@ikas/storefront 5.0.0-beta.9 → 5.0.1
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/build/analytics/analytics.d.ts +4 -0
- package/build/analytics/analytics.js +1 -1
- package/build/analytics/facebookPixel.d.ts +1 -0
- package/build/analytics/facebookPixel.js +1 -1
- package/build/analytics/googleAnalytics.d.ts +1 -0
- package/build/analytics/googleAnalytics.js +1 -1
- package/build/analytics/googleTagManager.d.ts +12 -21
- package/build/analytics/googleTagManager.js +1 -1
- package/build/analytics/head/index.js +1 -1
- package/build/analytics/ikas.d.ts +2 -1
- package/build/analytics/ikas.js +1 -1
- package/build/analytics/tiktokPixel.d.ts +1 -0
- package/build/analytics/tiktokPixel.js +1 -1
- package/build/components/checkout/components/address-form/index.js +1 -1
- package/build/components/checkout/components/address-form/model.d.ts +13 -2
- package/build/components/checkout/components/address-form/model.js +1 -1
- package/build/components/checkout/components/cart-summary/cart-item/bundle-product-item/index.d.ts +7 -0
- package/build/components/checkout/components/cart-summary/cart-item/bundle-product-item/index.js +1 -0
- package/build/components/checkout/components/cart-summary/cart-item/bundle-product-item/style.module.scss.js +1 -0
- package/build/components/checkout/components/cart-summary/cart-item/index.d.ts +1 -0
- package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
- package/build/components/checkout/components/cart-summary/cart-item/style.module.scss.js +1 -1
- package/build/components/checkout/components/cart-summary/cart-item/svg/arrow-down.d.ts +2 -0
- package/build/components/checkout/components/cart-summary/cart-item/svg/arrow-down.js +1 -0
- package/build/components/checkout/components/cart-summary/index.d.ts +11 -0
- package/build/components/checkout/components/cart-summary/index.js +1 -1
- package/build/components/checkout/components/cart-summary/style.module.scss.js +1 -1
- package/build/components/checkout/components/credit-card-form/model.js +1 -1
- package/build/components/checkout/components/customer-addresses/index.js +1 -1
- package/build/components/checkout/components/customer-addresses/model.js +1 -1
- package/build/components/checkout/components/customer-addresses/style.module.scss.js +1 -1
- package/build/components/checkout/components/epaykolay-button/index.d.ts +5 -0
- package/build/components/checkout/components/epaykolay-button/index.js +1 -0
- package/build/components/checkout/components/epaykolay-button/style.module.scss.js +1 -0
- package/build/components/checkout/components/error/customer-account-disabled-error/index.d.ts +8 -0
- package/build/components/checkout/components/error/customer-account-disabled-error/index.js +1 -0
- package/build/components/checkout/components/error/customer-login-required-error/index.js +1 -1
- package/build/components/checkout/components/error/index.js +1 -1
- package/build/components/checkout/components/form-item/index.js +1 -1
- package/build/components/checkout/components/form-item/model.js +1 -1
- package/build/components/checkout/components/notification-box/index.d.ts +2 -0
- package/build/components/checkout/components/notification-box/index.js +1 -1
- package/build/components/checkout/components/offer-product/index.js +1 -1
- package/build/components/checkout/components/paypal/index.d.ts +7 -0
- package/build/components/checkout/components/paypal/index.js +1 -0
- package/build/components/checkout/components/paypal/style.module.scss.js +1 -0
- package/build/components/checkout/components/product-files/index.d.ts +7 -0
- package/build/components/checkout/components/product-files/index.js +1 -0
- package/build/components/checkout/components/product-files/style.module.scss.js +1 -0
- package/build/components/checkout/components/quick-registration/model.js +1 -1
- package/build/components/checkout/components/select-box/index.d.ts +1 -0
- package/build/components/checkout/components/select-box/index.js +1 -1
- package/build/components/checkout/components/stripe/index.js +1 -1
- package/build/components/checkout/components/svg/epaykolay.d.ts +6 -0
- package/build/components/checkout/components/svg/epaykolay.js +1 -0
- package/build/components/checkout/components/toggle/index.d.ts +1 -0
- package/build/components/checkout/components/toggle/index.js +1 -1
- package/build/components/checkout/components/toggle/style.module.scss.js +1 -1
- package/build/components/checkout/index.d.ts +2 -0
- package/build/components/checkout/index.js +1 -1
- package/build/components/checkout/model.d.ts +44 -17
- package/build/components/checkout/model.js +1 -1
- package/build/components/checkout/steps/step-payment/index.js +1 -1
- package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
- package/build/components/checkout/steps/step-payment/style.module.scss.js +1 -1
- package/build/components/checkout/steps/step-shipping/index.js +1 -1
- package/build/components/checkout/steps/step-success/index.js +1 -1
- package/build/components/checkout/steps/step-success/style.module.scss.js +1 -1
- package/build/components/checkout/style.module.scss.js +1 -1
- package/build/components/google-captcha/index.js +1 -1
- package/build/components/link/index.js +1 -1
- package/build/components/page/head.js +1 -1
- package/build/components/page/index.js +1 -1
- package/build/components/page-editor/ThemeComponentEditor.js +1 -1
- package/build/components/page-editor/model.d.ts +1 -0
- package/build/components/page-editor/model.js +1 -1
- package/build/hooks/useCustomerReviews.js +1 -1
- package/build/hooks/useStore.js +1 -1
- package/build/index.js +1 -1
- package/build/models/data/cart/available-shipping-method/estimated-delivery-time/index.d.ts +6 -0
- package/build/models/data/cart/available-shipping-method/estimated-delivery-time/index.js +1 -0
- package/build/models/data/cart/available-shipping-method/index.d.ts +2 -0
- package/build/models/data/cart/available-shipping-method/index.js +1 -1
- package/build/models/data/category/conditions/index.d.ts +21 -0
- package/build/models/data/category/conditions/index.js +1 -0
- package/build/models/data/category/index.d.ts +3 -0
- package/build/models/data/category/index.js +1 -1
- package/build/models/data/checkout/index.d.ts +2 -2
- package/build/models/data/checkout-settings/index.d.ts +2 -1
- package/build/models/data/checkout-settings/index.js +1 -1
- package/build/models/data/checkout-settings/price/index.d.ts +2 -1
- package/build/models/data/checkout-settings/price/index.js +1 -1
- package/build/models/data/contact-form/index.d.ts +1 -0
- package/build/models/data/contact-form/index.js +1 -1
- package/build/models/data/customer/address/ikas-localized-customer-address.d.ts +26 -12
- package/build/models/data/customer/address/ikas-localized-customer-address.js +1 -1
- package/build/models/data/customer/address/index.d.ts +5 -0
- package/build/models/data/customer/address/index.js +1 -1
- package/build/models/data/customer/address/region/index.d.ts +6 -0
- package/build/models/data/customer/address/region/index.js +1 -0
- package/build/models/data/customer/index.d.ts +7 -0
- package/build/models/data/customer/index.js +1 -1
- package/build/models/data/customer/price-list-rule/filter/index.d.ts +7 -0
- package/build/models/data/customer/price-list-rule/filter/index.js +1 -0
- package/build/models/data/customer/price-list-rule/index.d.ts +10 -0
- package/build/models/data/customer/price-list-rule/index.js +1 -0
- package/build/models/data/customer/review/index.d.ts +1 -0
- package/build/models/data/customer/review/index.js +1 -1
- package/build/models/data/favorite-product/index.d.ts +2 -0
- package/build/models/data/favorite-product/index.js +1 -1
- package/build/models/data/filter-category/index.d.ts +4 -0
- package/build/models/data/filter-category/index.js +1 -1
- package/build/models/data/html-meta-data/translations/index.d.ts +1 -0
- package/build/models/data/html-meta-data/translations/index.js +1 -1
- package/build/models/data/image/index.d.ts +1 -0
- package/build/models/data/image/index.js +1 -1
- package/build/models/data/index.d.ts +15 -1
- package/build/models/data/order/address/ikas-localized-order-address.d.ts +48 -18
- package/build/models/data/order/address/ikas-localized-order-address.js +1 -1
- package/build/models/data/order/address/index.d.ts +5 -0
- package/build/models/data/order/address/index.js +1 -1
- package/build/models/data/order/address/region/index.d.ts +6 -0
- package/build/models/data/order/address/region/index.js +1 -0
- package/build/models/data/order/index.d.ts +3 -0
- package/build/models/data/order/index.js +1 -1
- package/build/models/data/order/line-item/index.d.ts +5 -0
- package/build/models/data/order/line-item/index.js +1 -1
- package/build/models/data/order/line-item/variant/bundle-product/bundle-variant/index.d.ts +33 -0
- package/build/models/data/order/line-item/variant/bundle-product/bundle-variant/index.js +1 -0
- package/build/models/data/order/line-item/variant/bundle-product/index.d.ts +15 -0
- package/build/models/data/order/line-item/variant/bundle-product/index.js +1 -0
- package/build/models/data/order/line-item/variant/index.d.ts +4 -0
- package/build/models/data/order/line-item/variant/index.js +1 -1
- package/build/models/data/order/transaction/index.d.ts +1 -0
- package/build/models/data/order/transaction/index.js +1 -1
- package/build/models/data/order/transaction/payment-method-detail/index.d.ts +1 -0
- package/build/models/data/order/transaction/payment-method-detail/index.js +1 -1
- package/build/models/data/product/campaign-offer/index.d.ts +15 -0
- package/build/models/data/product/campaign-offer/index.js +1 -0
- package/build/models/data/product/filter/index.d.ts +2 -0
- package/build/models/data/product/filter/index.js +1 -1
- package/build/models/data/product/group/index.d.ts +11 -0
- package/build/models/data/product/group/index.js +1 -0
- package/build/models/data/product/group/translation/index.d.ts +13 -0
- package/build/models/data/product/group/translation/index.js +1 -0
- package/build/models/data/product/group/value/index.d.ts +7 -0
- package/build/models/data/product/group/value/index.js +1 -0
- package/build/models/data/product/image/index.d.ts +1 -0
- package/build/models/data/product/image/index.js +1 -1
- package/build/models/data/product/index.d.ts +34 -1
- package/build/models/data/product/index.js +1 -1
- package/build/models/data/product/variant/bundle-settings/bundle-product/index.d.ts +28 -0
- package/build/models/data/product/variant/bundle-settings/bundle-product/index.js +1 -0
- package/build/models/data/product/variant/bundle-settings/index.d.ts +8 -0
- package/build/models/data/product/variant/bundle-settings/index.js +1 -0
- package/build/models/data/product/variant/index.d.ts +35 -3
- package/build/models/data/product/variant/index.js +1 -1
- package/build/models/data/product/variant/price/index.d.ts +26 -0
- package/build/models/data/product/variant/price/index.js +1 -1
- package/build/models/data/product/variant/price/product-campaign-price/index.d.ts +6 -0
- package/build/models/data/product/variant/price/product-campaign-price/index.js +1 -0
- package/build/models/data/product-file/index.d.ts +8 -0
- package/build/models/data/product-file/index.js +1 -0
- package/build/models/data/shipping-zone/index.d.ts +9 -0
- package/build/models/data/shipping-zone/index.js +1 -0
- package/build/models/data/shipping-zone/state/city/district/index.d.ts +7 -0
- package/build/models/data/shipping-zone/state/city/district/index.js +1 -0
- package/build/models/data/shipping-zone/state/city/district/region/index.d.ts +6 -0
- package/build/models/data/shipping-zone/state/city/district/region/index.js +1 -0
- package/build/models/data/shipping-zone/state/city/index.d.ts +8 -0
- package/build/models/data/shipping-zone/state/city/index.js +1 -0
- package/build/models/data/shipping-zone/state/index.d.ts +9 -0
- package/build/models/data/shipping-zone/state/index.js +1 -0
- package/build/models/data/storefront/b2b-settings/index.d.ts +8 -0
- package/build/models/data/storefront/b2b-settings/index.js +1 -0
- package/build/models/data/storefront/index-page-seo-setting/index.d.ts +17 -0
- package/build/models/data/storefront/index-page-seo-setting/index.js +1 -0
- package/build/models/data/storefront/index.d.ts +6 -1
- package/build/models/data/storefront/index.js +1 -1
- package/build/models/data/theme-json/component/index.d.ts +2 -0
- package/build/models/data/theme-json/component/index.js +1 -1
- package/build/models/data/theme-json/component/prop/index.d.ts +2 -0
- package/build/models/data/theme-json/component/prop/index.js +1 -1
- package/build/models/data/theme-json/custom-data/index.d.ts +2 -0
- package/build/models/data/theme-json/custom-data/index.js +1 -1
- package/build/models/data/theme-json/index.js +1 -1
- package/build/models/data/video/index.d.ts +11 -0
- package/build/models/data/video/index.js +1 -0
- package/build/models/ui/blog-category-list/index.js +1 -1
- package/build/models/ui/brand-list/index.js +1 -1
- package/build/models/ui/category-list/index.js +1 -1
- package/build/models/ui/customer-review-list/index.js +1 -1
- package/build/models/ui/customer-review-summary-list/index.js +1 -1
- package/build/models/ui/index.d.ts +1 -1
- package/build/models/ui/product-attribute-list/index.js +1 -1
- package/build/models/ui/product-list/index.d.ts +25 -3
- package/build/models/ui/product-list/index.js +1 -1
- package/build/models/ui/raffle-list/index.js +1 -1
- package/build/models/ui/validator/form/account-info.js +1 -1
- package/build/models/ui/validator/form/address.js +1 -1
- package/build/models/ui/validator/form/contact-form.d.ts +6 -0
- package/build/models/ui/validator/form/contact-form.js +1 -1
- package/build/models/ui/validator/form/ikas-address.d.ts +46 -20
- package/build/models/ui/validator/form/ikas-address.js +1 -1
- package/build/models/ui/validator/form/login.d.ts +7 -4
- package/build/models/ui/validator/form/login.js +1 -1
- package/build/models/ui/validator/form/register.d.ts +10 -1
- package/build/models/ui/validator/form/register.js +1 -1
- package/build/page-data-init/index.d.ts +9 -1
- package/build/page-data-init/index.js +1 -1
- package/build/pages/account/activate.d.ts +4 -0
- package/build/pages/account/activate.js +1 -0
- package/build/pages/checkout.js +1 -1
- package/build/pages/home.js +1 -1
- package/build/pages/index.d.ts +1 -0
- package/build/store/base.d.ts +1 -0
- package/build/store/base.js +1 -1
- package/build/store/blog/index.js +1 -1
- package/build/store/brand/index.js +1 -1
- package/build/store/cart/index.d.ts +6 -2
- package/build/store/cart/index.js +1 -1
- package/build/store/category/index.js +1 -1
- package/build/store/checkout/index.d.ts +7 -2
- package/build/store/checkout/index.js +1 -1
- package/build/store/customer/api.d.ts +5 -1
- package/build/store/customer/api.js +1 -1
- package/build/store/customer/index.d.ts +25 -5
- package/build/store/customer/index.js +1 -1
- package/build/store/html-meta-data/index.js +1 -1
- package/build/store/index.d.ts +1 -1
- package/build/store/location/index.d.ts +2 -1
- package/build/store/location/index.js +1 -1
- package/build/store/product/index.d.ts +4 -1
- package/build/store/product/index.js +1 -1
- package/build/utils/constants.js +1 -1
- package/build/utils/helper.d.ts +1 -0
- package/build/utils/helper.js +1 -1
- package/package.json +18 -14
- package/build/analytics/googleUniversal.d.ts +0 -9
- package/build/analytics/googleUniversal.js +0 -1
- package/build/ext/@builder.io/partytown/integration/index.mjs.js +0 -1
- package/build/ext/@builder.io/partytown/react/index.mjs.js +0 -1
- package/build/models/data/checkout/country-settings-model.d.ts +0 -141
- package/build/models/data/checkout/country-settings-model.js +0 -1
|
@@ -3,12 +3,14 @@ declare type ContactFormProps<T> = {
|
|
|
3
3
|
requiredRule: ((model: T) => string) | string;
|
|
4
4
|
emailRule: ((model: T) => string) | string;
|
|
5
5
|
minRule: ((model: T) => string) | string;
|
|
6
|
+
phoneRule?: ((model: T) => string) | string;
|
|
6
7
|
};
|
|
7
8
|
};
|
|
8
9
|
declare type ContactFormModel = {
|
|
9
10
|
firstName: string;
|
|
10
11
|
lastName: string;
|
|
11
12
|
email: string;
|
|
13
|
+
phone?: string | null;
|
|
12
14
|
message: string;
|
|
13
15
|
};
|
|
14
16
|
export declare class ContactForm {
|
|
@@ -21,17 +23,21 @@ export declare class ContactForm {
|
|
|
21
23
|
set lastName(value: string);
|
|
22
24
|
get email(): string;
|
|
23
25
|
set email(value: string);
|
|
26
|
+
get phone(): string | null | undefined;
|
|
27
|
+
set phone(value: string | null | undefined);
|
|
24
28
|
get message(): string;
|
|
25
29
|
set message(value: string);
|
|
26
30
|
get hasError(): boolean;
|
|
27
31
|
get firstNameErrorMessage(): string | undefined;
|
|
28
32
|
get lastNameErrorMessage(): string | undefined;
|
|
29
33
|
get emailErrorMessage(): string | undefined;
|
|
34
|
+
get phoneErrorMessage(): string | undefined;
|
|
30
35
|
get messageErrorMessage(): string | undefined;
|
|
31
36
|
get redirect(): string | null | undefined;
|
|
32
37
|
onFirstNameChange: (value: string) => void;
|
|
33
38
|
onLastNameChange: (value: string) => void;
|
|
34
39
|
onEmailChange: (value: string) => void;
|
|
40
|
+
onPhoneChange: (value: string) => void;
|
|
35
41
|
onMessageChange: (value: string) => void;
|
|
36
42
|
validateAll(): Promise<boolean>;
|
|
37
43
|
saveContactForm(): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as r}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as
|
|
1
|
+
import{__awaiter as e,__generator as r,__assign as t}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as s,computed as o,observable as a,action as i}from"mobx";import{Validator as n}from"../index.js";import{IkasBaseStore as l}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";import{RequiredRule as m,EmailRule as u,PhoneRule as f}from"../rules/index.js";var c=function(){function c(e){var r=this;this.model={firstName:"",lastName:"",email:"",phone:null,message:""},this.onFirstNameChange=function(e){r.firstName=e},this.onLastNameChange=function(e){r.lastName=e},this.onEmailChange=function(e){r.email=e},this.onPhoneChange=function(e){r.phone=e},this.onMessageChange=function(e){r.message=e},s(this,{emailErrorMessage:o,messageErrorMessage:o,firstNameErrorMessage:o,lastNameErrorMessage:o,phoneErrorMessage:o,hasError:o,redirect:o,model:a,validateAll:i,saveContactForm:i});var t=[new m({fieldKey:"firstName",valuePath:"firstName",message:e.message.requiredRule}),new m({fieldKey:"lastName",valuePath:"lastName",message:e.message.requiredRule}),new m({fieldKey:"email",valuePath:"email",message:e.message.requiredRule}),new m({fieldKey:"message",valuePath:"message",message:e.message.requiredRule}),new u({fieldKey:"email",valuePath:"email",message:e.message.emailRule})];e.message.phoneRule&&t.push(new f({fieldKey:"phone",valuePath:"phone",message:e.message.phoneRule})),this.validator=new n(this.model,t)}return Object.defineProperty(c.prototype,"firstName",{get:function(){return this.model.firstName},set:function(e){this.model.firstName=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"lastName",{get:function(){return this.model.lastName},set:function(e){this.model.lastName=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"email",{get:function(){return this.model.email},set:function(e){this.model.email=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"phone",{get:function(){return this.model.phone},set:function(e){this.model.phone=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"message",{get:function(){return this.model.message},set:function(e){this.model.message=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"firstNameErrorMessage",{get:function(){return this.validator.results.firstName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"lastNameErrorMessage",{get:function(){return this.validator.results.lastName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"emailErrorMessage",{get:function(){return this.validator.results.email.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"phoneErrorMessage",{get:function(){var e,r,t;if(null===(r=null===(e=this.validator.results)||void 0===e?void 0:e.phone)||void 0===r?void 0:r.errorMessage)return null===(t=this.validator.results)||void 0===t?void 0:t.phone.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"messageErrorMessage",{get:function(){return this.validator.results.message.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"redirect",{get:function(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("redirect")},enumerable:!1,configurable:!0}),c.prototype.validateAll=function(){return this.validator.validateAll()},c.prototype.saveContactForm=function(){return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return e={isFormError:!1,isSuccess:!1},[4,this.validateAll()];case 1:if(r.sent())return e.isFormError=!0,[2,e];r.label=2;case 2:return r.trys.push([2,4,,5]),[4,l.getInstance().customerStore.saveContactForm(t({firstName:this.model.firstName,lastName:this.model.lastName,email:this.model.email,message:this.model.message,referer:window.location.href},this.model.phone&&{phone:this.model.phone}))];case 3:return r.sent()&&(e.isSuccess=!0),[2,e];case 4:return r.sent(),[2,e];case 5:return[2]}}))}))},c}();export{c as ContactForm};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IkasCity, IkasCountry, IkasDistrict, IkasLocalizedCustomerAddress, IkasState } from "../../../data";
|
|
2
|
-
import { AddressFormItem } from "
|
|
2
|
+
import { AddressFormItem } from "@ikas/localized-address";
|
|
3
3
|
declare type IkasAddressFormPropsValidatorMessage<T> = {
|
|
4
4
|
requiredRule: ((model: T) => string) | string;
|
|
5
5
|
invalidRule: ((model: T) => string) | string;
|
|
@@ -22,7 +22,6 @@ export declare class IkasAddressForm {
|
|
|
22
22
|
private _isCitiesPending;
|
|
23
23
|
private _isDistrictsPending;
|
|
24
24
|
private message;
|
|
25
|
-
private countrySettings;
|
|
26
25
|
constructor(props: IkasAddressFormProps<IkasLocalizedCustomerAddress>);
|
|
27
26
|
init: () => Promise<void>;
|
|
28
27
|
onTitleChange: (value: string) => void;
|
|
@@ -39,10 +38,16 @@ export declare class IkasAddressForm {
|
|
|
39
38
|
onCityInputChange: (value: string) => void;
|
|
40
39
|
onDistrictChange: (districtId: string) => void;
|
|
41
40
|
onDistrictInputChange: (value: string) => void;
|
|
41
|
+
onRegionChange: (regionId: string) => void;
|
|
42
42
|
listCountries: () => Promise<void>;
|
|
43
43
|
listStates: () => Promise<void>;
|
|
44
44
|
listCities: () => Promise<void>;
|
|
45
45
|
listDistricts: () => Promise<void>;
|
|
46
|
+
private get shippingZone();
|
|
47
|
+
private get shippingZoneState();
|
|
48
|
+
private get shippingZoneCity();
|
|
49
|
+
private get shippingZoneDistrict();
|
|
50
|
+
private get shippingZoneRegion();
|
|
46
51
|
get isFreeTextCity(): boolean | undefined;
|
|
47
52
|
get isFreeTextDistrict(): boolean | undefined;
|
|
48
53
|
get isEdit(): boolean;
|
|
@@ -63,29 +68,34 @@ export declare class IkasAddressForm {
|
|
|
63
68
|
label: string;
|
|
64
69
|
value: string;
|
|
65
70
|
}[];
|
|
71
|
+
get regionOptions(): {
|
|
72
|
+
label: string;
|
|
73
|
+
value: string;
|
|
74
|
+
}[] | undefined;
|
|
66
75
|
get hasState(): boolean;
|
|
67
76
|
get isCountriesPending(): boolean;
|
|
68
77
|
get isStatesPending(): boolean;
|
|
69
78
|
get isCitiesPending(): boolean;
|
|
70
79
|
get isDistrictsPending(): boolean;
|
|
71
80
|
get fieldSettings(): {
|
|
72
|
-
firstName: import("
|
|
73
|
-
lastName: import("
|
|
74
|
-
identityNumber: import("
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
firstName: import("@ikas/localized-address").AddressFormField;
|
|
82
|
+
lastName: import("@ikas/localized-address").AddressFormField;
|
|
83
|
+
identityNumber: import("@ikas/localized-address").AddressFormField;
|
|
84
|
+
addressLine1: import("@ikas/localized-address").AddressFormField;
|
|
85
|
+
addressLine2: import("@ikas/localized-address").AddressFormField;
|
|
86
|
+
postalCode: import("@ikas/localized-address").AddressFormField;
|
|
87
|
+
country: import("@ikas/localized-address").AddressFormField;
|
|
88
|
+
state: import("@ikas/localized-address").AddressFormField;
|
|
89
|
+
city: import("@ikas/localized-address").AddressFormField;
|
|
90
|
+
district: import("@ikas/localized-address").AddressFormField;
|
|
91
|
+
region: import("@ikas/localized-address").AddressFormField;
|
|
92
|
+
phone: import("@ikas/localized-address").AddressFormField;
|
|
93
|
+
company: import("@ikas/localized-address").AddressFormField;
|
|
94
|
+
taxOffice: import("@ikas/localized-address").AddressFormField;
|
|
95
|
+
taxNumber: import("@ikas/localized-address").AddressFormField;
|
|
96
|
+
title: import("@ikas/localized-address").AddressFormField;
|
|
87
97
|
} | undefined;
|
|
88
|
-
get fieldLabels(): import("
|
|
98
|
+
get fieldLabels(): import("@ikas/localized-address").IkasAddressFormLabels | undefined;
|
|
89
99
|
get addressFormat(): AddressFormItem[][] | undefined;
|
|
90
100
|
get validationResult(): {
|
|
91
101
|
firstName: {
|
|
@@ -96,6 +106,10 @@ export declare class IkasAddressForm {
|
|
|
96
106
|
hasError: boolean;
|
|
97
107
|
message: string;
|
|
98
108
|
};
|
|
109
|
+
identityNumber: {
|
|
110
|
+
hasError: boolean;
|
|
111
|
+
message: string;
|
|
112
|
+
};
|
|
99
113
|
addressLine1: {
|
|
100
114
|
hasError: boolean;
|
|
101
115
|
message: string;
|
|
@@ -104,6 +118,10 @@ export declare class IkasAddressForm {
|
|
|
104
118
|
hasError: boolean;
|
|
105
119
|
message: string;
|
|
106
120
|
};
|
|
121
|
+
postalCode: {
|
|
122
|
+
hasError: boolean;
|
|
123
|
+
message: string;
|
|
124
|
+
};
|
|
107
125
|
country: {
|
|
108
126
|
hasError: boolean;
|
|
109
127
|
message: string;
|
|
@@ -120,15 +138,23 @@ export declare class IkasAddressForm {
|
|
|
120
138
|
hasError: boolean;
|
|
121
139
|
message: string;
|
|
122
140
|
};
|
|
141
|
+
region: {
|
|
142
|
+
hasError: boolean;
|
|
143
|
+
message: string;
|
|
144
|
+
};
|
|
123
145
|
phone: {
|
|
124
146
|
hasError: boolean;
|
|
125
147
|
message: string;
|
|
126
148
|
};
|
|
127
|
-
|
|
149
|
+
company: {
|
|
128
150
|
hasError: boolean;
|
|
129
151
|
message: string;
|
|
130
152
|
};
|
|
131
|
-
|
|
153
|
+
taxOffice: {
|
|
154
|
+
hasError: boolean;
|
|
155
|
+
message: string;
|
|
156
|
+
};
|
|
157
|
+
taxNumber: {
|
|
132
158
|
hasError: boolean;
|
|
133
159
|
message: string;
|
|
134
160
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as i,observable as s,computed as n,action as r}from"mobx";import d from"lodash/cloneDeep";import{listCheckoutSettings as a,listCountry as o,listState as u,listCity as c,listDistrict as l}from"@ikas/storefront-api";import{IkasStorefrontConfig as h}from"@ikas/storefront-config";import{IkasBaseStore as m}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";import"../../../data/blog/category/index.js";import"../../../data/blog/content/index.js";import"../../../data/blog/meta-data/index.js";import"../../../data/blog/tag/index.js";import"../../../data/blog/index.js";import"../../../data/brand/index.js";import"@ikas/storefront-models";import"../../../data/campaign-offer/index.js";import"../../../data/cart/campaign-offer/index.js";import"../../../data/cart/index.js";import"../../../data/category/path-item/index.js";import"../../../data/category/index.js";import"../../../data/checkout/index.js";import p,{AddressFormItem as f}from"../../../data/checkout/country-settings-model.js";import"../../../data/checkout-settings/index.js";import"../../../data/city/index.js";import"../../../data/country/index.js";import"../../../data/customer/address/index.js";import{IkasLocalizedCustomerAddress as g}from"../../../data/customer/address/ikas-localized-customer-address.js";import"../../../data/customer/attribute/index.js";import"../../../data/customer/review/summary/index.js";import"../../../data/customer/review/index.js";import"../../../data/customer/index.js";import"../../../data/district/index.js";import"../../../data/favorite-product/index.js";import"../../../data/filter-category/index.js";import"../../../data/html-meta-data/index.js";import"../../../data/image/index.js";import"../../../data/order/address/index.js";import"../../../data/order/line-item/option/value/index.js";import"../../../data/order/line-item/variant/value/index.js";import"../../../data/order/line-item/variant/index.js";import"../../../data/order/line-item/index.js";import"../../../data/order/package/index.js";import"../../../data/order/transaction/index.js";import"../../../data/order/index.js";import"../../../data/payment-gateway/index.js";import"../../../data/product/attribute-value/index.js";import"../../../data/product/filter/index.js";import"../../../data/product/option-set/option/index.js";import"../../../data/product/option-set/index.js";import"../../../data/product/stock-location/index.js";import"../../../data/product/variant/price/index.js";import"../../../data/product/variant/index.js";import"../../../data/variant-type/index.js";import"../../../data/product/index.js";import"../../../data/raffle/index.js";import"../../../data/state/index.js";import"../../../data/theme-json/index.js";import"../../../data/theme-json/custom-data/index.js";import"../../../data/variant-type/variant-value/index.js";import y from"lodash/mapValues";import v from"../../../../store/location/index.js";var b=function(t){return t.sort((function(t,e){return t.label.localeCompare(e.label)}))},j=function(t){return{label:t.name,value:t.id+""}},x=function(){function x(f){var y=this;this.countries=[],this.states=[],this.cities=[],this.districts=[],this.isLoaded=!1,this.isFormSubmit=!1,this._isCountriesPending=!0,this._isStatesPending=!1,this._isCitiesPending=!1,this._isDistrictsPending=!1,this.init=function(){return t(y,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,a({})];case 1:return(t=e.sent()).isSuccess&&(null===(i=t.data)||void 0===i?void 0:i.length)&&(this.countrySettings=new p({checkoutSettings:t.data[0]})),[4,this.countrySettings.waitUntilInitialized()];case 2:return e.sent(),this.address.countrySettings=this.countrySettings,this.isLoaded=!0,[2]}}))}))},this.onTitleChange=function(t){y.address.title=t},this.onFirstNameChange=function(t){y.address.firstName=t},this.onLastNameChange=function(t){y.address.lastName=t},this.onIdentityNumberChange=function(t){y.address.identityNumber=t},this.onPhoneChange=function(t){y.address.phone=t},this.onAddressLine1Change=function(t){y.address.addressLine1=t},this.onAddressLine2Change=function(t){y.address.addressLine2=t},this.onAddressPostalCodeChange=function(t){y.address.postalCode=t},this.onCountryChange=function(t){var e;if((null===(e=y.address.country)||void 0===e?void 0:e.id)!==t){var i=y.countries.find((function(e){return e.id===t}));y.address.country={id:(null==i?void 0:i.id)||null,name:(null==i?void 0:i.name)||"",code:(null==i?void 0:i.iso3)||null,iso2:(null==i?void 0:i.iso2)||null,iso3:(null==i?void 0:i.iso3)||null},y.address.state=null,y.address.city=null,y.address.district=null,y.states=[],y.cities=[],y.districts=[],y.listStates()}},this.onStateChange=function(t){var e;if((null===(e=y.address.state)||void 0===e?void 0:e.id)!==t){var i=y.states.find((function(e){return e.id===t}));y.address.state={id:i.id,name:null==i?void 0:i.name,code:null==i?void 0:i.stateCode},y.address.isFreeTextCity||(y.address.city=null,y.cities=[],y.listCities()),y.address.isFreeTextDistrict||(y.address.district=null,y.districts=[])}},this.onCityChange=function(t){var e;if((null===(e=y.address.city)||void 0===e?void 0:e.id)!==t){var i=y.cities.find((function(e){return e.id===t}));y.address.city={id:i.id,name:i.name,code:null},y.address.isFreeTextDistrict||(y.address.district=null,y.districts=[],y.listDistricts())}},this.onCityInputChange=function(t){y.districts=[],y.address.city={id:null,name:t,code:null}},this.onDistrictChange=function(t){var e;if((null===(e=y.address.district)||void 0===e?void 0:e.id)!==t){var i=y.districts.find((function(e){return e.id===t}));y.address.district={id:i.id,name:i.name,code:null}}},this.onDistrictInputChange=function(t){y.address.district={id:null,name:t,code:null}},this.listCountries=function(){return t(y,void 0,void 0,(function(){var t,i,s,n,r,d,a;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,6,7]),this._isCountriesPending=!0,[4,o({})];case 1:return t=e.sent(),i=h.getCurrentRouting(),s=t.data||[],(null===(a=null==i?void 0:i.countryCodes)||void 0===a?void 0:a.length)&&(s=s.filter((function(t){var e;return t.iso2&&(null===(e=i.countryCodes)||void 0===e?void 0:e.includes(t.iso2))}))),this.countries=s,1!==this.countries.length||this.address.country?[3,2]:(this.onCountryChange(this.countries[0].id),[3,4]);case 2:return!this.countries.length||this.address.country?[3,4]:[4,v.getMyCountry()];case 3:n=e.sent(),r=n.data,(d=this.countries.find((function(t){return t.iso2===r})))?this.onCountryChange(d.id):this.onCountryChange(this.countries[0].id),e.label=4;case 4:return this.countries=s,[3,7];case 5:return e.sent(),[3,7];case 6:return this._isCountriesPending=!1,[7];case 7:return[2]}}))}))},this.listStates=function(){return t(y,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:if(!(null===(i=this.address.country)||void 0===i?void 0:i.id))return[2];e.label=1;case 1:return e.trys.push([1,3,4,5]),this._isStatesPending=!0,[4,u({countryId:{eq:this.address.country.id}})];case 2:return t=e.sent(),this.states=t.data||[],this.hasState||this.onStateChange(this.states[0].id),[3,5];case 3:return e.sent(),[3,5];case 4:return this._isStatesPending=!1,[7];case 5:return[2]}}))}))},this.listCities=function(){return t(y,void 0,void 0,(function(){var t,i,s,n;return e(this,(function(e){switch(e.label){case 0:if(!(null===(i=this.address.state)||void 0===i?void 0:i.id))return[2];e.label=1;case 1:return e.trys.push([1,3,4,5]),this._isCitiesPending=!0,[4,c({stateId:{eq:this.address.state.id},countryId:(null===(s=this.address.country)||void 0===s?void 0:s.id)?{eq:null===(n=this.address.country)||void 0===n?void 0:n.id}:void 0})];case 2:return t=e.sent(),this.cities=t.data||[],[3,5];case 3:return e.sent(),[3,5];case 4:return this._isCitiesPending=!1,[7];case 5:return[2]}}))}))},this.listDistricts=function(){return t(y,void 0,void 0,(function(){var t,i,s,n;return e(this,(function(e){switch(e.label){case 0:if(!(null===(i=this.address.city)||void 0===i?void 0:i.id))return[2];e.label=1;case 1:return e.trys.push([1,3,4,5]),this._isDistrictsPending=!0,[4,l({cityId:{eq:this.address.city.id},stateId:(null===(s=this.address.state)||void 0===s?void 0:s.id)?{eq:null===(n=this.address.state)||void 0===n?void 0:n.id}:void 0})];case 2:return t=e.sent(),this.districts=t.data||[],[3,5];case 3:return e.sent(),[3,5];case 4:return this._isDistrictsPending=!1,[7];case 5:return[2]}}))}))},this.submit=function(){return t(y,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:if(t={isFormError:!1,isSuccess:!1},this.isFormSubmit=!0,!this.address.isValidAddress)return t.isFormError=!0,[2,t];if(!(i=d(m.getInstance().customerStore.customer))||!this.address)return[2,t];(null==i?void 0:i.addresses)||(i.addresses=[]),this.isEdit?i.addresses[this.editingAddressIndex]=this.address:i.addresses.push(this.address),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,m.getInstance().customerStore.saveCustomer(i)];case 2:return e.sent()&&(t.isSuccess=!0),[2,t];case 3:return e.sent(),[2,t];case 4:return[2]}}))}))},i(this,{isLoaded:s,isEdit:n,editingAddressIndex:n,isFreeTextCity:n,isFreeTextDistrict:n,countries:s,states:s,cities:s,districts:s,_isCountriesPending:s,_isStatesPending:s,_isCitiesPending:s,_isDistrictsPending:s,isCountriesPending:n,isStatesPending:n,isCitiesPending:n,isDistrictsPending:n,onCountryChange:r,submit:r}),this.address=f.address||new g({addressLine1:"",addressLine2:null,attributes:null,company:null,firstName:"",identityNumber:null,isDefault:null,lastName:"",phone:null,postalCode:null,taxNumber:null,taxOffice:null,title:"",country:null,state:null,city:null,district:null,id:"",createdAt:0,updatedAt:0}),this.message=f.message,this.listCountries(),this.address.state&&this.listStates(),this.address.country&&this.listCities(),this.address.city&&this.listDistricts(),this.countrySettings=new p,this.init()}return Object.defineProperty(x.prototype,"isFreeTextCity",{get:function(){return this.address.isFreeTextCity},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isFreeTextDistrict",{get:function(){return this.address.isFreeTextDistrict},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isEdit",{get:function(){return-1!==this.editingAddressIndex},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"editingAddressIndex",{get:function(){var t,e,i,s=this;return null!==(i=null===(e=null===(t=m.getInstance().customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===e?void 0:e.findIndex((function(t){return t.id===s.address.id})))&&void 0!==i?i:-1},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"countryOptions",{get:function(){var t=this.countries.map(j);return b(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"stateOptions",{get:function(){var t=this.states.map(j);return b(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"cityOptions",{get:function(){var t=this.cities.map(j);return b(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"districtOptions",{get:function(){var t=this.districts.map(j);return b(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isCountriesPending",{get:function(){return this._isCountriesPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isStatesPending",{get:function(){return this.isCountriesPending||this._isStatesPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isCitiesPending",{get:function(){return this.isStatesPending||this._isCitiesPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isDistrictsPending",{get:function(){return this.isCitiesPending||this._isDistrictsPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"fieldSettings",{get:function(){return this.address.fieldSettings},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"fieldLabels",{get:function(){return this.address.fieldLabels},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"addressFormat",{get:function(){return this.countryOptions.length<=1?this.address.addressFormatIgnoreCountry:this.address.addressFormat},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"validationResult",{get:function(){var t=this;if(this.address.validationResults)return y(this.address.validationResults,(function(e,i){return{hasError:t.isFormSubmit&&e.hasError,message:t.isFormSubmit&&e.hasError?i===f.PHONE?t.message.phoneRule?"string"==typeof t.message.phoneRule?t.message.phoneRule:t.message.phoneRule(t.address):"":e.isInvalid?"string"==typeof t.message.invalidRule?t.message.invalidRule:t.message.invalidRule(t.address):"string"==typeof t.message.requiredRule?t.message.requiredRule:t.message.requiredRule(t.address):""}}))},enumerable:!1,configurable:!0}),x}();export{x as IkasAddressForm};
|
|
1
|
+
import{__awaiter as t,__generator as i}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as e,observable as s,computed as n,action as r}from"mobx";import d from"lodash/cloneDeep";import{listCheckoutSettings as o,listCountry as a,listState as u,listCity as l,listDistrict as c}from"@ikas/storefront-api";import{IkasStorefrontConfig as p}from"@ikas/storefront-config";import{IkasBaseStore as h}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";import"../../../data/blog/category/index.js";import"../../../data/blog/content/index.js";import"../../../data/blog/meta-data/index.js";import"../../../data/blog/tag/index.js";import"../../../data/blog/index.js";import"../../../data/brand/index.js";import"@ikas/storefront-models";import"../../../data/campaign-offer/index.js";import"../../../data/cart/campaign-offer/index.js";import"../../../data/cart/index.js";import"../../../data/category/path-item/index.js";import"../../../data/category/index.js";import"../../../data/checkout/index.js";import"../../../data/checkout-settings/index.js";import"../../../data/city/index.js";import"../../../data/country/index.js";import"../../../data/customer/address/region/index.js";import"../../../data/customer/address/index.js";import{IkasLocalizedCustomerAddress as m}from"../../../data/customer/address/ikas-localized-customer-address.js";import"../../../data/customer/attribute/index.js";import"../../../data/customer/review/summary/index.js";import"../../../data/customer/review/index.js";import"../../../data/customer/index.js";import"../../../data/district/index.js";import"../../../data/favorite-product/index.js";import"../../../data/filter-category/index.js";import"../../../data/html-meta-data/index.js";import"../../../data/image/index.js";import{IkasOrderAddressRegion as g}from"../../../data/order/address/region/index.js";import"../../../data/order/address/index.js";import"../../../data/order/line-item/option/value/index.js";import"../../../data/order/line-item/variant/value/index.js";import"../../../data/order/line-item/variant/index.js";import"../../../data/order/line-item/index.js";import"../../../data/order/package/index.js";import"../../../data/order/transaction/index.js";import"../../../data/order/index.js";import"../../../data/payment-gateway/index.js";import"../../../data/product/attribute-value/index.js";import"../../../data/product/filter/index.js";import"../../../data/product/campaign-offer/index.js";import"../../../data/product/option-set/option/index.js";import"../../../data/product/option-set/index.js";import"../../../data/product/stock-location/index.js";import"../../../data/product/variant/price/index.js";import"../../../data/product/variant/index.js";import"../../../data/variant-type/index.js";import"../../../data/product/index.js";import"../../../data/raffle/index.js";import"../../../data/shipping-zone/state/city/district/region/index.js";import"../../../data/state/index.js";import"../../../data/theme-json/index.js";import"../../../data/theme-json/component/index.js";import"../../../data/theme-json/custom-data/index.js";import"../../../data/variant-type/variant-value/index.js";import{AddressFormItem as f,LocalizedAddressModel as v}from"@ikas/localized-address";import y from"lodash/mapValues";import b from"../../../../store/location/index.js";import{stringSorter as j}from"../../../../utils/helper.js";var x=function(t){return t.sort((function(t,i){return t.label.localeCompare(i.label)}))},C=function(t){return{label:t.name,value:t.id+""}},P=function(){function P(f){var y=this;this.countries=[],this.states=[],this.cities=[],this.districts=[],this.isLoaded=!1,this.isFormSubmit=!1,this._isCountriesPending=!0,this._isStatesPending=!1,this._isCitiesPending=!1,this._isDistrictsPending=!1,this.init=function(){return t(y,void 0,void 0,(function(){var t,e,s,n;return i(this,(function(i){switch(i.label){case 0:return[4,o({})];case 1:return t=i.sent(),[4,b.getAvailableShippingZones({salesChannelId:p.getSalesChannelId()})];case 2:return e=i.sent(),t.isSuccess&&(null===(s=t.data)||void 0===s?void 0:s.length)&&(this.address.checkoutSettings=t.data[0]),e.isSuccess&&(null===(n=e.data)||void 0===n?void 0:n.length)&&(this.address.shippingZones=e.data),this.address.countrySettings=new v({currentLocale:p.getCurrentLocale()}),[4,this.address.countrySettings.waitUntilInitialized()];case 3:return i.sent(),this.address.getValidatedCustomerAddress(),this.isLoaded=!0,[2]}}))}))},this.onTitleChange=function(t){y.address.title=t},this.onFirstNameChange=function(t){y.address.firstName=t},this.onLastNameChange=function(t){y.address.lastName=t},this.onIdentityNumberChange=function(t){y.address.identityNumber=t},this.onPhoneChange=function(t){y.address.phone=t},this.onAddressLine1Change=function(t){y.address.addressLine1=t},this.onAddressLine2Change=function(t){y.address.addressLine2=t},this.onAddressPostalCodeChange=function(t){y.address.postalCode=t},this.onCountryChange=function(t){var i;if((null===(i=y.address.country)||void 0===i?void 0:i.id)!==t){var e=y.countries.find((function(i){return i.id===t}));y.address.country={id:(null==e?void 0:e.id)||null,name:(null==e?void 0:e.name)||"",code:(null==e?void 0:e.iso3)||null,iso2:(null==e?void 0:e.iso2)||null,iso3:(null==e?void 0:e.iso3)||null},y.address.state=null,y.address.city=null,y.address.district=null,y.states=[],y.cities=[],y.districts=[],y.listStates()}},this.onStateChange=function(t){var i;if((null===(i=y.address.state)||void 0===i?void 0:i.id)!==t){var e=y.states.find((function(i){return i.id===t}));y.address.state={id:e.id,name:null==e?void 0:e.name,code:null==e?void 0:e.stateCode},y.address.isFreeTextCity||(y.address.city=null,y.cities=[],y.listCities()),y.address.isFreeTextDistrict||(y.address.district=null,y.districts=[])}},this.onCityChange=function(t){var i;if((null===(i=y.address.city)||void 0===i?void 0:i.id)!==t){var e=y.cities.find((function(i){return i.id===t}));y.address.city={id:e.id,name:e.name,code:null},y.address.isFreeTextDistrict||(y.address.district=null,y.districts=[],y.listDistricts())}},this.onCityInputChange=function(t){y.districts=[],y.address.city={id:null,name:t,code:null}},this.onDistrictChange=function(t){var i;if((null===(i=y.address.district)||void 0===i?void 0:i.id)!==t){var e=y.districts.find((function(i){return i.id===t}));y.address.district={id:e.id,name:e.name,code:null},y.address.region=null}},this.onDistrictInputChange=function(t){y.address.district={id:null,name:t,code:null}},this.onRegionChange=function(t){var i,e,s;if((null===(i=y.address.region)||void 0===i?void 0:i.id)!==t){var n=null===(s=null===(e=y.shippingZoneDistrict)||void 0===e?void 0:e.regions)||void 0===s?void 0:s.find((function(i){return i.id===t}));y.address.region=new g({id:n.id,name:n.name})}},this.listCountries=function(){return t(y,void 0,void 0,(function(){var t,e,s,n,r,d,o;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,5,6,7]),this._isCountriesPending=!0,[4,a({})];case 1:return t=i.sent(),e=p.getCurrentRouting(),s=t.data||[],(null===(o=null==e?void 0:e.countryCodes)||void 0===o?void 0:o.length)&&(s=s.filter((function(t){var i;return t.iso2&&(null===(i=e.countryCodes)||void 0===i?void 0:i.includes(t.iso2))}))),this.countries=s,1!==this.countries.length||this.address.country?[3,2]:(this.onCountryChange(this.countries[0].id),[3,4]);case 2:return!this.countries.length||this.address.country?[3,4]:[4,b.getMyCountry()];case 3:n=i.sent(),r=n.data,(d=this.countries.find((function(t){return t.iso2===r})))?this.onCountryChange(d.id):this.onCountryChange(this.countries[0].id),i.label=4;case 4:return this.countries=s,[3,7];case 5:return i.sent(),[3,7];case 6:return this._isCountriesPending=!1,[7];case 7:return[2]}}))}))},this.listStates=function(){return t(y,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.address.country)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isStatesPending=!0,[4,u({countryId:{eq:this.address.country.id}})];case 2:return t=i.sent(),this.states=t.data||[],this.hasState||this.onStateChange(this.states[0].id),[3,5];case 3:return i.sent(),[3,5];case 4:return this._isStatesPending=!1,[7];case 5:return[2]}}))}))},this.listCities=function(){return t(y,void 0,void 0,(function(){var t,e,s,n;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.address.state)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isCitiesPending=!0,[4,l({stateId:{eq:this.address.state.id},countryId:(null===(s=this.address.country)||void 0===s?void 0:s.id)?{eq:null===(n=this.address.country)||void 0===n?void 0:n.id}:void 0})];case 2:return t=i.sent(),this.cities=t.data||[],[3,5];case 3:return i.sent(),[3,5];case 4:return this._isCitiesPending=!1,[7];case 5:return[2]}}))}))},this.listDistricts=function(){return t(y,void 0,void 0,(function(){var t,e,s,n;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.address.city)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isDistrictsPending=!0,[4,c({cityId:{eq:this.address.city.id},stateId:(null===(s=this.address.state)||void 0===s?void 0:s.id)?{eq:null===(n=this.address.state)||void 0===n?void 0:n.id}:void 0})];case 2:return t=i.sent(),this.districts=t.data||[],[3,5];case 3:return i.sent(),[3,5];case 4:return this._isDistrictsPending=!1,[7];case 5:return[2]}}))}))},this.submit=function(){return t(y,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:if(t={isFormError:!1,isSuccess:!1},this.isFormSubmit=!0,!this.address.isValidAddress)return t.isFormError=!0,[2,t];if(!(e=d(h.getInstance().customerStore.customer))||!this.address)return[2,t];(null==e?void 0:e.addresses)||(e.addresses=[]),this.isEdit?e.addresses[this.editingAddressIndex]=this.address:e.addresses.push(this.address),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,h.getInstance().customerStore.saveCustomer(e)];case 2:return i.sent()&&(t.isSuccess=!0),[2,t];case 3:return i.sent(),[2,t];case 4:return[2]}}))}))},e(this,{isLoaded:s,isEdit:n,editingAddressIndex:n,isFreeTextCity:n,isFreeTextDistrict:n,countries:s,states:s,cities:s,districts:s,_isCountriesPending:s,_isStatesPending:s,_isCitiesPending:s,_isDistrictsPending:s,isCountriesPending:n,isStatesPending:n,isCitiesPending:n,isDistrictsPending:n,onCountryChange:r,submit:r}),this.address=f.address||new m({addressLine1:"",addressLine2:null,attributes:null,company:null,firstName:"",identityNumber:null,isDefault:null,lastName:"",phone:null,postalCode:null,taxNumber:null,taxOffice:null,title:"",country:null,state:null,city:null,district:null,region:null,id:"",createdAt:0,updatedAt:0}),this.message=f.message,this.listCountries(),this.address.state&&this.listStates(),this.address.country&&this.listCities(),this.address.city&&this.listDistricts(),this.init()}return Object.defineProperty(P.prototype,"shippingZone",{get:function(){var t,i=this;return null===(t=this.address.shippingZones)||void 0===t?void 0:t.find((function(t){var e;return t.countryId===(null===(e=i.address.country)||void 0===e?void 0:e.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"shippingZoneState",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZone)||void 0===t?void 0:t.states)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.state)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"shippingZoneCity",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZoneState)||void 0===t?void 0:t.cities)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.city)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"shippingZoneDistrict",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZoneCity)||void 0===t?void 0:t.districts)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.district)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"shippingZoneRegion",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZoneDistrict)||void 0===t?void 0:t.regions)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.region)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isFreeTextCity",{get:function(){return this.address.isFreeTextCity},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isFreeTextDistrict",{get:function(){return this.address.isFreeTextDistrict},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isEdit",{get:function(){return-1!==this.editingAddressIndex},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"editingAddressIndex",{get:function(){var t,i,e,s=this;return null!==(e=null===(i=null===(t=h.getInstance().customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===i?void 0:i.findIndex((function(t){return t.id===s.address.id})))&&void 0!==e?e:-1},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"countryOptions",{get:function(){var t=this.countries.map(C);return x(t)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"stateOptions",{get:function(){var t,i,e=this,s=this.states.map(C);return this.shippingZone&&!this.shippingZone.showAllStates&&(null===(i=null===(t=this.shippingZone)||void 0===t?void 0:t.states)||void 0===i?void 0:i.length)&&(s=s.filter((function(t){var i,s;return null===(s=null===(i=e.shippingZone)||void 0===i?void 0:i.states)||void 0===s?void 0:s.some((function(i){return i.id===t.value}))}))),x(s)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"cityOptions",{get:function(){var t,i,e,s=this,n=this.cities.map(C);return this.shippingZone&&!(null===(t=this.shippingZoneState)||void 0===t?void 0:t.showAllCities)&&(null===(e=null===(i=this.shippingZoneState)||void 0===i?void 0:i.cities)||void 0===e?void 0:e.length)&&(n=n.filter((function(t){var i,e;return null===(e=null===(i=s.shippingZoneState)||void 0===i?void 0:i.cities)||void 0===e?void 0:e.some((function(i){return i.id===t.value}))}))),x(n)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"districtOptions",{get:function(){var t,i,e,s=this,n=this.districts.map(C);return this.shippingZone&&!(null===(t=this.shippingZoneCity)||void 0===t?void 0:t.showAllDistricts)&&(null===(e=null===(i=this.shippingZoneCity)||void 0===i?void 0:i.districts)||void 0===e?void 0:e.length)&&(n=n.filter((function(t){var i,e;return null===(e=null===(i=s.shippingZoneCity)||void 0===i?void 0:i.districts)||void 0===e?void 0:e.some((function(i){return i.id===t.value}))}))),x(n)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"regionOptions",{get:function(){var t,i;return null===(i=null===(t=this.shippingZoneDistrict)||void 0===t?void 0:t.regions)||void 0===i?void 0:i.map(C).sort((function(t,i){return j(t.label,i.label)}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isCountriesPending",{get:function(){return this._isCountriesPending},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isStatesPending",{get:function(){return this.isCountriesPending||this._isStatesPending},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isCitiesPending",{get:function(){return this.isStatesPending||this._isCitiesPending},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isDistrictsPending",{get:function(){return this.isCitiesPending||this._isDistrictsPending},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"fieldSettings",{get:function(){return this.address.fieldSettings},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"fieldLabels",{get:function(){return this.address.fieldLabels},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"addressFormat",{get:function(){return this.countryOptions.length<=1?this.address.addressFormatIgnoreCountry:this.address.addressFormat},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"validationResult",{get:function(){var t=this;if(this.address.validationResults)return y(this.address.validationResults,(function(i,e){return{hasError:t.isFormSubmit&&i.hasError,message:t.isFormSubmit&&i.hasError?e===f.PHONE?t.message.phoneRule?"string"==typeof t.message.phoneRule?t.message.phoneRule:t.message.phoneRule(t.address):"":i.isInvalid?"string"==typeof t.message.invalidRule?t.message.invalidRule:t.message.invalidRule(t.address):"string"==typeof t.message.requiredRule?t.message.requiredRule:t.message.requiredRule(t.address):""}}))},enumerable:!1,configurable:!0}),P}();export{P as IkasAddressForm};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LoginResponseErrorCode } from "../../../../store/customer";
|
|
1
2
|
declare type LoginFormProps<T> = {
|
|
2
3
|
message: {
|
|
3
4
|
requiredRule: ((model: T) => string) | string;
|
|
@@ -24,9 +25,11 @@ export declare class LoginForm {
|
|
|
24
25
|
onEmailChange: (value: string) => void;
|
|
25
26
|
onPasswordChange: (value: string) => void;
|
|
26
27
|
validateAll(): Promise<boolean>;
|
|
27
|
-
login(): Promise<
|
|
28
|
-
isFormError: boolean;
|
|
29
|
-
isSuccess: boolean;
|
|
30
|
-
}>;
|
|
28
|
+
login(): Promise<LoginResponse>;
|
|
31
29
|
}
|
|
30
|
+
declare type LoginResponse = {
|
|
31
|
+
isFormError: boolean;
|
|
32
|
+
isSuccess: boolean;
|
|
33
|
+
errorCodes: LoginResponseErrorCode[];
|
|
34
|
+
};
|
|
32
35
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as r}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as
|
|
1
|
+
import{__awaiter as e,__generator as r}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as s,computed as t,observable as o,action as i}from"mobx";import{Validator as a}from"../index.js";import{IkasBaseStore as n}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";import{RequiredRule as l,EmailRule as u,MinRule as d}from"../rules/index.js";var m=function(){function m(e){var r=this;this.model={email:"",password:""},this.onEmailChange=function(e){r.email=e},this.onPasswordChange=function(e){r.password=e},s(this,{emailErrorMessage:t,passwordErrorMessage:t,hasError:t,redirect:t,email:t,password:t,model:o,validateAll:i,login:i}),this.validator=new a(this.model,[new l({fieldKey:"email",valuePath:"email",message:e.message.requiredRule}),new l({fieldKey:"password",valuePath:"password",message:e.message.requiredRule}),new u({fieldKey:"email",valuePath:"email",message:e.message.emailRule}),new d({fieldKey:"password",valuePath:"password",minValue:6,message:e.message.minRule})])}return Object.defineProperty(m.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"email",{get:function(){return this.model.email},set:function(e){this.model.email=e},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"password",{get:function(){return this.model.password},set:function(e){this.model.password=e},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"emailErrorMessage",{get:function(){return this.validator.results.email.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"passwordErrorMessage",{get:function(){return this.validator.results.password.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"redirect",{get:function(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("redirect")},enumerable:!1,configurable:!0}),m.prototype.validateAll=function(){return this.validator.validateAll()},m.prototype.login=function(){return e(this,void 0,void 0,(function(){var e,s;return r(this,(function(r){switch(r.label){case 0:return e={isFormError:!1,isSuccess:!1,errorCodes:[]},[4,this.validateAll()];case 1:if(r.sent())return e.isFormError=!0,[2,e];r.label=2;case 2:return r.trys.push([2,4,,5]),[4,n.getInstance().customerStore.customerLogin(this.model.email,this.model.password)];case 3:return s=r.sent(),e.isSuccess=s.isSuccess,e.errorCodes=s.errorCodes,[2,e];case 4:return r.sent(),[2,e];case 5:return[2]}}))}))},m}();export{m as LoginForm};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { EmailRule, MinRule, PhoneRule, RequiredRule } from "../rules";
|
|
1
2
|
import { IkasCustomerAttribute, IkasCustomerAttributeValue } from "../../../data";
|
|
2
3
|
declare type RegisterFormPropsValidatorMessage<T> = {
|
|
3
4
|
requiredRule: ((model: T) => string) | string;
|
|
4
5
|
emailRule: ((model: T) => string) | string;
|
|
5
6
|
minRule: ((model: T) => string) | string;
|
|
7
|
+
phoneRule?: ((model: T) => string) | string;
|
|
6
8
|
};
|
|
7
9
|
declare type RegisterFormProps<T> = {
|
|
8
10
|
message: RegisterFormPropsValidatorMessage<T>;
|
|
@@ -14,6 +16,7 @@ declare type RegisterFormModel = {
|
|
|
14
16
|
password: string;
|
|
15
17
|
attributes?: IkasCustomerAttributeValue[];
|
|
16
18
|
isMarketingAccepted?: boolean;
|
|
19
|
+
phone?: string | null;
|
|
17
20
|
};
|
|
18
21
|
declare type AttributeValue = {
|
|
19
22
|
isChecked?: boolean;
|
|
@@ -36,6 +39,7 @@ export declare class RegisterForm {
|
|
|
36
39
|
private isFormSubmit;
|
|
37
40
|
private _customerAttributes;
|
|
38
41
|
constructor(props: RegisterFormProps<RegisterFormModel>);
|
|
42
|
+
validatorRules: (includePhoneRule?: boolean) => (RequiredRule<RegisterFormModel> | EmailRule<RegisterFormModel> | MinRule<RegisterFormModel> | PhoneRule<RegisterFormModel>)[];
|
|
39
43
|
get firstName(): string;
|
|
40
44
|
set firstName(value: string);
|
|
41
45
|
get lastName(): string;
|
|
@@ -46,11 +50,14 @@ export declare class RegisterForm {
|
|
|
46
50
|
set password(value: string);
|
|
47
51
|
get isMarketingAccepted(): boolean | undefined;
|
|
48
52
|
set isMarketingAccepted(value: boolean | undefined);
|
|
53
|
+
get phone(): string | null | undefined;
|
|
54
|
+
set phone(value: string | null | undefined);
|
|
49
55
|
get hasError(): boolean;
|
|
50
56
|
get firstNameErrorMessage(): string | undefined;
|
|
51
57
|
get lastNameErrorMessage(): string | undefined;
|
|
52
58
|
get emailErrorMessage(): string | undefined;
|
|
53
59
|
get passwordErrorMessage(): string | undefined;
|
|
60
|
+
get phoneErrorMessage(): string | undefined;
|
|
54
61
|
get attributes(): IkasCustomerAttributeValue[] | undefined;
|
|
55
62
|
set attributes(attributes: IkasCustomerAttributeValue[] | undefined);
|
|
56
63
|
get redirect(): string | null | undefined;
|
|
@@ -59,6 +66,7 @@ export declare class RegisterForm {
|
|
|
59
66
|
onLastNameChange: (value: string) => void;
|
|
60
67
|
onEmailChange: (value: string) => void;
|
|
61
68
|
onPasswordChange: (value: string) => void;
|
|
69
|
+
onPhoneChange: (value: string) => void;
|
|
62
70
|
setCustomerAttributes: (customerAttributes: IkasCustomerAttribute[]) => void;
|
|
63
71
|
private getAttributeValue;
|
|
64
72
|
onAttributeChange: (attributeId: string, value: boolean | string | string[]) => void;
|
|
@@ -66,8 +74,9 @@ export declare class RegisterForm {
|
|
|
66
74
|
private validateCustomerAttribute;
|
|
67
75
|
validateAll(): Promise<boolean | undefined>;
|
|
68
76
|
register(): Promise<{
|
|
69
|
-
isFormError: boolean;
|
|
70
77
|
isSuccess: boolean;
|
|
78
|
+
errorCodes: import("@ikas/storefront-api").IkasRegisterError[];
|
|
79
|
+
isFormError: boolean;
|
|
71
80
|
}>;
|
|
72
81
|
}
|
|
73
82
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as r,computed as i,observable as a,action as s}from"mobx";import{Validator as o}from"../index.js";import{IkasBaseStore as n}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";import{RequiredRule as u,EmailRule as d,MinRule as m}from"../rules/index.js";import"../../../data/blog/category/index.js";import"../../../data/blog/content/index.js";import"../../../data/blog/meta-data/index.js";import"../../../data/blog/tag/index.js";import"../../../data/blog/index.js";import"../../../data/brand/index.js";import{IkasCustomerAttributeType as l,IkasCustomerAttributeRegisterPageRequirement as c}from"@ikas/storefront-models";import"../../../data/campaign-offer/index.js";import"../../../data/cart/campaign-offer/index.js";import"../../../data/cart/index.js";import"../../../data/category/path-item/index.js";import"../../../data/category/index.js";import"../../../data/checkout/index.js";import"../../../data/checkout/country-settings-model.js";import"../../../data/checkout-settings/index.js";import"../../../data/city/index.js";import"../../../data/country/index.js";import"../../../data/customer/address/index.js";import"../../../data/customer/address/ikas-localized-customer-address.js";import"../../../data/customer/attribute/index.js";import"../../../data/customer/review/summary/index.js";import"../../../data/customer/review/index.js";import"../../../data/customer/index.js";import"../../../data/district/index.js";import"../../../data/favorite-product/index.js";import"../../../data/filter-category/index.js";import"../../../data/html-meta-data/index.js";import"../../../data/image/index.js";import"../../../data/order/address/index.js";import"../../../data/order/line-item/option/value/index.js";import"../../../data/order/line-item/variant/value/index.js";import"../../../data/order/line-item/variant/index.js";import"../../../data/order/line-item/index.js";import"../../../data/order/package/index.js";import"../../../data/order/transaction/index.js";import"../../../data/order/index.js";import"../../../data/payment-gateway/index.js";import"../../../data/product/attribute-value/index.js";import"../../../data/product/filter/index.js";import"../../../data/product/option-set/option/index.js";import"../../../data/product/option-set/index.js";import"../../../data/product/stock-location/index.js";import"../../../data/product/variant/price/index.js";import"../../../data/product/variant/index.js";import"../../../data/variant-type/index.js";import"../../../data/product/index.js";import"../../../data/raffle/index.js";import"../../../data/state/index.js";import"../../../data/theme-json/index.js";import"../../../data/theme-json/custom-data/index.js";import"../../../data/variant-type/variant-value/index.js";var p=function(){function p(t){var e=this;this.model={firstName:"",lastName:"",email:"",password:"",attributes:void 0,isMarketingAccepted:!1},this.isFormSubmit=!1,this._customerAttributes=void 0,this.onFirstNameChange=function(t){e.firstName=t},this.onLastNameChange=function(t){e.lastName=t},this.onEmailChange=function(t){e.email=t},this.onPasswordChange=function(t){e.password=t},this.setCustomerAttributes=function(t){e._customerAttributes=(null==t?void 0:t.filter((function(t){return t.registerPageRequirement!==c.INVISIBLE})).map((function(t){return{attribute:t,attributeValue:{isChecked:void 0,value:void 0,selectedIdList:void 0},validator:{isRequired:t.registerPageRequirement===c.MANDATORY,hasError:!1,message:""}}})))||[]},this.onAttributeChange=function(t,r){var i;if(e._customerAttributes){var a=e._customerAttributes.find((function(e){return e.attribute.id===t}));if(a){var s=null===(i=e._customerAttributes)||void 0===i?void 0:i.findIndex((function(e){return e.attribute.id===t}));void 0!==s&&-1!==s&&(e._customerAttributes[s].attributeValue=e.getAttributeValue(a.attribute,r),e.validateCustomerAttribute())}}},r(this,{emailErrorMessage:i,passwordErrorMessage:i,firstNameErrorMessage:i,lastNameErrorMessage:i,hasError:i,redirect:i,model:a,validateAll:s,register:s,customerAttributes:i,_customerAttributes:a}),this.message=t.message,this.validator=new o(this.model,[new u({fieldKey:"firstName",valuePath:"firstName",message:t.message.requiredRule}),new u({fieldKey:"lastName",valuePath:"lastName",message:t.message.requiredRule}),new u({fieldKey:"email",valuePath:"email",message:t.message.requiredRule}),new u({fieldKey:"password",valuePath:"password",message:t.message.requiredRule}),new d({fieldKey:"email",valuePath:"email",message:t.message.emailRule}),new m({fieldKey:"password",valuePath:"password",minValue:6,message:t.message.minRule})])}return Object.defineProperty(p.prototype,"firstName",{get:function(){return this.model.firstName},set:function(t){this.model.firstName=t},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"lastName",{get:function(){return this.model.lastName},set:function(t){this.model.lastName=t},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"email",{get:function(){return this.model.email},set:function(t){this.model.email=t},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"password",{get:function(){return this.model.password},set:function(t){this.model.password=t},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isMarketingAccepted",{get:function(){return this.model.isMarketingAccepted},set:function(t){this.model.isMarketingAccepted=t},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"firstNameErrorMessage",{get:function(){return this.validator.results.firstName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"lastNameErrorMessage",{get:function(){return this.validator.results.lastName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"emailErrorMessage",{get:function(){return this.validator.results.email.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"passwordErrorMessage",{get:function(){return this.validator.results.password.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"attributes",{get:function(){return this.model.attributes},set:function(t){this.model.attributes=t},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"redirect",{get:function(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("redirect")},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"customerAttributes",{get:function(){return this._customerAttributes},enumerable:!1,configurable:!0}),p.prototype.getAttributeValue=function(t,e){var r={isChecked:void 0,value:void 0,selectedIdList:void 0};if("string"!=typeof e||t.type!==l.TEXT&&t.type!==l.DATETIME&&t.type!==l.CHOICE||(r.value=e),"string"==typeof e&&t.type===l.NUMERIC){var i=parseInt(e);isNaN(i)?r.value=r.value||"":r.value=e}return"boolean"==typeof e&&t.type===l.BOOLEAN&&(r.isChecked=e),"object"==typeof e&&t.type===l.MULTIPLE_CHOICE&&(r.selectedIdList=e),r},Object.defineProperty(p.prototype,"formattedAttributesInput",{get:function(){if(!this._customerAttributes)return null;if(!this._customerAttributes.some((function(t){return void 0!==t.attributeValue.value||void 0!==t.attributeValue.isChecked||void 0!==t.attributeValue.selectedIdList})))return null;var t=[];return this._customerAttributes.map((function(e){var r=e.attributeValue,i=r.selectedIdList,a=r.isChecked,s=r.value;void 0!==i&&l.MULTIPLE_CHOICE&&i.map((function(r){t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:r,value:null})})),e.attribute.type===l.BOOLEAN&&t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:null,value:a?a.toString():"false"}),void 0!==s&&(e.attribute.type!==l.TEXT&&e.attribute.type!==l.NUMERIC||t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:null,value:s.toString()}),e.attribute.type===l.CHOICE&&t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:s,value:null}),e.attribute.type===l.DATETIME&&t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:null,value:new Date(s).getTime().toString()}))})),t},enumerable:!1,configurable:!0}),p.prototype.validateCustomerAttribute=function(){var t,e=this;this._customerAttributes=null===(t=this._customerAttributes)||void 0===t?void 0:t.map((function(t){var r;return t.validator.isRequired&&e.isFormSubmit&&(t.attribute.type===l.BOOLEAN||t.attributeValue.value||(null===(r=t.attributeValue.selectedIdList)||void 0===r?void 0:r.length)?(t.validator.hasError=!1,t.validator.message=""):(t.validator.hasError=!0,t.validator.message="string"==typeof e.message.requiredRule?e.message.requiredRule:e.message.requiredRule(e.model))),t}))},p.prototype.validateAll=function(){var r;return t(this,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return this.validateCustomerAttribute(),[4,this.validator.validateAll()];case 1:return t=e.sent(),i=null===(r=this._customerAttributes)||void 0===r?void 0:r.some((function(t){return t.validator.hasError})),[2,t||i]}}))}))},p.prototype.register=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.isFormSubmit=!0,t={isFormError:!1,isSuccess:!1},[4,this.validateAll()];case 1:if(e.sent())return t.isFormError=!0,[2,t];e.label=2;case 2:return e.trys.push([2,4,,5]),[4,n.getInstance().customerStore.register(this.model.firstName,this.model.lastName,this.model.email,this.model.password,this.model.isMarketingAccepted,this.model.attributes||this.formattedAttributesInput||void 0)];case 3:return e.sent()&&(t.isSuccess=!0),[2,t];case 4:return e.sent(),[2,t];case 5:return[2]}}))}))},p}();export{p as RegisterForm};
|
|
1
|
+
import{__awaiter as e,__generator as t,__spreadArray as r,__assign as i}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as a,computed as o,observable as s,action as n}from"mobx";import{Validator as u}from"../index.js";import{IkasBaseStore as d}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";import{PhoneRule as m,RequiredRule as l,EmailRule as p,MinRule as c}from"../rules/index.js";import"../../../data/blog/category/index.js";import"../../../data/blog/content/index.js";import"../../../data/blog/meta-data/index.js";import"../../../data/blog/tag/index.js";import"../../../data/blog/index.js";import"../../../data/brand/index.js";import{IkasCustomerAttributeType as f,IkasCustomerAttributeRegisterPageRequirement as b}from"@ikas/storefront-models";import"../../../data/campaign-offer/index.js";import"../../../data/cart/campaign-offer/index.js";import"../../../data/cart/index.js";import"../../../data/category/path-item/index.js";import"../../../data/category/index.js";import"../../../data/checkout/index.js";import"../../../data/checkout-settings/index.js";import"../../../data/city/index.js";import"../../../data/country/index.js";import"../../../data/customer/address/region/index.js";import"../../../data/customer/address/index.js";import"../../../data/customer/address/ikas-localized-customer-address.js";import"../../../data/customer/attribute/index.js";import"../../../data/customer/review/summary/index.js";import"../../../data/customer/review/index.js";import"../../../data/customer/index.js";import"../../../data/district/index.js";import"../../../data/favorite-product/index.js";import"../../../data/filter-category/index.js";import"../../../data/html-meta-data/index.js";import"../../../data/image/index.js";import"../../../data/order/address/region/index.js";import"../../../data/order/address/index.js";import"../../../data/order/line-item/option/value/index.js";import"../../../data/order/line-item/variant/value/index.js";import"../../../data/order/line-item/variant/index.js";import"../../../data/order/line-item/index.js";import"../../../data/order/package/index.js";import"../../../data/order/transaction/index.js";import"../../../data/order/index.js";import"../../../data/payment-gateway/index.js";import"../../../data/product/attribute-value/index.js";import"../../../data/product/filter/index.js";import"../../../data/product/campaign-offer/index.js";import"../../../data/product/option-set/option/index.js";import"../../../data/product/option-set/index.js";import"../../../data/product/stock-location/index.js";import"../../../data/product/variant/price/index.js";import"../../../data/product/variant/index.js";import"../../../data/variant-type/index.js";import"../../../data/product/index.js";import"../../../data/raffle/index.js";import"../../../data/shipping-zone/state/city/district/region/index.js";import"../../../data/state/index.js";import"../../../data/theme-json/index.js";import"../../../data/theme-json/component/index.js";import"../../../data/theme-json/custom-data/index.js";import"../../../data/variant-type/variant-value/index.js";import"@ikas/localized-address";var h=function(){function h(e){var t=this;this.model={firstName:"",lastName:"",email:"",password:"",attributes:void 0,isMarketingAccepted:!1,phone:null},this.isFormSubmit=!1,this._customerAttributes=void 0,this.validatorRules=function(e){return void 0===e&&(e=!1),r([new l({fieldKey:"firstName",valuePath:"firstName",message:t.message.requiredRule}),new l({fieldKey:"lastName",valuePath:"lastName",message:t.message.requiredRule}),new l({fieldKey:"email",valuePath:"email",message:t.message.requiredRule}),new l({fieldKey:"password",valuePath:"password",message:t.message.requiredRule}),new p({fieldKey:"email",valuePath:"email",message:t.message.emailRule}),new c({fieldKey:"password",valuePath:"password",minValue:6,message:t.message.minRule})],e?[new m({fieldKey:"phone",valuePath:"phone",message:t.message.phoneRule})]:[],!0)},this.onFirstNameChange=function(e){t.firstName=e},this.onLastNameChange=function(e){t.lastName=e},this.onEmailChange=function(e){t.email=e},this.onPasswordChange=function(e){t.password=e},this.onPhoneChange=function(e){t.phone=e},this.setCustomerAttributes=function(e){t._customerAttributes=(null==e?void 0:e.filter((function(e){return e.registerPageRequirement!==b.INVISIBLE})).map((function(e){return{attribute:e,attributeValue:{isChecked:void 0,value:void 0,selectedIdList:void 0},validator:{isRequired:e.registerPageRequirement===b.MANDATORY,hasError:!1,message:""}}})))||[]},this.onAttributeChange=function(e,r){var i;if(t._customerAttributes){var a=t._customerAttributes.find((function(t){return t.attribute.id===e}));if(a){var o=null===(i=t._customerAttributes)||void 0===i?void 0:i.findIndex((function(t){return t.attribute.id===e}));void 0!==o&&-1!==o&&(t._customerAttributes[o].attributeValue=t.getAttributeValue(a.attribute,r),t.validateCustomerAttribute())}}},a(this,{emailErrorMessage:o,passwordErrorMessage:o,firstNameErrorMessage:o,lastNameErrorMessage:o,phoneErrorMessage:o,hasError:o,redirect:o,model:s,validateAll:n,register:n,customerAttributes:o,_customerAttributes:s}),this.message=e.message,this.validator=new u(this.model,this.validatorRules())}return Object.defineProperty(h.prototype,"firstName",{get:function(){return this.model.firstName},set:function(e){this.model.firstName=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"lastName",{get:function(){return this.model.lastName},set:function(e){this.model.lastName=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"email",{get:function(){return this.model.email},set:function(e){this.model.email=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"password",{get:function(){return this.model.password},set:function(e){this.model.password=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"isMarketingAccepted",{get:function(){return this.model.isMarketingAccepted},set:function(e){this.model.isMarketingAccepted=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"phone",{get:function(){return this.model.phone},set:function(e){this.model.phone=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"firstNameErrorMessage",{get:function(){return this.validator.results.firstName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"lastNameErrorMessage",{get:function(){return this.validator.results.lastName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"emailErrorMessage",{get:function(){return this.validator.results.email.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"passwordErrorMessage",{get:function(){return this.validator.results.password.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"phoneErrorMessage",{get:function(){var e;return null===(e=this.validator.results.phone)||void 0===e?void 0:e.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"attributes",{get:function(){return this.model.attributes},set:function(e){this.model.attributes=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"redirect",{get:function(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("redirect")},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"customerAttributes",{get:function(){return this._customerAttributes},enumerable:!1,configurable:!0}),h.prototype.getAttributeValue=function(e,t){var r={isChecked:void 0,value:void 0,selectedIdList:void 0};if("string"!=typeof t||e.type!==f.TEXT&&e.type!==f.DATETIME&&e.type!==f.CHOICE||(r.value=t),"string"==typeof t&&e.type===f.NUMERIC){var i=parseInt(t);isNaN(i)?r.value=r.value||"":r.value=t}return"boolean"==typeof t&&e.type===f.BOOLEAN&&(r.isChecked=t),"object"==typeof t&&e.type===f.MULTIPLE_CHOICE&&(r.selectedIdList=t),r},Object.defineProperty(h.prototype,"formattedAttributesInput",{get:function(){if(!this._customerAttributes)return null;if(!this._customerAttributes.some((function(e){return void 0!==e.attributeValue.value||void 0!==e.attributeValue.isChecked||void 0!==e.attributeValue.selectedIdList})))return null;var e=[];return this._customerAttributes.map((function(t){var r=t.attributeValue,i=r.selectedIdList,a=r.isChecked,o=r.value;void 0!==i&&f.MULTIPLE_CHOICE&&i.map((function(r){e.push({customerAttributeId:t.attribute.id,customerAttributeOptionId:r,value:null})})),t.attribute.type===f.BOOLEAN&&e.push({customerAttributeId:t.attribute.id,customerAttributeOptionId:null,value:a?a.toString():"false"}),void 0!==o&&(t.attribute.type!==f.TEXT&&t.attribute.type!==f.NUMERIC||e.push({customerAttributeId:t.attribute.id,customerAttributeOptionId:null,value:o.toString()}),t.attribute.type===f.CHOICE&&e.push({customerAttributeId:t.attribute.id,customerAttributeOptionId:o,value:null}),t.attribute.type===f.DATETIME&&e.push({customerAttributeId:t.attribute.id,customerAttributeOptionId:null,value:new Date(o).getTime().toString()}))})),e},enumerable:!1,configurable:!0}),h.prototype.validateCustomerAttribute=function(){var e,t=this;this._customerAttributes=null===(e=this._customerAttributes)||void 0===e?void 0:e.map((function(e){var r;return e.validator.isRequired&&t.isFormSubmit&&(e.attribute.type===f.BOOLEAN||e.attributeValue.value||(null===(r=e.attributeValue.selectedIdList)||void 0===r?void 0:r.length)?(e.validator.hasError=!1,e.validator.message=""):(e.validator.hasError=!0,e.validator.message="string"==typeof t.message.requiredRule?t.message.requiredRule:t.message.requiredRule(t.model))),e}))},h.prototype.validateAll=function(){var r;return e(this,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return this.validateCustomerAttribute(),[4,this.validator.validateAll()];case 1:return e=t.sent(),i=null===(r=this._customerAttributes)||void 0===r?void 0:r.some((function(e){return e.validator.hasError})),[2,e||i]}}))}))},h.prototype.register=function(){return e(this,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return this.isFormSubmit=!0,e={isFormError:!1,isSuccess:!1,errorCodes:[]},this.email&&(this.email=this.email.trim()),this.phone&&this.validator.setRules(this.validatorRules(!0)),[4,this.validateAll()];case 1:if(t.sent())return e.isFormError=!0,[2,e];t.label=2;case 2:return t.trys.push([2,4,,5]),[4,d.getInstance().customerStore.register(this.model.firstName,this.model.lastName,this.model.email,this.model.password,this.model.isMarketingAccepted,this.model.attributes||this.formattedAttributesInput||void 0,this.model.phone)];case 3:return r=t.sent(),[2,i(i({},e),r)];case 4:return t.sent(),[2,e];case 5:return[2]}}))}))},h}();export{h as RegisterForm};
|
|
@@ -2,7 +2,7 @@ import { IkasCategoryListParams } from "../models/ui/category-list";
|
|
|
2
2
|
import { IkasAttributeList } from "../models/ui/product-attribute-list";
|
|
3
3
|
import { IkasProductListParams } from "../models/ui/product-list";
|
|
4
4
|
import { IkasRaffleListParams } from "../models/ui/raffle-list";
|
|
5
|
-
import { IkasThemeJsonSettings, IkasThemeJsonPageType, IkasThemeJsonComponentProp, IkasThemeJsonCustomData, IkasBrandListParams, IkasBrandList, IkasCategoryList, IkasProductList, IkasAttributeDetail, IkasNavigationLink, IkasImage, IkasComponentRenderer, IkasBlogListParams, IkasBlogList, IkasBlogCategoryListParams, IkasBlogCategoryList, IkasRaffleList, IkasProduct } from "../models";
|
|
5
|
+
import { IkasThemeJsonSettings, IkasThemeJsonPageType, IkasThemeJsonComponentProp, IkasThemeJsonCustomData, IkasBrandListParams, IkasBrandList, IkasCategoryList, IkasProductList, IkasAttributeDetail, IkasNavigationLink, IkasImage, IkasComponentRenderer, IkasBlogListParams, IkasBlogList, IkasBlogCategoryListParams, IkasBlogCategoryList, IkasRaffleList, IkasProduct, IkasVideo } from "../models";
|
|
6
6
|
import { IkasPageComponentPropValue, IkasSimplePageComponentPropValue, IkasAttributePropValueData, IkasAttributeListPropValueData, IkasBlogPropValueData, IkasBrandPropValueData, IkasCategoryPropValueData, IkasBlogCategoryPropValueData, IkasCustomDataPropValueData, IkasRafflePropValueData, IkasProductPropValueData, IkasSliderPropValueData } from "@ikas/storefront-providers";
|
|
7
7
|
import { IkasThemeJsonComponent } from "@ikas/storefront-models";
|
|
8
8
|
export declare class IkasPageDataInit {
|
|
@@ -39,4 +39,12 @@ export declare class IkasPageDataInit {
|
|
|
39
39
|
static initRafflePropValue(propValue: IkasRafflePropValueData): any;
|
|
40
40
|
static initRaffleListPropValue(propValue: IkasRaffleListParams): IkasRaffleList;
|
|
41
41
|
static initSliderPropValue(propValue: IkasSliderPropValueData): IkasSliderPropValueData;
|
|
42
|
+
static initVideoPropValue(propValue: IkasVideo): {
|
|
43
|
+
thumbnailImage: IkasImage | null;
|
|
44
|
+
videoSrc: string | null;
|
|
45
|
+
autoplay: boolean;
|
|
46
|
+
controls: boolean;
|
|
47
|
+
loop: boolean;
|
|
48
|
+
muted: boolean;
|
|
49
|
+
};
|
|
42
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as t}from'./../ext/tslib/tslib.es6.js';import{renderComponent as e}from"../components/page/index.js";import{IkasAttributeList as i}from"../models/ui/product-attribute-list/index.js";import{IkasBlogCategory as a}from"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import{IkasBlog as r}from"../models/data/blog/index.js";import{IkasBrand as o}from"../models/data/brand/index.js";import{IkasThemeJsonPageType as n,IkasThemeJsonComponentPropType as s}from"@ikas/storefront-models";import"mobx";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import{IkasCategory as u}from"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/checkout/country-settings-model.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import{IkasImage as l}from"../models/data/image/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as d}from"../models/data/product/index.js";import{IkasRaffle as p}from"../models/data/raffle/index.js";import"../models/data/state/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/custom-data/index.js";import{IkasThemeJsonPageComponent as m}from"../models/data/theme-json/page/component/index.js";import"../models/data/variant-type/variant-value/index.js";import{IkasBlogList as c}from"../models/ui/blog-list/index.js";import{IkasBlogCategoryList as f}from"../models/ui/blog-category-list/index.js";import{IkasBrandList as P}from"../models/ui/brand-list/index.js";import{IkasCategoryList as g}from"../models/ui/category-list/index.js";import{IkasNavigationLink as V}from"../models/ui/navigation-link/index.js";import{IkasProductList as L}from"../models/ui/product-list/index.js";import{IkasAttributeDetail as j}from"../models/ui/product-attribute-detail/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import{IkasComponentRenderer as v}from"../models/ui/component-renderer/index.js";import{IkasRaffleList as D}from"../models/ui/raffle-list/index.js";import{IkasPageComponentPropValue as h,getPlaceholderBrand as x,getPlaceholderCategory as C,getPlaceholderProduct as T,getPlaceholderBlog as S,getPlaceholderBlogCategory as w,getPlaceholderRaffle as I}from"@ikas/storefront-providers";import b from"lodash/flatten";import{IkasBaseStore as y}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";var _=function(){function _(){}return _.setPageSpecificData=function(e,i,o){if(this.isBrowser=o,e)switch(i){case n.PRODUCT:var s=e;_.pageSpecificData=new d(t(t({},s),{selectedVariantValues:s.selectedVariantValues||s.variants[0].variantValues})),o&&this._initProductOnBrowser(_.pageSpecificData);break;case n.CATEGORY:var l=e;_.pageSpecificData=new u(l);break;case n.BRAND:var m=e;_.pageSpecificData=new u(m);break;case n.BLOG:var c=e;_.pageSpecificData=new r(c);break;case n.BLOG_CATEGORY:var f=e;_.pageSpecificData=new a(f);break;case n.RAFFLE_DETAIL:var P=e;_.pageSpecificData=new p(P)}else this.pageSpecificData=void 0},_.isServer=function(){return"undefined"==typeof window},_.initPagePropValues=function(t,e,i,a,r){return this.flatCustomDataList=b(i.map((function(t){return t.flat}))),t.map((function(t){return _.initPageComponentPropValue(t,e,a,r)}))},_.initPageComponentPropValue=function(e,i,a,r){var o=i.find((function(t){return t.id===e.pageComponent.componentId})),n=null==o?void 0:o.props,s={};return null==n||n.map((function(t){var i=e.propValues[t.name];s[t.name]=_.initPropValue(t,i,a,r)})),new h(t(t({},e),{pageComponent:new m(t(t({},e.pageComponent),{propValues:s,componentId:o.id})),component:o,propValues:s}))},_.initPropValue=function(t,e,i,a){if(null==e)return null;switch(t.type){case s.IMAGE:return _.initImagePropValue(e);case s.IMAGE_LIST:return _.initImageListPropValue(e);case s.BRAND:return _.initBrandPropValue(e);case s.BRAND_LIST:return _.initBrandListPropValue(e);case s.CATEGORY:return _.initCategoryPropValue(e);case s.CATEGORY_LIST:return _.initCategoryListPropValue(e);case s.PRODUCT_LIST:return _.initProductListPropValue(e);case s.PRODUCT_DETAIL:return _.initProductPropValue(e);case s.PRODUCT_ATTRIBUTE:return _.initAttributePropValue(e);case s.PRODUCT_ATTRIBUTE_LIST:return _.initAttributeListPropValue(e);case s.LINK:case s.LIST_OF_LINK:return _.initLinkPropValue(e);case s.COMPONENT:return _.initComponentPropValue(e,i,a);case s.COMPONENT_LIST:return _.initComponentListPropValue(e,i,a);case s.CUSTOM:return _.initCustomDataPropValue(e,i,a);case s.BLOG:return _.initBlogPropValue(e);case s.BLOG_LIST:return _.initBlogListPropValue(e);case s.BLOG_CATEGORY:return _.initBlogCategoryPropValue(e);case s.BLOG_LIST:return _.initBlogCategoryListPropValue(e);case s.RAFFLE:return _.initRafflePropValue(e);case s.RAFFLE_LIST:return _.initRaffleListPropValue(e);case s.SLIDER:return _.initSliderPropValue(e);default:return e}},_.initBrandPropValue=function(t){return t.brandPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:t.brand?new o(t.brand):x()},_.initBrandListPropValue=function(t){return new P(t)},_.initCategoryPropValue=function(t){return t.categoryPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:t.category?new u(t.category):C()},_.initCategoryListPropValue=function(t){return new g(t)},_.initProductListPropValue=function(t){return new L(t,y.getInstance().router)},_.initProductPropValue=function(e){var i=new d(T());if(e.productDetailPropValue.usePageData&&this.pageSpecificData)i=this.pageSpecificData;else if(e.productDetail){var a=e.productDetail;i=new d(t(t({},a),{selectedVariantValues:a.selectedVariantValues}))}return i},_._initProductOnBrowser=function(t){var e=new URLSearchParams(window.location.search),i=e.get("vid");if(i){var a=t.variants.find((function(t){return t.id===i}));a&&(t.selectedVariantValues=a.variantValues)}else{var r=t.variantTypes.map((function(t){return t.variantType.slug})),o=[];r.forEach((function(i,a){var r=t.variantTypes[a],n=e.get(i);if(n){var s=r.variantType.values.find((function(t){return t.slug===n}));s&&o.push(s)}})),o.length===t.selectedVariantValues.length&&(t.selectedVariantValues=o)}},_.initAttributePropValue=function(e){var i=null;if(e.attributePropValue.usePageData&&this.pageSpecificData)i=this.pageSpecificData;else if(e.productDetail){var a=e.productDetail;i=new d(t(t({},a),{selectedVariantValues:a.selectedVariantValues}))}return new j(i,e.attributePropValue)},_.initAttributeListPropValue=function(e){var a=null;if(e.attributeListPropValue.usePageData&&this.pageSpecificData)a=this.pageSpecificData;else if(e.productDetail){var r=e.productDetail;a=new d(t(t({},r),{selectedVariantValues:r.selectedVariantValues}))}return new i(a,e.attributeListPropValue)},_.initLinkPropValue=function(t){return Array.isArray(t)?t.map((function(t){return new V(t.href,t.label,t.subLinks,t.isExternal||void 0)})):t?new V(t.href,t.label,t.subLinks,t.isExternal||void 0):void 0},_.initImagePropValue=function(t){return new l(t)},_.initImageListPropValue=function(t){return t.map((function(t){return new l(t)}))},_.initCustomDataPropValue=function(t,e,i){if(t&&t.value&&t.customDataId){var a=this.flatCustomDataList.find((function(e){return e.id===t.customDataId}));if(a)return this._initCustomDataPropValue(t,a,e,i)}},_._initCustomDataPropValue=function(t,e,i,a){var r=this;if(!t)return null;var o=t.value;if(null==o)return null;switch(e.type){case s.BRAND:return this.initBrandPropValue(o);case s.BRAND_LIST:return this.initBrandListPropValue(o);case s.CATEGORY_LIST:return this.initCategoryListPropValue(o);case s.CATEGORY:return this.initCategoryPropValue(o);case s.IMAGE_LIST:return this.initImageListPropValue(o);case s.IMAGE:return this.initImagePropValue(o);case s.LINK:return this.initLinkPropValue(o);case s.PRODUCT_DETAIL:return this.initProductPropValue(o);case s.PRODUCT_LIST:return this.initProductListPropValue(o);case s.PRODUCT_ATTRIBUTE:return this.initAttributePropValue(o);case s.PRODUCT_ATTRIBUTE_LIST:return this.initAttributeListPropValue(o);case s.BLOG:return this.initBlogPropValue(o);case s.BLOG_LIST:return this.initBlogListPropValue(o);case s.BLOG_CATEGORY:return this.initBlogCategoryPropValue(o);case s.BLOG_CATEGORY_LIST:return this.initBlogCategoryListPropValue(o);case s.RAFFLE:return this.initRafflePropValue(o);case s.RAFFLE_LIST:return this.initRaffleListPropValue(o);case s.SLIDER:return this.initSliderPropValue(o);case s.OBJECT:for(var n={},u=function(t){var e=o[t.key],r=void 0;t.customDataId&&(r=l.flatCustomDataList.find((function(t){return t.id===e.customDataId}))),n[t.key]=l._initCustomDataPropValue(e,r||t,i,a)},l=this,d=0,p=e.nestedData||[];d<p.length;d++){u(p[d])}return n;case s.DYNAMIC_LIST:case s.STATIC_LIST:try{if(!o||!o.length)return null;var m=[],c=e.nestedData[0];return o.forEach((function(t){var e;c.customDataId&&(e=r.flatCustomDataList.find((function(e){return e.id===t.customDataId}))),m.push(r._initCustomDataPropValue(t,e||c,i,a))})),m}catch(t){return[]}case s.COMPONENT:return this.initComponentPropValue(o,i,a);case s.COMPONENT_LIST:return this.initComponentListPropValue(o,i,a);default:return o}},_.initComponentPropValue=function(t,e,i){return this._initComponentPropValue(t,e,i)},_._initComponentPropValue=function(t,i,a){var r=t.length?t[0]:void 0;if(r){var o=new h(r),n=_.initPageComponentPropValue(o,[o.component],i,a);if(n)return new v((function(){return e(n,i,-10)}))}},_.initComponentListPropValue=function(t,e,i){return this._initComponentListPropValue(t,e,i)},_._initComponentListPropValue=function(t,i,a){return t&&t.length?t.map((function(t){var r=new h(t),o=_.initPageComponentPropValue(r,[r.component],i,a);return new v((function(){return e(o,i,-1)}))})):[]},_.initBlogPropValue=function(t){return t.blogPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:t.blog?new r(t.blog):S()},_.initBlogListPropValue=function(t){return new c(t)},_.initBlogCategoryPropValue=function(t){return t.blogCategoryPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:t.blogCategory?new a(t.blogCategory):w()},_.initBlogCategoryListPropValue=function(t){return new f(t)},_.initRafflePropValue=function(t){return t.rafflePropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:t.raffle?new p(t.raffle):new p(I())},_.initRaffleListPropValue=function(t){return new D(t)},_.initSliderPropValue=function(t){return t},_.pageSpecificData={},_.flatCustomDataList=[],_.isBrowser=!1,_}();export{_ as IkasPageDataInit};
|
|
1
|
+
import{__assign as t}from'./../ext/tslib/tslib.es6.js';import{renderComponent as e}from"../components/page/index.js";import{IkasAttributeList as i}from"../models/ui/product-attribute-list/index.js";import{IkasBlogCategory as a}from"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import{IkasBlog as r}from"../models/data/blog/index.js";import{IkasBrand as o}from"../models/data/brand/index.js";import{IkasThemeJsonPageType as n,initIkasCategory as s,IkasThemeJsonComponentPropType as u}from"@ikas/storefront-models";import"mobx";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import{IkasCategory as d}from"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import{IkasImage as l}from"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as p}from"../models/data/product/index.js";import{IkasRaffle as m}from"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import{IkasThemeJsonPageComponent as c}from"../models/data/theme-json/page/component/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import{IkasBlogList as f}from"../models/ui/blog-list/index.js";import{IkasBlogCategoryList as g}from"../models/ui/blog-category-list/index.js";import{IkasBrandList as P}from"../models/ui/brand-list/index.js";import{IkasCategoryList as V}from"../models/ui/category-list/index.js";import{IkasNavigationLink as v}from"../models/ui/navigation-link/index.js";import{IkasProductList as j}from"../models/ui/product-list/index.js";import{IkasAttributeDetail as L}from"../models/ui/product-attribute-detail/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import{IkasComponentRenderer as D}from"../models/ui/component-renderer/index.js";import{IkasRaffleList as h}from"../models/ui/raffle-list/index.js";import{IkasPageComponentPropValue as x,getPlaceholderBrand as C,getPlaceholderCategory as T,getPlaceholderProduct as S,getPlaceholderBlog as I,getPlaceholderBlogCategory as w,getPlaceholderRaffle as y}from"@ikas/storefront-providers";import b from"lodash/flatten";import{IkasBaseStore as _}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import{IkasProductVariantFunctions as O}from"@ikas/storefront-model-functions";import{IkasStorefrontConfig as B}from"@ikas/storefront-config";var R=function(){function R(){}return R.setPageSpecificData=function(e,i,u){var l;if(this.isBrowser=u,e)switch(i){case n.PRODUCT:var c=e;R.pageSpecificData=new p(t(t({},c),{selectedVariantValues:c.selectedVariantValues||(null===(l=c.variants.find((function(t){return O.hasStock(t)})))||void 0===l?void 0:l.variantValues)||c.variants[0].variantValues})),u&&this._initProductOnBrowser(R.pageSpecificData);break;case n.CATEGORY:var f=e;s(f,B.getCurrentLocale()),R.pageSpecificData=new d(f);break;case n.BRAND:var g=e;R.pageSpecificData=new o(g);break;case n.BLOG:var P=e;R.pageSpecificData=new r(P);break;case n.BLOG_CATEGORY:var V=e;R.pageSpecificData=new a(V);break;case n.RAFFLE_DETAIL:var v=e;R.pageSpecificData=new m(v)}else this.pageSpecificData=void 0},R.isServer=function(){return"undefined"==typeof window},R.initPagePropValues=function(t,e,i,a,r){return this.flatCustomDataList=b(i.map((function(t){return t.flat}))),t.map((function(t){return R.initPageComponentPropValue(t,e,a,r)}))},R.initPageComponentPropValue=function(e,i,a,r){var o=i.find((function(t){return t.id===e.pageComponent.componentId})),n=null==o?void 0:o.props,s={};return null==n||n.map((function(t){var i=e.propValues[t.name];s[t.name]=R.initPropValue(t,i,a,r)})),new x(t(t({},e),{pageComponent:new c(t(t({},e.pageComponent),{propValues:s,componentId:o.id})),component:o,propValues:s}))},R.initPropValue=function(t,e,i,a){if(null==e)return null;switch(t.type){case u.IMAGE:return R.initImagePropValue(e);case u.IMAGE_LIST:return R.initImageListPropValue(e);case u.BRAND:return R.initBrandPropValue(e);case u.BRAND_LIST:return R.initBrandListPropValue(e);case u.CATEGORY:return R.initCategoryPropValue(e);case u.CATEGORY_LIST:return R.initCategoryListPropValue(e);case u.PRODUCT_LIST:return R.initProductListPropValue(e);case u.PRODUCT_DETAIL:return R.initProductPropValue(e);case u.PRODUCT_ATTRIBUTE:return R.initAttributePropValue(e);case u.PRODUCT_ATTRIBUTE_LIST:return R.initAttributeListPropValue(e);case u.LINK:case u.LIST_OF_LINK:return R.initLinkPropValue(e);case u.COMPONENT:return R.initComponentPropValue(e,i,a);case u.COMPONENT_LIST:return R.initComponentListPropValue(e,i,a);case u.CUSTOM:return R.initCustomDataPropValue(e,i,a);case u.BLOG:return R.initBlogPropValue(e);case u.BLOG_LIST:return R.initBlogListPropValue(e);case u.BLOG_CATEGORY:return R.initBlogCategoryPropValue(e);case u.BLOG_LIST:return R.initBlogCategoryListPropValue(e);case u.RAFFLE:return R.initRafflePropValue(e);case u.RAFFLE_LIST:return R.initRaffleListPropValue(e);case u.SLIDER:return R.initSliderPropValue(e);case u.VIDEO:return R.initVideoPropValue(e);default:return e}},R.initBrandPropValue=function(t){return t.brandPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:t.brand?new o(t.brand):C()},R.initBrandListPropValue=function(t){return new P(t)},R.initCategoryPropValue=function(e){var i,a;return e.categoryPropValue.usePageData&&this.pageSpecificData?((null===(i=e.categoryPropValue.excludedFieldsCategory)||void 0===i?void 0:i.length)&&(this.pageSpecificData.description=null),this.pageSpecificData):e.category?new d(t(t({},e.category),{description:(null===(a=e.categoryPropValue.excludedFieldsCategory)||void 0===a?void 0:a.length)?null:e.category.description})):T()},R.initCategoryListPropValue=function(t){return new V(t)},R.initProductListPropValue=function(e){return new j(t(t({},e),{pageSpecificData:this.pageSpecificData}),_.getInstance().router)},R.initProductPropValue=function(e){var i=new p(S());if(e.productDetailPropValue.usePageData&&this.pageSpecificData)i=this.pageSpecificData;else if(e.productDetail){var a=e.productDetail;i=new p(t(t({},a),{selectedVariantValues:a.selectedVariantValues}))}return i},R._initProductOnBrowser=function(t){var e=new URLSearchParams(window.location.search),i=e.get("vid");if(i){var a=t.variants.find((function(t){return t.id===i}));a&&(t.selectedVariantValues=a.variantValues)}else{var r=t.variantTypes.map((function(t){return t.variantType.slug})),o=[];r.forEach((function(i,a){var r=t.variantTypes[a],n=e.get(i);if(n){var s=r.variantType.values.find((function(t){return t.slug===n}));s&&o.push(s)}})),o.length===t.selectedVariantValues.length&&(t.selectedVariantValues=o)}},R.initAttributePropValue=function(e){var i=null;if(e.attributePropValue.usePageData&&this.pageSpecificData)i=this.pageSpecificData;else if(e.productDetail){var a=e.productDetail;i=new p(t(t({},a),{selectedVariantValues:a.selectedVariantValues}))}return new L(i,e.attributePropValue)},R.initAttributeListPropValue=function(e){var a=null;if(e.attributeListPropValue.usePageData&&this.pageSpecificData)a=this.pageSpecificData;else if(e.productDetail){var r=e.productDetail;a=new p(t(t({},r),{selectedVariantValues:r.selectedVariantValues}))}return new i(a,e.attributeListPropValue)},R.initLinkPropValue=function(t){return Array.isArray(t)?t.map((function(t){return new v(t.href,t.label,t.subLinks,t.isExternal||void 0)})):t?new v(t.href,t.label,t.subLinks,t.isExternal||void 0):void 0},R.initImagePropValue=function(t){return new l(t)},R.initImageListPropValue=function(t){return t.map((function(t){return new l(t)}))},R.initCustomDataPropValue=function(t,e,i){if(t&&t.value&&t.customDataId){var a=this.flatCustomDataList.find((function(e){return e.id===t.customDataId}));if(a)return this._initCustomDataPropValue(t,a,e,i)}},R._initCustomDataPropValue=function(t,e,i,a){var r=this;if(!t)return null;var o=t.value;if(null==o)return null;switch(e.type){case u.BRAND:return this.initBrandPropValue(o);case u.BRAND_LIST:return this.initBrandListPropValue(o);case u.CATEGORY_LIST:return this.initCategoryListPropValue(o);case u.CATEGORY:return this.initCategoryPropValue(o);case u.IMAGE_LIST:return this.initImageListPropValue(o);case u.IMAGE:return this.initImagePropValue(o);case u.LINK:return this.initLinkPropValue(o);case u.PRODUCT_DETAIL:return this.initProductPropValue(o);case u.PRODUCT_LIST:return this.initProductListPropValue(o);case u.PRODUCT_ATTRIBUTE:return this.initAttributePropValue(o);case u.PRODUCT_ATTRIBUTE_LIST:return this.initAttributeListPropValue(o);case u.BLOG:return this.initBlogPropValue(o);case u.BLOG_LIST:return this.initBlogListPropValue(o);case u.BLOG_CATEGORY:return this.initBlogCategoryPropValue(o);case u.BLOG_CATEGORY_LIST:return this.initBlogCategoryListPropValue(o);case u.RAFFLE:return this.initRafflePropValue(o);case u.RAFFLE_LIST:return this.initRaffleListPropValue(o);case u.SLIDER:return this.initSliderPropValue(o);case u.VIDEO:return R.initVideoPropValue(o);case u.OBJECT:for(var n={},s=function(t){var e=o[t.key],r=void 0;t.customDataId&&(r=d.flatCustomDataList.find((function(t){return t.id===e.customDataId}))),n[t.key]=d._initCustomDataPropValue(e,r||t,i,a)},d=this,l=0,p=e.nestedData||[];l<p.length;l++){s(p[l])}return n;case u.DYNAMIC_LIST:case u.STATIC_LIST:try{if(!o||!o.length)return null;var m=[],c=e.nestedData[0];return o.forEach((function(t){var e;c.customDataId&&(e=r.flatCustomDataList.find((function(e){return e.id===t.customDataId}))),m.push(r._initCustomDataPropValue(t,e||c,i,a))})),m}catch(t){return[]}case u.COMPONENT:return this.initComponentPropValue(o,i,a);case u.COMPONENT_LIST:return this.initComponentListPropValue(o,i,a);default:return o}},R.initComponentPropValue=function(t,e,i){return this._initComponentPropValue(t,e,i)},R._initComponentPropValue=function(t,i,a){var r=t.length?t[0]:void 0;if(r){var o=new x(r),n=R.initPageComponentPropValue(o,[o.component],i,a);if(n)return new D((function(){return e(n,i,-10)}))}},R.initComponentListPropValue=function(t,e,i){return this._initComponentListPropValue(t,e,i)},R._initComponentListPropValue=function(t,i,a){return t&&t.length?t.map((function(t){var r=new x(t),o=R.initPageComponentPropValue(r,[r.component],i,a);return new D((function(){return e(o,i,-1)}))})):[]},R.initBlogPropValue=function(t){return t.blogPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:t.blog?new r(t.blog):I()},R.initBlogListPropValue=function(t){return new f(t)},R.initBlogCategoryPropValue=function(t){return t.blogCategoryPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:t.blogCategory?new a(t.blogCategory):w()},R.initBlogCategoryListPropValue=function(t){return new g(t)},R.initRafflePropValue=function(t){return t.rafflePropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:t.raffle?new m(t.raffle):new m(y())},R.initRaffleListPropValue=function(t){return new h(t)},R.initSliderPropValue=function(t){return t},R.initVideoPropValue=function(e){return t(t({},e),{thumbnailImage:e.thumbnailImage?new l(e.thumbnailImage):null})},R.pageSpecificData={},R.flatCustomDataList=[],R.isBrowser=!1,R}();export{R as IkasPageDataInit};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__assign as e}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as o}from"mobx-react-lite";import{IkasPage as r}from"../../components/page/index.js";var m=o((function(o){return t.createElement(r,e({},o))}));export{m as default};
|
package/build/pages/checkout.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as o,__awaiter as t,__generator as e,__assign as r}from'./../ext/tslib/tslib.es6.js';import*as i from"react";import{observer as s}from"mobx-react-lite";import d from"../components/checkout/index.js";import{useRouter as
|
|
1
|
+
import{__rest as o,__awaiter as t,__generator as e,__assign as r}from'./../ext/tslib/tslib.es6.js';import*as i from"react";import{observer as s}from"mobx-react-lite";import d from"../components/checkout/index.js";import{useRouter as a}from"next/router.js";import{FullscreenLoading as m}from"../components/checkout/components/fullscreen-loading/index.js";import{CheckoutStep as n}from"../components/checkout/model.js";import{setAPIClientConfig as l,listCheckoutSettings as c,getCartById as p}from"@ikas/storefront-api";import{IkasStorefrontConfig as u}from"@ikas/storefront-config";import"../analytics/analytics.js";import"../analytics/head/index.js";import"../components/page/index.js";import"../components/page/head.js";import"next/image.js";import"@ikas/storefront-model-functions";import"../components/link/index.js";import"../components/page-editor/loader/style.module.scss.js";import"../components/google-captcha/index.js";import"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"@ikas/storefront-models";import"mobx";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import"../models/data/category/index.js";import{IkasCheckout as j}from"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/brand-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import"./home.js";import"./_slug_/index.js";import"./pages/_slug_.js";import"./account/index.js";import"./account/addresses.js";import"./account/orders/index.js";import"./account/orders/_id_.js";import"./account/login.js";import"./account/register.js";import"./account/forgot-password.js";import"./account/recover-password.js";import"./cart.js";import"./editor.js";import"./account/favorite-products.js";import"./search.js";import"next/error.js";import"./blog/index.js";import"./blog/_slug_.js";import"./raffle/_slug_.js";import"./raffle/index.js";import"./account/raffles.js";import"./account/activate.js";import{IkasBaseStore as x}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import"lodash/get";import{initIkasEvents as g}from"../analytics/events.js";import{APIErrorCode as f}from'./../ext/@ikas/fe-api-client/build/utils/api.js';import'./../ext/axios/index.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_defineProperty.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_baseGetTag.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_stringToPath.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_baseToString.js';var y=s((function(s){var y=s.customizationProps,v=s.configJson,h=o(s,["customizationProps","configJson"]),b=a(),k=i.useState(),E=k[0],F=k[1],C=i.useState(h.checkoutSettings),P=C[0],_=C[1];u.init(v),l(),i.useEffect((function(){!function(o){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==o?void 0:o.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==o?void 0:o.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==o?void 0:o.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==o?void 0:o.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==o?void 0:o.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==o?void 0:o.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==o?void 0:o.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==o?void 0:o.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==o?void 0:o.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==o?void 0:o.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==o?void 0:o.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==o?void 0:o.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==o?void 0:o.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==o?void 0:o.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==o?void 0:o.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==o?void 0:o.successLightColor)||"#F6FFED")}(y)}),[y]),i.useEffect((function(){x.getInstance().checkLocalization(),w(),g()}),[]);var w=i.useCallback((function(){return t(void 0,void 0,void 0,(function(){var o,t,r,i,s,d,a,m;return e(this,(function(e){switch(e.label){case 0:return o=new URLSearchParams(window.location.search),t=o.get("id"),r=o.get("step"),t?(i=!1,r&&r===n.SUCCESS&&(i=!0),[4,p({id:t,getCompletedCart:i})]):[2,b.replace("/")];case 1:return s=e.sent(),P?[3,3]:[4,c({})];case 2:(d=e.sent()).isSuccess&&(null===(m=d.data)||void 0===m?void 0:m.length)?_(d.data[0]):(console.error("CHECKOUT SETTINGS FETCH FAILED!"),console.error(d),console.error(d.graphQLErrors),console.error(d.errorCodes)),e.label=3;case 3:return s.isSuccess&&s.data?(a=s.data,F(new j(a))):s.errorCodes.some((function(o){return o===f.LOGIN_REQUIRED}))?b.replace("/account/login?redirect="+encodeURIComponent(window.location.href)):b.replace("/"),[2]}}))}))}),[]);return E&&P?i.createElement(d,r({checkout:E,customizationProps:y},h,{checkoutSettings:P})):i.createElement(m,null)}));export{y as default};
|