@ikas/storefront-next 6.1.0-beta.227 → 6.1.0-beta.229

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{IkasThemeJsonComponentPropType as a}from"@ikas/storefront-models";import s from"path";import{createFile as r,deleteDirContent as n}from"../../../utils/fs.js";import o from"lodash/uniq";var c=function(){function c(){}return c.generate=function(a,p){return e(this,void 0,void 0,(function(){var e,u,I,k,m,T,L;return t(this,(function(t){switch(t.label){case 0:return[4,n(s.join(p||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]),a.customData.forEach((function(t){c.generateAllCustomDataTypes(t,e,a)})),u=0,I=0;do{u=e.internalCustomDatas.length,e.internalCustomDatas.forEach((function(t){c.generateAllCustomDataTypes(t,e,a)})),(I=e.internalCustomDatas.length)!==u&&(e.internalCustomDatas=e.internalCustomDatas.splice(u,I))}while(u!==I);return[4,i.generate(a,e)];case 3:return t.sent(),k=s.join(p||process.cwd(),"src","components","__generated__"),e.imports=o(e.imports),m="import {\r\n",e.imports.forEach((function(e){m+="\t".concat(e,",\r\n")})),T=(m+='} from "@ikas/storefront"\r\n\r\n')+e.content,[4,r(k,"types.ts",T)];case 4:return[2,t.sent()];case 5:return L=t.sent(),console.log(L),[2,!1];case 6:return[2]}}))}))},c.generateAllCustomDataTypes=function(e,t,s){var r=e.type===a.ENUM,n="export ".concat(r?"enum":"type"," ").concat(c.generateTypeName(e)).concat(r?"":" = ","{ \r\n"),o="};\r\n\r\n";e.type!==a.DYNAMIC_LIST&&e.type!==a.STATIC_LIST||!e.nestedData?e.type===a.ENUM&&e.enumOptions?(t.content+=n,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+=o):(t.content+=n,e.nestedData&&e.nestedData.forEach((function(e){c.genenateCustomDataType(e,t,s),t.content+="\r\n"})),t.content+=o):c.generateAllCustomDataTypes(e.nestedData[0],t,s)},c.genenateCustomDataType=function(e,t,s){var r=c.getType(e,t,s);e.key&&e.key[0].match(/^\d/)&&(e.key="_"+e.key),t.content+="\t".concat(e.key).concat(e.isRequired?"":"?",": ").concat(r).concat([a.DYNAMIC_LIST,a.STATIC_LIST].includes(e.type)?"[]":"").concat(e.type===a.ENUM?",":";")},c.getType=function(e,t,s){var r="";switch(e.type){case a.TEXT:case a.RICH_TEXT:case a.COLOR:r="string";break;case a.BOOLEAN:r="boolean";break;case a.IMAGE:r="IkasImage",t.imports.push(r);break;case a.IMAGE_LIST:r="IkasImage[]",t.imports.push("IkasImage");break;case a.LINK:r="IkasNavigationLink",t.imports.push(r);break;case a.LIST_OF_LINK:r="IkasNavigationLink[]",t.imports.push("IkasNavigationLink");break;case a.PRODUCT_DETAIL:r="IkasProduct",t.imports.push(r);break;case a.PRODUCT_LIST:r="IkasProductList",t.imports.push("IkasProductList");break;case a.PRODUCT_ATTRIBUTE:r="IkasAttributeDetail",t.imports.push(r);break;case a.PRODUCT_ATTRIBUTE_LIST:r="IkasAttributeList",t.imports.push("IkasAttributeList");break;case a.BRAND:r="IkasBrand",t.imports.push(r);break;case a.BRAND_LIST:r="IkasBrandList",t.imports.push(r);break;case a.CATEGORY:r="IkasCategory",t.imports.push(r);break;case a.CATEGORY_LIST:r="IkasCategoryList",t.imports.push(r);break;case a.CUSTOM:var n=s.customData.find((function(t){return t.id===e.customDataId}));n&&(r=c.generateTypeName(n));break;case a.COMPONENT:r="IkasComponentRenderer",t.imports.push(r);break;case a.COMPONENT_LIST:r="IkasComponentRenderer[]",t.imports.push("IkasComponentRenderer");break;case a.BLOG:r="IkasBlog",t.imports.push(r);break;case a.BLOG_LIST:r="IkasBlogList",t.imports.push(r);break;case a.BLOG_CATEGORY:r="IkasBlogCategory",t.imports.push(r);break;case a.BLOG_CATEGORY_LIST:r="IkasBlogCategoryList",t.imports.push(r);break;case a.RAFFLE:r="IkasRaffle",t.imports.push(r);break;case a.RAFFLE_LIST:r="IkasRaffleList",t.imports.push(r);break;case a.SLIDER:r="IkasSlider",t.imports.push(r);break;case a.VIDEO:r="IkasVideo",t.imports.push(r);break;case a.ENUM:case a.OBJECT:r=c.generateTypeName(e),t.content.includes("export enum ".concat(r))||t.internalCustomDatas.push(e);break;case a.DYNAMIC_LIST:case a.STATIC_LIST:e.nestedData&&(e.nestedData[0].type===a.OBJECT||e.nestedData[0].type===a.ENUM?(r=c.generateTypeName(e.nestedData[0]),t.content.includes("export type ".concat(r))||t.internalCustomDatas.push(e.nestedData[0])):r=c.getType(e.nestedData[0],t,s))}return r},c.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===a.ENUM&&(t+="Enum"),t},c}(),i=function(){function s(){}return s.generate=function(a,r){return e(this,void 0,void 0,(function(){return t(this,(function(e){return a.components.forEach((function(e){e.props.length>0&&"checkout"!==e.id&&(r.content+="export type ".concat(s.generatePropTypeName(e),"Props = {\n"),e.props.forEach((function(e){r.content+="\t".concat(e.name).concat(e.isRequired?"":"?",": ").concat(s.getType(e,a,r),";\n")})),r.content+="};\r\n\r\n")})),[2]}))}))},s.getType=function(e,t,s){var r="";switch(e.type){case a.TEXT:case a.RICH_TEXT:case a.COLOR:r="string";break;case a.BOOLEAN:r="boolean";break;case a.IMAGE:r="IkasImage",s.imports.push(r);break;case a.IMAGE_LIST:r="IkasImage[]",s.imports.push("IkasImage");break;case a.LINK:r="IkasNavigationLink",s.imports.push(r);break;case a.LIST_OF_LINK:r="IkasNavigationLink[]",s.imports.push("IkasNavigationLink");break;case a.PRODUCT_DETAIL:r="IkasProduct",s.imports.push(r);break;case a.PRODUCT_LIST:r="IkasProductList",s.imports.push("IkasProductList");break;case a.PRODUCT_ATTRIBUTE:r="IkasAttributeDetail",s.imports.push(r);break;case a.PRODUCT_ATTRIBUTE_LIST:r="IkasAttributeList",s.imports.push("IkasAttributeList");break;case a.BRAND:r="IkasBrand",s.imports.push(r);break;case a.BRAND_LIST:r="IkasBrandList",s.imports.push(r);break;case a.CATEGORY:r="IkasCategory",s.imports.push(r);break;case a.CATEGORY_LIST:r="IkasCategoryList",s.imports.push(r);break;case a.CUSTOM:var n=t.customData.find((function(t){return t.id===e.customDataId}));n&&(r=c.getType(n,s,t),n.type!==a.DYNAMIC_LIST&&n.type!==a.STATIC_LIST||(r+="[]"));break;case a.COMPONENT:r="IkasComponentRenderer",s.imports.push(r);break;case a.COMPONENT_LIST:r="IkasComponentRenderer[]",s.imports.push("IkasComponentRenderer");break;case a.BLOG:r="IkasBlog",s.imports.push(r);break;case a.BLOG_LIST:r="IkasBlogList",s.imports.push(r);break;case a.BLOG_CATEGORY:r="IkasBlogCategory",s.imports.push(r);break;case a.BLOG_CATEGORY_LIST:r="IkasBlogCategoryList",s.imports.push(r);break;case a.RAFFLE:r="IkasRaffle",s.imports.push(r);break;case a.RAFFLE_LIST:r="IkasRaffleList",s.imports.push(r);break;case a.SLIDER:r="IkasSlider",s.imports.push(r);break;case a.VIDEO:r="IkasVideo",s.imports.push(r)}return r},s.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}},s}();export{c as CustomDataTypesGenerator,i as PropTypeGenarator};
1
+ import{__awaiter as e,__generator as t}from"../../../ext/tslib/tslib.es6.js";import{IkasThemeJsonComponentPropType as a}from"@ikas/storefront-models";import s from"path";import{createFile as r,deleteDirContent as n}from"../../../utils/fs.js";import o from"lodash/uniq";var i=function(){function i(){}return i.generate=function(a,p){return e(this,void 0,void 0,(function(){var e,u,I,k,m,T,L;return t(this,(function(t){switch(t.label){case 0:return[4,n(s.join(p||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]),a.customData.forEach((function(t){i.generateAllCustomDataTypes(t,e,a)})),u=0,I=0;do{u=e.internalCustomDatas.length,e.internalCustomDatas.forEach((function(t){i.generateAllCustomDataTypes(t,e,a)})),(I=e.internalCustomDatas.length)!==u&&(e.internalCustomDatas=e.internalCustomDatas.splice(u,I))}while(u!==I);return[4,c.generate(a,e)];case 3:return t.sent(),k=s.join(p||process.cwd(),"src","components","__generated__"),e.imports=o(e.imports),m="import {\r\n",e.imports.forEach((function(e){m+="\t".concat(e,",\r\n")})),T=(m+='} from "@ikas/storefront"\r\n\r\n')+e.content,[4,r(k,"types.ts",T)];case 4:return[2,t.sent()];case 5:return L=t.sent(),console.log(L),[2,!1];case 6:return[2]}}))}))},i.generateAllCustomDataTypes=function(e,t,s){var r=e.type===a.ENUM,n="export ".concat(r?"enum":"type"," ").concat(i.generateTypeName(e)).concat(r?"":" = ","{ \r\n"),o="};\r\n\r\n";e.type!==a.DYNAMIC_LIST&&e.type!==a.STATIC_LIST||!e.nestedData?e.type===a.ENUM&&e.enumOptions?(t.content+=n,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+=o):(t.content+=n,e.nestedData&&e.nestedData.forEach((function(e){i.genenateCustomDataType(e,t,s),t.content+="\r\n"})),t.content+=o):i.generateAllCustomDataTypes(e.nestedData[0],t,s)},i.genenateCustomDataType=function(e,t,s){var r=i.getType(e,t,s);e.key&&e.key[0].match(/^\d/)&&(e.key="_"+e.key),t.content+="\t".concat(e.key).concat(e.isRequired?"":"?",": ").concat(r).concat([a.DYNAMIC_LIST,a.STATIC_LIST].includes(e.type)?"[]":"").concat(e.type===a.ENUM?",":";")},i.getType=function(e,t,s){var r="";switch(e.type){case a.TEXT:case a.RICH_TEXT:case a.COLOR:r="string";break;case a.BOOLEAN:r="boolean";break;case a.IMAGE:r="IkasImage",t.imports.push(r);break;case a.IMAGE_LIST:r="IkasImage[]",t.imports.push("IkasImage");break;case a.LINK:r="IkasNavigationLink",t.imports.push(r);break;case a.LIST_OF_LINK:r="IkasNavigationLink[]",t.imports.push("IkasNavigationLink");break;case a.PRODUCT_DETAIL:r="IkasProduct",t.imports.push(r);break;case a.PRODUCT_LIST:r="IkasProductList",t.imports.push("IkasProductList");break;case a.PRODUCT_ATTRIBUTE:r="IkasAttributeDetail",t.imports.push(r);break;case a.PRODUCT_ATTRIBUTE_LIST:r="IkasAttributeList",t.imports.push("IkasAttributeList");break;case a.BRAND:r="IkasBrand",t.imports.push(r);break;case a.BRAND_LIST:r="IkasBrandList",t.imports.push(r);break;case a.CATEGORY:r="IkasCategory",t.imports.push(r);break;case a.CATEGORY_LIST:r="IkasCategoryList",t.imports.push(r);break;case a.CUSTOM:var n=s.customData.find((function(t){return t.id===e.customDataId}));n&&(r=i.generateTypeName(n));break;case a.COMPONENT:r="IkasComponentRenderer",t.imports.push(r);break;case a.COMPONENT_LIST:r="IkasComponentRenderer[]",t.imports.push("IkasComponentRenderer");break;case a.BLOG:r="IkasBlog",t.imports.push(r);break;case a.BLOG_LIST:r="IkasBlogList",t.imports.push(r);break;case a.BLOG_CATEGORY:r="IkasBlogCategory",t.imports.push(r);break;case a.BLOG_CATEGORY_LIST:r="IkasBlogCategoryList",t.imports.push(r);break;case a.RAFFLE:r="IkasRaffle",t.imports.push(r);break;case a.RAFFLE_LIST:r="IkasRaffleList",t.imports.push(r);break;case a.SLIDER:r="IkasSlider",t.imports.push(r);break;case a.VIDEO:r="IkasVideo",t.imports.push(r);break;case a.ENUM:case a.OBJECT:r=i.generateTypeName(e),t.content.includes("export enum ".concat(r))||t.internalCustomDatas.push(e);break;case a.DYNAMIC_LIST:case a.STATIC_LIST:e.nestedData&&(e.nestedData[0].type===a.OBJECT||e.nestedData[0].type===a.ENUM?(r=i.generateTypeName(e.nestedData[0]),t.content.includes("export type ".concat(r))||t.internalCustomDatas.push(e.nestedData[0])):r=i.getType(e.nestedData[0],t,s))}return r},i.generateTypeName=function(e){var t;if(e.typescriptName)return e.typescriptName;if((e.type===a.DYNAMIC_LIST||e.type===a.STATIC_LIST)&&(null===(t=e.nestedData)||void 0===t?void 0:t.length))return i.generateTypeName(e.nestedData[0]);var s=e.name||"";return(s=(s=s.replace(/\s/g,"")).replace(/\W/g,""))[0].match(/^\d/)&&(s="_"+s),e.type===a.ENUM&&(s+="Enum"),s},i}(),c=function(){function s(){}return s.generate=function(a,r){return e(this,void 0,void 0,(function(){return t(this,(function(e){return a.components.forEach((function(e){e.props.length>0&&"checkout"!==e.id&&(r.content+="export type ".concat(s.generatePropTypeName(e),"Props = {\n"),e.props.forEach((function(e){r.content+="\t".concat(e.name).concat(e.isRequired?"":"?",": ").concat(s.getType(e,a,r),";\n")})),r.content+="};\r\n\r\n")})),[2]}))}))},s.getType=function(e,t,s){var r="";switch(e.type){case a.TEXT:case a.RICH_TEXT:case a.COLOR:r="string";break;case a.BOOLEAN:r="boolean";break;case a.IMAGE:r="IkasImage",s.imports.push(r);break;case a.IMAGE_LIST:r="IkasImage[]",s.imports.push("IkasImage");break;case a.LINK:r="IkasNavigationLink",s.imports.push(r);break;case a.LIST_OF_LINK:r="IkasNavigationLink[]",s.imports.push("IkasNavigationLink");break;case a.PRODUCT_DETAIL:r="IkasProduct",s.imports.push(r);break;case a.PRODUCT_LIST:r="IkasProductList",s.imports.push("IkasProductList");break;case a.PRODUCT_ATTRIBUTE:r="IkasAttributeDetail",s.imports.push(r);break;case a.PRODUCT_ATTRIBUTE_LIST:r="IkasAttributeList",s.imports.push("IkasAttributeList");break;case a.BRAND:r="IkasBrand",s.imports.push(r);break;case a.BRAND_LIST:r="IkasBrandList",s.imports.push(r);break;case a.CATEGORY:r="IkasCategory",s.imports.push(r);break;case a.CATEGORY_LIST:r="IkasCategoryList",s.imports.push(r);break;case a.CUSTOM:var n=t.customData.find((function(t){return t.id===e.customDataId}));n&&(r=i.getType(n,s,t),n.type!==a.DYNAMIC_LIST&&n.type!==a.STATIC_LIST||(r+="[]"));break;case a.COMPONENT:r="IkasComponentRenderer",s.imports.push(r);break;case a.COMPONENT_LIST:r="IkasComponentRenderer[]",s.imports.push("IkasComponentRenderer");break;case a.BLOG:r="IkasBlog",s.imports.push(r);break;case a.BLOG_LIST:r="IkasBlogList",s.imports.push(r);break;case a.BLOG_CATEGORY:r="IkasBlogCategory",s.imports.push(r);break;case a.BLOG_CATEGORY_LIST:r="IkasBlogCategoryList",s.imports.push(r);break;case a.RAFFLE:r="IkasRaffle",s.imports.push(r);break;case a.RAFFLE_LIST:r="IkasRaffleList",s.imports.push(r);break;case a.SLIDER:r="IkasSlider",s.imports.push(r);break;case a.VIDEO:r="IkasVideo",s.imports.push(r)}return r},s.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}},s}();export{i as CustomDataTypesGenerator,c as PropTypeGenarator};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront-next",
3
- "version": "6.1.0-beta.227",
3
+ "version": "6.1.0-beta.229",
4
4
  "description": "Next.js specific functions for ikas storefront themes.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",
