@ikas/storefront 2.0.26 → 2.0.27

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 e,__generator as t}from'../../../ext/tslib/tslib.es6.js';import a from"path";import{createFile as s,deleteDirContent as o}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 r}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(r){return e(this,void 0,void 0,(function(){var e,m,d,c,u,l,k;return t(this,(function(t){switch(t.label){case 0:return[4,o(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]),r.customData.forEach((function(t){n.generateAllCustomDataTypes(t,e,r)})),m=0,d=0;do{m=e.internalCustomDatas.length,e.internalCustomDatas.forEach((function(t){n.generateAllCustomDataTypes(t,e,r)})),(d=e.internalCustomDatas.length)!==m&&(e.internalCustomDatas=e.internalCustomDatas.splice(m,d))}while(m!==d);return[4,p.generate(r,e)];case 3:return t.sent(),c=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(c,"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===r.ENUM,o="export ".concat(s?"enum":"type"," ").concat(n.generateTypeName(e)).concat(s?"":" = ","{ \r\n"),i="};\r\n\r\n";e.type!==r.DYNAMIC_LIST&&e.type!==r.STATIC_LIST||!e.nestedData?e.type===r.ENUM&&e.enumOptions?(t.content+=o,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+=o,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([r.DYNAMIC_LIST,r.STATIC_LIST].includes(e.type)?"[]":"").concat(e.type===r.ENUM?",":";")},n.getType=function(e,t,a){var s="";switch(e.type){case r.TEXT:case r.RICH_TEXT:case r.COLOR:s="string";break;case r.BOOLEAN:s="boolean";break;case r.IMAGE:s="IkasImage",t.imports.push(s);break;case r.IMAGE_LIST:s="IkasImage[]",t.imports.push("IkasImage");break;case r.LINK:s="IkasNavigationLink",t.imports.push(s);break;case r.LIST_OF_LINK:s="IkasNavigationLink[]",t.imports.push("IkasNavigationLink");break;case r.PRODUCT_DETAIL:s="IkasProductDetail",t.imports.push(s);break;case r.PRODUCT_LIST:s="IkasProductList",t.imports.push("IkasProductList");break;case r.PRODUCT_ATTRIBUTE:s="IkasProductAttribute",t.imports.push(s);break;case r.PRODUCT_ATTRIBUTE_LIST:s="IkasProductAttribute[]",t.imports.push("IkasProductAttribute");break;case r.BRAND:s="IkasBrand",t.imports.push(s);break;case r.BRAND_LIST:s="IkasBrandList",t.imports.push(s);break;case r.CATEGORY:s="IkasCategory",t.imports.push(s);break;case r.CATEGORY_LIST:s="IkasCategoryList",t.imports.push(s);break;case r.CUSTOM:var o=a.customData.find((function(t){return t.id===e.customDataId}));o&&(s=n.generateTypeName(o));break;case r.COMPONENT:s="IkasComponentRenderer",t.imports.push(s);break;case r.COMPONENT_LIST:s="IkasComponentRenderer[]",t.imports.push("IkasComponentRenderer");break;case r.BLOG:s="IkasBlog",t.imports.push(s);break;case r.BLOG_LIST:s="IkasBlogList",t.imports.push(s);break;case r.BLOG_CATEGORY:s="IkasBlogCategory",t.imports.push(s);break;case r.BLOG_CATEGORY_LIST:s="IkasBlogCategoryList",t.imports.push(s);break;case r.RAFFLE:s="IkasRaffle",t.imports.push(s);break;case r.RAFFLE_LIST:s="IkasRaffleList",t.imports.push(s);break;case r.ENUM:s=n.generateTypeName(e),t.content.includes("export enum ".concat(s))||t.internalCustomDatas.push(e);break;case r.DYNAMIC_LIST:case r.STATIC_LIST:e.nestedData&&(e.nestedData[0].type===r.OBJECT||e.nestedData[0].type===r.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===r.ENUM&&(t+="Enum"),t},n}(),p=function(){function a(){}return a.generate=function(s,o){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&&(o.content+="export type ".concat(a.generatePropTypeName(e),"Props = {\n"),e.props.forEach((function(e){o.content+="\t".concat(e.name,": ").concat(a.getType(e,s,o),";\n")})),o.content+="};\r\n\r\n")})),[2]}))}))},a.getType=function(e,t,a){var s="";switch(e.type){case r.TEXT:case r.RICH_TEXT:case r.COLOR:s="string";break;case r.BOOLEAN:s="boolean";break;case r.IMAGE:s="IkasImage",a.imports.push(s);break;case r.IMAGE_LIST:s="IkasImage[]",a.imports.push("IkasImage");break;case r.LINK:s="IkasNavigationLink",a.imports.push(s);break;case r.LIST_OF_LINK:s="IkasNavigationLink[]",a.imports.push("IkasNavigationLink");break;case r.PRODUCT_DETAIL:s="IkasProductDetail",a.imports.push(s);break;case r.PRODUCT_LIST:s="IkasProductList",a.imports.push("IkasProductList");break;case r.PRODUCT_ATTRIBUTE:s="IkasProductAttribute",a.imports.push(s);break;case r.PRODUCT_ATTRIBUTE_LIST:s="IkasProductAttribute[]",a.imports.push("IkasProductAttribute");break;case r.BRAND:s="IkasBrand",a.imports.push(s);break;case r.BRAND_LIST:s="IkasBrandList",a.imports.push(s);break;case r.CATEGORY:s="IkasCategory",a.imports.push(s);break;case r.CATEGORY_LIST:s="IkasCategoryList",a.imports.push(s);break;case r.CUSTOM:var o=t.customData.find((function(t){return t.id===e.customDataId}));(null==o?void 0:o.nestedData)&&(o.nestedData[0].type===r.OBJECT||o.nestedData[0].type===r.ENUM?(s=n.generateTypeName(o.nestedData[0]),o.type!==r.DYNAMIC_LIST&&o.type!==r.STATIC_LIST||(s+="[]")):s=n.getType(o.nestedData[0],a,t));break;case r.COMPONENT:s="IkasComponentRenderer",a.imports.push(s);break;case r.COMPONENT_LIST:s="IkasComponentRenderer[]",a.imports.push("IkasComponentRenderer");break;case r.BLOG:s="IkasBlog",a.imports.push(s);break;case r.BLOG_LIST:s="IkasBlogList",a.imports.push(s);break;case r.BLOG_CATEGORY:s="IkasBlogCategory",a.imports.push(s);break;case r.BLOG_CATEGORY_LIST:s="IkasBlogCategoryList",a.imports.push(s);break;case r.RAFFLE:s="IkasRaffle",a.imports.push(s);break;case r.RAFFLE_LIST:s="IkasRaffleList",a.imports.push(s);break;case r.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){return a+=e.charAt(0).toUpperCase()+e.slice(1)})),a}},a}();export{n as CustomDataTypesGenerator,p as PropTypeGenarator};
1
+ import{__awaiter as e,__generator as t}from'../../../ext/tslib/tslib.es6.js';import a from"path";import{createFile as s,deleteDirContent as o}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 r}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(r){return e(this,void 0,void 0,(function(){var e,p,m,d,c,u,l;return t(this,(function(t){switch(t.label){case 0:return[4,o(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,4,,5]),r.customData.forEach((function(t){n.generateAllCustomDataTypes(t,e,r)})),p=0,m=0;do{p=e.internalCustomDatas.length,e.internalCustomDatas.forEach((function(t){n.generateAllCustomDataTypes(t,e,r)})),(m=e.internalCustomDatas.length)!==p&&(e.internalCustomDatas=e.internalCustomDatas.splice(p,m))}while(p!==m);return d=a.join(process.cwd(),"src","components","__generated__"),e.imports=i(e.imports),c="import {\r\n",e.imports.forEach((function(e){c+="\t".concat(e,",\r\n")})),u=(c+='} from "@ikas/storefront"\r\n\r\n')+e.content,[4,s(d,"types.ts",u)];case 3:return[2,t.sent()];case 4:return l=t.sent(),console.log(l),[2,!1];case 5:return[2]}}))}))},n.generateAllCustomDataTypes=function(e,t,a){var s=e.type===r.ENUM,o="export ".concat(s?"enum":"type"," ").concat(n.generateTypeName(e)).concat(s?"":" = ","{ \r\n"),i="};\r\n\r\n";e.type!==r.DYNAMIC_LIST&&e.type!==r.STATIC_LIST||!e.nestedData?e.type===r.ENUM&&e.enumOptions?(t.content+=o,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+=o,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([r.DYNAMIC_LIST,r.STATIC_LIST].includes(e.type)?"[]":"").concat(e.type===r.ENUM?",":";")},n.getType=function(e,t,a){var s="";switch(e.type){case r.TEXT:case r.RICH_TEXT:case r.COLOR:s="string";break;case r.BOOLEAN:s="boolean";break;case r.IMAGE:s="IkasImage",t.imports.push(s);break;case r.IMAGE_LIST:s="IkasImage[]",t.imports.push("IkasImage");break;case r.LINK:s="IkasNavigationLink",t.imports.push(s);break;case r.LIST_OF_LINK:s="IkasNavigationLink[]",t.imports.push("IkasNavigationLink");break;case r.PRODUCT_DETAIL:s="IkasProductDetail",t.imports.push(s);break;case r.PRODUCT_LIST:s="IkasProductList",t.imports.push("IkasProductList");break;case r.PRODUCT_ATTRIBUTE:s="IkasProductAttribute",t.imports.push(s);break;case r.PRODUCT_ATTRIBUTE_LIST:s="IkasProductAttribute[]",t.imports.push("IkasProductAttribute");break;case r.BRAND:s="IkasBrand",t.imports.push(s);break;case r.BRAND_LIST:s="IkasBrandList",t.imports.push(s);break;case r.CATEGORY:s="IkasCategory",t.imports.push(s);break;case r.CATEGORY_LIST:s="IkasCategoryList",t.imports.push(s);break;case r.CUSTOM:var o=a.customData.find((function(t){return t.id===e.customDataId}));o&&(s=n.generateTypeName(o));break;case r.COMPONENT:s="IkasComponentRenderer",t.imports.push(s);break;case r.COMPONENT_LIST:s="IkasComponentRenderer[]",t.imports.push("IkasComponentRenderer");break;case r.BLOG:s="IkasBlog",t.imports.push(s);break;case r.BLOG_LIST:s="IkasBlogList",t.imports.push(s);break;case r.BLOG_CATEGORY:s="IkasBlogCategory",t.imports.push(s);break;case r.BLOG_CATEGORY_LIST:s="IkasBlogCategoryList",t.imports.push(s);break;case r.RAFFLE:s="IkasRaffle",t.imports.push(s);break;case r.RAFFLE_LIST:s="IkasRaffleList",t.imports.push(s);break;case r.ENUM:s=n.generateTypeName(e),t.content.includes("export enum ".concat(s))||t.internalCustomDatas.push(e);break;case r.DYNAMIC_LIST:case r.STATIC_LIST:e.nestedData&&(e.nestedData[0].type===r.OBJECT||e.nestedData[0].type===r.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===r.ENUM&&(t+="Enum"),t},n}(),p=function(){function a(){}return a.generate=function(s,o){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&&(o.content+="export type ".concat(a.generatePropTypeName(e),"Props = {\n"),e.props.forEach((function(e){o.content+="\t".concat(e.name,": ").concat(a.getType(e,s,o),";\n")})),o.content+="};\r\n\r\n")})),[2]}))}))},a.getType=function(e,t,a){var s="";switch(e.type){case r.TEXT:case r.RICH_TEXT:case r.COLOR:s="string";break;case r.BOOLEAN:s="boolean";break;case r.IMAGE:s="IkasImage",a.imports.push(s);break;case r.IMAGE_LIST:s="IkasImage[]",a.imports.push("IkasImage");break;case r.LINK:s="IkasNavigationLink",a.imports.push(s);break;case r.LIST_OF_LINK:s="IkasNavigationLink[]",a.imports.push("IkasNavigationLink");break;case r.PRODUCT_DETAIL:s="IkasProductDetail",a.imports.push(s);break;case r.PRODUCT_LIST:s="IkasProductList",a.imports.push("IkasProductList");break;case r.PRODUCT_ATTRIBUTE:s="IkasProductAttribute",a.imports.push(s);break;case r.PRODUCT_ATTRIBUTE_LIST:s="IkasProductAttribute[]",a.imports.push("IkasProductAttribute");break;case r.BRAND:s="IkasBrand",a.imports.push(s);break;case r.BRAND_LIST:s="IkasBrandList",a.imports.push(s);break;case r.CATEGORY:s="IkasCategory",a.imports.push(s);break;case r.CATEGORY_LIST:s="IkasCategoryList",a.imports.push(s);break;case r.CUSTOM:var o=t.customData.find((function(t){return t.id===e.customDataId}));(null==o?void 0:o.nestedData)&&(o.nestedData[0].type===r.OBJECT||o.nestedData[0].type===r.ENUM?(s=n.generateTypeName(o.nestedData[0]),o.type!==r.DYNAMIC_LIST&&o.type!==r.STATIC_LIST||(s+="[]")):s=n.getType(o.nestedData[0],a,t));break;case r.COMPONENT:s="IkasComponentRenderer",a.imports.push(s);break;case r.COMPONENT_LIST:s="IkasComponentRenderer[]",a.imports.push("IkasComponentRenderer");break;case r.BLOG:s="IkasBlog",a.imports.push(s);break;case r.BLOG_LIST:s="IkasBlogList",a.imports.push(s);break;case r.BLOG_CATEGORY:s="IkasBlogCategory",a.imports.push(s);break;case r.BLOG_CATEGORY_LIST:s="IkasBlogCategoryList",a.imports.push(s);break;case r.RAFFLE:s="IkasRaffle",a.imports.push(s);break;case r.RAFFLE_LIST:s="IkasRaffleList",a.imports.push(s);break;case r.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){return a+=e.charAt(0).toUpperCase()+e.slice(1)})),a}},a}();export{n as CustomDataTypesGenerator,p as PropTypeGenarator};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "2.0.26",
3
+ "version": "2.0.27",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.js",
6
6
  "author": "Umut Ozan Yıldırım",