@ikas/bp-storefront 0.132.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/functions/models/validator/account-info/index.d.ts +17 -0
- package/dist/functions/models/validator/account-info/index.js +1 -1
- package/dist/functions/models/validator/address/index.js +1 -1
- package/dist/functions/stores/customer/index.d.ts +1 -1
- package/dist/functions/stores/customer/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/router/index.d.ts +19 -0
- package/dist/router/index.js +1 -1
- package/dist/storefront-api/src/__api/types/index.d.ts +5 -3
- package/dist/storefront-models/src/models/storefront-popup/index.d.ts +1 -0
- package/dist/storefront-models/src/models/storefront-popup/storefront-popup-display-filter/index.d.ts +4 -3
- package/dist/storefront-models/src/models/validator/account-info/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -66,6 +66,23 @@ export declare function setAccountInfoFormLastName(accountInfoForm: AccountInfoF
|
|
|
66
66
|
* ```
|
|
67
67
|
*/
|
|
68
68
|
export declare function setAccountInfoFormPhone(accountInfoForm: AccountInfoForm, value: string): void;
|
|
69
|
+
/**
|
|
70
|
+
* Sets the marketing acceptance field on the account info form and re-validates if the form has already been submitted.
|
|
71
|
+
*
|
|
72
|
+
* @ai-category AccountInfo, Form
|
|
73
|
+
* @ai-related setAccountInfoFormFirstName, setAccountInfoFormLastName, setAccountInfoFormPhone, initAccountInfoForm, submitAccountInfoForm
|
|
74
|
+
*
|
|
75
|
+
* @param accountInfoForm - The AccountInfoForm instance to update.
|
|
76
|
+
* @param value - The new marketing acceptance value.
|
|
77
|
+
* @returns void
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* import { setAccountInfoFormIsMarketingAccepted } from "@ikas/bp-storefront";
|
|
82
|
+
* setAccountInfoFormIsMarketingAccepted(accountInfoForm, true);
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export declare function setAccountInfoFormIsMarketingAccepted(accountInfoForm: AccountInfoForm, value: boolean): void;
|
|
69
86
|
/**
|
|
70
87
|
* Validates and submits the account info form, saving the updated customer first name, last name, and phone to the server.
|
|
71
88
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as s,__assign as r}from'./../../../../ext/tslib/tslib.es6.mjs.js';import{I18n as
|
|
1
|
+
import{__awaiter as e,__generator as s,__assign as r}from'./../../../../ext/tslib/tslib.es6.mjs.js';import{I18n as i}from"../../../../i18n/index.js";import{customerStore as a}from"../../../../stores/customer/index.js";import"../../../../stores/base/index.js";import"../../../../packages/storefront-config/src/index.js";import"../../../../stores/cart/index.js";import'./../../../../ext/mobx/dist/mobx.esm.js';import"../../../../router/index.js";import'./../../../../ext/lodash/sortBy.js';import{waitForCustomerStoreInit as t,saveCustomer as o}from"../../../stores/customer/index.js";import{validateValue as n,FORM_ITEM_DEFAULT_VALUE as l}from"../index.js";import{isCustomerSubscribed as u}from"../../customer/index.js";function m(o){return e(this,void 0,void 0,function(){var e;return s(this,function(s){switch(s.label){case 0:return[4,t(a)];case 1:return s.sent(),e=a.customer,o.firstName=r(r({},l),{value:(null==e?void 0:e.firstName)||"",isRequired:!0,label:i.translate("label.first_name"),placeholder:i.translate("placeholder.first_name")}),o.lastName=r(r({},l),{value:(null==e?void 0:e.lastName)||"",isRequired:!0,label:i.translate("label.last_name"),placeholder:i.translate("placeholder.last_name")}),o.phone=r(r({},l),{value:(null==e?void 0:e.phone)||"",isRequired:!1,label:i.translate("label.phone"),placeholder:i.translate("placeholder.phone")}),o.isMarketingAccepted={value:!!e&&u(e),hasError:!1,message:void 0},o.isInitialized=!0,o.isSubmitted=!1,o.isSubmitting=!1,o.isSuccess=void 0,o.isFailure=void 0,o.responseMessage=void 0,[2]}})})}function d(e,s){e.firstName&&(e.firstName.value=s),e.isSubmitted&&f(e)}function c(e,s){e.lastName&&(e.lastName.value=s),e.isSubmitted&&f(e)}function v(e,s){e.phone&&(e.phone.value=s),e.isSubmitted&&f(e)}function p(e,s){e.isMarketingAccepted&&(e.isMarketingAccepted.value=s,e.isSubmitted&&f(e))}function h(t){return e(this,void 0,void 0,function(){var e,n,l,u,m;return s(this,function(s){switch(s.label){case 0:return t.isSubmitted=!0,t.isSuccess=void 0,t.isFailure=void 0,t.responseMessage=void 0,f(t)?[2,!1]:(t.isSubmitting=!0,[4,o(a,r(r({},a.customer),{firstName:null===(n=t.firstName)||void 0===n?void 0:n.value,lastName:null===(l=t.lastName)||void 0===l?void 0:l.value,phone:null===(u=t.phone)||void 0===u?void 0:u.value,subscriptionStatus:(null===(m=t.isMarketingAccepted)||void 0===m?void 0:m.value)?"SUBSCRIBED":"NOT_SUBSCRIBED"}))]);case 1:return e=s.sent(),t.isSubmitting=!1,e?(t.isSuccess=!0,t.responseMessage=i.translate("notification.success.account_info"),[2,!0]):(t.isFailure=!0,t.responseMessage=i.translate("notification.failure.account_info"),[2,!1])}})})}function f(e){if(!e.firstName||!e.lastName||!e.phone)return!1;var s=n(e.firstName.value,{required:!0});s.hasError?(e.firstName.hasError=!0,e.firstName.message=s.message):(e.firstName.hasError=!1,e.firstName.message=void 0);var r=n(e.lastName.value,{required:!0});r.hasError?(e.lastName.hasError=!0,e.lastName.message=r.message):(e.lastName.hasError=!1,e.lastName.message=void 0);var i=n(e.phone.value,{phone:!0});return i.hasError?(e.phone.hasError=!0,e.phone.message=i.message):(e.phone.hasError=!1,e.phone.message=void 0),s.hasError||r.hasError||i.hasError}export{m as initAccountInfoForm,d as setAccountInfoFormFirstName,p as setAccountInfoFormIsMarketingAccepted,c as setAccountInfoFormLastName,v as setAccountInfoFormPhone,h as submitAccountInfoForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as i,__assign as t}from'./../../../../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as r}from"../../../../packages/storefront-config/src/index.js";import'./../../../../ext/uuid/dist/esm-browser/stringify.js';import'./../../../../ext/uuid/dist/esm-browser/v3.js';import n from'./../../../../ext/uuid/dist/esm-browser/v4.js';import'./../../../../ext/uuid/dist/esm-browser/v5.js';import{I18n as s}from"../../../../i18n/index.js";import{customerStore as o}from"../../../../stores/customer/index.js";import{cloneDeep as a}from"../../../../utils/helper.js";import{validateValue as d,FORM_ITEM_DEFAULT_VALUE as l}from"../index.js";function u(r,n){return e(this,void 0,void 0,function(){var e,s,o,a,d,u;return i(this,function(i){switch(i.label){case 0:return r.id=null==n?void 0:n.id,r.title=n?t(t({},l),{value:n.title||""}):l,r.firstName=n?t(t({},l),{value:n.firstName||""}):l,r.lastName=n?t(t({},l),{value:n.lastName||""}):l,r.identityNumber=n?t(t({},l),{value:n.identityNumber||""}):l,r.addressLine1=n?t(t({},l),{value:n.addressLine1||""}):l,r.addressLine2=n?t(t({},l),{value:n.addressLine2||""}):l,r.postalCode=n?t(t({},l),{value:n.postalCode||""}):l,r.country=n?t(t({},U),{value:(null===(e=n.country)||void 0===e?void 0:e.id)||""}):U,r.state=n?t(t({},U),{value:(null===(s=n.state)||void 0===s?void 0:s.id)||""}):U,r.city=n?t(t({},U),{value:(null===(o=n.city)||void 0===o?void 0:o.id)||(null===(a=n.city)||void 0===a?void 0:a.name)||""}):U,r.district=n?t(t({},U),{value:(null===(d=n.district)||void 0===d?void 0:d.id)||""}):U,r.region=n?t(t({},l),{value:(null===(u=n.region)||void 0===u?void 0:u.id)||""}):l,r.phone=n?t(t({},l),{value:n.phone||""}):l,r.company=n?t(t({},l),{value:n.company||""}):l,r.taxOffice=n?t(t({},l),{value:n.taxOffice||""}):l,r.taxNumber=n?t(t({},l),{value:n.taxNumber||""}):l,r.isSubmitted=!1,r.isInitialized=!1,r.isSubmitting=!1,r.isFailure=void 0,r.isSuccess=void 0,r.responseMessage=void 0,r.countryOptions=[],r.stateOptions=[],r.cityOptions=[],r.districtOptions=[],r.regionOptions=[],[4,M(r)];case 1:return i.sent(),r.state.value?[4,D(r)]:[3,3];case 2:i.sent(),i.label=3;case 3:return r.country.value?[4,Y(r)]:[3,5];case 4:i.sent(),i.label=5;case 5:return r.city.value?[4,Z(r)]:[3,7];case 6:i.sent(),i.label=7;case 7:return[4,R(r)];case 8:return i.sent(),[4,A(r)];case 9:return i.sent(),[4,k(r)];case 10:return i.sent(),I(r),r.isInitialized=!0,[2]}})})}function c(e,i){e.title&&(e.title.value=i),e.isSubmitted&&j(e)}function v(e,i){e.firstName&&(e.firstName.value=i),e.isSubmitted&&j(e)}function m(e,i){e.lastName&&(e.lastName.value=i),e.isSubmitted&&j(e)}function f(e,i){e.identityNumber&&(e.identityNumber.value=i),e.isSubmitted&&j(e)}function p(e,i){e.addressLine1&&(e.addressLine1.value=i),e.isSubmitted&&j(e)}function h(e,i){e.addressLine2&&(e.addressLine2.value=i),e.isSubmitted&&j(e)}function y(e,i){e.postalCode&&(e.postalCode.value=i),e.isSubmitted&&j(e)}function b(e,i){e.country&&e.country.value!==i&&(e.country.value=i,e.state&&(e.state.value=""),e.city&&(e.city.value=""),e.district&&(e.district.value=""),e.states=[],e.stateOptions=[],e.cities=[],e.cityOptions=[],e.districts=[],e.districtOptions=[],_(e),I(e),D(e),e.isSubmitted&&j(e))}function g(e,i){var t,r;e.state&&e.state.value!==i&&(e.state.value=i,(null===(t=e.city)||void 0===t?void 0:t.isFreeText)||(e.city&&(e.city.value=""),e.cities=[],e.cityOptions=[],Y(e)),(null===(r=e.district)||void 0===r?void 0:r.isFreeText)||(e.district&&(e.district.value=""),e.districts=[],e.districtOptions=[]),e.isSubmitted&&j(e))}function N(e,i){var t;e.city&&(e.city.value=i,e.districts=[],e.districtOptions=[],(null===(t=e.district)||void 0===t?void 0:t.isFreeText)||(e.district&&(e.district.value=""),Z(e)),e.isSubmitted&&j(e))}function x(e,i){e.district&&e.district.value!==i&&(e.district.value=i,e.region&&(e.region.value=""),e.regionOptions=[],e.isSubmitted&&j(e))}function q(e,i){e.region&&e.region.value!==i&&(e.region.value=i,e.isSubmitted&&j(e))}function L(e,i){e.phone&&(e.phone.value=i),e.isSubmitted&&j(e)}function S(e,i){e.company&&(e.company.value=i),e.isSubmitted&&j(e)}function O(e,i){e.taxOffice&&(e.taxOffice.value=i),e.isSubmitted&&j(e)}function C(e,i){e.taxNumber&&(e.taxNumber.value=i),e.isSubmitted&&j(e)}function E(t){return e(this,void 0,void 0,function(){var e,r,n,d,l,u,c;return i(this,function(i){switch(i.label){case 0:if(t.isSubmitted=!0,t.isSuccess=void 0,t.isFailure=void 0,t.responseMessage=void 0,j(t))return[2,!1];t.isSubmitting=!0,i.label=1;case 1:return i.trys.push([1,4,5,6]),(e=a(o.customer))?(r=!!t.id,n=null===(c=e.addresses)||void 0===c?void 0:c.findIndex(function(e){return e.id===t.id}),r&&e.addresses&&void 0!==n?(d=J(t))&&(e.addresses[n]=d):(e.addresses||(e.addresses=[]),(d=J(t))&&e.addresses.push(d)),[4,import("../../../stores/customer/index.js")]):(t.isSubmitting=!1,[2,!1]);case 2:return[4,(0,i.sent().saveCustomer)(o,e)];case 3:return l=i.sent(),t.isSubmitting=!1,l?(t.isSuccess=!0,t.responseMessage=s.translate("notification.success.address"),[2,!0]):(t.isFailure=!0,t.responseMessage=s.translate("notification.failure.address"),[2,!1]);case 4:return u=i.sent(),console.error(u),[3,6];case 5:return t.isSubmitting=!1,[7];case 6:return[2,!1]}})})}function j(e){if(!(e.title&&e.firstName&&e.lastName&&e.addressLine1&&e.country&&e.city&&e.district&&e.state))return!1;var i=d(e.title.value,{required:!0});i.hasError?(e.title.hasError=!0,e.title.message=i.message):(e.title.hasError=!1,e.title.message=void 0);var t=d(e.firstName.value,F(e,"firstName"));t.hasError?(e.firstName.hasError=!0,e.firstName.message=t.message):(e.firstName.hasError=!1,e.firstName.message=void 0);var r=d(e.lastName.value,F(e,"lastName"));r.hasError?(e.lastName.hasError=!0,e.lastName.message=r.message):(e.lastName.hasError=!1,e.lastName.message=void 0);var n=d(e.addressLine1.value,F(e,"addressLine1"));n.hasError?(e.addressLine1.hasError=!0,e.addressLine1.message=n.message):(e.addressLine1.hasError=!1,e.addressLine1.message=void 0);var s=d(e.country.value,F(e,"country"));s.hasError?(e.country.hasError=!0,e.country.message=s.message):(e.country.hasError=!1,e.country.message=void 0);var o=d(e.state.value,F(e,"state"));o.hasError?(e.state.hasError=!0,e.state.message=o.message):(e.state.hasError=!1,e.state.message=void 0);var a=d(e.city.value,F(e,"city"));a.hasError?(e.city.hasError=!0,e.city.message=a.message):(e.city.hasError=!1,e.city.message=void 0);var l=d(e.district.value,F(e,"district"));return l.hasError?(e.district.hasError=!0,e.district.message=l.message):(e.district.hasError=!1,e.district.message=void 0),i.hasError||t.hasError||r.hasError||n.hasError||s.hasError||a.hasError||l.hasError||o.hasError}function F(e,i){var t,r,n,s,o,a,d,l,u,c,v,m,f,p,h,y,b,g,N=null===(t=Q[i])||void 0===t?void 0:t.required,x=null===(r=Q[i])||void 0===r?void 0:r.regex,q=null===(n=Q[i])||void 0===n?void 0:n.isFreeText;e.addressFormat&&!e.addressFormat.some(function(e){return e.some(function(e){return e===i})})&&(N=!1),void 0!==(null===(o=null===(s=e.countrySettings)||void 0===s?void 0:s[i])||void 0===o?void 0:o.required)&&(N=!1!==(null===(d=null===(a=e.countrySettings)||void 0===a?void 0:a[i])||void 0===d?void 0:d.required)),void 0!==(null===(u=null===(l=e.countrySettings)||void 0===l?void 0:l[i])||void 0===u?void 0:u.regex)&&(x=null===(v=null===(c=e.countrySettings)||void 0===c?void 0:c[i])||void 0===v?void 0:v.regex),void 0!==(null===(f=null===(m=e.countrySettings)||void 0===m?void 0:m[i])||void 0===f?void 0:f.type)&&(q="text"===(null===(h=null===(p=e.countrySettings)||void 0===p?void 0:p[i])||void 0===h?void 0:h.type));var L=null===(y=e.checkoutSettings)||void 0===y?void 0:y.identityNumberRequirement;"identityNumber"===i&&L&&(N="MANDATORY"===L);var S=null===(b=e.checkoutSettings)||void 0===b?void 0:b.postalCodeRequirement;"postalCode"===i&&S&&(N="MANDATORY"===S);var O=null===(g=e.checkoutSettings)||void 0===g?void 0:g.phoneRequirement;return"phone"===i&&O&&(N="MANDATORY"===O),"region"!==i||function(e){var i,t,r;return!!(null===(i=e.district)||void 0===i?void 0:i.value)&&(null===(r=null===(t=H(e))||void 0===t?void 0:t.regions)||void 0===r?void 0:r.length)}(e)||(N=!1),{required:N,regex:x,isFreeText:q}}function R(t){return e(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,T(t)];case 1:return e.sent(),[4,w(t)];case 2:return e.sent(),[2]}})})}function w(t){return e(this,void 0,void 0,function(){var e;return i(this,function(i){switch(i.label){case 0:return[4,fetch("https://cdn.myikas.com/sf/static/location/settings.json")];case 1:return[4,i.sent().json()];case 2:return e=i.sent(),t.locationSettings=e,[2]}})})}function T(t){return e(this,void 0,void 0,function(){var e,n,s;return i(this,function(i){switch(i.label){case 0:return t.title&&t.firstName&&t.lastName&&t.identityNumber&&t.addressLine1&&t.addressLine2&&t.postalCode&&t.country&&t.state&&t.city&&t.district&&t.region&&t.phone&&t.company&&t.taxOffice&&t.taxNumber?(e=r.getCurrentLocale(),n="https://eu.myikas.com/sf/static/location/".concat(e,".json"),[4,fetch(n)]):[2];case 1:return[4,i.sent().json()];case 2:return s=i.sent(),t.countryLabels=s.countryLabels,_(t),[2]}})})}function _(e){var i,t,r,n,o,a,d,l,u,c,v,m,f,p,h,y,b,g,N,x,q,L,S,O,C,E,j,F,R,w;if(e.title&&e.firstName&&e.lastName&&e.identityNumber&&e.addressLine1&&e.addressLine2&&e.postalCode&&e.country&&e.state&&e.city&&e.district&&e.region&&e.phone&&e.company&&e.taxOffice&&e.taxNumber){var T=z(e),_=e.countryLabels[T].fields||{};e.title.label=s.translate("label.address_title"),e.title.placeholder="",e.firstName.label=(null===(i=_.firstName)||void 0===i?void 0:i.label)||s.translate("label.first_name"),e.firstName.placeholder=(null===(t=_.firstName)||void 0===t?void 0:t.placeholder)||"",e.lastName.label=(null===(r=_.lastName)||void 0===r?void 0:r.label)||s.translate("label.last_name"),e.lastName.placeholder=(null===(n=_.lastName)||void 0===n?void 0:n.placeholder)||"",e.identityNumber.label=(null===(o=_.identityNumber)||void 0===o?void 0:o.label)||s.translate("label.identity_number"),e.identityNumber.placeholder=(null===(a=_.identityNumber)||void 0===a?void 0:a.placeholder)||"",e.addressLine1.label=(null===(d=_.addressLine1)||void 0===d?void 0:d.label)||s.translate("label.address_line"),e.addressLine1.placeholder=(null===(l=_.addressLine1)||void 0===l?void 0:l.placeholder)||"",e.addressLine2.label=(null===(u=_.addressLine2)||void 0===u?void 0:u.label)||s.translate("label.address_line_2"),e.addressLine2.placeholder=(null===(c=_.addressLine2)||void 0===c?void 0:c.placeholder)||"",e.postalCode.label=(null===(v=_.postalCode)||void 0===v?void 0:v.label)||s.translate("label.postal_code"),e.postalCode.placeholder=(null===(m=_.postalCode)||void 0===m?void 0:m.placeholder)||"",e.country.label=(null===(f=_.country)||void 0===f?void 0:f.label)||s.translate("label.country"),e.country.placeholder=(null===(p=_.country)||void 0===p?void 0:p.placeholder)||"",e.state.label=(null===(h=_.state)||void 0===h?void 0:h.label)||s.translate("label.state"),e.state.placeholder=(null===(y=_.state)||void 0===y?void 0:y.placeholder)||"",e.city.label=(null===(b=_.city)||void 0===b?void 0:b.label)||s.translate("label.city"),e.city.placeholder=(null===(g=_.city)||void 0===g?void 0:g.placeholder)||"",e.district.label=(null===(N=_.district)||void 0===N?void 0:N.label)||s.translate("label.district"),e.district.placeholder=(null===(x=_.district)||void 0===x?void 0:x.placeholder)||"",e.region.label=(null===(q=_.region)||void 0===q?void 0:q.label)||s.translate("label.region"),e.region.placeholder=(null===(L=_.region)||void 0===L?void 0:L.placeholder)||"",e.phone.label=(null===(S=_.phone)||void 0===S?void 0:S.label)||s.translate("label.phone"),e.phone.placeholder=(null===(O=_.phone)||void 0===O?void 0:O.placeholder)||"",e.company.label=(null===(C=_.company)||void 0===C?void 0:C.label)||s.translate("label.company"),e.company.placeholder=(null===(E=_.company)||void 0===E?void 0:E.placeholder)||"",e.taxOffice.label=(null===(j=_.taxOffice)||void 0===j?void 0:j.label)||s.translate("label.tax_office"),e.taxOffice.placeholder=(null===(F=_.taxOffice)||void 0===F?void 0:F.placeholder)||"",e.taxNumber.label=(null===(R=_.taxNumber)||void 0===R?void 0:R.label)||s.translate("label.tax_number"),e.taxNumber.placeholder=(null===(w=_.taxNumber)||void 0===w?void 0:w.placeholder)||""}}function I(t){t.firstName&&t.lastName&&t.identityNumber&&t.addressLine1&&t.postalCode&&t.country&&t.city&&t.district&&t.region&&t.phone&&t.company&&t.taxOffice&&t.taxNumber&&t.state&&(!function(t){e(this,void 0,void 0,function(){var e,r,n,s,o,a,d;return i(this,function(i){if(e=z(t),r=null===(o=t.locationSettings)||void 0===o?void 0:o.addressFormats,n=null===(d=null===(a=t.locationSettings)||void 0===a?void 0:a.countrySettings)||void 0===d?void 0:d[e],!(s=null==n?void 0:n.fields))return[2];t.countrySettings=s;try{t.addressFormat=r[n.addressFormat]}catch(e){t.addressFormat=[]}return[2]})})}(t),t.firstName.isRequired=F(t,"firstName").required,t.lastName.isRequired=F(t,"lastName").required,t.identityNumber.isRequired=F(t,"identityNumber").required,t.addressLine1.isRequired=F(t,"addressLine1").required,t.postalCode.isRequired=F(t,"postalCode").required,t.country.isRequired=F(t,"country").required,t.state.isRequired=F(t,"state").required,t.city.isRequired=F(t,"city").required,t.city.isFreeText=F(t,"city").isFreeText,t.district.isRequired=F(t,"district").required,t.district.isFreeText=F(t,"district").isFreeText,t.region.isRequired=F(t,"region").required,t.phone.isRequired=F(t,"phone").required,t.company.isRequired=F(t,"company").required,t.taxOffice.isRequired=F(t,"taxOffice").required,t.taxNumber.isRequired=F(t,"taxNumber").required)}function A(t){return e(this,void 0,void 0,function(){var e,r;return i(this,function(i){switch(i.label){case 0:return[4,import("../../../api/checkout/index.js")];case 1:return[4,(0,i.sent().apiListCheckoutSettings)({})];case 2:return(e=i.sent()).isSuccess&&(null===(r=e.data)||void 0===r?void 0:r.length)?(t.checkoutSettings=e.data[0],[2]):[2]}})})}function k(t){return e(this,void 0,void 0,function(){var e,n,s,o;return i(this,function(i){switch(i.label){case 0:return[4,import("../../../api/location/index.js")];case 1:return[4,(0,i.sent().apiGetAvailableShippingZones)({salesChannelId:r.salesChannelId})];case 2:return(e=i.sent()).isSuccess&&(null===(o=e.data)||void 0===o?void 0:o.length)?(t.shippingZones=e.data,n=H(t),s=(null==n?void 0:n.regions)||[],t.regions=s,t.regionOptions=P(s.map(K)),[2]):[2]}})})}function M(t){return e(this,void 0,void 0,function(){var e,n,s,o,a,d,l,u,c;return i(this,function(i){switch(i.label){case 0:return i.trys.push([0,7,8,9]),t.country&&(t.country.isLoading=!0),[4,import("../../../api/location/index.js")];case 1:return[4,(0,i.sent().apiListCountry)({locale:r.getCurrentLocale()})];case 2:return e=i.sent(),n=r.getCurrentRouting(),s=e.data||[],(null===(l=null==n?void 0:n.countryCodes)||void 0===l?void 0:l.length)&&(s=s.filter(function(e){var i;return e.iso2&&(null===(i=n.countryCodes)||void 0===i?void 0:i.includes(e.iso2))})),t.countries=s,1!==t.countries.length||(null===(u=t.country)||void 0===u?void 0:u.value)?[3,3]:(b(t,t.countries[0].id),[3,6]);case 3:return!t.countries.length||(null===(c=t.country)||void 0===c?void 0:c.value)?[3,6]:[4,import("../../../api/location/index.js")];case 4:return[4,(0,i.sent().apiGetMyCountry)()];case 5:(o=i.sent()).isSuccess&&o.data&&(a=o.data,d=t.countries.find(function(e){return e.iso2===a}),b(t,d?d.id:t.countries[0].id)),i.label=6;case 6:return t.countries=s,t.countryOptions=P(t.countries.map(K)),[3,9];case 7:return i.sent(),[3,9];case 8:return t.country&&(t.country.isLoading=!1),[7];case 9:return[2]}})})}function D(t){return e(this,void 0,void 0,function(){var e,r,n,s,o,a;return i(this,function(i){switch(i.label){case 0:if(!(e=null===(o=t.country)||void 0===o?void 0:o.value))return[2];i.label=1;case 1:return i.trys.push([1,4,5,6]),t.state&&(t.state.isLoading=!0),[4,import("../../../api/location/index.js")];case 2:return[4,(0,i.sent().apiListState)({countryId:{eq:e}})];case 3:return r=i.sent(),n=r.data||[],(s=G(t))&&!s.showAllStates&&(null===(a=s.states)||void 0===a?void 0:a.length)&&(n=n.filter(function(e){var i;return null===(i=s.states)||void 0===i?void 0:i.some(function(i){return i.id===e.id})})),t.states=n,n.length<=1?(g(t,n[0].id),[2]):(t.stateOptions=P(n.map(K)),[3,6]);case 4:return i.sent(),[3,6];case 5:return t.state&&(t.state.isLoading=!1),[7];case 6:return[2]}})})}function Y(t){return e(this,void 0,void 0,function(){var e,r,n,s,o,a;return i(this,function(i){switch(i.label){case 0:if(!(null===(s=t.state)||void 0===s?void 0:s.value))return[2];i.label=1;case 1:return i.trys.push([1,4,5,6]),t.city&&(t.city.isLoading=!0),[4,import("../../../api/location/index.js")];case 2:return[4,(0,i.sent().apiListCity)({stateId:{eq:t.state.value},countryId:(null===(o=t.country)||void 0===o?void 0:o.value)?{eq:t.country.value}:void 0})];case 3:return e=i.sent(),r=e.data||[],(n=$(t))&&!n.showAllCities&&(null===(a=n.cities)||void 0===a?void 0:a.length)&&(r=r.filter(function(e){var i;return null===(i=n.cities)||void 0===i?void 0:i.some(function(i){return i.id===e.id})})),t.cities=r,t.cityOptions=P(r.map(K)),[3,6];case 4:return i.sent(),[3,6];case 5:return t.city&&(t.city.isLoading=!1),[7];case 6:return[2]}})})}function Z(t){return e(this,void 0,void 0,function(){var e,r,n,s,o,a,d,l;return i(this,function(i){switch(i.label){case 0:if(!(e=null===(a=t.city)||void 0===a?void 0:a.value))return[2];r=null===(d=t.state)||void 0===d?void 0:d.value,i.label=1;case 1:return i.trys.push([1,4,5,6]),t.district&&(t.district.isLoading=!0),[4,import("../../../api/location/index.js")];case 2:return[4,(0,i.sent().apiListDistrict)({cityId:{eq:e},stateId:r?{eq:r}:void 0})];case 3:return n=i.sent(),s=n.data||[],(o=B(t))&&!o.showAllDistricts&&(null===(l=o.districts)||void 0===l?void 0:l.length)&&(s=s.filter(function(e){var i;return null===(i=o.districts)||void 0===i?void 0:i.some(function(i){return i.id===e.id})})),t.districts=s,t.districtOptions=P(s.map(K)),[3,6];case 4:return i.sent(),[3,6];case 5:return t.district&&(t.district.isLoading=!1),[7];case 6:return[2]}})})}function z(e){var i,t=null===(i=e.countries)||void 0===i?void 0:i.find(function(i){var t;return i.id===(null===(t=e.country)||void 0===t?void 0:t.value)});return(null==t?void 0:t.iso2)||"TR"}function G(e){var i;return null===(i=e.shippingZones)||void 0===i?void 0:i.find(function(i){var t;return i.countryId===(null===(t=e.country)||void 0===t?void 0:t.value)})}function $(e){var i,t=G(e);return null===(i=null==t?void 0:t.states)||void 0===i?void 0:i.find(function(i){var t;return i.id===(null===(t=e.state)||void 0===t?void 0:t.value)})}function B(e){var i,t=$(e);return null===(i=null==t?void 0:t.cities)||void 0===i?void 0:i.find(function(i){var t;return i.id===(null===(t=e.city)||void 0===t?void 0:t.value)})}function H(e){var i,t=B(e);return null===(i=null==t?void 0:t.districts)||void 0===i?void 0:i.find(function(i){var t;return i.id===(null===(t=e.district)||void 0===t?void 0:t.value)})}function J(e){var i,t,r,s,o,a,d,l,u,c,v,m,f,p,h;if(e.countries&&e.states&&e.cities&&e.districts&&e.regions){var y=e.countries.find(function(i){var t;return i.id===(null===(t=e.country)||void 0===t?void 0:t.value)}),b=e.states.find(function(i){var t;return i.id===(null===(t=e.state)||void 0===t?void 0:t.value)}),g=e.cities.find(function(i){var t;return i.id===(null===(t=e.city)||void 0===t?void 0:t.value)}),N=e.districts.find(function(i){var t;return i.id===(null===(t=e.district)||void 0===t?void 0:t.value)}),x=e.regions.find(function(i){var t;return i.id===(null===(t=e.region)||void 0===t?void 0:t.value)});return{id:e.id||n(),title:null===(i=e.title)||void 0===i?void 0:i.value,firstName:null===(t=e.firstName)||void 0===t?void 0:t.value,lastName:null===(r=e.lastName)||void 0===r?void 0:r.value,identityNumber:null===(s=e.identityNumber)||void 0===s?void 0:s.value,addressLine1:null===(o=e.addressLine1)||void 0===o?void 0:o.value,addressLine2:null===(a=e.addressLine2)||void 0===a?void 0:a.value,postalCode:null===(d=e.postalCode)||void 0===d?void 0:d.value,country:y?{id:y.id,name:y.name,code:y.iso3,iso2:y.iso2,iso3:y.iso3}:null,state:b?{id:b.id,name:b.name,code:b.stateCode}:null,city:!(null===(l=e.city)||void 0===l?void 0:l.isFreeText)&&g?{id:g.id,name:g.name,code:null}:{id:null,name:null===(u=e.city)||void 0===u?void 0:u.value,code:null},district:!(null===(c=e.district)||void 0===c?void 0:c.isFreeText)&&N?{id:N.id,name:N.name,code:null}:{id:null,name:null===(v=e.district)||void 0===v?void 0:v.value,code:null},region:x?{id:x.id,name:x.name}:null,phone:null===(m=e.phone)||void 0===m?void 0:m.value,company:null===(f=e.company)||void 0===f?void 0:f.value,taxOffice:null===(p=e.taxOffice)||void 0===p?void 0:p.value,taxNumber:null===(h=e.taxNumber)||void 0===h?void 0:h.value}}}function K(e){return{label:e.name,value:e.id+""}}function P(e){return e.sort(function(e,i){return e.label.localeCompare(i.label)})}var Q={firstName:{required:!0},lastName:{required:!0},identityNumber:{required:!0},addressLine1:{required:!0},addressLine2:{required:!1},postalCode:{required:!0},country:{required:!0},city:{required:!0,isFreeText:!1},district:{required:!0,isFreeText:!1},region:{required:!1},phone:{required:!1,regex:/^\+?\d{10,}$/},company:{required:!1},taxOffice:{required:!1},taxNumber:{required:!1}},U={value:"",hasError:!1,message:void 0,isLoading:!0};export{u as initAddressForm,p as setAddressFormAddressLine1,h as setAddressFormAddressLine2,N as setAddressFormCity,S as setAddressFormCompany,b as setAddressFormCountry,x as setAddressFormDistrict,v as setAddressFormFirstName,f as setAddressFormIdentityNumber,m as setAddressFormLastName,L as setAddressFormPhone,y as setAddressFormPostalCode,q as setAddressFormRegion,g as setAddressFormState,C as setAddressFormTaxNumber,O as setAddressFormTaxOffice,c as setAddressFormTitle,E as submitAddressForm};
|
|
1
|
+
import{__awaiter as e,__generator as i,__assign as t}from'./../../../../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as r}from"../../../../packages/storefront-config/src/index.js";import'./../../../../ext/uuid/dist/esm-browser/stringify.js';import'./../../../../ext/uuid/dist/esm-browser/v3.js';import n from'./../../../../ext/uuid/dist/esm-browser/v4.js';import'./../../../../ext/uuid/dist/esm-browser/v5.js';import{I18n as s}from"../../../../i18n/index.js";import{customerStore as o}from"../../../../stores/customer/index.js";import{cloneDeep as a}from"../../../../utils/helper.js";import{validateValue as d,FORM_ITEM_DEFAULT_VALUE as l}from"../index.js";function u(r,n){return e(this,void 0,void 0,function(){var e,s,o,a,d,u;return i(this,function(i){switch(i.label){case 0:return r.id=null==n?void 0:n.id,r.title=n?t(t({},l),{value:n.title||""}):l,r.firstName=n?t(t({},l),{value:n.firstName||""}):l,r.lastName=n?t(t({},l),{value:n.lastName||""}):l,r.identityNumber=n?t(t({},l),{value:n.identityNumber||""}):l,r.addressLine1=n?t(t({},l),{value:n.addressLine1||""}):l,r.addressLine2=n?t(t({},l),{value:n.addressLine2||""}):l,r.postalCode=n?t(t({},l),{value:n.postalCode||""}):l,r.country=n?t(t({},U),{value:(null===(e=n.country)||void 0===e?void 0:e.id)||""}):U,r.state=n?t(t({},U),{value:(null===(s=n.state)||void 0===s?void 0:s.id)||""}):U,r.city=n?t(t({},U),{value:(null===(o=n.city)||void 0===o?void 0:o.id)||(null===(a=n.city)||void 0===a?void 0:a.name)||""}):U,r.district=n?t(t({},U),{value:(null===(d=n.district)||void 0===d?void 0:d.id)||""}):U,r.region=n?t(t({},l),{value:(null===(u=n.region)||void 0===u?void 0:u.id)||""}):l,r.phone=n?t(t({},l),{value:n.phone||""}):l,r.company=n?t(t({},l),{value:n.company||""}):l,r.taxOffice=n?t(t({},l),{value:n.taxOffice||""}):l,r.taxNumber=n?t(t({},l),{value:n.taxNumber||""}):l,r.isSubmitted=!1,r.isInitialized=!1,r.isSubmitting=!1,r.isFailure=void 0,r.isSuccess=void 0,r.responseMessage=void 0,r.countryOptions=[],r.stateOptions=[],r.cityOptions=[],r.districtOptions=[],r.regionOptions=[],[4,M(r)];case 1:return i.sent(),r.state.value?[4,D(r)]:[3,3];case 2:i.sent(),i.label=3;case 3:return r.country.value?[4,Y(r)]:[3,5];case 4:i.sent(),i.label=5;case 5:return r.city.value?[4,Z(r)]:[3,7];case 6:i.sent(),i.label=7;case 7:return[4,R(r)];case 8:return i.sent(),[4,A(r)];case 9:return i.sent(),[4,k(r)];case 10:return i.sent(),I(r),r.isInitialized=!0,[2]}})})}function c(e,i){e.title&&(e.title.value=i),e.isSubmitted&&j(e)}function v(e,i){e.firstName&&(e.firstName.value=i),e.isSubmitted&&j(e)}function m(e,i){e.lastName&&(e.lastName.value=i),e.isSubmitted&&j(e)}function f(e,i){e.identityNumber&&(e.identityNumber.value=i),e.isSubmitted&&j(e)}function p(e,i){e.addressLine1&&(e.addressLine1.value=i),e.isSubmitted&&j(e)}function h(e,i){e.addressLine2&&(e.addressLine2.value=i),e.isSubmitted&&j(e)}function y(e,i){e.postalCode&&(e.postalCode.value=i),e.isSubmitted&&j(e)}function b(e,i){e.country&&e.country.value!==i&&(e.country.value=i,e.state&&(e.state.value=""),e.city&&(e.city.value=""),e.district&&(e.district.value=""),e.states=[],e.stateOptions=[],e.cities=[],e.cityOptions=[],e.districts=[],e.districtOptions=[],_(e),I(e),D(e),e.isSubmitted&&j(e))}function g(e,i){var t,r;e.state&&e.state.value!==i&&(e.state.value=i,(null===(t=e.city)||void 0===t?void 0:t.isFreeText)||(e.city&&(e.city.value=""),e.cities=[],e.cityOptions=[],Y(e)),(null===(r=e.district)||void 0===r?void 0:r.isFreeText)||(e.district&&(e.district.value=""),e.districts=[],e.districtOptions=[]),e.isSubmitted&&j(e))}function N(e,i){var t;e.city&&(e.city.value=i,e.districts=[],e.districtOptions=[],(null===(t=e.district)||void 0===t?void 0:t.isFreeText)||(e.district&&(e.district.value=""),Z(e)),e.isSubmitted&&j(e))}function x(e,i){e.district&&e.district.value!==i&&(e.district.value=i,e.region&&(e.region.value=""),e.regionOptions=[],e.isSubmitted&&j(e))}function L(e,i){e.region&&e.region.value!==i&&(e.region.value=i,e.isSubmitted&&j(e))}function q(e,i){e.phone&&(e.phone.value=i),e.isSubmitted&&j(e)}function S(e,i){e.company&&(e.company.value=i),e.isSubmitted&&j(e)}function O(e,i){e.taxOffice&&(e.taxOffice.value=i),e.isSubmitted&&j(e)}function C(e,i){e.taxNumber&&(e.taxNumber.value=i),e.isSubmitted&&j(e)}function E(t){return e(this,void 0,void 0,function(){var e,r,n,d,l,u,c;return i(this,function(i){switch(i.label){case 0:if(t.isSubmitted=!0,t.isSuccess=void 0,t.isFailure=void 0,t.responseMessage=void 0,j(t))return[2,!1];t.isSubmitting=!0,i.label=1;case 1:return i.trys.push([1,4,5,6]),(e=a(o.customer))?(r=!!t.id,n=null===(c=e.addresses)||void 0===c?void 0:c.findIndex(function(e){return e.id===t.id}),r&&e.addresses&&void 0!==n?(d=J(t))&&(e.addresses[n]=d):(e.addresses||(e.addresses=[]),(d=J(t))&&e.addresses.push(d)),[4,import("../../../stores/customer/index.js")]):(t.isSubmitting=!1,[2,!1]);case 2:return[4,(0,i.sent().saveCustomer)(o,e)];case 3:return l=i.sent(),t.isSubmitting=!1,l?(t.isSuccess=!0,t.responseMessage=s.translate("notification.success.address"),[2,!0]):(t.isFailure=!0,t.responseMessage=s.translate("notification.failure.address"),[2,!1]);case 4:return u=i.sent(),console.error(u),[3,6];case 5:return t.isSubmitting=!1,[7];case 6:return[2,!1]}})})}function j(e){if(!(e.title&&e.firstName&&e.lastName&&e.addressLine1&&e.country&&e.city&&e.district&&e.state))return!1;var i=d(e.title.value,{required:!0});i.hasError?(e.title.hasError=!0,e.title.message=i.message):(e.title.hasError=!1,e.title.message=void 0);var t=d(e.firstName.value,F(e,"firstName"));t.hasError?(e.firstName.hasError=!0,e.firstName.message=t.message):(e.firstName.hasError=!1,e.firstName.message=void 0);var r=d(e.lastName.value,F(e,"lastName"));r.hasError?(e.lastName.hasError=!0,e.lastName.message=r.message):(e.lastName.hasError=!1,e.lastName.message=void 0);var n=d(e.addressLine1.value,F(e,"addressLine1"));n.hasError?(e.addressLine1.hasError=!0,e.addressLine1.message=n.message):(e.addressLine1.hasError=!1,e.addressLine1.message=void 0);var s=d(e.country.value,F(e,"country"));s.hasError?(e.country.hasError=!0,e.country.message=s.message):(e.country.hasError=!1,e.country.message=void 0);var o=d(e.state.value,F(e,"state"));o.hasError?(e.state.hasError=!0,e.state.message=o.message):(e.state.hasError=!1,e.state.message=void 0);var a=d(e.city.value,F(e,"city"));a.hasError?(e.city.hasError=!0,e.city.message=a.message):(e.city.hasError=!1,e.city.message=void 0);var l=d(e.district.value,F(e,"district"));return l.hasError?(e.district.hasError=!0,e.district.message=l.message):(e.district.hasError=!1,e.district.message=void 0),i.hasError||t.hasError||r.hasError||n.hasError||s.hasError||a.hasError||l.hasError||o.hasError}function F(e,i){var t,r,n,s,o,a,d,l,u,c,v,m,f,p,h,y,b,g,N=null===(t=Q[i])||void 0===t?void 0:t.required,x=null===(r=Q[i])||void 0===r?void 0:r.regex,L=null===(n=Q[i])||void 0===n?void 0:n.isFreeText;e.addressFormat&&!e.addressFormat.some(function(e){return e.some(function(e){return e===i})})&&(N=!1),void 0!==(null===(o=null===(s=e.countrySettings)||void 0===s?void 0:s[i])||void 0===o?void 0:o.required)&&(N=!1!==(null===(d=null===(a=e.countrySettings)||void 0===a?void 0:a[i])||void 0===d?void 0:d.required)),void 0!==(null===(u=null===(l=e.countrySettings)||void 0===l?void 0:l[i])||void 0===u?void 0:u.regex)&&(x=null===(v=null===(c=e.countrySettings)||void 0===c?void 0:c[i])||void 0===v?void 0:v.regex),void 0!==(null===(f=null===(m=e.countrySettings)||void 0===m?void 0:m[i])||void 0===f?void 0:f.type)&&(L="text"===(null===(h=null===(p=e.countrySettings)||void 0===p?void 0:p[i])||void 0===h?void 0:h.type));var q=null===(y=e.checkoutSettings)||void 0===y?void 0:y.identityNumberRequirement;"identityNumber"===i&&q&&(N="MANDATORY"===q);var S=null===(b=e.checkoutSettings)||void 0===b?void 0:b.postalCodeRequirement;"postalCode"===i&&S&&(N="MANDATORY"===S);var O=null===(g=e.checkoutSettings)||void 0===g?void 0:g.phoneRequirement;return"phone"===i&&O&&(N="MANDATORY"===O),"region"!==i||function(e){var i,t,r;return!!(null===(i=e.district)||void 0===i?void 0:i.value)&&(null===(r=null===(t=H(e))||void 0===t?void 0:t.regions)||void 0===r?void 0:r.length)}(e)||(N=!1),{required:N,regex:x,isFreeText:L}}function R(t){return e(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return[4,T(t)];case 1:return e.sent(),[4,w(t)];case 2:return e.sent(),[2]}})})}function w(t){return e(this,void 0,void 0,function(){var e;return i(this,function(i){switch(i.label){case 0:return[4,fetch("https://cdn.myikas.com/sf/static/location/settings.json")];case 1:return[4,i.sent().json()];case 2:return e=i.sent(),t.locationSettings=e,[2]}})})}function T(t){return e(this,void 0,void 0,function(){var e,n,s;return i(this,function(i){switch(i.label){case 0:return t.title&&t.firstName&&t.lastName&&t.identityNumber&&t.addressLine1&&t.addressLine2&&t.postalCode&&t.country&&t.state&&t.city&&t.district&&t.region&&t.phone&&t.company&&t.taxOffice&&t.taxNumber?(e=r.getCurrentLocale(),n="https://eu.myikas.com/sf/static/location/".concat(e,".json"),[4,fetch(n)]):[2];case 1:return[4,i.sent().json()];case 2:return s=i.sent(),t.countryLabels=s.countryLabels,_(t),[2]}})})}function _(e){var i,t,r,n,o,a,d,l,u,c,v,m,f,p,h,y,b,g,N,x,L,q,S,O,C,E,j,F,R,w;if(e.countryLabels&&e.title&&e.firstName&&e.lastName&&e.identityNumber&&e.addressLine1&&e.addressLine2&&e.postalCode&&e.country&&e.state&&e.city&&e.district&&e.region&&e.phone&&e.company&&e.taxOffice&&e.taxNumber){var T=z(e),_=e.countryLabels[T].fields||{};e.title.label=s.translate("label.address_title"),e.title.placeholder="",e.firstName.label=(null===(i=_.firstName)||void 0===i?void 0:i.label)||s.translate("label.first_name"),e.firstName.placeholder=(null===(t=_.firstName)||void 0===t?void 0:t.placeholder)||"",e.lastName.label=(null===(r=_.lastName)||void 0===r?void 0:r.label)||s.translate("label.last_name"),e.lastName.placeholder=(null===(n=_.lastName)||void 0===n?void 0:n.placeholder)||"",e.identityNumber.label=(null===(o=_.identityNumber)||void 0===o?void 0:o.label)||s.translate("label.identity_number"),e.identityNumber.placeholder=(null===(a=_.identityNumber)||void 0===a?void 0:a.placeholder)||"",e.addressLine1.label=(null===(d=_.addressLine1)||void 0===d?void 0:d.label)||s.translate("label.address_line"),e.addressLine1.placeholder=(null===(l=_.addressLine1)||void 0===l?void 0:l.placeholder)||"",e.addressLine2.label=(null===(u=_.addressLine2)||void 0===u?void 0:u.label)||s.translate("label.address_line_2"),e.addressLine2.placeholder=(null===(c=_.addressLine2)||void 0===c?void 0:c.placeholder)||"",e.postalCode.label=(null===(v=_.postalCode)||void 0===v?void 0:v.label)||s.translate("label.postal_code"),e.postalCode.placeholder=(null===(m=_.postalCode)||void 0===m?void 0:m.placeholder)||"",e.country.label=(null===(f=_.country)||void 0===f?void 0:f.label)||s.translate("label.country"),e.country.placeholder=(null===(p=_.country)||void 0===p?void 0:p.placeholder)||"",e.state.label=(null===(h=_.state)||void 0===h?void 0:h.label)||s.translate("label.state"),e.state.placeholder=(null===(y=_.state)||void 0===y?void 0:y.placeholder)||"",e.city.label=(null===(b=_.city)||void 0===b?void 0:b.label)||s.translate("label.city"),e.city.placeholder=(null===(g=_.city)||void 0===g?void 0:g.placeholder)||"",e.district.label=(null===(N=_.district)||void 0===N?void 0:N.label)||s.translate("label.district"),e.district.placeholder=(null===(x=_.district)||void 0===x?void 0:x.placeholder)||"",e.region.label=(null===(L=_.region)||void 0===L?void 0:L.label)||s.translate("label.region"),e.region.placeholder=(null===(q=_.region)||void 0===q?void 0:q.placeholder)||"",e.phone.label=(null===(S=_.phone)||void 0===S?void 0:S.label)||s.translate("label.phone"),e.phone.placeholder=(null===(O=_.phone)||void 0===O?void 0:O.placeholder)||"",e.company.label=(null===(C=_.company)||void 0===C?void 0:C.label)||s.translate("label.company"),e.company.placeholder=(null===(E=_.company)||void 0===E?void 0:E.placeholder)||"",e.taxOffice.label=(null===(j=_.taxOffice)||void 0===j?void 0:j.label)||s.translate("label.tax_office"),e.taxOffice.placeholder=(null===(F=_.taxOffice)||void 0===F?void 0:F.placeholder)||"",e.taxNumber.label=(null===(R=_.taxNumber)||void 0===R?void 0:R.label)||s.translate("label.tax_number"),e.taxNumber.placeholder=(null===(w=_.taxNumber)||void 0===w?void 0:w.placeholder)||""}}function I(t){t.firstName&&t.lastName&&t.identityNumber&&t.addressLine1&&t.postalCode&&t.country&&t.city&&t.district&&t.region&&t.phone&&t.company&&t.taxOffice&&t.taxNumber&&t.state&&(!function(t){e(this,void 0,void 0,function(){var e,r,n,s,o,a,d;return i(this,function(i){if(e=z(t),r=null===(o=t.locationSettings)||void 0===o?void 0:o.addressFormats,n=null===(d=null===(a=t.locationSettings)||void 0===a?void 0:a.countrySettings)||void 0===d?void 0:d[e],!(s=null==n?void 0:n.fields))return[2];t.countrySettings=s;try{t.addressFormat=r[n.addressFormat]}catch(e){t.addressFormat=[]}return[2]})})}(t),t.firstName.isRequired=F(t,"firstName").required,t.lastName.isRequired=F(t,"lastName").required,t.identityNumber.isRequired=F(t,"identityNumber").required,t.addressLine1.isRequired=F(t,"addressLine1").required,t.postalCode.isRequired=F(t,"postalCode").required,t.country.isRequired=F(t,"country").required,t.state.isRequired=F(t,"state").required,t.city.isRequired=F(t,"city").required,t.city.isFreeText=F(t,"city").isFreeText,t.district.isRequired=F(t,"district").required,t.district.isFreeText=F(t,"district").isFreeText,t.region.isRequired=F(t,"region").required,t.phone.isRequired=F(t,"phone").required,t.company.isRequired=F(t,"company").required,t.taxOffice.isRequired=F(t,"taxOffice").required,t.taxNumber.isRequired=F(t,"taxNumber").required)}function A(t){return e(this,void 0,void 0,function(){var e,r;return i(this,function(i){switch(i.label){case 0:return[4,import("../../../api/checkout/index.js")];case 1:return[4,(0,i.sent().apiListCheckoutSettings)({})];case 2:return(e=i.sent()).isSuccess&&(null===(r=e.data)||void 0===r?void 0:r.length)?(t.checkoutSettings=e.data[0],[2]):[2]}})})}function k(t){return e(this,void 0,void 0,function(){var e,n,s,o;return i(this,function(i){switch(i.label){case 0:return[4,import("../../../api/location/index.js")];case 1:return[4,(0,i.sent().apiGetAvailableShippingZones)({salesChannelId:r.salesChannelId})];case 2:return(e=i.sent()).isSuccess&&(null===(o=e.data)||void 0===o?void 0:o.length)?(t.shippingZones=e.data,n=H(t),s=(null==n?void 0:n.regions)||[],t.regions=s,t.regionOptions=P(s.map(K)),[2]):[2]}})})}function M(t){return e(this,void 0,void 0,function(){var e,n,s,o,a,d,l,u,c;return i(this,function(i){switch(i.label){case 0:return i.trys.push([0,7,8,9]),t.country&&(t.country.isLoading=!0),[4,import("../../../api/location/index.js")];case 1:return[4,(0,i.sent().apiListCountry)({locale:r.getCurrentLocale()})];case 2:return e=i.sent(),n=r.getCurrentRouting(),s=e.data||[],(null===(l=null==n?void 0:n.countryCodes)||void 0===l?void 0:l.length)&&(s=s.filter(function(e){var i;return e.iso2&&(null===(i=n.countryCodes)||void 0===i?void 0:i.includes(e.iso2))})),t.countries=s,1!==t.countries.length||(null===(u=t.country)||void 0===u?void 0:u.value)?[3,3]:(b(t,t.countries[0].id),[3,6]);case 3:return!t.countries.length||(null===(c=t.country)||void 0===c?void 0:c.value)?[3,6]:[4,import("../../../api/location/index.js")];case 4:return[4,(0,i.sent().apiGetMyCountry)()];case 5:(o=i.sent()).isSuccess&&o.data&&(a=o.data,d=t.countries.find(function(e){return e.iso2===a}),b(t,d?d.id:t.countries[0].id)),i.label=6;case 6:return t.countries=s,t.countryOptions=P(t.countries.map(K)),[3,9];case 7:return i.sent(),[3,9];case 8:return t.country&&(t.country.isLoading=!1),[7];case 9:return[2]}})})}function D(t){return e(this,void 0,void 0,function(){var e,r,n,s,o,a;return i(this,function(i){switch(i.label){case 0:if(!(e=null===(o=t.country)||void 0===o?void 0:o.value))return[2];i.label=1;case 1:return i.trys.push([1,4,5,6]),t.state&&(t.state.isLoading=!0),[4,import("../../../api/location/index.js")];case 2:return[4,(0,i.sent().apiListState)({countryId:{eq:e}})];case 3:return r=i.sent(),n=r.data||[],(s=G(t))&&!s.showAllStates&&(null===(a=s.states)||void 0===a?void 0:a.length)&&(n=n.filter(function(e){var i;return null===(i=s.states)||void 0===i?void 0:i.some(function(i){return i.id===e.id})})),t.states=n,n.length<=1?(g(t,n[0].id),[2]):(t.stateOptions=P(n.map(K)),[3,6]);case 4:return i.sent(),[3,6];case 5:return t.state&&(t.state.isLoading=!1),[7];case 6:return[2]}})})}function Y(t){return e(this,void 0,void 0,function(){var e,r,n,s,o,a;return i(this,function(i){switch(i.label){case 0:if(!(null===(s=t.state)||void 0===s?void 0:s.value))return[2];i.label=1;case 1:return i.trys.push([1,4,5,6]),t.city&&(t.city.isLoading=!0),[4,import("../../../api/location/index.js")];case 2:return[4,(0,i.sent().apiListCity)({stateId:{eq:t.state.value},countryId:(null===(o=t.country)||void 0===o?void 0:o.value)?{eq:t.country.value}:void 0})];case 3:return e=i.sent(),r=e.data||[],(n=$(t))&&!n.showAllCities&&(null===(a=n.cities)||void 0===a?void 0:a.length)&&(r=r.filter(function(e){var i;return null===(i=n.cities)||void 0===i?void 0:i.some(function(i){return i.id===e.id})})),t.cities=r,t.cityOptions=P(r.map(K)),[3,6];case 4:return i.sent(),[3,6];case 5:return t.city&&(t.city.isLoading=!1),[7];case 6:return[2]}})})}function Z(t){return e(this,void 0,void 0,function(){var e,r,n,s,o,a,d,l;return i(this,function(i){switch(i.label){case 0:if(!(e=null===(a=t.city)||void 0===a?void 0:a.value))return[2];r=null===(d=t.state)||void 0===d?void 0:d.value,i.label=1;case 1:return i.trys.push([1,4,5,6]),t.district&&(t.district.isLoading=!0),[4,import("../../../api/location/index.js")];case 2:return[4,(0,i.sent().apiListDistrict)({cityId:{eq:e},stateId:r?{eq:r}:void 0})];case 3:return n=i.sent(),s=n.data||[],(o=B(t))&&!o.showAllDistricts&&(null===(l=o.districts)||void 0===l?void 0:l.length)&&(s=s.filter(function(e){var i;return null===(i=o.districts)||void 0===i?void 0:i.some(function(i){return i.id===e.id})})),t.districts=s,t.districtOptions=P(s.map(K)),[3,6];case 4:return i.sent(),[3,6];case 5:return t.district&&(t.district.isLoading=!1),[7];case 6:return[2]}})})}function z(e){var i,t=null===(i=e.countries)||void 0===i?void 0:i.find(function(i){var t;return i.id===(null===(t=e.country)||void 0===t?void 0:t.value)});return(null==t?void 0:t.iso2)||"TR"}function G(e){var i;return null===(i=e.shippingZones)||void 0===i?void 0:i.find(function(i){var t;return i.countryId===(null===(t=e.country)||void 0===t?void 0:t.value)})}function $(e){var i,t=G(e);return null===(i=null==t?void 0:t.states)||void 0===i?void 0:i.find(function(i){var t;return i.id===(null===(t=e.state)||void 0===t?void 0:t.value)})}function B(e){var i,t=$(e);return null===(i=null==t?void 0:t.cities)||void 0===i?void 0:i.find(function(i){var t;return i.id===(null===(t=e.city)||void 0===t?void 0:t.value)})}function H(e){var i,t=B(e);return null===(i=null==t?void 0:t.districts)||void 0===i?void 0:i.find(function(i){var t;return i.id===(null===(t=e.district)||void 0===t?void 0:t.value)})}function J(e){var i,t,r,s,o,a,d,l,u,c,v,m,f,p,h;if(e.countries&&e.states&&e.cities&&e.districts&&e.regions){var y=e.countries.find(function(i){var t;return i.id===(null===(t=e.country)||void 0===t?void 0:t.value)}),b=e.states.find(function(i){var t;return i.id===(null===(t=e.state)||void 0===t?void 0:t.value)}),g=e.cities.find(function(i){var t;return i.id===(null===(t=e.city)||void 0===t?void 0:t.value)}),N=e.districts.find(function(i){var t;return i.id===(null===(t=e.district)||void 0===t?void 0:t.value)}),x=e.regions.find(function(i){var t;return i.id===(null===(t=e.region)||void 0===t?void 0:t.value)});return{id:e.id||n(),title:null===(i=e.title)||void 0===i?void 0:i.value,firstName:null===(t=e.firstName)||void 0===t?void 0:t.value,lastName:null===(r=e.lastName)||void 0===r?void 0:r.value,identityNumber:null===(s=e.identityNumber)||void 0===s?void 0:s.value,addressLine1:null===(o=e.addressLine1)||void 0===o?void 0:o.value,addressLine2:null===(a=e.addressLine2)||void 0===a?void 0:a.value,postalCode:null===(d=e.postalCode)||void 0===d?void 0:d.value,country:y?{id:y.id,name:y.name,code:y.iso3,iso2:y.iso2,iso3:y.iso3}:null,state:b?{id:b.id,name:b.name,code:b.stateCode}:null,city:!(null===(l=e.city)||void 0===l?void 0:l.isFreeText)&&g?{id:g.id,name:g.name,code:null}:{id:null,name:null===(u=e.city)||void 0===u?void 0:u.value,code:null},district:!(null===(c=e.district)||void 0===c?void 0:c.isFreeText)&&N?{id:N.id,name:N.name,code:null}:{id:null,name:null===(v=e.district)||void 0===v?void 0:v.value,code:null},region:x?{id:x.id,name:x.name}:null,phone:null===(m=e.phone)||void 0===m?void 0:m.value,company:null===(f=e.company)||void 0===f?void 0:f.value,taxOffice:null===(p=e.taxOffice)||void 0===p?void 0:p.value,taxNumber:null===(h=e.taxNumber)||void 0===h?void 0:h.value}}}function K(e){return{label:e.name,value:e.id+""}}function P(e){return e.sort(function(e,i){return e.label.localeCompare(i.label)})}var Q={firstName:{required:!0},lastName:{required:!0},identityNumber:{required:!0},addressLine1:{required:!0},addressLine2:{required:!1},postalCode:{required:!0},country:{required:!0},city:{required:!0,isFreeText:!1},district:{required:!0,isFreeText:!1},region:{required:!1},phone:{required:!1,regex:/^\+?\d{10,}$/},company:{required:!1},taxOffice:{required:!1},taxNumber:{required:!1}},U={value:"",hasError:!1,message:void 0,isLoading:!0};export{u as initAddressForm,p as setAddressFormAddressLine1,h as setAddressFormAddressLine2,N as setAddressFormCity,S as setAddressFormCompany,b as setAddressFormCountry,x as setAddressFormDistrict,v as setAddressFormFirstName,f as setAddressFormIdentityNumber,m as setAddressFormLastName,q as setAddressFormPhone,y as setAddressFormPostalCode,L as setAddressFormRegion,g as setAddressFormState,C as setAddressFormTaxNumber,O as setAddressFormTaxOffice,c as setAddressFormTitle,E as submitAddressForm};
|
|
@@ -3,7 +3,7 @@ import { APIResponse } from "../../../storefront-api-client/src";
|
|
|
3
3
|
import { AccountInfoForm, AddressForm, ContactForm, CouponCodeForm, ForgotPasswordForm, IkasContactForm, IkasCustomer, IkasCustomerAddress, IkasCustomerAttributeValue, IkasCustomerReviewForm, IkasFavoriteProduct, IkasOrder, IkasOrderTransaction, IkasProduct, IkasProductFile, LoginForm, NewsletterSubscriptionForm, OrderTrackingForm, RecoverPasswordForm, RegisterForm, SmsLoginForm, VerifyPhoneNumberForm } from "../../../storefront-models/src";
|
|
4
4
|
import { IkasCustomerStore } from "../../../stores/customer";
|
|
5
5
|
import { IkasLoginError, IkasRegisterError } from "../../api/customer";
|
|
6
|
-
export type SocialLoginProvider = "facebook" | "google" | "twitch";
|
|
6
|
+
export type SocialLoginProvider = "facebook" | "google" | "twitch" | "miles_smiles";
|
|
7
7
|
/**
|
|
8
8
|
* Initialize the customer store by loading tokens, refreshing authentication, and fetching customer data.
|
|
9
9
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__assign as e,__generator as r}from'./../../../ext/tslib/tslib.es6.mjs.js';import n from"../../../packages/storefront-api-client/src/config/index.js";import"../../../packages/storefront-api-client/src/utils/api.js";import'./../../../ext/isomorphic-fetch/fetch-npm-node.js';import{IkasStorefrontConfig as i}from"../../../packages/storefront-config/src/index.js";import{makeAutoObservable as s,observable as o}from'./../../../ext/mobx/dist/mobx.esm.js';import{Router as a}from"../../../router/index.js";import{baseStore as c}from"../../../stores/base/index.js";import{cartStore as u}from"../../../stores/cart/index.js";import{isServer as d,cloneDeep as l}from"../../../utils/helper.js";import'./../../../ext/lodash/sortBy.js';import"../../../stores/customer/index.js";import"../../../i18n/index.js";import{removeCart as m,getCart as f}from"../cart/index.js";import{isCustomerSubscribed as p}from"../../models/customer/index.js";import{initAddressForm as v}from"../../models/validator/address/index.js";import{getOrderLineItemRefundQuantity as h}from"../../models/order/line-item/index.js";import"../../models/product-list/index.js";import{initAccountInfoForm as _}from"../../models/validator/account-info/index.js";import{initContactForm as w}from"../../models/validator/contact-form/index.js";import{initCouponCodeForm as b}from"../../models/validator/coupon-code-form/index.js";import{initForgotPasswordForm as S}from"../../models/validator/forgot-password/index.js";import{initLoginForm as g}from"../../models/validator/login/index.js";import{initNewsletterSubscriptionForm as I}from"../../models/validator/newsletter-subscription/index.js";import{initOrderTrackingForm as y}from"../../models/validator/order-tracking/index.js";import{initRecoverPasswordForm as x}from"../../models/validator/recover-password/index.js";import{initRegisterForm as j}from"../../models/validator/register/index.js";import{initSmsLoginForm as k}from"../../models/validator/sms-login/index.js";import{initVerifyPhoneNumberForm as F}from"../../models/validator/verify-phone-number/index.js";var P="customerToken",T="customerTokenExpiry",C="customerEmailSubscription",E="lastViewedProducts",L="customerConsent";function N(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return function(t){if(d())return;var e=localStorage.getItem(P),r=localStorage.getItem(T);e&&r?jt(t,e,parseInt(r)):kt(t)}(e),Nt(e),function(t){if(d())return;t._customerConsentGranted=!!window.localStorage.getItem(L)}(e),[4,xt(e)];case 1:return t.sent(),[4,It(e)];case 2:return t.sent(),e._initialized=!0,[4,ct(e)];case 3:return t.sent(),e.customer?[4,import("../../../analytics/analytics-functions/customerVisit.js")]:[3,5];case 4:(0,t.sent().anl_customerVisit)(),t.label=5;case 5:return[2]}})})}function O(t){return!!t.customer&&(!(p(t.customer)||d()||t._visitorSubscribedEmail)&&!window.localStorage.getItem(C))}function R(t){return e(e({},t.customer),{consentGranted:t._customerConsentGranted})}function A(e,n){return t(this,void 0,void 0,function(){var t,e,s;return r(this,function(r){switch(r.label){case 0:return"undefined"==typeof window?[2]:(t=new URLSearchParams(window.location.search).get("redirect")||"",e="".concat(import.meta.env.VITE_BASE_URL,"/ms/").concat(n,"/login/authenticate?redirect=").concat(t),[4,fetch(e,{headers:{"x-api-key":i.apiKey||"","x-sfid":i.storefrontId||"","x-sfrid":i.storefrontRoutingId||""}})]);case 1:return[4,r.sent().json()];case 2:return s=r.sent(),a.navigate(s.redirectUrl),[2]}})})}function V(e){return t(this,void 0,void 0,function(){var t,n,i,s,o;return r(this,function(r){switch(r.label){case 0:return t={status:"fail"},n=new URLSearchParams(window.location.search),i=n.get("socialLoginStatus"),s=n.get("socialLoginToken"),"success"===i&&s?[4,D(e,s)]:[3,2];case 1:return r.sent()?(t.status="success",[2,t]):[2,t];case 2:return o=n.get("socialLoginError"),t.message=o||void 0,[2,t]}})})}function D(e,n){return t(this,void 0,void 0,function(){var t,i,s;return r(this,function(r){switch(r.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiSocialLogin)({code:n})];case 2:return(null==(t=r.sent())?void 0:t.isSuccess)&&(null===(s=t.data)||void 0===s?void 0:s.customer)?(jt(e,t.data.token,t.data.tokenExpiry),yt(e,t.data.customer),[4,import("../../../analytics/analytics-functions/customerLogin.js")]):[2,!1];case 3:return i=r.sent().anl_customerLogin,e.customer&&i(),[2,!0]}})})}function U(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:return(t=l(e.customer))&&t.addresses?-1===(i=t.addresses.findIndex(function(t){return t.id===n.id}))?[2,!1]:(t.addresses.splice(i,1),[4,$(e,t)]):[2,!1];case 1:return[2,r.sent()]}})})}function M(e,n,i){return t(this,void 0,void 0,function(){var t,e,s;return r(this,function(r){switch(r.label){case 0:r.label=1;case 1:return r.trys.push([1,4,,5]),t=[],n.orderLineItems.map(function(e){var r=h(e);r&&(null==t||t.push({orderLineItemId:e.id,quantity:r}))}),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiCreateOrderRefundRequest)({input:{email:i,orderId:n.id,orderLineItems:t}})];case 3:return(e=r.sent()).isSuccess&&e.data?(Object.entries(e.data).forEach(function(t){var e=t[0],r=t[1];n[e]=r}),[2,!0]):[3,5];case 4:return s=r.sent(),console.error(s),[3,5];case 5:return[2,!1]}})})}function B(e,n,i,s){return t(this,void 0,void 0,function(){var t,o;return r(this,function(r){switch(r.label){case 0:return[4,Ct(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiLogin)({email:n,password:i,phone:s,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Pt(e),t&&t.isSuccess&&t.data?(o=t.data,jt(e,o.token,o.tokenExpiry),o.customer&&yt(e,o.customer),e.customer?[4,import("../../../analytics/analytics-functions/customerLogin.js")]:[3,5]):[3,6];case 4:(0,r.sent().anl_customerLogin)(),r.label=5;case 5:return At(e),[2,{isSuccess:!0,errorCodes:[],otpSend:o.otpSend,flowId:o.flowId}];case 6:return[2,{isSuccess:!1,errorCodes:t.errorCodes.map(function(t){return["CUSTOMER_ACCOUNT_DISABLED","EMAIL_IS_NOT_VERIFIED","CUSTOMER_NOT_FOUND","B2B_CUSTOMER_ACCOUNT_DISABLED","PHONE_IS_NOT_VERIFIED","WRONG_PASSWORD"].includes(t)?t:"UNKOWN"})}]}})})}function G(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return Ft(e),m(u),[4,import("../../../analytics/analytics-functions/customerLogout.js")];case 1:return(0,t.sent().anl_customerLogout)(),[2]}})})}function W(e,n,i,s,o,a,c,u,d){return t(this,void 0,void 0,function(){var t,l;return r(this,function(r){switch(r.label){case 0:return[4,Ct(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiRegister)({email:s,password:o,firstName:n,lastName:i,isAcceptMarketing:a,attributes:c,captchaToken:e._captchaToken,phone:u,flowId:d})];case 3:return t=r.sent(),Pt(e),t&&t.isSuccess&&(null===(l=t.data)||void 0===l?void 0:l.customer)?(jt(e,t.data.token,t.data.tokenExpiry),yt(e,t.data.customer),At(e),[4,import("../../../analytics/analytics-functions/completeRegistration.js")]):[3,5];case 4:return(0,r.sent().anl_completeRegistration)(R(e)),[2,{isSuccess:!0,errorCodes:[]}];case 5:return[2,{isSuccess:!1,errorCodes:t.errorCodes.map(function(t){return["EMAIL_IS_NOT_VERIFIED","CUSTOMER_EMAIL_ALREADY_EXISTS","B2B_CUSTOMER_ACCOUNT_DISABLED","PHONE_IS_NOT_VERIFIED"].includes(t)?t:"UNKOWN"})}]}})})}function q(e){return t(this,void 0,void 0,function(){var t,n,i;return r(this,function(r){switch(r.label){case 0:return t=new URLSearchParams(window.location.search),(n=t.get("token"))?[4,Ct(e)]:[3,4];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiActivateCustomer)({token:n,captchaToken:e._captchaToken})];case 3:return i=r.sent(),Pt(e),[2,i.isSuccess];case 4:return[2,!1]}})})}function K(e,n){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return n?[4,Ct(e)]:[3,4];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiResendCustomerActivationMail)({email:n,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Pt(e),[2,t.isSuccess];case 4:return[2,!1]}})})}function z(e,n,i){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return n?[4,Ct(e)]:[3,4];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiValidateCustomerPhoneVerificationCode)({verificationCode:n,otpInfo:i,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Pt(e),[2,!(!t.isSuccess||!t.data)&&t.data];case 4:return[2,!1]}})})}function H(n,i,s){return t(this,void 0,void 0,function(){var t,o,a,c,u;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,7,,8]),[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiValidateOTPCode)({verificationCode:i,otpInfo:s,captchaToken:n._captchaToken})];case 2:return t=r.sent(),Pt(n),t&&t.isSuccess&&(null===(o=t.data)||void 0===o?void 0:o.customer)?(jt(n,t.data.token,t.data.tokenExpiry),yt(n,t.data.customer),At(n),[4,import("../../../analytics/analytics-functions/completeRegistration.js")]):[3,4];case 3:return(0,r.sent().anl_completeRegistration)(R(n)),[2,{isSuccess:!0,errorCodes:[]}];case 4:return t&&t.isSuccess&&((null===(a=t.data)||void 0===a?void 0:a.otpSend)||(null===(c=t.data)||void 0===c?void 0:c.flowId))?[2,{isSuccess:!0,otpSend:!0,flowId:null===(u=t.data)||void 0===u?void 0:u.flowId,errorCodes:[]}]:t.errorCodes.some(function(t){return"B2B_CUSTOMER_ACCOUNT_DISABLED"===t})?[4,import("../../../analytics/analytics-functions/completeRegistration.js")]:[3,6];case 5:(0,r.sent().anl_completeRegistration)(e(e({},R(n)),{notificationsAccepted:null}),!0),r.label=6;case 6:return[2,{isSuccess:!1,errorCodes:t.errorCodes.map(function(t){return["EMAIL_IS_NOT_VERIFIED","CUSTOMER_EMAIL_ALREADY_EXISTS","B2B_CUSTOMER_ACCOUNT_DISABLED","PHONE_IS_NOT_VERIFIED"].includes(t)?t:"UNKOWN"})}];case 7:return r.sent(),[2,{isSuccess:!1,errorCodes:[]}];case 8:return[2]}})})}function J(e){return t(this,void 0,void 0,function(){var t;return r(this,function(e){switch(e.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,e.sent().apiResendCustomerPhoneVerificationCode)()];case 2:return[2,!(!(t=e.sent()).isSuccess||!t.data)&&t.data]}})})}function X(n,i){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,import("../../../analytics/analytics-functions/contactForm.js")];case 1:return(0,r.sent().anl_contactForm)(i),[4,Ct(n)];case 2:return r.sent(),[4,import("../../api/customer/index.js")];case 3:return[4,(0,r.sent().apiSendContactFormToMerchant)(e(e({},i),{captchaToken:n._captchaToken}))];case 4:return t=r.sent(),Pt(n),[2,t.isSuccess]}})})}function Y(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:return[4,Ct(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiCheckEmail)({email:n,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Pt(e),[2,!!t.isSuccess&&!!(null===(i=t.data)||void 0===i?void 0:i.exists)]}})})}function Q(e,n){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,Ct(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiForgotPassword)({email:n,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Pt(e),[2,!!t.isSuccess&&t.data]}})})}function Z(e,n,i,s){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,Ct(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiRecoverPassword)({password:n,passwordAgain:i,token:s,captchaToken:e._captchaToken})];case 3:return t=r.sent(),Pt(e),[2,t.isSuccess]}})})}function $(e,n){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiSaveCustomer)({input:Ut(n)})];case 2:return(t=r.sent()).isSuccess&&t.data?(yt(e,t.data),[2,!0]):[2,!1]}})})}function tt(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,ht(e)];case 1:return t.sent(),e.customer?[4,import("../../api/customer/index.js")]:[2,[]];case 2:return[4,(0,t.sent().apiGetOrders)({})];case 3:return[2,t.sent().data||[]]}})})}function et(e,n){return t(this,void 0,void 0,function(){var s,o,a,c,u,d,l,m=this;return r(this,function(f){switch(f.label){case 0:return[4,ht(e)];case 1:return f.sent(),e.customer?(s=n,!i.isPreview||s&&"orders"!==s?[3,3]:[4,tt(e)]):[2,null];case 2:(o=f.sent()).length&&(s=o[0].id),f.label=3;case 3:return[4,Promise.all([t(m,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[2,(0,t.sent().apiGetOrders)({orderId:s})]}})}),gt(e),nt(e,{orderId:s})])];case 4:return a=f.sent(),c=a[0],u=a[2],c.isSuccess&&(null===(l=c.data)||void 0===l?void 0:l.length)?((d=c.data[0]).transactions=u,[2,d]):[2,null]}})})}function rt(e,n,i){return t(this,void 0,void 0,function(){var t,s,o,a;return r(this,function(r){switch(r.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiGetOrderByEmail)({email:n,orderNumber:i})];case 2:return(t=r.sent()).isSuccess&&t.data?(s=t.data,[4,Promise.all([gt(e),nt(e,{orderId:s.id})])]):[2,null];case 3:return o=r.sent(),a=o[1],s.transactions=a,[2,s]}})})}function nt(e){return t(this,arguments,void 0,function(t,e){var n;return void 0===e&&(e={}),r(this,function(t){switch(t.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return n=t.sent().apiListOrderTransactions,e.orderId||e.checkoutId||e.id?[4,n({checkoutId:{eq:e.checkoutId},id:{eq:e.checkoutId},orderId:{eq:e.orderId}})]:[2,[]];case 2:return[2,t.sent().data||[]]}})})}function it(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[2,[]];case 1:return[4,(0,t.sent().apiListFavoriteProducts)()];case 2:return[2,t.sent().data||[]]}})})}function st(e){return t(this,void 0,void 0,function(){var t,n,s,a,c;return r(this,function(r){switch(r.label){case 0:return[4,ct(e)];case 1:return 0===(t=r.sent()).length?[2,[]]:[4,import("../../api/product/index.js")];case 2:return[4,(0,r.sent().apiSearchProducts)({input:{productIdList:t.map(function(t){return t.productId}),priceListId:i.priceListId,salesChannelId:i.salesChannelId,perPage:100}})];case 3:return n=r.sent(),null===(a=null===(s=n.data)||void 0===s?void 0:s.data)||void 0===a||a.forEach(function(t){t.selectedVariantValues=t.variants[0].variantValues}),[2,o((null===(c=null==n?void 0:n.data)||void 0===c?void 0:c.data)||[])]}})})}function ot(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:if(!(null===(i=e.customer)||void 0===i?void 0:i.id))throw Error("Unauthorized");return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiSaveFavoriteProduct)({isFavorite:!0,productId:n})];case 2:return t=r.sent(),[4,import("../../../analytics/analytics-functions/addToWishlist.js")];case 3:return(0,r.sent().anl_addToWishlist)(n),t.isSuccess?[4,ct(e,!0)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2,t.data||!1]}})})}function at(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:if(!(null===(i=e.customer)||void 0===i?void 0:i.id))throw Error("Unauthorized");return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiSaveFavoriteProduct)({isFavorite:!1,productId:n})];case 2:return t=r.sent(),[4,import("../../../analytics/analytics-functions/addToWishlist.js")];case 3:return(0,r.sent().anl_addToWishlist)(n,!0),t.isSuccess?[4,ct(e,!0)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2,t.data||!1]}})})}function ct(e){return t(this,arguments,void 0,function(t,e){var n;return void 0===e&&(e=!1),r(this,function(r){switch(r.label){case 0:return[4,ht(t)];case 1:return r.sent(),t.customer?t._isFavoriteProductsLoaded&&!e?[3,3]:[4,it(t)]:[2,[]];case 2:n=r.sent(),t._favoriteProducts=n,t._isFavoriteProductsLoaded=!0,r.label=3;case 3:return[2,t._favoriteProducts]}})})}function ut(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){return[2,e._favoriteProducts.some(function(t){return t.productId===n})]})})}function dt(e,n){return t(this,void 0,void 0,function(){var t,i;return r(this,function(r){switch(r.label){case 0:return[4,Ct(e)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiSubscribeToMarketingNotifications)({input:{email:n,captchaToken:e._captchaToken}})];case 3:return(t=r.sent()).isSuccess?(i=e.customer,window.localStorage.setItem(C,"true"),i?i.subscriptionStatus:e._visitorSubscribedEmail=!0,[4,import("../../../analytics/analytics-functions/createEmailSubscription.js")]):[3,5];case 4:(0,r.sent().anl_createEmailSubscription)(n),r.label=5;case 5:return[2,t]}})})}function lt(n,i){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,Ct(n)];case 1:return r.sent(),[4,import("../../api/customer/index.js")];case 2:return[4,(0,r.sent().apiSaveCustomerFormData)({input:e(e({},i),{captchaToken:n._captchaToken})})];case 3:return(t=r.sent()).isSuccess?(window.localStorage.setItem(C,"true"),n.customer?n.customer.subscriptionStatus:n._visitorSubscribedEmail=!0,[4,import("../../../analytics/analytics-functions/createEmailSubscription.js")]):[3,5];case 4:(0,r.sent().anl_createEmailSubscription)(i.email),r.label=5;case 5:return[2,t.isSuccess]}})})}function mt(n,s){return t(this,void 0,void 0,function(){var t,o,a,c,u;return r(this,function(r){switch(r.label){case 0:if(t=i.customerReviewSettings,o=i.salesChannelId,a=i.getCurrentLocale(),!t)return[2];if(!(c=null===(u=n.customer)||void 0===u?void 0:u.id)&&t.customerLoginRequired)throw Error("Unauthorized");return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiCreateCustomerReview)({input:e(e({},s),{customerId:t.customerLoginRequired?c:void 0,salesChannelId:o||"",locale:a})})];case 2:return[2,r.sent().data]}})})}function ft(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,t.sent().apiDeactivateCustomer)({password:n})];case 2:return[2,t.sent()];case 3:return[2]}})})}function pt(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,t.sent().apiExportCustomerPersonalData)()];case 2:return[2,t.sent()];case 3:return[2]}})})}function vt(t){!function(t){if(d())return;t._customerConsentGranted=!0,window.localStorage.setItem(L,"true")}(t)}function ht(e){return t(this,void 0,void 0,function(){return r(this,function(t){return d()?[2]:[2,new Promise(function(t){var r=setInterval(function(){e._initialized&&(clearInterval(r),t(null))},100)})]})})}function _t(t){return new Promise(function(e){var r=setInterval(function(){t._captchaToken&&(clearInterval(r),e(null))},100)})}function wt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiListCustomerAttribute)()];case 2:return t=r.sent(),e.customer&&(null===(n=e.customer.attributes)||void 0===n||n.forEach(function(e){var r,n,i;e.customerAttribute=(null===(r=t.data)||void 0===r?void 0:r.find(function(t){return t.id===e.customerAttributeId}))||null,e.customerAttributeOptionId&&(e.customerAttributeOption=(null===(i=null===(n=e.customerAttribute)||void 0===n?void 0:n.options)||void 0===i?void 0:i.find(function(t){return t.id===e.customerAttributeOptionId}))||null)})),[2,t.data||[]]}})})}function bt(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return n.length?[4,import("../../api/checkout/index.js")]:[2,[]];case 1:return[4,(0,t.sent().apiListProductFile)({id:{in:n}})];case 2:return[2,t.sent().data||[]]}})})}function St(e,n,i){return t(this,void 0,void 0,function(){var t,e,s,o,a;return r(this,function(r){switch(r.label){case 0:r.label=1;case 1:return r.trys.push([1,5,,6]),(t=n.orderLineItems.find(function(t){return t.variant.id===i.variantId}))?[4,import("../../api/customer/index.js")]:[3,4];case 2:return[4,(0,r.sent().apiGetDigitalProductFileDownloadUrl)(n.id,t.id)];case 3:e=r.sent(),(s=e.data)&&((o=document.createElement("a")).href=s,o.download=decodeURIComponent(i.name.split("/")[i.name.split("/").length-1])||"",o.click(),o.remove()),r.label=4;case 4:return[3,6];case 5:return a=r.sent(),console.error(a),[3,6];case 6:return[2]}})})}function gt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return e._refundSettings?[3,3]:[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiListOrderRefundSettings)({})];case 2:(t=r.sent()).isSuccess&&(null===(n=t.data)||void 0===n?void 0:n.length)&&(e._refundSettings=t.data[0]),r.label=3;case 3:return[2]}})})}function It(e){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return d()||!e._token?[2]:[4,import("../../api/customer/index.js")];case 1:return[4,(0,r.sent().apiGetCustomer)()];case 2:return(t=r.sent()).data&&yt(e,t.data),[2]}})})}function yt(t,e){t.customer=e}function xt(e){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return e._token?[4,import("../../api/customer/index.js")]:[2];case 1:return[4,(0,r.sent().apiRefreshToken)({token:e._token})];case 2:if((t=r.sent()).isSuccess&&t.data)jt(e,t.data.token,t.data.tokenExpiry);else{if(t.isCancelled||t.isNetworkError)return[2];console.log("refreshToken error",t),e._token=null,e._tokenExpiry=null,Ft(e)}return[2]}})})}function jt(t,e,r){d()||(t._token=e,t._tokenExpiry=r,localStorage.setItem(P,e),localStorage.setItem(T,r+""),i.init({customerToken:e}),n.TOKEN=e)}function kt(t){localStorage.removeItem(P),localStorage.removeItem(T),t._token=null,t._tokenExpiry=null}function Ft(t){kt(t),t.customer=null,t._favoriteProducts=[],t._isFavoriteProductsLoaded=!1,i.init({customerToken:""}),n.TOKEN="",Pt(t)}function Pt(t){t._captchaToken=null}function Tt(t,e){t._captchaToken=e}function Ct(e){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),i.isCaptchaRequired()?(window.grecaptcha.execute(),[4,_t(e)]):[3,2];case 1:r.sent(),window.grecaptcha.reset(),r.label=2;case 2:return[3,4];case 3:return t=r.sent(),console.log("Get captcha error",t),[3,4];case 4:return[2]}})})}function Et(t,e){t._savedLastViewedProducts=l(t._lastViewedProducts),t._savedLastViewedProductsResponse=e}function Lt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return e.customer?[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,r.sent().apiGetLastViewedProducts)({customerId:e.customer.id})];case 2:return t=r.sent(),e._lastViewedProducts=(null===(n=l(t.data))||void 0===n?void 0:n.reverse())||[],[3,4];case 3:Nt(e),r.label=4;case 4:return[2,e._lastViewedProducts]}})})}function Nt(t){d()||(t._lastViewedProducts=Ot(),t._lastViewedProducts=l(t._lastViewedProducts).reverse())}function Ot(){if(d())return[];try{var t=window.localStorage.getItem(E);if(t)return JSON.parse(t)}catch(t){console.error(t)}return[]}function Rt(e,n,i){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.customer?e._lastViewedProducts.find(function(t){return t.productId===n})?[2]:[4,import("../../api/customer/index.js")]:[3,3];case 1:return[4,(0,t.sent().apiSaveLastViewedProducts)({input:{customerId:e.customer.id,products:[{productId:n,variantId:i}]}})];case 2:return t.sent()&&e._lastViewedProducts.push({productId:n,variantId:i}),[3,4];case 3:e._lastViewedProducts=Ot(),e._lastViewedProducts=e._lastViewedProducts.filter(function(t){return t.productId!==n}),e._lastViewedProducts.push({productId:n,variantId:i}),e._lastViewedProducts=e._lastViewedProducts.slice(-20),function(t){d()||window.localStorage.setItem(E,JSON.stringify(t._lastViewedProducts))}(e),t.label=4;case 4:return[2]}})})}function At(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:if(d())return[2];r.label=1;case 1:return r.trys.push([1,5,,6]),(t=Ot()).length?[4,import("../../api/customer/index.js")]:[3,4];case 2:return[4,(0,r.sent().apiSaveLastViewedProducts)({input:{customerId:e.customer.id,products:t}})];case 3:r.sent()&&(d()||window.localStorage.removeItem(E)),r.label=4;case 4:return[3,6];case 5:return n=r.sent(),console.error(n),[3,6];case 6:return[2]}})})}function Vt(t){return t._customerConsentGranted}function Dt(t){d()||window.localStorage.removeItem(L)}function Ut(t){var e;return{addresses:null===(e=t.addresses)||void 0===e?void 0:e.map(function(t){return{addressLine1:t.addressLine1,addressLine2:t.addressLine2,city:t.city,company:t.company,country:t.country,createdAt:t.createdAt,deleted:t.deleted,district:t.district,firstName:t.firstName,id:t.id,identityNumber:t.identityNumber,isDefault:t.isDefault,lastName:t.lastName,phone:t.phone,postalCode:t.postalCode,region:t.region,state:t.state,taxNumber:t.taxNumber,taxOffice:t.taxOffice,title:t.title,updatedAt:t.updatedAt}}),attributes:t.attributes,birthDate:t.birthDate,firstName:t.firstName,gender:t.gender,lastName:t.lastName,phone:t.phone,phoneSubscriptionStatus:t.phoneSubscriptionStatus,smsSubscriptionStatus:t.smsSubscriptionStatus,subscriptionStatus:t.subscriptionStatus}}function Mt(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../api/loyalty/index.js")];case 1:return[4,(0,t.sent().apiListEarningMethods)()];case 2:return[2,t.sent().data]}})})}function Bt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return[4,ht(e)];case 1:return r.sent(),(t=null===(n=u.cart)||void 0===n?void 0:n.id)?[4,import("../../api/loyalty/index.js")]:[2,[]];case 2:return[4,(0,r.sent().apiListSpendingMethodsByCartId)({cartId:t})];case 3:return[2,r.sent().data]}})})}function Gt(e){return t(this,void 0,void 0,function(){var t,n,i,s,o,a,c;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),[4,ht(e)];case 1:return r.sent(),t=null===(s=u.cart)||void 0===s?void 0:s.id,n=null===(c=null===(a=null===(o=u.cart)||void 0===o?void 0:o.loyaltyLines)||void 0===a?void 0:a[0])||void 0===c?void 0:c.loyaltySpendingMethodId,t&&n?[4,import("../../api/loyalty/index.js")]:[2];case 2:return[4,(0,r.sent().apiRemoveLoyaltyPointsFromCart)({cartId:t,loyaltySpendingMethodId:n})];case 3:return r.sent().isSuccess?[4,f()]:[3,5];case 4:r.sent(),r.label=5;case 5:return[3,7];case 6:return i=r.sent(),console.error(i),[3,7];case 7:return[2]}})})}function Wt(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return[4,ht(e)];case 1:return r.sent(),Ht(e)?(t=null===(n=u.cart)||void 0===n?void 0:n.id,[4,import("../../api/loyalty/index.js")]):[2,null];case 2:return[4,(0,r.sent().apiGetLoyaltyCustomerInfo)({cartId:t})];case 3:return[2,r.sent().data||null]}})})}function qt(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../api/loyalty/index.js")];case 1:return[4,(0,t.sent().apiListLoyaltyProgramTiers)()];case 2:return[2,t.sent().data]}})})}function Kt(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../api/loyalty/index.js")];case 1:return[4,(0,t.sent().apiListLoyaltyProgramPointHistory)(n)];case 2:return[2,t.sent().data]}})})}function zt(n,i){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return(t=null===(n=u.cart)||void 0===n?void 0:n.id)?[4,import("../../api/loyalty/index.js")]:[2,null];case 1:return[4,(0,r.sent().apiUseLoyaltyPoints)({input:e(e({},i.input),{cartId:t})})];case 2:return[2,r.sent().data||null]}})})}function Ht(t){return!!t.customer}function Jt(t){return t._accountInfoForm||(t._accountInfoForm={},_(t._accountInfoForm)),t._accountInfoForm}function Xt(t){t._accountInfoForm=null}function Yt(t){return t._contactForm||(t._contactForm={},w(t._contactForm)),t._contactForm}function Qt(t){t._contactForm=null}function Zt(t){return t._couponCodeForm||(t._couponCodeForm={},b(t._couponCodeForm)),t._couponCodeForm}function $t(t){t._couponCodeForm=null}function te(t){return t._forgotPasswordForm||(t._forgotPasswordForm={},S(t._forgotPasswordForm)),t._forgotPasswordForm}function ee(t){t._forgotPasswordForm=null}function re(t){return t._loginForm||(t._loginForm={},g(t._loginForm)),t._loginForm}function ne(t){return t._smsLoginForm||(t._smsLoginForm={},k(t._smsLoginForm)),t._smsLoginForm}function ie(t){return t._verifyPhoneNumberForm||(t._verifyPhoneNumberForm={},F(t._verifyPhoneNumberForm)),t._verifyPhoneNumberForm}function se(t){t._loginForm=null}function oe(t){return t._newsletterSubscriptionForm||(t._newsletterSubscriptionForm={},I(t._newsletterSubscriptionForm)),t._newsletterSubscriptionForm}function ae(t){t._newsletterSubscriptionForm=null}function ce(t){return t._orderTrackingForm||(t._orderTrackingForm={},y(t._orderTrackingForm)),t._orderTrackingForm}function ue(t){t._orderTrackingForm=null}function de(t){return t._recoverPasswordForm||(t._recoverPasswordForm={},x(t._recoverPasswordForm)),t._recoverPasswordForm}function le(t){t._recoverPasswordForm=null}function me(t){return t._registerForm||(t._registerForm={},j(t._registerForm)),t._registerForm}function fe(t){t._registerForm=null}function pe(t){var e={};return v(e),s(e)}function ve(e){return t(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return"ORDER_DETAIL"!==c.currentPageType||"undefined"==typeof window?[3,4]:(t=a.getCurrentPath().split("/").pop(),!i.isPreview||t&&"orders"!==t?[3,2]:[4,tt(e)]);case 1:(n=r.sent()).length&&(t=n[0].id),r.label=2;case 2:return t?[4,et(e,t)]:[3,4];case 3:return[2,r.sent()];case 4:return[2]}})})}function he(t){try{window.openIkasStorefrontWidget()}catch(t){console.error("Failed to open ikas storefront widget",t)}}function _e(t){try{window.closeIkasStorefrontWidget()}catch(t){console.error("Failed to close ikas storefront widget",t)}}export{q as activateCustomer,ot as addProductToFavorites,O as canCustomerCreateEmailSubscription,Y as checkEmail,Xt as clearAccountInfoForm,Qt as clearContactForm,$t as clearCouponCodeForm,ee as clearForgotPasswordForm,se as clearLoginForm,ae as clearNewsletterSubscriptionForm,ue as clearOrderTrackingForm,le as clearRecoverPasswordForm,fe as clearRegisterForm,_e as closeIkasStorefrontWidget,dt as createEmailSubscription,Wt as cs_getLoyaltyCustomerInfo,Mt as cs_listEarningMethods,Kt as cs_listLoyaltyProgramPointHistory,qt as cs_listLoyaltyProgramTiers,Bt as cs_listSpendingMethodsByCartId,Gt as cs_removeLoyaltyPointsFromCart,zt as cs_useLoyaltyPoints,B as customerLogin,Rt as customerStore_onProductView,R as customerToAnalyticsCustomer,ft as deactivateCustomer,U as deleteCustomerAddress,pt as exportCustomerPersonalData,Q as forgotPassword,Jt as getAccountInfoForm,Yt as getContactForm,Zt as getCouponCodeForm,wt as getCustomerAttributes,Vt as getCustomerConsentGranted,St as getDigitalProductFileDownloadUrl,pe as getEmptyAddressForm,st as getFavoriteProducts,it as getFavoriteProductsIds,te as getForgotPasswordForm,Lt as getLastViewedProducts,re as getLoginForm,oe as getNewsletterSubscriptionForm,et as getOrder,rt as getOrderByEmail,ve as getOrderDetailsOfPage,bt as getOrderProductFiles,gt as getOrderRefundSettings,ce as getOrderTrackingForm,nt as getOrderTransactions,tt as getOrders,de as getRecoverPasswordForm,me as getRegisterForm,ne as getSmsLoginForm,ie as getVerifyPhoneNumberForm,vt as handleCustomerConsentGrant,V as handleSocialLogin,Ht as hasCustomer,N as initCustomerStore,ut as isFavoriteProduct,G as logout,he as openIkasStorefrontWidget,Z as recoverPassword,M as refundOrder,W as register,Dt as removeCustomerConsent,at as removeProductFromFavorites,K as resendCustomerActivationMail,J as resendCustomerPhoneVerificationCode,X as saveContactForm,$ as saveCustomer,lt as saveCustomerFormData,mt as sendReview,Tt as setCaptchaToken,Et as setSavedLastViewedProductsResponse,A as socialLogin,D as socialLoginToken,z as validateCustomerPhoneVerificationCode,H as validateOTPCode,_t as waitForCaptchaTokenInit,ht as waitForCustomerStoreInit};
|
|
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};
|
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,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,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}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,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}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";
|
package/dist/router/index.d.ts
CHANGED
|
@@ -155,6 +155,25 @@ export declare class Router {
|
|
|
155
155
|
* ```
|
|
156
156
|
*/
|
|
157
157
|
static getPageParams(): Record<string, string>;
|
|
158
|
+
/**
|
|
159
|
+
* Get the current URL query parameters as an object.
|
|
160
|
+
*
|
|
161
|
+
* @ai-category Navigation
|
|
162
|
+
* @ai-related getCurrentPath, getPageParams
|
|
163
|
+
*
|
|
164
|
+
* @returns Object containing query parameters parsed from the current URL
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* import { Router } from "@ikas/bp-storefront";
|
|
169
|
+
*
|
|
170
|
+
* // URL: /search?q=shoes&color=red
|
|
171
|
+
* const query = Router.router_getQueryParams();
|
|
172
|
+
* console.log(query.q); // "shoes"
|
|
173
|
+
* console.log(query.color); // "red"
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
static router_getQueryParams(): Record<string, string>;
|
|
158
177
|
private static handleRouteChange;
|
|
159
178
|
private static handlePopState;
|
|
160
179
|
private static interceptAnchorClicks;
|
package/dist/router/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IkasStorefrontConfig as e}from"../packages/storefront-config/src/index.js";import{getCheckoutUrlFromCartStore as t}from"../functions/stores/cart/index.js";import{cartStore as a}from"../stores/cart/index.js";var r=function(){function r(){}return r.initialize=function(e,t){var a=this;this.window=t||window,this.currentPath=void 0!==this.window?this.window.location.pathname:"/",void 0!==this.window&&(r.pageParams=e,this.window.addEventListener("popstate",r.handlePopState),r.interceptAnchorClicks(),this.window.addEventListener("pageshow",function(e){return a.isFromBFCache=e.persisted}))},r.navigate=function(t,a,n){if(void 0===a&&(a=!1),void 0===n&&(n=!1),void 0!==this.window){var o=r.ensurePathPrefix(t);e.getIsPreview()||(a?this.window.history.replaceState({},"",o):n?this.window.open(o,"_blank"):this.window.location.href=o),r.handleRouteChange(o)}},r.navigateToPage=function(e,n,c,
|
|
1
|
+
import{IkasStorefrontConfig as e}from"../packages/storefront-config/src/index.js";import{getCheckoutUrlFromCartStore as t}from"../functions/stores/cart/index.js";import{cartStore as a}from"../stores/cart/index.js";var r=function(){function r(){}return r.initialize=function(e,t){var a=this;this.window=t||window,this.currentPath=void 0!==this.window?this.window.location.pathname:"/",void 0!==this.window&&(r.pageParams=e,this.window.addEventListener("popstate",r.handlePopState),r.interceptAnchorClicks(),this.window.addEventListener("pageshow",function(e){return a.isFromBFCache=e.persisted}))},r.navigate=function(t,a,n){if(void 0===a&&(a=!1),void 0===n&&(n=!1),void 0!==this.window){var o=r.ensurePathPrefix(t);e.getIsPreview()||(a?this.window.history.replaceState({},"",o):n?this.window.open(o,"_blank"):this.window.location.href=o),r.handleRouteChange(o)}},r.navigateToPage=function(e,n,i,c,s){void 0===c&&(c=!1),void 0===s&&(s=!1);var u=Object.entries(i||{}).map(function(e){var t=e[0],a=e[1];return"".concat(t,"=").concat(encodeURIComponent(a))}).join("&"),h="";switch(e){case"INDEX":h="/";break;case"ACCOUNT":h="/account";break;case"ACTIVATE_CUSTOMER":h="/account/activate";break;case"ADDRESSES":h="/account/addresses";break;case"FAVORITE_PRODUCTS":h="/account/favorite-products";break;case"FORGOT_PASSWORD":h="/account/forgot-password";break;case"LOGIN":h="/account/login";break;case"RAFFLE_ACCOUNT":h="/account/raffles";break;case"RECOVER_PASSWORD":h="/account/recover-password";break;case"REGISTER":h="/account/register";break;case"ORDERS":h="/account/orders";break;case"ORDER_DETAIL":h="/account/orders/".concat(n);break;case"BLOG_INDEX":h="/blog";break;case"BLOG":case"BLOG_CATEGORY":h="/blog/".concat(n);break;case"CART":h="/cart";break;case"CHECKOUT":h=t(a);break;case"CUSTOM":h="/pages/".concat(n);break;case"RAFFLE":h="/raffle";break;case"RAFFLE_DETAIL":h="/raffle/".concat(n);break;case"SEARCH":h="/search";break;case"NOT_FOUND":h="/404"}u&&(h+="?".concat(u)),r.navigate(o(h),c,s)},r.addObserver=function(e){r.observers.push(e)},r.removeObserver=function(e){r.observers=r.observers.filter(function(t){return t!==e})},r.goBack=function(){this.window.history.back()},r.getCurrentPath=function(){return r.currentPath},r.getPageParams=function(){return r.pageParams},r.router_getQueryParams=function(){if(void 0===this.window)return{};var e={};return new URLSearchParams(this.window.location.search).forEach(function(t,a){e[a]=t}),e},r.handleRouteChange=function(e){r.currentPath=e,r.notifyObservers()},r.handlePopState=function(){void 0!==this.window&&r.handleRouteChange(this.window.location.pathname)},r.interceptAnchorClicks=function(){void 0!==this.window&&this.window.addEventListener("click",function(e){var t=e.target.closest("a");if(t&&"A"===t.tagName&&t.getAttribute("href")){var a=t.getAttribute("href");if(e.metaKey||e.ctrlKey)return;if(/^(mailto|tel|sms|javascript):/i.test(a))return;e.preventDefault();var n="_blank"===t.getAttribute("target");r.navigate(a,!1,n)}})},r.notifyObservers=function(){r.observers.forEach(function(e){return e(r.currentPath)})},r.ensurePathPrefix=function(e){return e.startsWith("http")||e.startsWith("/")?e:"/".concat(e)},r.currentPath="undefined"!=typeof window?window.location.pathname:"/",r.observers=[],r.pageParams={},r.isFromBFCache=!1,r}(),n=r;function o(t){var a=e.getCurrentPath(),r=t.split("/").filter(function(e){return""!==e})[0];return r&&e.getSupportedPaths().includes(r)?t:"".concat(a?"/".concat(a):"").concat(t).replace("//","/")}export{r as Router,n as router,o as withRoutePrefix};
|
|
@@ -92,7 +92,8 @@ export type StorefrontB2BShowProductsEnum = "StorefrontB2BShowProductsEnum" | "A
|
|
|
92
92
|
export type StorefrontPageTypesEnum = "StorefrontPageTypesEnum" | "BLOG" | "BLOG_CATEGORY" | "BRAND" | "CATEGORY" | "CUSTOM" | "PRODUCT";
|
|
93
93
|
export type StorefrontPolicyTypeEnum = "StorefrontPolicyTypeEnum" | "IMPRINT" | "OTHER" | "PRIVACY_POLICY" | "RETURN_POLICY" | "SHIPPING_POLICY" | "TERMS_OF_SERVICE";
|
|
94
94
|
export type StorefrontPopupDeviceTypeEnum = "StorefrontPopupDeviceTypeEnum" | "ALL" | "DESKTOP" | "MOBILE";
|
|
95
|
-
export type StorefrontPopupDisplayFilterTypeEnum = "StorefrontPopupDisplayFilterTypeEnum" | "CART_TOTAL" | "CUSTOMER_SEGMENT";
|
|
95
|
+
export type StorefrontPopupDisplayFilterTypeEnum = "StorefrontPopupDisplayFilterTypeEnum" | "APPLIED_CAMPAIGN" | "BRAND_IN_CART" | "CART_ITEM_COUNT" | "CART_TOTAL" | "CATEGORY_IN_CART" | "CUSTOMER_AUTH_STATUS" | "CUSTOMER_GENDER" | "CUSTOMER_GROUP" | "CUSTOMER_SEGMENT" | "CUSTOMER_SUBSCRIPTION" | "PRODUCT_IN_CART";
|
|
96
|
+
export type StorefrontPopupDisplayFilterOperatorEnum = "StorefrontPopupDisplayFilterOperatorEnum" | "ANY_OF" | "BETWEEN" | "EQUALS" | "GREATER_THAN" | "GREATER_THAN_OR_EQUAL" | "LESS_THAN" | "LESS_THAN_OR_EQUAL" | "NONE_OF" | "NOT_EQUALS";
|
|
96
97
|
export type StorefrontPopupDisplayFrequencyEnum = "StorefrontPopupDisplayFrequencyEnum" | "EVERY_TIME" | "ONCE_PER_SESSION";
|
|
97
98
|
export type StorefrontPopupDisplayTriggerTypeEnum = "StorefrontPopupDisplayTriggerTypeEnum" | "EXIT_INTENT" | "ON_PAGE_LOAD" | "SCROLL_DOWN";
|
|
98
99
|
export type StorefrontPopupPageFilterDataTypeEnum = "StorefrontPopupPageFilterDataTypeEnum" | "CONTAINS" | "DOES_NOT_CONTAIN" | "EXACT_MATCH" | "ID_LIST";
|
|
@@ -2659,6 +2660,7 @@ export interface StorefrontPopup {
|
|
|
2659
2660
|
deleted: boolean;
|
|
2660
2661
|
displayFilters: StorefrontPopupDisplayFilter[] | null;
|
|
2661
2662
|
displaySettings: StorefrontPopupDisplaySettings;
|
|
2663
|
+
hideFilters: StorefrontPopupDisplayFilter[] | null;
|
|
2662
2664
|
id: string;
|
|
2663
2665
|
name: string;
|
|
2664
2666
|
pageFilters: StorefrontPopupPageFilter[] | null;
|
|
@@ -2678,9 +2680,9 @@ export interface StorefrontPopupDateFilter {
|
|
|
2678
2680
|
startDate: any | null;
|
|
2679
2681
|
}
|
|
2680
2682
|
export interface StorefrontPopupDisplayFilter {
|
|
2681
|
-
operator:
|
|
2683
|
+
operator: StorefrontPopupDisplayFilterOperatorEnum;
|
|
2682
2684
|
type: StorefrontPopupDisplayFilterTypeEnum;
|
|
2683
|
-
value: string;
|
|
2685
|
+
value: string[];
|
|
2684
2686
|
}
|
|
2685
2687
|
export interface StorefrontPopupDisplaySettings {
|
|
2686
2688
|
frequency: StorefrontPopupDisplayFrequencyEnum;
|
|
@@ -14,6 +14,7 @@ export type IkasStorefrontPopup = {
|
|
|
14
14
|
dateFilter: IkasStorefrontPopupDateFilter | null;
|
|
15
15
|
displayFilters: IkasStorefrontPopupDisplayFilter[] | null;
|
|
16
16
|
displaySettings: IkasStorefrontPopupDisplaySettings;
|
|
17
|
+
hideFilters: IkasStorefrontPopupDisplayFilter[] | null;
|
|
17
18
|
name: string;
|
|
18
19
|
pageFilters: IkasStorefrontPopupPageFilter[] | null;
|
|
19
20
|
status: IkasStorefrontPopupStatusEnum;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type IkasStorefrontPopupDisplayFilter = {
|
|
2
|
-
operator:
|
|
2
|
+
operator: IkasStorefrontPopupDisplayFilterOperatorEnum;
|
|
3
3
|
type: IkasStorefrontPopupDisplayFilterTypeEnum;
|
|
4
|
-
value: string;
|
|
4
|
+
value: string[];
|
|
5
5
|
};
|
|
6
|
-
export type IkasStorefrontPopupDisplayFilterTypeEnum = "CART_TOTAL" | "CUSTOMER_SEGMENT";
|
|
6
|
+
export type IkasStorefrontPopupDisplayFilterTypeEnum = "APPLIED_CAMPAIGN" | "BRAND_IN_CART" | "CART_ITEM_COUNT" | "CART_TOTAL" | "CATEGORY_IN_CART" | "CUSTOMER_AUTH_STATUS" | "CUSTOMER_GENDER" | "CUSTOMER_GROUP" | "CUSTOMER_SEGMENT" | "CUSTOMER_SUBSCRIPTION" | "PRODUCT_IN_CART";
|
|
7
|
+
export type IkasStorefrontPopupDisplayFilterOperatorEnum = "ANY_OF" | "BETWEEN" | "EQUALS" | "GREATER_THAN" | "GREATER_THAN_OR_EQUAL" | "LESS_THAN" | "LESS_THAN_OR_EQUAL" | "NONE_OF" | "NOT_EQUALS";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { IkasForm, IkasFormItem } from "..";
|
|
1
|
+
import { IkasForm, IkasFormItem, IkasFormItemBoolean } from "..";
|
|
2
2
|
export type AccountInfoForm = {
|
|
3
3
|
firstName?: IkasFormItem;
|
|
4
4
|
lastName?: IkasFormItem;
|
|
5
|
+
isMarketingAccepted?: IkasFormItemBoolean;
|
|
5
6
|
isInitialized?: boolean;
|
|
6
7
|
phone?: IkasFormItem;
|
|
7
8
|
} & IkasForm;
|