@@ -17,23 +17,23 @@
17
17
  },
18
18
  "peerDependencies": {
19
19
  "next": "12.2.0",
20
- "@ikas/storefront-config": "^6.1.0-beta.227",
21
- "@ikas/storefront-providers": "^6.1.0-beta.227",
22
- "@ikas/storefront-models": "^6.1.0-beta.227",
23
- "@ikas/storefront-api": "^6.1.0-beta.227",
24
- "@ikas/storefront-assets": "^6.1.0-beta.227",
20
+ "@ikas/storefront-config": "^6.1.0-beta.229",
21
+ "@ikas/storefront-providers": "^6.1.0-beta.229",
22
+ "@ikas/storefront-models": "^6.1.0-beta.229",
23
+ "@ikas/storefront-api": "^6.1.0-beta.229",
24
+ "@ikas/storefront-assets": "^6.1.0-beta.229",
25
25
  "axios": "^0.26.0",
26
26
  "lodash": "^4.17.21",
27
27
  "cors": "^2.8.5",
28
28
  "adm-zip": "^0.5.9"
29
29
  },
30
30
  "devDependencies": {
31
- "@ikas/storefront-cmd": "^6.1.0-beta.227",
32
- "@ikas/storefront-config": "^6.1.0-beta.227",
33
- "@ikas/storefront-providers": "^6.1.0-beta.227",
34
- "@ikas/storefront-models": "^6.1.0-beta.227",
35
- "@ikas/storefront-api": "^6.1.0-beta.227",
36
- "@ikas/storefront-assets": "^6.1.0-beta.227",
31
+ "@ikas/storefront-cmd": "^6.1.0-beta.229",
32
+ "@ikas/storefront-config": "^6.1.0-beta.229",
33
+ "@ikas/storefront-providers": "^6.1.0-beta.229",
34
+ "@ikas/storefront-models": "^6.1.0-beta.229",
35
+ "@ikas/storefront-api": "^6.1.0-beta.229",
36
+ "@ikas/storefront-assets": "^6.1.0-beta.229",
37
37
  "@rollup/plugin-node-resolve": "^13.3.0",
38
38
  "@rollup/plugin-commonjs": "^22.0.0",
39
39
  "@rollup/plugin-json": "^4.1.0",