@ikas/storefront 2.0.0-alpha.24 → 2.0.0-alpha.25

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.
@@ -7,9 +7,9 @@ declare type File = {
7
7
  };
8
8
  export declare class CustomDataTypesGenerator {
9
9
  static generate(themeJson: IkasTheme): Promise<boolean>;
10
- static generateAllCustomDataTypes(customData: IkasThemeCustomData, file: File): void;
11
- static genenateCustomDataType(customData: IkasThemeCustomData, file: File): void;
12
- static getType(customData: IkasThemeCustomData, file: File): string;
10
+ static generateAllCustomDataTypes(customData: IkasThemeCustomData, file: File, themeJson: IkasTheme): void;
11
+ static genenateCustomDataType(customData: IkasThemeCustomData, file: File, themeJson: IkasTheme): void;
12
+ static getType(customData: IkasThemeCustomData, file: File, themeJson: IkasTheme): string;
13
13
  static generateTypeName(customData: IkasThemeCustomData): string;
14
14
  }
15
15
  export {};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from'../../../ext/tslib/tslib.es6.js';import a from"path";import{createFile as o,deleteDirContent as s}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"../../../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/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,p,c;return t(this,(function(t){switch(t.label){case 0:return[4,s(a.join(process.cwd(),"src","components","__generated__","types"))];case 1:t.sent(),e={content:"",imports:[],internalCustomDatas:[]},t.label=2;case 2:return t.trys.push([2,4,,5]),r.customData.forEach((function(t){n.generateAllCustomDataTypes(t,e)})),e.internalCustomDatas.forEach((function(t){n.generateAllCustomDataTypes(t,e)})),m=a.join(process.cwd(),"src","components","__generated__"),e.imports=i(e.imports),d="import {\r\n",e.imports.forEach((function(e){d+="\t".concat(e,",\r\n")})),p=(d+='} from "@ikas/storefront"\r\n\r\n')+e.content,[4,o(m,"types.ts",p)];case 3:return[2,t.sent()];case 4:return c=t.sent(),console.log(c),[2,!1];case 5:return[2]}}))}))},n.generateAllCustomDataTypes=function(e,t){var a=e.type===r.ENUM,o="export ".concat(a?"enum":"type"," ").concat(n.generateTypeName(e)).concat(a?"":" = ","{ \r\n"),s="};\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){e.value&&e.value[0].match(/^\d/)&&(e.value="_"+e.value),t.content+='\t"'.concat(null==e?void 0:e.value,'" = "').concat(null==e?void 0:e.displayName,'",'),t.content+="\r\n"})),t.content+=s):(t.content+=o,e.nestedData&&e.nestedData.forEach((function(e){n.genenateCustomDataType(e,t),t.content+="\r\n"})),t.content+=s):n.generateAllCustomDataTypes(e.nestedData[0],t)},n.genenateCustomDataType=function(e,t){var a=n.getType(e,t);e.key&&e.key[0].match(/^\d/)&&(e.key="_"+e.key),t.content+="\t".concat(e.key).concat(e.isRequired?"":"?",": ").concat(a).concat([r.DYNAMIC_LIST,r.STATIC_LIST].includes(e.type)?"[]":"").concat(e.type===r.ENUM?",":";")},n.getType=function(e,t){var a="";switch(e.type){case r.TEXT:case r.RICH_TEXT:case r.COLOR:a="string";break;case r.BOOLEAN:a="boolean";break;case r.IMAGE:a="IkasImage",t.imports.push(a);break;case r.IMAGE_LIST:a="IkasImageList",t.imports.push(a);break;case r.LINK:a="IkasNavigationLink",t.imports.push(a);break;case r.LIST_OF_LINK:a="IkasNavigationLink[]",t.imports.push("IkasNavigationLink");break;case r.PRODUCT_DETAIL:a="IkasProductDetail",t.imports.push(a);break;case r.PRODUCT_LIST:a="IkasProductDetail[]",t.imports.push("IkasProductDetail");break;case r.PRODUCT_ATTRIBUTE:a="IkasProductAttribute",t.imports.push(a);break;case r.PRODUCT_ATTRIBUTE_LIST:a="IkasProductAttribute[]",t.imports.push("IkasProductAttribute");break;case r.BRAND:a="IkasBrand",t.imports.push(a);break;case r.BRAND_LIST:a="IkasBrandList",t.imports.push(a);break;case r.CATEGORY:a="IkasCategory",t.imports.push(a);break;case r.CATEGORY_LIST:a="IkasCategoryList",t.imports.push(a);break;case r.COMPONENT:a="IkasComponentRenderer";break;case r.COMPONENT_LIST:a="IkasComponentRenderer[]";break;case r.BLOG:a="IkasBlog",t.imports.push(a);break;case r.BLOG_LIST:a="IkasBlogList",t.imports.push(a);break;case r.BLOG_CATEGORY:a="IkasBlogCategory",t.imports.push(a);break;case r.BLOG_CATEGORY_LIST:a="IkasBlogCategoryList",t.imports.push(a);break;case r.RAFFLE:a="IkasRaffle",t.imports.push(a);break;case r.RAFFLE_LIST:a="IkasRaffleList",t.imports.push(a);break;case r.ENUM:a=n.generateTypeName(e),t.content.includes("export enum ".concat(a))||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?(a=n.generateTypeName(e.nestedData[0]),t.content.includes("export type ".concat(a))||t.internalCustomDatas.push(e)):a=n.getType(e.nestedData[0],t))}return a},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}();export{n as CustomDataTypesGenerator};
