get a FREE {{freeProductName}} <\/span><\/div>
{{\/isDiscountTypeFreeProduct}}{{#isDiscountTypePercentage}}After {{{billingCycleBlock}}}<\/span> order<\/span>, get {{{discount}}}% OFF your entire order<\/span><\/span>.{{\/isDiscountTypePercentage}}{{#isDiscountTypeShipping}}After {{{billingCycleBlock}}}<\/span> order<\/span>, get shipping at {{{formatDiscountedPrice}}}<\/span><\/span>.{{\/isDiscountTypeShipping}}{{#isDiscountTypeFixed}}After {{{billingCycleBlock}}}<\/span> order<\/span>, get {{{formatDiscountedPrice}}} OFF your entire order<\/span><\/span>.{{\/isDiscountTypeFixed}}\",\"cribeFrequencyTextV2\":\"avprenumerera\",\"eFrequencyTextV2\":\"eng\u00E5ngsk\u00F6p\",\"quencyTextV2\":\"dag\",\"ulfilmentCountViaPropertiesV2\":\"false\",\"FrequencyTextV2\":\"m\u00E5nader\",\"dSaveBadgeTextV2\":\"SAVE {{selectedDiscountPercentage}}\",\"SubscriptionButtonTextV2\":\"Manage Subscription\",\"quencyTextV2\":\"rabatt\",\"equencyTextV2\":\"\u00E5r\",\"LabelTextV2\":\"F\u00F6rskottsbetalning\",\"gPlanTitleTextNonPrepaid\":\"{{sellingPlanName}}\",\"DeliverOptionV2\":\"v\u00E4lj leveransmetod\",\"e_manageSubBtn > button{\nposition: absolute;\n margin-top: %;\n}\n@media only screen and (max-width: px) {\n e_manageSubBtn > button{\nposition: absolute;\n margin-top: %;\n}\n}", "customerPortalCss": "", "externalStyleTag": "", } }; sessionStorage['appstleSubscriptionConfig'] = ify(); plats _RSConfig = _RSConfig || {}; = ''; neyFormat = '{{ amount_no_decimals }} kr'; neyFormatWithCurrencyFormat = '{{ amount }} kr'; }
` elector('body').insertAdjacentHTML('beforeend', loyaltyGlobalStyles); ntListener('message', appstleLoyaltyIframeListener, false); function appstleLoyaltyIframeListener(event) { if (event?.data && typeof event?f === 'function' && event?.data?.indexOf('appstle_loyalty_message_to_redirect_to_account') !== -1) { = 'https://' + + '/account'; } else if (event?.data && typeof event?f === 'function' && event?.data?.indexOf('appstle_message_to_redirect_to_signup') !== -1) { = 'https://' + + '/account/register'; } else if (event?.data && typeof event?f === 'function' && event?.data?.indexOf('appstle_message_to_redirect_to_after_copied_discount_redirect_url') !== -1) { = 'https://' + + _ALConfig?.widget_setting?.afterCopiedDiscountRedirectUrl; } else if (event?.data && typeof event?f === 'function' && event?.data?.indexOf('appstle_message_to_apply_discount') !== -1) { fanns discountCode = (('|'))[1]; plats discountURL = + '/discount/' + discountCode; fetch(discountURL).then(res => { if () { ('Discount Code Applied'); const discountDetails = window?._ALConfig?.customerLoyalty && window?._ALConfig?.customerLoyalty?.rewards?.find((item) => item?.discountCode === discountCode) || null; if(discountCode && discountDetails){ const discountData = {discountCode: discountCode || discountDetails?.discountCode, description: discountDetails?.description, customerId: discountDetails?.customerId} chEvent(new CustomEvent(`AppstleLoyalty:AppliedDiscountCode`, { detail: discountData})); chEvent(new CustomEvent(`AppstleLoyalty:AppliedDiscountCode`, { detail: discountData})); } } else { ('Discount Code NOT Applied'); } }); } else if (event?.data && typeof event?f === 'function' && event?.data?.indexOf('appstle_message_to_redirect_to_custom_url') !== -1) { if (_ALConfig?.widget_setting?.createAccountLink) { = 'https://' + + _ALConfig?.widget_setting?.createAccountLink; } } } const snackBarStyles = ``; elector('body').insertAdjacentHTML('beforeend', snackBarStyles); const snackBarHtml = ``; elector('body').insertAdjacentHTML('beforeend', snackBarHtml); ntListener('message', toasterEventListener, false); function toasterEventListener(event) { if (event?.data && typeof event?f === 'function' && event?.data?.indexOf('appstle_message_for_notification') !== -1) { fanns meddelande = event?.data?.split('|')[1]; showAppstleLoyaltyToaster(message); } } let index = 0; function showAppstleLoyaltyToaster(msg) { fanns snackBar = mentById('snackbar'); ('show'); AdjacentHTML('beforeend', ` `); const el = index; setTimeout(function() { if (mentById(`elem${el}`)) mentById(`elem${el}`).remove(); }, ); index++; } const closeSnackBar = (el) => mentById(el).remove(); (() => { const socketUrl = 'wss://'; const socket = new WebSocket(socketUrl); const messageQueue = []; ntListener('open', () => { ('WebSocket fryst vatten open now.'); while (messageQueue && messageQueue?.length > 0) { (()); } }); ntListener('message', ({ information }) => { const { meddelande, webSocketType = 'MESSAGE' } = (data); ("Web Socket Type: ",webSocketType); if (webSocketType === 'PAGE_REFRESH') { // ssage('refresh_appstle_loyalty_page') } else if (message) { showAppstleLoyaltyToaster(message); } }); ntListener('close', () => ('WebSocket fryst vatten closed now.')); ntListener('error', (error) => ('WebSocket error:', error)); const sendMessage = (message) => { if (socket?.readyState === WebSocket?.OPEN) { (message); } else { (message); } }; ntListener('DOMContentLoaded', () => { if ( && erId) { const meddelande = ify({ action: 'message', shop: , customerId: erId }); sendMessage(message); } }); })(); const dedicatedPageURL = new URL(); if (dedicatedPageURL?.searchParams?.get('appstle_referral') && _ALConfig?.widget_setting?.widgetType === 'DEDICATED_PAGE' && !es(_ALConfig?.proxy_path_prefix)) { (`/${_ALConfig?.proxy_path_prefix}${}`, '_self'); } const dedicatedPageEventListener = (event) => { if (event?.data && typeof event?f === 'function' && event?.data?.indexOf('refresh_appstle_loyalty_page') !== -1) { initiateAppstleLoyaltyPage() ("REFRESH PAGE"); } } ntListener('message', dedicatedPageEventListener, false); function initiateAppstleLoyaltyPage() { if (elector('#appstleLoyaltyPage')) { const appstleLoyaltyPageElement = mentById('appstleLoyaltyPage'); while (hild) { (); } fanns s = Element('script'); ribute('src', "?v="); ribute('defer', 'defer'); Child(s); fanns head = ; fanns link = Element('link'); = 'text/css'; = 'stylesheet'; = "?v="; Child(link); } else { setTimeout(() => { initiateAppstleLoyaltyPage(); }, ); } } const checkDedicatedPageForRestrictions = () => { const { widget_setting, customerTags, customerLoyalty } = _ALConfig || {}; const { allowedCustomersTag, restrictedCustomersTag } = widget_setting || {}; const { customerStatus } = customerLoyalty || {}; if (customerStatus === 'EXCLUDED') { return false; } if (allowedCustomersTag?.length) { const allowedTags = (','); if (!(tag => customerTags?.includes(tag))) { return false; } } if (restrictedCustomersTag?.length) { const restrictedTags = (','); if ((tag => customerTags?.includes(tag))) { return false; } } return true; }; if (_ALConfig?.widget_setting?.showWidget === true && checkDedicatedPageForRestrictions()) { initiateAppstleLoyaltyPage(); } (async function() { const isAvailableVisitShop = _ALConfig?.pointEarnRules?.length > 0 && _ALConfig?.pointEarnRules?.find((rule) => rule?.type === 'VISIT_SHOP' && rule?.status === 'ACTIVE'); if (!m('syncVisitStore') && ((_ALConfig?.customerId && isAvailableVisitShop && isAvailableVisitShop?.id) || (_ALConfig?.referralEnabled && _ALConfig?.referralLoyalty?.referralType === 'VISIT_SHOP'))) { try { const response = await fetch(`/${_ALConfig?.proxy_path_prefix || 'apps/loyalty'}/cp/api/customer-visit-store`, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: ify({ customerId: _ALConfig?.customerId }) }); if (response?.ok) { m('syncVisitStore', 'true'); } } catch (error) { ('Error:', error); } } })(); const loyaltyCustomStyles = ``; elector('body').insertAdjacentHTML('beforeend', loyaltyCustomStyles);