CHAMPRO ORDERING INSTRUCTIONS

`; document.querySelector('body').insertAdjacentHTML('beforeend', mainHTMLString); window.addEventListener('message', widgetEventListener, false); function widgetEventListener(event) { if (event?.data && typeof event?.data.indexOf === 'function' && event?.data?.indexOf('appstle_message_for_showWidget') !== -1) { } else if (event?.data && typeof event?.data.indexOf === 'function' && event?.data?.indexOf('appstle_widget_showHide') !== -1) { document.querySelector('#appstle-loyalty-button')?.classList?.remove('appstle-loyalty-hidden'); toggleWidget(); } else if (event?.data && typeof event?.data.indexOf === 'function' && event?.data?.indexOf('refresh_appstle_loyalty_widget') !== -1 && _ALConfig?.widget_setting?.widgetType === 'LAUNCHER') { loadAppstleLoyaltyWidget(); console.log('REFRESH WIDGET'); } } function removeAppstleLoyaltyWidget() { document.querySelector('#appstle-loyalty-button')?.classList?.add('appstle-loyalty-hidden'); document.querySelector('#appstle_loyalty_iframe')?.classList?.add('appstle-loyalty-hidden'); } (function checkForWidgetRestrictions() { let isShowWidget = true; if (_ALConfig?.customerLoyalty?.customerStatus === 'EXCLUDED') { isShowWidget = false; } if (!_ALConfig?.customerId) { isShowWidget = !(_ALConfig?.widget_setting?.restrictedCustomersTag || _ALConfig?.widget_setting?.allowedCustomersTag); } if (_ALConfig?.widget_setting?.allowedCustomersTag?.length && isShowWidget) { let allowedTags = _ALConfig?.widget_setting?.allowedCustomersTag.split(','); if (allowedTags?.length > 0 && !_ALConfig?.customerTags?.some((tag) => allowedTags?.some((allowedTag) => allowedTag?.trim()?.toLowerCase() === tag?.trim()?.toLowerCase()))) { isShowWidget = false; } } if (_ALConfig?.widget_setting?.restrictedCustomersTag?.length && isShowWidget) { let restrictedTags = _ALConfig?.widget_setting?.restrictedCustomersTag?.split(','); if (restrictedTags?.length > 0 && _ALConfig?.customerTags?.some((tag) => restrictedTags?.some((restrictedTag) => restrictedTag?.trim()?.toLowerCase() === tag?.trim()?.toLowerCase()))) { isShowWidget = false; } } if (_ALConfig?.widget_setting?.blockWidgetOnPages?.length && isShowWidget) { let restrictedPages = _ALConfig?.widget_setting?.blockWidgetOnPages?.split(','); const currentPage = window?.location?.pathname; if (restrictedPages?.length > 0) { if (restrictedPages?.includes('/homepage') && currentPage === '/') { isShowWidget = false; } else if (restrictedPages?.some((page) => currentPage?.includes(page))) { isShowWidget = false; } } } if (_ALConfig?.widget_setting?.allowWidgetOnSpecificPages?.length && isShowWidget) { let allowedPages = _ALConfig?.widget_setting?.allowWidgetOnSpecificPages?.split(','); const currentPage = window?.location?.pathname; if (allowedPages?.length > 0) { if (allowedPages?.includes('/homepage') && currentPage === '/') { isShowWidget = true; } else if (allowedPages?.some((page) => currentPage?.includes(page))) { isShowWidget = true; } else { isShowWidget = false; } } } if (!_ALConfig?.customerId && _ALConfig?.widget_setting?.showToLoggedInCustomerOnly) { isShowWidget = false; } if (isShowWidget) { showAppstleLoyaltyWidget(); } else { removeAppstleLoyaltyWidget(); } })(); function enableWidget() { document.querySelector('#appstle_loyalty_iframe')?.classList?.add('open'); document.querySelector('#appstle_loyalty_iframe')?.classList?.remove('appstle-loyalty-hidden'); setTimeout(function() { document.querySelector('#appstle_loyalty_iframe')?.classList?.toggle('show-close-icon'); }, 900); } function showAppstleLoyaltyWidget() { document.querySelector('#appstle-loyalty-button')?.classList?.remove('appstle-loyalty-hidden'); document.querySelector('#appstle_loyalty_iframe')?.classList?.remove('appstle-loyalty-hidden'); } document.querySelector('.appstle-loyalty-button').addEventListener('click', toggleWidget); if (_ALConfig?.widget_setting?.widgetPosition === 'LEFT') { document.getElementById('appstle_loyalty_iframe')?.classList?.add('appstle-loyalty-left'); document.querySelector('.appstle-loyalty-button')?.classList?.add('appstle-loyalty-left'); document.getElementById('appstle_loyalty_iframe')?.classList?.add('appstle-loyalty-left'); document.getElementById('snackbar')?.classList?.add('left_snackbar'); } else { document.getElementById('appstle_loyalty_iframe')?.classList?.add('appstle-loyalty-right'); document.querySelector('.appstle-loyalty-button')?.classList?.add('appstle-loyalty-right'); document.getElementById('snackbar')?.classList?.add('right_snackbar'); } const alIframeSrc = `