@ikas/bp-storefront 1.4.0-beta.13 → 1.4.0-beta.130
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/helpers.js +1 -1
- package/dist/analytics/analytics.js +1 -1
- package/dist/analytics/google-tag-manager/productView.js +1 -1
- package/dist/analytics/google-tag-manager/viewCategory.js +1 -1
- package/dist/analytics/ikas/analytics.js +1 -1
- package/dist/analytics/utils.js +1 -1
- package/dist/ext/lodash/flatten.js +1 -0
- package/dist/functions/api/cart/index.js +1 -1
- package/dist/functions/models/category/index.js +1 -1
- package/dist/functions/models/image/index.d.ts +65 -20
- package/dist/functions/models/image/index.js +1 -1
- package/dist/functions/models/product/variant/index.d.ts +72 -6
- package/dist/functions/models/product/variant/index.js +1 -1
- package/dist/functions/models/product-list/index.js +1 -1
- package/dist/functions/models/validator/account-info/index.js +1 -1
- package/dist/functions/models/validator/address/index.d.ts +70 -2
- package/dist/functions/models/validator/contact-form/index.js +1 -1
- package/dist/functions/models/validator/coupon-code-form/index.js +1 -1
- package/dist/functions/models/validator/customer-review/index.js +1 -1
- package/dist/functions/models/validator/forgot-password/index.js +1 -1
- package/dist/functions/models/validator/login/index.js +1 -1
- package/dist/functions/models/validator/newsletter-subscription/index.js +1 -1
- package/dist/functions/models/validator/order-tracking/index.js +1 -1
- package/dist/functions/models/validator/recover-password/index.js +1 -1
- package/dist/functions/models/validator/register/index.js +1 -1
- package/dist/functions/models/validator/sms-login/index.js +1 -1
- package/dist/functions/models/validator/verify-phone-number/index.js +1 -1
- package/dist/functions/stores/base/index.d.ts +38 -1
- package/dist/functions/stores/base/index.js +1 -1
- package/dist/functions/stores/cart/index.js +1 -1
- package/dist/functions/stores/customer/index.d.ts +29 -23
- package/dist/functions/stores/customer/index.js +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -1
- package/dist/packages/storefront-config/src/index.js +1 -1
- package/dist/packages/storefront-config/src/theme-globals.js +1 -0
- package/dist/storefront-config/src/index.d.ts +4 -0
- package/dist/storefront-config/src/theme-globals.d.ts +305 -0
- package/dist/storefront-models/src/index.d.ts +1 -0
- package/dist/storefront-models/src/models/blueprint/prop-value/color.d.ts +2 -0
- package/dist/storefront-models/src/models/blueprint/prop-value/index.d.ts +2 -0
- package/dist/storefront-models/src/models/blueprint/prop-value/svg-list.d.ts +3 -0
- package/dist/storefront-models/src/models/blueprint/prop-value/svg.d.ts +3 -0
- package/dist/storefront-models/src/models/product/campaign/data/index.d.ts +2 -0
- package/dist/storefront-models/src/models/product/campaign/filter/index.d.ts +1 -1
- package/dist/storefront-models/src/models/product/campaign/product-tiered-discount/index.d.ts +13 -0
- package/dist/storefront-models/src/models/product/variant/index.d.ts +17 -0
- package/dist/theme/settings/index.d.ts +48 -0
- package/dist/theme/settings/index.js +1 -0
- package/dist/utils/component-renderer.d.ts +2 -1
- package/dist/utils/component-renderer.js +1 -1
- package/dist/utils/pay-with-ikas.d.ts +552 -0
- package/dist/utils/pay-with-ikas.js +1 -0
- package/dist/utils/svg.d.ts +15 -0
- package/dist/utils/svg.js +1 -0
- package/package.json +1 -1
|
@@ -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";function v(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 p(a,s){return t(this,arguments,void 0,function(t,a,s,d){var v,p,m,I,g,y,b,C,L,_,j,P,T,w,x,E,U;return void 0===s&&(s=1),n(this,function(n){switch(n.label){case 0:v=null!==(P=null==d?void 0:d.isPayWithIkas)&&void 0!==P&&P,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,k()]):[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=O(i.cart,t,a))){if(a.productOptionSet&&l(a.productOptionSet),!t.bundleSettings)return[2,h(p,p.quantity+s,a.offers,a)];if(!S())return[2,h(p,p.quantity+s,a.offers,a)]}n.label=3;case 3:return m=F(a),I=s,(null==(g=null===(T=a.salesChannels)||void 0===T?void 0:T.find(function(t){return t.id===r.salesChannelId}))?void 0:g.minQuantityPerCart)&&s<g.minQuantityPerCart&&(I=g.minQuantityPerCart),(null==g?void 0:g.maxQuantityPerCart)&&s>g.maxQuantityPerCart&&(I=g.maxQuantityPerCart),y=v?null:(null===(w=i.cart)||void 0===w?void 0:w.id)||localStorage.getItem(e),[4,import("../../api/cart/index.js")];case 4:return[4,(0,n.sent().apiAddItemToCart)({input:{cartId:y,item:{id:null!==(x=null==p?void 0:p.id)&&void 0!==x?x:null,quantity:null!==(E=null==p?void 0:p.quantity)&&void 0!==E?E:I,variant:{id:t.id,name:a.name,bundleProducts:null===(U=t.bundleSettings)||void 0===U?void 0:U.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:q(a.offers),options:m.length?m:null,priceListId:r.priceListId||null,salesChannelId:r.salesChannelId,storefrontThemeId:r.storefrontThemeId,metadata:{_fbp:o("_fbp"),_fbc:o("_fbc")}}})];case 5:return b=n.sent(),v?[3,7]:b.isSuccess&&b.data?[4,A(b.data)]:[3,7];case 6:n.sent(),n.label=7;case 7:return(C=v?b.data:i.cart)?(L="".concat(C.id,"-").concat(C.updatedAt),(_=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)(_,s,L,C,a),n.label=9;case 9:return a.productOptionSet&&l(a.productOptionSet),[2,{success:b.isSuccess,response:b}];case 10:return j=n.sent(),console.log(j),[2,{success:!1}];case 11:return[2]}})})}function m(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,p(u(t),t,r)];case 1:return[2,n.sent()]}})})}function h(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,k()];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?q(s):void 0,options:E(e),priceListId:r.priceListId||null,salesChannelId:r.salesChannelId,storefrontThemeId:r.storefrontThemeId,metadata:{_fbp:o("_fbp"),_fbc:o("_fbc")}}})];case 3:return(t=n.sent()).isSuccess&&t.data?[4,A(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 I(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,h(e,i,a,o)];case 1:return[2,t.sent()]}})})}function g(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,h(r,0)];case 1:return[2,t.sent()]}})})}function b(t){localStorage.removeItem(e),t.cart=null}function C(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 S(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("editLineID")||""}function O(t,n,r){var e,i,a;if(!r.productOptionSetId&&!n.bundleSettings)return t.orderLineItems.find(function(t){return t.variant.id===n.id});if(n.bundleSettings){var o=S();if(o)if(g=t.orderLineItems.find(function(t){return t.id===o}))return g}var s=t.orderLineItems.filter(function(t){return t.variant.id===n.id})||[];if(r.productOptionSetId)for(var u=F(r),c=s.filter(function(t){var n;return(null===(n=t.options)||void 0===n?void 0:n.length)===u.length})||[],d=0,l=c;d<l.length;d++){if((g=l[d]).options){for(var f=!0,v=function(t){var n=t.values.map(function(t){return t.value}),o=null===(a=null===(i=null===(e=r.productOptionSet)||void 0===e?void 0:e.options)||void 0===i?void 0:i.find(function(n){return n.id===t.productOptionId}))||void 0===a?void 0:a.values;if(!(f=f&&n.length===(null==o?void 0:o.length)&&n.every(function(t){return null==o?void 0:o.includes(t)})))return"break"},p=0,m=g.options;p<m.length;p++){if("break"===v(m[p]))break}if(f){if(!n.bundleSettings)return g;if(_(n,g))return g}}}else if(n.bundleSettings)for(var h=0,I=s;h<I.length;h++){var g=I[h];if(_(n,g))return g}}function L(t,n){return O(t,u(n),n)}function _(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 j(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 P(r){return t(this,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,j(r,null)];case 1:return[2,t.sent()]}})})}function T(t){t.cart&&0===s(t.cart)&&b(t)}function w(){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,7,8,9]),i.isCartLoading=!0,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 2:return[4,(0,n.sent().apiGetCartById)({id:r})];case 3:return(o=n.sent()).isSuccess&&o.data?[4,A(o.data)]:[3,5];case 4:return n.sent(),[3,6];case 5:if(o.isCancelled||o.isNetworkError)return[2];b(i),n.label=6;case 6:return[3,9];case 7:return s=n.sent(),console.log(s),[3,9];case 8:return i.isCartLoading=!1,i.isCartInitialLoadFinished=!0,[7];case 9:return[2]}})})}function q(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 x(e,i){return t(this,arguments,void 0,function(t,e,i){var a,o,s,c,d,l,f,v,m,h,I,g,y,b,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,p(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===(m=null===(v=c.response)||void 0===v?void 0:v.data)||void 0===m?void 0:m.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===(y=l.graphQLErrors)||void 0===y?void 0:y.length)?[2,{success:!1,error:(null===(C=null===(b=l.graphQLErrors)||void 0===b?void 0:b[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 A(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 k(){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]:(b(i),[3,3]);case 1:return i.cart||!t?[3,3]:[4,w()];case 2:n.sent(),n.label=3;case 3:return[2]}})})}function E(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 F(t){var n,r=[];return null===(n=t.productOptionSet)||void 0===n||n.options.forEach(function(t){t.values.length&&r.push({productOptionId:t.id,productOptionsSetId:t.productOptionSetId,values:t.values})}),r}function U(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,k()];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")}}})];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,A(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 Q(t){var n;return!!t.cart&&(null===(n=t.cart.orderLineItems)||void 0===n?void 0:n.length)>0}export{p as addItemToCart,m as addSelectedtedVariantToCart,I as changeCartItemQuantity,h as changeItemQuantity,x as createPayWithIkasSession,O as findExistingCartItem,L as findExistingCartItemWithProduct,q as getAcceptedOffers,w as getCart,v as getCheckoutUrlFromCartStore,Q as hasCart,g as isOrderLineItemAutoCreated,b as removeCart,P as removeCouponCode,y as removeItem,j as saveCouponCode,A as setCart,C as waitForCartStoreInit,U as windowAddToCart};
|
|
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,y,b,C,S,L,j,w,P,T,q,A,F;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,k()]):[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=U(a),h=s,(null==(g=null===(P=a.salesChannels)||void 0===P?void 0:P.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),y=v?null:(null===(T=i.cart)||void 0===T?void 0:T.id)||localStorage.getItem(e),[4,import("../../api/cart/index.js")];case 4:return[4,(0,n.sent().apiAddItemToCart)({input:{cartId:y,item:{id:null!==(q=null==p?void 0:p.id)&&void 0!==q?q:null,quantity:null!==(A=null==p?void 0:p.quantity)&&void 0!==A?A:h,variant:{id:t.id,name:a.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?u(t.product).id:"",quantity:t.quantity}})}},acceptedOffers:x(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 b=n.sent(),v?[3,7]:b.isSuccess&&b.data?[4,E(b.data)]:[3,7];case 6:n.sent(),n.label=7;case 7:return(C=v?b.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:b.isSuccess,response:b}];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,k()];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?x(s):void 0,options:F(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,E(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 y(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 b(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=U(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 P(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 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,E(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 x(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 A(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,y,b,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===(y=l.graphQLErrors)||void 0===y?void 0:y.length)?[2,{success:!1,error:(null===(C=null===(b=l.graphQLErrors)||void 0===b?void 0:b[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 E(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 k(){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 F(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 U(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 Q(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,k()];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,E(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 N(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,A as createPayWithIkasSession,_ as findExistingCartItem,L as findExistingCartItemWithProduct,x as getAcceptedOffers,q as getCart,p as getCheckoutUrlFromCartStore,N as hasCart,y as isOrderLineItemAutoCreated,C as removeCart,P as removeCouponCode,b as removeItem,w as saveCouponCode,E as setCart,S as waitForCartStoreInit,Q as windowAddToCart};
|
|
@@ -1868,35 +1868,41 @@ export declare function clearRegisterForm(customerStore: IkasCustomerStore): voi
|
|
|
1868
1868
|
/**
|
|
1869
1869
|
* Create and return a new, empty address form with validation, wrapped in MobX observability.
|
|
1870
1870
|
*
|
|
1871
|
+
* Use this to create an address; use `getIkasCustomerAddressForm(address)` to edit an existing
|
|
1872
|
+
* one. It starts `initAddressForm` internally but does not await it, so await `initAddressForm`
|
|
1873
|
+
* yourself when you need to know that the country layout (`addressFormat`) and the country/state/
|
|
1874
|
+
* city lists are ready to render.
|
|
1875
|
+
*
|
|
1871
1876
|
* @ai-category Customer, Address
|
|
1872
|
-
* @ai-related
|
|
1877
|
+
* @ai-related initAddressForm, submitAddressForm, getIkasCustomerAddressForm, deleteCustomerAddress
|
|
1873
1878
|
*
|
|
1874
1879
|
* @param customerStore - The customer store instance
|
|
1875
1880
|
* @returns A new observable address form object with validated fields
|
|
1876
1881
|
*
|
|
1877
1882
|
* @example
|
|
1878
|
-
* ```
|
|
1879
|
-
* import {
|
|
1880
|
-
*
|
|
1881
|
-
*
|
|
1882
|
-
*
|
|
1883
|
-
*
|
|
1884
|
-
*
|
|
1885
|
-
*
|
|
1886
|
-
*
|
|
1887
|
-
*
|
|
1888
|
-
*
|
|
1889
|
-
*
|
|
1890
|
-
*
|
|
1891
|
-
*
|
|
1892
|
-
*
|
|
1893
|
-
*
|
|
1894
|
-
*
|
|
1895
|
-
*
|
|
1896
|
-
*
|
|
1897
|
-
*
|
|
1898
|
-
*
|
|
1899
|
-
*
|
|
1883
|
+
* ```tsx
|
|
1884
|
+
* import {
|
|
1885
|
+
* customerStore,
|
|
1886
|
+
* getEmptyAddressForm,
|
|
1887
|
+
* initAddressForm,
|
|
1888
|
+
* setAddressFormAddressLine1,
|
|
1889
|
+
* submitAddressForm,
|
|
1890
|
+
* } from "@ikas/bp-storefront";
|
|
1891
|
+
*
|
|
1892
|
+
* // Create the form once, then await init before rendering the country-driven layout.
|
|
1893
|
+
* const [form] = useState(() => getEmptyAddressForm(customerStore));
|
|
1894
|
+
* const [isLoading, setIsLoading] = useState(true);
|
|
1895
|
+
* useEffect(() => {
|
|
1896
|
+
* initAddressForm(form).then(() => setIsLoading(false));
|
|
1897
|
+
* }, []);
|
|
1898
|
+
*
|
|
1899
|
+
* // Always go through the setters. Assigning `form.addressLine1.value` directly skips
|
|
1900
|
+
* // re-validation and the dependent-field resets the location setters perform.
|
|
1901
|
+
* setAddressFormAddressLine1(form, "123 Main Street");
|
|
1902
|
+
*
|
|
1903
|
+
* // submitAddressForm validates and saves the address onto the customer itself --
|
|
1904
|
+
* // do not hand-build a customer object and call saveCustomer for this.
|
|
1905
|
+
* const ok = await submitAddressForm(form);
|
|
1900
1906
|
* ```
|
|
1901
1907
|
*/
|
|
1902
1908
|
export declare function getEmptyAddressForm(customerStore: IkasCustomerStore): AddressForm;
|
|
@@ -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{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{initForgotPasswordForm as b}from"../../models/validator/forgot-password/index.js";import{initLoginForm as I}from"../../models/validator/login/index.js";import{initNewsletterSubscriptionForm as S}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 T}from"../../models/validator/sms-login/index.js";import{initVerifyPhoneNumberForm as j}from"../../models/validator/verify-phone-number/index.js";var E="customerToken",F="customerTokenExpiry",P="customerEmailSubscription",C="lastViewedProducts",L="customerConsent";function N(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return function(t){if(d())return;var e=localStorage.getItem(E),r=localStorage.getItem(F);e&&r?xt(t,e,parseInt(r)):Tt(t)}(e),Nt(e),function(t){if(d())return;t._customerConsentGranted=!!window.localStorage.getItem(L)}(e),[4,kt(e)];case 1:return t.sent(),[4,St(e)];case 2:return t.sent(),e._initialized=!0,[4,ct(e)];case 3:return t.sent(),e.customer?[4,import("../../../analytics/analytics-functions/customerVisit.js")]:[3,5];case 4:(0,t.sent().anl_customerVisit)(),t.label=5;case 5:return[2]}})})}function O(t){return!!t.customer&&(!(p(t.customer)||d()||t._visitorSubscribedEmail)&&!window.localStorage.getItem(P))}function R(t){return e(e({},t.customer),{consentGranted:t._customerConsentGranted})}function A(e,n){return t(this,void 0,void 0,function(){var t,e,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 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,U(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 U(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)?(xt(e,t.data.token,t.data.tokenExpiry),yt(e,t.data.customer),[4,import("../../../analytics/analytics-functions/customerLogin.js")]):[2,!1];case 3:return i=r.sent().anl_customerLogin,e.customer&&i(),[2,!0]}})})}function D(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:return(t=l(e.customer))&&t.addresses?-1===(i=t.addresses.findIndex(function(t){return t.id===n.id}))?[2,!1]:(t.addresses.splice(i,1),[4,$(e,t)]):[2,!1];case 1:return[2,r.sent()]}})})}function M(e,n,i){return t(this,void 0,void 0,function(){var t,e,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 B(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,Pt(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(),Et(e),t&&t.isSuccess&&t.data?(s=t.data,xt(e,s.token,s.tokenExpiry),s.customer&&yt(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 At(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 G(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return jt(e),m(u),[4,import("../../../analytics/analytics-functions/customerLogout.js")];case 1:return(0,t.sent().anl_customerLogout)(),[2]}})})}function W(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,Pt(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(),Et(e),t&&t.isSuccess&&(null===(l=t.data)||void 0===l?void 0:l.customer)?(xt(e,t.data.token,t.data.tokenExpiry),yt(e,t.data.customer),At(e),[4,import("../../../analytics/analytics-functions/completeRegistration.js")]):[3,5];case 4:return(0,r.sent().anl_completeRegistration)(R(e)),[2,{isSuccess:!0,errorCodes:[]}];case 5:return[2,{isSuccess:!1,errorCodes:t.errorCodes.map(function(t){return["EMAIL_IS_NOT_VERIFIED","CUSTOMER_EMAIL_ALREADY_EXISTS","B2B_CUSTOMER_ACCOUNT_DISABLED","PHONE_IS_NOT_VERIFIED"].includes(t)?t:"UNKOWN"})}]}})})}function q(e){return t(this,void 0,void 0,function(){var t,n,i;return r(this,function(r){switch(r.label){case 0:return t=new URLSearchParams(window.location.search),(n=t.get("token"))?[4,Pt(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(),Et(e),[2,i.isSuccess];case 4:return[2,!1]}})})}function K(e,n){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return n?[4,Pt(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(),Et(e),[2,t.isSuccess];case 4:return[2,!1]}})})}function z(e,n,i){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return n?[4,Pt(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(),Et(e),[2,!(!t.isSuccess||!t.data)&&t.data];case 4:return[2,!1]}})})}function H(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(),Et(n),t&&t.isSuccess&&(null===(s=t.data)||void 0===s?void 0:s.customer)?(xt(n,t.data.token,t.data.tokenExpiry),yt(n,t.data.customer),At(n),[4,import("../../../analytics/analytics-functions/completeRegistration.js")]):[3,4];case 3:return(0,r.sent().anl_completeRegistration)(R(n)),[2,{isSuccess:!0,errorCodes:[]}];case 4:return t&&t.isSuccess&&((null===(a=t.data)||void 0===a?void 0:a.otpSend)||(null===(c=t.data)||void 0===c?void 0:c.flowId))?[2,{isSuccess:!0,otpSend:!0,flowId:null===(u=t.data)||void 0===u?void 0:u.flowId,errorCodes:[]}]:t.errorCodes.some(function(t){return"B2B_CUSTOMER_ACCOUNT_DISABLED"===t})?[4,import("../../../analytics/analytics-functions/completeRegistration.js")]:[3,6];case 5:(0,r.sent().anl_completeRegistration)(e(e({},R(n)),{notificationsAccepted:null}),!0),r.label=6;case 6:return[2,{isSuccess:!1,errorCodes:t.errorCodes.map(function(t){return["EMAIL_IS_NOT_VERIFIED","CUSTOMER_EMAIL_ALREADY_EXISTS","B2B_CUSTOMER_ACCOUNT_DISABLED","PHONE_IS_NOT_VERIFIED"].includes(t)?t:"UNKOWN"})}];case 7:return r.sent(),[2,{isSuccess:!1,errorCodes:[]}];case 8:return[2]}})})}function J(e){return t(this,void 0,void 0,function(){var t;return r(this,function(e){switch(e.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,e.sent().apiResendCustomerPhoneVerificationCode)()];case 2:return[2,!(!(t=e.sent()).isSuccess||!t.data)&&t.data]}})})}function X(n,i){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,import("../../../analytics/analytics-functions/contactForm.js")];case 1:return(0,r.sent().anl_contactForm)(i),[4,Pt(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(),Et(n),[2,t.isSuccess]}})})}function Y(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:return[4,Pt(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(),Et(e),[2,!!t.isSuccess&&!!(null===(i=t.data)||void 0===i?void 0:i.exists)]}})})}function Q(e,n){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,Pt(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(),Et(e),[2,!!t.isSuccess&&t.data]}})})}function Z(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,Pt(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(),Et(e),[2,t.isSuccess]}})})}function $(e,n){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiSaveCustomer)({input:Dt(n)})];case 2:return(t=r.sent()).isSuccess&&t.data?(yt(e,t.data),[2,!0]):[2,!1]}})})}function tt(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,ht(e)];case 1:return t.sent(),e.customer?[4,import("../../api/customer/index.js")]:[2,[]];case 2:return[4,(0,t.sent().apiGetOrders)({})];case 3:return[2,t.sent().data||[]]}})})}function et(e,n){return t(this,void 0,void 0,function(){var o,s,a,c,u,d,l,m=this;return r(this,function(f){switch(f.label){case 0:return[4,ht(e)];case 1:return f.sent(),e.customer?(o=n,!i.isPreview||o&&"orders"!==o?[3,3]:[4,tt(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})]}})}),It(e),nt(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 rt(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([It(e),nt(e,{orderId:o.id})])]):[2,null];case 3:return s=r.sent(),a=s[1],o.transactions=a,[2,o]}})})}function nt(e){return t(this,arguments,void 0,function(t,e){var n;return void 0===e&&(e={}),r(this,function(t){switch(t.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return n=t.sent().apiListOrderTransactions,e.orderId||e.checkoutId||e.id?[4,n({checkoutId:{eq:e.checkoutId},id:{eq:e.checkoutId},orderId:{eq:e.orderId}})]:[2,[]];case 2:return[2,t.sent().data||[]]}})})}function it(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[2,[]];case 1:return[4,(0,t.sent().apiListFavoriteProducts)()];case 2:return[2,t.sent().data||[]]}})})}function ot(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,ct(e)];case 1:return 0===(t=r.sent()).length?[2,[]]:[4,import("../../api/product/index.js")];case 2:return[4,(0,r.sent().apiSearchProducts)({input:{productIdList:t.map(function(t){return t.productId}),priceListId:i.priceListId,salesChannelId:i.salesChannelId,perPage:100}})];case 3:return n=r.sent(),null===(a=null===(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 st(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:if(!(null===(i=e.customer)||void 0===i?void 0:i.id))throw Error("Unauthorized");return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiSaveFavoriteProduct)({isFavorite:!0,productId:n})];case 2:return t=r.sent(),[4,import("../../../analytics/analytics-functions/addToWishlist.js")];case 3:return(0,r.sent().anl_addToWishlist)(n),t.isSuccess?[4,ct(e,!0)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2,t.data||!1]}})})}function at(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:if(!(null===(i=e.customer)||void 0===i?void 0:i.id))throw Error("Unauthorized");return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiSaveFavoriteProduct)({isFavorite:!1,productId:n})];case 2:return t=r.sent(),[4,import("../../../analytics/analytics-functions/addToWishlist.js")];case 3:return(0,r.sent().anl_addToWishlist)(n,!0),t.isSuccess?[4,ct(e,!0)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2,t.data||!1]}})})}function ct(e){return t(this,arguments,void 0,function(t,e){var n;return void 0===e&&(e=!1),r(this,function(r){switch(r.label){case 0:return[4,ht(t)];case 1:return r.sent(),t.customer?t._isFavoriteProductsLoaded&&!e?[3,3]:[4,it(t)]:[2,[]];case 2:n=r.sent(),t._favoriteProducts=n,t._isFavoriteProductsLoaded=!0,r.label=3;case 3:return[2,t._favoriteProducts]}})})}function ut(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){return[2,e._favoriteProducts.some(function(t){return t.productId===n})]})})}function dt(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:return[4,Pt(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 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,Pt(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 mt(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 ft(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,t.sent().apiDeactivateCustomer)({password:n})];case 2:return[2,t.sent()];case 3:return[2]}})})}function pt(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,t.sent().apiExportCustomerPersonalData)()];case 2:return[2,t.sent()];case 3:return[2]}})})}function vt(t){!function(t){if(d())return;t._customerConsentGranted=!0,window.localStorage.setItem(L,"true")}(t)}function ht(e){return t(this,void 0,void 0,function(){return r(this,function(t){return d()?[2]:[2,new Promise(function(t){var r=setInterval(function(){e._initialized&&(clearInterval(r),t(null))},100)})]})})}function _t(t){return new Promise(function(e){var r=setInterval(function(){t._captchaToken&&(clearInterval(r),e(null))},100)})}function wt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiListCustomerAttribute)()];case 2:return t=r.sent(),e.customer&&(null===(n=e.customer.attributes)||void 0===n||n.forEach(function(e){var r,n,i;e.customerAttribute=(null===(r=t.data)||void 0===r?void 0:r.find(function(t){return t.id===e.customerAttributeId}))||null,e.customerAttributeOptionId&&(e.customerAttributeOption=(null===(i=null===(n=e.customerAttribute)||void 0===n?void 0:n.options)||void 0===i?void 0:i.find(function(t){return t.id===e.customerAttributeOptionId}))||null)})),[2,t.data||[]]}})})}function gt(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return n.length?[4,import("../../api/checkout/index.js")]:[2,[]];case 1:return[4,(0,t.sent().apiListProductFile)({id:{in:n}})];case 2:return[2,t.sent().data||[]]}})})}function bt(e,n,i){return t(this,void 0,void 0,function(){var t,e,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 It(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 St(e){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return d()||!e._token?[2]:[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiGetCustomer)()];case 2:return(t=r.sent()).data&&yt(e,t.data),[2]}})})}function yt(t,e){t.customer=e}function kt(e){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return e._token?[4,import("../../api/customer/index.js")]:[2];case 1:return[4,(0,r.sent().apiRefreshToken)({token:e._token})];case 2:if((t=r.sent()).isSuccess&&t.data)xt(e,t.data.token,t.data.tokenExpiry);else{if(t.isCancelled||t.isNetworkError)return[2];console.log("refreshToken error",t),e._token=null,e._tokenExpiry=null,jt(e)}return[2]}})})}function xt(t,e,r){d()||(t._token=e,t._tokenExpiry=r,localStorage.setItem(E,e),localStorage.setItem(F,r+""),i.init({customerToken:e}),n.TOKEN=e)}function Tt(t){localStorage.removeItem(E),localStorage.removeItem(F),t._token=null,t._tokenExpiry=null}function jt(t){Tt(t),t.customer=null,t._favoriteProducts=[],t._isFavoriteProductsLoaded=!1,i.init({customerToken:""}),n.TOKEN="",Et(t)}function Et(t){t._captchaToken=null}function Ft(t,e){t._captchaToken=e}function Pt(e){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),i.isCaptchaRequired()?(window.grecaptcha.execute(),[4,_t(e)]):[3,2];case 1:r.sent(),window.grecaptcha.reset(),r.label=2;case 2:return[3,4];case 3:return t=r.sent(),console.log("Get captcha error",t),[3,4];case 4:return[2]}})})}function Ct(t,e){t._savedLastViewedProducts=l(t._lastViewedProducts),t._savedLastViewedProductsResponse=e}function Lt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,r.sent().apiGetLastViewedProducts)({customerId:e.customer.id})];case 2:return t=r.sent(),e._lastViewedProducts=(null===(n=l(t.data))||void 0===n?void 0:n.reverse())||[],[3,4];case 3:Nt(e),r.label=4;case 4:return[2,e._lastViewedProducts]}})})}function Nt(t){d()||(t._lastViewedProducts=Ot(),t._lastViewedProducts=l(t._lastViewedProducts).reverse())}function Ot(){if(d())return[];try{var t=window.localStorage.getItem(C);if(t)return JSON.parse(t)}catch(t){console.error(t)}return[]}function Rt(e,n,i){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?e._lastViewedProducts.find(function(t){return t.productId===n})?[2]:[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,t.sent().apiSaveLastViewedProducts)({input:{customerId:e.customer.id,products:[{productId:n,variantId:i}]}})];case 2:return t.sent()&&e._lastViewedProducts.push({productId:n,variantId:i}),[3,4];case 3:e._lastViewedProducts=Ot(),e._lastViewedProducts=e._lastViewedProducts.filter(function(t){return t.productId!==n}),e._lastViewedProducts.push({productId:n,variantId:i}),e._lastViewedProducts=e._lastViewedProducts.slice(-20),function(t){d()||window.localStorage.setItem(C,JSON.stringify(t._lastViewedProducts))}(e),t.label=4;case 4:return[2]}})})}function At(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:if(d())return[2];r.label=1;case 1:return r.trys.push([1,5,,6]),(t=Ot()).length?[4,import("../../api/customer/index.js")]:[3,4];case 2:return[4,(0,r.sent().apiSaveLastViewedProducts)({input:{customerId:e.customer.id,products:t}})];case 3:r.sent()&&(d()||window.localStorage.removeItem(C)),r.label=4;case 4:return[3,6];case 5:return n=r.sent(),console.error(n),[3,6];case 6:return[2]}})})}function Vt(t){return t._customerConsentGranted}function Ut(t){d()||window.localStorage.removeItem(L)}function Dt(t){var e;return{addresses:null===(e=t.addresses)||void 0===e?void 0:e.map(function(t){return{addressLine1:t.addressLine1,addressLine2:t.addressLine2,city:t.city,company:t.company,country:t.country,createdAt:t.createdAt,deleted:t.deleted,district:t.district,firstName:t.firstName,id:t.id,identityNumber:t.identityNumber,isDefault:t.isDefault,lastName:t.lastName,phone:t.phone,postalCode:t.postalCode,region:t.region,state:t.state,taxNumber:t.taxNumber,taxOffice:t.taxOffice,title:t.title,updatedAt:t.updatedAt}}),attributes:t.attributes,birthDate:t.birthDate,firstName:t.firstName,gender:t.gender,lastName:t.lastName,phone:t.phone,phoneSubscriptionStatus:t.phoneSubscriptionStatus,smsSubscriptionStatus:t.smsSubscriptionStatus,subscriptionStatus:t.subscriptionStatus}}function Mt(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../api/loyalty/index.js")];case 1:return[4,(0,t.sent().apiListEarningMethods)()];case 2:return[2,t.sent().data]}})})}function Bt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return[4,ht(e)];case 1:return r.sent(),(t=null===(n=u.cart)||void 0===n?void 0:n.id)?[4,import("../../api/loyalty/index.js")]:[2,[]];case 2:return[4,(0,r.sent().apiListSpendingMethodsByCartId)({cartId:t})];case 3:return[2,r.sent().data]}})})}function Gt(e){return t(this,void 0,void 0,function(){var t,n,i,o,s,a,c;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),[4,ht(e)];case 1:return r.sent(),t=null===(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 Wt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return[4,ht(e)];case 1:return r.sent(),Ht(e)?(t=null===(n=u.cart)||void 0===n?void 0:n.id,[4,import("../../api/loyalty/index.js")]):[2,null];case 2:return[4,(0,r.sent().apiGetLoyaltyCustomerInfo)({cartId:t})];case 3:return[2,r.sent().data||null]}})})}function qt(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../api/loyalty/index.js")];case 1:return[4,(0,t.sent().apiListLoyaltyProgramTiers)()];case 2:return[2,t.sent().data]}})})}function Kt(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../api/loyalty/index.js")];case 1:return[4,(0,t.sent().apiListLoyaltyProgramPointHistory)(n)];case 2:return[2,t.sent().data]}})})}function zt(n,i){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return(t=null===(n=u.cart)||void 0===n?void 0:n.id)?[4,import("../../api/loyalty/index.js")]:[2,null];case 1:return[4,(0,r.sent().apiUseLoyaltyPoints)({input:e(e({},i.input),{cartId:t})})];case 2:return[2,r.sent().data||null]}})})}function Ht(t){return!!t.customer}function Jt(t){return t._accountInfoForm||(t._accountInfoForm={},_(t._accountInfoForm)),t._accountInfoForm}function Xt(t){t._accountInfoForm=null}function Yt(t){return t._contactForm||(t._contactForm={},w(t._contactForm)),t._contactForm}function Qt(t){t._contactForm=null}function Zt(t){return t._couponCodeForm||(t._couponCodeForm={},g(t._couponCodeForm)),t._couponCodeForm}function $t(t){t._couponCodeForm=null}function te(t){return t._forgotPasswordForm||(t._forgotPasswordForm={},b(t._forgotPasswordForm)),t._forgotPasswordForm}function ee(t){t._forgotPasswordForm=null}function re(t){return t._loginForm||(t._loginForm={},I(t._loginForm)),t._loginForm}function ne(t){return t._smsLoginForm||(t._smsLoginForm={},T(t._smsLoginForm)),t._smsLoginForm}function ie(t){return t._verifyPhoneNumberForm||(t._verifyPhoneNumberForm={},j(t._verifyPhoneNumberForm)),t._verifyPhoneNumberForm}function oe(t){t._loginForm=null}function se(t){return t._newsletterSubscriptionForm||(t._newsletterSubscriptionForm={},S(t._newsletterSubscriptionForm)),t._newsletterSubscriptionForm}function ae(t){t._newsletterSubscriptionForm=null}function ce(t){return t._orderTrackingForm||(t._orderTrackingForm={},y(t._orderTrackingForm)),t._orderTrackingForm}function ue(t){t._orderTrackingForm=null}function de(t){return t._recoverPasswordForm||(t._recoverPasswordForm={},k(t._recoverPasswordForm)),t._recoverPasswordForm}function le(t){t._recoverPasswordForm=null}function me(t){return t._registerForm||(t._registerForm={},x(t._registerForm)),t._registerForm}function fe(t){t._registerForm=null}function pe(t){var e={};return v(e),o(e)}function ve(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return"ORDER_DETAIL"!==c.currentPageType||"undefined"==typeof window?[3,4]:(t=a.getCurrentPath().split("/").pop(),!i.isPreview||t&&"orders"!==t?[3,2]:[4,tt(e)]);case 1:(n=r.sent()).length&&(t=n[0].id),r.label=2;case 2:return t?[4,et(e,t)]:[3,4];case 3:return[2,r.sent()];case 4:return[2]}})})}function he(t){try{window.openIkasStorefrontWidget()}catch(t){console.error("Failed to open ikas storefront widget",t)}}function _e(t){try{window.closeIkasStorefrontWidget()}catch(t){console.error("Failed to close ikas storefront widget",t)}}export{q as activateCustomer,st as addProductToFavorites,O as canCustomerCreateEmailSubscription,Y as checkEmail,Xt as clearAccountInfoForm,Qt as clearContactForm,$t as clearCouponCodeForm,ee as clearForgotPasswordForm,oe as clearLoginForm,ae as clearNewsletterSubscriptionForm,ue as clearOrderTrackingForm,le as clearRecoverPasswordForm,fe as clearRegisterForm,_e as closeIkasStorefrontWidget,dt as createEmailSubscription,Wt as cs_getLoyaltyCustomerInfo,Mt as cs_listEarningMethods,Kt as cs_listLoyaltyProgramPointHistory,qt as cs_listLoyaltyProgramTiers,Bt as cs_listSpendingMethodsByCartId,Gt as cs_removeLoyaltyPointsFromCart,zt as cs_useLoyaltyPoints,B as customerLogin,Rt as customerStore_onProductView,R as customerToAnalyticsCustomer,ft as deactivateCustomer,D as deleteCustomerAddress,pt as exportCustomerPersonalData,Q as forgotPassword,Jt as getAccountInfoForm,Yt as getContactForm,Zt as getCouponCodeForm,wt as getCustomerAttributes,Vt as getCustomerConsentGranted,bt as getDigitalProductFileDownloadUrl,pe as getEmptyAddressForm,ot as getFavoriteProducts,it as getFavoriteProductsIds,te as getForgotPasswordForm,Lt as getLastViewedProducts,re as getLoginForm,se as getNewsletterSubscriptionForm,et as getOrder,rt as getOrderByEmail,ve as getOrderDetailsOfPage,gt as getOrderProductFiles,It as getOrderRefundSettings,ce as getOrderTrackingForm,nt as getOrderTransactions,tt as getOrders,de as getRecoverPasswordForm,me as getRegisterForm,ne as getSmsLoginForm,ie as getVerifyPhoneNumberForm,vt as handleCustomerConsentGrant,V as handleSocialLogin,Ht as hasCustomer,N as initCustomerStore,ut as isFavoriteProduct,G as logout,he as openIkasStorefrontWidget,Z as recoverPassword,M as refundOrder,W as register,Ut as removeCustomerConsent,at as removeProductFromFavorites,K as resendCustomerActivationMail,J as resendCustomerPhoneVerificationCode,X as saveContactForm,$ as saveCustomer,lt as saveCustomerFormData,mt as sendReview,Ft as setCaptchaToken,Ct as setSavedLastViewedProductsResponse,A as socialLogin,U as socialLoginToken,z as validateCustomerPhoneVerificationCode,H as validateOTPCode,_t as waitForCaptchaTokenInit,ht 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 g}from"../../models/validator/coupon-code-form/index.js";import{initForgotPasswordForm as b}from"../../models/validator/forgot-password/index.js";import{initLoginForm as I}from"../../models/validator/login/index.js";import{initNewsletterSubscriptionForm as S}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 T}from"../../models/validator/sms-login/index.js";import{initVerifyPhoneNumberForm as j}from"../../models/validator/verify-phone-number/index.js";var E="customerToken",F="customerTokenExpiry",P="customerEmailSubscription",C="lastViewedProducts",L="customerConsent";function N(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return function(t){if(d())return;var e=localStorage.getItem(E),r=localStorage.getItem(F);e&&r?xt(t,e,parseInt(r)):Tt(t)}(e),Nt(e),function(t){if(d())return;t._customerConsentGranted=!!window.localStorage.getItem(L)}(e),[4,kt(e)];case 1:return t.sent(),[4,St(e)];case 2:return t.sent(),e._initialized=!0,[4,ct(e)];case 3:return t.sent(),e.customer?[4,import("../../../analytics/analytics-functions/customerVisit.js")]:[3,5];case 4:(0,t.sent().anl_customerVisit)(),t.label=5;case 5:return[2]}})})}function O(t){return!!t.customer&&(!(p(t.customer)||d()||t._visitorSubscribedEmail)&&!window.localStorage.getItem(P))}function R(t){return e(e({},t.customer),{consentGranted:t._customerConsentGranted})}function A(e,n){return t(this,void 0,void 0,function(){var t,e,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 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,U(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 U(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)?(xt(e,t.data.token,t.data.tokenExpiry),yt(e,t.data.customer),[4,import("../../../analytics/analytics-functions/customerLogin.js")]):[2,!1];case 3:return i=r.sent().anl_customerLogin,e.customer&&i(),[2,!0]}})})}function D(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:return(t=l(e.customer))&&t.addresses?-1===(i=t.addresses.findIndex(function(t){return t.id===n.id}))?[2,!1]:(t.addresses.splice(i,1),[4,$(e,t)]):[2,!1];case 1:return[2,r.sent()]}})})}function M(e,n,i){return t(this,void 0,void 0,function(){var t,e,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 B(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,Pt(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(),Et(e),t&&t.isSuccess&&t.data?(s=t.data,xt(e,s.token,s.tokenExpiry),s.customer&&yt(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 At(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 G(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return jt(e),m(u),[4,import("../../../analytics/analytics-functions/customerLogout.js")];case 1:return(0,t.sent().anl_customerLogout)(),[2]}})})}function W(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,Pt(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(),Et(e),t&&t.isSuccess&&(null===(l=t.data)||void 0===l?void 0:l.customer)?(xt(e,t.data.token,t.data.tokenExpiry),yt(e,t.data.customer),At(e),[4,import("../../../analytics/analytics-functions/completeRegistration.js")]):[3,5];case 4:return(0,r.sent().anl_completeRegistration)(R(e)),[2,{isSuccess:!0,errorCodes:[]}];case 5:return[2,{isSuccess:!1,errorCodes:t.errorCodes.map(function(t){return["EMAIL_IS_NOT_VERIFIED","CUSTOMER_EMAIL_ALREADY_EXISTS","B2B_CUSTOMER_ACCOUNT_DISABLED","PHONE_IS_NOT_VERIFIED"].includes(t)?t:"UNKOWN"})}]}})})}function q(e){return t(this,void 0,void 0,function(){var t,n,i;return r(this,function(r){switch(r.label){case 0:return t=new URLSearchParams(window.location.search),(n=t.get("token"))?[4,Pt(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(),Et(e),[2,i.isSuccess];case 4:return[2,!1]}})})}function K(e,n){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return n?[4,Pt(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(),Et(e),[2,t.isSuccess];case 4:return[2,!1]}})})}function z(e,n,i){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return n?[4,Pt(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(),Et(e),[2,!(!t.isSuccess||!t.data)&&t.data];case 4:return[2,!1]}})})}function H(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(),Et(n),t&&t.isSuccess&&(null===(s=t.data)||void 0===s?void 0:s.customer)?(xt(n,t.data.token,t.data.tokenExpiry),yt(n,t.data.customer),At(n),[4,import("../../../analytics/analytics-functions/completeRegistration.js")]):[3,4];case 3:return(0,r.sent().anl_completeRegistration)(R(n)),[2,{isSuccess:!0,errorCodes:[]}];case 4:return t&&t.isSuccess&&((null===(a=t.data)||void 0===a?void 0:a.otpSend)||(null===(c=t.data)||void 0===c?void 0:c.flowId))?[2,{isSuccess:!0,otpSend:!0,flowId:null===(u=t.data)||void 0===u?void 0:u.flowId,errorCodes:[]}]:t.errorCodes.some(function(t){return"B2B_CUSTOMER_ACCOUNT_DISABLED"===t})?[4,import("../../../analytics/analytics-functions/completeRegistration.js")]:[3,6];case 5:(0,r.sent().anl_completeRegistration)(e(e({},R(n)),{notificationsAccepted:null}),!0),r.label=6;case 6:return[2,{isSuccess:!1,errorCodes:t.errorCodes.map(function(t){return["EMAIL_IS_NOT_VERIFIED","CUSTOMER_EMAIL_ALREADY_EXISTS","B2B_CUSTOMER_ACCOUNT_DISABLED","PHONE_IS_NOT_VERIFIED"].includes(t)?t:"UNKOWN"})}];case 7:return r.sent(),[2,{isSuccess:!1,errorCodes:[]}];case 8:return[2]}})})}function J(e){return t(this,void 0,void 0,function(){var t;return r(this,function(e){switch(e.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,e.sent().apiResendCustomerPhoneVerificationCode)()];case 2:return[2,!(!(t=e.sent()).isSuccess||!t.data)&&t.data]}})})}function X(n,i){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,import("../../../analytics/analytics-functions/contactForm.js")];case 1:return(0,r.sent().anl_contactForm)(i),[4,Pt(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(),Et(n),[2,t.isSuccess]}})})}function Y(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:return[4,Pt(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(),Et(e),[2,!!t.isSuccess&&!!(null===(i=t.data)||void 0===i?void 0:i.exists)]}})})}function Q(e,n){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,Pt(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(),Et(e),[2,!!t.isSuccess&&t.data]}})})}function Z(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,Pt(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(),Et(e),[2,t.isSuccess]}})})}function $(e,n){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiSaveCustomer)({input:Dt(n)})];case 2:return(t=r.sent()).isSuccess&&t.data?(yt(e,t.data),[2,!0]):[2,!1]}})})}function tt(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,ht(e)];case 1:return t.sent(),e.customer?[4,import("../../api/customer/index.js")]:[2,[]];case 2:return[4,(0,t.sent().apiGetOrders)({})];case 3:return[2,t.sent().data||[]]}})})}function et(e,n){return t(this,void 0,void 0,function(){var o,s,a,c,u,d,l,m=this;return r(this,function(f){switch(f.label){case 0:return[4,ht(e)];case 1:return f.sent(),e.customer?(o=n,!i.isPreview||o&&"orders"!==o?[3,3]:[4,tt(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})]}})}),It(e),nt(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 rt(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([It(e),nt(e,{orderId:o.id})])]):[2,null];case 3:return s=r.sent(),a=s[1],o.transactions=a,[2,o]}})})}function nt(e){return t(this,arguments,void 0,function(t,e){var n;return void 0===e&&(e={}),r(this,function(t){switch(t.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return n=t.sent().apiListOrderTransactions,e.orderId||e.checkoutId||e.id?[4,n({checkoutId:{eq:e.checkoutId},id:{eq:e.checkoutId},orderId:{eq:e.orderId}})]:[2,[]];case 2:return[2,t.sent().data||[]]}})})}function it(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[2,[]];case 1:return[4,(0,t.sent().apiListFavoriteProducts)()];case 2:return[2,t.sent().data||[]]}})})}function ot(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,ct(e)];case 1:return 0===(t=r.sent()).length?[2,[]]:[4,import("../../api/product/index.js")];case 2:return[4,(0,r.sent().apiSearchProducts)({input:{productIdList:t.map(function(t){return t.productId}),priceListId:i.priceListId,salesChannelId:i.salesChannelId,perPage:100}})];case 3:return n=r.sent(),null===(a=null===(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 st(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:if(!(null===(i=e.customer)||void 0===i?void 0:i.id))throw Error("Unauthorized");return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiSaveFavoriteProduct)({isFavorite:!0,productId:n})];case 2:return t=r.sent(),[4,import("../../../analytics/analytics-functions/addToWishlist.js")];case 3:return(0,r.sent().anl_addToWishlist)(n),t.isSuccess?[4,ct(e,!0)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2,t.data||!1]}})})}function at(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:if(!(null===(i=e.customer)||void 0===i?void 0:i.id))throw Error("Unauthorized");return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiSaveFavoriteProduct)({isFavorite:!1,productId:n})];case 2:return t=r.sent(),[4,import("../../../analytics/analytics-functions/addToWishlist.js")];case 3:return(0,r.sent().anl_addToWishlist)(n,!0),t.isSuccess?[4,ct(e,!0)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2,t.data||!1]}})})}function ct(e){return t(this,arguments,void 0,function(t,e){var n;return void 0===e&&(e=!1),r(this,function(r){switch(r.label){case 0:return[4,ht(t)];case 1:return r.sent(),t.customer?t._isFavoriteProductsLoaded&&!e?[3,3]:[4,it(t)]:[2,[]];case 2:n=r.sent(),t._favoriteProducts=n,t._isFavoriteProductsLoaded=!0,r.label=3;case 3:return[2,t._favoriteProducts]}})})}function ut(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){return[2,e._favoriteProducts.some(function(t){return t.productId===n})]})})}function dt(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:return[4,Pt(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 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,Pt(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 mt(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 ft(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,t.sent().apiDeactivateCustomer)({password:n})];case 2:return[2,t.sent()];case 3:return[2]}})})}function pt(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,t.sent().apiExportCustomerPersonalData)()];case 2:return[2,t.sent()];case 3:return[2]}})})}function vt(t){!function(t){if(d())return;t._customerConsentGranted=!0,window.localStorage.setItem(L,"true")}(t)}function ht(e){return t(this,void 0,void 0,function(){return r(this,function(t){return d()?[2]:[2,new Promise(function(t){var r=setInterval(function(){e._initialized&&(clearInterval(r),t(null))},100)})]})})}function _t(t){return new Promise(function(e){var r=setInterval(function(){t._captchaToken&&(clearInterval(r),e(null))},100)})}function wt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiListCustomerAttribute)()];case 2:return t=r.sent(),e.customer&&(null===(n=e.customer.attributes)||void 0===n||n.forEach(function(e){var r,n,i;e.customerAttribute=(null===(r=t.data)||void 0===r?void 0:r.find(function(t){return t.id===e.customerAttributeId}))||null,e.customerAttributeOptionId&&(e.customerAttributeOption=(null===(i=null===(n=e.customerAttribute)||void 0===n?void 0:n.options)||void 0===i?void 0:i.find(function(t){return t.id===e.customerAttributeOptionId}))||null)})),[2,t.data||[]]}})})}function gt(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return n.length?[4,import("../../api/checkout/index.js")]:[2,[]];case 1:return[4,(0,t.sent().apiListProductFile)({id:{in:n}})];case 2:return[2,t.sent().data||[]]}})})}function bt(e,n,i){return t(this,void 0,void 0,function(){var t,e,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 It(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 St(e){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return d()||!e._token?[2]:[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiGetCustomer)()];case 2:return(t=r.sent()).data&&yt(e,t.data),[2]}})})}function yt(t,e){t.customer=e}function kt(e){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return e._token?[4,import("../../api/customer/index.js")]:[2];case 1:return[4,(0,r.sent().apiRefreshToken)({token:e._token})];case 2:if((t=r.sent()).isSuccess&&t.data)xt(e,t.data.token,t.data.tokenExpiry);else{if(t.isCancelled||t.isNetworkError)return[2];console.log("refreshToken error",t),e._token=null,e._tokenExpiry=null,jt(e)}return[2]}})})}function xt(t,e,r){d()||(t._token=e,t._tokenExpiry=r,localStorage.setItem(E,e),localStorage.setItem(F,r+""),i.init({customerToken:e}),n.TOKEN=e)}function Tt(t){localStorage.removeItem(E),localStorage.removeItem(F),t._token=null,t._tokenExpiry=null}function jt(t){Tt(t),t.customer=null,t._favoriteProducts=[],t._isFavoriteProductsLoaded=!1,i.init({customerToken:""}),n.TOKEN="",Et(t)}function Et(t){t._captchaToken=null}function Ft(t,e){t._captchaToken=e}function Pt(e){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),i.isCaptchaRequired()?(window.grecaptcha.execute(),[4,_t(e)]):[3,2];case 1:r.sent(),window.grecaptcha.reset(),r.label=2;case 2:return[3,4];case 3:return t=r.sent(),console.log("Get captcha error",t),[3,4];case 4:return[2]}})})}function Ct(t,e){t._savedLastViewedProducts=l(t._lastViewedProducts),t._savedLastViewedProductsResponse=e}function Lt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,r.sent().apiGetLastViewedProducts)({customerId:e.customer.id})];case 2:return t=r.sent(),e._lastViewedProducts=(null===(n=l(t.data))||void 0===n?void 0:n.reverse())||[],[3,4];case 3:Nt(e),r.label=4;case 4:return[2,e._lastViewedProducts]}})})}function Nt(t){d()||(t._lastViewedProducts=Ot(),t._lastViewedProducts=l(t._lastViewedProducts).reverse())}function Ot(){if(d())return[];try{var t=window.localStorage.getItem(C);if(t)return JSON.parse(t)}catch(t){console.error(t)}return[]}function Rt(e,n,i){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?e._lastViewedProducts.find(function(t){return t.productId===n})?[2]:[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,t.sent().apiSaveLastViewedProducts)({input:{customerId:e.customer.id,products:[{productId:n,variantId:i}]}})];case 2:return t.sent()&&e._lastViewedProducts.push({productId:n,variantId:i}),[3,4];case 3:e._lastViewedProducts=Ot(),e._lastViewedProducts=e._lastViewedProducts.filter(function(t){return t.productId!==n}),e._lastViewedProducts.push({productId:n,variantId:i}),e._lastViewedProducts=e._lastViewedProducts.slice(-20),function(t){d()||window.localStorage.setItem(C,JSON.stringify(t._lastViewedProducts))}(e),t.label=4;case 4:return[2]}})})}function At(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:if(d())return[2];r.label=1;case 1:return r.trys.push([1,5,,6]),(t=Ot()).length?[4,import("../../api/customer/index.js")]:[3,4];case 2:return[4,(0,r.sent().apiSaveLastViewedProducts)({input:{customerId:e.customer.id,products:t}})];case 3:r.sent()&&(d()||window.localStorage.removeItem(C)),r.label=4;case 4:return[3,6];case 5:return n=r.sent(),console.error(n),[3,6];case 6:return[2]}})})}function Vt(t){return t._customerConsentGranted}function Ut(t){d()||window.localStorage.removeItem(L)}function Dt(t){var e;return{addresses:null===(e=t.addresses)||void 0===e?void 0:e.map(function(t){return{addressLine1:t.addressLine1,addressLine2:t.addressLine2,city:t.city,company:t.company,country:t.country,createdAt:t.createdAt,deleted:t.deleted,district:t.district,firstName:t.firstName,id:t.id,identityNumber:t.identityNumber,isDefault:t.isDefault,lastName:t.lastName,phone:t.phone,postalCode:t.postalCode,region:t.region,state:t.state,taxNumber:t.taxNumber,taxOffice:t.taxOffice,title:t.title,updatedAt:t.updatedAt}}),attributes:t.attributes,birthDate:t.birthDate,firstName:t.firstName,gender:t.gender,lastName:t.lastName,phone:t.phone,phoneSubscriptionStatus:t.phoneSubscriptionStatus,smsSubscriptionStatus:t.smsSubscriptionStatus,subscriptionStatus:t.subscriptionStatus}}function Mt(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../api/loyalty/index.js")];case 1:return[4,(0,t.sent().apiListEarningMethods)()];case 2:return[2,t.sent().data]}})})}function Bt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return[4,ht(e)];case 1:return r.sent(),(t=null===(n=u.cart)||void 0===n?void 0:n.id)?[4,import("../../api/loyalty/index.js")]:[2,[]];case 2:return[4,(0,r.sent().apiListSpendingMethodsByCartId)({cartId:t})];case 3:return[2,r.sent().data]}})})}function Gt(e){return t(this,void 0,void 0,function(){var t,n,i,o,s,a,c;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),[4,ht(e)];case 1:return r.sent(),t=null===(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 Wt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return[4,ht(e)];case 1:return r.sent(),Ht(e)?(t=null===(n=u.cart)||void 0===n?void 0:n.id,[4,import("../../api/loyalty/index.js")]):[2,null];case 2:return[4,(0,r.sent().apiGetLoyaltyCustomerInfo)({cartId:t})];case 3:return[2,r.sent().data||null]}})})}function qt(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../api/loyalty/index.js")];case 1:return[4,(0,t.sent().apiListLoyaltyProgramTiers)()];case 2:return[2,t.sent().data]}})})}function Kt(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../api/loyalty/index.js")];case 1:return[4,(0,t.sent().apiListLoyaltyProgramPointHistory)(n)];case 2:return[2,t.sent().data]}})})}function zt(n,i){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return(t=null===(n=u.cart)||void 0===n?void 0:n.id)?[4,import("../../api/loyalty/index.js")]:[2,null];case 1:return[4,(0,r.sent().apiUseLoyaltyPoints)({input:e(e({},i.input),{cartId:t})})];case 2:return[2,r.sent().data||null]}})})}function Ht(t){return!!t.customer}function Jt(t){return t._accountInfoForm||(t._accountInfoForm={},_(t._accountInfoForm)),t._accountInfoForm}function Xt(t){t._accountInfoForm=null}function Yt(t){return t._contactForm||(t._contactForm={},w(t._contactForm)),t._contactForm}function Qt(t){t._contactForm=null}function Zt(t){return t._couponCodeForm||(t._couponCodeForm={},g(t._couponCodeForm)),t._couponCodeForm}function $t(t){t._couponCodeForm=null}function te(t){return t._forgotPasswordForm||(t._forgotPasswordForm={},b(t._forgotPasswordForm)),t._forgotPasswordForm}function ee(t){t._forgotPasswordForm=null}function re(t){return t._loginForm||(t._loginForm={},I(t._loginForm)),t._loginForm}function ne(t){return t._smsLoginForm||(t._smsLoginForm={},T(t._smsLoginForm)),t._smsLoginForm}function ie(t){return t._verifyPhoneNumberForm||(t._verifyPhoneNumberForm={},j(t._verifyPhoneNumberForm)),t._verifyPhoneNumberForm}function oe(t){t._loginForm=null}function se(t){return t._newsletterSubscriptionForm||(t._newsletterSubscriptionForm={},S(t._newsletterSubscriptionForm)),t._newsletterSubscriptionForm}function ae(t){t._newsletterSubscriptionForm=null}function ce(t){return t._orderTrackingForm||(t._orderTrackingForm={},y(t._orderTrackingForm)),t._orderTrackingForm}function ue(t){t._orderTrackingForm=null}function de(t){return t._recoverPasswordForm||(t._recoverPasswordForm={},k(t._recoverPasswordForm)),t._recoverPasswordForm}function le(t){t._recoverPasswordForm=null}function me(t){return t._registerForm||(t._registerForm={},x(t._registerForm)),t._registerForm}function fe(t){t._registerForm=null}function pe(t){var e={};return v(e),o(e)}function ve(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return"ORDER_DETAIL"!==c.currentPageType||"undefined"==typeof window?[3,4]:(t=a.getCurrentPath().split("/").pop(),!i.isPreview||t&&"orders"!==t?[3,2]:[4,tt(e)]);case 1:(n=r.sent()).length&&(t=n[0].id),r.label=2;case 2:return t?[4,et(e,t)]:[3,4];case 3:return[2,r.sent()];case 4:return[2]}})})}function he(t){try{window.openIkasStorefrontWidget()}catch(t){console.error("Failed to open ikas storefront widget",t)}}function _e(t){try{window.closeIkasStorefrontWidget()}catch(t){console.error("Failed to close ikas storefront widget",t)}}export{q as activateCustomer,st as addProductToFavorites,O as canCustomerCreateEmailSubscription,Y as checkEmail,Xt as clearAccountInfoForm,Qt as clearContactForm,$t as clearCouponCodeForm,ee as clearForgotPasswordForm,oe as clearLoginForm,ae as clearNewsletterSubscriptionForm,ue as clearOrderTrackingForm,le as clearRecoverPasswordForm,fe as clearRegisterForm,_e as closeIkasStorefrontWidget,dt as createEmailSubscription,Wt as cs_getLoyaltyCustomerInfo,Mt as cs_listEarningMethods,Kt as cs_listLoyaltyProgramPointHistory,qt as cs_listLoyaltyProgramTiers,Bt as cs_listSpendingMethodsByCartId,Gt as cs_removeLoyaltyPointsFromCart,zt as cs_useLoyaltyPoints,B as customerLogin,Rt as customerStore_onProductView,R as customerToAnalyticsCustomer,ft as deactivateCustomer,D as deleteCustomerAddress,pt as exportCustomerPersonalData,Q as forgotPassword,Jt as getAccountInfoForm,Yt as getContactForm,Zt as getCouponCodeForm,wt as getCustomerAttributes,Vt as getCustomerConsentGranted,bt as getDigitalProductFileDownloadUrl,pe as getEmptyAddressForm,ot as getFavoriteProducts,it as getFavoriteProductsIds,te as getForgotPasswordForm,Lt as getLastViewedProducts,re as getLoginForm,se as getNewsletterSubscriptionForm,et as getOrder,rt as getOrderByEmail,ve as getOrderDetailsOfPage,gt as getOrderProductFiles,It as getOrderRefundSettings,ce as getOrderTrackingForm,nt as getOrderTransactions,tt as getOrders,de as getRecoverPasswordForm,me as getRegisterForm,ne as getSmsLoginForm,ie as getVerifyPhoneNumberForm,vt as handleCustomerConsentGrant,V as handleSocialLogin,Ht as hasCustomer,N as initCustomerStore,ut as isFavoriteProduct,G as logout,he as openIkasStorefrontWidget,Z as recoverPassword,M as refundOrder,W as register,Ut as removeCustomerConsent,at as removeProductFromFavorites,K as resendCustomerActivationMail,J as resendCustomerPhoneVerificationCode,X as saveContactForm,$ as saveCustomer,lt as saveCustomerFormData,mt as sendReview,Ft as setCaptchaToken,Ct as setSavedLastViewedProductsResponse,A as socialLogin,U as socialLoginToken,z as validateCustomerPhoneVerificationCode,H as validateOTPCode,_t as waitForCaptchaTokenInit,ht as waitForCustomerStoreInit};
|
package/dist/index.d.ts
CHANGED
|
@@ -16,12 +16,15 @@ export * from "./stores/cart";
|
|
|
16
16
|
export * from "./stores/customer";
|
|
17
17
|
export * from "./theme/infinite-scroller";
|
|
18
18
|
export * from "./theme/overlay";
|
|
19
|
+
export * from "./theme/settings";
|
|
19
20
|
export * from "./theme/slider";
|
|
20
21
|
export * from "./theme/styles";
|
|
21
22
|
export * from "./utils/blueprint";
|
|
22
23
|
export * from "./utils/component-renderer";
|
|
23
24
|
export * from "./utils/fetch";
|
|
24
25
|
export * from "./utils/object-wrapper";
|
|
26
|
+
export * from "./utils/pay-with-ikas";
|
|
27
|
+
export * from "./utils/svg";
|
|
25
28
|
export type { APIErrorCode, APIResponse } from "./storefront-api/src";
|
|
26
29
|
export * from "./storefront-api/src";
|
|
27
30
|
export * from "./storefront-config/src";
|
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,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,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{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}from"./functions/stores/base/index.js";export{addItemToCart,addSelectedtedVariantToCart,changeCartItemQuantity,changeItemQuantity,createPayWithIkasSession,findExistingCartItem,findExistingCartItemWithProduct,getAcceptedOffers,getCart,getCheckoutUrlFromCartStore,hasCart,isOrderLineItemAutoCreated,removeCart,removeCouponCode,removeItem,saveCouponCode,setCart,waitForCartStoreInit,windowAddToCart}from"./functions/stores/cart/index.js";export{activateCustomer,addProductToFavorites,canCustomerCreateEmailSubscription,checkEmail,clearAccountInfoForm,clearContactForm,clearCouponCodeForm,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,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,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{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{HttpMethod,get,httpRequest,post}from"./utils/fetch.js";export{JsObject}from"./utils/object-wrapper.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 t from'./ext/animejs/lib/anime.esm.js';export{t as AnimeJS};export{cloneDeep,reaction}from"./utils/helper.js";export{APIErrorCode,APIResponse}from"./packages/storefront-api-client/src/utils/api.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,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{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,removeItem,saveCouponCode,setCart,waitForCartStoreInit,windowAddToCart}from"./functions/stores/cart/index.js";export{activateCustomer,addProductToFavorites,canCustomerCreateEmailSubscription,checkEmail,clearAccountInfoForm,clearContactForm,clearCouponCodeForm,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,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,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{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 +1 @@
|
|
|
1
|
-
import{__assign as
|
|
1
|
+
import{__assign as r}from'./../../../ext/tslib/tslib.es6.mjs.js';import{EMPTY_THEME_GLOBALS as t}from"./theme-globals.js";export{EMPTY_THEME_GLOBALS,breakpointCssToken,cssVarCamelCase,cssVarRef,isReservedVariableId,rawClassRef,resolveBreakpointMediaTokens,serializeThemeGlobals,toResolverBreakpoints}from"./theme-globals.js";var e=function(){function e(){}return e.addObserver=function(r){var t=e.observers.find(function(t){return t.id===r.id});t?t.callback=r.callback:e.observers.push(r),r.callback(e)},e.init=function(r){try{var t=["themeSecret"];Object.entries(r).forEach(function(r){var n=r[0],i=r[1];t.includes(n)||(e[n]="storefrontJSScripts"===n||"highPriorityStoreFrontJSScripts"===n?null==i?void 0:i.map(function(r){return o(r)}):i)}),r.token&&(e.apiKey=r.token),this.notify()}catch(r){console.error(r)}},e.getCurrentRouting=function(){return e.routings.find(function(r){return r.id===e.storefrontRoutingId})},e.getCurrentPath=function(){var r;return(null===(r=e.getCurrentRouting())||void 0===r?void 0:r.path)||""},e.getSupportedPaths=function(){return e.routings.map(function(r){var t;return(null===(t=r.path)||void 0===t?void 0:t.split("/")[0])||""})},e.getCurrentLocale=function(){var r=e.getCurrentRouting();return(null==r?void 0:r.locale)||"en"},e.getDefaultLocale=function(){var r=e.routings.find(function(r){return"/"===r.path||!r.path});return(null==r?void 0:r.locale)||"en"},e.getIsPreview=function(){return e.isPreview},e.notify=function(){var r=this;this.observers.forEach(function(t){return t.callback(r)})},e.isCustomerReviewEnabled=function(){var r=e.customerReviewSettings;return!!r&&!r.customerPurchaseRequired},e.isCustomerReviewLoginRequired=function(){var r=e.customerReviewSettings;return!r||r.customerLoginRequired},e.isBackInStockEnabled=function(){return!!e.productBackInStockSettings},e.isCustomerLoginRequiredForBackInStock=function(){var r=e.productBackInStockSettings;return r&&r.customerLoginRequired},e.toJSON=function(){var t=r({},this);return delete t.observers,t.storefrontJSScripts=this.storefrontJSScripts.map(function(r){return n(r)}),t.highPriorityStoreFrontJSScripts=this.highPriorityStoreFrontJSScripts.map(function(r){return n(r)}),t},e.isB2BStorefront=function(){return"B2B_STOREFRONT"===e.storefrontType},e.getDefaultCurrencyCode=function(){var r;return null===(r=e.getCurrentRouting())||void 0===r?void 0:r.currencyCode},e.getDefaultCurrencySymbol=function(){var r;return null===(r=e.getCurrentRouting())||void 0===r?void 0:r.currencySymbol},e.isCaptchaRequired=function(){var r;return(null===(r=e.customerSettings)||void 0===r?void 0:r.requireCaptchaValidation)||!1},e.getPayWithIkasUrl=function(){return e.payWithIkasUrl},e.routings=[],e.paymentGateways=[],e.translations={},e.themeGlobals=t,e.storefrontJSScripts=[],e.highPriorityStoreFrontJSScripts=[],e.isEditor=!1,e.observers=[],e.isPreview=!1,e}();function n(r){return"string"!=typeof r?(console.error("escapeForJSON: Input is not a string",r),""):r.replace(/<\/script\b/gi,"<\\/script")}function o(r){return"string"!=typeof r?(console.error("unescapeFromJSON: Input is not a string",r),""):r.replace(/<\\\/script\b/gi,"</script")}export{e as IkasStorefrontConfig,n as escapeForJSON,o as unescapeFromJSON};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=new RegExp(["[A-Z]?[a-z]+","[0-9]*(?:1ST|2ND|3RD|(?![123])[0-9]TH)(?=\\b|[a-z_])","[0-9]*(?:1st|2nd|3rd|(?![123])[0-9]th)(?=\\b|[A-Z_])","[A-Z]+(?![a-z])","[0-9]+","[A-Z]"].join("|"),"g");function e(e){return(String(e).match(n)||[]).map(function(n,e){var i=n.toLowerCase();return 0===e?i:i.charAt(0).toUpperCase()+i.slice(1)}).join("")}var i={settings:{},colors:[],typography:[],breakpoints:[],keyframes:[],colorSchemes:{schemes:[],values:[]}},r=function(n){return"var(--".concat(e(n),")")},l=function(n){return"_".concat(n)},t=function(n){return"bp(".concat(n,")")},u=function(n){return n.map(function(n){return{id:n.id,width:Number(n.width)||0}})},a=/\d*\.?\d+(?:e[+-]?\d+)?px|\d*\.?\d+(?:e[+-]?\d+)?|[()+\-*/]|\S/gi,o=function(n,e){var i=s(n,e);return i&&d(n,e,i)},d=function(n,e,i){var r=n[e.i];if("+"!==r&&"-"!==r)return i;e.i+=1;var l=s(n,e);return l&&l.isPx===i.isPx?d(n,e,{n:"+"===r?i.n+l.n:i.n-l.n,isPx:i.isPx}):null},s=function(n,e){var i=c(n,e);return i&&v(n,e,i)},v=function(n,e,i){var r=n[e.i];if("*"!==r&&"/"!==r)return i;e.i+=1;var l=c(n,e);return l?"*"===r?i.isPx&&l.isPx?null:v(n,e,{n:i.n*l.n,isPx:i.isPx||l.isPx}):l.isPx||0===l.n?null:v(n,e,{n:i.n/l.n,isPx:i.isPx}):null},c=function(n,e){var i,r=n[e.i];return"-"===r?(e.i+=1,(i=c(n,e))&&{n:-i.n,isPx:i.isPx}):"+"===r?(e.i+=1,c(n,e)):"("===r?(e.i+=1,(i=o(n,e))&&")"===n[e.i]?(e.i+=1,i):null):"object"==typeof r&&null!==r?(e.i+=1,r):null},f=function(n){var e=function(n){var e=(n.match(a)||[]).map(function(n){return/^\d*\.?\d+(?:e[+-]?\d+)?px$/i.test(n)?{n:parseFloat(n),isPx:!0}:/^\d*\.?\d+(?:e[+-]?\d+)?$/i.test(n)?{n:parseFloat(n),isPx:!1}:"()+-*/".includes(n)?n:null});return e.every(function(n){return null!==n})?e:null}(n.replace(/calc\(/gi,"("));if(!e)return null;var i={i:0},r=o(e,i);return r&&r.isPx&&i.i===e.length&&Number.isFinite(r.n)&&Math.abs(r.n)<1e8?r.n:null},m=function(n,e,i,r){if(e>=n.length||e>r)return-1;var l=n[e],t="("===l?i+1:")"===l?i-1:i;return 0===t?e:m(n,e+1,t,r)},p=function(n,e){return e.reduce(function(n,e){return n.split(t(e.id)).join("".concat(e.width,"px"))},n)},h=/^-(?:webkit|moz|ms|o)-$/i,y=/[-A-Za-z0-9_]+$/,x=function(n,e,i){var r=n.indexOf("bp(",i);if(-1===r)return n;var l=Math.max(i,r-512-5),t=n.slice(l,r+5).indexOf("calc("),u=-1===t?-1:l+t;if(-1===u||u>r)return x(n,e,r+3);var a=y.exec(n.slice(Math.max(0,u-12),u)),o=a?a[0]:"",d=h.test(o)&&!y.test(n.slice(u-o.length-1,u-o.length));if(o&&!d)return x(n,e,u+5);var s=d?u-o.length:u,v=u+4,c=m(n,v,0,v+512);if(-1===c)return x(n,e,u+5);if(c<r)return x(n,e,c+1);var g=p(n.slice(v+1,c),e),b=f(g);if(null===b)return x(n,e,u+5);var P="".concat(parseFloat(b.toFixed(4)),"px");return x(n.slice(0,s)+P+n.slice(c+1),e,s+P.length)};function g(n,e){if(!n||!n.includes("bp("))return n;var i=x(n,e,0);return i.includes("bp(")?p(i,e):i}var b=function(n){var e;if(n)return Array.isArray(n)?null===(e=n[0])||void 0===e?void 0:e.value:n},P=function(n){var e,i=n;if(!i)return null;if(i.patternValueId)return r(i.patternValueId);if(i.colorSchemeId)return r(i.colorSchemeId);if(i.keyframeValueId)return l(i.keyframeValueId);var t=i.value;return null==t?null:"object"==typeof t?"string"==typeof t.css?t.css:null!=t.value?"".concat(t.value).concat(null!==(e=t.unit)&&void 0!==e?e:""):null:String(t)},S=/^__.+__$/,N=function(n){return S.test(null!=n?n:"")};function A(n){var t,u,a,o,d,s,v,c,f,m,p,h,y,x,g,S;if(!n)return i;for(var A=null===(t=n.theme)||void 0===t?void 0:t.pattern,I={},k=0,V=null!==(o=null===(a=null===(u=n.globalsBlueprint)||void 0===u?void 0:u.module)||void 0===a?void 0:a.variables)&&void 0!==o?o:[];k<V.length;k++){var w=V[k];if(!1!==w.isGlobal&&w.variableName&&(!N(w.id)&&!N(w.variableName))){var _=null!==(d=w.variableType)&&void 0!==d?d:"TEXT";I[w.variableName]={name:w.variableName,displayName:null!==(s=w.displayName)&&void 0!==s?s:w.variableName,type:_,value:"BOOLEAN"===_?!!w.defaultValue:null!==(v=w.defaultValue)&&void 0!==v?v:null}}}var D=(null!==(c=null==A?void 0:A.values)&&void 0!==c?c:[]).map(function(n){var e,i;return{id:n.id,name:null!==(e=n.name)&&void 0!==e?e:n.id,resolved:P(b(null===(i=n.style)||void 0===i?void 0:i.value)),cssVar:r(n.id)}}),j=function(n){return(null!=n?n:[]).map(function(n){return{property:n.property,value:P(b(n.value))}}).filter(function(n){return null!=n.value})},z=(null!==(f=null==A?void 0:A.elements)&&void 0!==f?f:[]).map(function(n){for(var i,r={},t=0,u=j(n.styles);t<u.length;t++){var a=u[t],o=a.property,d=a.value;r[e(o)]=d}return{id:n.id,name:null!==(i=n.name)&&void 0!==i?i:n.id,resolved:r,className:l(n.id),isDefault:!!n.isDefault}}),F=(null!==(p=null===(m=n.theme)||void 0===m?void 0:m.breakpoints)&&void 0!==p?p:[]).map(function(n){var e,i;return{id:n.id,name:null!==(e=n.name)&&void 0!==e?e:n.id,width:null!==(i=n.width)&&void 0!==i?i:0}}),T=(null!==(y=null===(h=n.theme)||void 0===h?void 0:h.keyframes)&&void 0!==y?y:[]).map(function(n){var e,i,r;return{id:n.id,name:null!==(e=n.name)&&void 0!==e?e:n.id,type:null!==(i=n.type)&&void 0!==i?i:"keyframe",ref:l(n.id),settings:j(n.styles),points:(null!==(r=n.points)&&void 0!==r?r:[]).map(function(n){return{point:n.point,styles:j(n.styles)}})}}),Z=(null!==(x=null==A?void 0:A.colorSchemes)&&void 0!==x?x:[]).map(function(n){var e;return{id:n.id,name:null!==(e=n.name)&&void 0!==e?e:n.id}}),$=null!==(g=null==A?void 0:A.colorSchemes)&&void 0!==g?g:[],O=null!==(S=null==A?void 0:A.colorSchemeValues)&&void 0!==S?S:[],B=O.map(function(n){for(var e,i,t,u,a=function(n){var e,i;return null!==(i=null===(e=O.find(function(e){return e.isDefault&&(n?e.designAssetId===n:!e.designAssetId)}))||void 0===e?void 0:e.colors)&&void 0!==i?i:[]}(n.designAssetId),o={},d=function(l){var u=null===(e=n.colors)||void 0===e?void 0:e.find(function(n){return n.colorSchemeId===l.id}),d=u?void 0:a.find(function(n){return n.colorSchemeId===l.id});o[l.id]={resolved:null!==(t=P(null!==(i=null==u?void 0:u.style)&&void 0!==i?i:null==d?void 0:d.style))&&void 0!==t?t:"#ffffff",cssVar:r(l.id)}},s=0,v=$;s<v.length;s++){d(v[s])}return{id:n.id,name:null!==(u=n.name)&&void 0!==u?u:n.id,isDefault:!!n.isDefault,className:l(n.id),colorsByScheme:o}});return{settings:I,colors:D,typography:z,breakpoints:F,keyframes:T,colorSchemes:{schemes:Z,values:B}}}export{i as EMPTY_THEME_GLOBALS,t as breakpointCssToken,e as cssVarCamelCase,r as cssVarRef,N as isReservedVariableId,l as rawClassRef,g as resolveBreakpointMediaTokens,A as serializeThemeGlobals,u as toResolverBreakpoints};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { IkasCustomerReviewSettings, IkasCustomerSettings, IkasIndexPageSeoSetting, IkasLoyaltyProgram, IkasMerchantSettings, IkasProductBackInStockSettings, IkasSalesChannelPaymentGateway, IkasStorefontMetaTemplates, IkasStorefrontB2BSettings, IkasStorefrontPopup, IkasStorefrontRouting, IkasStorefrontType, IkasThemeStockPreference } from "../../storefront-models/src";
|
|
2
|
+
import { ThemeGlobals } from "./theme-globals";
|
|
3
|
+
export * from "./theme-globals";
|
|
2
4
|
export declare class IkasStorefrontConfig {
|
|
3
5
|
static themeId?: string;
|
|
4
6
|
static apiUrl?: string;
|
|
@@ -27,6 +29,7 @@ export declare class IkasStorefrontConfig {
|
|
|
27
29
|
static tiktokPixelId?: string;
|
|
28
30
|
static stockPreference?: IkasThemeStockPreference;
|
|
29
31
|
static translations: Record<string, any>;
|
|
32
|
+
static themeGlobals: ThemeGlobals;
|
|
30
33
|
static storefrontJSScripts: string[];
|
|
31
34
|
static highPriorityStoreFrontJSScripts: string[];
|
|
32
35
|
static customerReviewSettings?: IkasCustomerReviewSettings | null;
|
|
@@ -100,6 +103,7 @@ export type IkasStorefrontConfigParams = {
|
|
|
100
103
|
tiktokPixelId?: string;
|
|
101
104
|
stockPreference?: IkasThemeStockPreference;
|
|
102
105
|
translations: Record<string, any>;
|
|
106
|
+
themeGlobals: ThemeGlobals;
|
|
103
107
|
storefrontJSScripts: string[];
|
|
104
108
|
highPriorityStoreFrontJSScripts: string[];
|
|
105
109
|
customerReviewSettings?: IkasCustomerReviewSettings | null;
|