@ikas/storefront 6.1.0-beta.134 → 6.1.0-beta.135
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e,__spreadArray as r,__assign as i}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as s,computed as a,observable as o,action as n}from"mobx";import u from"lodash/toNumber";import{Validator as d}from"../index.js";import{IkasBaseStore as m}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";import{PhoneRule as l,RequiredRule as p,EmailRule as c,MinRule as f}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 h,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/customer-form-data-input/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/order-transaction-with-prices/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/storefront-popup/storefront-popup-display-filter/index.js";import"../../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../../data/storefront-popup/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 g=function(){function g(t){var e=this;this.model={firstName:"",lastName:"",email:"",password:"",attributes:void 0,isMarketingAccepted:!1,phone:null,isSmsRegister:!1},this.isFormSubmit=!1,this._customerAttributes=void 0,this.validatorRules=function(t){return void 0===t&&(t=!1),r([new p({fieldKey:"firstName",valuePath:"firstName",message:e.message.requiredRule}),new p({fieldKey:"lastName",valuePath:"lastName",message:e.message.requiredRule}),new p({fieldKey:"email",valuePath:"email",message:e.message.requiredRule}),new p({fieldKey:"password",valuePath:"password",message:e.message.requiredRule}),new c({fieldKey:"email",valuePath:"email",message:e.message.emailRule}),new f({fieldKey:"password",valuePath:"password",minValue:6,message:e.message.minRule})],t?[new l({fieldKey:"phone",valuePath:"phone",message:e.message.phoneRule})]:[],!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.onPhoneChange=function(t){e.phone=t},this.onSmsRegisterChange=function(t){if(t){var r=e.validatorRules(!0);e.validator.setRules(r)}else{r=e.validatorRules(!1);e.validator.setRules(r)}e.isSmsRegister=t},this.setCustomerAttributes=function(t){e._customerAttributes=(null==t?void 0:t.filter((function(t){return t.registerPageRequirement!==b.INVISIBLE})).map((function(t){return{attribute:t,attributeValue:{isChecked:void 0,value:void 0,selectedIdList:void 0},validator:{isRequired:t.registerPageRequirement===b.MANDATORY,hasError:!1,message:""}}})))||[]},this.onAttributeChange=function(t,r){var i;if(e._customerAttributes){var s=e._customerAttributes.find((function(e){return e.attribute.id===t}));if(s){var a=null===(i=e._customerAttributes)||void 0===i?void 0:i.findIndex((function(e){return e.attribute.id===t}));void 0!==a&&-1!==a&&(e._customerAttributes[a].attributeValue=e.getAttributeValue(s.attribute,r),e.validateCustomerAttribute())}}},s(this,{emailErrorMessage:a,passwordErrorMessage:a,firstNameErrorMessage:a,lastNameErrorMessage:a,phoneErrorMessage:a,hasError:a,redirect:a,model:o,validateAll:n,register:n,customerAttributes:a,_customerAttributes:o}),this.message=t.message,this.validator=new d(this.model,this.validatorRules())}return Object.defineProperty(g.prototype,"firstName",{get:function(){return this.model.firstName},set:function(t){this.model.firstName=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"lastName",{get:function(){return this.model.lastName},set:function(t){this.model.lastName=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"email",{get:function(){return this.model.email},set:function(t){this.model.email=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"password",{get:function(){return this.model.password},set:function(t){this.model.password=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isMarketingAccepted",{get:function(){return this.model.isMarketingAccepted},set:function(t){this.model.isMarketingAccepted=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isSmsRegister",{get:function(){return this.model.isSmsRegister},set:function(t){this.model.isSmsRegister=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"phone",{get:function(){return this.model.phone},set:function(t){this.model.phone=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"firstNameErrorMessage",{get:function(){return this.validator.results.firstName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"lastNameErrorMessage",{get:function(){return this.validator.results.lastName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"emailErrorMessage",{get:function(){return this.validator.results.email.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"passwordErrorMessage",{get:function(){return this.validator.results.password.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"phoneErrorMessage",{get:function(){var t;return null===(t=this.validator.results.phone)||void 0===t?void 0:t.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"attributes",{get:function(){return this.model.attributes},set:function(t){this.model.attributes=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"redirect",{get:function(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("redirect")},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"customerAttributes",{get:function(){return this._customerAttributes},enumerable:!1,configurable:!0}),g.prototype.getAttributeValue=function(t,e){var r={isChecked:void 0,value:void 0,selectedIdList:void 0};return"string"!=typeof e||t.type!==h.TEXT&&t.type!==h.DATETIME&&t.type!==h.DATE&&t.type!==h.CHOICE||(r.value=e),"string"==typeof e&&t.type===h.NUMERIC&&(Number.isInteger(u(e))?r.value=e:r.value=e.slice(0,-1)),"boolean"==typeof e&&t.type===h.BOOLEAN&&(r.isChecked=e),"object"==typeof e&&t.type===h.MULTIPLE_CHOICE&&(r.selectedIdList=e),r},Object.defineProperty(g.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,s=r.isChecked,a=r.value;void 0!==i&&h.MULTIPLE_CHOICE&&i.map((function(r){t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:r,value:null})})),e.attribute.type===h.BOOLEAN&&t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:null,value:s?s.toString():"false"}),void 0!==a&&(e.attribute.type!==h.TEXT&&e.attribute.type!==h.NUMERIC||t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:null,value:a.toString()}),e.attribute.type===h.CHOICE&&t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:a,value:null}),e.attribute.type!==h.DATETIME&&e.attribute.type!==h.DATE||t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:null,value:new Date(a).getTime().toString()}))})),t},enumerable:!1,configurable:!0}),g.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===h.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}))},g.prototype.validateAll=function(){var r;return t(this,void 0,void 0,(function(){var t,i,s;return e(this,(function(e){switch(e.label){case 0:return this.validateCustomerAttribute(),t=this.isSmsRegister?["email"]:void 0,[4,this.validator.validateAll(t)];case 1:return i=e.sent(),s=null===(r=this._customerAttributes)||void 0===r?void 0:r.some((function(t){return t.validator.hasError})),[2,i||s]}}))}))},g.prototype.register=function(){return t(this,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return this.isFormSubmit=!0,t={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(e.sent())return t.isFormError=!0,[2,t];e.label=2;case 2:return e.trys.push([2,4,,5]),[4,m.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=e.sent(),[2,i(i({},t),r)];case 4:return e.sent(),[2,t];case 5:return[2]}}))}))},g.prototype.smsRegister=function(){return t(this,void 0,void 0,(function(){var t,r,s;return e(this,(function(e){switch(e.label){case 0:return this.isFormSubmit=!0,t={isFormError:!1,isSuccess:!1,errorCodes:[]},[4,this.validateAll()];case 1:if(e.sent())return t.isFormError=!0,[2,t];r=this.model.phone||"",e.label=2;case 2:return e.trys.push([2,4,,5]),[4,m.getInstance().customerStore.smsRegister(this.model.firstName,this.model.lastName,r,this.model.isMarketingAccepted,this.model.attributes||this.formattedAttributesInput||void 0)];case 3:return s=e.sent(),[2,i(i({},t),{isSuccess:s})];case 4:return e.sent(),[2,t];case 5:return[2]}}))}))},g}();export{g as RegisterForm};
|
|
1
|
+
import{__awaiter as t,__generator as e,__spreadArray as r,__assign as i}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as s,computed as a,observable as o,action as n}from"mobx";import u from"lodash/toNumber";import{Validator as d}from"../index.js";import{IkasBaseStore as m}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";import{PhoneRule as l,RequiredRule as p,EmailRule as c,MinRule as f}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 h,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/customer-form-data-input/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/order-transaction-with-prices/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/storefront-popup/storefront-popup-display-filter/index.js";import"../../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../../data/storefront-popup/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 g=function(){function g(t){var e=this;this.model={firstName:"",lastName:"",email:"",password:"",attributes:void 0,isMarketingAccepted:!1,phone:null,isSmsRegister:!1},this.isFormSubmit=!1,this._customerAttributes=void 0,this.validatorRules=function(t){return void 0===t&&(t=!1),r([new p({fieldKey:"firstName",valuePath:"firstName",message:e.message.requiredRule}),new p({fieldKey:"lastName",valuePath:"lastName",message:e.message.requiredRule}),new p({fieldKey:"email",valuePath:"email",message:e.message.requiredRule}),new p({fieldKey:"password",valuePath:"password",message:e.message.requiredRule}),new c({fieldKey:"email",valuePath:"email",message:e.message.emailRule}),new f({fieldKey:"password",valuePath:"password",minValue:6,message:e.message.minRule})],t?[new l({fieldKey:"phone",valuePath:"phone",message:e.message.phoneRule})]:[],!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.onPhoneChange=function(t){e.phone=t},this.onSmsRegisterChange=function(t){if(t){var r=e.validatorRules(!0);e.validator.setRules(r)}else{r=e.validatorRules(!1);e.validator.setRules(r)}e.isSmsRegister=t},this.setCustomerAttributes=function(t){e._customerAttributes=(null==t?void 0:t.filter((function(t){return t.registerPageRequirement!==b.INVISIBLE})).map((function(t){return{attribute:t,attributeValue:{isChecked:void 0,value:void 0,selectedIdList:void 0},validator:{isRequired:t.registerPageRequirement===b.MANDATORY,hasError:!1,message:""}}})))||[]},this.onAttributeChange=function(t,r){var i;if(e._customerAttributes){var s=e._customerAttributes.find((function(e){return e.attribute.id===t}));if(s){var a=null===(i=e._customerAttributes)||void 0===i?void 0:i.findIndex((function(e){return e.attribute.id===t}));void 0!==a&&-1!==a&&(e._customerAttributes[a].attributeValue=e.getAttributeValue(s.attribute,r),e.validateCustomerAttribute())}}},s(this,{emailErrorMessage:a,passwordErrorMessage:a,firstNameErrorMessage:a,lastNameErrorMessage:a,phoneErrorMessage:a,hasError:a,redirect:a,model:o,validateAll:n,register:n,customerAttributes:a,_customerAttributes:o}),this.message=t.message,this.validator=new d(this.model,this.validatorRules())}return Object.defineProperty(g.prototype,"firstName",{get:function(){return this.model.firstName},set:function(t){this.model.firstName=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"lastName",{get:function(){return this.model.lastName},set:function(t){this.model.lastName=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"email",{get:function(){return this.model.email},set:function(t){this.model.email=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"password",{get:function(){return this.model.password},set:function(t){this.model.password=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isMarketingAccepted",{get:function(){return this.model.isMarketingAccepted},set:function(t){this.model.isMarketingAccepted=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isSmsRegister",{get:function(){return this.model.isSmsRegister},set:function(t){this.model.isSmsRegister=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"phone",{get:function(){return this.model.phone},set:function(t){this.model.phone=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"firstNameErrorMessage",{get:function(){return this.validator.results.firstName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"lastNameErrorMessage",{get:function(){return this.validator.results.lastName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"emailErrorMessage",{get:function(){return this.validator.results.email.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"passwordErrorMessage",{get:function(){return this.validator.results.password.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"phoneErrorMessage",{get:function(){var t;return null===(t=this.validator.results.phone)||void 0===t?void 0:t.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"attributes",{get:function(){return this.model.attributes},set:function(t){this.model.attributes=t},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"redirect",{get:function(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("redirect")},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"customerAttributes",{get:function(){return this._customerAttributes},enumerable:!1,configurable:!0}),g.prototype.getAttributeValue=function(t,e){var r={isChecked:void 0,value:void 0,selectedIdList:void 0};return"string"!=typeof e||t.type!==h.TEXT&&t.type!==h.DATETIME&&t.type!==h.DATE&&t.type!==h.CHOICE||(r.value=e),"string"==typeof e&&t.type===h.NUMERIC&&(Number.isInteger(u(e))?r.value=e:r.value=e.slice(0,-1)),"boolean"==typeof e&&t.type===h.BOOLEAN&&(r.isChecked=e),"object"==typeof e&&t.type===h.MULTIPLE_CHOICE&&(r.selectedIdList=e),r},Object.defineProperty(g.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,s=r.isChecked,a=r.value;void 0!==i&&h.MULTIPLE_CHOICE&&i.map((function(r){t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:r,value:null})})),e.attribute.type===h.BOOLEAN&&t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:null,value:s?s.toString():"false"}),void 0!==a&&(e.attribute.type!==h.TEXT&&e.attribute.type!==h.NUMERIC||t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:null,value:a.toString()}),e.attribute.type===h.CHOICE&&t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:a,value:null}),e.attribute.type!==h.DATETIME&&e.attribute.type!==h.DATE||t.push({customerAttributeId:e.attribute.id,customerAttributeOptionId:null,value:new Date(a).getTime().toString()}))})),t},enumerable:!1,configurable:!0}),g.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===h.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}))},g.prototype.validateAll=function(){var r;return t(this,void 0,void 0,(function(){var t,i,s;return e(this,(function(e){switch(e.label){case 0:return this.validateCustomerAttribute(),t=this.isSmsRegister?["email","password"]:void 0,[4,this.validator.validateAll(t)];case 1:return i=e.sent(),s=null===(r=this._customerAttributes)||void 0===r?void 0:r.some((function(t){return t.validator.hasError})),[2,i||s]}}))}))},g.prototype.register=function(){return t(this,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return this.isFormSubmit=!0,t={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(e.sent())return t.isFormError=!0,[2,t];e.label=2;case 2:return e.trys.push([2,4,,5]),[4,m.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=e.sent(),[2,i(i({},t),r)];case 4:return e.sent(),[2,t];case 5:return[2]}}))}))},g.prototype.smsRegister=function(){return t(this,void 0,void 0,(function(){var t,r,s;return e(this,(function(e){switch(e.label){case 0:return this.isFormSubmit=!0,t={isFormError:!1,isSuccess:!1,errorCodes:[]},[4,this.validateAll()];case 1:if(e.sent())return t.isFormError=!0,[2,t];r=this.model.phone||"",e.label=2;case 2:return e.trys.push([2,4,,5]),[4,m.getInstance().customerStore.smsRegister(this.model.firstName,this.model.lastName,r,this.model.isMarketingAccepted,this.model.attributes||this.formattedAttributesInput||void 0)];case 3:return s=e.sent(),[2,i(i({},t),{isSuccess:s})];case 4:return e.sent(),[2,t];case 5:return[2]}}))}))},g}();export{g as RegisterForm};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront",
|
|
3
|
-
"version": "6.1.0-beta.
|
|
3
|
+
"version": "6.1.0-beta.135",
|
|
4
4
|
"description": "Storefront functionality for ikas storefront themes.",
|
|
5
5
|
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"swiper": "11.0.6"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@ikas/storefront-api": "^6.1.0-beta.
|
|
25
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
26
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
27
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
28
|
-
"@ikas/storefront-providers": "^6.1.0-beta.
|
|
24
|
+
"@ikas/storefront-api": "^6.1.0-beta.135",
|
|
25
|
+
"@ikas/storefront-config": "^6.1.0-beta.135",
|
|
26
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.135",
|
|
27
|
+
"@ikas/storefront-models": "^6.1.0-beta.135",
|
|
28
|
+
"@ikas/storefront-providers": "^6.1.0-beta.135",
|
|
29
29
|
"@ikas/localized-address": "1.0.0-beta.6",
|
|
30
30
|
"@adyen/adyen-web": "^5.57.0",
|
|
31
31
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"@ikas/localized-address": "1.0.0-beta.6",
|
|
63
|
-
"@ikas/storefront-api": "^6.1.0-beta.
|
|
64
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
65
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
66
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
67
|
-
"@ikas/storefront-providers": "^6.1.0-beta.
|
|
63
|
+
"@ikas/storefront-api": "^6.1.0-beta.135",
|
|
64
|
+
"@ikas/storefront-config": "^6.1.0-beta.135",
|
|
65
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.135",
|
|
66
|
+
"@ikas/storefront-models": "^6.1.0-beta.135",
|
|
67
|
+
"@ikas/storefront-providers": "^6.1.0-beta.135",
|
|
68
68
|
"mobx": "^6.1.3",
|
|
69
69
|
"mobx-react-lite": "^3.1.5",
|
|
70
70
|
"next": "12.2.0",
|