1
+ import{__awaiter as e,__generator as t}from'../../../ext/tslib/tslib.es6.js';import a from"path";import{createFile as o,deleteDirContent as s}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"../../../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/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,p,c;return t(this,(function(t){switch(t.label){case 0:return[4,s(a.join(process.cwd(),"src","components","__generated__","types"))];case 1:t.sent(),e={content:"",imports:[],internalCustomDatas:[]},t.label=2;case 2:return t.trys.push([2,4,,5]),r.customData.forEach((function(t){n.generateAllCustomDataTypes(t,e,r)})),e.internalCustomDatas.forEach((function(t){n.generateAllCustomDataTypes(t,e,r)})),m=a.join(process.cwd(),"src","components","__generated__"),e.imports=i(e.imports),d="import {\r\n",e.imports.forEach((function(e){d+="\t".concat(e,",\r\n")})),p=(d+='} from "@ikas/storefront"\r\n\r\n')+e.content,[4,o(m,"types.ts",p)];case 3:return[2,t.sent()];case 4:return c=t.sent(),console.log(c),[2,!1];case 5:return[2]}}))}))},n.generateAllCustomDataTypes=function(e,t,a){var o=e.type===r.ENUM,s="export ".concat(o?"enum":"type"," ").concat(n.generateTypeName(e)).concat(o?"":" = ","{ \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+=s,e.enumOptions.forEach((function(e){e.value&&e.value[0].match(/^\d/)&&(e.value="_"+e.value),t.content+='\t"'.concat(null==e?void 0:e.value,'" = "').concat(null==e?void 0:e.displayName,'",'),t.content+="\r\n"})),t.content+=i):(t.content+=s,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 o=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(o).concat([r.DYNAMIC_LIST,r.STATIC_LIST].includes(e.type)?"[]":"").concat(e.type===r.ENUM?",":";")},n.getType=function(e,t,a){var o="";switch(e.type){case r.TEXT:case r.RICH_TEXT:case r.COLOR:o="string";break;case r.BOOLEAN:o="boolean";break;case r.IMAGE:o="IkasImage",t.imports.push(o);break;case r.IMAGE_LIST:o="IkasImageList",t.imports.push(o);break;case r.LINK:o="IkasNavigationLink",t.imports.push(o);break;case r.LIST_OF_LINK:o="IkasNavigationLink[]",t.imports.push("IkasNavigationLink");break;case r.PRODUCT_DETAIL:o="IkasProductDetail",t.imports.push(o);break;case r.PRODUCT_LIST:o="IkasProductDetail[]",t.imports.push("IkasProductDetail");break;case r.PRODUCT_ATTRIBUTE:o="IkasProductAttribute",t.imports.push(o);break;case r.PRODUCT_ATTRIBUTE_LIST:o="IkasProductAttribute[]",t.imports.push("IkasProductAttribute");break;case r.BRAND:o="IkasBrand",t.imports.push(o);break;case r.BRAND_LIST:o="IkasBrandList",t.imports.push(o);break;case r.CATEGORY:o="IkasCategory",t.imports.push(o);break;case r.CATEGORY_LIST:o="IkasCategoryList",t.imports.push(o);break;case r.CUSTOM:var s=a.customData.find((function(t){return t.id===e.customDataId}));s&&(o=n.generateTypeName(s));break;case r.COMPONENT:o="IkasComponentRenderer",t.imports.push(o);break;case r.COMPONENT_LIST:o="IkasComponentRenderer[]",t.imports.push("IkasComponentRenderer");break;case r.BLOG:o="IkasBlog",t.imports.push(o);break;case r.BLOG_LIST:o="IkasBlogList",t.imports.push(o);break;case r.BLOG_CATEGORY:o="IkasBlogCategory",t.imports.push(o);break;case r.BLOG_CATEGORY_LIST:o="IkasBlogCategoryList",t.imports.push(o);break;case r.RAFFLE:o="IkasRaffle",t.imports.push(o);break;case r.RAFFLE_LIST:o="IkasRaffleList",t.imports.push(o);break;case r.ENUM:o=n.generateTypeName(e),t.content.includes("export enum ".concat(o))||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?(o=n.generateTypeName(e.nestedData[0]),t.content.includes("export type ".concat(o))||t.internalCustomDatas.push(e)):o=n.getType(e.nestedData[0],t,a))}return o},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}();export{n as CustomDataTypesGenerator};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "2.0.0-alpha.24",
3
+ "version": "2.0.0-alpha.25",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.js",
6
6
  "author": "Umut Ozan Yıldırım",