@ikas/storefront 2.0.30 → 2.0.32
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/_virtual/index.js_commonjs-proxy3.js +1 -1
- package/build/_virtual/index.js_commonjs-proxy4.js +1 -1
- package/build/api/contact-form/__generated__/sendContactFormToMerchant.d.ts +1 -0
- package/build/api/contact-form/index.d.ts +2 -1
- package/build/api/contact-form/index.js +1 -1
- package/build/ikas.js +1 -1
- package/build/models/ui/validator/form/contact-form.js +1 -1
- package/build/scripts/generators/types/index.js +1 -1
- package/build/store/base.js +1 -1
- package/build/store/customer.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as
|
|
1
|
+
import{__awaiter as e,__generator as r}from'../../../../ext/tslib/tslib.es6.js';import{makeObservable as t,computed as s,observable as a,action as i}from"mobx";import{Validator as o}from"../index.js";import{RequiredRule as n,EmailRule as l}from"../rules/index.js";var m=function(){function m(e){var r=this;this.model={firstName:"",lastName:"",email:"",message:""},this.onFirstNameChange=function(e){r.firstName=e},this.onLastNameChange=function(e){r.lastName=e},this.onEmailChange=function(e){r.email=e},this.onMessageChange=function(e){r.message=e},t(this,{emailErrorMessage:s,messageErrorMessage:s,firstNameErrorMessage:s,lastNameErrorMessage:s,hasError:s,redirect:s,model:a,validateAll:i,saveContactForm:i}),this.store=e.store,this.validator=new o(this.model,[new n({fieldKey:"firstName",valuePath:"firstName",message:e.message.requiredRule}),new n({fieldKey:"lastName",valuePath:"lastName",message:e.message.requiredRule}),new n({fieldKey:"email",valuePath:"email",message:e.message.requiredRule}),new n({fieldKey:"message",valuePath:"message",message:e.message.requiredRule}),new l({fieldKey:"email",valuePath:"email",message:e.message.emailRule})])}return Object.defineProperty(m.prototype,"firstName",{get:function(){return this.model.firstName},set:function(e){this.model.firstName=e},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"lastName",{get:function(){return this.model.lastName},set:function(e){this.model.lastName=e},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,"message",{get:function(){return this.model.message},set:function(e){this.model.message=e},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"firstNameErrorMessage",{get:function(){return this.validator.results.firstName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"lastNameErrorMessage",{get:function(){return this.validator.results.lastName.errorMessage},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,"messageErrorMessage",{get:function(){return this.validator.results.message.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.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,this.store.customerStore.saveContactForm({firstName:this.model.firstName,lastName:this.model.lastName,email:this.model.email,message:this.model.message,referer:window.location.href})];case 3:return r.sent()&&(e.isSuccess=!0),[2,e];case 4:return r.sent(),[2,e];case 5:return[2]}}))}))},m}();export{m as ContactForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'../../../ext/tslib/tslib.es6.js';import a from"path";import{createFile as s,deleteDirContent as
|
|
1
|
+
import{__awaiter as e,__generator as t}from'../../../ext/tslib/tslib.es6.js';import a from"path";import{createFile as s,deleteDirContent as r}from"../../../utils/fs.js";import"../../../models/data/blog/index.js";import"../../../models/data/brand/index.js";import"../../../models/data/category/index.js";import"../../../models/data/checkout/index.js";import"../../../models/data/customer/address/index.js";import"../../../models/data/customer/index.js";import"../../../models/data/customer-review/index.js";import"../../../models/data/html-meta-data/index.js";import"../../../models/data/image/index.js";import"../../../models/data/installment-info/index.js";import"../../../models/data/order/index.js";import"../../../models/data/order/line-item/index.js";import"mobx";import"../../../api/product-option-file/index.js";import"../../../models/data/product/index.js";import"../../../models/data/variant-type/index.js";import"../../../models/data/product/variant/index.js";import"../../../models/data/product/variant/price/index.js";import"../../../models/data/product-attribute/index.js";import"../../../models/data/product/attribute-value/index.js";import"../../../models/data/product-filter/index.js";import"../../../models/data/variant-type/variant-value/index.js";import"../../../models/data/order-transaction/index.js";import"../../../models/data/product-option-set/index.js";import"../../../models/data/raffle/index.js";import"../../../models/data/product-campaing/campaign/index.js";import"../../../models/theme/theme.js";import"../../../models/theme/page/index.js";import{IkasThemeComponentPropType as o}from"../../../models/theme/component/prop/index.js";import"../../../models/theme/page/component/prop-value/link.js";import"../../../models/ui/brand-list/index.js";import"../../../models/ui/blog-list/index.js";import"../../../models/ui/blog-category-list/index.js";import"../../../models/ui/category-list/index.js";import"../../../models/ui/product-detail/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/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/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"../../../models/theme/settings/index.js";import"../../../models/theme/custom-data/index.js";import i from'../../../ext/lodash/uniq.js';var n=function(){function n(){}return n.generate=function(o){return e(this,void 0,void 0,(function(){var e,m,c,d,u,l,k;return t(this,(function(t){switch(t.label){case 0:return[4,r(a.join(process.cwd(),"src","components","__generated__","types"))];case 1:t.sent(),e={content:"",imports:[],internalCustomDatas:[]},t.label=2;case 2:t.trys.push([2,5,,6]),o.customData.forEach((function(t){n.generateAllCustomDataTypes(t,e,o)})),m=0,c=0;do{m=e.internalCustomDatas.length,e.internalCustomDatas.forEach((function(t){n.generateAllCustomDataTypes(t,e,o)})),(c=e.internalCustomDatas.length)!==m&&(e.internalCustomDatas=e.internalCustomDatas.splice(m,c))}while(m!==c);return[4,p.generate(o,e)];case 3:return t.sent(),d=a.join(process.cwd(),"src","components","__generated__"),e.imports=i(e.imports),u="import {\r\n",e.imports.forEach((function(e){u+="\t".concat(e,",\r\n")})),l=(u+='} from "@ikas/storefront"\r\n\r\n')+e.content,[4,s(d,"types.ts",l)];case 4:return[2,t.sent()];case 5:return k=t.sent(),console.log(k),[2,!1];case 6:return[2]}}))}))},n.generateAllCustomDataTypes=function(e,t,a){var s=e.type===o.ENUM,r="export ".concat(s?"enum":"type"," ").concat(n.generateTypeName(e)).concat(s?"":" = ","{ \r\n"),i="};\r\n\r\n";e.type!==o.DYNAMIC_LIST&&e.type!==o.STATIC_LIST||!e.nestedData?e.type===o.ENUM&&e.enumOptions?(t.content+=r,e.enumOptions.forEach((function(e){var a=e.value;e.value&&!isNaN(parseInt(e.value))&&(a="_"+e.value),t.content+='\t"'.concat(a,'" = "').concat(null==e?void 0:e.value,'",'),t.content+="\r\n"})),t.content+=i):(t.content+=r,e.nestedData&&e.nestedData.forEach((function(e){n.genenateCustomDataType(e,t,a),t.content+="\r\n"})),t.content+=i):n.generateAllCustomDataTypes(e.nestedData[0],t,a)},n.genenateCustomDataType=function(e,t,a){var s=n.getType(e,t,a);e.key&&e.key[0].match(/^\d/)&&(e.key="_"+e.key),t.content+="\t".concat(e.key).concat(e.isRequired?"":"?",": ").concat(s).concat([o.DYNAMIC_LIST,o.STATIC_LIST].includes(e.type)?"[]":"").concat(e.type===o.ENUM?",":";")},n.getType=function(e,t,a){var s="";switch(e.type){case o.TEXT:case o.RICH_TEXT:case o.COLOR:s="string";break;case o.BOOLEAN:s="boolean";break;case o.IMAGE:s="IkasImage",t.imports.push(s);break;case o.IMAGE_LIST:s="IkasImage[]",t.imports.push("IkasImage");break;case o.LINK:s="IkasNavigationLink",t.imports.push(s);break;case o.LIST_OF_LINK:s="IkasNavigationLink[]",t.imports.push("IkasNavigationLink");break;case o.PRODUCT_DETAIL:s="IkasProductDetail",t.imports.push(s);break;case o.PRODUCT_LIST:s="IkasProductList",t.imports.push("IkasProductList");break;case o.PRODUCT_ATTRIBUTE:s="IkasProductAttribute",t.imports.push(s);break;case o.PRODUCT_ATTRIBUTE_LIST:s="IkasProductAttribute[]",t.imports.push("IkasProductAttribute");break;case o.BRAND:s="IkasBrand",t.imports.push(s);break;case o.BRAND_LIST:s="IkasBrandList",t.imports.push(s);break;case o.CATEGORY:s="IkasCategory",t.imports.push(s);break;case o.CATEGORY_LIST:s="IkasCategoryList",t.imports.push(s);break;case o.CUSTOM:var r=a.customData.find((function(t){return t.id===e.customDataId}));r&&(s=n.generateTypeName(r));break;case o.COMPONENT:s="IkasComponentRenderer",t.imports.push(s);break;case o.COMPONENT_LIST:s="IkasComponentRenderer[]",t.imports.push("IkasComponentRenderer");break;case o.BLOG:s="IkasBlog",t.imports.push(s);break;case o.BLOG_LIST:s="IkasBlogList",t.imports.push(s);break;case o.BLOG_CATEGORY:s="IkasBlogCategory",t.imports.push(s);break;case o.BLOG_CATEGORY_LIST:s="IkasBlogCategoryList",t.imports.push(s);break;case o.RAFFLE:s="IkasRaffle",t.imports.push(s);break;case o.RAFFLE_LIST:s="IkasRaffleList",t.imports.push(s);break;case o.SLIDER:s="IkasSlider",t.imports.push(s);break;case o.ENUM:s=n.generateTypeName(e),t.content.includes("export enum ".concat(s))||t.internalCustomDatas.push(e);break;case o.OBJECT:s=n.generateTypeName(e);break;case o.DYNAMIC_LIST:case o.STATIC_LIST:e.nestedData&&(e.nestedData[0].type===o.OBJECT||e.nestedData[0].type===o.ENUM?(s=n.generateTypeName(e.nestedData[0]),t.content.includes("export type ".concat(s))||t.internalCustomDatas.push(e.nestedData[0])):s=n.getType(e.nestedData[0],t,a))}return s},n.generateTypeName=function(e){if(e.typescriptName)return e.typescriptName;var t=e.name||"";return(t=(t=t.replace(/\s/g,"")).replace(/\W/g,""))[0].match(/^\d/)&&(t="_"+t),e.type===o.ENUM&&(t+="Enum"),t},n}(),p=function(){function a(){}return a.generate=function(s,r){return e(this,void 0,void 0,(function(){return t(this,(function(e){return s.components.forEach((function(e){e.props.length>0&&"checkout"!==e.id&&(r.content+="export type ".concat(a.generatePropTypeName(e),"Props = {\n"),e.props.forEach((function(e){r.content+="\t".concat(e.name,": ").concat(a.getType(e,s,r),";\n")})),r.content+="};\r\n\r\n")})),[2]}))}))},a.getType=function(e,t,a){var s="";switch(e.type){case o.TEXT:case o.RICH_TEXT:case o.COLOR:s="string";break;case o.BOOLEAN:s="boolean";break;case o.IMAGE:s="IkasImage",a.imports.push(s);break;case o.IMAGE_LIST:s="IkasImage[]",a.imports.push("IkasImage");break;case o.LINK:s="IkasNavigationLink",a.imports.push(s);break;case o.LIST_OF_LINK:s="IkasNavigationLink[]",a.imports.push("IkasNavigationLink");break;case o.PRODUCT_DETAIL:s="IkasProductDetail",a.imports.push(s);break;case o.PRODUCT_LIST:s="IkasProductList",a.imports.push("IkasProductList");break;case o.PRODUCT_ATTRIBUTE:s="IkasProductAttribute",a.imports.push(s);break;case o.PRODUCT_ATTRIBUTE_LIST:s="IkasProductAttribute[]",a.imports.push("IkasProductAttribute");break;case o.BRAND:s="IkasBrand",a.imports.push(s);break;case o.BRAND_LIST:s="IkasBrandList",a.imports.push(s);break;case o.CATEGORY:s="IkasCategory",a.imports.push(s);break;case o.CATEGORY_LIST:s="IkasCategoryList",a.imports.push(s);break;case o.CUSTOM:var r=t.customData.find((function(t){return t.id===e.customDataId}));r&&(s=n.getType(r,a,t),r.type!==o.DYNAMIC_LIST&&r.type!==o.STATIC_LIST||(s+="[]"));break;case o.COMPONENT:s="IkasComponentRenderer",a.imports.push(s);break;case o.COMPONENT_LIST:s="IkasComponentRenderer[]",a.imports.push("IkasComponentRenderer");break;case o.BLOG:s="IkasBlog",a.imports.push(s);break;case o.BLOG_LIST:s="IkasBlogList",a.imports.push(s);break;case o.BLOG_CATEGORY:s="IkasBlogCategory",a.imports.push(s);break;case o.BLOG_CATEGORY_LIST:s="IkasBlogCategoryList",a.imports.push(s);break;case o.RAFFLE:s="IkasRaffle",a.imports.push(s);break;case o.RAFFLE_LIST:s="IkasRaffleList",a.imports.push(s);break;case o.SLIDER:s="IkasSlider",a.imports.push(s)}return s},a.generatePropTypeName=function(e){if(""!==e.displayName){var t=(e.dir||"").split("-"),a="";return t.forEach((function(e,t){return a+=e.charAt(0).toUpperCase()+e.slice(1)})),a[0].match(/^\d/)&&(a="_"+a),a}},a}();export{n as CustomDataTypesGenerator,p as PropTypeGenarator};
|
package/build/store/base.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as o,__generator as
|
|
1
|
+
import{__awaiter as o,__generator as t}from'../ext/tslib/tslib.es6.js';import{configure as i,makeObservable as e,observable as r}from"mobx";import s from'../ext/lodash/sortBy.js';import d from'../ext/lodash/flatten.js';import{IkasCartStore as n}from"./cart.js";import{IkasCustomerStore as a}from"./customer.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/index.js";import"../models/data/customer-review/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/installment-info/index.js";import"../models/data/order/index.js";import"../models/data/order/line-item/index.js";import"../api/product-option-file/index.js";import"../models/data/product/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/variant/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product-attribute/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product-filter/index.js";import"../models/data/variant-type/variant-value/index.js";import"../models/data/order-transaction/index.js";import"../models/data/product-option-set/index.js";import"../models/data/raffle/index.js";import"../models/data/product-campaing/campaign/index.js";import"../models/theme/theme.js";import"../models/theme/page/index.js";import"../models/theme/component/prop/index.js";import"../models/theme/page/component/prop-value/link.js";import"../models/ui/brand-list/index.js";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-detail/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/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/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{IkasThemeSettings as m}from"../models/theme/settings/index.js";import"../models/theme/custom-data/index.js";import"../api/blog/index.js";import"../api/brand/index.js";import"../api/cart/index.js";import"../api/category/index.js";import"../api/checkout/index.js";import"../api/city/index.js";import{IkasCountryAPI as p}from"../api/country/index.js";import"../api/customer/index.js";import"../api/customer-review/index.js";import"../api/district/index.js";import"../api/html-meta-data/index.js";import"../api/merchant/index.js";import"../api/product-search/index.js";import"../api/apollo.js";import"../api/favorite-product/index.js";import"../api/contact-form/index.js";import"../api/state/index.js";import"../api/product-option-set/index.js";import"../api/raffle/index.js";import"../api/back-in-stock-reminder/index.js";import"../api/product-campaign/index.js";import{IkasStorefrontConfig as l}from"../storefront/index.js";import u from'../ext/uuid/dist/esm-browser/v4.js';i({enforceActions:"never"});var c=function(){function i(){this.currentPageType=null,this.localeOptions=[],this.showLocaleOptions=!1,this.currentCountryCode=null,this.localeChecked=!1,this.settingsSet=!1,this.customerStore=new a(this),this.cartStore=new n(this),e(this,{currentPageType:r,localeOptions:r,showLocaleOptions:r,currentCountryCode:r})}return i.prototype.checkLocalization=function(){return o(this,void 0,void 0,(function(){var o,i,e,r,n,a,m,c;return t(this,(function(t){switch(t.label){case 0:return this.localeChecked?[2]:void 0===typeof window?(console.warn("checkLocalization should be called on the client side!"),[2]):[4,p.getMyCountry()];case 1:return o=t.sent(),i=l.routings.find((function(o){return o.id===l.storefrontRoutingId})),this.currentCountryCode=o,i&&o?(e=!0,r=l.routings.find((function(t){var i;return null===(i=t.countryCodes)||void 0===i?void 0:i.includes(o)})),n=l.routings.find((function(o){var t;return!(null===(t=o.countryCodes)||void 0===t?void 0:t.length)})),r?i.id!==r.id&&(e=!1):n&&i.id!==n.id&&(e=!1),a=d(l.routings.map((function(o){return o.countryCodes||[]}))),[4,p.listCountries(a)]):[3,3];case 2:m=t.sent(),c=[],l.routings.map((function(t){var i;(null===(i=t.countryCodes)||void 0===i?void 0:i.length)?t.countryCodes.forEach((function(i){var e=m.find((function(o){return o.iso2===i}));c.push({id:u(),countryName:(null==e?void 0:e.native)||(null==e?void 0:e.name)||"",iso2:null==e?void 0:e.iso2,iso3:null==e?void 0:e.iso3,routing:t,isRecommended:i===o})})):c.push({id:u(),routing:t,isRecommended:!l.routings.some((function(t){var i;return null===(i=t.countryCodes)||void 0===i?void 0:i.includes(o)}))})})),this.localeOptions=s(c,"countryName"),e||(this.showLocaleOptions=!0),this.localeChecked=!0,t.label=3;case 3:return[2]}}))}))},i.prototype.setLocalization=function(o){o.routing.domain?window.location.replace("https://"+o.routing.domain):window.location.replace(window.location.origin+(o.routing.path?"/"+o.routing.path:""))},i.prototype.setSettings=function(o){this.settingsSet||new m(JSON.parse(o)).colors.map((function(o){return document.documentElement.style.setProperty(o.key,o.color)}))},i}();export{c as IkasBaseStore};
|
|
@@ -35,7 +35,7 @@ export declare class IkasCustomerStore {
|
|
|
35
35
|
*/
|
|
36
36
|
socialLoginToken(token: string): Promise<boolean>;
|
|
37
37
|
register: (firstName: string, lastName: string, email: string, password: string, isMarketingAccepted?: boolean | undefined) => Promise<boolean>;
|
|
38
|
-
saveContactForm: (input: IkasContactForm) => Promise<boolean
|
|
38
|
+
saveContactForm: (input: IkasContactForm) => Promise<boolean>;
|
|
39
39
|
checkEmail: (email: string) => Promise<boolean>;
|
|
40
40
|
forgotPassword: (email: string) => Promise<boolean>;
|
|
41
41
|
recoverPassword: (password: string, passwordAgain: string, token: string) => Promise<boolean>;
|
|
@@ -83,6 +83,7 @@ export declare type IkasContactForm = {
|
|
|
83
83
|
lastName: string;
|
|
84
84
|
email: string;
|
|
85
85
|
message: string;
|
|
86
|
+
referer: string;
|
|
86
87
|
};
|
|
87
88
|
export declare type IkasCustomerReviewForm = {
|
|
88
89
|
comment?: string;
|