@ikas/bp-storefront 1.4.0-beta.190 → 1.4.0-beta.191
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.
- package/dist/analytics/analytics-functions/addToCart.js +1 -1
- package/dist/analytics/analytics-functions/completeRegistration.js +1 -1
- package/dist/analytics/analytics-functions/contactForm.js +1 -1
- package/dist/analytics/analytics-functions/createEmailSubscription.js +1 -1
- package/dist/analytics/analytics-functions/customerLogin.js +1 -1
- package/dist/analytics/analytics-functions/pageView.js +1 -1
- package/dist/analytics/analytics-functions/productView.js +1 -1
- package/dist/analytics/ikas/analytics.js +1 -1
- package/dist/analytics/openai/addToCart.d.ts +2 -0
- package/dist/analytics/openai/addToCart.js +1 -0
- package/dist/analytics/openai/completeRegistration.d.ts +1 -0
- package/dist/analytics/openai/completeRegistration.js +1 -0
- package/dist/analytics/openai/contactForm.d.ts +1 -0
- package/dist/analytics/openai/contactForm.js +1 -0
- package/dist/analytics/openai/initAdvancedMatching.d.ts +12 -0
- package/dist/analytics/openai/initAdvancedMatching.js +1 -0
- package/dist/analytics/openai/pageView.d.ts +1 -0
- package/dist/analytics/openai/pageView.js +1 -0
- package/dist/analytics/openai/productView.d.ts +2 -0
- package/dist/analytics/openai/productView.js +1 -0
- package/dist/analytics/openai/utils.d.ts +26 -0
- package/dist/analytics/openai/utils.js +1 -0
- package/dist/analytics/utils.d.ts +1 -0
- package/dist/analytics/utils.js +1 -1
- package/dist/functions/api/customer/index.d.ts +5 -0
- package/dist/functions/api/customer/index.js +1 -1
- package/dist/functions/stores/cart/index.js +1 -1
- package/dist/functions/stores/customer/index.d.ts +149 -2
- package/dist/functions/stores/customer/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/packages/storefront-api/src/__api/mutations/unlinkExternalAccount.js +1 -0
- package/dist/packages/storefront-api/src/__api/queries/getExternalAccountLink.js +1 -0
- package/dist/packages/storefront-api/src/__api/queries/getMilesSmilesDetails.js +1 -0
- package/dist/storefront-api/src/__api/mutations/unlinkExternalAccount.d.ts +6 -0
- package/dist/storefront-api/src/__api/queries/getExternalAccountLink.d.ts +6 -0
- package/dist/storefront-api/src/__api/queries/getMilesSmilesDetails.d.ts +3 -0
- package/dist/storefront-api/src/__api/types/index.d.ts +18 -0
- package/dist/storefront-config/src/index.d.ts +2 -0
- package/dist/storefront-models/src/models/payment-gateway/index.d.ts +2 -0
- package/dist/storefront-models/src/models/storefront/index.d.ts +1 -0
- package/dist/utils/helper.d.ts +1 -0
- package/dist/utils/helper.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as a}from'./../../ext/tslib/tslib.es6.mjs.js';import{notifySubscribers as e}from"../events.js";import{
|
|
1
|
+
import{__awaiter as t,__generator as a}from'./../../ext/tslib/tslib.es6.mjs.js';import{notifySubscribers as e}from"../events.js";import{hasOpenAiPixel as r,hasTiktokPixel as s,hasGoogleAnalytics as o,hasGoogleTagManager as n,canTrack as i,hasFacebookPixel as d}from"../utils.js";function c(c,l,u,m,p){return t(this,void 0,void 0,function(){var t;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,13,,14]),i()?(e({type:"ADD_TO_CART",data:{item:c,quantity:l,cart:m}}),d()?[4,import("../facebook/addToCart.js")]:[3,2]):[2];case 1:(0,a.sent().fbp_addToCart)(c,u),a.label=2;case 2:return n()?[4,import("../google-tag-manager/addToCart.js")]:[3,4];case 3:(0,a.sent().gtm_addToCart)(c,l,p),a.label=4;case 4:return[4,import("../ikas/analytics.js")];case 5:return[4,(0,a.sent().iks_addToCart)(c,m,u)];case 6:return a.sent(),o()?[4,import("../google-analytics/addToCart.js")]:[3,8];case 7:(0,a.sent().ga_addToCart)(c,l),a.label=8;case 8:return s()?[4,import("../tiktok/addToCart.js")]:[3,10];case 9:(0,a.sent().tik_addToCart)(c,l),a.label=10;case 10:return r()?[4,import("../openai/addToCart.js")]:[3,12];case 11:(0,a.sent().oai_addToCart)(c,l,u),a.label=12;case 12:return[3,14];case 13:return t=a.sent(),console.error(t),[3,14];case 14:return[2]}})})}export{c as anl_addToCart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as
|
|
1
|
+
import{__awaiter as e,__generator as t,__assign as i}from'./../../ext/tslib/tslib.es6.mjs.js';import{notifySubscribers as s}from"../events.js";import{hasOpenAiPixel as a,hasTiktokPixel as n,hasGoogleTagManager as r,hasFacebookPixel as o,canTrack as c}from"../utils.js";function l(l,m){return e(this,void 0,void 0,function(){var e,p,u;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,15,,16]),c()?(s({type:"CUSTOMER_REGISTER",data:i({email:l.email,firstName:l.firstName,lastName:l.lastName,notificationsAccepted:l.subscriptionStatus},m?{attributes:l.attributes}:{})}),e={em:l.email,fn:l.firstName,ln:l.lastName,ph:l.phone,external_id:l.id},o()?[4,import("../facebook/initAdvancedMatching.js")]:[3,2]):[2];case 1:(0,t.sent().fbp_initAdvancedMatching)(e),t.label=2;case 2:return a()?[4,import("../openai/initAdvancedMatching.js")]:[3,4];case 3:(0,t.sent().oai_initAdvancedMatching)(e),t.label=4;case 4:return p=Date.now().toString(),m?[3,12]:o()?[4,import("../facebook/completeRegistration.js")]:[3,6];case 5:(0,t.sent().fbp_completeRegistration)(p),t.label=6;case 6:return r()?[4,import("../google-tag-manager/completeRegistration.js")]:[3,8];case 7:(0,t.sent().gtm_completeRegistration)(l),t.label=8;case 8:return n()?[4,import("../tiktok/completeRegistration.js")]:[3,10];case 9:(0,t.sent().tik_completeRegistration)(),t.label=10;case 10:return a()?[4,import("../openai/completeRegistration.js")]:[3,12];case 11:(0,t.sent().oai_completeRegistration)(p),t.label=12;case 12:return[4,import("../ikas/analytics.js")];case 13:return[4,(0,t.sent().iks_customerRegister)(p)];case 14:return t.sent(),[3,16];case 15:return u=t.sent(),console.error(u),[3,16];case 16:return[2]}})})}export{l as anl_completeRegistration};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as r}from'./../../ext/tslib/tslib.es6.mjs.js';import{notifySubscribers as e}from"../events.js";import{
|
|
1
|
+
import{__awaiter as t,__generator as r}from'./../../ext/tslib/tslib.es6.mjs.js';import{notifySubscribers as e}from"../events.js";import{hasOpenAiPixel as o,hasTiktokPixel as s,canTrack as n,hasFacebookPixel as a}from"../utils.js";function c(c){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,9,,10]),n()?(t=Date.now().toString(),e({type:"CONTACT_FORM",data:{form:c}}),a()?[4,import("../facebook/contactForm.js")]:[3,2]):[2];case 1:(0,r.sent().fbp_contactForm)(t),r.label=2;case 2:return s()?[4,import("../tiktok/contactForm.js")]:[3,4];case 3:(0,r.sent().tik_contactForm)(),r.label=4;case 4:return o()?[4,import("../openai/contactForm.js")]:[3,6];case 5:(0,r.sent().oai_contactForm)(t),r.label=6;case 6:return[4,import("../ikas/analytics.js")];case 7:return[4,(0,r.sent().iks_contactForm)(t)];case 8:return r.sent(),[3,10];case 9:return i=r.sent(),console.error(i),[3,10];case 10:return[2]}})})}export{c as anl_contactForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.mjs.js';import{notifySubscribers as n}from"../events.js";import{hasOpenAiPixel as i,canTrack as r,hasFacebookPixel as s}from"../utils.js";function a(a){return e(this,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,5,,6]),r()?(n({type:"EMAIL_SUBSCRIPTION",data:{email:a}}),s()?[4,import("../facebook/initAdvancedMatching.js")]:[3,2]):[2];case 1:(0,t.sent().fbp_initAdvancedMatching)({em:a}),t.label=2;case 2:return i()?[4,import("../openai/initAdvancedMatching.js")]:[3,4];case 3:(0,t.sent().oai_initAdvancedMatching)({em:a}),t.label=4;case 4:return[3,6];case 5:return e=t.sent(),console.error(e),[3,6];case 6:return[2]}})})}export{a as anl_createEmailSubscription};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.mjs.js';import{notifySubscribers as s}from"../events.js";import{hasGoogleTagManager as r,hasFacebookPixel as
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.mjs.js';import{notifySubscribers as s}from"../events.js";import{hasGoogleTagManager as n,hasOpenAiPixel as r,hasFacebookPixel as i,canTrack as a}from"../utils.js";import{getCustomerInfo as o}from"./helpers.js";function c(){return e(this,void 0,void 0,function(){var e,c,m;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,10,,11]),a()?[4,o()]:[2];case 1:return(e=t.sent())&&e.email?(s({type:"CUSTOMER_LOGIN",data:{customer:e}}),c={em:e.email,fn:e.firstName,ln:e.lastName,ph:e.phone,external_id:e.id},i()?[4,import("../facebook/initAdvancedMatching.js")]:[3,3]):[2];case 2:(0,t.sent().fbp_initAdvancedMatching)(c),t.label=3;case 3:return r()?[4,import("../openai/initAdvancedMatching.js")]:[3,5];case 4:(0,t.sent().oai_initAdvancedMatching)(c),t.label=5;case 5:return n()?[4,import("../google-tag-manager/customerLogin.js")]:[3,7];case 6:(0,t.sent().gtm_customerLogin)(e),t.label=7;case 7:return[4,import("../ikas/analytics.js")];case 8:return[4,(0,t.sent().iks_customerLogin)()];case 9:return t.sent(),[3,11];case 10:return m=t.sent(),console.error(m),[3,11];case 11:return[2]}})})}export{c as anl_customerLogin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.mjs.js';import{notifySubscribers as s}from"../events.js";import{
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.mjs.js';import{notifySubscribers as s}from"../events.js";import{hasOpenAiPixel as r,hasTiktokPixel as a,hasFacebookPixel as i,hasGoogleTagManager as n,canTrack as o}from"../utils.js";import{getCustomerInfo as c}from"./helpers.js";function p(p){return e(this,void 0,void 0,function(){var e,u,l,m;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,14,,15]),o()?[4,import("../ikas/analytics.js")]:[2];case 1:return[4,(0,t.sent().iks_checkJourneyId)()];case 2:return t.sent(),e=window.location.href,[4,c()];case 3:return u=t.sent(),l=Date.now().toString(),s({type:"PAGE_VIEW",data:{url:e,pageType:p,customer:u}}),n()?[4,import("../google-tag-manager/pageView.js")]:[3,5];case 4:(0,t.sent().gtm_pageView)(e),t.label=5;case 5:return i()?[4,import("../facebook/pageView.js")]:[3,7];case 6:(0,t.sent().fbp_pageView)(l),t.label=7;case 7:return[4,import("../ikas/analytics.js")];case 8:return[4,(0,t.sent().iks_pageView)(p,l)];case 9:return t.sent(),a()?[4,import("../tiktok/pageView.js")]:[3,11];case 10:(0,t.sent().tik_pageView)(e),t.label=11;case 11:return r()?[4,import("../openai/pageView.js")]:[3,13];case 12:(0,t.sent().oai_pageView)(l),t.label=13;case 13:return[3,15];case 14:return m=t.sent(),console.error(m),[3,15];case 15:return[2]}})})}export{p as anl_pageView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.mjs.js';import{notifySubscribers as r}from"../events.js";import{hasOpenAiPixel as s,hasTiktokPixel as o,hasGoogleAnalytics as i,hasGoogleTagManager as a,canTrack as c,hasFacebookPixel as n}from"../utils.js";function u(u){return e(this,void 0,void 0,function(){var e,p;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,13,,14]),c()?(e=Date.now().toString(),r({type:"PRODUCT_VIEW",data:{productDetail:u}}),n()?[4,import("../facebook/productView.js")]:[3,2]):[2];case 1:(0,t.sent().fbp_productView)(u,e),t.label=2;case 2:return a()?[4,import("../google-tag-manager/productView.js")]:[3,4];case 3:(0,t.sent().gtm_productView)(u),t.label=4;case 4:return[4,import("../ikas/analytics.js")];case 5:return[4,(0,t.sent().iks_productView)(u,e)];case 6:return t.sent(),i()?[4,import("../google-analytics/productView.js")]:[3,8];case 7:(0,t.sent().ga_productView)(u),t.label=8;case 8:return o()?[4,import("../tiktok/productView.js")]:[3,10];case 9:(0,t.sent().tik_productView)(u),t.label=10;case 10:return s()?[4,import("../openai/productView.js")]:[3,12];case 11:(0,t.sent().oai_productView)(u,e),t.label=12;case 12:return[3,14];case 13:return p=t.sent(),console.error(p),[3,14];case 14:return[2]}})})}export{u as anl_productView};
|
|
@@ -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'./../../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'./../../ext/lodash/_isFlattenable.js';import'./../../ext/lodash/sortBy.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",_=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 f(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({},W()),{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({},W()),{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({},W()),{d:{crt:{id:i.id,c:i.currencyCode,pr:i.totalFinalPrice,il:K(i)},crtItm:H(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.VIEW_CART,ts:Date.now(),d:n(n({},W()),{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({},W()),{d:{chk:{id:r.id,s:"success",p:r.totalFinalPrice,c:r.currencyCode,il:K(r)}}})}])];case 1:return t.sent(),[4,y()];case 2: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.BEGIN_CHECKOUT,ts:Date.now(),d:n(n({},W()),{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({},W()),{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({},W()),{d:{cst:F()}})}])];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({},W()),{d:{cst:F()}})}])];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({},W()),{d:{cst:F()}})}])];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({},W()),{d:{cst:F(),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({},W()),{d:{cst:F(),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({},W()),{d:{cst:F()},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({},W()),{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({},W())}])];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({},W()),{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(_.JOURNEY_ID_KEY),_.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(_.JOURNEY_ID_KEY))?(_.journeyId=t,[3,3]):[3,1];case 1:return[4,V()];case 2:e.sent(),e.label=3;case 3:return r.init({journeyId:_.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 y(){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()+_.EXPIRY_LENGTH,t=r,localStorage.setItem(_.SESSION_ID_KEY,JSON.stringify(t)),_.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 V(){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(_.JOURNEY_ID_KEY,t),_.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(_.SESSION_ID_KEY))?(n=JSON.parse(t)).expiry<Date.now()||n.id.length<=13?[4,y()]:[3,2]:[3,4];case 1:return e.sent(),[3,3];case 2:_.sessionId=n.id,e.label=3;case 3:return[3,6];case 4:return[4,y()];case 5:e.sent(),e.label=6;case 6:return r.init({sessionId:_.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({},W())}])];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(_.VISITOR_ID_KEY))&&t.length>13?(_.visitorId=t,[3,3]):[3,1];case 1:return n=_,[4,j()];case 2:n.visitorId=e.sent(),localStorage.setItem(_.VISITOR_ID_KEY,_.visitorId),e.label=3;case 3:return r.init({visitorId:_.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 F(){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 W(){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,f,T,I,m;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:_.sessionId,jid:_.journeyId,vid:_.visitorId,sfrid:r.storefrontRoutingId||"",ud:n(n(n(n({id:null===(u=c.customer)||void 0===u?void 0:u.id},(null===(d=c.customer)||void 0===d?void 0:d.email)?{em:null===(a=c.customer)||void 0===a?void 0:a.email}:{}),(null===(E=c.customer)||void 0===E?void 0:E.phone)?{ph:null===(O=c.customer)||void 0===O?void 0:O.phone}:{}),(null===(f=c.customer)||void 0===f?void 0:f.lastName)?{ln:null===(T=c.customer)||void 0===T?void 0:T.lastName}:{}),(null===(I=c.customer)||void 0===I?void 0:I.firstName)?{fn:null===(m=c.customer)||void 0===m?void 0:m.firstName}:{}),v:3},s=JSON.stringify(t),[4,fetch(R,{method:"POST",body:s,headers:{"Content-Type":"application/json","x-api-key":r.apiKey},keepalive:s.length<3e4})];case 5:return e.sent(),[3,7];case 6:return o=e.sent(),console.error(o),[3,7];case 7:return[2]}})})}export{_ as default,I as iks_addToCart,w as iks_addToWishlist,C 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,f as iks_pageView,T as iks_productView,v as iks_purchase,G as iks_refreshJourneyId,P as iks_search,A as iks_viewBrand,m 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,getOpenAiAttributionMetadata as o}from"../../utils/helper.js";import"../../router/index.js";import"../../stores/cart/index.js";import{getCategoryPath as c}from"../../functions/models/category/index.js";import{customerStore as u}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 d,getProductVariantFinalPrice as a}from"../../functions/models/product/variant/index.js";import'./../../ext/lodash/_isFlattenable.js';import'./../../ext/lodash/sortBy.js';import{baseStore as l}from"../../stores/base/index.js";import{waitForCustomerStoreInit as E}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 O,R;!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"}(O||(O={})),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"}(R||(R={}));var _=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 T(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,k([{id:i,t:O.PAGE_VIEW,ts:Date.now(),d:n(n({},K()),{pt:F(r)})}])];case 1:return t.sent(),[2]}})})}function I(r,s){return t(this,void 0,void 0,function(){var t,o,u,l;return e(this,function(e){switch(e.label){case 0:return t=[],o=[],r.categories&&r.categories.length>0&&c(r.categories[0]).map(function(e){t.push(e.name),o.push(e.id)}),u=i(r),l=d(u),[4,k([{id:s,t:O.PRODUCT_VIEW,ts:Date.now(),d:n(n({},K()),{d:n({pr:n({id:r.id,vid:u.id,cp:t,cid:o,n:r.name,pr:a(u)},(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 m(r,i,s){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,k([{id:s,t:O.ADD_TO_CART,ts:Date.now(),d:n(n({},K()),{d:{crt:{id:i.id,c:i.currencyCode,pr:i.totalFinalPrice,il:H(i)},crtItm:M(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,k([{id:i,t:O.VIEW_CART,ts:Date.now(),d:n(n({},K()),{d:{crt:{id:r.id,c:r.currencyCode,pr:r.totalFinalPrice,il: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,k([{id:i,t:O.ORDER_SUCCESS,ts:Date.now(),d:n(n({},K()),{d:{chk:{id:r.id,s:"success",p:r.totalFinalPrice,c:r.currencyCode,il:H(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,k([{id:i,t:O.BEGIN_CHECKOUT,ts:Date.now(),d:n(n({},K()),{d:{chk:{id:r.id,p:r.totalFinalPrice,c:r.currencyCode,il:H(r)}}})}])];case 1:return t.sent(),[2]}})})}function h(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,k([{t:O.CHECKOUT_STEP,ts:Date.now(),d:n(n({},K()),{d:{chk:{id:r.id,s:i,p:r.totalFinalPrice,c:r.currencyCode,il:H(r)}}})}])];case 1:return t.sent(),[2]}})})}function D(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,k([{id:r,t:O.CUSTOMER_REGISTER,ts:Date.now(),d:n(n({},K()),{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,k([{t:O.CUSTOMER_LOGIN,ts:Date.now(),d:n(n({},K()),{d:{cst:W()}})}])];case 1:return t.sent(),[2]}})})}function A(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,k([{t:O.CUSTOMER_VISIT,ts:Date.now(),d:n(n({},K()),{d:{cst:W()}})}])];case 1:return t.sent(),[2]}})})}function N(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,k([{t:O.BRAND_VIEW,ts:Date.now(),d:n(n({},K()),{d:{cst:W(),br:{id:r.id}}})}])];case 1:return t.sent(),[2]}})})}function U(r,i,s){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,k([{id:s,t:O.CATEGORY_VIEW,ts:Date.now(),d:n(n({},K()),{d:{cst:W(),ctg:{id:r.id,cp:i}}})}])];case 1:return t.sent(),[2]}})})}function P(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,k([{t:O.POPUP_VIEW,ts:Date.now(),d:n(n({},K()),{d:{cst:W()},m:{sfpid:r}})}])];case 1:return t.sent(),[2]}})})}function x(r,i,s){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,k([{id:i,t:O.SEARCH,ts:Date.now(),d:n(n({},K()),{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,k([{id:r,t:O.CONTACT_FORM,ts:Date.now(),d:n({},K())}])];case 1:return t.sent(),[2]}})})}function G(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,k([{id:i,t:O.FAVORITE_PRODUCT,ts:Date.now(),d:n(n({},K()),{d:{pr:{id:r}}})}])];case 1:return t.sent(),[2]}})})}function b(){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,j()];case 1:return t.sent(),[2]}})})}function j(){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,g()];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 y(){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,y()];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,Y()];case 2:return e.sent(),[3,4];case 3:return n=e.sent(),console.error(n),[3,4];case 4:return[2]}})})}function g(){return t(this,void 0,void 0,function(){var t;return e(this,function(e){switch(e.label){case 0:return[4,y()];case 1:return t=e.sent(),localStorage.setItem(f.JOURNEY_ID_KEY,t),f.journeyId=t,[2]}})})}function L(){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 Y(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,k([{t:O.SESSION_START,ts:Date.now(),d:n({},K())}])];case 1:return t.sent(),[2]}})})}function B(){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,y()];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 F(t){switch(t){case"INDEX":return R.INDEX;case"CATEGORY":return R.CATEGORY;case"BRAND":return R.BRAND;case"PRODUCT":return R.PRODUCT;case"CUSTOM":return R.CUSTOM;case"ACCOUNT":return R.ACCOUNT;case"ADDRESSES":return R.ADDRESSES;case"ORDERS":return R.ORDERS;case"ORDER_DETAIL":return R.ORDER_DETAIL;case"LOGIN":return R.LOGIN;case"REGISTER":return R.REGISTER;case"FORGOT_PASSWORD":return R.FORGOT_PASSWORD;case"RECOVER_PASSWORD":return R.RECOVER_PASSWORD;case"CART":return R.CART;case"FAVORITE_PRODUCTS":return R.FAVORITE_PRODUCTS;case"SEARCH":return R.SEARCH;case"NOT_FOUND":return R.NOT_FOUND;case"BLOG":return R.BLOG;case"BLOG_INDEX":return R.BLOG_INDEX;case"BLOG_CATEGORY":return R.BLOG_CATEGORY;case"CHECKOUT":return R.CHECKOUT}}function W(){var t=u.customer;return{id:(null==t?void 0:t.id)||void 0,e:(null==t?void 0:t.email)||void 0,c:u._customerConsentGranted}}function K(){return{u:window.location.href,r:document.referrer,pt:l.currentPageType?F(l.currentPageType):void 0,m:n({fbp:s("_fbp"),fbc:s("_fbc")},o())}}function H(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 M(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 k(i){return t(this,void 0,void 0,function(){var t,s,o,c,d,a,l,O,R,T,I,m;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,6,,7]),[4,E(u)];case 1:return e.sent(),[4,L()];case 2:return e.sent(),[4,B()];case 3:return e.sent(),[4,j()];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===(c=u.customer)||void 0===c?void 0:c.id},(null===(d=u.customer)||void 0===d?void 0:d.email)?{em:null===(a=u.customer)||void 0===a?void 0:a.email}:{}),(null===(l=u.customer)||void 0===l?void 0:l.phone)?{ph:null===(O=u.customer)||void 0===O?void 0:O.phone}:{}),(null===(R=u.customer)||void 0===R?void 0:R.lastName)?{ln:null===(T=u.customer)||void 0===T?void 0:T.lastName}:{}),(null===(I=u.customer)||void 0===I?void 0:I.firstName)?{fn:null===(m=u.customer)||void 0===m?void 0:m.firstName}:{}),v:3},s=JSON.stringify(t),[4,fetch(_,{method:"POST",body:s,headers:{"Content-Type":"application/json","x-api-key":r.apiKey},keepalive:s.length<3e4})];case 5:return e.sent(),[3,7];case 6:return o=e.sent(),console.error(o),[3,7];case 7:return[2]}})})}export{f as default,m as iks_addToCart,G as iks_addToWishlist,S as iks_beginCheckout,j as iks_checkJourneyId,h as iks_checkoutStep,w as iks_contactForm,p as iks_customerLogin,D as iks_customerRegister,A as iks_customerVisit,T as iks_pageView,I as iks_productView,C as iks_purchase,b as iks_refreshJourneyId,x as iks_search,N as iks_viewBrand,v as iks_viewCart,U as iks_viewCategory,P as iks_viewPopup};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__assign as t}from'./../../ext/tslib/tslib.es6.mjs.js';import{extractCartItemData as o}from"../utils.js";import{hasOpenAi as r,measure as s,toOpenAiMoney as e,cartItemToOpenAiContent as i}from"./utils.js";function c(c,m,n){if(r())try{var d=o(c,m);s("items_added",t(t({type:"contents"},e(d.price*m,d.currency||void 0)),{contents:[i(d)]}),n)}catch(t){console.error(t)}}export{c as oai_addToCart};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function oai_completeRegistration(eventId: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{hasOpenAi as t,measure as o}from"./utils.js";function r(r){if(t())try{o("registration_completed",{type:"customer_action"},r)}catch(t){console.error(t)}}export{r as oai_completeRegistration};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function oai_contactForm(eventId: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{hasOpenAi as t,measure as o}from"./utils.js";function r(r){if(t())try{o("lead_created",{type:"customer_action"},r)}catch(t){console.error(t)}}export{r as oai_contactForm};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type AdvancedMatchingUserData = {
|
|
2
|
+
em?: string | null;
|
|
3
|
+
fn?: string | null;
|
|
4
|
+
ln?: string | null;
|
|
5
|
+
ph?: string | null;
|
|
6
|
+
external_id?: string | null;
|
|
7
|
+
ct?: string | null;
|
|
8
|
+
st?: string | null;
|
|
9
|
+
zp?: string | null;
|
|
10
|
+
country?: string | null;
|
|
11
|
+
};
|
|
12
|
+
export declare function oai_initAdvancedMatching(userData: AdvancedMatchingUserData): Promise<void> | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__awaiter as t,__generator as e}from'./../../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as r}from"../../packages/storefront-config/src/index.js";import{hasOpenAi as n,chainAdvancedMatching as i,oaiq as o}from"./utils.js";function s(s){var l=r.openAiPixelId;if(n()&&l)return i(function(){return function(r,n){return t(this,void 0,void 0,function(){var t,i,s,l,d,m,h;return e(this,function(e){switch(e.label){case 0:return[4,Promise.all([p(u(n.em)),p(a(n.ph)),p(c(n.external_id)),p(f(n.fn)),p(f(n.ln))])];case 1:return t=e.sent(),i=t[0],s=t[1],l=t[2],d=t[3],m=t[4],h={},i&&(h.email_sha256=i),s&&(h.phone_number_sha256=s),l&&(h.external_id_sha256=l),d&&(h.first_name_sha256=d),m&&(h.last_name_sha256=m),n.country&&(h.country=n.country.toUpperCase().trim()),n.ct&&(h.city=n.ct.trim()),n.st&&(h.region=n.st.trim()),n.zp&&(h.postal_code=n.zp.trim()),o()&&Object.keys(h).length>0&&o()("init",{pixelId:r,user:h}),[2]}})})}(l,s)})}function u(t){return t?t.trim().toLowerCase():""}function a(t){if(!t)return"";var e=t.replace(/\D/g,"").replace(/^0+/,"");return/^\d{8,15}$/.test(e)?e:""}function c(t){return t?t.trim():""}function f(t){return t?t.toLowerCase().replace(/[\s!-/:-@[-`{-~]/g,""):""}var l=new Map;function p(r){if(!r)return Promise.resolve(void 0);var n=l.get(r);return n||(n=function(r){return t(this,void 0,void 0,function(){var t;return e(this,function(e){switch(e.label){case 0:if("undefined"==typeof crypto||!crypto.subtle||"undefined"==typeof TextEncoder)return[2];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,crypto.subtle.digest("SHA-256",(new TextEncoder).encode(r))];case 2:return t=e.sent(),[2,Array.from(new Uint8Array(t)).map(function(t){return t.toString(16).padStart(2,"0")}).join("")];case 3:return e.sent(),[2];case 4:return[2]}})})}(r),l.set(r,n)),n}export{s as oai_initAdvancedMatching};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function oai_pageView(eventId: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{hasOpenAi as t,measure as e}from"./utils.js";function o(o){if(t())try{e("page_viewed",{type:"contents"},o)}catch(t){console.error(t)}}export{o as oai_pageView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__assign as t}from'./../../ext/tslib/tslib.es6.mjs.js';import{extractProductData as e}from"../utils.js";import{hasOpenAi as o,toOpenAiMoney as n,measure as r}from"./utils.js";function i(i,s){if(o())try{var c=e(i),m=n(c.price,c.currency);r("contents_viewed",t(t({type:"contents"},m),{contents:[t({id:c.variantId,name:c.name,content_type:"product",quantity:1},m)]}),s)}catch(t){console.error(t)}}export{i as oai_productView};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CommonCartItemData } from "../utils";
|
|
2
|
+
export type OpenAiEventName = "page_viewed" | "contents_viewed" | "items_added" | "registration_completed" | "lead_created";
|
|
3
|
+
export type OpenAiMoney = {
|
|
4
|
+
amount?: number;
|
|
5
|
+
currency?: string;
|
|
6
|
+
};
|
|
7
|
+
export type OpenAiContent = OpenAiMoney & {
|
|
8
|
+
id: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
content_type: "product" | "page";
|
|
11
|
+
quantity?: number;
|
|
12
|
+
};
|
|
13
|
+
export type OpenAiContentsData = OpenAiMoney & {
|
|
14
|
+
type: "contents";
|
|
15
|
+
contents?: OpenAiContent[];
|
|
16
|
+
};
|
|
17
|
+
export type OpenAiCustomerActionData = OpenAiMoney & {
|
|
18
|
+
type: "customer_action";
|
|
19
|
+
};
|
|
20
|
+
export type OpenAiEventData = OpenAiContentsData | OpenAiCustomerActionData;
|
|
21
|
+
export declare const oaiq: () => any;
|
|
22
|
+
export declare const hasOpenAi: () => any;
|
|
23
|
+
export declare function chainAdvancedMatching(task: () => Promise<void>): Promise<void>;
|
|
24
|
+
export declare function measure(eventName: OpenAiEventName, data: OpenAiEventData, eventId?: string): void;
|
|
25
|
+
export declare function cartItemToOpenAiContent(item: CommonCartItemData): OpenAiContent;
|
|
26
|
+
export declare function toOpenAiMoney(value: number | null | undefined, currency: string | undefined): OpenAiMoney;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__assign as n}from'./../../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as r}from"../../packages/storefront-config/src/index.js";import{canTrack as t}from"../utils.js";var e=function(){return window.oaiq},o=function(){return t()&&r.openAiPixelId&&e()},i=Promise.resolve();function u(n){return i=i.then(n).catch(function(n){return console.error(n)})}function c(n,r,t){i.then(function(){o()&&e()("measure",n,r,t?{event_id:t}:{})}).catch(function(n){return console.error(n)})}function a(r){return n({id:r.variantId,name:r.name,content_type:"product",quantity:r.quantity},s(r.price,r.currency||void 0))}function s(n,r){var t=function(n,r){var t;try{if("number"!=typeof n||isNaN(n)||!r)return;var e=m.get(r);return void 0===e&&(e=null!==(t=new Intl.NumberFormat("en",{style:"currency",currency:r}).resolvedOptions().maximumFractionDigits)&&void 0!==t?t:2,m.set(r,e)),Math.round(n*Math.pow(10,e))}catch(n){return}}(n,r);return void 0!==t&&r?{amount:t,currency:r}:{}}var m=new Map;export{a as cartItemToOpenAiContent,u as chainAdvancedMatching,o as hasOpenAi,c as measure,e as oaiq,s as toOpenAiMoney};
|
|
@@ -4,6 +4,7 @@ export declare const hasFacebookPixel: () => boolean;
|
|
|
4
4
|
export declare const hasGoogleAnalytics: () => boolean;
|
|
5
5
|
export declare const hasGoogleTagManager: () => boolean;
|
|
6
6
|
export declare const hasTiktokPixel: () => boolean;
|
|
7
|
+
export declare const hasOpenAiPixel: () => boolean;
|
|
7
8
|
export interface CommonProductData {
|
|
8
9
|
id: string;
|
|
9
10
|
variantId: string;
|
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 o}from"../utils/helper.js";import"../router/index.js";import"../stores/cart/index.js";import{getCategoryPath as r}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 t}from"../functions/models/image/index.js";import"../functions/models/product-list/index.js";import{getProductVariantMainImage as n,getProductVariantPrice as s,getProductVariantFinalPrice as a,getProductVariantSellPrice as d,getProductVariantDiscountPrice as m}from"../functions/models/product/variant/index.js";import'./../ext/lodash/_isFlattenable.js';import'./../ext/lodash/sortBy.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!o()&&!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
|
|
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 o}from"../utils/helper.js";import"../router/index.js";import"../stores/cart/index.js";import{getCategoryPath as r}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 t}from"../functions/models/image/index.js";import"../functions/models/product-list/index.js";import{getProductVariantMainImage as n,getProductVariantPrice as s,getProductVariantFinalPrice as a,getProductVariantSellPrice as d,getProductVariantDiscountPrice as m}from"../functions/models/product/variant/index.js";import'./../ext/lodash/_isFlattenable.js';import'./../ext/lodash/sortBy.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!o()&&!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},f=function(){return u()&&!!i.openAiPixelId&&!!window.oaiq};function j(i,o){var u,c,l,p,v=e(i),f=i.categories.length>0?r(i.categories[0]).map(function(i){return i.name}):[],j=null===(u=n(v))||void 0===u?void 0:u.image,g=s(v);return{id:i.id,variantId:v.id,name:i.name,price:null!==(c=a(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?t(j):"",sellPrice:d(v)||void 0,discountPrice:m(v)}}function g(i,e,o){var r,t,n,s,a,d=[];if(null===(r=null==o?void 0:o.categories)||void 0===r?void 0:r.length)(m=o.categories[0]).categoryPath&&m.categoryPath.forEach(function(i){return d.push(i)}),d.push(m.name);else if(null===(t=i.variant.categories)||void 0===t?void 0:t.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==o?void 0:o.brand)||void 0===n?void 0:n.name)||(null===(s=i.variant.brand)||void 0===s?void 0:s.name)||"",variant:(null===(a=i.variant.variantValues)||void 0===a?void 0:a.map(function(i){return i.variantValueName}).join(" / "))||""}}function h(i){var e;return{items:i.orderLineItems.map(function(i){return g(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,h as extractCartData,g as extractCartItemData,j as extractProductData,c as hasFacebookPixel,l as hasGoogleAnalytics,p as hasGoogleTagManager,f as hasOpenAiPixel,v as hasTiktokPixel};
|
|
@@ -14,11 +14,13 @@ import type { SaveLastViewedProductsQueryParams } from "../../../storefront-api/
|
|
|
14
14
|
import type { SaveMyCustomerQueryParams } from "../../../storefront-api/src/__api/mutations/saveMyCustomer";
|
|
15
15
|
import type { SendContactFormToMerchantQueryParams } from "../../../storefront-api/src/__api/mutations/sendContactFormToMerchant";
|
|
16
16
|
import type { SubscribeToMarketingNotificationsQueryParams } from "../../../storefront-api/src/__api/mutations/subscribeToMarketingNotifications";
|
|
17
|
+
import type { UnlinkExternalAccountQueryParams } from "../../../storefront-api/src/__api/mutations/unlinkExternalAccount";
|
|
17
18
|
import type { ValidateCustomerPhoneVerificationCodeQueryParams } from "../../../storefront-api/src/__api/mutations/validateCustomerPhoneVerificationCode";
|
|
18
19
|
import { ValidateOTPCodeQueryParams } from "../../../storefront-api/src/__api/mutations/validateOTPCode";
|
|
19
20
|
import type { CheckCustomerEmailQueryParams } from "../../../storefront-api/src/__api/queries/checkCustomerEmail";
|
|
20
21
|
import type { CustomerSocialLoginQueryParams } from "../../../storefront-api/src/__api/queries/customerSocialLogin";
|
|
21
22
|
import type { GetCustomerOrdersQueryParams } from "../../../storefront-api/src/__api/queries/getCustomerOrders";
|
|
23
|
+
import type { GetExternalAccountLinkQueryParams } from "../../../storefront-api/src/__api/queries/getExternalAccountLink";
|
|
22
24
|
import type { GetLastViewedProductsQueryParams } from "../../../storefront-api/src/__api/queries/getLastViewedProducts";
|
|
23
25
|
import type { GetOrderByEmailQueryParams } from "../../../storefront-api/src/__api/queries/getOrderByEmail";
|
|
24
26
|
import type { IsFavoriteProductQueryParams } from "../../../storefront-api/src/__api/queries/isFavoriteProduct";
|
|
@@ -202,3 +204,6 @@ export declare function apiValidateOTPCode(params: ValidateOTPCodeQueryParams):
|
|
|
202
204
|
export declare function apiDeactivateCustomer(params: CustomerDeactivateQueryParams): Promise<APIResponse<undefined> | APIResponse<boolean>>;
|
|
203
205
|
export declare function apiExportCustomerPersonalData(): Promise<APIResponse<undefined> | APIResponse<string>>;
|
|
204
206
|
export declare function apiGetDigitalProductFileDownloadUrl(orderId: string, orderLineItemId: string): Promise<APIResponse<undefined> | APIResponse<string>>;
|
|
207
|
+
export declare function apiGetExternalAccountLink(params: GetExternalAccountLinkQueryParams): Promise<APIResponse<import("../../../storefront-api/src").ExternalAccountLink | null>>;
|
|
208
|
+
export declare function apiUnlinkExternalAccount(params: UnlinkExternalAccountQueryParams): Promise<APIResponse<boolean>>;
|
|
209
|
+
export declare function apiGetMilesSmilesDetails(): Promise<APIResponse<undefined> | APIResponse<import("../../../storefront-api/src").MilesSmilesDetailsResponse>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e,__assign as r}from'./../../../ext/tslib/tslib.es6.mjs.js';import{APIResponse as s}from"../../../packages/storefront-api-client/src/utils/api.js";import'./../../../ext/isomorphic-fetch/fetch-npm-node.js';import{IkasStorefrontConfig as n}from"../../../packages/storefront-config/src/index.js";import{initIkasCustomerAttribute as i}from"../../models/customer/attribute/init.js";import{initIkasCustomerReview as o}from"../../models/customer/review/init.js";import{initIkasOrder as a}from"../../models/order/index.js";function u(n){return t(this,void 0,void 0,function(){var t,i,o;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/customerLogin.js")];case 1:return[4,(0,e.sent().customerLogin)(n,["customer.addresses.region.createdAt","customer.addresses.region.deleted","customer.addresses.region.updatedAt"])];case 2:return t=e.sent(),i=(null===(o=t.data)||void 0===o?void 0:o.customer)||null,[2,new s(t.data?r(r({},t.data),{customer:i}):null,t.graphQLErrors)]}})})}function c(n){return t(this,void 0,void 0,function(){var t,i,o;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/customerSocialLogin.js")];case 1:return[4,(0,e.sent().customerSocialLogin)(n,["customer.addresses.region.createdAt","customer.addresses.region.deleted","customer.addresses.region.updatedAt"])];case 2:return t=e.sent(),i=(null===(o=t.data)||void 0===o?void 0:o.customer)||null,[2,new s(t.data?r(r({},t.data),{customer:i}):null,t.graphQLErrors)]}})})}function d(n){return t(this,void 0,void 0,function(){var t,i,o;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/registerCustomer.js")];case 1:return[4,(0,e.sent().registerCustomer)(n,["customer.addresses.region.createdAt","customer.addresses.region.deleted","customer.addresses.region.updatedAt"])];case 2:return t=e.sent(),i=(null===(o=t.data)||void 0===o?void 0:o.customer)||null,[2,new s(t.data?r(r({},t.data),{customer:i}):null,t.graphQLErrors)]}})})}function p(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/customerRefreshToken.js")];case 1:return[4,(0,t.sent().customerRefreshToken)(r)];case 2:return[2,t.sent()]}})})}function l(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/customerForgotPassword.js")];case 1:return[4,(0,t.sent().customerForgotPassword)(r)];case 2:return[2,t.sent()]}})})}function f(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/customerRecoverPassword.js")];case 1:return[4,(0,t.sent().customerRecoverPassword)(r)];case 2:return[2,t.sent()]}})})}function m(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/checkCustomerEmail.js")];case 1:return[4,(0,t.sent().checkCustomerEmail)(r)];case 2:return[2,t.sent()]}})})}function h(){return t(this,void 0,void 0,function(){var t,r;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/getMyCustomer.js")];case 1:return[4,(0,e.sent().getMyCustomer)(["note","tagIds","customerGroupIds","passwordUpdateDate","orderCount","registrationSource","customerSequence","addresses.region.createdAt","addresses.region.deleted","addresses.region.updatedAt"])];case 2:return t=e.sent(),r=t.data||null,[2,new s(r,t.graphQLErrors)]}})})}function g(r){return t(this,void 0,void 0,function(){var t,n;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/saveMyCustomer.js")];case 1:return[4,(0,e.sent().saveMyCustomer)(r,["note","tagIds","customerGroupIds","passwordUpdateDate","orderCount","registrationSource","customerSequence","addresses.region.createdAt","addresses.region.deleted","addresses.region.updatedAt"])];case 2:return t=e.sent(),n=t.data||null,[2,new s(n,t.graphQLErrors)]}})})}function v(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/saveCustomerFormData.js")];case 1:return[4,(0,t.sent().saveCustomerFormData)(r)];case 2:return[2,t.sent()]}})})}function w(r){return t(this,void 0,void 0,function(){var t,n;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/getCustomerOrders.js")];case 1:return[4,(0,e.sent().getCustomerOrders)(r,["billingAddress.region.createdAt","billingAddress.region.deleted","billingAddress.region.updatedAt","shippingAddress.region.createdAt","shippingAddress.region.deleted","shippingAddress.region.updatedAt"])];case 2:return t=e.sent(),n=t.data.map(a),[2,new s(n,t.graphQLErrors)]}})})}function _(r){return t(this,void 0,void 0,function(){var t,n;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/getOrderByEmail.js")];case 1:return[4,(0,e.sent().getOrderByEmail)(r,["billingAddress.region.createdAt","billingAddress.region.deleted","billingAddress.region.updatedAt","shippingAddress.region.createdAt","shippingAddress.region.deleted","shippingAddress.region.updatedAt"])];case 2:return t=e.sent(),n=t.data?a(t.data):void 0,[2,new s(n,t.graphQLErrors)]}})})}function b(r){return t(this,void 0,void 0,function(){var t,n;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/listOrderTransactions.js")];case 1:return[4,(0,e.sent().listOrderTransactions)(r)];case 2:return t=e.sent(),n=t.data,[2,new s(n,t.graphQLErrors)]}})})}function A(r){return t(this,void 0,void 0,function(){var t,n;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/createOrderRefundRequest.js")];case 1:return[4,(0,e.sent().createOrderRefundRequest)(r,["billingAddress.region.createdAt","billingAddress.region.deleted","billingAddress.region.updatedAt","shippingAddress.region.createdAt","shippingAddress.region.deleted","shippingAddress.region.updatedAt"])];case 2:return t=e.sent(),n=a(t.data),[2,new s(n,t.graphQLErrors)]}})})}function j(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/subscribeToMarketingNotifications.js")];case 1:return[4,(0,t.sent().subscribeToMarketingNotifications)(r)];case 2:return[2,t.sent()]}})})}function k(r){return t(this,void 0,void 0,function(){var t,n;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/getLastViewedProducts.js")];case 1:return[4,(0,e.sent().getLastViewedProducts)(r)];case 2:return t=e.sent(),[2,new s(null===(n=t.data)||void 0===n?void 0:n.products,t.graphQLErrors)]}})})}function C(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/saveLastViewedProducts.js")];case 1:return[4,(0,t.sent().saveLastViewedProducts)(r)];case 2:return[2,t.sent()]}})})}function L(n){return t(this,void 0,void 0,function(){var t,i,o;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/listOrderRefundSettings.js")];case 1:return[4,(0,e.sent().listOrderRefundSettings)(n)];case 2:return t=e.sent(),i=(null===(o=t.data)||void 0===o?void 0:o.map(function(t){return r({},t)}))||null,[2,new s(i,t.graphQLErrors)]}})})}function E(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/sendContactFormToMerchant.js")];case 1:return[4,(0,t.sent().sendContactFormToMerchant)(r)];case 2:return[2,t.sent()]}})})}function P(){return t(this,void 0,void 0,function(){var t,r;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/listFavoriteProducts.js")];case 1:return[4,(0,e.sent().listFavoriteProducts)()];case 2:return t=e.sent(),r=t.data||null,[2,new s(r,t.graphQLErrors)]}})})}function q(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/saveFavoriteProduct.js")];case 1:return[4,(0,t.sent().saveFavoriteProduct)(r)];case 2:return[2,t.sent()]}})})}function Q(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/isFavoriteProduct.js")];case 1:return[4,(0,t.sent().isFavoriteProduct)({productId:r.productId})];case 2:return[2,t.sent()]}})})}function R(r){return t(this,void 0,void 0,function(){var t,n;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/createCustomerReview.js")];case 1:return[4,(0,e.sent().createCustomerReview)(r)];case 2:return t=e.sent(),(n=t.data)&&o(n),[2,new s(n,t.graphQLErrors)]}})})}function F(n){return t(this,void 0,void 0,function(){var t,i,a;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/listCustomerReviews.js")];case 1:return[4,(0,e.sent().listCustomerReviews)(n)];case 2:return t=e.sent(),(i=(null===(a=t.data)||void 0===a?void 0:a.data)||[]).forEach(o),[2,new s(t.data?r(r({},t.data),{data:i}):null,t.graphQLErrors)]}})})}function D(n){return t(this,void 0,void 0,function(){var t,i,o;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/listCustomerReviewSummary.js")];case 1:return[4,(0,e.sent().listCustomerReviewSummary)(n)];case 2:return t=e.sent(),i=(null===(o=t.data)||void 0===o?void 0:o.data)||[],[2,new s(r(r({},t.data),{data:i}),t.graphQLErrors)]}})})}function O(){return t(this,void 0,void 0,function(){var t,r;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/listCustomerAttribute.js")];case 1:return[4,(0,e.sent().listCustomerAttribute)()];case 2:return t=e.sent(),(r=t.data||[]).sort(function(t,e){return t.order&&e.order?t.order-e.order:-1}).forEach(function(t){return i(t,n.getCurrentLocale())}),[2,new s(r,t.graphQLErrors)]}})})}function S(n){return t(this,void 0,void 0,function(){var t,i;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/listCustomerSettings.js")];case 1:return[4,(0,e.sent().listCustomerSettings)(n)];case 2:return t=e.sent(),i=t.data||[],[2,new s(r(r({},t.data),{data:i}),t.graphQLErrors)]}})})}function M(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/activateCustomer.js")];case 1:return[4,(0,t.sent().activateCustomer)(r)];case 2:return[2,t.sent()]}})})}function T(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/resendCustomerActivationMail.js")];case 1:return[4,(0,t.sent().resendCustomerActivationMail)(r)];case 2:return[2,t.sent()]}})})}function I(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/resendCustomerPhoneVerificationCode.js")];case 1:return[4,(0,t.sent().resendCustomerPhoneVerificationCode)()];case 2:return[2,t.sent()]}})})}function y(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/validateCustomerPhoneVerificationCode.js")];case 1:return[4,(0,t.sent().validateCustomerPhoneVerificationCode)(r)];case 2:return[2,t.sent()]}})})}function V(n){return t(this,void 0,void 0,function(){var t,i,o;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/validateOTPCode.js")];case 1:return[4,(0,e.sent().validateOTPCode)(n)];case 2:return t=e.sent(),i=(null===(o=t.data)||void 0===o?void 0:o.customer)||null,[2,new s(t.data?r(r({},t.data),{customer:i}):null,t.graphQLErrors)]}})})}function x(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/customerDeactivate.js")];case 1:return[4,(0,t.sent().customerDeactivate)(r)];case 2:return[2,t.sent()]}})})}function U(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/exportCustomerPersonalData.js")];case 1:return[4,(0,t.sent().exportCustomerPersonalData)()];case 2:return[2,t.sent()]}})})}function B(r,s){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/getDigitalProductFileDownloadUrl.js")];case 1:return[4,(0,t.sent().getDigitalProductFileDownloadUrl)({orderId:r,orderLineItemId:s})];case 2:return[2,t.sent()]}})})}export{M as apiActivateCustomer,m as apiCheckEmail,R as apiCreateCustomerReview,A as apiCreateOrderRefundRequest,x as apiDeactivateCustomer,U as apiExportCustomerPersonalData,l as apiForgotPassword,h as apiGetCustomer,B as apiGetDigitalProductFileDownloadUrl,k as apiGetLastViewedProducts,_ as apiGetOrderByEmail,w as apiGetOrders,Q as apiIsFavoriteProduct,O as apiListCustomerAttribute,D as apiListCustomerReviewSummary,F as apiListCustomerReviews,S as apiListCustomerSettings,P as apiListFavoriteProducts,L as apiListOrderRefundSettings,b as apiListOrderTransactions,u as apiLogin,f as apiRecoverPassword,p as apiRefreshToken,d as apiRegister,T as apiResendCustomerActivationMail,I as apiResendCustomerPhoneVerificationCode,g as apiSaveCustomer,v as apiSaveCustomerFormData,q as apiSaveFavoriteProduct,C as apiSaveLastViewedProducts,E as apiSendContactFormToMerchant,c as apiSocialLogin,j as apiSubscribeToMarketingNotifications,y as apiValidateCustomerPhoneVerificationCode,V as apiValidateOTPCode};
|
|
1
|
+
import{__awaiter as t,__generator as e,__assign as r}from'./../../../ext/tslib/tslib.es6.mjs.js';import{APIResponse as s}from"../../../packages/storefront-api-client/src/utils/api.js";import'./../../../ext/isomorphic-fetch/fetch-npm-node.js';import{IkasStorefrontConfig as n}from"../../../packages/storefront-config/src/index.js";import{initIkasCustomerAttribute as i}from"../../models/customer/attribute/init.js";import{initIkasCustomerReview as o}from"../../models/customer/review/init.js";import{initIkasOrder as a}from"../../models/order/index.js";function u(n){return t(this,void 0,void 0,function(){var t,i,o;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/customerLogin.js")];case 1:return[4,(0,e.sent().customerLogin)(n,["customer.addresses.region.createdAt","customer.addresses.region.deleted","customer.addresses.region.updatedAt"])];case 2:return t=e.sent(),i=(null===(o=t.data)||void 0===o?void 0:o.customer)||null,[2,new s(t.data?r(r({},t.data),{customer:i}):null,t.graphQLErrors)]}})})}function c(n){return t(this,void 0,void 0,function(){var t,i,o;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/customerSocialLogin.js")];case 1:return[4,(0,e.sent().customerSocialLogin)(n,["customer.addresses.region.createdAt","customer.addresses.region.deleted","customer.addresses.region.updatedAt"])];case 2:return t=e.sent(),i=(null===(o=t.data)||void 0===o?void 0:o.customer)||null,[2,new s(t.data?r(r({},t.data),{customer:i}):null,t.graphQLErrors)]}})})}function d(n){return t(this,void 0,void 0,function(){var t,i,o;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/registerCustomer.js")];case 1:return[4,(0,e.sent().registerCustomer)(n,["customer.addresses.region.createdAt","customer.addresses.region.deleted","customer.addresses.region.updatedAt"])];case 2:return t=e.sent(),i=(null===(o=t.data)||void 0===o?void 0:o.customer)||null,[2,new s(t.data?r(r({},t.data),{customer:i}):null,t.graphQLErrors)]}})})}function p(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/customerRefreshToken.js")];case 1:return[4,(0,t.sent().customerRefreshToken)(r)];case 2:return[2,t.sent()]}})})}function l(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/customerForgotPassword.js")];case 1:return[4,(0,t.sent().customerForgotPassword)(r)];case 2:return[2,t.sent()]}})})}function f(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/customerRecoverPassword.js")];case 1:return[4,(0,t.sent().customerRecoverPassword)(r)];case 2:return[2,t.sent()]}})})}function m(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/checkCustomerEmail.js")];case 1:return[4,(0,t.sent().checkCustomerEmail)(r)];case 2:return[2,t.sent()]}})})}function h(){return t(this,void 0,void 0,function(){var t,r;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/getMyCustomer.js")];case 1:return[4,(0,e.sent().getMyCustomer)(["note","tagIds","customerGroupIds","passwordUpdateDate","orderCount","registrationSource","customerSequence","addresses.region.createdAt","addresses.region.deleted","addresses.region.updatedAt"])];case 2:return t=e.sent(),r=t.data||null,[2,new s(r,t.graphQLErrors)]}})})}function g(r){return t(this,void 0,void 0,function(){var t,n;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/saveMyCustomer.js")];case 1:return[4,(0,e.sent().saveMyCustomer)(r,["note","tagIds","customerGroupIds","passwordUpdateDate","orderCount","registrationSource","customerSequence","addresses.region.createdAt","addresses.region.deleted","addresses.region.updatedAt"])];case 2:return t=e.sent(),n=t.data||null,[2,new s(n,t.graphQLErrors)]}})})}function v(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/saveCustomerFormData.js")];case 1:return[4,(0,t.sent().saveCustomerFormData)(r)];case 2:return[2,t.sent()]}})})}function _(r){return t(this,void 0,void 0,function(){var t,n;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/getCustomerOrders.js")];case 1:return[4,(0,e.sent().getCustomerOrders)(r,["billingAddress.region.createdAt","billingAddress.region.deleted","billingAddress.region.updatedAt","shippingAddress.region.createdAt","shippingAddress.region.deleted","shippingAddress.region.updatedAt"])];case 2:return t=e.sent(),n=t.data.map(a),[2,new s(n,t.graphQLErrors)]}})})}function w(r){return t(this,void 0,void 0,function(){var t,n;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/getOrderByEmail.js")];case 1:return[4,(0,e.sent().getOrderByEmail)(r,["billingAddress.region.createdAt","billingAddress.region.deleted","billingAddress.region.updatedAt","shippingAddress.region.createdAt","shippingAddress.region.deleted","shippingAddress.region.updatedAt"])];case 2:return t=e.sent(),n=t.data?a(t.data):void 0,[2,new s(n,t.graphQLErrors)]}})})}function b(r){return t(this,void 0,void 0,function(){var t,n;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/listOrderTransactions.js")];case 1:return[4,(0,e.sent().listOrderTransactions)(r)];case 2:return t=e.sent(),n=t.data,[2,new s(n,t.graphQLErrors)]}})})}function k(r){return t(this,void 0,void 0,function(){var t,n;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/createOrderRefundRequest.js")];case 1:return[4,(0,e.sent().createOrderRefundRequest)(r,["billingAddress.region.createdAt","billingAddress.region.deleted","billingAddress.region.updatedAt","shippingAddress.region.createdAt","shippingAddress.region.deleted","shippingAddress.region.updatedAt"])];case 2:return t=e.sent(),n=a(t.data),[2,new s(n,t.graphQLErrors)]}})})}function A(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/subscribeToMarketingNotifications.js")];case 1:return[4,(0,t.sent().subscribeToMarketingNotifications)(r)];case 2:return[2,t.sent()]}})})}function j(r){return t(this,void 0,void 0,function(){var t,n;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/getLastViewedProducts.js")];case 1:return[4,(0,e.sent().getLastViewedProducts)(r)];case 2:return t=e.sent(),[2,new s(null===(n=t.data)||void 0===n?void 0:n.products,t.graphQLErrors)]}})})}function C(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/saveLastViewedProducts.js")];case 1:return[4,(0,t.sent().saveLastViewedProducts)(r)];case 2:return[2,t.sent()]}})})}function L(n){return t(this,void 0,void 0,function(){var t,i,o;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/listOrderRefundSettings.js")];case 1:return[4,(0,e.sent().listOrderRefundSettings)(n)];case 2:return t=e.sent(),i=(null===(o=t.data)||void 0===o?void 0:o.map(function(t){return r({},t)}))||null,[2,new s(i,t.graphQLErrors)]}})})}function E(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/sendContactFormToMerchant.js")];case 1:return[4,(0,t.sent().sendContactFormToMerchant)(r)];case 2:return[2,t.sent()]}})})}function P(){return t(this,void 0,void 0,function(){var t,r;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/listFavoriteProducts.js")];case 1:return[4,(0,e.sent().listFavoriteProducts)()];case 2:return t=e.sent(),r=t.data||null,[2,new s(r,t.graphQLErrors)]}})})}function q(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/saveFavoriteProduct.js")];case 1:return[4,(0,t.sent().saveFavoriteProduct)(r)];case 2:return[2,t.sent()]}})})}function Q(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/isFavoriteProduct.js")];case 1:return[4,(0,t.sent().isFavoriteProduct)({productId:r.productId})];case 2:return[2,t.sent()]}})})}function R(r){return t(this,void 0,void 0,function(){var t,n;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/createCustomerReview.js")];case 1:return[4,(0,e.sent().createCustomerReview)(r)];case 2:return t=e.sent(),(n=t.data)&&o(n),[2,new s(n,t.graphQLErrors)]}})})}function D(n){return t(this,void 0,void 0,function(){var t,i,a;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/listCustomerReviews.js")];case 1:return[4,(0,e.sent().listCustomerReviews)(n)];case 2:return t=e.sent(),(i=(null===(a=t.data)||void 0===a?void 0:a.data)||[]).forEach(o),[2,new s(t.data?r(r({},t.data),{data:i}):null,t.graphQLErrors)]}})})}function F(n){return t(this,void 0,void 0,function(){var t,i,o;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/listCustomerReviewSummary.js")];case 1:return[4,(0,e.sent().listCustomerReviewSummary)(n)];case 2:return t=e.sent(),i=(null===(o=t.data)||void 0===o?void 0:o.data)||[],[2,new s(r(r({},t.data),{data:i}),t.graphQLErrors)]}})})}function S(){return t(this,void 0,void 0,function(){var t,r;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/listCustomerAttribute.js")];case 1:return[4,(0,e.sent().listCustomerAttribute)()];case 2:return t=e.sent(),(r=t.data||[]).sort(function(t,e){return t.order&&e.order?t.order-e.order:-1}).forEach(function(t){return i(t,n.getCurrentLocale())}),[2,new s(r,t.graphQLErrors)]}})})}function M(n){return t(this,void 0,void 0,function(){var t,i;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/listCustomerSettings.js")];case 1:return[4,(0,e.sent().listCustomerSettings)(n)];case 2:return t=e.sent(),i=t.data||[],[2,new s(r(r({},t.data),{data:i}),t.graphQLErrors)]}})})}function O(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/activateCustomer.js")];case 1:return[4,(0,t.sent().activateCustomer)(r)];case 2:return[2,t.sent()]}})})}function T(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/resendCustomerActivationMail.js")];case 1:return[4,(0,t.sent().resendCustomerActivationMail)(r)];case 2:return[2,t.sent()]}})})}function x(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/resendCustomerPhoneVerificationCode.js")];case 1:return[4,(0,t.sent().resendCustomerPhoneVerificationCode)()];case 2:return[2,t.sent()]}})})}function I(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/validateCustomerPhoneVerificationCode.js")];case 1:return[4,(0,t.sent().validateCustomerPhoneVerificationCode)(r)];case 2:return[2,t.sent()]}})})}function y(n){return t(this,void 0,void 0,function(){var t,i,o;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/validateOTPCode.js")];case 1:return[4,(0,e.sent().validateOTPCode)(n)];case 2:return t=e.sent(),i=(null===(o=t.data)||void 0===o?void 0:o.customer)||null,[2,new s(t.data?r(r({},t.data),{customer:i}):null,t.graphQLErrors)]}})})}function V(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/customerDeactivate.js")];case 1:return[4,(0,t.sent().customerDeactivate)(r)];case 2:return[2,t.sent()]}})})}function U(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/exportCustomerPersonalData.js")];case 1:return[4,(0,t.sent().exportCustomerPersonalData)()];case 2:return[2,t.sent()]}})})}function B(r,s){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/getDigitalProductFileDownloadUrl.js")];case 1:return[4,(0,t.sent().getDigitalProductFileDownloadUrl)({orderId:r,orderLineItemId:s})];case 2:return[2,t.sent()]}})})}function G(r){return t(this,void 0,void 0,function(){var t,n;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/getExternalAccountLink.js")];case 1:return[4,(0,e.sent().getExternalAccountLink)(r)];case 2:return t=e.sent(),[2,new s(null!==(n=t.data)&&void 0!==n?n:null,t.graphQLErrors)]}})})}function N(r){return t(this,void 0,void 0,function(){var t;return e(this,function(e){switch(e.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/unlinkExternalAccount.js")];case 1:return[4,(0,e.sent().unlinkExternalAccount)(r)];case 2:return t=e.sent(),[2,new s(!!t.data,t.graphQLErrors)]}})})}function z(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/getMilesSmilesDetails.js")];case 1:return[4,(0,t.sent().getMilesSmilesDetails)()];case 2:return[2,t.sent()]}})})}export{O as apiActivateCustomer,m as apiCheckEmail,R as apiCreateCustomerReview,k as apiCreateOrderRefundRequest,V as apiDeactivateCustomer,U as apiExportCustomerPersonalData,l as apiForgotPassword,h as apiGetCustomer,B as apiGetDigitalProductFileDownloadUrl,G as apiGetExternalAccountLink,j as apiGetLastViewedProducts,z as apiGetMilesSmilesDetails,w as apiGetOrderByEmail,_ as apiGetOrders,Q as apiIsFavoriteProduct,S as apiListCustomerAttribute,F as apiListCustomerReviewSummary,D as apiListCustomerReviews,M as apiListCustomerSettings,P as apiListFavoriteProducts,L as apiListOrderRefundSettings,b as apiListOrderTransactions,u as apiLogin,f as apiRecoverPassword,p as apiRefreshToken,d as apiRegister,T as apiResendCustomerActivationMail,x as apiResendCustomerPhoneVerificationCode,g as apiSaveCustomer,v as apiSaveCustomerFormData,q as apiSaveFavoriteProduct,C as apiSaveLastViewedProducts,E as apiSendContactFormToMerchant,c as apiSocialLogin,A as apiSubscribeToMarketingNotifications,N as apiUnlinkExternalAccount,I as apiValidateCustomerPhoneVerificationCode,y as apiValidateOTPCode};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as n}from'./../../../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as r}from"../../../packages/storefront-config/src/index.js";import{CART_LS_KEY as e,cartStore as i}from"../../../stores/cart/index.js";import{customerStore as a}from"../../../stores/customer/index.js";import{getCookieValue as o}from"../../../utils/helper.js";import{getIkasOrderDistinctItemCount as s}from"../../models/order/index.js";import{getSelectedProductVariant as u,hasProductValidOptionValues as c}from"../../models/product/index.js";import{isProductOfferAccepted as d}from"../../models/product/campaign-offer/index.js";import{initProductOptionSetValues as l}from"../../models/product/option-set/index.js";import{hasProductVariantStock as f}from"../../models/product/variant/index.js";import{waitForCustomerStoreInit as v}from"../customer/index.js";function p(t){var n,e=null===(n=t.cart)||void 0===n?void 0:n.id;if(e){var i=r.getCurrentRouting();return"".concat((null==i?void 0:i.path)?"/".concat(i.path):"","/checkout?id=").concat(e,"&step=info")}return""}function m(a,s){return t(this,arguments,void 0,function(t,a,s,d){var v,p,m,h,g,b,y,C,S,L,j,w,x,P,T,q,E;return void 0===s&&(s=1),n(this,function(n){switch(n.label){case 0:v=null!==(w=null==d?void 0:d.isPayWithIkas)&&void 0!==w&&w,n.label=1;case 1:return n.trys.push([1,10,,11]),v||!a.productOptionSetId||a.productOptionSet?c(a)?f(t)||t.sellIfOutOfStock?(p=void 0,v?[3,3]:[4,F()]):[2,{success:!1,validationError:"INSUFFICIENT_STOCK"}]:[2,{success:!1,validationError:"INVALID_PRODUCT_OPTION_VALUES"}]:[2,{success:!1,validationError:"INVALID_PRODUCT_OPTION_VALUES"}];case 2:if(n.sent(),i.cart&&(p=_(i.cart,t,a))){if(a.productOptionSet&&l(a.productOptionSet),!t.bundleSettings)return[2,I(p,p.quantity+s,a.offers,a)];if(!O())return[2,I(p,p.quantity+s,a.offers,a)]}n.label=3;case 3:return m=Q(a),h=s,(null==(g=null===(x=a.salesChannels)||void 0===x?void 0:x.find(function(t){return t.id===r.salesChannelId}))?void 0:g.minQuantityPerCart)&&s<g.minQuantityPerCart&&(h=g.minQuantityPerCart),(null==g?void 0:g.maxQuantityPerCart)&&s>g.maxQuantityPerCart&&(h=g.maxQuantityPerCart),b=v?null:(null===(P=i.cart)||void 0===P?void 0:P.id)||localStorage.getItem(e),[4,import("../../api/cart/index.js")];case 4:return[4,(0,n.sent().apiAddItemToCart)({input:{cartId:b,item:{id:null!==(T=null==p?void 0:p.id)&&void 0!==T?T:null,quantity:null!==(q=null==p?void 0:p.quantity)&&void 0!==q?q:h,variant:{id:t.id,name:a.name,bundleProducts:null===(E=t.bundleSettings)||void 0===E?void 0:E.products.map(function(t){var n;return{id:t.id,productId:(null===(n=t.product)||void 0===n?void 0:n.id)||"",variantId:t.product?u(t.product).id:"",quantity:t.quantity}})}},acceptedOffers:A(a.offers),options:m.length?m:null,priceListId:r.priceListId||null,salesChannelId:r.salesChannelId,storefrontThemeId:r.storefrontThemeId,metadata:{_fbp:o("_fbp"),_fbc:o("_fbc"),_ga:o("_ga")}}})];case 5:return y=n.sent(),v?[3,7]:y.isSuccess&&y.data?[4,k(y.data)]:[3,7];case 6:n.sent(),n.label=7;case 7:return(C=v?y.data:i.cart)?(S="".concat(C.id,"-").concat(C.updatedAt),(L=C.orderLineItems.find(function(n){return n.variant.id===t.id}))?[4,import("../../../analytics/analytics-functions/addToCart.js")]:[3,9]):[3,9];case 8:(0,n.sent().anl_addToCart)(L,s,S,C,a),n.label=9;case 9:return a.productOptionSet&&l(a.productOptionSet),[2,{success:y.isSuccess,response:y}];case 10:return j=n.sent(),console.log(j),[2,{success:!1}];case 11:return[2]}})})}function h(r){return t(this,arguments,void 0,function(t,r){return void 0===r&&(r=1),n(this,function(n){switch(n.label){case 0:return[4,m(u(t),t,r)];case 1:return[2,n.sent()]}})})}function I(e,a,s,u){return t(this,void 0,void 0,function(){var t,c,d,l,f,v;return n(this,function(n){switch(n.label){case 0:return n.trys.push([0,10,,11]),[4,F()];case 1:return n.sent(),[4,import("../../api/cart/index.js")];case 2:return[4,(0,n.sent().apiAddItemToCart)({input:{cartId:(null===(f=i.cart)||void 0===f?void 0:f.id)||null,item:{id:e.id,quantity:a,variant:{id:e.variant.id,name:e.variant.name,bundleProducts:null===(v=e.variant.bundleProducts)||void 0===v?void 0:v.map(function(t){return{id:t.id,productId:t.variant.productId||"",variantId:t.variant.id||"",quantity:t.quantity}})}},acceptedOffers:s?A(s):void 0,options:U(e),priceListId:r.priceListId||null,salesChannelId:r.salesChannelId,storefrontThemeId:r.storefrontThemeId,metadata:{_fbp:o("_fbp"),_fbc:o("_fbc"),_ga:o("_ga")}}})];case 3:return(t=n.sent()).isSuccess&&t.data?[4,k(t.data)]:[3,5];case 4:n.sent(),n.label=5;case 5:return i.cart?(c="".concat(i.cart.id,"-").concat(i.cart.updatedAt),(d=e.quantity)>a?[4,import("../../../analytics/analytics-functions/removeFromCart.js")]:[3,7]):[3,9];case 6:return(0,n.sent().anl_removeFromCart)(e,d-a,i.cart),[3,9];case 7:return[4,import("../../../analytics/analytics-functions/addToCart.js")];case 8:(0,n.sent().anl_addToCart)(e,a-d,c,i.cart,u),n.label=9;case 9:return T(i),[2,{success:t.isSuccess,response:t}];case 10:return l=n.sent(),console.log(l),[2,{success:!1}];case 11:return[2]}})})}function g(r,e,i,a,o){return t(this,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,I(e,i,a,o)];case 1:return[2,t.sent()]}})})}function b(t,n){for(var r=0,e=(null==t?void 0:t.orderAdjustments)||[];r<e.length;r++)for(var i=0,a=e[r].appliedOrderLines||[];i<a.length;i++){var o=a[i];if(o.orderLineId===n.id)return o.isAutoCreated||!1}return!1}function y(r){return t(this,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,I(r,0)];case 1:return[2,t.sent()]}})})}function C(t){localStorage.removeItem(e),t.cart=null}function S(r){return t(this,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,new Promise(function(t){var n=setInterval(function(){r.isCartInitialLoadFinished&&(clearInterval(n),t(null))},100)})];case 1:return[2,t.sent()]}})})}function O(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("editLineID")||""}function _(t,n,r){var e;if(!r.productOptionSetId&&!n.bundleSettings)return t.orderLineItems.find(function(t){return t.variant.id===n.id});if(n.bundleSettings){var i=O();if(i)if(h=t.orderLineItems.find(function(t){return t.id===i}))return h}var a=t.orderLineItems.filter(function(t){return t.variant.id===n.id})||[];if(r.productOptionSetId)for(var o=Q(r),s=a.filter(function(t){var n;return(null===(n=t.options)||void 0===n?void 0:n.length)===o.length})||[],u=0,c=s;u<c.length;u++){if((h=c[u]).options){for(var d=!0,l=function(t){var n=t.values.map(function(t){return t.value}),r=null===(e=o.find(function(n){return n.productOptionId===t.productOptionId}))||void 0===e?void 0:e.values;if(!(d=d&&n.length===(null==r?void 0:r.length)&&n.every(function(t){return null==r?void 0:r.includes(t)})))return"break"},f=0,v=h.options;f<v.length;f++){if("break"===l(v[f]))break}if(d){if(!n.bundleSettings)return h;if(j(n,h))return h}}}else if(n.bundleSettings)for(var p=0,m=a;p<m.length;p++){var h=m[p];if(j(n,h))return h}}function L(t,n){return _(t,u(n),n)}function j(t,n){var r,e=null===(r=t.bundleSettings)||void 0===r?void 0:r.products,i=n.variant.bundleProducts;return!!e&&((null==e?void 0:e.length)===(null==i?void 0:i.length)&&(null==e?void 0:e.every(function(t){return!!(null==i?void 0:i.find(function(n){return n.id===t.id&&n.quantity===t.quantity&&t.product&&n.variant.id===u(t.product).id}))})))}function w(r,e){return t(this,void 0,void 0,function(){var t;return n(this,function(n){switch(n.label){case 0:return[4,import("../../api/cart/index.js")];case 1:return[4,(0,n.sent().apiSaveCartCouponCode)({cartId:r.id,couponCode:e})];case 2:return(t=n.sent()).isSuccess&&t.data&&(i.cart=t.data),[2,{success:t.isSuccess,response:t}]}})})}function x(r){return t(this,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,w(r,null)];case 1:return[2,t.sent()]}})})}function P(r,e){return t(this,void 0,void 0,function(){var t;return n(this,function(n){switch(n.label){case 0:return[4,import("../../api/cart/index.js")];case 1:return[4,(0,n.sent().apiRemoveGiftCardFromCart)({cartId:r.id,giftCardId:e})];case 2:return(t=n.sent()).isSuccess&&t.data&&(i.cart=t.data),[2,{success:t.isSuccess,response:t}]}})})}function T(t){t.cart&&0===s(t.cart)&&C(t)}function q(){return t(this,void 0,void 0,function(){var t,r,o,s,u,c;return n(this,function(n){switch(n.label){case 0:if(!("undefined"!=typeof localStorage))return[2];n.label=1;case 1:return n.trys.push([1,8,9,10]),i.isCartLoading=!0,[4,v(a)];case 2:return n.sent(),t=null===(u=a.customer)||void 0===u?void 0:u.id,(r=(null===(c=i.cart)||void 0===c?void 0:c.id)||localStorage.getItem(e))||t?[4,import("../../api/cart/index.js")]:[2];case 3:return[4,(0,n.sent().apiGetCartById)({id:r})];case 4:return(o=n.sent()).isSuccess&&o.data?[4,k(o.data)]:[3,6];case 5:return n.sent(),[3,7];case 6:if(o.isCancelled||o.isNetworkError)return[2];C(i),n.label=7;case 7:return[3,10];case 8:return s=n.sent(),console.log(s),[3,10];case 9:return i.isCartLoading=!1,i.isCartInitialLoadFinished=!0,[7];case 10:return[2]}})})}function A(t){var n=t.filter(function(t){return t.isSelected&&!d(t)}).map(function(t){return{campaignOfferId:t.campaignOfferId,campaignOfferProductId:t.campaignOfferProductId,productId:t.product.id,quantity:t.quantity,variantId:u(t.product).id}})||[];return n.length?n:void 0}function E(e,i){return t(this,arguments,void 0,function(t,e,i){var a,o,s,c,d,l,f,v,p,h,I,g,b,y,C;return void 0===i&&(i=1),n(this,function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),a=r.salesChannelId,o=r.storefrontThemeId,a&&o?(s=u(e))?[4,m(s,e,i,{isPayWithIkas:!0})]:[2,{success:!1,error:"No variant selected"}]:[2,{success:!1,error:"Missing storefront configuration"}];case 1:return(c=t.sent()).success&&(null===(p=null===(v=c.response)||void 0===v?void 0:v.data)||void 0===p?void 0:p.id)?(d=c.response.data.id,[4,import("../../api/cart/index.js")]):[2,{success:!1,error:(null===(g=null===(I=null===(h=c.response)||void 0===h?void 0:h.graphQLErrors)||void 0===I?void 0:I[0])||void 0===g?void 0:g.message)||"Failed to create cart"}];case 2:return[4,(0,t.sent().apiCreatePayWithIkasSessionUrl)({cartId:d})];case 3:return!(l=t.sent()).data||(null===(b=l.graphQLErrors)||void 0===b?void 0:b.length)?[2,{success:!1,error:(null===(C=null===(y=l.graphQLErrors)||void 0===y?void 0:y[0])||void 0===C?void 0:C.message)||"Failed to create Pay with ikas session"}]:[2,{success:!0,payUrl:l.data.payUrl,expiresAt:l.data.expiresAt}];case 4:return f=t.sent(),console.log("error",f),[2,{success:!1,error:f instanceof Error?f.message:"Unknown error occurred"}];case 5:return[2]}})})}function k(r){return t(this,void 0,void 0,function(){return n(this,function(t){return localStorage.setItem(e,r.id),i.cart=r,[2]})})}function F(){return t(this,void 0,void 0,function(){var t;return n(this,function(n){switch(n.label){case 0:return t=localStorage.getItem(e),!i.cart||t?[3,1]:(C(i),[3,3]);case 1:return i.cart||!t?[3,3]:[4,q()];case 2:n.sent(),n.label=3;case 3:return[2]}})})}function U(t){if(t&&t.options){for(var n=[],r=0,e=t.options;r<e.length;r++){var i=e[r],a={productOptionId:i.productOptionId,productOptionsSetId:i.productOptionsSetId,values:i.values.map(function(t){return t.value})};n.push(a)}return n}return null}function Q(t){var n,r=[],e=new Set,i=function(t){var n;e.has(t.id)||(e.add(t.id),t.values.length&&r.push({productOptionId:t.id,productOptionsSetId:t.productOptionSetId,values:t.values}),null===(n=t.childOptions)||void 0===n||n.forEach(i))};return null===(n=t.productOptionSet)||void 0===n||n.options.filter(function(t){return!t.requiredOptionId}).forEach(i),r}function N(e){return t(this,void 0,void 0,function(){var t,a,s,u,c,d,l,f,v,p,m;return n(this,function(n){switch(n.label){case 0:return n.trys.push([0,10,,11]),[4,F()];case 1:return n.sent(),t=e.itemId?null===(v=i.cart)||void 0===v?void 0:v.orderLineItems.find(function(t){return t.id===e.itemId}):null,[4,import("../../api/cart/index.js")];case 2:return[4,(0,n.sent().apiAddItemToCart)({input:{cartId:(null===(p=i.cart)||void 0===p?void 0:p.id)||null,item:{id:e.itemId||null,quantity:e.quantity,variant:{id:e.variantId}},priceListId:r.priceListId||null,salesChannelId:r.salesChannelId,storefrontThemeId:r.storefrontThemeId,metadata:{_fbp:o("_fbp"),_fbc:o("_fbc"),_ga:o("_ga")}}})];case 3:return(a=n.sent()).isSuccess&&a.data?(e.itemId||(s=(null===(m=i.cart)||void 0===m?void 0:m.orderLineItems.map(function(t){return t.id}))||[],u=a.data.orderLineItems.map(function(t){return t.id}),(c=u.find(function(t){return!s.includes(t)}))&&(t=a.data.orderLineItems.find(function(t){return t.id===c}))),[4,k(a.data)]):[3,5];case 4:n.sent(),n.label=5;case 5:return i.cart&&t?(d="".concat(i.cart.id,"-").concat(i.cart.updatedAt),(l=e.quantity)>e.quantity?[4,import("../../../analytics/analytics-functions/removeFromCart.js")]:[3,7]):[3,9];case 6:return(0,n.sent().anl_removeFromCart)(t,l-e.quantity,i.cart),[3,9];case 7:return[4,import("../../../analytics/analytics-functions/addToCart.js")];case 8:(0,n.sent().anl_addToCart)(t,e.quantity-l,d,i.cart),n.label=9;case 9:return T(i),[2,{success:a.isSuccess,response:a}];case 10:return f=n.sent(),console.log(f),[2,{success:!1}];case 11:return[2]}})})}function D(t){var n;return!!t.cart&&(null===(n=t.cart.orderLineItems)||void 0===n?void 0:n.length)>0}export{m as addItemToCart,h as addSelectedtedVariantToCart,g as changeCartItemQuantity,I as changeItemQuantity,E as createPayWithIkasSession,_ as findExistingCartItem,L as findExistingCartItemWithProduct,A as getAcceptedOffers,q as getCart,p as getCheckoutUrlFromCartStore,D as hasCart,b as isOrderLineItemAutoCreated,C as removeCart,x as removeCouponCode,P as removeGiftCardLine,y as removeItem,w as saveCouponCode,k as setCart,S as waitForCartStoreInit,N as windowAddToCart};
|
|
1
|
+
import{__awaiter as t,__generator as n,__assign as r}from'./../../../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as e}from"../../../packages/storefront-config/src/index.js";import{CART_LS_KEY as i,cartStore as a}from"../../../stores/cart/index.js";import{customerStore as o}from"../../../stores/customer/index.js";import{getCookieValue as s,getOpenAiAttributionMetadata as u}from"../../../utils/helper.js";import{getIkasOrderDistinctItemCount as c}from"../../models/order/index.js";import{getSelectedProductVariant as d,hasProductValidOptionValues as l}from"../../models/product/index.js";import{isProductOfferAccepted as f}from"../../models/product/campaign-offer/index.js";import{initProductOptionSetValues as v}from"../../models/product/option-set/index.js";import{hasProductVariantStock as p}from"../../models/product/variant/index.js";import{waitForCustomerStoreInit as m}from"../customer/index.js";function h(t){var n,r=null===(n=t.cart)||void 0===n?void 0:n.id;if(r){var i=e.getCurrentRouting();return"".concat((null==i?void 0:i.path)?"/".concat(i.path):"","/checkout?id=").concat(r,"&step=info")}return""}function I(o,c){return t(this,arguments,void 0,function(t,o,c,f){var m,h,I,g,y,C,S,O,_,w,x,P,T,q,A,E,F;return void 0===c&&(c=1),n(this,function(n){switch(n.label){case 0:m=null!==(P=null==f?void 0:f.isPayWithIkas)&&void 0!==P&&P,n.label=1;case 1:return n.trys.push([1,10,,11]),m||!o.productOptionSetId||o.productOptionSet?l(o)?p(t)||t.sellIfOutOfStock?(h=void 0,m?[3,3]:[4,Q()]):[2,{success:!1,validationError:"INSUFFICIENT_STOCK"}]:[2,{success:!1,validationError:"INVALID_PRODUCT_OPTION_VALUES"}]:[2,{success:!1,validationError:"INVALID_PRODUCT_OPTION_VALUES"}];case 2:if(n.sent(),a.cart&&(h=j(a.cart,t,o))){if(o.productOptionSet&&v(o.productOptionSet),!t.bundleSettings)return[2,b(h,h.quantity+c,o.offers,o)];if(!L())return[2,b(h,h.quantity+c,o.offers,o)]}n.label=3;case 3:return I=D(o),g=c,(null==(y=null===(T=o.salesChannels)||void 0===T?void 0:T.find(function(t){return t.id===e.salesChannelId}))?void 0:y.minQuantityPerCart)&&c<y.minQuantityPerCart&&(g=y.minQuantityPerCart),(null==y?void 0:y.maxQuantityPerCart)&&c>y.maxQuantityPerCart&&(g=y.maxQuantityPerCart),C=m?null:(null===(q=a.cart)||void 0===q?void 0:q.id)||localStorage.getItem(i),[4,import("../../api/cart/index.js")];case 4:return[4,(0,n.sent().apiAddItemToCart)({input:{cartId:C,item:{id:null!==(A=null==h?void 0:h.id)&&void 0!==A?A:null,quantity:null!==(E=null==h?void 0:h.quantity)&&void 0!==E?E:g,variant:{id:t.id,name:o.name,bundleProducts:null===(F=t.bundleSettings)||void 0===F?void 0:F.products.map(function(t){var n;return{id:t.id,productId:(null===(n=t.product)||void 0===n?void 0:n.id)||"",variantId:t.product?d(t.product).id:"",quantity:t.quantity}})}},acceptedOffers:k(o.offers),options:I.length?I:null,priceListId:e.priceListId||null,salesChannelId:e.salesChannelId,storefrontThemeId:e.storefrontThemeId,metadata:r({_fbp:s("_fbp"),_fbc:s("_fbc"),_ga:s("_ga")},u())}})];case 5:return S=n.sent(),m?[3,7]:S.isSuccess&&S.data?[4,U(S.data)]:[3,7];case 6:n.sent(),n.label=7;case 7:return(O=m?S.data:a.cart)?(_="".concat(O.id,"-").concat(O.updatedAt),(w=O.orderLineItems.find(function(n){return n.variant.id===t.id}))?[4,import("../../../analytics/analytics-functions/addToCart.js")]:[3,9]):[3,9];case 8:(0,n.sent().anl_addToCart)(w,c,_,O,o),n.label=9;case 9:return o.productOptionSet&&v(o.productOptionSet),[2,{success:S.isSuccess,response:S}];case 10:return x=n.sent(),console.log(x),[2,{success:!1}];case 11:return[2]}})})}function g(r){return t(this,arguments,void 0,function(t,r){return void 0===r&&(r=1),n(this,function(n){switch(n.label){case 0:return[4,I(d(t),t,r)];case 1:return[2,n.sent()]}})})}function b(i,o,c,d){return t(this,void 0,void 0,function(){var t,l,f,v,p,m;return n(this,function(n){switch(n.label){case 0:return n.trys.push([0,10,,11]),[4,Q()];case 1:return n.sent(),[4,import("../../api/cart/index.js")];case 2:return[4,(0,n.sent().apiAddItemToCart)({input:{cartId:(null===(p=a.cart)||void 0===p?void 0:p.id)||null,item:{id:i.id,quantity:o,variant:{id:i.variant.id,name:i.variant.name,bundleProducts:null===(m=i.variant.bundleProducts)||void 0===m?void 0:m.map(function(t){return{id:t.id,productId:t.variant.productId||"",variantId:t.variant.id||"",quantity:t.quantity}})}},acceptedOffers:c?k(c):void 0,options:N(i),priceListId:e.priceListId||null,salesChannelId:e.salesChannelId,storefrontThemeId:e.storefrontThemeId,metadata:r({_fbp:s("_fbp"),_fbc:s("_fbc"),_ga:s("_ga")},u())}})];case 3:return(t=n.sent()).isSuccess&&t.data?[4,U(t.data)]:[3,5];case 4:n.sent(),n.label=5;case 5:return a.cart?(l="".concat(a.cart.id,"-").concat(a.cart.updatedAt),(f=i.quantity)>o?[4,import("../../../analytics/analytics-functions/removeFromCart.js")]:[3,7]):[3,9];case 6:return(0,n.sent().anl_removeFromCart)(i,f-o,a.cart),[3,9];case 7:return[4,import("../../../analytics/analytics-functions/addToCart.js")];case 8:(0,n.sent().anl_addToCart)(i,o-f,l,a.cart,d),n.label=9;case 9:return A(a),[2,{success:t.isSuccess,response:t}];case 10:return v=n.sent(),console.log(v),[2,{success:!1}];case 11:return[2]}})})}function y(r,e,i,a,o){return t(this,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,b(e,i,a,o)];case 1:return[2,t.sent()]}})})}function C(t,n){for(var r=0,e=(null==t?void 0:t.orderAdjustments)||[];r<e.length;r++)for(var i=0,a=e[r].appliedOrderLines||[];i<a.length;i++){var o=a[i];if(o.orderLineId===n.id)return o.isAutoCreated||!1}return!1}function S(r){return t(this,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,b(r,0)];case 1:return[2,t.sent()]}})})}function O(t){localStorage.removeItem(i),t.cart=null}function _(r){return t(this,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,new Promise(function(t){var n=setInterval(function(){r.isCartInitialLoadFinished&&(clearInterval(n),t(null))},100)})];case 1:return[2,t.sent()]}})})}function L(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("editLineID")||""}function j(t,n,r){var e;if(!r.productOptionSetId&&!n.bundleSettings)return t.orderLineItems.find(function(t){return t.variant.id===n.id});if(n.bundleSettings){var i=L();if(i)if(h=t.orderLineItems.find(function(t){return t.id===i}))return h}var a=t.orderLineItems.filter(function(t){return t.variant.id===n.id})||[];if(r.productOptionSetId)for(var o=D(r),s=a.filter(function(t){var n;return(null===(n=t.options)||void 0===n?void 0:n.length)===o.length})||[],u=0,c=s;u<c.length;u++){if((h=c[u]).options){for(var d=!0,l=function(t){var n=t.values.map(function(t){return t.value}),r=null===(e=o.find(function(n){return n.productOptionId===t.productOptionId}))||void 0===e?void 0:e.values;if(!(d=d&&n.length===(null==r?void 0:r.length)&&n.every(function(t){return null==r?void 0:r.includes(t)})))return"break"},f=0,v=h.options;f<v.length;f++){if("break"===l(v[f]))break}if(d){if(!n.bundleSettings)return h;if(x(n,h))return h}}}else if(n.bundleSettings)for(var p=0,m=a;p<m.length;p++){var h=m[p];if(x(n,h))return h}}function w(t,n){return j(t,d(n),n)}function x(t,n){var r,e=null===(r=t.bundleSettings)||void 0===r?void 0:r.products,i=n.variant.bundleProducts;return!!e&&((null==e?void 0:e.length)===(null==i?void 0:i.length)&&(null==e?void 0:e.every(function(t){return!!(null==i?void 0:i.find(function(n){return n.id===t.id&&n.quantity===t.quantity&&t.product&&n.variant.id===d(t.product).id}))})))}function P(r,e){return t(this,void 0,void 0,function(){var t;return n(this,function(n){switch(n.label){case 0:return[4,import("../../api/cart/index.js")];case 1:return[4,(0,n.sent().apiSaveCartCouponCode)({cartId:r.id,couponCode:e})];case 2:return(t=n.sent()).isSuccess&&t.data&&(a.cart=t.data),[2,{success:t.isSuccess,response:t}]}})})}function T(r){return t(this,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,P(r,null)];case 1:return[2,t.sent()]}})})}function q(r,e){return t(this,void 0,void 0,function(){var t;return n(this,function(n){switch(n.label){case 0:return[4,import("../../api/cart/index.js")];case 1:return[4,(0,n.sent().apiRemoveGiftCardFromCart)({cartId:r.id,giftCardId:e})];case 2:return(t=n.sent()).isSuccess&&t.data&&(a.cart=t.data),[2,{success:t.isSuccess,response:t}]}})})}function A(t){t.cart&&0===c(t.cart)&&O(t)}function E(){return t(this,void 0,void 0,function(){var t,r,e,s,u,c;return n(this,function(n){switch(n.label){case 0:if(!("undefined"!=typeof localStorage))return[2];n.label=1;case 1:return n.trys.push([1,8,9,10]),a.isCartLoading=!0,[4,m(o)];case 2:return n.sent(),t=null===(u=o.customer)||void 0===u?void 0:u.id,(r=(null===(c=a.cart)||void 0===c?void 0:c.id)||localStorage.getItem(i))||t?[4,import("../../api/cart/index.js")]:[2];case 3:return[4,(0,n.sent().apiGetCartById)({id:r})];case 4:return(e=n.sent()).isSuccess&&e.data?[4,U(e.data)]:[3,6];case 5:return n.sent(),[3,7];case 6:if(e.isCancelled||e.isNetworkError)return[2];O(a),n.label=7;case 7:return[3,10];case 8:return s=n.sent(),console.log(s),[3,10];case 9:return a.isCartLoading=!1,a.isCartInitialLoadFinished=!0,[7];case 10:return[2]}})})}function k(t){var n=t.filter(function(t){return t.isSelected&&!f(t)}).map(function(t){return{campaignOfferId:t.campaignOfferId,campaignOfferProductId:t.campaignOfferProductId,productId:t.product.id,quantity:t.quantity,variantId:d(t.product).id}})||[];return n.length?n:void 0}function F(r,i){return t(this,arguments,void 0,function(t,r,i){var a,o,s,u,c,l,f,v,p,m,h,g,b,y,C;return void 0===i&&(i=1),n(this,function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),a=e.salesChannelId,o=e.storefrontThemeId,a&&o?(s=d(r))?[4,I(s,r,i,{isPayWithIkas:!0})]:[2,{success:!1,error:"No variant selected"}]:[2,{success:!1,error:"Missing storefront configuration"}];case 1:return(u=t.sent()).success&&(null===(p=null===(v=u.response)||void 0===v?void 0:v.data)||void 0===p?void 0:p.id)?(c=u.response.data.id,[4,import("../../api/cart/index.js")]):[2,{success:!1,error:(null===(g=null===(h=null===(m=u.response)||void 0===m?void 0:m.graphQLErrors)||void 0===h?void 0:h[0])||void 0===g?void 0:g.message)||"Failed to create cart"}];case 2:return[4,(0,t.sent().apiCreatePayWithIkasSessionUrl)({cartId:c})];case 3:return!(l=t.sent()).data||(null===(b=l.graphQLErrors)||void 0===b?void 0:b.length)?[2,{success:!1,error:(null===(C=null===(y=l.graphQLErrors)||void 0===y?void 0:y[0])||void 0===C?void 0:C.message)||"Failed to create Pay with ikas session"}]:[2,{success:!0,payUrl:l.data.payUrl,expiresAt:l.data.expiresAt}];case 4:return f=t.sent(),console.log("error",f),[2,{success:!1,error:f instanceof Error?f.message:"Unknown error occurred"}];case 5:return[2]}})})}function U(r){return t(this,void 0,void 0,function(){return n(this,function(t){return localStorage.setItem(i,r.id),a.cart=r,[2]})})}function Q(){return t(this,void 0,void 0,function(){var t;return n(this,function(n){switch(n.label){case 0:return t=localStorage.getItem(i),!a.cart||t?[3,1]:(O(a),[3,3]);case 1:return a.cart||!t?[3,3]:[4,E()];case 2:n.sent(),n.label=3;case 3:return[2]}})})}function N(t){if(t&&t.options){for(var n=[],r=0,e=t.options;r<e.length;r++){var i=e[r],a={productOptionId:i.productOptionId,productOptionsSetId:i.productOptionsSetId,values:i.values.map(function(t){return t.value})};n.push(a)}return n}return null}function D(t){var n,r=[],e=new Set,i=function(t){var n;e.has(t.id)||(e.add(t.id),t.values.length&&r.push({productOptionId:t.id,productOptionsSetId:t.productOptionSetId,values:t.values}),null===(n=t.childOptions)||void 0===n||n.forEach(i))};return null===(n=t.productOptionSet)||void 0===n||n.options.filter(function(t){return!t.requiredOptionId}).forEach(i),r}function R(i){return t(this,void 0,void 0,function(){var t,o,c,d,l,f,v,p,m,h,I;return n(this,function(n){switch(n.label){case 0:return n.trys.push([0,10,,11]),[4,Q()];case 1:return n.sent(),t=i.itemId?null===(m=a.cart)||void 0===m?void 0:m.orderLineItems.find(function(t){return t.id===i.itemId}):null,[4,import("../../api/cart/index.js")];case 2:return[4,(0,n.sent().apiAddItemToCart)({input:{cartId:(null===(h=a.cart)||void 0===h?void 0:h.id)||null,item:{id:i.itemId||null,quantity:i.quantity,variant:{id:i.variantId}},priceListId:e.priceListId||null,salesChannelId:e.salesChannelId,storefrontThemeId:e.storefrontThemeId,metadata:r({_fbp:s("_fbp"),_fbc:s("_fbc"),_ga:s("_ga")},u())}})];case 3:return(o=n.sent()).isSuccess&&o.data?(i.itemId||(c=(null===(I=a.cart)||void 0===I?void 0:I.orderLineItems.map(function(t){return t.id}))||[],d=o.data.orderLineItems.map(function(t){return t.id}),(l=d.find(function(t){return!c.includes(t)}))&&(t=o.data.orderLineItems.find(function(t){return t.id===l}))),[4,U(o.data)]):[3,5];case 4:n.sent(),n.label=5;case 5:return a.cart&&t?(f="".concat(a.cart.id,"-").concat(a.cart.updatedAt),(v=i.quantity)>i.quantity?[4,import("../../../analytics/analytics-functions/removeFromCart.js")]:[3,7]):[3,9];case 6:return(0,n.sent().anl_removeFromCart)(t,v-i.quantity,a.cart),[3,9];case 7:return[4,import("../../../analytics/analytics-functions/addToCart.js")];case 8:(0,n.sent().anl_addToCart)(t,i.quantity-v,f,a.cart),n.label=9;case 9:return A(a),[2,{success:o.isSuccess,response:o}];case 10:return p=n.sent(),console.log(p),[2,{success:!1}];case 11:return[2]}})})}function V(t){var n;return!!t.cart&&(null===(n=t.cart.orderLineItems)||void 0===n?void 0:n.length)>0}export{I as addItemToCart,g as addSelectedtedVariantToCart,y as changeCartItemQuantity,b as changeItemQuantity,F as createPayWithIkasSession,j as findExistingCartItem,w as findExistingCartItemWithProduct,k as getAcceptedOffers,E as getCart,h as getCheckoutUrlFromCartStore,V as hasCart,C as isOrderLineItemAutoCreated,O as removeCart,T as removeCouponCode,q as removeGiftCardLine,S as removeItem,P as saveCouponCode,U as setCart,_ as waitForCartStoreInit,R as windowAddToCart};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ListLoyaltyProgramPointHistoryQueryParams, SaveCustomerFormDataInput, UseLoyaltyPointsQueryParams } from "../../../storefront-api/src";
|
|
1
|
+
import type { ExternalAccountLink, ListLoyaltyProgramPointHistoryQueryParams, MilesSmilesDetailsResponse, SaveCustomerFormDataInput, UseLoyaltyPointsQueryParams } from "../../../storefront-api/src";
|
|
2
2
|
import { APIResponse } from "../../../storefront-api-client/src";
|
|
3
3
|
import { AccountInfoForm, AddressForm, ContactForm, CouponCodeForm, DeactivateCustomerForm, ForgotPasswordForm, IkasContactForm, IkasCustomer, IkasCustomerAddress, IkasCustomerAttributeValue, IkasCustomerReviewForm, IkasFavoriteProduct, IkasOrder, IkasOrderTransaction, IkasProduct, IkasProductFile, LoginForm, NewsletterSubscriptionForm, OrderTrackingForm, RecoverPasswordForm, RegisterForm, SmsLoginForm, VerifyPhoneNumberForm } from "../../../storefront-models/src";
|
|
4
4
|
import { IkasCustomerStore } from "../../../stores/customer";
|
|
5
5
|
import { IkasLoginError, IkasRegisterError } from "../../api/customer";
|
|
6
|
-
export type SocialLoginProvider = "facebook" | "google" | "twitch"
|
|
6
|
+
export type SocialLoginProvider = "facebook" | "google" | "twitch";
|
|
7
7
|
/**
|
|
8
8
|
* Initialize the customer store by loading tokens, refreshing authentication, and fetching customer data.
|
|
9
9
|
*
|
|
@@ -192,6 +192,143 @@ export declare function handleSocialLogin(customerStore: IkasCustomerStore): Pro
|
|
|
192
192
|
* ```
|
|
193
193
|
*/
|
|
194
194
|
export declare function socialLoginToken(customerStore: IkasCustomerStore, token: string): Promise<boolean>;
|
|
195
|
+
/** Provider segment of the customer-service external-account endpoints (`/ms/miles_smiles/bind/*`). */
|
|
196
|
+
export declare const MILES_SMILES_PROVIDER: string;
|
|
197
|
+
/** Synthetic gateway code a Miles&Smiles SALE is written on. Never selectable at checkout. */
|
|
198
|
+
export declare const MILES_SMILES_PAYMENT_GATEWAY_CODE: string;
|
|
199
|
+
/** Synthetic gateway id of the Miles&Smiles SALE. Never send it as `paymentGatewayId`. */
|
|
200
|
+
export declare const MILES_SMILES_PAYMENT_GATEWAY_ID: string;
|
|
201
|
+
/**
|
|
202
|
+
* Start the Turkish Airlines Miles&Smiles account bind flow for the logged-in customer.
|
|
203
|
+
* Opens the THY login page in a popup; once THY confirms, the browser is sent to the
|
|
204
|
+
* ikas bind callback and lands back on `redirect` with `milesSmilesStatus` query params
|
|
205
|
+
* (see handleMilesSmilesBind). Binding is required before miles can be spent at checkout.
|
|
206
|
+
*
|
|
207
|
+
* @ai-category Customer, Miles&Smiles
|
|
208
|
+
* @ai-related handleMilesSmilesBind, getMilesSmilesLink, unlinkMilesSmiles, getMilesSmilesDetails
|
|
209
|
+
*
|
|
210
|
+
* @param customerStore - The customer store instance (customer must be logged in)
|
|
211
|
+
* @param redirect - Relative store path to land on after bind, e.g. "/account" or "/checkout?id=...&step=payment"
|
|
212
|
+
* @returns `isSuccess: true` when the bind hand-off started; otherwise an `errorCode`
|
|
213
|
+
* such as "AUTHORIZATION_REQUIRED" or "MILES_SMILES_LOGIN_CANCELLED_OR_FAILED"
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```typescript
|
|
217
|
+
* import { customerStore, milesSmilesBind } from "@ikas/bp-storefront";
|
|
218
|
+
*
|
|
219
|
+
* async function onLinkClick() {
|
|
220
|
+
* const result = await milesSmilesBind(customerStore, "/account");
|
|
221
|
+
* if (!result.isSuccess) showToast(result.errorCode || "UNEXPECTED_ERROR");
|
|
222
|
+
* }
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
export declare function milesSmilesBind(customerStore: IkasCustomerStore, redirect?: string | null): Promise<MilesSmilesBindResult>;
|
|
226
|
+
/**
|
|
227
|
+
* Read the Miles&Smiles bind result from the current URL after THY redirects back
|
|
228
|
+
* (`?milesSmilesStatus=success` or `?milesSmilesStatus=fail&milesSmilesError=CODE`).
|
|
229
|
+
* Call this on the landing page (account or checkout). The params are removed from the
|
|
230
|
+
* URL so a refresh does not repeat the same message.
|
|
231
|
+
*
|
|
232
|
+
* @ai-category Customer, Miles&Smiles
|
|
233
|
+
* @ai-related milesSmilesBind, getMilesSmilesLink
|
|
234
|
+
*
|
|
235
|
+
* @param clear - Remove the params from the URL with history.replaceState (default: true)
|
|
236
|
+
* @returns The landing result, or null when the URL carries no bind result
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* ```typescript
|
|
240
|
+
* import { handleMilesSmilesBind } from "@ikas/bp-storefront";
|
|
241
|
+
*
|
|
242
|
+
* useEffect(() => {
|
|
243
|
+
* const result = handleMilesSmilesBind();
|
|
244
|
+
* if (result?.status === "success") showToast("Miles&Smiles account linked");
|
|
245
|
+
* if (result?.status === "fail") showToast(result.errorCode || "Bind failed");
|
|
246
|
+
* }, []);
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
export declare function handleMilesSmilesBind(clear?: boolean): HandleMilesSmilesBindReturnType | null;
|
|
250
|
+
/**
|
|
251
|
+
* Get the customer's durable Miles&Smiles link (TK membership number and link date).
|
|
252
|
+
* A link does not guarantee a live checkout session; when getMilesSmilesDetails returns
|
|
253
|
+
* MILES_SMILES_LOGIN_REQUIRED, run milesSmilesBind again.
|
|
254
|
+
*
|
|
255
|
+
* @ai-category Customer, Miles&Smiles
|
|
256
|
+
* @ai-related milesSmilesBind, unlinkMilesSmiles
|
|
257
|
+
*
|
|
258
|
+
* @param customerStore - The customer store instance
|
|
259
|
+
* @returns API response whose data is the link, or null when not linked
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```typescript
|
|
263
|
+
* import { customerStore, getMilesSmilesLink } from "@ikas/bp-storefront";
|
|
264
|
+
*
|
|
265
|
+
* const response = await getMilesSmilesLink(customerStore);
|
|
266
|
+
* const tkNumber = response.data?.externalId;
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
export declare function getMilesSmilesLink(customerStore: IkasCustomerStore): Promise<APIResponse<ExternalAccountLink | null>>;
|
|
270
|
+
/**
|
|
271
|
+
* Remove the customer's Miles&Smiles link. Also clears the server-side checkout
|
|
272
|
+
* session token, so miles cannot be spent until the customer binds again.
|
|
273
|
+
*
|
|
274
|
+
* @ai-category Customer, Miles&Smiles
|
|
275
|
+
* @ai-related milesSmilesBind, getMilesSmilesLink
|
|
276
|
+
*
|
|
277
|
+
* @param customerStore - The customer store instance
|
|
278
|
+
* @returns API response whose data is true on success
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* ```typescript
|
|
282
|
+
* import { customerStore, unlinkMilesSmiles } from "@ikas/bp-storefront";
|
|
283
|
+
*
|
|
284
|
+
* const response = await unlinkMilesSmiles(customerStore);
|
|
285
|
+
* if (response.isSuccess) showToast("Miles&Smiles link removed");
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
export declare function unlinkMilesSmiles(customerStore: IkasCustomerStore): Promise<APIResponse<boolean>>;
|
|
289
|
+
/**
|
|
290
|
+
* Get the Miles&Smiles balance and member details for the payment step.
|
|
291
|
+
* Requires a recent bind; MILES_SMILES_LOGIN_REQUIRED means the short-lived session
|
|
292
|
+
* expired and milesSmilesBind should be run again. MILES_SMILES_NOT_ENABLED and
|
|
293
|
+
* PAYMENT_GATEWAY_NOT_FOUND mean the Miles UI should be hidden.
|
|
294
|
+
*
|
|
295
|
+
* @ai-category Customer, Miles&Smiles
|
|
296
|
+
* @ai-related milesSmilesBind, getMilesSmilesLink
|
|
297
|
+
*
|
|
298
|
+
* @param customerStore - The customer store instance
|
|
299
|
+
* @returns API response whose data holds availableMiles, memberId, firstName and lastName
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* ```typescript
|
|
303
|
+
* import { customerStore, getMilesSmilesDetails } from "@ikas/bp-storefront";
|
|
304
|
+
*
|
|
305
|
+
* const response = await getMilesSmilesDetails(customerStore);
|
|
306
|
+
* if (response.errorCodes.includes("MILES_SMILES_LOGIN_REQUIRED")) {
|
|
307
|
+
* await milesSmilesBind(customerStore, window.location.pathname + window.location.search);
|
|
308
|
+
* } else if (response.data) {
|
|
309
|
+
* console.log("Available miles:", response.data.availableMiles);
|
|
310
|
+
* }
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
export declare function getMilesSmilesDetails(customerStore: IkasCustomerStore): Promise<APIResponse<MilesSmilesDetailsResponse | undefined>>;
|
|
314
|
+
/**
|
|
315
|
+
* Check whether an order transaction is the Miles&Smiles leg of a multi-tender payment.
|
|
316
|
+
* Such rows are written on the synthetic MILES_SMILES gateway and are not refundable from the storefront.
|
|
317
|
+
*
|
|
318
|
+
* @ai-category Customer, Orders, Miles&Smiles
|
|
319
|
+
* @ai-related getOrderTransactions
|
|
320
|
+
*
|
|
321
|
+
* @param transaction - The order transaction to check
|
|
322
|
+
* @returns True when the transaction is a Miles&Smiles SALE
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```typescript
|
|
326
|
+
* import { isMilesSmilesTransaction } from "@ikas/bp-storefront";
|
|
327
|
+
*
|
|
328
|
+
* const label = isMilesSmilesTransaction(tx) ? "Miles&Smiles" : tx.paymentGatewayName;
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
export declare function isMilesSmilesTransaction(transaction: IkasOrderTransaction): boolean;
|
|
195
332
|
/**
|
|
196
333
|
* Delete a customer address from their address list.
|
|
197
334
|
*
|
|
@@ -1312,6 +1449,16 @@ type HandleSocialLoginReturnType = {
|
|
|
1312
1449
|
status?: "fail" | "success";
|
|
1313
1450
|
message?: string;
|
|
1314
1451
|
};
|
|
1452
|
+
export type MilesSmilesBindResult = {
|
|
1453
|
+
isSuccess: boolean;
|
|
1454
|
+
/** Bind error code, e.g. AUTHORIZATION_REQUIRED, MILES_SMILES_LOGIN_CANCELLED_OR_FAILED, UNEXPECTED_ERROR. */
|
|
1455
|
+
errorCode?: string | null;
|
|
1456
|
+
};
|
|
1457
|
+
export type HandleMilesSmilesBindReturnType = {
|
|
1458
|
+
status: "success" | "fail";
|
|
1459
|
+
/** milesSmilesError from the redirect, e.g. EXTERNAL_ACCOUNT_ALREADY_LINKED. */
|
|
1460
|
+
errorCode: string | null;
|
|
1461
|
+
};
|
|
1315
1462
|
/**
|
|
1316
1463
|
* Get or initialize the account info form with validation for updating customer profile details.
|
|
1317
1464
|
*
|
|
@@ -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 o,observable as s}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'./../../../ext/lodash/_isFlattenable.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 g}from"../../models/validator/coupon-code-form/index.js";import{initDeactivateCustomerForm as b}from"../../models/validator/deactivate-customer/index.js";import{initForgotPasswordForm as S}from"../../models/validator/forgot-password/index.js";import{initLoginForm as I}from"../../models/validator/login/index.js";import{initNewsletterSubscriptionForm as k}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 T}from"../../models/validator/sms-login/index.js";import{initVerifyPhoneNumberForm as E}from"../../models/validator/verify-phone-number/index.js";var F="customerToken",C="customerTokenExpiry",P="customerEmailSubscription",L="lastViewedProducts",N="customerConsent";function O(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return Ft(e),Vt(e),Bt(e),[4,Tt(e)];case 1:return t.sent(),[4,xt(e)];case 2:return t.sent(),e._initialized=!0,[4,lt(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 R(e,n){return t(this,arguments,void 0,function(t,e,n){var i,o;return void 0===n&&(n=[]),r(this,function(r){switch(r.label){case 0:if(Ft(t),Vt(t),Bt(t),!(null==e?void 0:e.customer)||!t._token)return[3,4];if(jt(t,e.customer),t._favoriteProducts=e.favoriteProducts||[],t._isFavoriteProductsLoaded=!0,!(i=n.filter(function(t){return!(t in e.customer)})).length)return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,xt(t)];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),console.error("[seedCustomerSession] snapshot lacks [".concat(i.join(", "),"] and the fallback fetch failed — ")+"keeping the partial customer:",o),[3,4];case 4:return t._initialized=!0,[2]}})})}function A(t){Pt(t)}function V(t){return!!t.customer&&(!(p(t.customer)||d()||t._visitorSubscribedEmail)&&!window.localStorage.getItem(P))}function U(t){return e(e({},t.customer),{consentGranted:t._customerConsentGranted})}function D(e,n){return t(this,void 0,void 0,function(){var t,e,o,s,c,u;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 o=r.sent(),"miles_smiles"===n?(s=function(t){try{return new URL(t).searchParams.get("redirectUrl")}catch(t){return null}},c=function(t){try{var e=s(t);return e?new URL(e).searchParams.get("transactionId"):null}catch(t){return null}},u=function(t){var e=s(o.redirectUrl)||"",r=document.createElement("form");r.method="POST",r.action=e,r.style.display="none";for(var n=0,i=[["transactionId",t.transactionId],["token",t.token],["memberId",t.memberId],["shortTokenExpireMinute",null!=t.shortTokenExpireMinute?String(t.shortTokenExpireMinute):""],["longToken",t.longToken||""],["longTokenExpireMinute",null!=t.longTokenExpireMinute?String(t.longTokenExpireMinute):""]];n<i.length;n++){var a=i[n],c=a[0],u=a[1],d=document.createElement("input");d.type="hidden",d.name=c,d.value=u,r.appendChild(d)}document.body.appendChild(r),r.submit()},window.addEventListener("message",function(t){var e;try{e="string"==typeof t.data?JSON.parse(t.data):t.data}catch(t){return}if(e&&!0===e.isSuccess){var r={transactionId:c(o.redirectUrl),token:e.token,memberId:e.ffid||e.memberId||e.memberID,shortTokenExpireMinute:e.tokenExpireMinute,longToken:e.longToken,longTokenExpireMinute:e.longTokenExpireMinute};r.memberId&&r.token?u(r):console.error("Missing token or memberId")}}),window.open(o.redirectUrl,"mslogin","width=480,height=720"),[2]):(a.navigate(o.redirectUrl),[2])}})})}function M(e){return t(this,void 0,void 0,function(){var t,n,i,o,s;return r(this,function(r){switch(r.label){case 0:return t={status:"fail"},n=new URLSearchParams(window.location.search),i=n.get("socialLoginStatus"),o=n.get("socialLoginToken"),"success"===i&&o?[4,B(e,o)]:[3,2];case 1:return r.sent()?(t.status="success",[2,t]):[2,t];case 2:return s=n.get("socialLoginError"),t.message=s||void 0,[2,t]}})})}function B(e,n){return t(this,void 0,void 0,function(){var t,i,o;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===(o=t.data)||void 0===o?void 0:o.customer)?(Et(e,t.data.token,t.data.tokenExpiry),jt(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 G(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,rt(e,t)]):[2,!1];case 1:return[2,r.sent()]}})})}function W(e,n,i){return t(this,void 0,void 0,function(){var t,e,o;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 o=r.sent(),console.error(o),[3,5];case 5:return[2,!1]}})})}function q(e,n,i,o){return t(this,void 0,void 0,function(){var t,s;return r(this,function(r){switch(r.label){case 0:return[4,Ot(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:o,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Lt(e),t&&t.isSuccess&&t.data?(s=t.data,Et(e,s.token,s.tokenExpiry),s.customer&&jt(e,s.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 Mt(e),[2,{isSuccess:!0,errorCodes:[],otpSend:s.otpSend,flowId:s.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 z(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return Pt(e),m(u),[4,import("../../../analytics/analytics-functions/customerLogout.js")];case 1:return(0,t.sent().anl_customerLogout)(),[2]}})})}function K(e,n,i,o,s,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,Ot(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiRegister)({email:o,password:s,firstName:n,lastName:i,isAcceptMarketing:a,attributes:c,captchaToken:e._captchaToken,phone:u,flowId:d})];case 3:return t=r.sent(),Lt(e),t&&t.isSuccess&&(null===(l=t.data)||void 0===l?void 0:l.customer)?(Et(e,t.data.token,t.data.tokenExpiry),jt(e,t.data.customer),Mt(e),[4,import("../../../analytics/analytics-functions/completeRegistration.js")]):[3,5];case 4:return(0,r.sent().anl_completeRegistration)(U(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 H(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,Ot(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(),Lt(e),[2,i.isSuccess];case 4:return[2,!1]}})})}function J(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,Ot(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(),Lt(e),[2,t.isSuccess];case 4:return[2,!1]}})})}function X(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,Ot(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(),Lt(e),[2,!(!t.isSuccess||!t.data)&&t.data];case 4:return[2,!1]}})})}function Y(n,i,o){return t(this,void 0,void 0,function(){var t,s,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:o,captchaToken:n._captchaToken})];case 2:return t=r.sent(),Lt(n),t&&t.isSuccess&&(null===(s=t.data)||void 0===s?void 0:s.customer)?(Et(n,t.data.token,t.data.tokenExpiry),jt(n,t.data.customer),Mt(n),[4,import("../../../analytics/analytics-functions/completeRegistration.js")]):[3,4];case 3:return(0,r.sent().anl_completeRegistration)(U(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({},U(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 Q(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 Z(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,Ot(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(),Lt(n),[2,t.isSuccess]}})})}function $(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,Ot(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(),Lt(e),[2,!!t.isSuccess&&!!(null===(i=t.data)||void 0===i?void 0:i.exists)]}})})}function tt(e,n){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,Ot(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(),Lt(e),[2,!!t.isSuccess&&t.data]}})})}function et(e,n,i,o){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,Ot(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:o,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Lt(e),[2,t.isSuccess]}})})}function rt(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:qt(n)})];case 2:return(t=r.sent()).isSuccess&&t.data?(jt(e,t.data),[2,!0]):[2,!1]}})})}function nt(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,gt(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 it(e,n){return t(this,void 0,void 0,function(){var o,s,a,c,u,d,l,m=this;return r(this,function(f){switch(f.label){case 0:return[4,gt(e)];case 1:return f.sent(),e.customer?(o=n,!i.isPreview||o&&"orders"!==o?[3,3]:[4,nt(e)]):[2,null];case 2:(s=f.sent()).length&&(o=s[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:o})]}})}),yt(e),st(e,{orderId:o})])];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 ot(e,n,i){return t(this,void 0,void 0,function(){var t,o,s,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?(o=t.data,[4,Promise.all([yt(e),st(e,{orderId:o.id})])]):[2,null];case 3:return s=r.sent(),a=s[1],o.transactions=a,[2,o]}})})}function st(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 at(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 ct(e){return t(this,void 0,void 0,function(){var t,n,o,a,c;return r(this,function(r){switch(r.label){case 0:return[4,lt(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===(o=n.data)||void 0===o?void 0:o.data)||void 0===a||a.forEach(function(t){t.selectedVariantValues=t.variants[0].variantValues}),[2,s((null===(c=null==n?void 0:n.data)||void 0===c?void 0:c.data)||[])]}})})}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: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,lt(e,!0)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2,t.data||!1]}})})}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: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,lt(e,!0)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2,t.data||!1]}})})}function lt(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,gt(t)];case 1:return r.sent(),t.customer?t._isFavoriteProductsLoaded&&!e?[3,3]:[4,at(t)]:[2,[]];case 2:n=r.sent(),t._favoriteProducts=n,t._isFavoriteProductsLoaded=!0,r.label=3;case 3:return[2,t._favoriteProducts]}})})}function mt(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 ft(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,Ot(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(P,"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 pt(n,i){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,Ot(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(P,"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 vt(n,o){return t(this,void 0,void 0,function(){var t,s,a,c,u;return r(this,function(r){switch(r.label){case 0:if(t=i.customerReviewSettings,s=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({},o),{customerId:t.customerLoginRequired?c:void 0,salesChannelId:s||"",locale:a})})];case 2:return[2,r.sent().data]}})})}function ht(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 _t(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 wt(t){!function(t){if(d())return;t._customerConsentGranted=!0,window.localStorage.setItem(N,"true")}(t)}function gt(e){return t(this,void 0,void 0,function(){return r(this,function(t){return d()||e._initialized?[2]:[2,new Promise(function(t){var r=setInterval(function(){e._initialized&&(clearInterval(r),t(null))},100)})]})})}function bt(t){return new Promise(function(e){var r=setInterval(function(){t._captchaToken&&(clearInterval(r),e(null))},100)})}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[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 It(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 kt(e,n,i){return t(this,void 0,void 0,function(){var t,e,o,s,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(),(o=e.data)&&((s=document.createElement("a")).href=o,s.download=decodeURIComponent(i.name.split("/")[i.name.split("/").length-1])||"",s.click(),s.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 yt(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 xt(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&&jt(e,t.data),[2]}})})}function jt(t,e){t.customer=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 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)Et(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,Pt(e)}return[2]}})})}function Et(t,e,r){d()||(t._token=e,t._tokenExpiry=r,localStorage.setItem(F,e),localStorage.setItem(C,r+""),i.init({customerToken:e}),n.TOKEN=e)}function Ft(t){if(!d()){var e=localStorage.getItem(F),r=localStorage.getItem(C);e&&r?Et(t,e,parseInt(r)):Ct(t)}}function Ct(t){localStorage.removeItem(F),localStorage.removeItem(C),t._token=null,t._tokenExpiry=null}function Pt(t){Ct(t),t.customer=null,t._favoriteProducts=[],t._isFavoriteProductsLoaded=!1,i.init({customerToken:""}),n.TOKEN="",Lt(t)}function Lt(t){t._captchaToken=null}function Nt(t,e){t._captchaToken=e}function Ot(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,bt(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 Rt(t,e){t._savedLastViewedProducts=l(t._lastViewedProducts),t._savedLastViewedProductsResponse=e}function At(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:Vt(e),r.label=4;case 4:return[2,e._lastViewedProducts]}})})}function Vt(t){d()||(t._lastViewedProducts=Ut(),t._lastViewedProducts=l(t._lastViewedProducts).reverse())}function Ut(){if(d())return[];try{var t=window.localStorage.getItem(L);if(t)return JSON.parse(t)}catch(t){console.error(t)}return[]}function Dt(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=Ut(),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(L,JSON.stringify(t._lastViewedProducts))}(e),t.label=4;case 4:return[2]}})})}function Mt(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=Ut()).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(L)),r.label=4;case 4:return[3,6];case 5:return n=r.sent(),console.error(n),[3,6];case 6:return[2]}})})}function Bt(t){d()||(t._customerConsentGranted=!!window.localStorage.getItem(N))}function Gt(t){return t._customerConsentGranted}function Wt(t){d()||window.localStorage.removeItem(N)}function qt(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 zt(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 Kt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return[4,gt(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 Ht(e){return t(this,void 0,void 0,function(){var t,n,i,o,s,a,c;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),[4,gt(e)];case 1:return r.sent(),t=null===(o=u.cart)||void 0===o?void 0:o.id,n=null===(c=null===(a=null===(s=u.cart)||void 0===s?void 0:s.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 Jt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return[4,gt(e)];case 1:return r.sent(),Zt(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 Xt(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 Yt(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 Qt(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 Zt(t){return!!t.customer}function $t(t){return t._accountInfoForm||(t._accountInfoForm={},_(t._accountInfoForm)),t._accountInfoForm}function te(t){t._accountInfoForm=null}function ee(t){return t._contactForm||(t._contactForm={},w(t._contactForm)),t._contactForm}function re(t){t._contactForm=null}function ne(t){return t._couponCodeForm||(t._couponCodeForm={},g(t._couponCodeForm)),t._couponCodeForm}function ie(t){t._couponCodeForm=null}function oe(t){return t._deactivateCustomerForm||(t._deactivateCustomerForm={},b(t._deactivateCustomerForm)),t._deactivateCustomerForm}function se(t){t._deactivateCustomerForm=null}function ae(t){return t._forgotPasswordForm||(t._forgotPasswordForm={},S(t._forgotPasswordForm)),t._forgotPasswordForm}function ce(t){t._forgotPasswordForm=null}function ue(t){return t._loginForm||(t._loginForm={},I(t._loginForm)),t._loginForm}function de(t){return t._smsLoginForm||(t._smsLoginForm={},T(t._smsLoginForm)),t._smsLoginForm}function le(t){return t._verifyPhoneNumberForm||(t._verifyPhoneNumberForm={},E(t._verifyPhoneNumberForm)),t._verifyPhoneNumberForm}function me(t){t._loginForm=null}function fe(t){return t._newsletterSubscriptionForm||(t._newsletterSubscriptionForm={},k(t._newsletterSubscriptionForm)),t._newsletterSubscriptionForm}function pe(t){t._newsletterSubscriptionForm=null}function ve(t){return t._orderTrackingForm||(t._orderTrackingForm={},y(t._orderTrackingForm)),t._orderTrackingForm}function he(t){t._orderTrackingForm=null}function _e(t){return t._recoverPasswordForm||(t._recoverPasswordForm={},x(t._recoverPasswordForm)),t._recoverPasswordForm}function we(t){t._recoverPasswordForm=null}function ge(t){return t._registerForm||(t._registerForm={},j(t._registerForm)),t._registerForm}function be(t){t._registerForm=null}function Se(t){var e={};return v(e),o(e)}function Ie(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,nt(e)]);case 1:(n=r.sent()).length&&(t=n[0].id),r.label=2;case 2:return t?[4,it(e,t)]:[3,4];case 3:return[2,r.sent()];case 4:return[2]}})})}function ke(t){try{window.openIkasStorefrontWidget()}catch(t){console.error("Failed to open ikas storefront widget",t)}}function ye(t){try{window.closeIkasStorefrontWidget()}catch(t){console.error("Failed to close ikas storefront widget",t)}}export{H as activateCustomer,ut as addProductToFavorites,V as canCustomerCreateEmailSubscription,$ as checkEmail,te as clearAccountInfoForm,re as clearContactForm,ie as clearCouponCodeForm,A as clearCustomerSession,se as clearDeactivateCustomerForm,ce as clearForgotPasswordForm,me as clearLoginForm,pe as clearNewsletterSubscriptionForm,he as clearOrderTrackingForm,we as clearRecoverPasswordForm,be as clearRegisterForm,ye as closeIkasStorefrontWidget,ft as createEmailSubscription,Jt as cs_getLoyaltyCustomerInfo,zt as cs_listEarningMethods,Yt as cs_listLoyaltyProgramPointHistory,Xt as cs_listLoyaltyProgramTiers,Kt as cs_listSpendingMethodsByCartId,Ht as cs_removeLoyaltyPointsFromCart,Qt as cs_useLoyaltyPoints,q as customerLogin,Dt as customerStore_onProductView,U as customerToAnalyticsCustomer,ht as deactivateCustomer,G as deleteCustomerAddress,_t as exportCustomerPersonalData,tt as forgotPassword,$t as getAccountInfoForm,ee as getContactForm,ne as getCouponCodeForm,St as getCustomerAttributes,Gt as getCustomerConsentGranted,oe as getDeactivateCustomerForm,kt as getDigitalProductFileDownloadUrl,Se as getEmptyAddressForm,ct as getFavoriteProducts,at as getFavoriteProductsIds,ae as getForgotPasswordForm,At as getLastViewedProducts,ue as getLoginForm,fe as getNewsletterSubscriptionForm,it as getOrder,ot as getOrderByEmail,Ie as getOrderDetailsOfPage,It as getOrderProductFiles,yt as getOrderRefundSettings,ve as getOrderTrackingForm,st as getOrderTransactions,nt as getOrders,_e as getRecoverPasswordForm,ge as getRegisterForm,de as getSmsLoginForm,le as getVerifyPhoneNumberForm,wt as handleCustomerConsentGrant,M as handleSocialLogin,Zt as hasCustomer,O as initCustomerStore,mt as isFavoriteProduct,z as logout,ke as openIkasStorefrontWidget,et as recoverPassword,W as refundOrder,K as register,Wt as removeCustomerConsent,dt as removeProductFromFavorites,J as resendCustomerActivationMail,Q as resendCustomerPhoneVerificationCode,Z as saveContactForm,rt as saveCustomer,pt as saveCustomerFormData,R as seedCustomerSession,vt as sendReview,Nt as setCaptchaToken,Rt as setSavedLastViewedProductsResponse,D as socialLogin,B as socialLoginToken,X as validateCustomerPhoneVerificationCode,Y as validateOTPCode,bt as waitForCaptchaTokenInit,gt 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 o,observable as s}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'./../../../ext/lodash/_isFlattenable.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 S}from"../../models/validator/coupon-code-form/index.js";import{initDeactivateCustomerForm as I}from"../../models/validator/deactivate-customer/index.js";import{initForgotPasswordForm as g}from"../../models/validator/forgot-password/index.js";import{initLoginForm as b}from"../../models/validator/login/index.js";import{initNewsletterSubscriptionForm as E}from"../../models/validator/newsletter-subscription/index.js";import{initOrderTrackingForm as y}from"../../models/validator/order-tracking/index.js";import{initRecoverPasswordForm as k}from"../../models/validator/recover-password/index.js";import{initRegisterForm as x}from"../../models/validator/register/index.js";import{initSmsLoginForm as C}from"../../models/validator/sms-login/index.js";import{initVerifyPhoneNumberForm as T}from"../../models/validator/verify-phone-number/index.js";var j="customerToken",L="customerTokenExpiry",P="customerEmailSubscription",F="lastViewedProducts",R="customerConsent";function O(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return Bt(e),Yt(e),te(e),[4,Vt(e)];case 1:return t.sent(),[4,Dt(e)];case 2:return t.sent(),e._initialized=!0,[4,yt(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(e,n){return t(this,arguments,void 0,function(t,e,n){var i,o;return void 0===n&&(n=[]),r(this,function(r){switch(r.label){case 0:if(Bt(t),Yt(t),te(t),!(null==e?void 0:e.customer)||!t._token)return[3,4];if(Mt(t,e.customer),t._favoriteProducts=e.favoriteProducts||[],t._isFavoriteProductsLoaded=!0,!(i=n.filter(function(t){return!(t in e.customer)})).length)return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,Dt(t)];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),console.error("[seedCustomerSession] snapshot lacks [".concat(i.join(", "),"] and the fallback fetch failed — ")+"keeping the partial customer:",o),[3,4];case 4:return t._initialized=!0,[2]}})})}function A(t){qt(t)}function U(t){return!!t.customer&&(!(p(t.customer)||d()||t._visitorSubscribedEmail)&&!window.localStorage.getItem(P))}function D(t){return e(e({},t.customer),{consentGranted:t._customerConsentGranted})}function M(e,n){return t(this,void 0,void 0,function(){var t,e,o;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 o=r.sent(),a.navigate(o.redirectUrl),[2]}})})}function V(e){return t(this,void 0,void 0,function(){var t,n,i,o,s;return r(this,function(r){switch(r.label){case 0:return t={status:"fail"},n=new URLSearchParams(window.location.search),i=n.get("socialLoginStatus"),o=n.get("socialLoginToken"),"success"===i&&o?[4,G(e,o)]:[3,2];case 1:return r.sent()?(t.status="success",[2,t]):[2,t];case 2:return s=n.get("socialLoginError"),t.message=s||void 0,[2,t]}})})}function G(e,n){return t(this,void 0,void 0,function(){var t,i,o;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===(o=t.data)||void 0===o?void 0:o.customer)?(Gt(e,t.data.token,t.data.tokenExpiry),Mt(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]}})})}var B="miles_smiles",W="MILES_SMILES",q="c8e4b1a0-5d3f-4a9e-8b2c-1f6d9e0a7c31",z="milesSmilesStatus",K="milesSmilesError";function X(t){try{return new URL(t).searchParams.get(K)}catch(t){return null}}function H(t){var e=function(t){try{return new URL(t).searchParams.get("redirectUrl")}catch(t){return null}}(t);if(!e)return window.location.href=t,Promise.resolve({isSuccess:!0});var r=function(t){try{return new URL(t).searchParams.get("transactionId")}catch(t){return null}}(e);return new Promise(function(n){var i,o=!1,s=function(t){o||(o=!0,window.removeEventListener("message",a),i&&window.clearInterval(i),n(t))},a=function(t){var n;try{n="string"==typeof t.data?JSON.parse(t.data):t.data}catch(t){return}if(n&&!0===n.isSuccess){var i={transactionId:r,token:n.token,memberId:n.ffid||n.memberId||n.memberID,shortTokenExpireMinute:n.tokenExpireMinute,longToken:n.longToken,longTokenExpireMinute:n.longTokenExpireMinute};if(!i.memberId||!i.token)return console.error("Miles&Smiles: missing token or memberId in popup message"),void s({isSuccess:!1,errorCode:"MILES_SMILES_LOGIN_CANCELLED_OR_FAILED"});!function(t,e){var r=document.createElement("form");r.method="POST",r.action=t,r.style.display="none";for(var n=0,i=[["transactionId",e.transactionId||""],["token",e.token||""],["memberId",e.memberId||""],["shortTokenExpireMinute",null!=e.shortTokenExpireMinute?String(e.shortTokenExpireMinute):""],["longToken",e.longToken||""],["longTokenExpireMinute",null!=e.longTokenExpireMinute?String(e.longTokenExpireMinute):""]];n<i.length;n++){var o=i[n],s=o[0],a=o[1],c=document.createElement("input");c.type="hidden",c.name=s,c.value=a,r.appendChild(c)}document.body.appendChild(r),r.submit()}(e,i);try{null==c||c.close()}catch(t){}s({isSuccess:!0})}};window.addEventListener("message",a);var c=window.open(t,"mslogin","width=480,height=720");if(!c)return window.removeEventListener("message",a),window.location.href=t,void n({isSuccess:!0});i=window.setInterval(function(){c.closed&&s({isSuccess:!1,errorCode:"MILES_SMILES_LOGIN_CANCELLED_OR_FAILED"})},500)})}function J(e,n){return t(this,void 0,void 0,function(){var t,o,s,a,c;return r(this,function(r){switch(r.label){case 0:if(d())return[2,{isSuccess:!1,errorCode:"UNEXPECTED_ERROR"}];if(!e.customer||!e._token)return[2,{isSuccess:!1,errorCode:"AUTHORIZATION_REQUIRED"}];t=function(t){return!!t&&t.startsWith("/")&&!t.startsWith("//")&&!t.includes("://")&&!t.includes("@")}(n)?n:"",o="".concat(import.meta.env.VITE_BASE_URL,"/ms/").concat(B,"/bind/authenticate?redirect=").concat(encodeURIComponent(t)),r.label=1;case 1:return r.trys.push([1,4,,5]),[4,fetch(o,{headers:{authorization:"Bearer ".concat(e._token),"x-api-key":i.apiKey||"","x-sfid":i.storefrontId||"","x-sfrid":i.storefrontRoutingId||""}})];case 2:return(a=r.sent()).redirected&&a.url?(window.location.href=a.url,[2,{isSuccess:!1,errorCode:X(a.url)}]):a.ok?[4,a.json()]:[2,{isSuccess:!1,errorCode:"UNEXPECTED_ERROR"}];case 3:return c=r.sent(),s=null==c?void 0:c.redirectUrl,[3,5];case 4:return r.sent(),[2,{isSuccess:!1,errorCode:"UNEXPECTED_ERROR"}];case 5:return s?[2,H(s)]:[2,{isSuccess:!1,errorCode:"UNEXPECTED_ERROR"}]}})})}function Y(t){if(void 0===t&&(t=!0),d())return null;var e=new URL(window.location.href),r=e.searchParams.get(z);if("success"!==r&&"fail"!==r)return null;var n=e.searchParams.get(K);return t&&(e.searchParams.delete(z),e.searchParams.delete(K),window.history.replaceState(window.history.state,"",e.pathname+e.search+e.hash)),{status:r,errorCode:n}}function Q(e){return t(this,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().apiGetExternalAccountLink)({provider:B})]}})})}function Z(e){return t(this,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().apiUnlinkExternalAccount)({provider:B})]}})})}function $(e){return t(this,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().apiGetMilesSmilesDetails)()]}})})}function tt(t){return t.paymentGatewayCode===W||t.paymentGatewayId===q}function et(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,vt(e,t)]):[2,!1];case 1:return[2,r.sent()]}})})}function rt(e,n,i){return t(this,void 0,void 0,function(){var t,e,o;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 o=r.sent(),console.error(o),[3,5];case 5:return[2,!1]}})})}function nt(e,n,i,o){return t(this,void 0,void 0,function(){var t,s;return r(this,function(r){switch(r.label){case 0:return[4,Xt(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:o,captchaToken:e._captchaToken})];case 3:return t=r.sent(),zt(e),t&&t.isSuccess&&t.data?(s=t.data,Gt(e,s.token,s.tokenExpiry),s.customer&&Mt(e,s.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 $t(e),[2,{isSuccess:!0,errorCodes:[],otpSend:s.otpSend,flowId:s.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 it(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return qt(e),m(u),[4,import("../../../analytics/analytics-functions/customerLogout.js")];case 1:return(0,t.sent().anl_customerLogout)(),[2]}})})}function ot(e,n,i,o,s,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,Xt(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiRegister)({email:o,password:s,firstName:n,lastName:i,isAcceptMarketing:a,attributes:c,captchaToken:e._captchaToken,phone:u,flowId:d})];case 3:return t=r.sent(),zt(e),t&&t.isSuccess&&(null===(l=t.data)||void 0===l?void 0:l.customer)?(Gt(e,t.data.token,t.data.tokenExpiry),Mt(e,t.data.customer),$t(e),[4,import("../../../analytics/analytics-functions/completeRegistration.js")]):[3,5];case 4:return(0,r.sent().anl_completeRegistration)(D(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 st(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,Xt(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(),zt(e),[2,i.isSuccess];case 4:return[2,!1]}})})}function at(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,Xt(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(),zt(e),[2,t.isSuccess];case 4:return[2,!1]}})})}function ct(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,Xt(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(),zt(e),[2,!(!t.isSuccess||!t.data)&&t.data];case 4:return[2,!1]}})})}function ut(n,i,o){return t(this,void 0,void 0,function(){var t,s,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:o,captchaToken:n._captchaToken})];case 2:return t=r.sent(),zt(n),t&&t.isSuccess&&(null===(s=t.data)||void 0===s?void 0:s.customer)?(Gt(n,t.data.token,t.data.tokenExpiry),Mt(n,t.data.customer),$t(n),[4,import("../../../analytics/analytics-functions/completeRegistration.js")]):[3,4];case 3:return(0,r.sent().anl_completeRegistration)(D(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({},D(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 dt(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 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,import("../../../analytics/analytics-functions/contactForm.js")];case 1:return(0,r.sent().anl_contactForm)(i),[4,Xt(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(),zt(n),[2,t.isSuccess]}})})}function mt(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,Xt(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(),zt(e),[2,!!t.isSuccess&&!!(null===(i=t.data)||void 0===i?void 0:i.exists)]}})})}function ft(e,n){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,Xt(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(),zt(e),[2,!!t.isSuccess&&t.data]}})})}function pt(e,n,i,o){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,Xt(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:o,captchaToken:e._captchaToken})];case 3:return t=r.sent(),zt(e),[2,t.isSuccess]}})})}function vt(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:ne(n)})];case 2:return(t=r.sent()).isSuccess&&t.data?(Mt(e,t.data),[2,!0]):[2,!1]}})})}function ht(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,Ft(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 _t(e,n){return t(this,void 0,void 0,function(){var o,s,a,c,u,d,l,m=this;return r(this,function(f){switch(f.label){case 0:return[4,Ft(e)];case 1:return f.sent(),e.customer?(o=n,!i.isPreview||o&&"orders"!==o?[3,3]:[4,ht(e)]):[2,null];case 2:(s=f.sent()).length&&(o=s[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:o})]}})}),Ut(e),St(e,{orderId:o})])];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 wt(e,n,i){return t(this,void 0,void 0,function(){var t,o,s,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?(o=t.data,[4,Promise.all([Ut(e),St(e,{orderId:o.id})])]):[2,null];case 3:return s=r.sent(),a=s[1],o.transactions=a,[2,o]}})})}function St(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 gt(e){return t(this,void 0,void 0,function(){var t,n,o,a,c;return r(this,function(r){switch(r.label){case 0:return[4,yt(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===(o=n.data)||void 0===o?void 0:o.data)||void 0===a||a.forEach(function(t){t.selectedVariantValues=t.variants[0].variantValues}),[2,s((null===(c=null==n?void 0:n.data)||void 0===c?void 0:c.data)||[])]}})})}function bt(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,yt(e,!0)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2,t.data||!1]}})})}function Et(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,yt(e,!0)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2,t.data||!1]}})})}function yt(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,Ft(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 kt(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 xt(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,Xt(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(P,"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 Ct(n,i){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,Xt(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(P,"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 Tt(n,o){return t(this,void 0,void 0,function(){var t,s,a,c,u;return r(this,function(r){switch(r.label){case 0:if(t=i.customerReviewSettings,s=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({},o),{customerId:t.customerLoginRequired?c:void 0,salesChannelId:s||"",locale:a})})];case 2:return[2,r.sent().data]}})})}function jt(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 Lt(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(d())return;t._customerConsentGranted=!0,window.localStorage.setItem(R,"true")}(t)}function Ft(e){return t(this,void 0,void 0,function(){return r(this,function(t){return d()||e._initialized?[2]:[2,new Promise(function(t){var r=setInterval(function(){e._initialized&&(clearInterval(r),t(null))},100)})]})})}function Rt(t){return new Promise(function(e){var r=setInterval(function(){t._captchaToken&&(clearInterval(r),e(null))},100)})}function Ot(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 Nt(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 At(e,n,i){return t(this,void 0,void 0,function(){var t,e,o,s,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(),(o=e.data)&&((s=document.createElement("a")).href=o,s.download=decodeURIComponent(i.name.split("/")[i.name.split("/").length-1])||"",s.click(),s.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 Ut(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 Dt(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&&Mt(e,t.data),[2]}})})}function Mt(t,e){t.customer=e}function Vt(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)Gt(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,qt(e)}return[2]}})})}function Gt(t,e,r){d()||(t._token=e,t._tokenExpiry=r,localStorage.setItem(j,e),localStorage.setItem(L,r+""),i.init({customerToken:e}),n.TOKEN=e)}function Bt(t){if(!d()){var e=localStorage.getItem(j),r=localStorage.getItem(L);e&&r?Gt(t,e,parseInt(r)):Wt(t)}}function Wt(t){localStorage.removeItem(j),localStorage.removeItem(L),t._token=null,t._tokenExpiry=null}function qt(t){Wt(t),t.customer=null,t._favoriteProducts=[],t._isFavoriteProductsLoaded=!1,i.init({customerToken:""}),n.TOKEN="",zt(t)}function zt(t){t._captchaToken=null}function Kt(t,e){t._captchaToken=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 r.trys.push([0,3,,4]),i.isCaptchaRequired()?(window.grecaptcha.execute(),[4,Rt(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 Ht(t,e){t._savedLastViewedProducts=l(t._lastViewedProducts),t._savedLastViewedProductsResponse=e}function Jt(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:Yt(e),r.label=4;case 4:return[2,e._lastViewedProducts]}})})}function Yt(t){d()||(t._lastViewedProducts=Qt(),t._lastViewedProducts=l(t._lastViewedProducts).reverse())}function Qt(){if(d())return[];try{var t=window.localStorage.getItem(F);if(t)return JSON.parse(t)}catch(t){console.error(t)}return[]}function Zt(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=Qt(),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(F,JSON.stringify(t._lastViewedProducts))}(e),t.label=4;case 4:return[2]}})})}function $t(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=Qt()).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(F)),r.label=4;case 4:return[3,6];case 5:return n=r.sent(),console.error(n),[3,6];case 6:return[2]}})})}function te(t){d()||(t._customerConsentGranted=!!window.localStorage.getItem(R))}function ee(t){return t._customerConsentGranted}function re(t){d()||window.localStorage.removeItem(R)}function ne(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 ie(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 oe(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return[4,Ft(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 se(e){return t(this,void 0,void 0,function(){var t,n,i,o,s,a,c;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),[4,Ft(e)];case 1:return r.sent(),t=null===(o=u.cart)||void 0===o?void 0:o.id,n=null===(c=null===(a=null===(s=u.cart)||void 0===s?void 0:s.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 ae(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return[4,Ft(e)];case 1:return r.sent(),le(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 ce(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 ue(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 de(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 le(t){return!!t.customer}function me(t){return t._accountInfoForm||(t._accountInfoForm={},_(t._accountInfoForm)),t._accountInfoForm}function fe(t){t._accountInfoForm=null}function pe(t){return t._contactForm||(t._contactForm={},w(t._contactForm)),t._contactForm}function ve(t){t._contactForm=null}function he(t){return t._couponCodeForm||(t._couponCodeForm={},S(t._couponCodeForm)),t._couponCodeForm}function _e(t){t._couponCodeForm=null}function we(t){return t._deactivateCustomerForm||(t._deactivateCustomerForm={},I(t._deactivateCustomerForm)),t._deactivateCustomerForm}function Se(t){t._deactivateCustomerForm=null}function Ie(t){return t._forgotPasswordForm||(t._forgotPasswordForm={},g(t._forgotPasswordForm)),t._forgotPasswordForm}function ge(t){t._forgotPasswordForm=null}function be(t){return t._loginForm||(t._loginForm={},b(t._loginForm)),t._loginForm}function Ee(t){return t._smsLoginForm||(t._smsLoginForm={},C(t._smsLoginForm)),t._smsLoginForm}function ye(t){return t._verifyPhoneNumberForm||(t._verifyPhoneNumberForm={},T(t._verifyPhoneNumberForm)),t._verifyPhoneNumberForm}function ke(t){t._loginForm=null}function xe(t){return t._newsletterSubscriptionForm||(t._newsletterSubscriptionForm={},E(t._newsletterSubscriptionForm)),t._newsletterSubscriptionForm}function Ce(t){t._newsletterSubscriptionForm=null}function Te(t){return t._orderTrackingForm||(t._orderTrackingForm={},y(t._orderTrackingForm)),t._orderTrackingForm}function je(t){t._orderTrackingForm=null}function Le(t){return t._recoverPasswordForm||(t._recoverPasswordForm={},k(t._recoverPasswordForm)),t._recoverPasswordForm}function Pe(t){t._recoverPasswordForm=null}function Fe(t){return t._registerForm||(t._registerForm={},x(t._registerForm)),t._registerForm}function Re(t){t._registerForm=null}function Oe(t){var e={};return v(e),o(e)}function Ne(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,ht(e)]);case 1:(n=r.sent()).length&&(t=n[0].id),r.label=2;case 2:return t?[4,_t(e,t)]:[3,4];case 3:return[2,r.sent()];case 4:return[2]}})})}function Ae(t){try{window.openIkasStorefrontWidget()}catch(t){console.error("Failed to open ikas storefront widget",t)}}function Ue(t){try{window.closeIkasStorefrontWidget()}catch(t){console.error("Failed to close ikas storefront widget",t)}}export{W as MILES_SMILES_PAYMENT_GATEWAY_CODE,q as MILES_SMILES_PAYMENT_GATEWAY_ID,B as MILES_SMILES_PROVIDER,st as activateCustomer,bt as addProductToFavorites,U as canCustomerCreateEmailSubscription,mt as checkEmail,fe as clearAccountInfoForm,ve as clearContactForm,_e as clearCouponCodeForm,A as clearCustomerSession,Se as clearDeactivateCustomerForm,ge as clearForgotPasswordForm,ke as clearLoginForm,Ce as clearNewsletterSubscriptionForm,je as clearOrderTrackingForm,Pe as clearRecoverPasswordForm,Re as clearRegisterForm,Ue as closeIkasStorefrontWidget,xt as createEmailSubscription,ae as cs_getLoyaltyCustomerInfo,ie as cs_listEarningMethods,ue as cs_listLoyaltyProgramPointHistory,ce as cs_listLoyaltyProgramTiers,oe as cs_listSpendingMethodsByCartId,se as cs_removeLoyaltyPointsFromCart,de as cs_useLoyaltyPoints,nt as customerLogin,Zt as customerStore_onProductView,D as customerToAnalyticsCustomer,jt as deactivateCustomer,et as deleteCustomerAddress,Lt as exportCustomerPersonalData,ft as forgotPassword,me as getAccountInfoForm,pe as getContactForm,he as getCouponCodeForm,Ot as getCustomerAttributes,ee as getCustomerConsentGranted,we as getDeactivateCustomerForm,At as getDigitalProductFileDownloadUrl,Oe as getEmptyAddressForm,gt as getFavoriteProducts,It as getFavoriteProductsIds,Ie as getForgotPasswordForm,Jt as getLastViewedProducts,be as getLoginForm,$ as getMilesSmilesDetails,Q as getMilesSmilesLink,xe as getNewsletterSubscriptionForm,_t as getOrder,wt as getOrderByEmail,Ne as getOrderDetailsOfPage,Nt as getOrderProductFiles,Ut as getOrderRefundSettings,Te as getOrderTrackingForm,St as getOrderTransactions,ht as getOrders,Le as getRecoverPasswordForm,Fe as getRegisterForm,Ee as getSmsLoginForm,ye as getVerifyPhoneNumberForm,Pt as handleCustomerConsentGrant,Y as handleMilesSmilesBind,V as handleSocialLogin,le as hasCustomer,O as initCustomerStore,kt as isFavoriteProduct,tt as isMilesSmilesTransaction,it as logout,J as milesSmilesBind,Ae as openIkasStorefrontWidget,pt as recoverPassword,rt as refundOrder,ot as register,re as removeCustomerConsent,Et as removeProductFromFavorites,at as resendCustomerActivationMail,dt as resendCustomerPhoneVerificationCode,lt as saveContactForm,vt as saveCustomer,Ct as saveCustomerFormData,N as seedCustomerSession,Tt as sendReview,Kt as setCaptchaToken,Ht as setSavedLastViewedProductsResponse,M as socialLogin,G as socialLoginToken,Z as unlinkMilesSmiles,ct as validateCustomerPhoneVerificationCode,ut as validateOTPCode,Rt as waitForCaptchaTokenInit,Ft as waitForCustomerStoreInit};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Analytics}from"./analytics/analytics.js";export{initIkasEvents}from"./analytics/events.js";export{EMPTY_STRING,NULL,UNDEFINED}from"./externals/index.js";export{apiListProductBrand}from"./functions/api/brand/index.js";export{apiListCategory}from"./functions/api/category/index.js";export{apiGetLoyaltyCustomerInfo,apiGetStorefrontWidgetSettings,apiListEarningMethods,apiListLoyaltyProgramPointHistory,apiListLoyaltyProgramTiers,apiListSpendingMethodsByCartId,apiRemoveLoyaltyPointsFromCart,apiUseLoyaltyPoints}from"./functions/api/loyalty/index.js";export{apiListStorefrontPopup}from"./functions/api/popup/index.js";export{apiSearchProducts}from"./functions/api/product/index.js";export{getAttributeDetailValues}from"./functions/models/attribute-detail/index.js";export{getAttributeListValues}from"./functions/models/attribute-list/index.js";export{createIkasBaseModel}from"./functions/models/base/index.js";export{getIkasBlogFormattedDate,getIkasBlogHref}from"./functions/models/blog/index.js";export{createIkasBlogCategory,getIkasBlogCategoryHref}from"./functions/models/blog/category/index.js";export{initIkasBlogCategory}from"./functions/models/blog/category/init.js";export{initIkasBlog}from"./functions/models/blog/init.js";export{getBlogCategoryListInitialData,getBlogCategoryListNextPage,getBlogCategoryListPage,getBlogCategoryListPageCount,getBlogCategoryListPrevPage,hasBlogCategoryListNextPage,hasBlogCategoryListPrevPage,isBlogCategoryListStatic}from"./functions/models/blog-category-list/index.js";export{initBlogCategoryList}from"./functions/models/blog-category-list/init.js";export{getBlogListInitialData,getBlogListNextPage,getBlogListPage,getBlogListPageCount,getBlogListPrevPage,hasBlogListNextPage,hasBlogListPrevPage,isBlogListStatic}from"./functions/models/blog-list/index.js";export{initBlogList}from"./functions/models/blog-list/init.js";export{getIkasBrandHref}from"./functions/models/brand/index.js";export{initIkasBrand}from"./functions/models/brand/init.js";export{getBrandListInitialData,getBrandListNextPage,getBrandListPage,getBrandListPageCount,getBrandListPrevPage,hasBrandListNextPage,hasBrandListPrevPage,isBrandListStatic}from"./functions/models/brand-list/index.js";export{initBrandList}from"./functions/models/brand-list/init.js";export{acceptProductOffer,isAcceptedProductOffer,rejectProductOffer}from"./functions/models/campaign-offer/index.js";export{getCategoryPath,getIkasCategoryHref}from"./functions/models/category/index.js";export{initIkasCategory}from"./functions/models/category/init.js";export{getCategoryListInitialData,getCategoryListNextPage,getCategoryListPage,getCategoryListPageCount,getCategoryListPrevPage,hasCategoryListNextPage,hasCategoryListPrevPage,isCategoryListStatic}from"./functions/models/category-list/index.js";export{initCategoryList}from"./functions/models/category-list/init.js";export{getIkasCategoryPathItemHref,getIkasCategoryPathItemSlug}from"./functions/models/category/path-item/index.js";export{initIkasCategoryPathItem}from"./functions/models/category/path-item/init.js";export{getCheckoutTotalFinalPrice,isCheckoutComplete}from"./functions/models/checkout/index.js";export{initIkasCountry}from"./functions/models/country/init.js";export{getCustomerBasicInfo,isCustomerSubscribed}from"./functions/models/customer/index.js";export{clearIkasCustomerAddressForm,getCustomerAddressText,getCustomerAddressValidationResult,getIkasCustomerAddressForm,isValidCustomerAddress}from"./functions/models/customer/address/index.js";export{getCustomerAttributeAccountPagePermission,getCustomerAttributeRegisterPageRequirement}from"./functions/models/customer/attribute/index.js";export{initIkasCustomerAttribute}from"./functions/models/customer/attribute/init.js";export{getIkasCustomerReviewFormattedDate}from"./functions/models/customer/review/index.js";export{initIkasCustomerReview}from"./functions/models/customer/review/init.js";export{getCustomerReviewListInitialData,getCustomerReviewListNextPage,getCustomerReviewListPage,getCustomerReviewListPageCount,getCustomerReviewListPrev,getProductCustomerReviews,hasCustomerReviewListNextPage,hasCustomerReviewListPrevPage}from"./functions/models/customer-review-list/index.js";export{initCustomerReviewList}from"./functions/models/customer-review-list/init.js";export{getCustomerReviewSummaryListInitialData,getCustomerReviewSummaryListNextPage,getCustomerReviewSummaryListPage,getCustomerReviewSummaryListPrev,hasCustomerReviewSummaryListNextPage,hasCustomerReviewSummaryListPrevPage}from"./functions/models/customer-review-summary-list/index.js";export{initCustomerReviewSummaryList}from"./functions/models/customer-review-summary-list/init.js";export{getIkasFilterCategoryHref,getIkasFilterCategorySlug}from"./functions/models/filter-category/index.js";export{initIkasHTMLMetaData,setHTMLMetaDataTranslations}from"./functions/models/html-meta-data/init.js";export{initThemeDatePicker,themeDatePickerGetDate,themeDatePickerGetDaysOfMonth,themeDatePickerGetDaysOfWeekShort,themeDatePickerGetFullYear,themeDatePickerGetHours,themeDatePickerGetMinutes,themeDatePickerGetMonth,themeDatePickerGetMonthList,themeDatePickerGetMonthName,themeDatePickerGetViewFullYear,themeDatePickerGetViewMonth,themeDatePickerGetWeekFirstDay,themeDatePickerOnChange,themeDatePickerOnDayChange,themeDatePickerOnHoursChange,themeDatePickerOnMinutesChange,themeDatePickerOnViewFullYearChange,themeDatePickerOnViewMonthChange,themeDatePickerSetViewNextMonth,themeDatePickerSetViewPrevMonth}from"./functions/models/ikas-theme/date-picker.js";export{createMediaSrcset,getDefaultSrc,getSrc,getThumbnailSrc}from"./functions/models/image/index.js";export{initIkasMerchantSettings}from"./functions/models/merchant-settings/init.js";export{getIkasOrderCouponAdjustment,getIkasOrderCustomerFullName,getIkasOrderDisplayedAdjustments,getIkasOrderDisplayedPackages,getIkasOrderDistinctItemCount,getIkasOrderFormattedDate,getIkasOrderFormattedOrderedAt,getIkasOrderFormattedShippingTotal,getIkasOrderFormattedTotalFinalPrice,getIkasOrderFormattedTotalPrice,getIkasOrderFormattedTotalTax,getIkasOrderGiftCardTotalPrice,getIkasOrderHref,getIkasOrderNonCouponAdjustments,getIkasOrderPackageStatusTranslation,getIkasOrderProductFiles,getIkasOrderRefundableItems,getIkasOrderRefundedItems,getIkasOrderShippingTotal,getIkasOrderTotalItemCount,getIkasOrderTotalTax,getIkasOrderUnfullfilledItems,getIkasOrderVariantNames,hasIkasOrderCustomer,hasValidIkasOrderCustomerEmail,initIkasOrder,isIkasOrderRefundable}from"./functions/models/order/index.js";export{createOrderAddress,getOrderAddressText,getOrderAddressValidationResult,isValidOrderAddress}from"./functions/models/order/address/index.js";export{getOrderAdjustmentDisplayName,getOrderAdjustmentFormattedAmount,getOrderAdjustmentIsDecrement}from"./functions/models/order/adjustment/index.js";export{getOrderGiftPackageLineFormattedPrice}from"./functions/models/order/gift-package/index.js";export{editOrderLineItem,getOrderLineItemFinalPriceWithQuantity,getOrderLineItemFormattedDiscountPrice,getOrderLineItemFormattedFinalPrice,getOrderLineItemFormattedFinalPriceWithQuantity,getOrderLineItemFormattedFinalUnitPrice,getOrderLineItemFormattedOverridenPriceWithQuantity,getOrderLineItemFormattedPrice,getOrderLineItemFormattedPriceWithQuantity,getOrderLineItemFormattedTax,getOrderLineItemFormattedUnitPrice,getOrderLineItemOverridenPriceWithQuantity,getOrderLineItemPriceWithQuantity,getOrderLineItemRefundQuantity,getOrderLineItemTax,getOrderLineItemUnitPriceText,hasOrderLineItemDiscount,setOrderLineItemRefundQuantity}from"./functions/models/order/line-item/index.js";export{downloadFile,getOrderLineItemOptionValueFormattedPrice,getOrderLineOptionFileName}from"./functions/models/order/line-item/option/value/index.js";export{getIkasOrderLineVariantHref,getIkasOrderLineVariantMainImage}from"./functions/models/order/line-item/variant/index.js";export{getIkasOrderLineBundleVariantMainImage}from"./functions/models/order/line-item/variant/bundle-product/bundle-variant/index.js";export{getIkasOrderLineVariantNameSlug,getIkasOrderLineVariantTypeSlug}from"./functions/models/order/line-item/variant/value/index.js";export{getOrderTransactionFormattedAmount,getOrderTransactionPaymentMethodTranslation}from"./functions/models/order/transaction/index.js";export{getPaymentGatewayCalculatedAdditionalPrices}from"./functions/models/payment-gateway/index.js";export{initIkasPaymentGateway}from"./functions/models/payment-gateway/init.js";export{addIkasProductToFavorites,clearIkasProductCustomerReviewForm,getBundleProductFinalPrice,getBundleProductFinalPriceWithQuantity,getBundleProductFormattedFinalPrice,getBundleProductFormattedFinalPriceWithQuantity,getBundleProductFormattedSellPrice,getBundleProductFormattedSellPriceWithQuantity,getBundleProductSellPrice,getBundleProductSellPriceWithQuantity,getBundleProductsOfVariant,getDisplayedProductGroups,getDisplayedProductVariantTypes,getGroupedAttributeValues,getIkasProductCustomerReviewForm,getMainProductVariantType,getMainProductVariantValue,getProductAvailableStockLocations,getProductCampaigns,getProductCategoryPath,getProductFirstCategory,getProductHref,getProductOptionSet,getSelectedProductVariant,getSelectedProductVariantHref,hasProductStock,hasProductValidOptionValues,hasProductVariant,initBundleProducts,initProductOnBrowser,initProductOptionSet,isAddToCartEnabled,isBundleProductQuantityEditable,isCustomerReviewEnabled,isCustomerReviewLoginRequired,isFavoriteIkasProduct,removeIkasProductFromFavorites,selectVariantValue,setBundleProductQuantity,setOptionRealPrices,setProductOfBundleProduct,shouldDisplayBundleProductPrice}from"./functions/models/product/index.js";export{getProductFromStore,initIkasProduct,initIkasProductExtraFields,productVariantStore}from"./functions/models/product/init.js";export{clearProductListFilter,clearProductListFilters,enableProductListSuggestions,getProductListCurrencyCode,getProductListCurrencySymbol,getProductListFilterCategories,getProductListInitialData,getProductListNextPage,getProductListPage,getProductListPrevPage,getProductListSortOptions,getProductListSortTypeTranslation,getProductListSuggestionHref,getSelectedFilterValues,handleFilterValueClick,handleNumberRangeOptionClick,hasProductListAppliedFilters,hasProductListFeaturedSortEnabled,hasProductListNextPage,hasProductListPrevPage,initProductList,initProductListFilterCategories,initProductListOnBrowser,isProductListDiscounted,isProductListFilterable,isProductListFiltered,isProductListLastViewed,isProductListPurchasedTogether,isProductListRecommended,isProductListRelatedProducts,isProductListSearch,isProductListStatic,isProductListViewedTogether,onFilterCategoryClick,productListToggleFilterCollapsed,searchProductList,setProductListIsFilteredForProducts,setProductListIsStaticForProducts,setProductListVisiblePage,setSortType,translateProductListSortType}from"./functions/models/product-list/index.js";export{getIkasProductAttributeProducts,getIkasProductAttributeTableValue,getIkasProductAttrributeProductIds}from"./functions/models/product/attribute-value/index.js";export{initIkasProductAttributeValue}from"./functions/models/product/attribute-value/init.js";export{applyQueryParamForFilter,clearFilter,filterParseRangeStr,filterRangeToId,filterToInput,getFilterDisplayedValues,getFilterKeyList,getFilterValueList,getIkasFilterHref,getIkasFilterThumbnailImage,initIkasProductFilter,isBoxFilter,isCustomValueFilter,isListFilter,isStockFilter,isSwatchFilter,onNumberRangeFilterChange,onNumberRangeFilterOptionClick,selectFilterValue}from"./functions/models/product/filter/index.js";export{getDisplayedOptions,hasDisplayedOptions,hasValidProductOptionSetValues,initOptionValues,initProductOptionSetValues,setChildOptions}from"./functions/models/product/option-set/index.js";export{initIkasProductOptionSet}from"./functions/models/product/option-set/init.js";export{clearValues,getDisplayedChildOptions,getProductOptionFormattedLabel,getProductOptionFormattedPrice,getTextValue,hasError,hasValidProductOptionValues,initIkasProductOptionValues,isCheckboxOption,isChecked,isChoiceOption,isChoiceOptionBoxType,isChoiceOptionSelectType,isChoiceOptionSwatchType,isColorPickerOption,isDatePickerOption,isFileOption,isImageOption,isProductOptionSelectValueSelected,isTextAreaOption,isTextOption,productOptionFileUpload,selectValue,setCheckboxValue,setTextValue,setValues}from"./functions/models/product/option-set/option/index.js";export{initIkasProductOption}from"./functions/models/product/option-set/option/init.js";export{clearProductVariantBackInStockForm,getGroupedAttributeValuesForVariant,getProductVariantAppliedCampaignAmount,getProductVariantB2bPriceRule,getProductVariantBackInStockForm,getProductVariantBundlePrice,getProductVariantCampaignOffersDiscountPercentage,getProductVariantCampaignPrice,getProductVariantDiscountAmount,getProductVariantDiscountPercentage,getProductVariantDiscountPrice,getProductVariantFinalPrice,getProductVariantFinalPriceWithCampaignOffers,getProductVariantFormattedBuyPrice,getProductVariantFormattedCampaignPrice,getProductVariantFormattedDiscountAmount,getProductVariantFormattedDiscountPrice,getProductVariantFormattedFinalPrice,getProductVariantFormattedFinalPriceWithCampaignOffers,getProductVariantFormattedSellPrice,getProductVariantFormattedSellPriceWithCampaignOffers,getProductVariantIsBackInStockCustomerLoginRequired,getProductVariantIsBackInStockEnabled,getProductVariantMainImage,getProductVariantPrice,getProductVariantSellPrice,getProductVariantSellPriceWithCampaignOffers,getProductVariantTieredDiscountProducts,getProductVariantUnitPriceText,hasBundleSettings,hasProductVariantDiscount,hasProductVariantStock,saveProductVariantBackInStockReminder}from"./functions/models/product/variant/index.js";export{initIkasProductVariant}from"./functions/models/product/variant/init.js";export{getIkasProductDiscountPercentage,getIkasProductPriceDiscountAmount,getIkasProductPriceFinalPrice,hasIkasProductPriceDiscount}from"./functions/models/product/variant/price/index.js";export{isRaffleAvailable}from"./functions/models/raffle/index.js";export{initIkasRaffle}from"./functions/models/raffle/init.js";export{initIkasState}from"./functions/models/state/init.js";export{getIkasVariantTypeSlug,isIkasVariantTypeColorSelection}from"./functions/models/variant-type/index.js";export{initIkasVariantType}from"./functions/models/variant-type/init.js";export{getIkasVariantValueSlug,getIkasVariantValueThumbnailImage,isColorVariantValue,isImageVariantValue,isTextVariantValue}from"./functions/models/variant-type/variant-value/index.js";export{FORM_ITEM_DEFAULT_VALUE,validateValue}from"./functions/models/validator/index.js";export{initAccountInfoForm,setAccountInfoFormFirstName,setAccountInfoFormIsMarketingAccepted,setAccountInfoFormLastName,setAccountInfoFormPhone,submitAccountInfoForm}from"./functions/models/validator/account-info/index.js";export{initAddressForm,setAddressFormAddressLine1,setAddressFormAddressLine2,setAddressFormCity,setAddressFormCompany,setAddressFormCountry,setAddressFormDistrict,setAddressFormFirstName,setAddressFormIdentityNumber,setAddressFormLastName,setAddressFormPhone,setAddressFormPostalCode,setAddressFormRegion,setAddressFormState,setAddressFormTaxNumber,setAddressFormTaxOffice,setAddressFormTitle,submitAddressForm}from"./functions/models/validator/address/index.js";export{initBackInStockNotificationForm,setBackInStockNotificationFormEmail,submitBackInStockNotificationForm}from"./functions/models/validator/back-in-stock-notification/index.js";export{initContactForm,setContactFormEmail,setContactFormFirstName,setContactFormLastName,setContactFormMessage,setContactFormPhone,submitContactForm}from"./functions/models/validator/contact-form/index.js";export{initCouponCodeForm,removeCouponCodeForm,setCouponCodeFormCouponCode,submitCouponCodeForm}from"./functions/models/validator/coupon-code-form/index.js";export{initCustomerReviewForm,setCustomerReviewFormComment,setCustomerReviewFormStar,setCustomerReviewFormTitle,submitCustomerReviewForm}from"./functions/models/validator/customer-review/index.js";export{initDeactivateCustomerForm,setDeactivateCustomerFormPassword,submitDeactivateCustomerForm}from"./functions/models/validator/deactivate-customer/index.js";export{initForgotPasswordForm,setForgotPasswordFormEmail,submitForgotPasswordForm}from"./functions/models/validator/forgot-password/index.js";export{initLoginForm,setLoginFormEmail,setLoginFormPassword,submitLoginForm}from"./functions/models/validator/login/index.js";export{initNewsletterSubscriptionForm,setNewsletterSubscriptionFormEmail,setNewsletterSubscriptionFormIsMarketingAccepted,submitNewsletterSubscriptionForm}from"./functions/models/validator/newsletter-subscription/index.js";export{initOrderTrackingForm,setOrderTrackingFormEmail,setOrderTrackingFormOrderNumber,submitOrderTrackingForm}from"./functions/models/validator/order-tracking/index.js";export{initRecoverPasswordForm,setRecoverPasswordFormPassword,setRecoverPasswordFormPasswordAgain,submitRecoverPasswordForm}from"./functions/models/validator/recover-password/index.js";export{initRegisterForm,setRegisterFormBooleanAttribute,setRegisterFormChoiceAttribute,setRegisterFormDateAttribute,setRegisterFormDateTimeAttribute,setRegisterFormEmail,setRegisterFormFirstName,setRegisterFormIsMarketingAccepted,setRegisterFormIsMembershipAgreementAccepted,setRegisterFormLastName,setRegisterFormMultipleChoiceAttribute,setRegisterFormNumericAttribute,setRegisterFormPassword,setRegisterFormPhone,setRegisterFormTextAttribute,submitRegisterForm}from"./functions/models/validator/register/index.js";export{initSmsLoginForm,resendSmsLoginFormCode,setSmsLoginFormCode,setSmsLoginFormEmail,setSmsLoginFormFirstName,setSmsLoginFormIsMarketingAccepted,setSmsLoginFormIsMembershipAgreementAccepted,setSmsLoginFormLastName,setSmsLoginFormPhone,submitSmsLoginForm}from"./functions/models/validator/sms-login/index.js";export{initVerifyPhoneNumberForm,resendVerifyPhoneNumberFormCode,setVerifyPhoneNumberFormCode,submitVerifyPhoneNumberForm}from"./functions/models/validator/verify-phone-number/index.js";export{collectionToArray}from"./functions/others/index.js";export{bs_searchProductById,bs_searchProductsById,initBaseStore,setLanguage,setLocalization}from"./functions/stores/base/index.js";export{addItemToCart,addSelectedtedVariantToCart,changeCartItemQuantity,changeItemQuantity,createPayWithIkasSession,findExistingCartItem,findExistingCartItemWithProduct,getAcceptedOffers,getCart,getCheckoutUrlFromCartStore,hasCart,isOrderLineItemAutoCreated,removeCart,removeCouponCode,removeGiftCardLine,removeItem,saveCouponCode,setCart,waitForCartStoreInit,windowAddToCart}from"./functions/stores/cart/index.js";export{activateCustomer,addProductToFavorites,canCustomerCreateEmailSubscription,checkEmail,clearAccountInfoForm,clearContactForm,clearCouponCodeForm,clearCustomerSession,clearDeactivateCustomerForm,clearForgotPasswordForm,clearLoginForm,clearNewsletterSubscriptionForm,clearOrderTrackingForm,clearRecoverPasswordForm,clearRegisterForm,closeIkasStorefrontWidget,createEmailSubscription,cs_getLoyaltyCustomerInfo,cs_listEarningMethods,cs_listLoyaltyProgramPointHistory,cs_listLoyaltyProgramTiers,cs_listSpendingMethodsByCartId,cs_removeLoyaltyPointsFromCart,cs_useLoyaltyPoints,customerLogin,customerStore_onProductView,customerToAnalyticsCustomer,deactivateCustomer,deleteCustomerAddress,exportCustomerPersonalData,forgotPassword,getAccountInfoForm,getContactForm,getCouponCodeForm,getCustomerAttributes,getCustomerConsentGranted,getDeactivateCustomerForm,getDigitalProductFileDownloadUrl,getEmptyAddressForm,getFavoriteProducts,getFavoriteProductsIds,getForgotPasswordForm,getLastViewedProducts,getLoginForm,getNewsletterSubscriptionForm,getOrder,getOrderByEmail,getOrderDetailsOfPage,getOrderProductFiles,getOrderRefundSettings,getOrderTrackingForm,getOrderTransactions,getOrders,getRecoverPasswordForm,getRegisterForm,getSmsLoginForm,getVerifyPhoneNumberForm,handleCustomerConsentGrant,handleSocialLogin,hasCustomer,initCustomerStore,isFavoriteProduct,logout,openIkasStorefrontWidget,recoverPassword,refundOrder,register,removeCustomerConsent,removeProductFromFavorites,resendCustomerActivationMail,resendCustomerPhoneVerificationCode,saveContactForm,saveCustomer,saveCustomerFormData,seedCustomerSession,sendReview,setCaptchaToken,setSavedLastViewedProductsResponse,socialLogin,socialLoginToken,validateCustomerPhoneVerificationCode,validateOTPCode,waitForCaptchaTokenInit,waitForCustomerStoreInit}from"./functions/stores/customer/index.js";export{I18n,i18n}from"./i18n/index.js";export{Router,router,withRoutePrefix}from"./router/index.js";export{baseStore}from"./stores/base/index.js";export{CART_LS_KEY,cartStore}from"./stores/cart/index.js";export{customerStore}from"./stores/customer/index.js";export{getThemeBreakpoints,getThemeColorSchemes,getThemeColors,getThemeKeyframes,getThemeSetting,getThemeSettingValue,getThemeSettings,getThemeTypography,registerThemeSettingValues}from"./theme/settings/index.js";export{DYNAMIC_STYLE_PROPERTIES,SIZE_PROPERTIES,getFormattedBorder,getFormattedBorderRadiusBottomLeftSize,getFormattedBorderRadiusBottomRightSize,getFormattedBorderRadiusSize,getFormattedBorderRadiusTopLeftSize,getFormattedBorderRadiusTopRightSize,getFormattedBorderWidthSizeSize,getFormattedBottomSize,getFormattedFontSize,getFormattedGapSize,getFormattedGridTemplateColumns,getFormattedHeightSize,getFormattedLeftSize,getFormattedLetterSpacingSize,getFormattedLineHeightSize,getFormattedMarginBottomSize,getFormattedMarginLeftSize,getFormattedMarginRightSize,getFormattedMarginTopSize,getFormattedMaxHeightSize,getFormattedMaxWidthSize,getFormattedMinHeightSize,getFormattedMinWidthSize,getFormattedPaddingBottomSize,getFormattedPaddingLeftSize,getFormattedPaddingMarginSize,getFormattedPaddingRightSize,getFormattedPaddingSize,getFormattedPaddingTopSize,getFormattedRightSize,getFormattedShadow,getFormattedSize,getFormattedStyleVariable,getFormattedTopSize,getFormattedWidthSize}from"./theme/styles/index.js";export{isBrowser,isDefined,isEmpty,isNotEmpty}from"./utils/blueprint.js";export{IkasComponentRenderer}from"./utils/component-renderer.js";export{formatCurrency}from"./utils/currency.js";export{HttpMethod,get,httpRequest,post}from"./utils/fetch.js";export{JsObject}from"./utils/object-wrapper.js";export{PayWithIkas}from"./utils/pay-with-ikas.js";export{normalizeSvg}from"./utils/svg.js";export{setAPIClientConfig}from"./packages/storefront-api/src/index.js";export{IkasStorefrontConfig,escapeForJSON,unescapeFromJSON}from"./packages/storefront-config/src/index.js";import"./packages/storefront-models/src/models/merchant-settings/index.js";export{default as IkasAPIClientConfig}from"./packages/storefront-api-client/src/config/index.js";export{anl_addToCart}from"./analytics/analytics-functions/addToCart.js";export{anl_addToWishlist}from"./analytics/analytics-functions/addToWishlist.js";export{anl_completeRegistration}from"./analytics/analytics-functions/completeRegistration.js";export{anl_contactForm}from"./analytics/analytics-functions/contactForm.js";export{anl_createEmailSubscription}from"./analytics/analytics-functions/createEmailSubscription.js";export{anl_customerLogin}from"./analytics/analytics-functions/customerLogin.js";export{anl_customerLogout}from"./analytics/analytics-functions/customerLogout.js";export{anl_customerVisit}from"./analytics/analytics-functions/customerVisit.js";export{anl_pageView}from"./analytics/analytics-functions/pageView.js";export{anl_productView}from"./analytics/analytics-functions/productView.js";export{anl_removeFromCart}from"./analytics/analytics-functions/removeFromCart.js";export{anl_search}from"./analytics/analytics-functions/search.js";export{anl_viewBrand}from"./analytics/analytics-functions/viewBrand.js";export{anl_viewCart}from"./analytics/analytics-functions/viewCart.js";export{anl_viewCategory}from"./analytics/analytics-functions/viewCategory.js";export{anl_viewListing}from"./analytics/analytics-functions/viewListing.js";export{anl_viewSearchResults}from"./analytics/analytics-functions/viewSearchResults.js";export{anl_viewStorefrontPopup}from"./analytics/analytics-functions/viewStorefrontPopup.js";import*as e from'./ext/animejs/lib/anime.esm.js';export{e as AnimeJS};export{cloneDeep,reaction}from"./utils/helper.js";export{APIErrorCode,APIResponse}from"./packages/storefront-api-client/src/utils/api.js";export{EMPTY_THEME_GLOBALS,breakpointCssToken,cssVarCamelCase,cssVarRef,isReservedVariableId,rawClassRef,resolveBreakpointMediaTokens,serializeThemeGlobals,toResolverBreakpoints}from"./packages/storefront-config/src/theme-globals.js";
|
|
1
|
+
export{Analytics}from"./analytics/analytics.js";export{initIkasEvents}from"./analytics/events.js";export{EMPTY_STRING,NULL,UNDEFINED}from"./externals/index.js";export{apiListProductBrand}from"./functions/api/brand/index.js";export{apiListCategory}from"./functions/api/category/index.js";export{apiGetLoyaltyCustomerInfo,apiGetStorefrontWidgetSettings,apiListEarningMethods,apiListLoyaltyProgramPointHistory,apiListLoyaltyProgramTiers,apiListSpendingMethodsByCartId,apiRemoveLoyaltyPointsFromCart,apiUseLoyaltyPoints}from"./functions/api/loyalty/index.js";export{apiListStorefrontPopup}from"./functions/api/popup/index.js";export{apiSearchProducts}from"./functions/api/product/index.js";export{getAttributeDetailValues}from"./functions/models/attribute-detail/index.js";export{getAttributeListValues}from"./functions/models/attribute-list/index.js";export{createIkasBaseModel}from"./functions/models/base/index.js";export{getIkasBlogFormattedDate,getIkasBlogHref}from"./functions/models/blog/index.js";export{createIkasBlogCategory,getIkasBlogCategoryHref}from"./functions/models/blog/category/index.js";export{initIkasBlogCategory}from"./functions/models/blog/category/init.js";export{initIkasBlog}from"./functions/models/blog/init.js";export{getBlogCategoryListInitialData,getBlogCategoryListNextPage,getBlogCategoryListPage,getBlogCategoryListPageCount,getBlogCategoryListPrevPage,hasBlogCategoryListNextPage,hasBlogCategoryListPrevPage,isBlogCategoryListStatic}from"./functions/models/blog-category-list/index.js";export{initBlogCategoryList}from"./functions/models/blog-category-list/init.js";export{getBlogListInitialData,getBlogListNextPage,getBlogListPage,getBlogListPageCount,getBlogListPrevPage,hasBlogListNextPage,hasBlogListPrevPage,isBlogListStatic}from"./functions/models/blog-list/index.js";export{initBlogList}from"./functions/models/blog-list/init.js";export{getIkasBrandHref}from"./functions/models/brand/index.js";export{initIkasBrand}from"./functions/models/brand/init.js";export{getBrandListInitialData,getBrandListNextPage,getBrandListPage,getBrandListPageCount,getBrandListPrevPage,hasBrandListNextPage,hasBrandListPrevPage,isBrandListStatic}from"./functions/models/brand-list/index.js";export{initBrandList}from"./functions/models/brand-list/init.js";export{acceptProductOffer,isAcceptedProductOffer,rejectProductOffer}from"./functions/models/campaign-offer/index.js";export{getCategoryPath,getIkasCategoryHref}from"./functions/models/category/index.js";export{initIkasCategory}from"./functions/models/category/init.js";export{getCategoryListInitialData,getCategoryListNextPage,getCategoryListPage,getCategoryListPageCount,getCategoryListPrevPage,hasCategoryListNextPage,hasCategoryListPrevPage,isCategoryListStatic}from"./functions/models/category-list/index.js";export{initCategoryList}from"./functions/models/category-list/init.js";export{getIkasCategoryPathItemHref,getIkasCategoryPathItemSlug}from"./functions/models/category/path-item/index.js";export{initIkasCategoryPathItem}from"./functions/models/category/path-item/init.js";export{getCheckoutTotalFinalPrice,isCheckoutComplete}from"./functions/models/checkout/index.js";export{initIkasCountry}from"./functions/models/country/init.js";export{getCustomerBasicInfo,isCustomerSubscribed}from"./functions/models/customer/index.js";export{clearIkasCustomerAddressForm,getCustomerAddressText,getCustomerAddressValidationResult,getIkasCustomerAddressForm,isValidCustomerAddress}from"./functions/models/customer/address/index.js";export{getCustomerAttributeAccountPagePermission,getCustomerAttributeRegisterPageRequirement}from"./functions/models/customer/attribute/index.js";export{initIkasCustomerAttribute}from"./functions/models/customer/attribute/init.js";export{getIkasCustomerReviewFormattedDate}from"./functions/models/customer/review/index.js";export{initIkasCustomerReview}from"./functions/models/customer/review/init.js";export{getCustomerReviewListInitialData,getCustomerReviewListNextPage,getCustomerReviewListPage,getCustomerReviewListPageCount,getCustomerReviewListPrev,getProductCustomerReviews,hasCustomerReviewListNextPage,hasCustomerReviewListPrevPage}from"./functions/models/customer-review-list/index.js";export{initCustomerReviewList}from"./functions/models/customer-review-list/init.js";export{getCustomerReviewSummaryListInitialData,getCustomerReviewSummaryListNextPage,getCustomerReviewSummaryListPage,getCustomerReviewSummaryListPrev,hasCustomerReviewSummaryListNextPage,hasCustomerReviewSummaryListPrevPage}from"./functions/models/customer-review-summary-list/index.js";export{initCustomerReviewSummaryList}from"./functions/models/customer-review-summary-list/init.js";export{getIkasFilterCategoryHref,getIkasFilterCategorySlug}from"./functions/models/filter-category/index.js";export{initIkasHTMLMetaData,setHTMLMetaDataTranslations}from"./functions/models/html-meta-data/init.js";export{initThemeDatePicker,themeDatePickerGetDate,themeDatePickerGetDaysOfMonth,themeDatePickerGetDaysOfWeekShort,themeDatePickerGetFullYear,themeDatePickerGetHours,themeDatePickerGetMinutes,themeDatePickerGetMonth,themeDatePickerGetMonthList,themeDatePickerGetMonthName,themeDatePickerGetViewFullYear,themeDatePickerGetViewMonth,themeDatePickerGetWeekFirstDay,themeDatePickerOnChange,themeDatePickerOnDayChange,themeDatePickerOnHoursChange,themeDatePickerOnMinutesChange,themeDatePickerOnViewFullYearChange,themeDatePickerOnViewMonthChange,themeDatePickerSetViewNextMonth,themeDatePickerSetViewPrevMonth}from"./functions/models/ikas-theme/date-picker.js";export{createMediaSrcset,getDefaultSrc,getSrc,getThumbnailSrc}from"./functions/models/image/index.js";export{initIkasMerchantSettings}from"./functions/models/merchant-settings/init.js";export{getIkasOrderCouponAdjustment,getIkasOrderCustomerFullName,getIkasOrderDisplayedAdjustments,getIkasOrderDisplayedPackages,getIkasOrderDistinctItemCount,getIkasOrderFormattedDate,getIkasOrderFormattedOrderedAt,getIkasOrderFormattedShippingTotal,getIkasOrderFormattedTotalFinalPrice,getIkasOrderFormattedTotalPrice,getIkasOrderFormattedTotalTax,getIkasOrderGiftCardTotalPrice,getIkasOrderHref,getIkasOrderNonCouponAdjustments,getIkasOrderPackageStatusTranslation,getIkasOrderProductFiles,getIkasOrderRefundableItems,getIkasOrderRefundedItems,getIkasOrderShippingTotal,getIkasOrderTotalItemCount,getIkasOrderTotalTax,getIkasOrderUnfullfilledItems,getIkasOrderVariantNames,hasIkasOrderCustomer,hasValidIkasOrderCustomerEmail,initIkasOrder,isIkasOrderRefundable}from"./functions/models/order/index.js";export{createOrderAddress,getOrderAddressText,getOrderAddressValidationResult,isValidOrderAddress}from"./functions/models/order/address/index.js";export{getOrderAdjustmentDisplayName,getOrderAdjustmentFormattedAmount,getOrderAdjustmentIsDecrement}from"./functions/models/order/adjustment/index.js";export{getOrderGiftPackageLineFormattedPrice}from"./functions/models/order/gift-package/index.js";export{editOrderLineItem,getOrderLineItemFinalPriceWithQuantity,getOrderLineItemFormattedDiscountPrice,getOrderLineItemFormattedFinalPrice,getOrderLineItemFormattedFinalPriceWithQuantity,getOrderLineItemFormattedFinalUnitPrice,getOrderLineItemFormattedOverridenPriceWithQuantity,getOrderLineItemFormattedPrice,getOrderLineItemFormattedPriceWithQuantity,getOrderLineItemFormattedTax,getOrderLineItemFormattedUnitPrice,getOrderLineItemOverridenPriceWithQuantity,getOrderLineItemPriceWithQuantity,getOrderLineItemRefundQuantity,getOrderLineItemTax,getOrderLineItemUnitPriceText,hasOrderLineItemDiscount,setOrderLineItemRefundQuantity}from"./functions/models/order/line-item/index.js";export{downloadFile,getOrderLineItemOptionValueFormattedPrice,getOrderLineOptionFileName}from"./functions/models/order/line-item/option/value/index.js";export{getIkasOrderLineVariantHref,getIkasOrderLineVariantMainImage}from"./functions/models/order/line-item/variant/index.js";export{getIkasOrderLineBundleVariantMainImage}from"./functions/models/order/line-item/variant/bundle-product/bundle-variant/index.js";export{getIkasOrderLineVariantNameSlug,getIkasOrderLineVariantTypeSlug}from"./functions/models/order/line-item/variant/value/index.js";export{getOrderTransactionFormattedAmount,getOrderTransactionPaymentMethodTranslation}from"./functions/models/order/transaction/index.js";export{getPaymentGatewayCalculatedAdditionalPrices}from"./functions/models/payment-gateway/index.js";export{initIkasPaymentGateway}from"./functions/models/payment-gateway/init.js";export{addIkasProductToFavorites,clearIkasProductCustomerReviewForm,getBundleProductFinalPrice,getBundleProductFinalPriceWithQuantity,getBundleProductFormattedFinalPrice,getBundleProductFormattedFinalPriceWithQuantity,getBundleProductFormattedSellPrice,getBundleProductFormattedSellPriceWithQuantity,getBundleProductSellPrice,getBundleProductSellPriceWithQuantity,getBundleProductsOfVariant,getDisplayedProductGroups,getDisplayedProductVariantTypes,getGroupedAttributeValues,getIkasProductCustomerReviewForm,getMainProductVariantType,getMainProductVariantValue,getProductAvailableStockLocations,getProductCampaigns,getProductCategoryPath,getProductFirstCategory,getProductHref,getProductOptionSet,getSelectedProductVariant,getSelectedProductVariantHref,hasProductStock,hasProductValidOptionValues,hasProductVariant,initBundleProducts,initProductOnBrowser,initProductOptionSet,isAddToCartEnabled,isBundleProductQuantityEditable,isCustomerReviewEnabled,isCustomerReviewLoginRequired,isFavoriteIkasProduct,removeIkasProductFromFavorites,selectVariantValue,setBundleProductQuantity,setOptionRealPrices,setProductOfBundleProduct,shouldDisplayBundleProductPrice}from"./functions/models/product/index.js";export{getProductFromStore,initIkasProduct,initIkasProductExtraFields,productVariantStore}from"./functions/models/product/init.js";export{clearProductListFilter,clearProductListFilters,enableProductListSuggestions,getProductListCurrencyCode,getProductListCurrencySymbol,getProductListFilterCategories,getProductListInitialData,getProductListNextPage,getProductListPage,getProductListPrevPage,getProductListSortOptions,getProductListSortTypeTranslation,getProductListSuggestionHref,getSelectedFilterValues,handleFilterValueClick,handleNumberRangeOptionClick,hasProductListAppliedFilters,hasProductListFeaturedSortEnabled,hasProductListNextPage,hasProductListPrevPage,initProductList,initProductListFilterCategories,initProductListOnBrowser,isProductListDiscounted,isProductListFilterable,isProductListFiltered,isProductListLastViewed,isProductListPurchasedTogether,isProductListRecommended,isProductListRelatedProducts,isProductListSearch,isProductListStatic,isProductListViewedTogether,onFilterCategoryClick,productListToggleFilterCollapsed,searchProductList,setProductListIsFilteredForProducts,setProductListIsStaticForProducts,setProductListVisiblePage,setSortType,translateProductListSortType}from"./functions/models/product-list/index.js";export{getIkasProductAttributeProducts,getIkasProductAttributeTableValue,getIkasProductAttrributeProductIds}from"./functions/models/product/attribute-value/index.js";export{initIkasProductAttributeValue}from"./functions/models/product/attribute-value/init.js";export{applyQueryParamForFilter,clearFilter,filterParseRangeStr,filterRangeToId,filterToInput,getFilterDisplayedValues,getFilterKeyList,getFilterValueList,getIkasFilterHref,getIkasFilterThumbnailImage,initIkasProductFilter,isBoxFilter,isCustomValueFilter,isListFilter,isStockFilter,isSwatchFilter,onNumberRangeFilterChange,onNumberRangeFilterOptionClick,selectFilterValue}from"./functions/models/product/filter/index.js";export{getDisplayedOptions,hasDisplayedOptions,hasValidProductOptionSetValues,initOptionValues,initProductOptionSetValues,setChildOptions}from"./functions/models/product/option-set/index.js";export{initIkasProductOptionSet}from"./functions/models/product/option-set/init.js";export{clearValues,getDisplayedChildOptions,getProductOptionFormattedLabel,getProductOptionFormattedPrice,getTextValue,hasError,hasValidProductOptionValues,initIkasProductOptionValues,isCheckboxOption,isChecked,isChoiceOption,isChoiceOptionBoxType,isChoiceOptionSelectType,isChoiceOptionSwatchType,isColorPickerOption,isDatePickerOption,isFileOption,isImageOption,isProductOptionSelectValueSelected,isTextAreaOption,isTextOption,productOptionFileUpload,selectValue,setCheckboxValue,setTextValue,setValues}from"./functions/models/product/option-set/option/index.js";export{initIkasProductOption}from"./functions/models/product/option-set/option/init.js";export{clearProductVariantBackInStockForm,getGroupedAttributeValuesForVariant,getProductVariantAppliedCampaignAmount,getProductVariantB2bPriceRule,getProductVariantBackInStockForm,getProductVariantBundlePrice,getProductVariantCampaignOffersDiscountPercentage,getProductVariantCampaignPrice,getProductVariantDiscountAmount,getProductVariantDiscountPercentage,getProductVariantDiscountPrice,getProductVariantFinalPrice,getProductVariantFinalPriceWithCampaignOffers,getProductVariantFormattedBuyPrice,getProductVariantFormattedCampaignPrice,getProductVariantFormattedDiscountAmount,getProductVariantFormattedDiscountPrice,getProductVariantFormattedFinalPrice,getProductVariantFormattedFinalPriceWithCampaignOffers,getProductVariantFormattedSellPrice,getProductVariantFormattedSellPriceWithCampaignOffers,getProductVariantIsBackInStockCustomerLoginRequired,getProductVariantIsBackInStockEnabled,getProductVariantMainImage,getProductVariantPrice,getProductVariantSellPrice,getProductVariantSellPriceWithCampaignOffers,getProductVariantTieredDiscountProducts,getProductVariantUnitPriceText,hasBundleSettings,hasProductVariantDiscount,hasProductVariantStock,saveProductVariantBackInStockReminder}from"./functions/models/product/variant/index.js";export{initIkasProductVariant}from"./functions/models/product/variant/init.js";export{getIkasProductDiscountPercentage,getIkasProductPriceDiscountAmount,getIkasProductPriceFinalPrice,hasIkasProductPriceDiscount}from"./functions/models/product/variant/price/index.js";export{isRaffleAvailable}from"./functions/models/raffle/index.js";export{initIkasRaffle}from"./functions/models/raffle/init.js";export{initIkasState}from"./functions/models/state/init.js";export{getIkasVariantTypeSlug,isIkasVariantTypeColorSelection}from"./functions/models/variant-type/index.js";export{initIkasVariantType}from"./functions/models/variant-type/init.js";export{getIkasVariantValueSlug,getIkasVariantValueThumbnailImage,isColorVariantValue,isImageVariantValue,isTextVariantValue}from"./functions/models/variant-type/variant-value/index.js";export{FORM_ITEM_DEFAULT_VALUE,validateValue}from"./functions/models/validator/index.js";export{initAccountInfoForm,setAccountInfoFormFirstName,setAccountInfoFormIsMarketingAccepted,setAccountInfoFormLastName,setAccountInfoFormPhone,submitAccountInfoForm}from"./functions/models/validator/account-info/index.js";export{initAddressForm,setAddressFormAddressLine1,setAddressFormAddressLine2,setAddressFormCity,setAddressFormCompany,setAddressFormCountry,setAddressFormDistrict,setAddressFormFirstName,setAddressFormIdentityNumber,setAddressFormLastName,setAddressFormPhone,setAddressFormPostalCode,setAddressFormRegion,setAddressFormState,setAddressFormTaxNumber,setAddressFormTaxOffice,setAddressFormTitle,submitAddressForm}from"./functions/models/validator/address/index.js";export{initBackInStockNotificationForm,setBackInStockNotificationFormEmail,submitBackInStockNotificationForm}from"./functions/models/validator/back-in-stock-notification/index.js";export{initContactForm,setContactFormEmail,setContactFormFirstName,setContactFormLastName,setContactFormMessage,setContactFormPhone,submitContactForm}from"./functions/models/validator/contact-form/index.js";export{initCouponCodeForm,removeCouponCodeForm,setCouponCodeFormCouponCode,submitCouponCodeForm}from"./functions/models/validator/coupon-code-form/index.js";export{initCustomerReviewForm,setCustomerReviewFormComment,setCustomerReviewFormStar,setCustomerReviewFormTitle,submitCustomerReviewForm}from"./functions/models/validator/customer-review/index.js";export{initDeactivateCustomerForm,setDeactivateCustomerFormPassword,submitDeactivateCustomerForm}from"./functions/models/validator/deactivate-customer/index.js";export{initForgotPasswordForm,setForgotPasswordFormEmail,submitForgotPasswordForm}from"./functions/models/validator/forgot-password/index.js";export{initLoginForm,setLoginFormEmail,setLoginFormPassword,submitLoginForm}from"./functions/models/validator/login/index.js";export{initNewsletterSubscriptionForm,setNewsletterSubscriptionFormEmail,setNewsletterSubscriptionFormIsMarketingAccepted,submitNewsletterSubscriptionForm}from"./functions/models/validator/newsletter-subscription/index.js";export{initOrderTrackingForm,setOrderTrackingFormEmail,setOrderTrackingFormOrderNumber,submitOrderTrackingForm}from"./functions/models/validator/order-tracking/index.js";export{initRecoverPasswordForm,setRecoverPasswordFormPassword,setRecoverPasswordFormPasswordAgain,submitRecoverPasswordForm}from"./functions/models/validator/recover-password/index.js";export{initRegisterForm,setRegisterFormBooleanAttribute,setRegisterFormChoiceAttribute,setRegisterFormDateAttribute,setRegisterFormDateTimeAttribute,setRegisterFormEmail,setRegisterFormFirstName,setRegisterFormIsMarketingAccepted,setRegisterFormIsMembershipAgreementAccepted,setRegisterFormLastName,setRegisterFormMultipleChoiceAttribute,setRegisterFormNumericAttribute,setRegisterFormPassword,setRegisterFormPhone,setRegisterFormTextAttribute,submitRegisterForm}from"./functions/models/validator/register/index.js";export{initSmsLoginForm,resendSmsLoginFormCode,setSmsLoginFormCode,setSmsLoginFormEmail,setSmsLoginFormFirstName,setSmsLoginFormIsMarketingAccepted,setSmsLoginFormIsMembershipAgreementAccepted,setSmsLoginFormLastName,setSmsLoginFormPhone,submitSmsLoginForm}from"./functions/models/validator/sms-login/index.js";export{initVerifyPhoneNumberForm,resendVerifyPhoneNumberFormCode,setVerifyPhoneNumberFormCode,submitVerifyPhoneNumberForm}from"./functions/models/validator/verify-phone-number/index.js";export{collectionToArray}from"./functions/others/index.js";export{bs_searchProductById,bs_searchProductsById,initBaseStore,setLanguage,setLocalization}from"./functions/stores/base/index.js";export{addItemToCart,addSelectedtedVariantToCart,changeCartItemQuantity,changeItemQuantity,createPayWithIkasSession,findExistingCartItem,findExistingCartItemWithProduct,getAcceptedOffers,getCart,getCheckoutUrlFromCartStore,hasCart,isOrderLineItemAutoCreated,removeCart,removeCouponCode,removeGiftCardLine,removeItem,saveCouponCode,setCart,waitForCartStoreInit,windowAddToCart}from"./functions/stores/cart/index.js";export{MILES_SMILES_PAYMENT_GATEWAY_CODE,MILES_SMILES_PAYMENT_GATEWAY_ID,MILES_SMILES_PROVIDER,activateCustomer,addProductToFavorites,canCustomerCreateEmailSubscription,checkEmail,clearAccountInfoForm,clearContactForm,clearCouponCodeForm,clearCustomerSession,clearDeactivateCustomerForm,clearForgotPasswordForm,clearLoginForm,clearNewsletterSubscriptionForm,clearOrderTrackingForm,clearRecoverPasswordForm,clearRegisterForm,closeIkasStorefrontWidget,createEmailSubscription,cs_getLoyaltyCustomerInfo,cs_listEarningMethods,cs_listLoyaltyProgramPointHistory,cs_listLoyaltyProgramTiers,cs_listSpendingMethodsByCartId,cs_removeLoyaltyPointsFromCart,cs_useLoyaltyPoints,customerLogin,customerStore_onProductView,customerToAnalyticsCustomer,deactivateCustomer,deleteCustomerAddress,exportCustomerPersonalData,forgotPassword,getAccountInfoForm,getContactForm,getCouponCodeForm,getCustomerAttributes,getCustomerConsentGranted,getDeactivateCustomerForm,getDigitalProductFileDownloadUrl,getEmptyAddressForm,getFavoriteProducts,getFavoriteProductsIds,getForgotPasswordForm,getLastViewedProducts,getLoginForm,getMilesSmilesDetails,getMilesSmilesLink,getNewsletterSubscriptionForm,getOrder,getOrderByEmail,getOrderDetailsOfPage,getOrderProductFiles,getOrderRefundSettings,getOrderTrackingForm,getOrderTransactions,getOrders,getRecoverPasswordForm,getRegisterForm,getSmsLoginForm,getVerifyPhoneNumberForm,handleCustomerConsentGrant,handleMilesSmilesBind,handleSocialLogin,hasCustomer,initCustomerStore,isFavoriteProduct,isMilesSmilesTransaction,logout,milesSmilesBind,openIkasStorefrontWidget,recoverPassword,refundOrder,register,removeCustomerConsent,removeProductFromFavorites,resendCustomerActivationMail,resendCustomerPhoneVerificationCode,saveContactForm,saveCustomer,saveCustomerFormData,seedCustomerSession,sendReview,setCaptchaToken,setSavedLastViewedProductsResponse,socialLogin,socialLoginToken,unlinkMilesSmiles,validateCustomerPhoneVerificationCode,validateOTPCode,waitForCaptchaTokenInit,waitForCustomerStoreInit}from"./functions/stores/customer/index.js";export{I18n,i18n}from"./i18n/index.js";export{Router,router,withRoutePrefix}from"./router/index.js";export{baseStore}from"./stores/base/index.js";export{CART_LS_KEY,cartStore}from"./stores/cart/index.js";export{customerStore}from"./stores/customer/index.js";export{getThemeBreakpoints,getThemeColorSchemes,getThemeColors,getThemeKeyframes,getThemeSetting,getThemeSettingValue,getThemeSettings,getThemeTypography,registerThemeSettingValues}from"./theme/settings/index.js";export{DYNAMIC_STYLE_PROPERTIES,SIZE_PROPERTIES,getFormattedBorder,getFormattedBorderRadiusBottomLeftSize,getFormattedBorderRadiusBottomRightSize,getFormattedBorderRadiusSize,getFormattedBorderRadiusTopLeftSize,getFormattedBorderRadiusTopRightSize,getFormattedBorderWidthSizeSize,getFormattedBottomSize,getFormattedFontSize,getFormattedGapSize,getFormattedGridTemplateColumns,getFormattedHeightSize,getFormattedLeftSize,getFormattedLetterSpacingSize,getFormattedLineHeightSize,getFormattedMarginBottomSize,getFormattedMarginLeftSize,getFormattedMarginRightSize,getFormattedMarginTopSize,getFormattedMaxHeightSize,getFormattedMaxWidthSize,getFormattedMinHeightSize,getFormattedMinWidthSize,getFormattedPaddingBottomSize,getFormattedPaddingLeftSize,getFormattedPaddingMarginSize,getFormattedPaddingRightSize,getFormattedPaddingSize,getFormattedPaddingTopSize,getFormattedRightSize,getFormattedShadow,getFormattedSize,getFormattedStyleVariable,getFormattedTopSize,getFormattedWidthSize}from"./theme/styles/index.js";export{isBrowser,isDefined,isEmpty,isNotEmpty}from"./utils/blueprint.js";export{IkasComponentRenderer}from"./utils/component-renderer.js";export{formatCurrency}from"./utils/currency.js";export{HttpMethod,get,httpRequest,post}from"./utils/fetch.js";export{JsObject}from"./utils/object-wrapper.js";export{PayWithIkas}from"./utils/pay-with-ikas.js";export{normalizeSvg}from"./utils/svg.js";export{setAPIClientConfig}from"./packages/storefront-api/src/index.js";export{IkasStorefrontConfig,escapeForJSON,unescapeFromJSON}from"./packages/storefront-config/src/index.js";import"./packages/storefront-models/src/models/merchant-settings/index.js";export{default as IkasAPIClientConfig}from"./packages/storefront-api-client/src/config/index.js";export{anl_addToCart}from"./analytics/analytics-functions/addToCart.js";export{anl_addToWishlist}from"./analytics/analytics-functions/addToWishlist.js";export{anl_completeRegistration}from"./analytics/analytics-functions/completeRegistration.js";export{anl_contactForm}from"./analytics/analytics-functions/contactForm.js";export{anl_createEmailSubscription}from"./analytics/analytics-functions/createEmailSubscription.js";export{anl_customerLogin}from"./analytics/analytics-functions/customerLogin.js";export{anl_customerLogout}from"./analytics/analytics-functions/customerLogout.js";export{anl_customerVisit}from"./analytics/analytics-functions/customerVisit.js";export{anl_pageView}from"./analytics/analytics-functions/pageView.js";export{anl_productView}from"./analytics/analytics-functions/productView.js";export{anl_removeFromCart}from"./analytics/analytics-functions/removeFromCart.js";export{anl_search}from"./analytics/analytics-functions/search.js";export{anl_viewBrand}from"./analytics/analytics-functions/viewBrand.js";export{anl_viewCart}from"./analytics/analytics-functions/viewCart.js";export{anl_viewCategory}from"./analytics/analytics-functions/viewCategory.js";export{anl_viewListing}from"./analytics/analytics-functions/viewListing.js";export{anl_viewSearchResults}from"./analytics/analytics-functions/viewSearchResults.js";export{anl_viewStorefrontPopup}from"./analytics/analytics-functions/viewStorefrontPopup.js";import*as e from'./ext/animejs/lib/anime.esm.js';export{e as AnimeJS};export{cloneDeep,reaction}from"./utils/helper.js";export{APIErrorCode,APIResponse}from"./packages/storefront-api-client/src/utils/api.js";export{EMPTY_THEME_GLOBALS,breakpointCssToken,cssVarCamelCase,cssVarRef,isReservedVariableId,rawClassRef,resolveBreakpointMediaTokens,serializeThemeGlobals,toResolverBreakpoints}from"./packages/storefront-config/src/theme-globals.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__awaiter as t,__generator as r}from'./../../../../../ext/tslib/tslib.es6.mjs.js';import{handleAPIError as e,APIResponse as n}from"../../../../storefront-api-client/src/utils/api.js";import i from"../../../../storefront-api-client/src/utils/fetch-query.js";var o=function(o,s,u){return t(void 0,void 0,void 0,function(){var t,c,l,a;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,i({operationName:"unlinkExternalAccount",config:u,excludeFields:s,input:o})];case 1:return t=r.sent(),c=t.data,l=t.errors,[2,new n(null==c?void 0:c.unlinkExternalAccount,l)];case 2:return a=r.sent(),[2,e(a)];case 3:return[2]}})})};export{o as unlinkExternalAccount};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__awaiter as t,__generator as r}from'./../../../../../ext/tslib/tslib.es6.mjs.js';import{handleAPIError as e,APIResponse as n}from"../../../../storefront-api-client/src/utils/api.js";import i from"../../../../storefront-api-client/src/utils/fetch-query.js";var o=function(o,s,c){return t(void 0,void 0,void 0,function(){var t,u,a,l;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,i({operationName:"getExternalAccountLink",config:c,excludeFields:s,input:o})];case 1:return t=r.sent(),u=t.data,a=t.errors,[2,new n(null==u?void 0:u.getExternalAccountLink,a)];case 2:return l=r.sent(),[2,e(l)];case 3:return[2]}})})};export{o as getExternalAccountLink};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../../../../ext/tslib/tslib.es6.mjs.js';import{handleAPIError as r,APIResponse as s}from"../../../../storefront-api-client/src/utils/api.js";import i from"../../../../storefront-api-client/src/utils/fetch-query.js";var o=function(o,n){return e(void 0,void 0,void 0,function(){var e,l,a,u;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,i({operationName:"getMilesSmilesDetails",config:n,excludeFields:o})];case 1:return e=t.sent(),l=e.data,a=e.errors,[2,new s(null==l?void 0:l.getMilesSmilesDetails,a)];case 2:return u=t.sent(),[2,r(u)];case 3:return[2]}})})};export{o as getMilesSmilesDetails};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ConfigType, APIResponse } from "../../../../storefront-api-client/src";
|
|
2
|
+
import { CustomerExternalAccountLinkProviderEnum } from "../types";
|
|
3
|
+
export declare const unlinkExternalAccount: (input: UnlinkExternalAccountQueryParams, excludeFields?: string[], config?: ConfigType) => Promise<APIResponse<boolean> | APIResponse<undefined>>;
|
|
4
|
+
export type UnlinkExternalAccountQueryParams = {
|
|
5
|
+
provider: CustomerExternalAccountLinkProviderEnum;
|
|
6
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ConfigType, APIResponse } from "../../../../storefront-api-client/src";
|
|
2
|
+
import { CustomerExternalAccountLinkProviderEnum, ExternalAccountLink } from "../types";
|
|
3
|
+
export declare const getExternalAccountLink: (input: GetExternalAccountLinkQueryParams, excludeFields?: string[], config?: ConfigType) => Promise<APIResponse<ExternalAccountLink> | APIResponse<undefined>>;
|
|
4
|
+
export type GetExternalAccountLinkQueryParams = {
|
|
5
|
+
provider: CustomerExternalAccountLinkProviderEnum;
|
|
6
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ConfigType, APIResponse } from "../../../../storefront-api-client/src";
|
|
2
|
+
import { MilesSmilesDetailsResponse } from "../types";
|
|
3
|
+
export declare const getMilesSmilesDetails: (excludeFields?: string[], config?: ConfigType) => Promise<APIResponse<MilesSmilesDetailsResponse> | APIResponse<undefined>>;
|
|
@@ -30,6 +30,7 @@ export type CustomerAttributePermissionEnum = "CustomerAttributePermissionEnum"
|
|
|
30
30
|
export type CustomerAttributeRegisterPageRequirementEnum = "CustomerAttributeRegisterPageRequirementEnum" | "INVISIBLE" | "MANDATORY" | "OPTIONAL";
|
|
31
31
|
export type CustomerAttributeTypeEnum = "CustomerAttributeTypeEnum" | "BOOLEAN" | "CHOICE" | "DATE" | "DATETIME" | "MULTIPLE_CHOICE" | "NUMERIC" | "TEXT";
|
|
32
32
|
export type CustomerEmailSubscriptionStatusesEnum = "CustomerEmailSubscriptionStatusesEnum" | "NOT_SUBSCRIBED" | "PENDING_CONFIRMATION" | "SUBSCRIBED";
|
|
33
|
+
export type CustomerExternalAccountLinkProviderEnum = "CustomerExternalAccountLinkProviderEnum" | "miles_smiles";
|
|
33
34
|
export type CustomerGenderTypeEnum = "CustomerGenderTypeEnum" | "FEMALE" | "MALE" | "OTHER";
|
|
34
35
|
export type CustomerPriceListRuleFilterTypeEnum = "CustomerPriceListRuleFilterTypeEnum" | "CATEGORY" | "PRODUCT" | "PRODUCT_BRAND" | "PRODUCT_TAG";
|
|
35
36
|
export type CustomerPriceListRuleValueTypeEnum = "CustomerPriceListRuleValueTypeEnum" | "DISCOUNT_AMOUNT" | "DISCOUNT_RATE" | "FIXED_PRICE";
|
|
@@ -1052,6 +1053,17 @@ export interface GetAvailableStockLocationAddressCountry {
|
|
|
1052
1053
|
export interface GetAvailableStockLocationsResponse {
|
|
1053
1054
|
stockLocations: GetAvailableStockLocation[];
|
|
1054
1055
|
}
|
|
1056
|
+
export interface ExternalAccountLink {
|
|
1057
|
+
externalId: string;
|
|
1058
|
+
linkedAt: any;
|
|
1059
|
+
provider: CustomerExternalAccountLinkProviderEnum;
|
|
1060
|
+
}
|
|
1061
|
+
export interface MilesSmilesDetailsResponse {
|
|
1062
|
+
availableMiles: number;
|
|
1063
|
+
firstName: string | null;
|
|
1064
|
+
lastName: string | null;
|
|
1065
|
+
memberId: string;
|
|
1066
|
+
}
|
|
1055
1067
|
export interface GetCustomerCouponResponse {
|
|
1056
1068
|
campaign: Campaign;
|
|
1057
1069
|
code: string;
|
|
@@ -1784,6 +1796,7 @@ export interface PaymentGateway {
|
|
|
1784
1796
|
isPassive: boolean | null;
|
|
1785
1797
|
logoUrl: string | null;
|
|
1786
1798
|
masterPassClientId: string | null;
|
|
1799
|
+
milesSmilesEnabled: boolean | null;
|
|
1787
1800
|
name: string;
|
|
1788
1801
|
paymentGatewayProviderId: string | null;
|
|
1789
1802
|
paymentMethodType: PaymentMethodTypeEnum;
|
|
@@ -3134,6 +3147,7 @@ export interface CreateSaleTransactionWithCartInput {
|
|
|
3134
3147
|
cartId: string;
|
|
3135
3148
|
masterPassDetail?: CreateSaleTransactionMasterPassPaymentMethodDetail | null;
|
|
3136
3149
|
metadata?: any | null;
|
|
3150
|
+
milesSmiles?: MilesSmilesPaymentInput | null;
|
|
3137
3151
|
paymentGatewayId: string;
|
|
3138
3152
|
paymentMethodDetail?: PaymentMethodDetailInput | null;
|
|
3139
3153
|
}
|
|
@@ -3141,6 +3155,7 @@ export interface CreateSaleTransactionWithCheckoutInput {
|
|
|
3141
3155
|
checkoutId: string;
|
|
3142
3156
|
masterPassDetail?: CreateSaleTransactionMasterPassPaymentMethodDetail | null;
|
|
3143
3157
|
metadata?: any | null;
|
|
3158
|
+
milesSmiles?: MilesSmilesPaymentInput | null;
|
|
3144
3159
|
paymentGatewayId: string;
|
|
3145
3160
|
paymentMethodDetail?: PaymentMethodDetailInput | null;
|
|
3146
3161
|
}
|
|
@@ -3190,6 +3205,9 @@ export interface DateFilterInput {
|
|
|
3190
3205
|
ne?: any | null;
|
|
3191
3206
|
nin?: any[] | null;
|
|
3192
3207
|
}
|
|
3208
|
+
export interface MilesSmilesPaymentInput {
|
|
3209
|
+
miles: number;
|
|
3210
|
+
}
|
|
3193
3211
|
export interface GetCustomerCouponsInput {
|
|
3194
3212
|
customerId: string;
|
|
3195
3213
|
}
|
|
@@ -27,6 +27,7 @@ export declare class IkasStorefrontConfig {
|
|
|
27
27
|
static universalAnalyticsId?: string;
|
|
28
28
|
static pickUpStockLocationIds?: string[] | null;
|
|
29
29
|
static tiktokPixelId?: string;
|
|
30
|
+
static openAiPixelId?: string;
|
|
30
31
|
static stockPreference?: IkasThemeStockPreference;
|
|
31
32
|
static translations: Record<string, any>;
|
|
32
33
|
static themeGlobals: ThemeGlobals;
|
|
@@ -101,6 +102,7 @@ export type IkasStorefrontConfigParams = {
|
|
|
101
102
|
universalAnalyticsId?: string;
|
|
102
103
|
pickUpStockLocationIds?: string[] | null;
|
|
103
104
|
tiktokPixelId?: string;
|
|
105
|
+
openAiPixelId?: string;
|
|
104
106
|
stockPreference?: IkasThemeStockPreference;
|
|
105
107
|
translations: Record<string, any>;
|
|
106
108
|
themeGlobals: ThemeGlobals;
|
|
@@ -12,6 +12,8 @@ export type IkasPaymentGateway = {
|
|
|
12
12
|
description: string | null;
|
|
13
13
|
logoUrl: string | null;
|
|
14
14
|
masterPassClientId: string | null;
|
|
15
|
+
/** True when Miles&Smiles can be redeemed on this (TK_PAY) gateway. */
|
|
16
|
+
milesSmilesEnabled?: boolean | null;
|
|
15
17
|
name: string;
|
|
16
18
|
paymentGatewayProviderId: string | null;
|
|
17
19
|
supportedCurrencies: string[] | null;
|
|
@@ -20,6 +20,7 @@ export type IkasStorefront = {
|
|
|
20
20
|
analytics4Id: string | null;
|
|
21
21
|
universalAnalyticsId: string | null;
|
|
22
22
|
tiktokPixelId: string | null;
|
|
23
|
+
openAiPixelId?: string | null;
|
|
23
24
|
token: string | null;
|
|
24
25
|
type: IkasStorefrontType;
|
|
25
26
|
metaTemplates: IkasStorefontMetaTemplates[] | null;
|
package/dist/utils/helper.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare function capitalize(value: string): string;
|
|
|
7
7
|
export declare function tryForEach(items: any[], callback: (item: any, index: number) => void, printErrors?: boolean): void;
|
|
8
8
|
export declare function formatDate(date: Date): string;
|
|
9
9
|
export declare function getCookieValue(cookieName: string): string | null;
|
|
10
|
+
export declare function getOpenAiAttributionMetadata(): Record<string, string>;
|
|
10
11
|
export declare function isClient(): boolean;
|
|
11
12
|
export declare function isServer(): boolean;
|
|
12
13
|
export declare function getQueryParams(): URLSearchParams | undefined;
|
package/dist/utils/helper.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__spreadArray as r}from'./../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as
|
|
1
|
+
import{__spreadArray as r,__assign as n}from'./../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as t}from"../packages/storefront-config/src/index.js";import{reaction as e}from'./../ext/mobx/dist/mobx.esm.js';var o=function(r){return/^\+?\d+$/.test(r)},a=function(r){r=(r=r.replace(/^\s+|\s+$/g,"")).toLocaleLowerCase("tr-TR");for(var n="àáäâèéëêìíïîıòóöôùúüûñçşğ·/_,:;",t=0;t<31;t++)r=r.replace(new RegExp(n.charAt(t),"g"),"aaaaeeeeiiiiioooouuuuncsg------".charAt(t));return r=r.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")},i=function(r){return!(r.length>320)&&/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(r)};function u(r){return!!new Intl.DateTimeFormat(r,{hour:"numeric"}).format(0).match(/\s/)}function c(r,n,t){void 0===t&&(t=!1),r.forEach(function(r,e){try{n(r,e)}catch(r){t&&console.error(r)}})}function f(r){var n={year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",hour12:!1},e=t.getCurrentLocale();return"undefined"!=typeof navigator?n.hour12=u(navigator.language):n.hour12=u(e),new Intl.DateTimeFormat(e,n).format(r)}function s(r){var n=document.cookie.split(";").find(function(n){return n.trim().startsWith("".concat(r,"="))});return n?n.split("=")[1]:null}function l(){var r=s("__oppref"),t=s("__obref");return n(n({},r?{oppref:r}:{}),t?{obref:t}:{})}function m(){return"undefined"!=typeof window}function p(){return!m()}function g(){if(m())return new URLSearchParams(location.search)}function h(){return!!m()&&(performance.getEntriesByType?"back_forward"===performance.getEntriesByType("navigation")[0].type:performance.navigation.type===performance.navigation.TYPE_BACK_FORWARD)}function v(r,n){void 0===n&&(n={arrayFormat:"comma"});for(var t=[],e=function(r,e){if(null==e)return"continue";Array.isArray(e)?"comma"===n.arrayFormat&&e.length>0?t.push("".concat(r,"=").concat(e.join(","))):e.forEach(function(n){return t.push("".concat(r,"=").concat(n))}):t.push("".concat(r,"=").concat(e))},o=0,a=Object.entries(r);o<a.length;o++){var i=a[o];e(i[0],i[1])}return t.length>0?"".concat(t.join("&")):""}function y(r){return null==r?r:JSON.parse(JSON.stringify(r))}function d(r,n){if(!r||!Array.isArray(r))return{};for(var t={},e=0,o=r;e<o.length;e++){var a=o[e],i=void 0;t[i=String("string"==typeof n?a[n]:"function"==typeof n?n(a):a)]||(t[i]=[]),t[i].push(a)}return t}function A(n){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];return n&&Array.isArray(n)?(0===t.length&&(t=[function(r){return r}]),r([],n,!0).sort(function(r,n){for(var e=0,o=t;e<o.length;e++){var a=o[e],i=void 0,u=void 0;if("string"==typeof a?(i=r[a],u=n[a]):"function"==typeof a?(i=a(r),u=a(n)):(i=r,u=n),null!=i||null!=u){if(null==i)return 1;if(null==u)return-1;if(i<u)return-1;if(i>u)return 1}}return 0})):[]}function _(r,n){var t;return function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];clearTimeout(t),t=setTimeout(function(){return r.apply(void 0,e)},n)}}function b(r,n){return e(r,n)}export{y as cloneDeep,_ as debounce,f as formatDate,s as getCookieValue,l as getOpenAiAttributionMetadata,g as getQueryParams,d as groupBy,h as isBackNavigation,m as isClient,p as isServer,b as reaction,A as sortBy,a as stringToSlug,v as stringifyQueryParams,c as tryForEach,i as validateEmail,o as validatePhoneNumber};
|