@ikas/bp-storefront 0.90.0 → 0.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e,__assign as n}from'./../../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as r}from"../../packages/storefront-config/src/index.js";import{getSelectedProductVariant as i}from"../../functions/models/product/index.js";import{getCookieValue as s}from"../../utils/helper.js";import"../../router/index.js";import"../../stores/cart/index.js";import{getCategoryPath as o}from"../../functions/models/category/index.js";import{customerStore as c}from"../../stores/customer/index.js";import'./../../ext/uuid/dist/esm-browser/stringify.js';import'./../../ext/uuid/dist/esm-browser/v3.js';import'./../../ext/uuid/dist/esm-browser/native.js';import'./../../ext/uuid/dist/esm-browser/v5.js';import"../../i18n/index.js";import"../../functions/models/product-list/index.js";import{getProductVariantPrice as u,getProductVariantFinalPrice as d}from"../../functions/models/product/variant/index.js";import{baseStore as a}from"../../stores/base/index.js";import{waitForCustomerStoreInit as l}from"../../functions/stores/customer/index.js";import"../analytics.js";import'./../../ext/animejs/lib/anime.esm.js';import"../../packages/storefront-api-client/src/utils/api.js";import'./../../ext/isomorphic-fetch/fetch-npm-node.js';import"../../packages/storefront-api/src/index.js";import"../../theme/styles/index.js";import'./../../ext/preact/dist/preact.mjs.js';import'./../../ext/preact/hooks/dist/hooks.mjs.js';import"../../utils/fetch.js";import"../../packages/storefront-models/src/models/merchant-settings/index.js";var E,O;!function(t){t[t.SESSION_START=1]="SESSION_START",t[t.PAGE_VIEW=2]="PAGE_VIEW",t[t.PRODUCT_VIEW=3]="PRODUCT_VIEW",t[t.ADD_TO_CART=4]="ADD_TO_CART",t[t.VIEW_CART=5]="VIEW_CART",t[t.ORDER_SUCCESS=6]="ORDER_SUCCESS",t[t.BEGIN_CHECKOUT=7]="BEGIN_CHECKOUT",t[t.CHECKOUT_STEP=8]="CHECKOUT_STEP",t[t.CUSTOMER_REGISTER=9]="CUSTOMER_REGISTER",t[t.CUSTOMER_VISIT=10]="CUSTOMER_VISIT",t[t.CUSTOMER_LOGIN=11]="CUSTOMER_LOGIN",t[t.BRAND_VIEW=12]="BRAND_VIEW",t[t.CATEGORY_VIEW=13]="CATEGORY_VIEW",t[t.POPUP_VIEW=14]="POPUP_VIEW",t[t.SEARCH=15]="SEARCH",t[t.FAVORITE_PRODUCT=16]="FAVORITE_PRODUCT",t[t.CONTACT_FORM=17]="CONTACT_FORM",t[t.CONTACT_FORM_BACKEND=205]="CONTACT_FORM_BACKEND"}(E||(E={})),function(t){t[t.INDEX=1]="INDEX",t[t.CATEGORY=2]="CATEGORY",t[t.BRAND=3]="BRAND",t[t.PRODUCT=4]="PRODUCT",t[t.CUSTOM=5]="CUSTOM",t[t.ACCOUNT=6]="ACCOUNT",t[t.ADDRESSES=7]="ADDRESSES",t[t.ORDERS=8]="ORDERS",t[t.ORDER_DETAIL=9]="ORDER_DETAIL",t[t.LOGIN=10]="LOGIN",t[t.REGISTER=11]="REGISTER",t[t.FORGOT_PASSWORD=12]="FORGOT_PASSWORD",t[t.RECOVER_PASSWORD=13]="RECOVER_PASSWORD",t[t.CART=14]="CART",t[t.FAVORITE_PRODUCTS=15]="FAVORITE_PRODUCTS",t[t.SEARCH=16]="SEARCH",t[t.NOT_FOUND=17]="NOT_FOUND",t[t.BLOG=18]="BLOG",t[t.BLOG_INDEX=19]="BLOG_INDEX",t[t.BLOG_CATEGORY=20]="BLOG_CATEGORY",t[t.CHECKOUT=21]="CHECKOUT"}(O||(O={}));var R=import.meta.env.VITE_PUBLIC_ANALYTICS_URL?"".concat(import.meta.env.VITE_PUBLIC_ANALYTICS_URL,"/sendEventV2"):"https://0.myikas.com/sendEventV2",f=function(){function t(){}return t.SESSION_ID_KEY="ikas_session_id",t.VISITOR_ID_KEY="ikas_visitor_id",t.JOURNEY_ID_KEY="ikas_journey_id",t.EXPIRY_LENGTH=18e5,t}();function _(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.PAGE_VIEW,ts:Date.now(),d:n(n({},F()),{pt:B(r)})}])];case 1:return t.sent(),[2]}})})}function T(r,s){return t(this,void 0,void 0,function(){var t,c,a,l;return e(this,function(e){switch(e.label){case 0:return t=[],c=[],r.categories&&r.categories.length>0&&o(r.categories[0]).map(function(e){t.push(e.name),c.push(e.id)}),a=i(r),l=u(a),[4,M([{id:s,t:E.PRODUCT_VIEW,ts:Date.now(),d:n(n({},F()),{d:n({pr:n({id:r.id,vid:a.id,cp:t,cid:c,n:r.name,pr:d(a)},(null==l?void 0:l.currency)?{c:null==l?void 0:l.currency}:{})},r.brand?{br:{id:r.brand.id}}:{})})}])];case 1:return e.sent(),[2]}})})}function I(r,i,s){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:s,t:E.ADD_TO_CART,ts:Date.now(),d:n(n({},F()),{d:{crt:{id:i.id,c:i.currencyCode,pr:i.totalFinalPrice,il:K(i)},crtItm:H(r)}})}])];case 1:return t.sent(),[2]}})})}function C(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.VIEW_CART,ts:Date.now(),d:n(n({},F()),{d:{crt:{id:r.id,c:r.currencyCode,pr:r.totalFinalPrice,il:K(r)}}})}])];case 1:return t.sent(),[2]}})})}function v(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.ORDER_SUCCESS,ts:Date.now(),d:n(n({},F()),{d:{chk:{id:r.id,s:"success",p:r.totalFinalPrice,c:r.currencyCode,il:K(r)}}})}])];case 1:return t.sent(),[4,V()];case 2:return t.sent(),[2]}})})}function S(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.BEGIN_CHECKOUT,ts:Date.now(),d:n(n({},F()),{d:{chk:{id:r.id,p:r.totalFinalPrice,c:r.currencyCode,il:K(r)}}})}])];case 1:return t.sent(),[2]}})})}function m(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.CHECKOUT_STEP,ts:Date.now(),d:n(n({},F()),{d:{chk:{id:r.id,s:i,p:r.totalFinalPrice,c:r.currencyCode,il:K(r)}}})}])];case 1:return t.sent(),[2]}})})}function h(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:r,t:E.CUSTOMER_REGISTER,ts:Date.now(),d:n(n({},F()),{d:{cst:W()}})}])];case 1:return t.sent(),[2]}})})}function D(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.CUSTOMER_LOGIN,ts:Date.now(),d:n(n({},F()),{d:{cst:W()}})}])];case 1:return t.sent(),[2]}})})}function p(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.CUSTOMER_VISIT,ts:Date.now(),d:n(n({},F()),{d:{cst:W()}})}])];case 1:return t.sent(),[2]}})})}function A(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.BRAND_VIEW,ts:Date.now(),d:n(n({},F()),{d:{cst:W(),br:{id:r.id}}})}])];case 1:return t.sent(),[2]}})})}function N(r,i,s){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:s,t:E.CATEGORY_VIEW,ts:Date.now(),d:n(n({},F()),{d:{cst:W(),ctg:{id:r.id,cp:i}}})}])];case 1:return t.sent(),[2]}})})}function U(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.POPUP_VIEW,ts:Date.now(),d:n(n({},F()),{d:{cst:W()},m:{sfpid:r}})}])];case 1:return t.sent(),[2]}})})}function P(r,i,s){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.SEARCH,ts:Date.now(),d:n(n({},F()),{d:{src:n({s:r},s?{r:s}:{})}})}])];case 1:return t.sent(),[2]}})})}function w(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:r,t:E.CONTACT_FORM,ts:Date.now(),d:n({},F())}])];case 1:return t.sent(),[2]}})})}function x(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.FAVORITE_PRODUCT,ts:Date.now(),d:n(n({},F()),{d:{pr:{id:r}}})}])];case 1:return t.sent(),[2]}})})}function G(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return localStorage.removeItem(f.JOURNEY_ID_KEY),f.journeyId=void 0,[4,b()];case 1:return t.sent(),[2]}})})}function b(){return t(this,void 0,void 0,function(){var t,n;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(t=localStorage.getItem(f.JOURNEY_ID_KEY))?(f.journeyId=t,[3,3]):[3,1];case 1:return[4,y()];case 2:e.sent(),e.label=3;case 3:return r.init({journeyId:f.journeyId||""}),[3,5];case 4:return n=e.sent(),console.error(n),[3,5];case 5:return[2]}})})}function j(){return t(this,void 0,void 0,function(){return e(this,function(t){return[2,"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})]})})}function V(){return t(this,void 0,void 0,function(){var t,n,r;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),r={},[4,j()];case 1:return r.id=e.sent(),r.expiry=Date.now()+f.EXPIRY_LENGTH,t=r,localStorage.setItem(f.SESSION_ID_KEY,JSON.stringify(t)),f.sessionId=t.id,[4,L()];case 2:return e.sent(),[3,4];case 3:return n=e.sent(),console.error(n),[3,4];case 4:return[2]}})})}function y(){return t(this,void 0,void 0,function(){var t;return e(this,function(e){switch(e.label){case 0:return[4,j()];case 1:return t=e.sent(),localStorage.setItem(f.JOURNEY_ID_KEY,t),f.journeyId=t,[2]}})})}function g(){return t(this,void 0,void 0,function(){var t,n,i;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,7,,8]),(t=localStorage.getItem(f.SESSION_ID_KEY))?(n=JSON.parse(t)).expiry<Date.now()||n.id.length<=13?[4,V()]:[3,2]:[3,4];case 1:return e.sent(),[3,3];case 2:f.sessionId=n.id,e.label=3;case 3:return[3,6];case 4:return[4,V()];case 5:e.sent(),e.label=6;case 6:return r.init({sessionId:f.sessionId||""}),[3,8];case 7:return i=e.sent(),console.error(i),[3,8];case 8:return[2]}})})}function L(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.SESSION_START,ts:Date.now(),d:n({},F())}])];case 1:return t.sent(),[2]}})})}function Y(){return t(this,void 0,void 0,function(){var t,n,i;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(t=localStorage.getItem(f.VISITOR_ID_KEY))&&t.length>13?(f.visitorId=t,[3,3]):[3,1];case 1:return n=f,[4,j()];case 2:n.visitorId=e.sent(),localStorage.setItem(f.VISITOR_ID_KEY,f.visitorId),e.label=3;case 3:return r.init({visitorId:f.visitorId}),[3,5];case 4:return i=e.sent(),console.error(i),[3,5];case 5:return[2]}})})}function B(t){switch(t){case"INDEX":return O.INDEX;case"CATEGORY":return O.CATEGORY;case"BRAND":return O.BRAND;case"PRODUCT":return O.PRODUCT;case"CUSTOM":return O.CUSTOM;case"ACCOUNT":return O.ACCOUNT;case"ADDRESSES":return O.ADDRESSES;case"ORDERS":return O.ORDERS;case"ORDER_DETAIL":return O.ORDER_DETAIL;case"LOGIN":return O.LOGIN;case"REGISTER":return O.REGISTER;case"FORGOT_PASSWORD":return O.FORGOT_PASSWORD;case"RECOVER_PASSWORD":return O.RECOVER_PASSWORD;case"CART":return O.CART;case"FAVORITE_PRODUCTS":return O.FAVORITE_PRODUCTS;case"SEARCH":return O.SEARCH;case"NOT_FOUND":return O.NOT_FOUND;case"BLOG":return O.BLOG;case"BLOG_INDEX":return O.BLOG_INDEX;case"BLOG_CATEGORY":return O.BLOG_CATEGORY;case"CHECKOUT":return O.CHECKOUT}}function W(){var t=c.customer;return{id:(null==t?void 0:t.id)||void 0,e:(null==t?void 0:t.email)||void 0,c:c._customerConsentGranted}}function F(){return{u:window.location.href,r:document.referrer,pt:a.currentPageType?B(a.currentPageType):void 0,m:{fbp:s("_fbp"),fbc:s("_fbc")}}}function K(t){return t.orderLineItems.map(function(t){return n(n(n(n({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})})}function H(t){return n(n(n(n({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})}function M(i){return t(this,void 0,void 0,function(){var t,s,o,u,d,a,E,O,_,T,I;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,6,,7]),[4,l(c)];case 1:return e.sent(),[4,g()];case 2:return e.sent(),[4,Y()];case 3:return e.sent(),[4,b()];case 4:return e.sent(),t={e:i,scid:r.salesChannelId,sfid:r.storefrontId,sid:f.sessionId,jid:f.journeyId,vid:f.visitorId,sfrid:r.storefrontRoutingId||"",ud:n(n(n(n({id:null===(o=c.customer)||void 0===o?void 0:o.id},(null===(u=c.customer)||void 0===u?void 0:u.email)?{em:null===(d=c.customer)||void 0===d?void 0:d.email}:{}),(null===(a=c.customer)||void 0===a?void 0:a.phone)?{ph:null===(E=c.customer)||void 0===E?void 0:E.phone}:{}),(null===(O=c.customer)||void 0===O?void 0:O.lastName)?{ln:null===(_=c.customer)||void 0===_?void 0:_.lastName}:{}),(null===(T=c.customer)||void 0===T?void 0:T.firstName)?{fn:null===(I=c.customer)||void 0===I?void 0:I.firstName}:{}),v:3},[4,fetch(R,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json","x-api-key":r.apiKey}})];case 5:return e.sent(),[3,7];case 6:return s=e.sent(),console.error(s),[3,7];case 7:return[2]}})})}export{f as default,I as iks_addToCart,x as iks_addToWishlist,S as iks_beginCheckout,b as iks_checkJourneyId,m as iks_checkoutStep,w as iks_contactForm,D as iks_customerLogin,h as iks_customerRegister,p as iks_customerVisit,_ as iks_pageView,T as iks_productView,v as iks_purchase,G as iks_refreshJourneyId,P as iks_search,A as iks_viewBrand,C as iks_viewCart,N as iks_viewCategory,U as iks_viewPopup};
|
|
1
|
+
import{__awaiter as t,__generator as e,__assign as n}from'./../../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as r}from"../../packages/storefront-config/src/index.js";import{getSelectedProductVariant as i}from"../../functions/models/product/index.js";import{getCookieValue as s}from"../../utils/helper.js";import"../../router/index.js";import"../../stores/cart/index.js";import{getCategoryPath as o}from"../../functions/models/category/index.js";import{customerStore as c}from"../../stores/customer/index.js";import'./../../ext/uuid/dist/esm-browser/stringify.js';import'./../../ext/uuid/dist/esm-browser/v3.js';import'./../../ext/uuid/dist/esm-browser/native.js';import'./../../ext/uuid/dist/esm-browser/v5.js';import"../../i18n/index.js";import'./../../ext/mobx/dist/mobx.esm.js';import"../../functions/models/product-list/index.js";import{getProductVariantPrice as u,getProductVariantFinalPrice as d}from"../../functions/models/product/variant/index.js";import{baseStore as a}from"../../stores/base/index.js";import{waitForCustomerStoreInit as l}from"../../functions/stores/customer/index.js";import"../analytics.js";import'./../../ext/animejs/lib/anime.esm.js';import"../../packages/storefront-api-client/src/utils/api.js";import'./../../ext/isomorphic-fetch/fetch-npm-node.js';import"../../packages/storefront-api/src/index.js";import"../../theme/styles/index.js";import'./../../ext/preact/dist/preact.mjs.js';import'./../../ext/preact/hooks/dist/hooks.mjs.js';import"../../utils/fetch.js";import"../../packages/storefront-models/src/models/merchant-settings/index.js";var E,O;!function(t){t[t.SESSION_START=1]="SESSION_START",t[t.PAGE_VIEW=2]="PAGE_VIEW",t[t.PRODUCT_VIEW=3]="PRODUCT_VIEW",t[t.ADD_TO_CART=4]="ADD_TO_CART",t[t.VIEW_CART=5]="VIEW_CART",t[t.ORDER_SUCCESS=6]="ORDER_SUCCESS",t[t.BEGIN_CHECKOUT=7]="BEGIN_CHECKOUT",t[t.CHECKOUT_STEP=8]="CHECKOUT_STEP",t[t.CUSTOMER_REGISTER=9]="CUSTOMER_REGISTER",t[t.CUSTOMER_VISIT=10]="CUSTOMER_VISIT",t[t.CUSTOMER_LOGIN=11]="CUSTOMER_LOGIN",t[t.BRAND_VIEW=12]="BRAND_VIEW",t[t.CATEGORY_VIEW=13]="CATEGORY_VIEW",t[t.POPUP_VIEW=14]="POPUP_VIEW",t[t.SEARCH=15]="SEARCH",t[t.FAVORITE_PRODUCT=16]="FAVORITE_PRODUCT",t[t.CONTACT_FORM=17]="CONTACT_FORM",t[t.CONTACT_FORM_BACKEND=205]="CONTACT_FORM_BACKEND"}(E||(E={})),function(t){t[t.INDEX=1]="INDEX",t[t.CATEGORY=2]="CATEGORY",t[t.BRAND=3]="BRAND",t[t.PRODUCT=4]="PRODUCT",t[t.CUSTOM=5]="CUSTOM",t[t.ACCOUNT=6]="ACCOUNT",t[t.ADDRESSES=7]="ADDRESSES",t[t.ORDERS=8]="ORDERS",t[t.ORDER_DETAIL=9]="ORDER_DETAIL",t[t.LOGIN=10]="LOGIN",t[t.REGISTER=11]="REGISTER",t[t.FORGOT_PASSWORD=12]="FORGOT_PASSWORD",t[t.RECOVER_PASSWORD=13]="RECOVER_PASSWORD",t[t.CART=14]="CART",t[t.FAVORITE_PRODUCTS=15]="FAVORITE_PRODUCTS",t[t.SEARCH=16]="SEARCH",t[t.NOT_FOUND=17]="NOT_FOUND",t[t.BLOG=18]="BLOG",t[t.BLOG_INDEX=19]="BLOG_INDEX",t[t.BLOG_CATEGORY=20]="BLOG_CATEGORY",t[t.CHECKOUT=21]="CHECKOUT"}(O||(O={}));var R=import.meta.env.VITE_PUBLIC_ANALYTICS_URL?"".concat(import.meta.env.VITE_PUBLIC_ANALYTICS_URL,"/sendEventV2"):"https://0.myikas.com/sendEventV2",f=function(){function t(){}return t.SESSION_ID_KEY="ikas_session_id",t.VISITOR_ID_KEY="ikas_visitor_id",t.JOURNEY_ID_KEY="ikas_journey_id",t.EXPIRY_LENGTH=18e5,t}();function _(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.PAGE_VIEW,ts:Date.now(),d:n(n({},F()),{pt:B(r)})}])];case 1:return t.sent(),[2]}})})}function T(r,s){return t(this,void 0,void 0,function(){var t,c,a,l;return e(this,function(e){switch(e.label){case 0:return t=[],c=[],r.categories&&r.categories.length>0&&o(r.categories[0]).map(function(e){t.push(e.name),c.push(e.id)}),a=i(r),l=u(a),[4,M([{id:s,t:E.PRODUCT_VIEW,ts:Date.now(),d:n(n({},F()),{d:n({pr:n({id:r.id,vid:a.id,cp:t,cid:c,n:r.name,pr:d(a)},(null==l?void 0:l.currency)?{c:null==l?void 0:l.currency}:{})},r.brand?{br:{id:r.brand.id}}:{})})}])];case 1:return e.sent(),[2]}})})}function I(r,i,s){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:s,t:E.ADD_TO_CART,ts:Date.now(),d:n(n({},F()),{d:{crt:{id:i.id,c:i.currencyCode,pr:i.totalFinalPrice,il:K(i)},crtItm:H(r)}})}])];case 1:return t.sent(),[2]}})})}function C(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.VIEW_CART,ts:Date.now(),d:n(n({},F()),{d:{crt:{id:r.id,c:r.currencyCode,pr:r.totalFinalPrice,il:K(r)}}})}])];case 1:return t.sent(),[2]}})})}function m(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.ORDER_SUCCESS,ts:Date.now(),d:n(n({},F()),{d:{chk:{id:r.id,s:"success",p:r.totalFinalPrice,c:r.currencyCode,il:K(r)}}})}])];case 1:return t.sent(),[4,V()];case 2:return t.sent(),[2]}})})}function v(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.BEGIN_CHECKOUT,ts:Date.now(),d:n(n({},F()),{d:{chk:{id:r.id,p:r.totalFinalPrice,c:r.currencyCode,il:K(r)}}})}])];case 1:return t.sent(),[2]}})})}function S(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.CHECKOUT_STEP,ts:Date.now(),d:n(n({},F()),{d:{chk:{id:r.id,s:i,p:r.totalFinalPrice,c:r.currencyCode,il:K(r)}}})}])];case 1:return t.sent(),[2]}})})}function h(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:r,t:E.CUSTOMER_REGISTER,ts:Date.now(),d:n(n({},F()),{d:{cst:W()}})}])];case 1:return t.sent(),[2]}})})}function D(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.CUSTOMER_LOGIN,ts:Date.now(),d:n(n({},F()),{d:{cst:W()}})}])];case 1:return t.sent(),[2]}})})}function p(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.CUSTOMER_VISIT,ts:Date.now(),d:n(n({},F()),{d:{cst:W()}})}])];case 1:return t.sent(),[2]}})})}function A(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.BRAND_VIEW,ts:Date.now(),d:n(n({},F()),{d:{cst:W(),br:{id:r.id}}})}])];case 1:return t.sent(),[2]}})})}function N(r,i,s){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:s,t:E.CATEGORY_VIEW,ts:Date.now(),d:n(n({},F()),{d:{cst:W(),ctg:{id:r.id,cp:i}}})}])];case 1:return t.sent(),[2]}})})}function U(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.POPUP_VIEW,ts:Date.now(),d:n(n({},F()),{d:{cst:W()},m:{sfpid:r}})}])];case 1:return t.sent(),[2]}})})}function P(r,i,s){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.SEARCH,ts:Date.now(),d:n(n({},F()),{d:{src:n({s:r},s?{r:s}:{})}})}])];case 1:return t.sent(),[2]}})})}function x(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:r,t:E.CONTACT_FORM,ts:Date.now(),d:n({},F())}])];case 1:return t.sent(),[2]}})})}function w(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.FAVORITE_PRODUCT,ts:Date.now(),d:n(n({},F()),{d:{pr:{id:r}}})}])];case 1:return t.sent(),[2]}})})}function G(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return localStorage.removeItem(f.JOURNEY_ID_KEY),f.journeyId=void 0,[4,b()];case 1:return t.sent(),[2]}})})}function b(){return t(this,void 0,void 0,function(){var t,n;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(t=localStorage.getItem(f.JOURNEY_ID_KEY))?(f.journeyId=t,[3,3]):[3,1];case 1:return[4,y()];case 2:e.sent(),e.label=3;case 3:return r.init({journeyId:f.journeyId||""}),[3,5];case 4:return n=e.sent(),console.error(n),[3,5];case 5:return[2]}})})}function j(){return t(this,void 0,void 0,function(){return e(this,function(t){return[2,"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})]})})}function V(){return t(this,void 0,void 0,function(){var t,n,r;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),r={},[4,j()];case 1:return r.id=e.sent(),r.expiry=Date.now()+f.EXPIRY_LENGTH,t=r,localStorage.setItem(f.SESSION_ID_KEY,JSON.stringify(t)),f.sessionId=t.id,[4,L()];case 2:return e.sent(),[3,4];case 3:return n=e.sent(),console.error(n),[3,4];case 4:return[2]}})})}function y(){return t(this,void 0,void 0,function(){var t;return e(this,function(e){switch(e.label){case 0:return[4,j()];case 1:return t=e.sent(),localStorage.setItem(f.JOURNEY_ID_KEY,t),f.journeyId=t,[2]}})})}function g(){return t(this,void 0,void 0,function(){var t,n,i;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,7,,8]),(t=localStorage.getItem(f.SESSION_ID_KEY))?(n=JSON.parse(t)).expiry<Date.now()||n.id.length<=13?[4,V()]:[3,2]:[3,4];case 1:return e.sent(),[3,3];case 2:f.sessionId=n.id,e.label=3;case 3:return[3,6];case 4:return[4,V()];case 5:e.sent(),e.label=6;case 6:return r.init({sessionId:f.sessionId||""}),[3,8];case 7:return i=e.sent(),console.error(i),[3,8];case 8:return[2]}})})}function L(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.SESSION_START,ts:Date.now(),d:n({},F())}])];case 1:return t.sent(),[2]}})})}function Y(){return t(this,void 0,void 0,function(){var t,n,i;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(t=localStorage.getItem(f.VISITOR_ID_KEY))&&t.length>13?(f.visitorId=t,[3,3]):[3,1];case 1:return n=f,[4,j()];case 2:n.visitorId=e.sent(),localStorage.setItem(f.VISITOR_ID_KEY,f.visitorId),e.label=3;case 3:return r.init({visitorId:f.visitorId}),[3,5];case 4:return i=e.sent(),console.error(i),[3,5];case 5:return[2]}})})}function B(t){switch(t){case"INDEX":return O.INDEX;case"CATEGORY":return O.CATEGORY;case"BRAND":return O.BRAND;case"PRODUCT":return O.PRODUCT;case"CUSTOM":return O.CUSTOM;case"ACCOUNT":return O.ACCOUNT;case"ADDRESSES":return O.ADDRESSES;case"ORDERS":return O.ORDERS;case"ORDER_DETAIL":return O.ORDER_DETAIL;case"LOGIN":return O.LOGIN;case"REGISTER":return O.REGISTER;case"FORGOT_PASSWORD":return O.FORGOT_PASSWORD;case"RECOVER_PASSWORD":return O.RECOVER_PASSWORD;case"CART":return O.CART;case"FAVORITE_PRODUCTS":return O.FAVORITE_PRODUCTS;case"SEARCH":return O.SEARCH;case"NOT_FOUND":return O.NOT_FOUND;case"BLOG":return O.BLOG;case"BLOG_INDEX":return O.BLOG_INDEX;case"BLOG_CATEGORY":return O.BLOG_CATEGORY;case"CHECKOUT":return O.CHECKOUT}}function W(){var t=c.customer;return{id:(null==t?void 0:t.id)||void 0,e:(null==t?void 0:t.email)||void 0,c:c._customerConsentGranted}}function F(){return{u:window.location.href,r:document.referrer,pt:a.currentPageType?B(a.currentPageType):void 0,m:{fbp:s("_fbp"),fbc:s("_fbc")}}}function K(t){return t.orderLineItems.map(function(t){return n(n(n(n({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})})}function H(t){return n(n(n(n({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})}function M(i){return t(this,void 0,void 0,function(){var t,s,o,u,d,a,E,O,_,T,I;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,6,,7]),[4,l(c)];case 1:return e.sent(),[4,g()];case 2:return e.sent(),[4,Y()];case 3:return e.sent(),[4,b()];case 4:return e.sent(),t={e:i,scid:r.salesChannelId,sfid:r.storefrontId,sid:f.sessionId,jid:f.journeyId,vid:f.visitorId,sfrid:r.storefrontRoutingId||"",ud:n(n(n(n({id:null===(o=c.customer)||void 0===o?void 0:o.id},(null===(u=c.customer)||void 0===u?void 0:u.email)?{em:null===(d=c.customer)||void 0===d?void 0:d.email}:{}),(null===(a=c.customer)||void 0===a?void 0:a.phone)?{ph:null===(E=c.customer)||void 0===E?void 0:E.phone}:{}),(null===(O=c.customer)||void 0===O?void 0:O.lastName)?{ln:null===(_=c.customer)||void 0===_?void 0:_.lastName}:{}),(null===(T=c.customer)||void 0===T?void 0:T.firstName)?{fn:null===(I=c.customer)||void 0===I?void 0:I.firstName}:{}),v:3},[4,fetch(R,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json","x-api-key":r.apiKey}})];case 5:return e.sent(),[3,7];case 6:return s=e.sent(),console.error(s),[3,7];case 7:return[2]}})})}export{f as default,I as iks_addToCart,w as iks_addToWishlist,v as iks_beginCheckout,b as iks_checkJourneyId,S as iks_checkoutStep,x as iks_contactForm,D as iks_customerLogin,h as iks_customerRegister,p as iks_customerVisit,_ as iks_pageView,T as iks_productView,m as iks_purchase,G as iks_refreshJourneyId,P as iks_search,A as iks_viewBrand,C as iks_viewCart,N as iks_viewCategory,U as iks_viewPopup};
|
package/dist/analytics/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IkasStorefrontConfig as i}from"../packages/storefront-config/src/index.js";import{getSelectedProductVariant as e}from"../functions/models/product/index.js";import{isServer as r}from"../utils/helper.js";import"../router/index.js";import"../stores/cart/index.js";import{getCategoryPath as t}from"../functions/models/category/index.js";import"../stores/customer/index.js";import'./../ext/uuid/dist/esm-browser/stringify.js';import'./../ext/uuid/dist/esm-browser/v3.js';import'./../ext/uuid/dist/esm-browser/native.js';import'./../ext/uuid/dist/esm-browser/v5.js';import"../i18n/index.js";import{getDefaultSrc as o}from"../functions/models/image/index.js";import"../functions/models/product-list/index.js";import{getProductVariantMainImage as n,getProductVariantPrice as a,getProductVariantFinalPrice as s,getProductVariantSellPrice as d,getProductVariantDiscountPrice as m}from"../functions/models/product/variant/index.js";import"../stores/base/index.js";import"../packages/storefront-api-client/src/utils/api.js";import'./../ext/isomorphic-fetch/fetch-npm-node.js';import
|
|
1
|
+
import{IkasStorefrontConfig as i}from"../packages/storefront-config/src/index.js";import{getSelectedProductVariant as e}from"../functions/models/product/index.js";import{isServer as r}from"../utils/helper.js";import"../router/index.js";import"../stores/cart/index.js";import{getCategoryPath as t}from"../functions/models/category/index.js";import"../stores/customer/index.js";import'./../ext/uuid/dist/esm-browser/stringify.js';import'./../ext/uuid/dist/esm-browser/v3.js';import'./../ext/uuid/dist/esm-browser/native.js';import'./../ext/uuid/dist/esm-browser/v5.js';import"../i18n/index.js";import'./../ext/mobx/dist/mobx.esm.js';import{getDefaultSrc as o}from"../functions/models/image/index.js";import"../functions/models/product-list/index.js";import{getProductVariantMainImage as n,getProductVariantPrice as a,getProductVariantFinalPrice as s,getProductVariantSellPrice as d,getProductVariantDiscountPrice as m}from"../functions/models/product/variant/index.js";import"../stores/base/index.js";import"../packages/storefront-api-client/src/utils/api.js";import'./../ext/isomorphic-fetch/fetch-npm-node.js';import"./analytics.js";import'./../ext/animejs/lib/anime.esm.js';import"../packages/storefront-api/src/index.js";import"../theme/styles/index.js";import'./../ext/preact/dist/preact.mjs.js';import'./../ext/preact/hooks/dist/hooks.mjs.js';import"../utils/fetch.js";import"../packages/storefront-models/src/models/merchant-settings/index.js";var u=function(){return!r()&&!i.isEditor},c=function(){return u()&&!!i.fbpId&&!!window.fbq},l=function(){return u()&&!!window.gtag},p=function(){return u()&&!!window.dataLayer},v=function(){return u()&&!!i.tiktokPixelId&&!!window.ttq};function f(i,r){var u,c,l,p,v=e(i),f=i.categories.length>0?t(i.categories[0]).map(function(i){return i.name}):[],j=null===(u=n(v))||void 0===u?void 0:u.image,g=a(v);return{id:i.id,variantId:v.id,name:i.name,price:null!==(c=s(v))&&void 0!==c?c:0,currency:(null==g?void 0:g.currency)||"TRY",categoryPath:f,categoryString:f.join(" > "),brand:(null===(l=i.brand)||void 0===l?void 0:l.name)||"",variant:v.variantValues.map(function(i){return i.name}).join(" / "),barcode:null===(p=v.barcodeList)||void 0===p?void 0:p[0],image:j?o(j):"",sellPrice:d(v)||void 0,discountPrice:m(v)}}function j(i,e,r){var t,o,n,a,s,d=[];if(null===(t=null==r?void 0:r.categories)||void 0===t?void 0:t.length)(m=r.categories[0]).categoryPath&&m.categoryPath.forEach(function(i){return d.push(i)}),d.push(m.name);else if(null===(o=i.variant.categories)||void 0===o?void 0:o.length){var m;(m=i.variant.categories[0]).categoryPath&&m.categoryPath.forEach(function(i){return d.push(i.name)}),d.push(m.name)}return{id:i.variant.productId||"",variantId:i.variant.id||"",name:i.variant.name,price:i.finalPrice||0,quantity:null!=e?e:i.quantity,currency:i.currencyCode||"",categoryPath:d,categoryString:d.join(" > "),brand:(null===(n=null==r?void 0:r.brand)||void 0===n?void 0:n.name)||(null===(a=i.variant.brand)||void 0===a?void 0:a.name)||"",variant:(null===(s=i.variant.variantValues)||void 0===s?void 0:s.map(function(i){return i.variantValueName}).join(" / "))||""}}function g(i){var e;return{items:i.orderLineItems.map(function(i){return j(i)}),totalPrice:"totalFinalPrice"in i?i.totalFinalPrice:i.totalPrice,currency:i.currencyCode||(null===(e=i.orderLineItems[0])||void 0===e?void 0:e.currencyCode)||"TRY",itemCount:i.orderLineItems.length}}export{u as canTrack,g as extractCartData,j as extractCartItemData,f as extractProductData,c as hasFacebookPixel,l as hasGoogleAnalytics,p as hasGoogleTagManager,v as hasTiktokPixel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as n,__assign as i}from'./../../../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as a}from"../../../packages/storefront-config/src/index.js";import{
|
|
1
|
+
import{__awaiter as t,__generator as n,__assign as i}from'./../../../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as a}from"../../../packages/storefront-config/src/index.js";import{observable as e}from'./../../../ext/mobx/dist/mobx.esm.js';import{getSelectedProductVariant as o}from"../product/index.js";import{initCustomerReviewList as r}from"./init.js";function d(t){return Math.ceil(t.count/t.limit)}function u(t){return!!t.minPage&&t.minPage>1}function s(t){return t.page*t.limit<t.count}function c(e,o,r,d,u){return t(this,void 0,void 0,function(){var t,s,c,l,p,v;return n(this,function(n){switch(n.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,n.sent().apiListCustomerReviews)(i(i(i({},e.productId?{productId:e.productId}:{}),{input:{salesChannelId:a.salesChannelId||""},pagination:{page:o,limit:r},hasImage:d,sortWithImagesFirst:!0}),u?{productIds:u}:{}))];case 2:return t=n.sent(),!(null===(l=t.data)||void 0===l?void 0:l.data)||e.productId?[3,5]:(s=null===(p=null==t?void 0:t.data)||void 0===p?void 0:p.data.map(function(t){return null==t?void 0:t.productId}),[4,import("../../api/product/index.js")]);case 3:return[4,(0,n.sent().apiSearchProducts)({input:{productIdList:s}})];case 4:c=n.sent(),t.data.data=null===(v=null==t?void 0:t.data)||void 0===v?void 0:v.data.map(function(t){var n,a,e=null===(a=null===(n=null==c?void 0:c.data)||void 0===n?void 0:n.data)||void 0===a?void 0:a.find(function(n){return n.id===t.productId});return i(i({},t),{product:e})}).filter(function(t){return t.product&&!t.product.deleted}),n.label=5;case 5:return[2,t]}})})}function l(i){return t(this,void 0,void 0,function(){var t,a,e,o;return n(this,function(n){switch(n.label){case 0:if(i.isLoading)return[2];i.isLoading=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,c(i,i.page,i.limit,i.hasImage,i.productIds)];case 2:return t=n.sent(),i.data=(null===(e=t.data)||void 0===e?void 0:e.data)||[],i.count=(null===(o=t.data)||void 0===o?void 0:o.count)||0,i.isInitialized=!0,i.minPage=i.page,[3,5];case 3:return a=n.sent(),console.log(a),[3,5];case 4:return i.isLoading=!1,[7];case 5:return[2]}})})}function p(i){return t(this,void 0,void 0,function(){var t,a,e,o,r;return n(this,function(n){switch(n.label){case 0:if(i.isLoading||!u(i))return[2];i.isLoading=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),t=i.minPage-1,[4,c(i,t,i.limit,i.hasImage,i.productIds)];case 2:return a=n.sent(),i.data=(null===(o=a.data)||void 0===o?void 0:o.data.concat(i.data))||i.data,i.count=(null===(r=a.data)||void 0===r?void 0:r.count)||i.count,i.minPage=t,[3,5];case 3:return e=n.sent(),console.log(e),[3,5];case 4:return i.isLoading=!1,[7];case 5:return[2]}})})}function v(i){return t(this,void 0,void 0,function(){var t,a,e,o;return n(this,function(n){switch(n.label){case 0:if(i.isLoading||!s(i))return[2];i.isLoading=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,c(i,i.page+1,i.limit,i.hasImage,i.productIds)];case 2:return t=n.sent(),i.data=i.data.concat((null===(e=t.data)||void 0===e?void 0:e.data)||[]),i.count=(null===(o=t.data)||void 0===o?void 0:o.count)||i.count,i.page=i.page+1,[3,5];case 3:return a=n.sent(),console.log(a),[3,5];case 4:return i.isLoading=!1,[7];case 5:return[2]}})})}function g(i,a){return t(this,void 0,void 0,function(){var t,e,o,r;return n(this,function(n){switch(n.label){case 0:if(i.isLoading)return[2];i.isLoading=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,c(i,a,i.limit,i.hasImage,i.productIds)];case 2:return t=n.sent(),i.data=(null===(o=t.data)||void 0===o?void 0:o.data)||[],i.count=(null===(r=t.data)||void 0===r?void 0:r.count)||0,i.page=a,i.minPage=a,[3,5];case 3:return e=n.sent(),console.log(e),[3,5];case 4:return i.isLoading=!1,[7];case 5:return[2]}})})}function m(a,d,u,s){return t(this,void 0,void 0,function(){var t,c,p,v,g,m;return n(this,function(n){switch(n.label){case 0:return t=o(a),c=!!(null===(g=t.bundleSettings)||void 0===g?void 0:g.products.length),p=[a.id],c&&(null===(m=t.bundleSettings)||void 0===m||m.products.forEach(function(t){p.push(t.productId)})),[4,l(v=r(i(i({limit:d||5,page:u||1,hasImage:s},c?{}:{productId:a.id}),c?{productIds:p}:{})))];case 1:return n.sent(),[2,e(v)]}})})}export{l as getCustomerReviewListInitialData,v as getCustomerReviewListNextPage,g as getCustomerReviewListPage,d as getCustomerReviewListPageCount,p as getCustomerReviewListPrev,m as getProductCustomerReviews,s as hasCustomerReviewListNextPage,u as hasCustomerReviewListPrevPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{initIkasBrand as t}from"../brand/init.js";import{initIkasCategory as r}from"../category/init.js";import{initIkasHTMLMetaData as i}from"../html-meta-data/init.js";import{initIkasProductAttributeValue as
|
|
1
|
+
import{initIkasBrand as t}from"../brand/init.js";import{initIkasCategory as r}from"../category/init.js";import{initIkasHTMLMetaData as i}from"../html-meta-data/init.js";import{initIkasProductAttributeValue as o}from"./attribute-value/init.js";import{initIkasProductGroup as a}from"./group/init.js";import{initIkasProductVariant as n}from"./variant/init.js";import{initIkasProductVariantType as f}from"./variant-type/init.js";var e={};function m(e,m){e.metaData&&i(e.metaData,m),e.brand&&t(e.brand,m),e.categories.forEach(function(t){return r(t,m)}),e.variants.forEach(n),e.attributes.forEach(o),e.variantTypes.forEach(function(t){return f(t,m)}),e.productGroup&&a(e.productGroup,m),u(e)}function u(t){t.variants.forEach(function(r){var i,o;e[r.id]&&(null===(i=t.campaignOffers)||void 0===i?void 0:i.length)&&0===(null===(o=t.offers)||void 0===o?void 0:o.length)||(e[r.id]=t)})}function c(t){return e[t]}export{c as getProductFromStore,m as initIkasProduct,u as initIkasProductExtraFields,e as productVariantStore};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__assign as e,__generator as r}from'./../../../ext/tslib/tslib.es6.mjs.js';import n from"../../../packages/storefront-api-client/src/config/index.js";import"../../../packages/storefront-api-client/src/utils/api.js";import'./../../../ext/isomorphic-fetch/fetch-npm-node.js';import{IkasStorefrontConfig as i}from"../../../packages/storefront-config/src/index.js";import{makeAutoObservable as s}from'./../../../ext/mobx/dist/mobx.esm.js';import{Router as o}from"../../../router/index.js";import{baseStore as a}from"../../../stores/base/index.js";import{cartStore as c}from"../../../stores/cart/index.js";import{isServer as u,cloneDeep as d}from"../../../utils/helper.js";import'./../../../ext/lodash/sortBy.js';import"../../../stores/customer/index.js";import"../../../i18n/index.js";import{removeCart as l,getCart as m}from"../cart/index.js";import{isCustomerSubscribed as f}from"../../models/customer/index.js";import{initAddressForm as p}from"../../models/validator/address/index.js";import{getOrderLineItemRefundQuantity as v}from"../../models/order/line-item/index.js";import"../../models/product-list/index.js";import{initAccountInfoForm as h}from"../../models/validator/account-info/index.js";import{initContactForm as _}from"../../models/validator/contact-form/index.js";import{initCouponCodeForm as w}from"../../models/validator/coupon-code-form/index.js";import{initForgotPasswordForm as b}from"../../models/validator/forgot-password/index.js";import{initLoginForm as S}from"../../models/validator/login/index.js";import{initNewsletterSubscriptionForm as g}from"../../models/validator/newsletter-subscription/index.js";import{initOrderTrackingForm as I}from"../../models/validator/order-tracking/index.js";import{initRecoverPasswordForm as y}from"../../models/validator/recover-password/index.js";import{initRegisterForm as x}from"../../models/validator/register/index.js";import{initSmsLoginForm as j}from"../../models/validator/sms-login/index.js";import{initVerifyPhoneNumberForm as k}from"../../models/validator/verify-phone-number/index.js";var F="customerToken",P="customerTokenExpiry",T="customerEmailSubscription",C="lastViewedProducts",E="customerConsent";function L(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return function(t){if(u())return;var e=localStorage.getItem(F),r=localStorage.getItem(P);e&&r?xt(t,e,parseInt(r)):jt(t)}(e),Lt(e),function(t){if(u())return;t._customerConsentGranted=!!window.localStorage.getItem(E)}(e),[4,yt(e)];case 1:return t.sent(),[4,gt(e)];case 2:return t.sent(),e._initialized=!0,[4,at(e)];case 3:return t.sent(),e.customer?[4,import("../../../analytics/analytics-functions/customerVisit.js")]:[3,5];case 4:(0,t.sent().anl_customerVisit)(),t.label=5;case 5:return[2]}})})}function N(t){return!!t.customer&&(!(f(t.customer)||u()||t._visitorSubscribedEmail)&&!window.localStorage.getItem(T))}function O(t){return e(e({},t.customer),{consentGranted:t._customerConsentGranted})}function R(e,n){return t(this,void 0,void 0,function(){var t,e,s;return r(this,function(r){switch(r.label){case 0:return"undefined"==typeof window?[2]:(t=new URLSearchParams(window.location.search).get("redirect")||"",e="".concat(import.meta.env.VITE_BASE_URL,"/ms/").concat(n,"/login/authenticate?redirect=").concat(t),[4,fetch(e,{headers:{"x-api-key":i.apiKey||"","x-sfid":i.storefrontId||"","x-sfrid":i.storefrontRoutingId||""}})]);case 1:return[4,r.sent().json()];case 2:return s=r.sent(),o.navigate(s.redirectUrl),[2]}})})}function A(e){return t(this,void 0,void 0,function(){var t,n,i,s,o;return r(this,function(r){switch(r.label){case 0:return t={status:"fail"},n=new URLSearchParams(window.location.search),i=n.get("socialLoginStatus"),s=n.get("socialLoginToken"),"success"===i&&s?[4,V(e,s)]:[3,2];case 1:return r.sent()?(t.status="success",[2,t]):[2,t];case 2:return o=n.get("socialLoginError"),t.message=o||void 0,[2,t]}})})}function V(e,n){return t(this,void 0,void 0,function(){var t,i,s;return r(this,function(r){switch(r.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiSocialLogin)({code:n})];case 2:return(null==(t=r.sent())?void 0:t.isSuccess)&&(null===(s=t.data)||void 0===s?void 0:s.customer)?(xt(e,t.data.token,t.data.tokenExpiry),It(e,t.data.customer),[4,import("../../../analytics/analytics-functions/customerLogin.js")]):[2,!1];case 3:return i=r.sent().anl_customerLogin,e.customer&&i(),[2,!0]}})})}function D(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:return(t=d(e.customer))&&t.addresses?-1===(i=t.addresses.findIndex(function(t){return t.id===n.id}))?[2,!1]:(t.addresses.splice(i,1),[4,Z(e,t)]):[2,!1];case 1:return[2,r.sent()]}})})}function U(e,n,i){return t(this,void 0,void 0,function(){var t,e,s;return r(this,function(r){switch(r.label){case 0:r.label=1;case 1:return r.trys.push([1,4,,5]),t=[],n.orderLineItems.map(function(e){var r=v(e);r&&(null==t||t.push({orderLineItemId:e.id,quantity:r}))}),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiCreateOrderRefundRequest)({input:{email:i,orderId:n.id,orderLineItems:t}})];case 3:return(e=r.sent()).isSuccess&&e.data?(Object.entries(e.data).forEach(function(t){var e=t[0],r=t[1];n[e]=r}),[2,!0]):[3,5];case 4:return s=r.sent(),console.error(s),[3,5];case 5:return[2,!1]}})})}function M(e,n,i,s){return t(this,void 0,void 0,function(){var t,o;return r(this,function(r){switch(r.label){case 0:return[4,Tt(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiLogin)({email:n,password:i,phone:s,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Ft(e),t&&t.isSuccess&&t.data?(o=t.data,xt(e,o.token,o.tokenExpiry),o.customer&&It(e,o.customer),e.customer?[4,import("../../../analytics/analytics-functions/customerLogin.js")]:[3,5]):[3,6];case 4:(0,r.sent().anl_customerLogin)(),r.label=5;case 5:return Rt(e),[2,{isSuccess:!0,errorCodes:[],otpSend:o.otpSend,flowId:o.flowId}];case 6:return[2,{isSuccess:!1,errorCodes:t.errorCodes.map(function(t){return["CUSTOMER_ACCOUNT_DISABLED","EMAIL_IS_NOT_VERIFIED","CUSTOMER_NOT_FOUND","B2B_CUSTOMER_ACCOUNT_DISABLED","PHONE_IS_NOT_VERIFIED","WRONG_PASSWORD"].includes(t)?t:"UNKOWN"})}]}})})}function B(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return kt(e),l(c),[4,import("../../../analytics/analytics-functions/customerLogout.js")];case 1:return(0,t.sent().anl_customerLogout)(),[2]}})})}function G(e,n,i,s,o,a,c,u,d){return t(this,void 0,void 0,function(){var t,l;return r(this,function(r){switch(r.label){case 0:return[4,Tt(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiRegister)({email:s,password:o,firstName:n,lastName:i,isAcceptMarketing:a,attributes:c,captchaToken:e._captchaToken,phone:u,flowId:d})];case 3:return t=r.sent(),Ft(e),t&&t.isSuccess&&(null===(l=t.data)||void 0===l?void 0:l.customer)?(xt(e,t.data.token,t.data.tokenExpiry),It(e,t.data.customer),Rt(e),[4,import("../../../analytics/analytics-functions/completeRegistration.js")]):[3,5];case 4:return(0,r.sent().anl_completeRegistration)(O(e)),[2,{isSuccess:!0,errorCodes:[]}];case 5:return[2,{isSuccess:!1,errorCodes:t.errorCodes.map(function(t){return["EMAIL_IS_NOT_VERIFIED","CUSTOMER_EMAIL_ALREADY_EXISTS","B2B_CUSTOMER_ACCOUNT_DISABLED","PHONE_IS_NOT_VERIFIED"].includes(t)?t:"UNKOWN"})}]}})})}function W(e){return t(this,void 0,void 0,function(){var t,n,i;return r(this,function(r){switch(r.label){case 0:return t=new URLSearchParams(window.location.search),(n=t.get("token"))?[4,Tt(e)]:[3,4];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiActivateCustomer)({token:n,captchaToken:e._captchaToken})];case 3:return i=r.sent(),Ft(e),[2,i.isSuccess];case 4:return[2,!1]}})})}function q(e,n){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return n?[4,Tt(e)]:[3,4];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiResendCustomerActivationMail)({email:n,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Ft(e),[2,t.isSuccess];case 4:return[2,!1]}})})}function K(e,n,i){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return n?[4,Tt(e)]:[3,4];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiValidateCustomerPhoneVerificationCode)({verificationCode:n,otpInfo:i,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Ft(e),[2,!(!t.isSuccess||!t.data)&&t.data];case 4:return[2,!1]}})})}function z(n,i,s){return t(this,void 0,void 0,function(){var t,o,a,c,u;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,7,,8]),[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiValidateOTPCode)({verificationCode:i,otpInfo:s,captchaToken:n._captchaToken})];case 2:return t=r.sent(),Ft(n),t&&t.isSuccess&&(null===(o=t.data)||void 0===o?void 0:o.customer)?(xt(n,t.data.token,t.data.tokenExpiry),It(n,t.data.customer),Rt(n),[4,import("../../../analytics/analytics-functions/completeRegistration.js")]):[3,4];case 3:return(0,r.sent().anl_completeRegistration)(O(n)),[2,{isSuccess:!0,errorCodes:[]}];case 4:return t&&t.isSuccess&&((null===(a=t.data)||void 0===a?void 0:a.otpSend)||(null===(c=t.data)||void 0===c?void 0:c.flowId))?[2,{isSuccess:!0,otpSend:!0,flowId:null===(u=t.data)||void 0===u?void 0:u.flowId,errorCodes:[]}]:t.errorCodes.some(function(t){return"B2B_CUSTOMER_ACCOUNT_DISABLED"===t})?[4,import("../../../analytics/analytics-functions/completeRegistration.js")]:[3,6];case 5:(0,r.sent().anl_completeRegistration)(e(e({},O(n)),{notificationsAccepted:null}),!0),r.label=6;case 6:return[2,{isSuccess:!1,errorCodes:t.errorCodes.map(function(t){return["EMAIL_IS_NOT_VERIFIED","CUSTOMER_EMAIL_ALREADY_EXISTS","B2B_CUSTOMER_ACCOUNT_DISABLED","PHONE_IS_NOT_VERIFIED"].includes(t)?t:"UNKOWN"})}];case 7:return r.sent(),[2,{isSuccess:!1,errorCodes:[]}];case 8:return[2]}})})}function H(e){return t(this,void 0,void 0,function(){var t;return r(this,function(e){switch(e.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,e.sent().apiResendCustomerPhoneVerificationCode)()];case 2:return[2,!(!(t=e.sent()).isSuccess||!t.data)&&t.data]}})})}function J(n,i){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,import("../../../analytics/analytics-functions/contactForm.js")];case 1:return(0,r.sent().anl_contactForm)(i),[4,Tt(n)];case 2:return r.sent(),[4,import("../../api/customer/index.js")];case 3:return[4,(0,r.sent().apiSendContactFormToMerchant)(e(e({},i),{captchaToken:n._captchaToken}))];case 4:return t=r.sent(),Ft(n),[2,t.isSuccess]}})})}function X(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:return[4,Tt(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiCheckEmail)({email:n,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Ft(e),[2,!!t.isSuccess&&!!(null===(i=t.data)||void 0===i?void 0:i.exists)]}})})}function Y(e,n){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,Tt(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiForgotPassword)({email:n,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Ft(e),[2,!!t.isSuccess&&t.data]}})})}function Q(e,n,i,s){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,Tt(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiRecoverPassword)({password:n,passwordAgain:i,token:s,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Ft(e),[2,t.isSuccess]}})})}function Z(e,n){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiSaveCustomer)({input:Dt(n)})];case 2:return(t=r.sent()).isSuccess&&t.data?(It(e,t.data),[2,!0]):[2,!1]}})})}function $(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,vt(e)];case 1:return t.sent(),e.customer?[4,import("../../api/customer/index.js")]:[2,[]];case 2:return[4,(0,t.sent().apiGetOrders)({})];case 3:return[2,t.sent().data||[]]}})})}function tt(e,n){return t(this,void 0,void 0,function(){var s,o,a,c,u,d,l,m=this;return r(this,function(f){switch(f.label){case 0:return[4,vt(e)];case 1:return f.sent(),e.customer?(s=n,!i.isPreview||s&&"orders"!==s?[3,3]:[4,$(e)]):[2,null];case 2:(o=f.sent()).length&&(s=o[0].id),f.label=3;case 3:return[4,Promise.all([t(m,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[2,(0,t.sent().apiGetOrders)({orderId:s})]}})}),St(e),rt(e,{orderId:s})])];case 4:return a=f.sent(),c=a[0],u=a[2],c.isSuccess&&(null===(l=c.data)||void 0===l?void 0:l.length)?((d=c.data[0]).transactions=u,[2,d]):[2,null]}})})}function et(e,n,i){return t(this,void 0,void 0,function(){var t,s,o,a;return r(this,function(r){switch(r.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiGetOrderByEmail)({email:n,orderNumber:i})];case 2:return(t=r.sent()).isSuccess&&t.data?(s=t.data,[4,Promise.all([St(e),rt(e,{orderId:s.id})])]):[2,null];case 3:return o=r.sent(),a=o[1],s.transactions=a,[2,s]}})})}function rt(e){return t(this,arguments,void 0,function(t,e){var n;return void 0===e&&(e={}),r(this,function(t){switch(t.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return n=t.sent().apiListOrderTransactions,e.orderId||e.checkoutId||e.id?[4,n({checkoutId:{eq:e.checkoutId},id:{eq:e.checkoutId},orderId:{eq:e.orderId}})]:[2,[]];case 2:return[2,t.sent().data||[]]}})})}function nt(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[2,[]];case 1:return[4,(0,t.sent().apiListFavoriteProducts)()];case 2:return[2,t.sent().data||[]]}})})}function it(e){return t(this,void 0,void 0,function(){var t,n,s,o,a;return r(this,function(r){switch(r.label){case 0:return[4,at(e)];case 1:return 0===(t=r.sent()).length?[2,[]]:[4,import("../../api/product/index.js")];case 2:return[4,(0,r.sent().apiSearchProducts)({input:{productIdList:t.map(function(t){return t.productId}),priceListId:i.priceListId,salesChannelId:i.salesChannelId,perPage:100}})];case 3:return n=r.sent(),null===(o=null===(s=n.data)||void 0===s?void 0:s.data)||void 0===o||o.forEach(function(t){t.selectedVariantValues=t.variants[0].variantValues}),[2,(null===(a=null==n?void 0:n.data)||void 0===a?void 0:a.data)||[]]}})})}function st(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:if(!(null===(i=e.customer)||void 0===i?void 0:i.id))throw Error("Unauthorized");return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiSaveFavoriteProduct)({isFavorite:!0,productId:n})];case 2:return t=r.sent(),[4,import("../../../analytics/analytics-functions/addToWishlist.js")];case 3:return(0,r.sent().anl_addToWishlist)(n),t.isSuccess?[4,at(e,!0)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2,t.data||!1]}})})}function ot(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:if(!(null===(i=e.customer)||void 0===i?void 0:i.id))throw Error("Unauthorized");return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiSaveFavoriteProduct)({isFavorite:!1,productId:n})];case 2:return t=r.sent(),[4,import("../../../analytics/analytics-functions/addToWishlist.js")];case 3:return(0,r.sent().anl_addToWishlist)(n,!0),t.isSuccess?[4,at(e,!0)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2,t.data||!1]}})})}function at(e){return t(this,arguments,void 0,function(t,e){var n;return void 0===e&&(e=!1),r(this,function(r){switch(r.label){case 0:return[4,vt(t)];case 1:return r.sent(),t.customer?t._isFavoriteProductsLoaded&&!e?[3,3]:[4,nt(t)]:[2,[]];case 2:n=r.sent(),t._favoriteProducts=n,t._isFavoriteProductsLoaded=!0,r.label=3;case 3:return[2,t._favoriteProducts]}})})}function ct(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){return[2,e._favoriteProducts.some(function(t){return t.productId===n})]})})}function ut(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:return[4,Tt(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiSubscribeToMarketingNotifications)({input:{email:n,captchaToken:e._captchaToken}})];case 3:return(t=r.sent()).isSuccess?(i=e.customer,window.localStorage.setItem(T,"true"),i?i.subscriptionStatus:e._visitorSubscribedEmail=!0,[4,import("../../../analytics/analytics-functions/createEmailSubscription.js")]):[3,5];case 4:(0,r.sent().anl_createEmailSubscription)(n),r.label=5;case 5:return[2,t]}})})}function dt(n,i){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,Tt(n)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiSaveCustomerFormData)({input:e(e({},i),{captchaToken:n._captchaToken})})];case 3:return(t=r.sent()).isSuccess?(window.localStorage.setItem(T,"true"),n.customer?n.customer.subscriptionStatus:n._visitorSubscribedEmail=!0,[4,import("../../../analytics/analytics-functions/createEmailSubscription.js")]):[3,5];case 4:(0,r.sent().anl_createEmailSubscription)(i.email),r.label=5;case 5:return[2,t.isSuccess]}})})}function lt(n,s){return t(this,void 0,void 0,function(){var t,o,a,c,u;return r(this,function(r){switch(r.label){case 0:if(t=i.customerReviewSettings,o=i.salesChannelId,a=i.getCurrentLocale(),!t)return[2];if(!(c=null===(u=n.customer)||void 0===u?void 0:u.id)&&t.customerLoginRequired)throw Error("Unauthorized");return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiCreateCustomerReview)({input:e(e({},s),{customerId:t.customerLoginRequired?c:void 0,salesChannelId:o||"",locale:a})})];case 2:return[2,r.sent().data]}})})}function mt(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,t.sent().apiDeactivateCustomer)({password:n})];case 2:return[2,t.sent()];case 3:return[2]}})})}function ft(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,t.sent().apiExportCustomerPersonalData)()];case 2:return[2,t.sent()];case 3:return[2]}})})}function pt(t){!function(t){if(u())return;t._customerConsentGranted=!0,window.localStorage.setItem(E,"true")}(t)}function vt(e){return t(this,void 0,void 0,function(){return r(this,function(t){return u()?[2]:[2,new Promise(function(t){var r=setInterval(function(){e._initialized&&(clearInterval(r),t(null))},100)})]})})}function ht(t){return new Promise(function(e){var r=setInterval(function(){t._captchaToken&&(clearInterval(r),e(null))},100)})}function _t(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiListCustomerAttribute)()];case 2:return t=r.sent(),e.customer&&(null===(n=e.customer.attributes)||void 0===n||n.forEach(function(e){var r,n,i;e.customerAttribute=(null===(r=t.data)||void 0===r?void 0:r.find(function(t){return t.id===e.customerAttributeId}))||null,e.customerAttributeOptionId&&(e.customerAttributeOption=(null===(i=null===(n=e.customerAttribute)||void 0===n?void 0:n.options)||void 0===i?void 0:i.find(function(t){return t.id===e.customerAttributeOptionId}))||null)})),[2,t.data||[]]}})})}function wt(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return n.length?[4,import("../../api/checkout/index.js")]:[2,[]];case 1:return[4,(0,t.sent().apiListProductFile)({id:{in:n}})];case 2:return[2,t.sent().data||[]]}})})}function bt(e,n,i){return t(this,void 0,void 0,function(){var t,e,s,o,a;return r(this,function(r){switch(r.label){case 0:r.label=1;case 1:return r.trys.push([1,5,,6]),(t=n.orderLineItems.find(function(t){return t.variant.id===i.variantId}))?[4,import("../../api/customer/index.js")]:[3,4];case 2:return[4,(0,r.sent().apiGetDigitalProductFileDownloadUrl)(n.id,t.id)];case 3:e=r.sent(),(s=e.data)&&((o=document.createElement("a")).href=s,o.download=decodeURIComponent(i.name.split("/")[i.name.split("/").length-1])||"",o.click(),o.remove()),r.label=4;case 4:return[3,6];case 5:return a=r.sent(),console.error(a),[3,6];case 6:return[2]}})})}function St(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return e._refundSettings?[3,3]:[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiListOrderRefundSettings)({})];case 2:(t=r.sent()).isSuccess&&(null===(n=t.data)||void 0===n?void 0:n.length)&&(e._refundSettings=t.data[0]),r.label=3;case 3:return[2]}})})}function gt(e){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return u()||!e._token?[2]:[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiGetCustomer)()];case 2:return(t=r.sent()).data&&It(e,t.data),[2]}})})}function It(t,e){t.customer=e}function yt(e){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return e._token?[4,import("../../api/customer/index.js")]:[2];case 1:return[4,(0,r.sent().apiRefreshToken)({token:e._token})];case 2:if((t=r.sent()).isSuccess&&t.data)xt(e,t.data.token,t.data.tokenExpiry);else{if(t.isCancelled||t.isNetworkError)return[2];console.log("refreshToken error",t),e._token=null,e._tokenExpiry=null,kt(e)}return[2]}})})}function xt(t,e,r){u()||(t._token=e,t._tokenExpiry=r,localStorage.setItem(F,e),localStorage.setItem(P,r+""),i.init({customerToken:e}),n.TOKEN=e)}function jt(t){localStorage.removeItem(F),localStorage.removeItem(P),t._token=null,t._tokenExpiry=null}function kt(t){jt(t),t.customer=null,t._favoriteProducts=[],t._isFavoriteProductsLoaded=!1,i.init({customerToken:""}),n.TOKEN="",Ft(t)}function Ft(t){t._captchaToken=null}function Pt(t,e){t._captchaToken=e}function Tt(e){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),i.isCaptchaRequired()?(window.grecaptcha.execute(),[4,ht(e)]):[3,2];case 1:r.sent(),window.grecaptcha.reset(),r.label=2;case 2:return[3,4];case 3:return t=r.sent(),console.log("Get captcha error",t),[3,4];case 4:return[2]}})})}function Ct(t,e){t._savedLastViewedProducts=d(t._lastViewedProducts),t._savedLastViewedProductsResponse=e}function Et(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,r.sent().apiGetLastViewedProducts)({customerId:e.customer.id})];case 2:return t=r.sent(),e._lastViewedProducts=(null===(n=d(t.data))||void 0===n?void 0:n.reverse())||[],[3,4];case 3:Lt(e),r.label=4;case 4:return[2,e._lastViewedProducts]}})})}function Lt(t){u()||(t._lastViewedProducts=Nt(),t._lastViewedProducts=d(t._lastViewedProducts).reverse())}function Nt(){if(u())return[];try{var t=window.localStorage.getItem(C);if(t)return JSON.parse(t)}catch(t){console.error(t)}return[]}function Ot(e,n,i){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?e._lastViewedProducts.find(function(t){return t.productId===n})?[2]:[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,t.sent().apiSaveLastViewedProducts)({input:{customerId:e.customer.id,products:[{productId:n,variantId:i}]}})];case 2:return t.sent()&&e._lastViewedProducts.push({productId:n,variantId:i}),[3,4];case 3:e._lastViewedProducts=Nt(),e._lastViewedProducts=e._lastViewedProducts.filter(function(t){return t.productId!==n}),e._lastViewedProducts.push({productId:n,variantId:i}),e._lastViewedProducts=e._lastViewedProducts.slice(-20),function(t){u()||window.localStorage.setItem(C,JSON.stringify(t._lastViewedProducts))}(e),t.label=4;case 4:return[2]}})})}function Rt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:if(u())return[2];r.label=1;case 1:return r.trys.push([1,5,,6]),(t=Nt()).length?[4,import("../../api/customer/index.js")]:[3,4];case 2:return[4,(0,r.sent().apiSaveLastViewedProducts)({input:{customerId:e.customer.id,products:t}})];case 3:r.sent()&&(u()||window.localStorage.removeItem(C)),r.label=4;case 4:return[3,6];case 5:return n=r.sent(),console.error(n),[3,6];case 6:return[2]}})})}function At(t){return t._customerConsentGranted}function Vt(t){u()||window.localStorage.removeItem(E)}function Dt(t){var e;return{addresses:null===(e=t.addresses)||void 0===e?void 0:e.map(function(t){return{addressLine1:t.addressLine1,addressLine2:t.addressLine2,city:t.city,company:t.company,country:t.country,createdAt:t.createdAt,deleted:t.deleted,district:t.district,firstName:t.firstName,id:t.id,identityNumber:t.identityNumber,isDefault:t.isDefault,lastName:t.lastName,phone:t.phone,postalCode:t.postalCode,region:t.region,state:t.state,taxNumber:t.taxNumber,taxOffice:t.taxOffice,title:t.title,updatedAt:t.updatedAt}}),attributes:t.attributes,birthDate:t.birthDate,firstName:t.firstName,gender:t.gender,lastName:t.lastName,phone:t.phone,phoneSubscriptionStatus:t.phoneSubscriptionStatus,smsSubscriptionStatus:t.smsSubscriptionStatus,subscriptionStatus:t.subscriptionStatus}}function Ut(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../api/loyalty/index.js")];case 1:return[4,(0,t.sent().apiListEarningMethods)()];case 2:return[2,t.sent().data]}})})}function Mt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return[4,vt(e)];case 1:return r.sent(),(t=null===(n=c.cart)||void 0===n?void 0:n.id)?[4,import("../../api/loyalty/index.js")]:[2,[]];case 2:return[4,(0,r.sent().apiListSpendingMethodsByCartId)({cartId:t})];case 3:return[2,r.sent().data]}})})}function Bt(e){return t(this,void 0,void 0,function(){var t,n,i,s,o,a,u;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),[4,vt(e)];case 1:return r.sent(),t=null===(s=c.cart)||void 0===s?void 0:s.id,n=null===(u=null===(a=null===(o=c.cart)||void 0===o?void 0:o.loyaltyLines)||void 0===a?void 0:a[0])||void 0===u?void 0:u.loyaltySpendingMethodId,t&&n?[4,import("../../api/loyalty/index.js")]:[2];case 2:return[4,(0,r.sent().apiRemoveLoyaltyPointsFromCart)({cartId:t,loyaltySpendingMethodId:n})];case 3:return r.sent().isSuccess?[4,m()]:[3,5];case 4:r.sent(),r.label=5;case 5:return[3,7];case 6:return i=r.sent(),console.error(i),[3,7];case 7:return[2]}})})}function Gt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return[4,vt(e)];case 1:return r.sent(),zt(e)?(t=null===(n=c.cart)||void 0===n?void 0:n.id,[4,import("../../api/loyalty/index.js")]):[2,null];case 2:return[4,(0,r.sent().apiGetLoyaltyCustomerInfo)({cartId:t})];case 3:return[2,r.sent().data||null]}})})}function Wt(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../api/loyalty/index.js")];case 1:return[4,(0,t.sent().apiListLoyaltyProgramTiers)()];case 2:return[2,t.sent().data]}})})}function qt(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../api/loyalty/index.js")];case 1:return[4,(0,t.sent().apiListLoyaltyProgramPointHistory)(n)];case 2:return[2,t.sent().data]}})})}function Kt(n,i){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return(t=null===(n=c.cart)||void 0===n?void 0:n.id)?[4,import("../../api/loyalty/index.js")]:[2,null];case 1:return[4,(0,r.sent().apiUseLoyaltyPoints)({input:e(e({},i.input),{cartId:t})})];case 2:return[2,r.sent().data||null]}})})}function zt(t){return!!t.customer}function Ht(t){return t._accountInfoForm||(t._accountInfoForm={},h(t._accountInfoForm)),t._accountInfoForm}function Jt(t){t._accountInfoForm=null}function Xt(t){return t._contactForm||(t._contactForm={},_(t._contactForm)),t._contactForm}function Yt(t){t._contactForm=null}function Qt(t){return t._couponCodeForm||(t._couponCodeForm={},w(t._couponCodeForm)),t._couponCodeForm}function Zt(t){t._couponCodeForm=null}function $t(t){return t._forgotPasswordForm||(t._forgotPasswordForm={},b(t._forgotPasswordForm)),t._forgotPasswordForm}function te(t){t._forgotPasswordForm=null}function ee(t){return t._loginForm||(t._loginForm={},S(t._loginForm)),t._loginForm}function re(t){return t._smsLoginForm||(t._smsLoginForm={},j(t._smsLoginForm)),t._smsLoginForm}function ne(t){return t._verifyPhoneNumberForm||(t._verifyPhoneNumberForm={},k(t._verifyPhoneNumberForm)),t._verifyPhoneNumberForm}function ie(t){t._loginForm=null}function se(t){return t._newsletterSubscriptionForm||(t._newsletterSubscriptionForm={},g(t._newsletterSubscriptionForm)),t._newsletterSubscriptionForm}function oe(t){t._newsletterSubscriptionForm=null}function ae(t){return t._orderTrackingForm||(t._orderTrackingForm={},I(t._orderTrackingForm)),t._orderTrackingForm}function ce(t){t._orderTrackingForm=null}function ue(t){return t._recoverPasswordForm||(t._recoverPasswordForm={},y(t._recoverPasswordForm)),t._recoverPasswordForm}function de(t){t._recoverPasswordForm=null}function le(t){return t._registerForm||(t._registerForm={},x(t._registerForm)),t._registerForm}function me(t){t._registerForm=null}function fe(t){var e={};return p(e),s(e)}function pe(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return"ORDER_DETAIL"!==a.currentPageType||"undefined"==typeof window?[3,4]:(t=o.getCurrentPath().split("/").pop(),!i.isPreview||t&&"orders"!==t?[3,2]:[4,$(e)]);case 1:(n=r.sent()).length&&(t=n[0].id),r.label=2;case 2:return t?[4,tt(e,t)]:[3,4];case 3:return[2,r.sent()];case 4:return[2]}})})}function ve(t){try{window.openIkasStorefrontWidget()}catch(t){console.error("Failed to open ikas storefront widget",t)}}function he(t){try{window.closeIkasStorefrontWidget()}catch(t){console.error("Failed to close ikas storefront widget",t)}}export{W as activateCustomer,st as addProductToFavorites,N as canCustomerCreateEmailSubscription,X as checkEmail,Jt as clearAccountInfoForm,Yt as clearContactForm,Zt as clearCouponCodeForm,te as clearForgotPasswordForm,ie as clearLoginForm,oe as clearNewsletterSubscriptionForm,ce as clearOrderTrackingForm,de as clearRecoverPasswordForm,me as clearRegisterForm,he as closeIkasStorefrontWidget,ut as createEmailSubscription,Gt as cs_getLoyaltyCustomerInfo,Ut as cs_listEarningMethods,qt as cs_listLoyaltyProgramPointHistory,Wt as cs_listLoyaltyProgramTiers,Mt as cs_listSpendingMethodsByCartId,Bt as cs_removeLoyaltyPointsFromCart,Kt as cs_useLoyaltyPoints,M as customerLogin,Ot as customerStore_onProductView,O as customerToAnalyticsCustomer,mt as deactivateCustomer,D as deleteCustomerAddress,ft as exportCustomerPersonalData,Y as forgotPassword,Ht as getAccountInfoForm,Xt as getContactForm,Qt as getCouponCodeForm,_t as getCustomerAttributes,At as getCustomerConsentGranted,bt as getDigitalProductFileDownloadUrl,fe as getEmptyAddressForm,it as getFavoriteProducts,nt as getFavoriteProductsIds,$t as getForgotPasswordForm,Et as getLastViewedProducts,ee as getLoginForm,se as getNewsletterSubscriptionForm,tt as getOrder,et as getOrderByEmail,pe as getOrderDetailsOfPage,wt as getOrderProductFiles,St as getOrderRefundSettings,ae as getOrderTrackingForm,rt as getOrderTransactions,$ as getOrders,ue as getRecoverPasswordForm,le as getRegisterForm,re as getSmsLoginForm,ne as getVerifyPhoneNumberForm,pt as handleCustomerConsentGrant,A as handleSocialLogin,zt as hasCustomer,L as initCustomerStore,ct as isFavoriteProduct,B as logout,ve as openIkasStorefrontWidget,Q as recoverPassword,U as refundOrder,G as register,Vt as removeCustomerConsent,ot as removeProductFromFavorites,q as resendCustomerActivationMail,H as resendCustomerPhoneVerificationCode,J as saveContactForm,Z as saveCustomer,dt as saveCustomerFormData,lt as sendReview,Pt as setCaptchaToken,Ct as setSavedLastViewedProductsResponse,R as socialLogin,V as socialLoginToken,K as validateCustomerPhoneVerificationCode,z as validateOTPCode,ht as waitForCaptchaTokenInit,vt as waitForCustomerStoreInit};
|
|
1
|
+
import{__awaiter as t,__assign as e,__generator as r}from'./../../../ext/tslib/tslib.es6.mjs.js';import n from"../../../packages/storefront-api-client/src/config/index.js";import"../../../packages/storefront-api-client/src/utils/api.js";import'./../../../ext/isomorphic-fetch/fetch-npm-node.js';import{IkasStorefrontConfig as i}from"../../../packages/storefront-config/src/index.js";import{makeAutoObservable as s,observable as o}from'./../../../ext/mobx/dist/mobx.esm.js';import{Router as a}from"../../../router/index.js";import{baseStore as c}from"../../../stores/base/index.js";import{cartStore as u}from"../../../stores/cart/index.js";import{isServer as d,cloneDeep as l}from"../../../utils/helper.js";import'./../../../ext/lodash/sortBy.js';import"../../../stores/customer/index.js";import"../../../i18n/index.js";import{removeCart as m,getCart as f}from"../cart/index.js";import{isCustomerSubscribed as p}from"../../models/customer/index.js";import{initAddressForm as v}from"../../models/validator/address/index.js";import{getOrderLineItemRefundQuantity as h}from"../../models/order/line-item/index.js";import"../../models/product-list/index.js";import{initAccountInfoForm as _}from"../../models/validator/account-info/index.js";import{initContactForm as w}from"../../models/validator/contact-form/index.js";import{initCouponCodeForm as b}from"../../models/validator/coupon-code-form/index.js";import{initForgotPasswordForm as S}from"../../models/validator/forgot-password/index.js";import{initLoginForm as g}from"../../models/validator/login/index.js";import{initNewsletterSubscriptionForm as I}from"../../models/validator/newsletter-subscription/index.js";import{initOrderTrackingForm as y}from"../../models/validator/order-tracking/index.js";import{initRecoverPasswordForm as x}from"../../models/validator/recover-password/index.js";import{initRegisterForm as j}from"../../models/validator/register/index.js";import{initSmsLoginForm as k}from"../../models/validator/sms-login/index.js";import{initVerifyPhoneNumberForm as F}from"../../models/validator/verify-phone-number/index.js";var P="customerToken",T="customerTokenExpiry",C="customerEmailSubscription",E="lastViewedProducts",L="customerConsent";function N(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return function(t){if(d())return;var e=localStorage.getItem(P),r=localStorage.getItem(T);e&&r?jt(t,e,parseInt(r)):kt(t)}(e),Nt(e),function(t){if(d())return;t._customerConsentGranted=!!window.localStorage.getItem(L)}(e),[4,xt(e)];case 1:return t.sent(),[4,It(e)];case 2:return t.sent(),e._initialized=!0,[4,ct(e)];case 3:return t.sent(),e.customer?[4,import("../../../analytics/analytics-functions/customerVisit.js")]:[3,5];case 4:(0,t.sent().anl_customerVisit)(),t.label=5;case 5:return[2]}})})}function O(t){return!!t.customer&&(!(p(t.customer)||d()||t._visitorSubscribedEmail)&&!window.localStorage.getItem(C))}function R(t){return e(e({},t.customer),{consentGranted:t._customerConsentGranted})}function A(e,n){return t(this,void 0,void 0,function(){var t,e,s;return r(this,function(r){switch(r.label){case 0:return"undefined"==typeof window?[2]:(t=new URLSearchParams(window.location.search).get("redirect")||"",e="".concat(import.meta.env.VITE_BASE_URL,"/ms/").concat(n,"/login/authenticate?redirect=").concat(t),[4,fetch(e,{headers:{"x-api-key":i.apiKey||"","x-sfid":i.storefrontId||"","x-sfrid":i.storefrontRoutingId||""}})]);case 1:return[4,r.sent().json()];case 2:return s=r.sent(),a.navigate(s.redirectUrl),[2]}})})}function V(e){return t(this,void 0,void 0,function(){var t,n,i,s,o;return r(this,function(r){switch(r.label){case 0:return t={status:"fail"},n=new URLSearchParams(window.location.search),i=n.get("socialLoginStatus"),s=n.get("socialLoginToken"),"success"===i&&s?[4,D(e,s)]:[3,2];case 1:return r.sent()?(t.status="success",[2,t]):[2,t];case 2:return o=n.get("socialLoginError"),t.message=o||void 0,[2,t]}})})}function D(e,n){return t(this,void 0,void 0,function(){var t,i,s;return r(this,function(r){switch(r.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiSocialLogin)({code:n})];case 2:return(null==(t=r.sent())?void 0:t.isSuccess)&&(null===(s=t.data)||void 0===s?void 0:s.customer)?(jt(e,t.data.token,t.data.tokenExpiry),yt(e,t.data.customer),[4,import("../../../analytics/analytics-functions/customerLogin.js")]):[2,!1];case 3:return i=r.sent().anl_customerLogin,e.customer&&i(),[2,!0]}})})}function U(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:return(t=l(e.customer))&&t.addresses?-1===(i=t.addresses.findIndex(function(t){return t.id===n.id}))?[2,!1]:(t.addresses.splice(i,1),[4,$(e,t)]):[2,!1];case 1:return[2,r.sent()]}})})}function M(e,n,i){return t(this,void 0,void 0,function(){var t,e,s;return r(this,function(r){switch(r.label){case 0:r.label=1;case 1:return r.trys.push([1,4,,5]),t=[],n.orderLineItems.map(function(e){var r=h(e);r&&(null==t||t.push({orderLineItemId:e.id,quantity:r}))}),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiCreateOrderRefundRequest)({input:{email:i,orderId:n.id,orderLineItems:t}})];case 3:return(e=r.sent()).isSuccess&&e.data?(Object.entries(e.data).forEach(function(t){var e=t[0],r=t[1];n[e]=r}),[2,!0]):[3,5];case 4:return s=r.sent(),console.error(s),[3,5];case 5:return[2,!1]}})})}function B(e,n,i,s){return t(this,void 0,void 0,function(){var t,o;return r(this,function(r){switch(r.label){case 0:return[4,Ct(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiLogin)({email:n,password:i,phone:s,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Pt(e),t&&t.isSuccess&&t.data?(o=t.data,jt(e,o.token,o.tokenExpiry),o.customer&&yt(e,o.customer),e.customer?[4,import("../../../analytics/analytics-functions/customerLogin.js")]:[3,5]):[3,6];case 4:(0,r.sent().anl_customerLogin)(),r.label=5;case 5:return At(e),[2,{isSuccess:!0,errorCodes:[],otpSend:o.otpSend,flowId:o.flowId}];case 6:return[2,{isSuccess:!1,errorCodes:t.errorCodes.map(function(t){return["CUSTOMER_ACCOUNT_DISABLED","EMAIL_IS_NOT_VERIFIED","CUSTOMER_NOT_FOUND","B2B_CUSTOMER_ACCOUNT_DISABLED","PHONE_IS_NOT_VERIFIED","WRONG_PASSWORD"].includes(t)?t:"UNKOWN"})}]}})})}function G(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return Ft(e),m(u),[4,import("../../../analytics/analytics-functions/customerLogout.js")];case 1:return(0,t.sent().anl_customerLogout)(),[2]}})})}function W(e,n,i,s,o,a,c,u,d){return t(this,void 0,void 0,function(){var t,l;return r(this,function(r){switch(r.label){case 0:return[4,Ct(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiRegister)({email:s,password:o,firstName:n,lastName:i,isAcceptMarketing:a,attributes:c,captchaToken:e._captchaToken,phone:u,flowId:d})];case 3:return t=r.sent(),Pt(e),t&&t.isSuccess&&(null===(l=t.data)||void 0===l?void 0:l.customer)?(jt(e,t.data.token,t.data.tokenExpiry),yt(e,t.data.customer),At(e),[4,import("../../../analytics/analytics-functions/completeRegistration.js")]):[3,5];case 4:return(0,r.sent().anl_completeRegistration)(R(e)),[2,{isSuccess:!0,errorCodes:[]}];case 5:return[2,{isSuccess:!1,errorCodes:t.errorCodes.map(function(t){return["EMAIL_IS_NOT_VERIFIED","CUSTOMER_EMAIL_ALREADY_EXISTS","B2B_CUSTOMER_ACCOUNT_DISABLED","PHONE_IS_NOT_VERIFIED"].includes(t)?t:"UNKOWN"})}]}})})}function q(e){return t(this,void 0,void 0,function(){var t,n,i;return r(this,function(r){switch(r.label){case 0:return t=new URLSearchParams(window.location.search),(n=t.get("token"))?[4,Ct(e)]:[3,4];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiActivateCustomer)({token:n,captchaToken:e._captchaToken})];case 3:return i=r.sent(),Pt(e),[2,i.isSuccess];case 4:return[2,!1]}})})}function K(e,n){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return n?[4,Ct(e)]:[3,4];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiResendCustomerActivationMail)({email:n,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Pt(e),[2,t.isSuccess];case 4:return[2,!1]}})})}function z(e,n,i){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return n?[4,Ct(e)]:[3,4];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiValidateCustomerPhoneVerificationCode)({verificationCode:n,otpInfo:i,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Pt(e),[2,!(!t.isSuccess||!t.data)&&t.data];case 4:return[2,!1]}})})}function H(n,i,s){return t(this,void 0,void 0,function(){var t,o,a,c,u;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,7,,8]),[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiValidateOTPCode)({verificationCode:i,otpInfo:s,captchaToken:n._captchaToken})];case 2:return t=r.sent(),Pt(n),t&&t.isSuccess&&(null===(o=t.data)||void 0===o?void 0:o.customer)?(jt(n,t.data.token,t.data.tokenExpiry),yt(n,t.data.customer),At(n),[4,import("../../../analytics/analytics-functions/completeRegistration.js")]):[3,4];case 3:return(0,r.sent().anl_completeRegistration)(R(n)),[2,{isSuccess:!0,errorCodes:[]}];case 4:return t&&t.isSuccess&&((null===(a=t.data)||void 0===a?void 0:a.otpSend)||(null===(c=t.data)||void 0===c?void 0:c.flowId))?[2,{isSuccess:!0,otpSend:!0,flowId:null===(u=t.data)||void 0===u?void 0:u.flowId,errorCodes:[]}]:t.errorCodes.some(function(t){return"B2B_CUSTOMER_ACCOUNT_DISABLED"===t})?[4,import("../../../analytics/analytics-functions/completeRegistration.js")]:[3,6];case 5:(0,r.sent().anl_completeRegistration)(e(e({},R(n)),{notificationsAccepted:null}),!0),r.label=6;case 6:return[2,{isSuccess:!1,errorCodes:t.errorCodes.map(function(t){return["EMAIL_IS_NOT_VERIFIED","CUSTOMER_EMAIL_ALREADY_EXISTS","B2B_CUSTOMER_ACCOUNT_DISABLED","PHONE_IS_NOT_VERIFIED"].includes(t)?t:"UNKOWN"})}];case 7:return r.sent(),[2,{isSuccess:!1,errorCodes:[]}];case 8:return[2]}})})}function J(e){return t(this,void 0,void 0,function(){var t;return r(this,function(e){switch(e.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,e.sent().apiResendCustomerPhoneVerificationCode)()];case 2:return[2,!(!(t=e.sent()).isSuccess||!t.data)&&t.data]}})})}function X(n,i){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,import("../../../analytics/analytics-functions/contactForm.js")];case 1:return(0,r.sent().anl_contactForm)(i),[4,Ct(n)];case 2:return r.sent(),[4,import("../../api/customer/index.js")];case 3:return[4,(0,r.sent().apiSendContactFormToMerchant)(e(e({},i),{captchaToken:n._captchaToken}))];case 4:return t=r.sent(),Pt(n),[2,t.isSuccess]}})})}function Y(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:return[4,Ct(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiCheckEmail)({email:n,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Pt(e),[2,!!t.isSuccess&&!!(null===(i=t.data)||void 0===i?void 0:i.exists)]}})})}function Q(e,n){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,Ct(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiForgotPassword)({email:n,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Pt(e),[2,!!t.isSuccess&&t.data]}})})}function Z(e,n,i,s){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,Ct(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiRecoverPassword)({password:n,passwordAgain:i,token:s,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Pt(e),[2,t.isSuccess]}})})}function $(e,n){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiSaveCustomer)({input:Ut(n)})];case 2:return(t=r.sent()).isSuccess&&t.data?(yt(e,t.data),[2,!0]):[2,!1]}})})}function tt(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,ht(e)];case 1:return t.sent(),e.customer?[4,import("../../api/customer/index.js")]:[2,[]];case 2:return[4,(0,t.sent().apiGetOrders)({})];case 3:return[2,t.sent().data||[]]}})})}function et(e,n){return t(this,void 0,void 0,function(){var s,o,a,c,u,d,l,m=this;return r(this,function(f){switch(f.label){case 0:return[4,ht(e)];case 1:return f.sent(),e.customer?(s=n,!i.isPreview||s&&"orders"!==s?[3,3]:[4,tt(e)]):[2,null];case 2:(o=f.sent()).length&&(s=o[0].id),f.label=3;case 3:return[4,Promise.all([t(m,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[2,(0,t.sent().apiGetOrders)({orderId:s})]}})}),gt(e),nt(e,{orderId:s})])];case 4:return a=f.sent(),c=a[0],u=a[2],c.isSuccess&&(null===(l=c.data)||void 0===l?void 0:l.length)?((d=c.data[0]).transactions=u,[2,d]):[2,null]}})})}function rt(e,n,i){return t(this,void 0,void 0,function(){var t,s,o,a;return r(this,function(r){switch(r.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiGetOrderByEmail)({email:n,orderNumber:i})];case 2:return(t=r.sent()).isSuccess&&t.data?(s=t.data,[4,Promise.all([gt(e),nt(e,{orderId:s.id})])]):[2,null];case 3:return o=r.sent(),a=o[1],s.transactions=a,[2,s]}})})}function nt(e){return t(this,arguments,void 0,function(t,e){var n;return void 0===e&&(e={}),r(this,function(t){switch(t.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return n=t.sent().apiListOrderTransactions,e.orderId||e.checkoutId||e.id?[4,n({checkoutId:{eq:e.checkoutId},id:{eq:e.checkoutId},orderId:{eq:e.orderId}})]:[2,[]];case 2:return[2,t.sent().data||[]]}})})}function it(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[2,[]];case 1:return[4,(0,t.sent().apiListFavoriteProducts)()];case 2:return[2,t.sent().data||[]]}})})}function st(e){return t(this,void 0,void 0,function(){var t,n,s,a,c;return r(this,function(r){switch(r.label){case 0:return[4,ct(e)];case 1:return 0===(t=r.sent()).length?[2,[]]:[4,import("../../api/product/index.js")];case 2:return[4,(0,r.sent().apiSearchProducts)({input:{productIdList:t.map(function(t){return t.productId}),priceListId:i.priceListId,salesChannelId:i.salesChannelId,perPage:100}})];case 3:return n=r.sent(),null===(a=null===(s=n.data)||void 0===s?void 0:s.data)||void 0===a||a.forEach(function(t){t.selectedVariantValues=t.variants[0].variantValues}),[2,o((null===(c=null==n?void 0:n.data)||void 0===c?void 0:c.data)||[])]}})})}function ot(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:if(!(null===(i=e.customer)||void 0===i?void 0:i.id))throw Error("Unauthorized");return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiSaveFavoriteProduct)({isFavorite:!0,productId:n})];case 2:return t=r.sent(),[4,import("../../../analytics/analytics-functions/addToWishlist.js")];case 3:return(0,r.sent().anl_addToWishlist)(n),t.isSuccess?[4,ct(e,!0)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2,t.data||!1]}})})}function at(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:if(!(null===(i=e.customer)||void 0===i?void 0:i.id))throw Error("Unauthorized");return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiSaveFavoriteProduct)({isFavorite:!1,productId:n})];case 2:return t=r.sent(),[4,import("../../../analytics/analytics-functions/addToWishlist.js")];case 3:return(0,r.sent().anl_addToWishlist)(n,!0),t.isSuccess?[4,ct(e,!0)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2,t.data||!1]}})})}function ct(e){return t(this,arguments,void 0,function(t,e){var n;return void 0===e&&(e=!1),r(this,function(r){switch(r.label){case 0:return[4,ht(t)];case 1:return r.sent(),t.customer?t._isFavoriteProductsLoaded&&!e?[3,3]:[4,it(t)]:[2,[]];case 2:n=r.sent(),t._favoriteProducts=n,t._isFavoriteProductsLoaded=!0,r.label=3;case 3:return[2,t._favoriteProducts]}})})}function ut(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){return[2,e._favoriteProducts.some(function(t){return t.productId===n})]})})}function dt(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:return[4,Ct(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiSubscribeToMarketingNotifications)({input:{email:n,captchaToken:e._captchaToken}})];case 3:return(t=r.sent()).isSuccess?(i=e.customer,window.localStorage.setItem(C,"true"),i?i.subscriptionStatus:e._visitorSubscribedEmail=!0,[4,import("../../../analytics/analytics-functions/createEmailSubscription.js")]):[3,5];case 4:(0,r.sent().anl_createEmailSubscription)(n),r.label=5;case 5:return[2,t]}})})}function lt(n,i){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,Ct(n)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiSaveCustomerFormData)({input:e(e({},i),{captchaToken:n._captchaToken})})];case 3:return(t=r.sent()).isSuccess?(window.localStorage.setItem(C,"true"),n.customer?n.customer.subscriptionStatus:n._visitorSubscribedEmail=!0,[4,import("../../../analytics/analytics-functions/createEmailSubscription.js")]):[3,5];case 4:(0,r.sent().anl_createEmailSubscription)(i.email),r.label=5;case 5:return[2,t.isSuccess]}})})}function mt(n,s){return t(this,void 0,void 0,function(){var t,o,a,c,u;return r(this,function(r){switch(r.label){case 0:if(t=i.customerReviewSettings,o=i.salesChannelId,a=i.getCurrentLocale(),!t)return[2];if(!(c=null===(u=n.customer)||void 0===u?void 0:u.id)&&t.customerLoginRequired)throw Error("Unauthorized");return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiCreateCustomerReview)({input:e(e({},s),{customerId:t.customerLoginRequired?c:void 0,salesChannelId:o||"",locale:a})})];case 2:return[2,r.sent().data]}})})}function ft(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,t.sent().apiDeactivateCustomer)({password:n})];case 2:return[2,t.sent()];case 3:return[2]}})})}function pt(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,t.sent().apiExportCustomerPersonalData)()];case 2:return[2,t.sent()];case 3:return[2]}})})}function vt(t){!function(t){if(d())return;t._customerConsentGranted=!0,window.localStorage.setItem(L,"true")}(t)}function ht(e){return t(this,void 0,void 0,function(){return r(this,function(t){return d()?[2]:[2,new Promise(function(t){var r=setInterval(function(){e._initialized&&(clearInterval(r),t(null))},100)})]})})}function _t(t){return new Promise(function(e){var r=setInterval(function(){t._captchaToken&&(clearInterval(r),e(null))},100)})}function wt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiListCustomerAttribute)()];case 2:return t=r.sent(),e.customer&&(null===(n=e.customer.attributes)||void 0===n||n.forEach(function(e){var r,n,i;e.customerAttribute=(null===(r=t.data)||void 0===r?void 0:r.find(function(t){return t.id===e.customerAttributeId}))||null,e.customerAttributeOptionId&&(e.customerAttributeOption=(null===(i=null===(n=e.customerAttribute)||void 0===n?void 0:n.options)||void 0===i?void 0:i.find(function(t){return t.id===e.customerAttributeOptionId}))||null)})),[2,t.data||[]]}})})}function bt(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return n.length?[4,import("../../api/checkout/index.js")]:[2,[]];case 1:return[4,(0,t.sent().apiListProductFile)({id:{in:n}})];case 2:return[2,t.sent().data||[]]}})})}function St(e,n,i){return t(this,void 0,void 0,function(){var t,e,s,o,a;return r(this,function(r){switch(r.label){case 0:r.label=1;case 1:return r.trys.push([1,5,,6]),(t=n.orderLineItems.find(function(t){return t.variant.id===i.variantId}))?[4,import("../../api/customer/index.js")]:[3,4];case 2:return[4,(0,r.sent().apiGetDigitalProductFileDownloadUrl)(n.id,t.id)];case 3:e=r.sent(),(s=e.data)&&((o=document.createElement("a")).href=s,o.download=decodeURIComponent(i.name.split("/")[i.name.split("/").length-1])||"",o.click(),o.remove()),r.label=4;case 4:return[3,6];case 5:return a=r.sent(),console.error(a),[3,6];case 6:return[2]}})})}function gt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return e._refundSettings?[3,3]:[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiListOrderRefundSettings)({})];case 2:(t=r.sent()).isSuccess&&(null===(n=t.data)||void 0===n?void 0:n.length)&&(e._refundSettings=t.data[0]),r.label=3;case 3:return[2]}})})}function It(e){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return d()||!e._token?[2]:[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiGetCustomer)()];case 2:return(t=r.sent()).data&&yt(e,t.data),[2]}})})}function yt(t,e){t.customer=e}function xt(e){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return e._token?[4,import("../../api/customer/index.js")]:[2];case 1:return[4,(0,r.sent().apiRefreshToken)({token:e._token})];case 2:if((t=r.sent()).isSuccess&&t.data)jt(e,t.data.token,t.data.tokenExpiry);else{if(t.isCancelled||t.isNetworkError)return[2];console.log("refreshToken error",t),e._token=null,e._tokenExpiry=null,Ft(e)}return[2]}})})}function jt(t,e,r){d()||(t._token=e,t._tokenExpiry=r,localStorage.setItem(P,e),localStorage.setItem(T,r+""),i.init({customerToken:e}),n.TOKEN=e)}function kt(t){localStorage.removeItem(P),localStorage.removeItem(T),t._token=null,t._tokenExpiry=null}function Ft(t){kt(t),t.customer=null,t._favoriteProducts=[],t._isFavoriteProductsLoaded=!1,i.init({customerToken:""}),n.TOKEN="",Pt(t)}function Pt(t){t._captchaToken=null}function Tt(t,e){t._captchaToken=e}function Ct(e){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),i.isCaptchaRequired()?(window.grecaptcha.execute(),[4,_t(e)]):[3,2];case 1:r.sent(),window.grecaptcha.reset(),r.label=2;case 2:return[3,4];case 3:return t=r.sent(),console.log("Get captcha error",t),[3,4];case 4:return[2]}})})}function Et(t,e){t._savedLastViewedProducts=l(t._lastViewedProducts),t._savedLastViewedProductsResponse=e}function Lt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,r.sent().apiGetLastViewedProducts)({customerId:e.customer.id})];case 2:return t=r.sent(),e._lastViewedProducts=(null===(n=l(t.data))||void 0===n?void 0:n.reverse())||[],[3,4];case 3:Nt(e),r.label=4;case 4:return[2,e._lastViewedProducts]}})})}function Nt(t){d()||(t._lastViewedProducts=Ot(),t._lastViewedProducts=l(t._lastViewedProducts).reverse())}function Ot(){if(d())return[];try{var t=window.localStorage.getItem(E);if(t)return JSON.parse(t)}catch(t){console.error(t)}return[]}function Rt(e,n,i){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?e._lastViewedProducts.find(function(t){return t.productId===n})?[2]:[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,t.sent().apiSaveLastViewedProducts)({input:{customerId:e.customer.id,products:[{productId:n,variantId:i}]}})];case 2:return t.sent()&&e._lastViewedProducts.push({productId:n,variantId:i}),[3,4];case 3:e._lastViewedProducts=Ot(),e._lastViewedProducts=e._lastViewedProducts.filter(function(t){return t.productId!==n}),e._lastViewedProducts.push({productId:n,variantId:i}),e._lastViewedProducts=e._lastViewedProducts.slice(-20),function(t){d()||window.localStorage.setItem(E,JSON.stringify(t._lastViewedProducts))}(e),t.label=4;case 4:return[2]}})})}function At(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:if(d())return[2];r.label=1;case 1:return r.trys.push([1,5,,6]),(t=Ot()).length?[4,import("../../api/customer/index.js")]:[3,4];case 2:return[4,(0,r.sent().apiSaveLastViewedProducts)({input:{customerId:e.customer.id,products:t}})];case 3:r.sent()&&(d()||window.localStorage.removeItem(E)),r.label=4;case 4:return[3,6];case 5:return n=r.sent(),console.error(n),[3,6];case 6:return[2]}})})}function Vt(t){return t._customerConsentGranted}function Dt(t){d()||window.localStorage.removeItem(L)}function Ut(t){var e;return{addresses:null===(e=t.addresses)||void 0===e?void 0:e.map(function(t){return{addressLine1:t.addressLine1,addressLine2:t.addressLine2,city:t.city,company:t.company,country:t.country,createdAt:t.createdAt,deleted:t.deleted,district:t.district,firstName:t.firstName,id:t.id,identityNumber:t.identityNumber,isDefault:t.isDefault,lastName:t.lastName,phone:t.phone,postalCode:t.postalCode,region:t.region,state:t.state,taxNumber:t.taxNumber,taxOffice:t.taxOffice,title:t.title,updatedAt:t.updatedAt}}),attributes:t.attributes,birthDate:t.birthDate,firstName:t.firstName,gender:t.gender,lastName:t.lastName,phone:t.phone,phoneSubscriptionStatus:t.phoneSubscriptionStatus,smsSubscriptionStatus:t.smsSubscriptionStatus,subscriptionStatus:t.subscriptionStatus}}function Mt(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../api/loyalty/index.js")];case 1:return[4,(0,t.sent().apiListEarningMethods)()];case 2:return[2,t.sent().data]}})})}function Bt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return[4,ht(e)];case 1:return r.sent(),(t=null===(n=u.cart)||void 0===n?void 0:n.id)?[4,import("../../api/loyalty/index.js")]:[2,[]];case 2:return[4,(0,r.sent().apiListSpendingMethodsByCartId)({cartId:t})];case 3:return[2,r.sent().data]}})})}function Gt(e){return t(this,void 0,void 0,function(){var t,n,i,s,o,a,c;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),[4,ht(e)];case 1:return r.sent(),t=null===(s=u.cart)||void 0===s?void 0:s.id,n=null===(c=null===(a=null===(o=u.cart)||void 0===o?void 0:o.loyaltyLines)||void 0===a?void 0:a[0])||void 0===c?void 0:c.loyaltySpendingMethodId,t&&n?[4,import("../../api/loyalty/index.js")]:[2];case 2:return[4,(0,r.sent().apiRemoveLoyaltyPointsFromCart)({cartId:t,loyaltySpendingMethodId:n})];case 3:return r.sent().isSuccess?[4,f()]:[3,5];case 4:r.sent(),r.label=5;case 5:return[3,7];case 6:return i=r.sent(),console.error(i),[3,7];case 7:return[2]}})})}function Wt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return[4,ht(e)];case 1:return r.sent(),Ht(e)?(t=null===(n=u.cart)||void 0===n?void 0:n.id,[4,import("../../api/loyalty/index.js")]):[2,null];case 2:return[4,(0,r.sent().apiGetLoyaltyCustomerInfo)({cartId:t})];case 3:return[2,r.sent().data||null]}})})}function qt(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../api/loyalty/index.js")];case 1:return[4,(0,t.sent().apiListLoyaltyProgramTiers)()];case 2:return[2,t.sent().data]}})})}function Kt(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../api/loyalty/index.js")];case 1:return[4,(0,t.sent().apiListLoyaltyProgramPointHistory)(n)];case 2:return[2,t.sent().data]}})})}function zt(n,i){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return(t=null===(n=u.cart)||void 0===n?void 0:n.id)?[4,import("../../api/loyalty/index.js")]:[2,null];case 1:return[4,(0,r.sent().apiUseLoyaltyPoints)({input:e(e({},i.input),{cartId:t})})];case 2:return[2,r.sent().data||null]}})})}function Ht(t){return!!t.customer}function Jt(t){return t._accountInfoForm||(t._accountInfoForm={},_(t._accountInfoForm)),t._accountInfoForm}function Xt(t){t._accountInfoForm=null}function Yt(t){return t._contactForm||(t._contactForm={},w(t._contactForm)),t._contactForm}function Qt(t){t._contactForm=null}function Zt(t){return t._couponCodeForm||(t._couponCodeForm={},b(t._couponCodeForm)),t._couponCodeForm}function $t(t){t._couponCodeForm=null}function te(t){return t._forgotPasswordForm||(t._forgotPasswordForm={},S(t._forgotPasswordForm)),t._forgotPasswordForm}function ee(t){t._forgotPasswordForm=null}function re(t){return t._loginForm||(t._loginForm={},g(t._loginForm)),t._loginForm}function ne(t){return t._smsLoginForm||(t._smsLoginForm={},k(t._smsLoginForm)),t._smsLoginForm}function ie(t){return t._verifyPhoneNumberForm||(t._verifyPhoneNumberForm={},F(t._verifyPhoneNumberForm)),t._verifyPhoneNumberForm}function se(t){t._loginForm=null}function oe(t){return t._newsletterSubscriptionForm||(t._newsletterSubscriptionForm={},I(t._newsletterSubscriptionForm)),t._newsletterSubscriptionForm}function ae(t){t._newsletterSubscriptionForm=null}function ce(t){return t._orderTrackingForm||(t._orderTrackingForm={},y(t._orderTrackingForm)),t._orderTrackingForm}function ue(t){t._orderTrackingForm=null}function de(t){return t._recoverPasswordForm||(t._recoverPasswordForm={},x(t._recoverPasswordForm)),t._recoverPasswordForm}function le(t){t._recoverPasswordForm=null}function me(t){return t._registerForm||(t._registerForm={},j(t._registerForm)),t._registerForm}function fe(t){t._registerForm=null}function pe(t){var e={};return v(e),s(e)}function ve(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return"ORDER_DETAIL"!==c.currentPageType||"undefined"==typeof window?[3,4]:(t=a.getCurrentPath().split("/").pop(),!i.isPreview||t&&"orders"!==t?[3,2]:[4,tt(e)]);case 1:(n=r.sent()).length&&(t=n[0].id),r.label=2;case 2:return t?[4,et(e,t)]:[3,4];case 3:return[2,r.sent()];case 4:return[2]}})})}function he(t){try{window.openIkasStorefrontWidget()}catch(t){console.error("Failed to open ikas storefront widget",t)}}function _e(t){try{window.closeIkasStorefrontWidget()}catch(t){console.error("Failed to close ikas storefront widget",t)}}export{q as activateCustomer,ot as addProductToFavorites,O as canCustomerCreateEmailSubscription,Y as checkEmail,Xt as clearAccountInfoForm,Qt as clearContactForm,$t as clearCouponCodeForm,ee as clearForgotPasswordForm,se as clearLoginForm,ae as clearNewsletterSubscriptionForm,ue as clearOrderTrackingForm,le as clearRecoverPasswordForm,fe as clearRegisterForm,_e as closeIkasStorefrontWidget,dt as createEmailSubscription,Wt as cs_getLoyaltyCustomerInfo,Mt as cs_listEarningMethods,Kt as cs_listLoyaltyProgramPointHistory,qt as cs_listLoyaltyProgramTiers,Bt as cs_listSpendingMethodsByCartId,Gt as cs_removeLoyaltyPointsFromCart,zt as cs_useLoyaltyPoints,B as customerLogin,Rt as customerStore_onProductView,R as customerToAnalyticsCustomer,ft as deactivateCustomer,U as deleteCustomerAddress,pt as exportCustomerPersonalData,Q as forgotPassword,Jt as getAccountInfoForm,Yt as getContactForm,Zt as getCouponCodeForm,wt as getCustomerAttributes,Vt as getCustomerConsentGranted,St as getDigitalProductFileDownloadUrl,pe as getEmptyAddressForm,st as getFavoriteProducts,it as getFavoriteProductsIds,te as getForgotPasswordForm,Lt as getLastViewedProducts,re as getLoginForm,oe as getNewsletterSubscriptionForm,et as getOrder,rt as getOrderByEmail,ve as getOrderDetailsOfPage,bt as getOrderProductFiles,gt as getOrderRefundSettings,ce as getOrderTrackingForm,nt as getOrderTransactions,tt as getOrders,de as getRecoverPasswordForm,me as getRegisterForm,ne as getSmsLoginForm,ie as getVerifyPhoneNumberForm,vt as handleCustomerConsentGrant,V as handleSocialLogin,Ht as hasCustomer,N as initCustomerStore,ut as isFavoriteProduct,G as logout,he as openIkasStorefrontWidget,Z as recoverPassword,M as refundOrder,W as register,Dt as removeCustomerConsent,at as removeProductFromFavorites,K as resendCustomerActivationMail,J as resendCustomerPhoneVerificationCode,X as saveContactForm,$ as saveCustomer,lt as saveCustomerFormData,mt as sendReview,Tt as setCaptchaToken,Et as setSavedLastViewedProductsResponse,A as socialLogin,D as socialLoginToken,z as validateCustomerPhoneVerificationCode,H as validateOTPCode,_t as waitForCaptchaTokenInit,ht as waitForCustomerStoreInit};
|