Ask the Bum - Help Center | Sun Bum (2025)

ShopDiscoverSun Education

Ask the Bum

0
  • About Us
  • Find a Store
  • Subscriptions
  • Log In / Create an Account

Free Daily Gel Sample in Every Order

{{/if}} {{#if text}}

{{ text }}

{{/if}}

Sign up and we'll let ya know when this product is back in stock.

You're in! We'll be in touch.

We don't share your information with others. Privacy Policy

${d?I:b}
`,E=document.createRange().createContextualFragment(j),q=E.querySelector("#rippleFect-container");if(E.querySelector("#ripplFectButton")?.addEventListener("click",H),E.querySelector("#rippleRewardBtnClose")?.addEventListener("click",J),E.querySelector("#hideRediemBtn")?.addEventListener("click",function(t){t.stopPropagation(),n.classList.add("hide-rediem-btn"),sessionStorage.setItem("hideRediemBtn","true")}),f&&g==v?.uniqueCode){n.appendChild(E);return}if(!(v?.programStatus==="active"&&!v?.finishLater))return;let R=await M(d,s);if(d&&(!R||!["active","delete"].includes(R?.status)))return;let F={...R};delete F?.token,delete F?.tags,q.dataset.user=JSON.stringify(R),n.appendChild(E);let D=document.getElementById("RippleRewards");if(D&&R?.token){let B=new URL(D.src);B.searchParams.set("customerId",d),B.searchParams.set("email",c),B.searchParams.set("firstName",l),B.searchParams.set("lastName",p),B.searchParams.set("token",R?.token),B.searchParams.set("status",R?.status),D.src=B.toString()}if(Q(v?.embedLink),v?.tierStatus=="active"&&R?.freeShipping&&R?.couponCode){var A;V(R?.couponCode)}if(R?.token){let O=JSON.parse(sessionStorage.getItem("ripplRewardData")??"{}");O?.rdashtrigger&&H(),R?.widgetSignup||z({user:R}).then(()=>{sessionStorage.removeItem("ripplRewardData")}).catch(t=>{console.warn("Error updating customer:",t)})}let W=document.querySelectorAll(`a[href="${v?.embedLink}"]`);async function M(t,r){if(!t||!r)return null;let a=`user_${t}_${r}`,i=0;for(;i<6;){let n=3===i?"&retry=true":"",o=`${e}/v1/getcustomer?userId=${encodeURIComponent(t)}&shop=${encodeURIComponent(r)}${n}`;try{let s=await fetch(o,{method:"GET",headers:{"Content-Type":"application/json"}});if(s.ok){let{data:d}=await s.json();return sessionStorage.setItem(a,JSON.stringify({data:d,timestamp:Date.now()})),d}if(404===s.status){let c=await s.json();if("User not found"===c.message)throw Error("User not found")}}catch(l){console.error(`Attempt ${i+1}: ${l.message}`),await new Promise(t=>setTimeout(t,1500))}i++}return null}async function z({user:t}){try{await fetch(`${e}/v1/getcustomer?shop=${s}`,{headers:{"Content-Type":"application/json"},method:"PATCH",body:JSON.stringify({email:t?.email,data:{widgetSignup:!0}})})}catch(r){return console.error(`Error in API request: ${r.message}`),null}}async function U(t){if(!t)return null;let r=`setting_${t}`;try{let a=await fetch(`${e}/v1/getsettings?shopDomain=${encodeURIComponent(t)}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!a.ok)return console.error("Failed to fetch settings:",a.status,a.statusText),null;let{data:i}=await a.json();if(i)return sessionStorage.setItem(r,JSON.stringify({data:i,timestamp:Date.now()})),i}catch(n){console.error("Error fetching settings:",n)}return null}async function N(t){try{let r=await fetch(`${e}/activity?shop=${s}&customerId=${d}`,{method:"POST",body:JSON.stringify(t)});r.ok||console.error("Activity tracking failed:",r.statusText)}catch(a){console.error({activityError:a})}}async function G(t){if(!t)return null;try{let r=await fetch(`${e}/public/action/type?shop=${encodeURIComponent(t)}&type=6`);if(!r.ok)return;let a=await r.json(),i=window.location.href,n=i.endsWith("/")?i.slice(0,-1):i,o=a?.data?.find(t=>{let e=t?.trackingLink?.endsWith("/")?t?.trackingLink.slice(0,-1):t?.trackingLink;return e===n});return o&&sessionStorage.setItem("link_actions",JSON.stringify(o)),!1}catch(s){}}function H(t){let e=document.querySelector(".ripple-frame-container"),r=document.querySelector("#rippleFect-container"),a=e?.classList.contains("show");if(a){if(t)return;e?.classList.remove("show"),r?.classList.remove("widget-open"),n.classList.remove("rippl-widget--open")}else d&&N({type:"dash-view",docId:void 0}),e?.classList.add("show"),r?.classList.add("widget-open"),n.classList.add("rippl-widget--open")}function J(){let t=document.querySelector(".ripple-frame-container"),e=document.querySelector("#rippleFect-container"),r=document.querySelector("body");t?.classList.remove("show"),e?.classList.remove("widget-open"),r?.classList.remove("rippl-widget--open")}function Y(e,r="cartUpdated"){let a=document.getElementById("RippleRewards"),i={type:r,data:e,..."cartUpdated"===r&&{cart:e}};a?.contentWindow.postMessage(i,t)}function K(e){let r=document.getElementById("RippleRewards");r?.contentWindow.postMessage(e,t)}function Q(t){let e=a.hash,r=t.replace("#",""),i="rediem_referral"!=e.replace("#","")&&window.location.hash.includes(r);i&&H()}async function V(t){if(t){sessionStorage.setItem("discount_code",t);try{await fetch(`/discount/${t}`)}catch(e){console.error("Error applying discount:",e)}}}async function X(){let t=sessionStorage.getItem("discount_code");if(t)try{let e=await fetch("/cart.js"),r=await e.json(),a=r.items.some(e=>e.discounts?.some(e=>e.title===t));a||await fetch(`/discount/${t}`)}catch(i){console.error("Error applying stored discount:",i)}}async function Z({products:t,subscription:e=!1}){let r=await tr(),a=sessionStorage.getItem("opt_type");try{let i=e?ta():ti();if(!i)return;if(i?.requiredPaidProduct){let n=tn({cartItems:r,freeProducts:i});if(!n)return}if(i?.perCartLimit){let o=to({cartItems:r,freeProducts:i});if(o)return}let s=r.map(t=>t.variant_id),d=t.filter(t=>!s.includes(t.variantId));if(0===d.length)throw Error("Product already in cart!");let c=d.map(async t=>{let e=new URLSearchParams,r=t.variantId;e.append("id",r),e.append("quantity",t.quantity);let a=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:e.toString()});if(!a.ok){let i=await a.json();throw Error(`${i?.message}: ${i?.description}`)}return a});await Promise.all(c),r=await tr();let l=r?.find(t=>t.discounts.length>0)?.discounts[0].title??null,p=i?.perCartLimit?i?.productData.filter(e=>t.some(t=>t.variantId===e.varientId)):i?.productData.filter(t=>r.some(e=>e.variant_id===t.varientId)),u=i?.productDocId,m="addProductToCartSubscription"==a?p.map(t=>t.docId):p.map(t=>t.productDocId),h=e?await ts({freeProductsData:i,productDocIds:m,couponCode:l}):await td({freeProductsData:i,productDocIds:m,couponCode:l,currProdId:u});h?window.location.href="/cart":(Y({message:"Failed to generate coupon",items:r}),console.error("Failed to generate coupon"))}catch(g){console.error(g.message),Y({message:g?.message??"Failed to add product to cart!",items:r})}}async function tt({products:t}){try{let e=t.map(async t=>{let e=new URLSearchParams,r=t.product?.split("/")?.at(-1);e.append("id",r),e.append("quantity",1);let a=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:e.toString()});if(!a.ok){let i=await a.json();throw Error(`${i?.message}: ${i?.description}`)}return a});await Promise.all(e),window.location.href="/cart"}catch(r){console.error(r.message),Y({message:r?.message??"Failed to add product to cart!"})}}async function te({cartJson:t,freeProduct:e}){let r=[],a=t?.items?.filter(t=>e?.productData?.find(e=>e?.varientId==t.variant_id));a?.length>0&&a.forEach(t=>{t.quantity>1&&r.push({id:t.variant_id,quantity:1})}),r.length>0&&(alert("Only single quantity is allowed!"),await Promise.all(r.map(t=>{let e=new URLSearchParams;return e.append("id",t.id),e.append("quantity",t.quantity),fetch("/cart/change.js",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:e.toString()})})),location.reload())}async function tr(){let t=await fetch("/cart.js");if(!t.ok)throw Error("Failed to fetch cart contents");let e=await t.json();return e.items}function ta(){let t=sessionStorage.getItem("freeProductsSubscription");if(!t)throw Error("Something went wrong!");return JSON.parse(t)}function ti(){let t=sessionStorage.getItem("freeProducts");if(!t)throw Error("Something went wrong!");return JSON.parse(t)}function tn({cartItems:t,freeProducts:e,error:r=!0}){let a=t?.filter(t=>e?.productData?.find(e=>e?.varientId!=t.variant_id));if(a?.length<1){if(r)throw Error("To redeem a free product, you must add a paid product to cart!");tc(t)}return!0}function to({cartItems:t,freeProducts:e}){let r=t?.filter(t=>e?.productData?.find(e=>e?.varientId==t.variant_id));if(r?.length>0)throw Error("You can only add one free product!");return!1}async function ts({freeProductsData:t,couponCode:e}){let a=new Headers;a.append("Authorization",`Bearer ${t?.token}`),a.append("Content-Type","application/json");let i={method:"POST",headers:a,body:JSON.stringify({id:t?.docId,couponCode:e}),redirect:"follow"};try{let n=await fetch(`${r}/waysToEarn/subscription/`,i);if(!n.ok)return console.error("Failed to generate coupon:",n.statusText),!1;{let o=await n.json();return await V(o?.data?.couponCode),!0}}catch(s){console.error("Error generating coupon:",s)}}async function td({freeProductsData:t,productDocIds:e,couponCode:a,currProdId:i}){let n=new Headers;n.append("Authorization",`Bearer ${t?.token}`),n.append("Content-Type","application/json");let o={method:"POST",headers:n,body:JSON.stringify({actionDocId:t?.actionDocId,productDocId:e,couponCode:a,productId:i}),redirect:"follow"};try{let s=await fetch(`${r}/waysToRedeem/free_product/`,o);if(!s.ok)return console.error("Failed to generate coupon:",s.statusText),!1;{let d=await s.json();return await V(d.coupon),!0}}catch(c){return console.error("Error generating coupon:",c),!1}}async function tc(t){try{for(let e of t){let r=new URLSearchParams;r.append("id",e.id),r.append("quantity",0);let a=await fetch("/cart/change.js",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:r.toString()});a.ok||console.error("Error removing item:",e.id)}location.reload()}catch(i){console.error("Error removing items:",i)}}W&&W.length>0&&W.forEach(t=>{t.addEventListener("click",function(t){t.preventDefault(),H()})}),G(s);let tl=window.fetch;window.fetch=async function(...t){try{let e=await tl.apply(this,t),r=t?.[0]??e?.url;if(r){let a=u.some(t=>r.includes(t));if(a)try{let i=e.clone(),n=await i.json();if(n?.items?.length>0){let o=sessionStorage.getItem("opt_type");if(o){let s="addProductToCart"===o?ti():"addProductToCartSubscription"===o?ta():null;s?.requiredPaidProduct&&tn({cartItems:n?.items,freeProducts:s,error:!1}),s?.perCartLimit&&await te({cartJson:n,freeProduct:s})}}}catch(d){console.error("Error in custom cart handling:",d)}}return e}catch(c){throw console.error("Fetch error:",c),c}},window.addEventListener("message",t=>{if("openRipplUrl"===t.data.type&&window.open(t.data.url,"_blank"),"ripplRewardSaveData"===t.data.type&&sessionStorage.setItem("ripplRewardData",JSON.stringify(t.data.data)),"addProductToCart"===t.data.type&&(sessionStorage.setItem("freeProducts",JSON.stringify(t.data?.data)),sessionStorage.setItem("opt_type",t.data.type),Z({products:t.data.products})),"addProductToCartSubscription"===t.data.type&&(sessionStorage.setItem("freeProductsSubscription",JSON.stringify(t.data?.data)),sessionStorage.setItem("opt_type",t.data.type),Z({products:t.data.products,subscription:!0})),"exclusiveProduct"===t.data.type&&tt({products:[t.data.item]}),"trigger_wiget_open"===t.data.type&&H(!0),"access_session_data"===t.data.type){let e=t.data.key,r=JSON.parse(sessionStorage.getItem(e)??"{}");if("link_actions"===e){let a=window.location.href,i=a?.endsWith("/")?a.slice(0,-1):a,n=r?.trackingLink?.endsWith("/")?r?.trackingLink?.slice(0,-1):r?.trackingLink;i===n&&Y(r,e)}else Y(r,e)}if(t.data?.type==="rdm_request_user"){let o=document.getElementById("rippleFect-container"),s=JSON.parse(o?.dataset.user||"{}");console.log({user:s}),K({type:"rdm_user_data",payload:{user:s}})}if(t.data?.type==="rdm_request_settings"){let d=document.getElementById("rippleFect-container"),c=JSON.parse(d?.dataset.settings||"{}");K({type:"rdm_setting_data",payload:{settings:c}})}}),X()};document.addEventListener("DOMContentLoaded",rediemWidgetLoadFn);
Ask the Bum - Help Center | Sun Bum (2025)
Top Articles
Latest Posts
Recommended Articles
Article information

Author: Van Hayes

Last Updated:

Views: 6421

Rating: 4.6 / 5 (66 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Van Hayes

Birthday: 1994-06-07

Address: 2004 Kling Rapid, New Destiny, MT 64658-2367

Phone: +512425013758

Job: National Farming Director

Hobby: Reading, Polo, Genealogy, amateur radio, Scouting, Stand-up comedy, Cryptography

Introduction: My name is Van Hayes, I am a thankful, friendly, smiling, calm, powerful, fine, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.