@ikas/storefront-next 4.0.0-beta.26 → 4.0.0-beta.3

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.
Files changed (84) hide show
  1. package/build/api/getTheme.js +1 -1
  2. package/build/api/updateTheme.js +1 -1
  3. package/build/api/uploadTheme.js +1 -1
  4. package/build/packages/cmd/build/_virtual/_cloneBuffer.js +1 -0
  5. package/build/packages/cmd/build/_virtual/_commonjsHelpers.js +1 -0
  6. package/build/packages/cmd/build/_virtual/_nodeUtil.js +1 -0
  7. package/build/packages/cmd/build/_virtual/isBuffer.js +1 -0
  8. package/build/packages/cmd/build/ext/lodash/_DataView.js +1 -0
  9. package/build/packages/cmd/build/ext/lodash/_Hash.js +1 -0
  10. package/build/packages/cmd/build/ext/lodash/_ListCache.js +1 -0
  11. package/build/packages/cmd/build/ext/lodash/_Map.js +1 -0
  12. package/build/packages/cmd/build/ext/lodash/_MapCache.js +1 -0
  13. package/build/packages/cmd/build/ext/lodash/_Promise.js +1 -0
  14. package/build/packages/cmd/build/ext/lodash/_Set.js +1 -0
  15. package/build/packages/cmd/build/ext/lodash/_SetCache.js +1 -0
  16. package/build/packages/cmd/build/ext/lodash/_Symbol.js +1 -0
  17. package/build/packages/cmd/build/ext/lodash/_Uint8Array.js +1 -0
  18. package/build/packages/cmd/build/ext/lodash/_WeakMap.js +1 -0
  19. package/build/packages/cmd/build/ext/lodash/_arrayIncludes.js +1 -0
  20. package/build/packages/cmd/build/ext/lodash/_arrayIncludesWith.js +1 -0
  21. package/build/packages/cmd/build/ext/lodash/_arrayLikeKeys.js +1 -0
  22. package/build/packages/cmd/build/ext/lodash/_assocIndexOf.js +1 -0
  23. package/build/packages/cmd/build/ext/lodash/_baseClone.js +1 -0
  24. package/build/packages/cmd/build/ext/lodash/_baseFindIndex.js +1 -0
  25. package/build/packages/cmd/build/ext/lodash/_baseGetTag.js +1 -0
  26. package/build/packages/cmd/build/ext/lodash/_baseIndexOf.js +1 -0
  27. package/build/packages/cmd/build/ext/lodash/_baseIsArguments.js +1 -0
  28. package/build/packages/cmd/build/ext/lodash/_baseIsNaN.js +1 -0
  29. package/build/packages/cmd/build/ext/lodash/_baseIsNative.js +1 -0
  30. package/build/packages/cmd/build/ext/lodash/_baseUniq.js +1 -0
  31. package/build/packages/cmd/build/ext/lodash/_cacheHas.js +1 -0
  32. package/build/packages/cmd/build/ext/lodash/_cloneBuffer.js +1 -0
  33. package/build/packages/cmd/build/ext/lodash/_cloneSymbol.js +1 -0
  34. package/build/packages/cmd/build/ext/lodash/_coreJsData.js +1 -0
  35. package/build/packages/cmd/build/ext/lodash/_createSet.js +1 -0
  36. package/build/packages/cmd/build/ext/lodash/_defineProperty.js +1 -0
  37. package/build/packages/cmd/build/ext/lodash/_freeGlobal.js +1 -0
  38. package/build/packages/cmd/build/ext/lodash/_getMapData.js +1 -0
  39. package/build/packages/cmd/build/ext/lodash/_getNative.js +1 -0
  40. package/build/packages/cmd/build/ext/lodash/_getRawTag.js +1 -0
  41. package/build/packages/cmd/build/ext/lodash/_getTag.js +1 -0
  42. package/build/packages/cmd/build/ext/lodash/_getValue.js +1 -0
  43. package/build/packages/cmd/build/ext/lodash/_hashClear.js +1 -0
  44. package/build/packages/cmd/build/ext/lodash/_hashDelete.js +1 -0
  45. package/build/packages/cmd/build/ext/lodash/_hashGet.js +1 -0
  46. package/build/packages/cmd/build/ext/lodash/_hashHas.js +1 -0
  47. package/build/packages/cmd/build/ext/lodash/_hashSet.js +1 -0
  48. package/build/packages/cmd/build/ext/lodash/_isKeyable.js +1 -0
  49. package/build/packages/cmd/build/ext/lodash/_isMasked.js +1 -0
  50. package/build/packages/cmd/build/ext/lodash/_listCacheClear.js +1 -0
  51. package/build/packages/cmd/build/ext/lodash/_listCacheDelete.js +1 -0
  52. package/build/packages/cmd/build/ext/lodash/_listCacheGet.js +1 -0
  53. package/build/packages/cmd/build/ext/lodash/_listCacheHas.js +1 -0
  54. package/build/packages/cmd/build/ext/lodash/_listCacheSet.js +1 -0
  55. package/build/packages/cmd/build/ext/lodash/_mapCacheClear.js +1 -0
  56. package/build/packages/cmd/build/ext/lodash/_mapCacheDelete.js +1 -0
  57. package/build/packages/cmd/build/ext/lodash/_mapCacheGet.js +1 -0
  58. package/build/packages/cmd/build/ext/lodash/_mapCacheHas.js +1 -0
  59. package/build/packages/cmd/build/ext/lodash/_mapCacheSet.js +1 -0
  60. package/build/packages/cmd/build/ext/lodash/_nativeCreate.js +1 -0
  61. package/build/packages/cmd/build/ext/lodash/_nodeUtil.js +1 -0
  62. package/build/packages/cmd/build/ext/lodash/_objectToString.js +1 -0
  63. package/build/packages/cmd/build/ext/lodash/_root.js +1 -0
  64. package/build/packages/cmd/build/ext/lodash/_setCacheAdd.js +1 -0
  65. package/build/packages/cmd/build/ext/lodash/_setCacheHas.js +1 -0
  66. package/build/packages/cmd/build/ext/lodash/_setToArray.js +1 -0
  67. package/build/packages/cmd/build/ext/lodash/_strictIndexOf.js +1 -0
  68. package/build/packages/cmd/build/ext/lodash/_toSource.js +1 -0
  69. package/build/packages/cmd/build/ext/lodash/eq.js +1 -0
  70. package/build/packages/cmd/build/ext/lodash/isArguments.js +1 -0
  71. package/build/packages/cmd/build/ext/lodash/isBuffer.js +1 -0
  72. package/build/packages/cmd/build/ext/lodash/isFunction.js +1 -0
  73. package/build/packages/cmd/build/ext/lodash/isMap.js +1 -0
  74. package/build/packages/cmd/build/ext/lodash/isObject.js +1 -0
  75. package/build/packages/cmd/build/ext/lodash/isObjectLike.js +1 -0
  76. package/build/packages/cmd/build/ext/lodash/isSet.js +1 -0
  77. package/build/packages/cmd/build/ext/lodash/isTypedArray.js +1 -0
  78. package/build/packages/cmd/build/ext/lodash/noop.js +1 -0
  79. package/build/packages/cmd/build/ext/lodash/stubFalse.js +1 -0
  80. package/build/packages/cmd/build/ext/lodash/uniq.js +1 -0
  81. package/build/packages/cmd/build/scripts/generators/types/index.js +1 -1
  82. package/build/provider/page-data-next.js +1 -1
  83. package/build/utils/i18n.js +1 -1
  84. package/package.json +12 -12
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as s}from'./../ext/tslib/tslib.es6.js';import{corsMiddleware as t}from"./middleware.js";import"../packages/cmd/build/scripts/generators/api/index.js";import"../packages/cmd/build/scripts/generators/components/index.js";import"path";import"fs";import"../packages/cmd/build/scripts/generators/pages/index.js";import{ThemeJsonGenerator as r}from"../packages/cmd/build/scripts/generators/theme/index.js";import"../packages/cmd/build/scripts/generators/types/index.js";import"lodash/cloneDeep";var o=function(o,i){return e(void 0,void 0,void 0,(function(){var e,n;return s(this,(function(s){switch(s.label){case 0:return s.trys.push([0,3,,4]),[4,t(o,i)];case 1:return s.sent(),[4,r.getTheme()];case 2:return e=s.sent(),i.statusCode=200,i.setHeader("Content-Type","application/json"),i.json({theme:e||{}}),[3,4];case 3:return n=s.sent(),console.error(n),i.statusCode=500,i.send(n),[3,4];case 4:return[2]}}))}))},i={};export{i as config,o as getTheme};
1
+ import{__awaiter as e,__generator as s}from'./../ext/tslib/tslib.es6.js';import{corsMiddleware as t}from"./middleware.js";import"../packages/cmd/build/scripts/generators/api/index.js";import"../packages/cmd/build/scripts/generators/components/index.js";import"path";import"fs";import"../packages/cmd/build/scripts/generators/pages/index.js";import{ThemeJsonGenerator as r}from"../packages/cmd/build/scripts/generators/theme/index.js";import"../packages/cmd/build/scripts/generators/types/index.js";import"../packages/cmd/build/ext/lodash/_baseClone.js";var o=function(o,i){return e(void 0,void 0,void 0,(function(){var e,n;return s(this,(function(s){switch(s.label){case 0:return s.trys.push([0,3,,4]),[4,t(o,i)];case 1:return s.sent(),[4,r.getTheme()];case 2:return e=s.sent(),i.statusCode=200,i.setHeader("Content-Type","application/json"),i.json({theme:e||{}}),[3,4];case 3:return n=s.sent(),console.error(n),i.statusCode=500,i.send(n),[3,4];case 4:return[2]}}))}))},i={};export{i as config,o as getTheme};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as r}from'./../ext/tslib/tslib.es6.js';import{corsMiddleware as t}from"./middleware.js";import{APIGenerator as s}from"../packages/cmd/build/scripts/generators/api/index.js";import{ComponentImportsGenerator as a}from"../packages/cmd/build/scripts/generators/components/index.js";import"path";import"fs";import{PageGenerator as n}from"../packages/cmd/build/scripts/generators/pages/index.js";import{ThemeJsonGenerator as o}from"../packages/cmd/build/scripts/generators/theme/index.js";import{CustomDataTypesGenerator as i}from"../packages/cmd/build/scripts/generators/types/index.js";import"lodash/cloneDeep";var p=function(p,m){return e(void 0,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return[4,t(p,m)];case 1:return r.sent(),e=p.body,[4,o.generate(e)];case 2:return r.sent(),[4,a.generate(e)];case 3:return r.sent(),[4,n.generate()];case 4:return r.sent(),[4,s.generate()];case 5:return r.sent(),[4,i.generate(e)];case 6:return r.sent(),m.statusCode=200,m.setHeader("Content-Type","application/json"),m.end(),[2]}}))}))},m={api:{bodyParser:{sizeLimit:"50mb"}}};export{m as config,p as updateTheme};
1
+ import{__awaiter as e,__generator as r}from'./../ext/tslib/tslib.es6.js';import{corsMiddleware as s}from"./middleware.js";import{APIGenerator as t}from"../packages/cmd/build/scripts/generators/api/index.js";import{ComponentImportsGenerator as a}from"../packages/cmd/build/scripts/generators/components/index.js";import"path";import"fs";import{PageGenerator as n}from"../packages/cmd/build/scripts/generators/pages/index.js";import{ThemeJsonGenerator as o}from"../packages/cmd/build/scripts/generators/theme/index.js";import{CustomDataTypesGenerator as i}from"../packages/cmd/build/scripts/generators/types/index.js";import"../packages/cmd/build/ext/lodash/_baseClone.js";var p=function(p,m){return e(void 0,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return[4,s(p,m)];case 1:return r.sent(),e=p.body,[4,o.generate(e)];case 2:return r.sent(),[4,a.generate(e)];case 3:return r.sent(),[4,n.generate()];case 4:return r.sent(),[4,t.generate()];case 5:return r.sent(),[4,i.generate(e)];case 6:return r.sent(),m.statusCode=200,m.setHeader("Content-Type","application/json"),m.end(),[2]}}))}))},m={api:{bodyParser:{sizeLimit:"50mb"}}};export{m as config,p as updateTheme};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from'./../ext/tslib/tslib.es6.js';import n from"fs";import r from"path";import s from"archiver";import o from"axios";import i from"@ikas/storefront-assets/checkout/de.js";import a from"@ikas/storefront-assets/checkout/en.js";import c from"@ikas/storefront-assets/checkout/tr.js";import{corsMiddleware as u}from"./middleware.js";var l=function(s,o){return e(void 0,void 0,void 0,(function(){var l,d,v,y,T,j,b;return t(this,(function(S){switch(S.label){case 0:return[4,u(s,o)];case 1:S.sent(),S.label=2;case 2:return S.trys.push([2,9,,10]),[4,new Promise((function(e,t){var s=r.join(process.cwd(),"src","theme.json");n.readFile(s,(function(n,r){if(n)return t(n);e(JSON.parse(r.toString()))}))}))];case 3:return l=S.sent(),[4,new Promise((function(e,t){var s=r.join(process.cwd(),"public","locales"),o=function(e){return e.length?e.split(".")[0]:e};n.readdir(s,(function(u,l){if(u)return t(u);var d=l.filter((function(e){return n.lstatSync(r.join(s,e)).isDirectory()})),f={},p=!1;d.forEach((function(e){var t=r.join(process.cwd(),"public","locales",e);f[e]={};try{var s=n.readdirSync(t);s.forEach((function(t){var s=n.readFileSync(r.join(process.cwd(),"public","locales",e,t)),u=o(e).toLowerCase(),l=o(t);f[u][l]=JSON.parse(s.toString()),f[u]["checkout-page"]="tr"===u?c:"de"===u?i:a}))}catch(e){console.error(e),p=!0}})),p?t(null):e(f)}))}))];case 4:return d=S.sent(),[4,p(l,d)];case 5:return"string"!=typeof(v=S.sent())?[3,8]:[4,f()];case 6:return y=S.sent(),T=n.statSync(y),[4,h(v,n.readFileSync(y),T.size)];case 7:j=S.sent(),console.log(j),j&&function(){e(this,void 0,void 0,(function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),[4,m()];case 1:return e=t.sent(),[4,fetch(process.env.NEXT_PUBLIC_UPLOAD_GQL_URL,{method:"POST",body:JSON.stringify({query:"\n mutation buildTheme($buildThemeThemeId: String!) {\n buildTheme(themeId: $buildThemeThemeId)\n }\n ",variables:{buildThemeThemeId:e.themeId}}),headers:{"x-api-key":e.apiKey,"Content-Type":"application/json"}})];case 2:return[4,t.sent().json()];case 3:return n=t.sent(),console.log(n),[3,5];case 4:return r=t.sent(),console.log(r),[3,5];case 5:return[2]}}))}))}(),function(e){n.unlinkSync(e)}(y),S.label=8;case 8:return o.statusCode=200,o.setHeader("Content-Type","application/json"),o.json({status:"ok"}),[3,10];case 9:return b=S.sent(),console.log(b),o.statusCode=400,o.setHeader("Content-Type","application/json"),o.json({status:"failed"}),[3,10];case 10:return[2]}}))}))},d={};function f(){return e(this,void 0,void 0,(function(){var e,o,i,a,c;return t(this,(function(t){switch(t.label){case 0:return e=r.join(process.cwd()),"theme.zip",o=r.join(process.cwd(),"theme.zip"),i=n.createWriteStream(o),(a=s("zip",{zlib:{level:9}})).on("warning",(function(e){if("ENOENT"!==e.code)throw e})),a.on("error",(function(e){throw e})),a.pipe(i),c=["node_modules",".next","out",".git"],n.readdirSync(e).forEach((function(t){var s=r.join(e,t);if(n.lstatSync(s).isDirectory()){if(c.includes(t))return;a.directory(s,t)}else a.file(s,{name:t})})),[4,a.finalize()];case 1:return t.sent(),[2,new Promise((function(e){setTimeout((function(){e(o)}),2e3)}))]}}))}))}function p(n,r){return e(this,void 0,void 0,(function(){var e,s,i,a,c;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),e=Object.keys(r),s=e.some((function(e){return"en"===e}))?"en":e[0],[4,m()];case 1:return i=t.sent(),[4,o({method:"post",url:process.env.NEXT_PUBLIC_UPLOAD_GQL_URL,headers:{"x-api-key":i.apiKey,"Content-Type":"application/json"},data:JSON.stringify({query:"\n mutation saveTheme($saveThemeInput: SaveThemeInput!) {\n saveTheme(input: $saveThemeInput) {\n themeVersionId\n uploadUrl\n }\n }\n ",variables:{saveThemeInput:{id:i.themeId,themeJson:JSON.stringify(n),locales:Object.entries(r).map((function(e){var t=e[0],n=e[1];return{isDefaultLocale:t===s,locale:t,localeJson:JSON.stringify(n)}}))}}})})];case 2:return[4,t.sent().data];case 3:return(a=t.sent()).data&&a.data.saveTheme?[2,a.data.saveTheme.uploadUrl]:[3,5];case 4:return c=t.sent(),console.log(c),[3,5];case 5:return[2]}}))}))}function h(n,r,s){return e(this,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:e={headers:{"Content-Type":"application/zip","Content-Length":s+""}},t.label=1;case 1:return t.trys.push([1,3,,4]),[4,o.put(n,r,e)];case 2:return[2,200===t.sent().status];case 3:return i=t.sent(),console.log(i),[2,!1];case 4:return[2]}}))}))}function m(){return new Promise((function(e,t){var s=r.join(process.cwd(),"config.json");n.readFile(s,(function(n,r){if(n)return t(n);e(JSON.parse(r.toString()))}))}))}export{d as config,l as uploadTheme};
1
+ import{__awaiter as e,__generator as t}from'./../ext/tslib/tslib.es6.js';import n from"fs";import r from"path";import s from"archiver";import o from"axios";import i from"@ikas/storefront-assets/checkout/de.js";import a from"@ikas/storefront-assets/checkout/en.js";import c from"@ikas/storefront-assets/checkout/tr.js";import{corsMiddleware as u}from"./middleware.js";var l=function(s,o){return e(void 0,void 0,void 0,(function(){var l,d,v,y,T,j,b;return t(this,(function(w){switch(w.label){case 0:return[4,u(s,o)];case 1:w.sent(),w.label=2;case 2:return w.trys.push([2,9,,10]),[4,new Promise((function(e,t){var s=r.join(process.cwd(),"src","theme.json");n.readFile(s,(function(n,r){if(n)return t(n);e(JSON.parse(r.toString()))}))}))];case 3:return l=w.sent(),[4,new Promise((function(e,t){var s=r.join(process.cwd(),"public","locales"),o=function(e){return e.length?e.split(".")[0]:e};n.readdir(s,(function(u,l){if(u)return t(u);var d=l.filter((function(e){return n.lstatSync(r.join(s,e)).isDirectory()})),f={},p=!1;d.forEach((function(e){var t=r.join(process.cwd(),"public","locales",e);f[e]={};try{var s=n.readdirSync(t);s.forEach((function(t){var s=n.readFileSync(r.join(process.cwd(),"public","locales",e,t)),u=o(e).toLowerCase(),l=o(t).toLowerCase();f[u][l]=JSON.parse(s.toString()),f[u]["checkout-page"]="tr"===u?c:"de"===u?i:a}))}catch(e){console.error(e),p=!0}})),p?t(null):e(f)}))}))];case 4:return d=w.sent(),[4,p(l,d)];case 5:return"string"!=typeof(v=w.sent())?[3,8]:[4,f()];case 6:return y=w.sent(),T=n.statSync(y),[4,h(v,n.readFileSync(y),T.size)];case 7:j=w.sent(),console.log(j),j&&function(){e(this,void 0,void 0,(function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),[4,m()];case 1:return e=t.sent(),[4,fetch(process.env.NEXT_PUBLIC_UPLOAD_GQL_URL,{method:"POST",body:JSON.stringify({query:"\n mutation buildTheme($buildThemeThemeId: String!) {\n buildTheme(themeId: $buildThemeThemeId)\n }\n ",variables:{buildThemeThemeId:e.themeId}}),headers:{"x-api-key":e.apiKey,"Content-Type":"application/json"}})];case 2:return[4,t.sent().json()];case 3:return n=t.sent(),console.log(n),[3,5];case 4:return r=t.sent(),console.log(r),[3,5];case 5:return[2]}}))}))}(),function(e){n.unlinkSync(e)}(y),w.label=8;case 8:return o.statusCode=200,o.setHeader("Content-Type","application/json"),o.json({status:"ok"}),[3,10];case 9:return b=w.sent(),console.log(b),o.statusCode=400,o.setHeader("Content-Type","application/json"),o.json({status:"failed"}),[3,10];case 10:return[2]}}))}))},d={};function f(){return e(this,void 0,void 0,(function(){var e,o,i,a,c;return t(this,(function(t){switch(t.label){case 0:return e=r.join(process.cwd()),"theme.zip",o=r.join(process.cwd(),"theme.zip"),i=n.createWriteStream(o),(a=s("zip",{zlib:{level:9}})).on("warning",(function(e){if("ENOENT"!==e.code)throw e})),a.on("error",(function(e){throw e})),a.pipe(i),c=["node_modules",".next","out",".git"],n.readdirSync(e).forEach((function(t){var s=r.join(e,t);if(n.lstatSync(s).isDirectory()){if(c.includes(t))return;a.directory(s,t)}else a.file(s,{name:t})})),[4,a.finalize()];case 1:return t.sent(),[2,new Promise((function(e){setTimeout((function(){e(o)}),2e3)}))]}}))}))}function p(n,r){return e(this,void 0,void 0,(function(){var e,s,i,a,c;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),e=Object.keys(r),s=e.some((function(e){return"en"===e}))?"en":e[0],[4,m()];case 1:return i=t.sent(),[4,o({method:"post",url:process.env.NEXT_PUBLIC_UPLOAD_GQL_URL,headers:{"x-api-key":i.apiKey,"Content-Type":"application/json"},data:JSON.stringify({query:"\n mutation saveTheme($saveThemeInput: SaveThemeInput!) {\n saveTheme(input: $saveThemeInput) {\n themeVersionId\n uploadUrl\n }\n }\n ",variables:{saveThemeInput:{id:i.themeId,themeJson:JSON.stringify(n),locales:Object.entries(r).map((function(e){var t=e[0],n=e[1];return{isDefaultLocale:t===s,locale:t,localeJson:JSON.stringify(n)}}))}}})})];case 2:return[4,t.sent().data];case 3:return(a=t.sent()).data&&a.data.saveTheme?[2,a.data.saveTheme.uploadUrl]:[3,5];case 4:return c=t.sent(),console.log(c),[3,5];case 5:return[2]}}))}))}function h(n,r,s){return e(this,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:e={headers:{"Content-Type":"application/zip","Content-Length":s+""}},t.label=1;case 1:return t.trys.push([1,3,,4]),[4,o.put(n,r,e)];case 2:return[2,200===t.sent().status];case 3:return i=t.sent(),console.log(i),[2,!1];case 4:return[2]}}))}))}function m(){return new Promise((function(e,t){var s=r.join(process.cwd(),"config.json");n.readFile(s,(function(n,r){if(n)return t(n);e(JSON.parse(r.toString()))}))}))}export{d as config,l as uploadTheme};
@@ -0,0 +1 @@
1
+ var r={exports:{}};export{r as _};
@@ -0,0 +1 @@
1
+ var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};export{e as commonjsGlobal};
@@ -0,0 +1 @@
1
+ var r={exports:{}};export{r as _};
@@ -0,0 +1 @@
1
+ var r={exports:{}};export{r as i};
@@ -0,0 +1 @@
1
+ import t from"./_getNative.js";import o from"./_root.js";var r=t(o,"DataView");export{r as default};
@@ -0,0 +1 @@
1
+ import t from"./_hashClear.js";import r from"./_hashDelete.js";import o from"./_hashGet.js";import e from"./_hashHas.js";import s from"./_hashSet.js";var a=t,p=r,h=o,m=e,l=s;function f(t){var r=-1,o=null==t?0:t.length;for(this.clear();++r<o;){var e=t[r];this.set(e[0],e[1])}}f.prototype.clear=a,f.prototype.delete=p,f.prototype.get=h,f.prototype.has=m,f.prototype.set=l;var i=f;export{i as default};
@@ -0,0 +1 @@
1
+ import t from"./_listCacheClear.js";import e from"./_listCacheDelete.js";import r from"./_listCacheGet.js";import o from"./_listCacheHas.js";import s from"./_listCacheSet.js";var a=t,p=e,l=r,i=o,m=s;function h(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}h.prototype.clear=a,h.prototype.delete=p,h.prototype.get=l,h.prototype.has=i,h.prototype.set=m;var c=h;export{c as default};
@@ -0,0 +1 @@
1
+ import o from"./_getNative.js";import r from"./_root.js";var t=o(r,"Map");export{t as default};
@@ -0,0 +1 @@
1
+ import t from"./_mapCacheClear.js";import e from"./_mapCacheDelete.js";import r from"./_mapCacheGet.js";import o from"./_mapCacheHas.js";import a from"./_mapCacheSet.js";var p=t,m=e,s=r,h=o,l=a;function c(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}c.prototype.clear=p,c.prototype.delete=m,c.prototype.get=s,c.prototype.has=h,c.prototype.set=l;var f=c;export{f as default};
@@ -0,0 +1 @@
1
+ import o from"./_getNative.js";import r from"./_root.js";var t=o(r,"Promise");export{t as default};
@@ -0,0 +1 @@
1
+ import t from"./_getNative.js";import o from"./_root.js";var r=t(o,"Set");export{r as default};
@@ -0,0 +1 @@
1
+ import t from"./_MapCache.js";import a from"./_setCacheAdd.js";import o from"./_setCacheHas.js";var r=t,e=a,p=o;function s(t){var a=-1,o=null==t?0:t.length;for(this.__data__=new r;++a<o;)this.add(t[a])}s.prototype.add=s.prototype.push=e,s.prototype.has=p;var d=s;export{d as default};
@@ -0,0 +1 @@
1
+ import o from"./_root.js";var r=o.Symbol;export{r as default};
@@ -0,0 +1 @@
1
+ import r from"./_root.js";r.Uint8Array;
@@ -0,0 +1 @@
1
+ import o from"./_getNative.js";import r from"./_root.js";var t=o(r,"WeakMap");export{t as default};
@@ -0,0 +1 @@
1
+ import e from"./_baseIndexOf.js";var n=e,r=function(e,r){return!(null==e||!e.length)&&n(e,r,0)>-1};export{r as default};
@@ -0,0 +1 @@
1
+ var r=function(r,n,t){for(var e=-1,u=null==r?0:r.length;++e<u;)if(t(n,r[e]))return!0;return!1};export{r as default};
@@ -0,0 +1 @@
1
+ import"./isArguments.js";import"./isBuffer.js";import"./isTypedArray.js";import{i as r}from"../../_virtual/isBuffer.js";r.exports;
@@ -0,0 +1 @@
1
+ import r from"./eq.js";var t=r,e=function(r,e){for(var f=r.length;f--;)if(t(r[f][0],e))return f;return-1};export{e as default};
@@ -0,0 +1 @@
1
+ import"./_ListCache.js";import"./_Map.js";import"./_MapCache.js";import"./_defineProperty.js";import"./_arrayLikeKeys.js";import"./_baseGetTag.js";import"./_cloneBuffer.js";import"./_getTag.js";import"./_Uint8Array.js";import"./_cloneSymbol.js";import"./isBuffer.js";import"./isMap.js";import"./isSet.js";import{_ as r}from"../../_virtual/_cloneBuffer.js";import{i}from"../../_virtual/isBuffer.js";r.exports,i.exports;
@@ -0,0 +1 @@
1
+ var r=function(r,t,e,n){for(var a=r.length,f=e+(n?1:-1);n?f--:++f<a;)if(t(r[f],f,r))return f;return-1};export{r as default};
@@ -0,0 +1 @@
1
+ import o from"./_Symbol.js";import t from"./_getRawTag.js";import r from"./_objectToString.js";var e=t,i=r,n=o?o.toStringTag:void 0,j=function(o){return null==o?void 0===o?"[object Undefined]":"[object Null]":n&&n in Object(o)?e(o):i(o)};export{j as default};
@@ -0,0 +1 @@
1
+ import r from"./_baseFindIndex.js";import t from"./_baseIsNaN.js";import o from"./_strictIndexOf.js";var s=r,e=t,a=o,f=function(r,t,o){return t==t?a(r,t,o):s(r,e,o)};export{f as default};
@@ -0,0 +1 @@
1
+ import t from"./_baseGetTag.js";import e from"./isObjectLike.js";var r=t,o=e,s=function(t){return o(t)&&"[object Arguments]"==r(t)};export{s as default};
@@ -0,0 +1 @@
1
+ var r=function(r){return r!=r};export{r as default};
@@ -0,0 +1 @@
1
+ import t from"./isFunction.js";import o from"./_isMasked.js";import r from"./isObject.js";import e from"./_toSource.js";var p=t,n=o,s=r,c=e,i=/^\[object .+?Constructor\]$/,a=Function.prototype,f=Object.prototype,m=a.toString,u=f.hasOwnProperty,j=RegExp("^"+m.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),l=function(t){return!(!s(t)||n(t))&&(p(t)?j:i).test(c(t))};export{l as default};
@@ -0,0 +1 @@
1
+ import r from"./_SetCache.js";import e from"./_arrayIncludes.js";import t from"./_arrayIncludesWith.js";import o from"./_cacheHas.js";import s from"./_createSet.js";import a from"./_setToArray.js";var f=r,i=e,m=t,n=o,u=s,p=a,l=function(r,e,t){var o=-1,s=i,a=r.length,l=!0,h=[],c=h;if(t)l=!1,s=m;else if(a>=200){var j=e?null:u(r);if(j)return p(j);l=!1,s=n,c=new f}else c=e?[]:h;r:for(;++o<a;){var _=r[o],v=e?e(_):_;if(_=t||0!==_?_:0,l&&v==v){for(var d=c.length;d--;)if(c[d]===v)continue r;e&&c.push(v),h.push(_)}else s(c,v,t)||(c!==h&&c.push(v),h.push(_))}return h};export{l as default};
@@ -0,0 +1 @@
1
+ var a=function(a,r){return a.has(r)};export{a as default};
@@ -0,0 +1 @@
1
+ import{_ as o}from"../../_virtual/_cloneBuffer.js";import r from"./_root.js";var e,t,n,f,s,i,p;e=o,n=r,i=(s=(f=(t=o.exports)&&!t.nodeType&&t)&&e&&!e.nodeType&&e)&&s.exports===f?n.Buffer:void 0,p=i?i.allocUnsafe:void 0,e.exports=function(o,r){if(r)return o.slice();var e=o.length,t=p?p(e):new o.constructor(e);return o.copy(t),t};
@@ -0,0 +1 @@
1
+ import o from"./_Symbol.js";var r=o?o.prototype:void 0;r&&r.valueOf;
@@ -0,0 +1 @@
1
+ import r from"./_root.js";var o=r["__core-js_shared__"];export{o as default};
@@ -0,0 +1 @@
1
+ import r from"./_Set.js";import o from"./noop.js";import t from"./_setToArray.js";var e=r,m=o,n=e&&1/t(new e([,-0]))[1]==1/0?function(r){return new e(r)}:m;export{n as default};
@@ -0,0 +1 @@
1
+ import t from"./_getNative.js";var r=t;!function(){try{var t=r(Object,"defineProperty");t({},"",{})}catch(t){}}();
@@ -0,0 +1 @@
1
+ import{commonjsGlobal as o}from"../../_virtual/_commonjsHelpers.js";var e="object"==typeof o&&o&&o.Object===Object&&o;export{e as default};
@@ -0,0 +1 @@
1
+ import a from"./_isKeyable.js";var r=a,t=function(a,t){var e=a.__data__;return r(t)?e["string"==typeof t?"string":"hash"]:e.map};export{t as default};
@@ -0,0 +1 @@
1
+ import r from"./_baseIsNative.js";import t from"./_getValue.js";var a=r,e=t,o=function(r,t){var o=e(r,t);return a(o)?o:void 0};export{o as default};
@@ -0,0 +1 @@
1
+ import t from"./_Symbol.js";var r=t,o=Object.prototype,a=o.hasOwnProperty,e=o.toString,l=r?r.toStringTag:void 0,c=function(t){var r=a.call(t,l),o=t[l];try{t[l]=void 0;var c=!0}catch(t){}var i=e.call(t);return c&&(r?t[l]=o:delete t[l]),i};export{c as default};
@@ -0,0 +1 @@
1
+ import e from"./_DataView.js";import r from"./_Map.js";import t from"./_Promise.js";import o from"./_Set.js";import a from"./_WeakMap.js";import c from"./_baseGetTag.js";import j from"./_toSource.js";var s=e,i=r,m=t,n=o,b=a,p=c,f=j,u=f(s),w=f(i),_=f(m),M=f(n),v=f(b),S=p;(s&&"[object DataView]"!=S(new s(new ArrayBuffer(1)))||i&&"[object Map]"!=S(new i)||m&&"[object Promise]"!=S(m.resolve())||n&&"[object Set]"!=S(new n)||b&&"[object WeakMap]"!=S(new b))&&(S=function(e){var r=p(e),t="[object Object]"==r?e.constructor:void 0,o=t?f(t):"";if(o)switch(o){case u:return"[object DataView]";case w:return"[object Map]";case _:return"[object Promise]";case M:return"[object Set]";case v:return"[object WeakMap]"}return r});
@@ -0,0 +1 @@
1
+ var n=function(n,r){return null==n?void 0:n[r]};export{n as default};
@@ -0,0 +1 @@
1
+ import t from"./_nativeCreate.js";var a=t,e=function(){this.__data__=a?a(null):{},this.size=0};export{e as default};
@@ -0,0 +1 @@
1
+ var t=function(t){var a=this.has(t)&&delete this.__data__[t];return this.size-=a?1:0,a};export{t as default};
@@ -0,0 +1 @@
1
+ import r from"./_nativeCreate.js";var t=r,a=Object.prototype.hasOwnProperty,e=function(r){var e=this.__data__;if(t){var _=e[r];return"__lodash_hash_undefined__"===_?void 0:_}return a.call(e,r)?e[r]:void 0};export{e as default};
@@ -0,0 +1 @@
1
+ import t from"./_nativeCreate.js";var r=t,a=Object.prototype.hasOwnProperty,e=function(t){var e=this.__data__;return r?void 0!==e[t]:a.call(e,t)};export{e as default};
@@ -0,0 +1 @@
1
+ import t from"./_nativeCreate.js";var a=t,_=function(t,_){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=a&&void 0===_?"__lodash_hash_undefined__":_,this};export{_ as default};
@@ -0,0 +1 @@
1
+ var o=function(o){var r=typeof o;return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==o:null===o};export{o as default};
@@ -0,0 +1 @@
1
+ import e from"./_coreJsData.js";var r,o=e,s=(r=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",t=function(e){return!!s&&s in e};export{t as default};
@@ -0,0 +1 @@
1
+ var t=function(){this.__data__=[],this.size=0};export{t as default};
@@ -0,0 +1 @@
1
+ import t from"./_assocIndexOf.js";var r=t,a=Array.prototype.splice,e=function(t){var e=this.__data__,o=r(e,t);return!(o<0||(o==e.length-1?e.pop():a.call(e,o,1),--this.size,0))};export{e as default};
@@ -0,0 +1 @@
1
+ import a from"./_assocIndexOf.js";var r=a,t=function(a){var t=this.__data__,o=r(t,a);return o<0?void 0:t[o][1]};export{t as default};
@@ -0,0 +1 @@
1
+ import t from"./_assocIndexOf.js";var a=t,r=function(t){return a(this.__data__,t)>-1};export{r as default};
@@ -0,0 +1 @@
1
+ import s from"./_assocIndexOf.js";var t=s,a=function(s,a){var r=this.__data__,i=t(r,s);return i<0?(++this.size,r.push([s,a])):r[i][1]=a,this};export{a as default};
@@ -0,0 +1 @@
1
+ import s from"./_Hash.js";import t from"./_ListCache.js";import a from"./_Map.js";var i=s,r=t,o=a,e=function(){this.size=0,this.__data__={hash:new i,map:new(o||r),string:new i}};export{e as default};
@@ -0,0 +1 @@
1
+ import t from"./_getMapData.js";var e=t,a=function(t){var a=e(this,t).delete(t);return this.size-=a?1:0,a};export{a as default};
@@ -0,0 +1 @@
1
+ import t from"./_getMapData.js";var a=t,r=function(t){return a(this,t).get(t)};export{r as default};
@@ -0,0 +1 @@
1
+ import t from"./_getMapData.js";var a=t,r=function(t){return a(this,t).has(t)};export{r as default};
@@ -0,0 +1 @@
1
+ import t from"./_getMapData.js";var s=t,e=function(t,e){var i=s(this,t),a=i.size;return i.set(t,e),this.size+=i.size==a?0:1,this};export{e as default};
@@ -0,0 +1 @@
1
+ import e from"./_getNative.js";var t=e(Object,"create");export{t as default};
@@ -0,0 +1 @@
1
+ import{_ as r}from"../../_virtual/_nodeUtil.js";import e from"./_freeGlobal.js";var t,i,o,n,p,s,u;t=r,o=e,n=(i=r.exports)&&!i.nodeType&&i,p=n&&t&&!t.nodeType&&t,s=p&&p.exports===n&&o.process,u=function(){try{return p&&p.require&&p.require("util").types||s&&s.binding&&s.binding("util")}catch(r){}}(),t.exports=u;
@@ -0,0 +1 @@
1
+ var t=Object.prototype.toString,r=function(r){return t.call(r)};export{r as default};
@@ -0,0 +1 @@
1
+ import e from"./_freeGlobal.js";var t=e,f="object"==typeof self&&self&&self.Object===Object&&self,l=t||f||Function("return this")();export{l as default};
@@ -0,0 +1 @@
1
+ var _=function(_){return this.__data__.set(_,"__lodash_hash_undefined__"),this};export{_ as default};
@@ -0,0 +1 @@
1
+ var a=function(a){return this.__data__.has(a)};export{a as default};
@@ -0,0 +1 @@
1
+ var r=function(r){var a=-1,n=Array(r.size);return r.forEach((function(r){n[++a]=r})),n};export{r as default};
@@ -0,0 +1 @@
1
+ var r=function(r,t,e){for(var n=e-1,a=r.length;++n<a;)if(r[n]===t)return n;return-1};export{r as default};
@@ -0,0 +1 @@
1
+ var t=Function.prototype.toString,r=function(r){if(null!=r){try{return t.call(r)}catch(t){}try{return r+""}catch(t){}}return""};export{r as default};
@@ -0,0 +1 @@
1
+ var r=function(r,t){return r===t||r!=r&&t!=t};export{r as default};
@@ -0,0 +1 @@
1
+ import r from"./_baseIsArguments.js";import e from"./isObjectLike.js";var t=r,o=Object.prototype;o.hasOwnProperty,o.propertyIsEnumerable;t(function(){return arguments}());
@@ -0,0 +1 @@
1
+ import{i as o}from"../../_virtual/isBuffer.js";import r from"./_root.js";import e from"./stubFalse.js";var s,f,i,t,p,m,u,a;s=o,f=o.exports,i=r,t=e,p=f&&!f.nodeType&&f,m=p&&s&&!s.nodeType&&s,u=m&&m.exports===p?i.Buffer:void 0,a=(u?u.isBuffer:void 0)||t,s.exports=a;
@@ -0,0 +1 @@
1
+ import t from"./_baseGetTag.js";import o from"./isObject.js";var r=t,e=o,n=function(t){if(!e(t))return!1;var o=r(t);return"[object Function]"==o||"[object GeneratorFunction]"==o||"[object AsyncFunction]"==o||"[object Proxy]"==o};export{n as default};
@@ -0,0 +1 @@
1
+ import"./_getTag.js";import"./_nodeUtil.js";import{_ as t}from"../../_virtual/_nodeUtil.js";var i=t.exports;i&&i.isMap;
@@ -0,0 +1 @@
1
+ var t=function(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)};export{t as default};
@@ -0,0 +1 @@
1
+ var t=function(t){return null!=t&&"object"==typeof t};export{t as default};
@@ -0,0 +1 @@
1
+ import"./_getTag.js";import"./_nodeUtil.js";import{_ as t}from"../../_virtual/_nodeUtil.js";var i=t.exports;i&&i.isSet;
@@ -0,0 +1 @@
1
+ import"./_baseGetTag.js";import"./_nodeUtil.js";import{_ as r}from"../../_virtual/_nodeUtil.js";var t=r.exports;t&&t.isTypedArray;
@@ -0,0 +1 @@
1
+ var a=function(){};export{a as default};
@@ -0,0 +1 @@
1
+ var r=function(){return!1};export{r as default};
@@ -0,0 +1 @@
1
+ import r from"./_baseUniq.js";var t=r,e=function(r){return r&&r.length?t(r):[]};export{e as default};
@@ -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,k,m,I,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,k=0;do{u=e.internalCustomDatas.length,e.internalCustomDatas.forEach((function(t){c.generateAllCustomDataTypes(t,e,a)})),(k=e.internalCustomDatas.length)!==u&&(e.internalCustomDatas=e.internalCustomDatas.splice(u,k))}while(u!==k);return[4,i.generate(a,e)];case 3:return t.sent(),m=s.join(p||process.cwd(),"src","components","__generated__"),e.imports=o(e.imports),I="import {\r\n",e.imports.forEach((function(e){I+="\t".concat(e,",\r\n")})),T=(I+='} from "@ikas/storefront"\r\n\r\n')+e.content,[4,r(m,"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.ENUM:r=c.generateTypeName(e),t.content.includes("export enum ".concat(r))||t.internalCustomDatas.push(e);break;case a.OBJECT:r=c.generateTypeName(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)}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"../../../ext/lodash/uniq.js";var c=function(){function c(){}return c.generate=function(a,p){return e(this,void 0,void 0,(function(){var e,u,k,m,I,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,k=0;do{u=e.internalCustomDatas.length,e.internalCustomDatas.forEach((function(t){c.generateAllCustomDataTypes(t,e,a)})),(k=e.internalCustomDatas.length)!==u&&(e.internalCustomDatas=e.internalCustomDatas.splice(u,k))}while(u!==k);return[4,i.generate(a,e)];case 3:return t.sent(),m=s.join(p||process.cwd(),"src","components","__generated__"),e.imports=o(e.imports),I="import {\r\n",e.imports.forEach((function(e){I+="\t".concat(e,",\r\n")})),T=(I+='} from "@ikas/storefront"\r\n\r\n')+e.content,[4,r(m,"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.ENUM:r=c.generateTypeName(e),t.content.includes("export enum ".concat(r))||t.internalCustomDatas.push(e);break;case a.OBJECT:r=c.generateTypeName(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)}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 +1 @@
1
- import{__awaiter as t,__generator as e,__spreadArray as r,__assign as o}from'./../ext/tslib/tslib.es6.js';import n from"fs";import s from"next/config.js";import{IkasThemeJsonPageType as i}from"@ikas/storefront-models";import{IkasPageDataProvider as c}from"@ikas/storefront-providers";import{IkasStorefrontConfig as a}from"@ikas/storefront-config";import{getStorefrontSettings as l,listMerchantSettings as u,setAPIClientConfig as p,listCheckoutSettings as d}from"@ikas/storefront-api";import{getGoogleFontHref as g}from"../utils/google-fonts.js";import{I18NFileReader as f}from"../utils/i18n.js";import{createFile as m,deleteDirContent as h}from"../utils/fs.js";var S=function(){function S(){}return S.readLocalTheme=function(){return new Promise((function(t,e){n.readFile("./src/theme.json",{flag:"a+"},(function(r,o){if(r)return e(r);var n=o.length?JSON.parse(o.toString()):{};t(n)}))}))},S.readSettingsFile=function(){return new Promise((function(t){var e=s().serverRuntimeConfig.SETTINGS;n.readFile(e,{flag:"a+"},(function(e,r){if(e)return console.error("SETTINGS FILE READ ERROR!!!"),console.error(e),t(null);var o=r.length?JSON.parse(r.toString()):{};t(o)}))}))},S.cacheLocalSettingsFile=function(r){return t(this,void 0,void 0,(function(){var t,o;return e(this,(function(e){switch(e.label){case 0:return[4,h(t=".ikas")];case 1:return e.sent(),o="settings-".concat(this.startTime,".json"),[4,m(t,o,JSON.stringify(r,null,2))];case 2:return e.sent(),[2]}}))}))},S.readLocalSettingsFile=function(){try{var t=n.readFileSync(".ikas/settings-".concat(this.startTime,".json"));if(t&&t.length)return JSON.parse(t.toString())}catch(t){}},S.getLocalSettings=function(r){return t(this,void 0,void 0,(function(){var t,o,n,s,i,c,a,u,p,d;return e(this,(function(e){switch(e.label){case 0:return[4,S.readLocalSettingsFile()];case 1:return(t=e.sent())?[3,4]:[4,l()];case 2:return(o=e.sent()).isSuccess&&o.data?(t=o.data,[4,this.cacheLocalSettingsFile(t)]):(console.error("Storefront settings fetch failed!"),console.error(o),[2,null]);case 3:e.sent(),e.label=4;case 4:return n=t.storefront,s=t.salesChannel,i=[],c=t.productBackInStockSettings?{customerLoginRequired:t.productBackInStockSettings.customerLoginRequired}:null,a=t.customerReviewSettings?{customerLoginRequired:t.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:t.customerReviewSettings.customerPurchaseRequired||!1}:null,[4,S.readLocalTheme()];case 5:return u=e.sent(),p=S.createColorScript(u.settings),d=S.createFontScript(u.settings),p&&i.push(p),d&&i.push(d),[2,{storefront:n,themeLocalization:{id:"",locale:"en",privacyPolicy:null,returnPolicy:null,storefrontId:n.id,storefrontThemeId:"",termsOfService:null,imprint:null,shippingPolicy:null,themeJson:u},salesChannel:s,routing:n.routings.length?n.routings.find((function(t){return t.locale===r||t.id===r}))||n.routings[0]:{countryCodes:[],domain:"",dynamicCurrencySettings:{roundingFormat:null,targetCurrencyCode:""},id:"",locale:"en",path:null,priceListId:null,currencyCode:"USD",currencySymbol:"$"},favicon:u.settings.favicon,stockPreference:u.settings.stockPreference,storefrontJSScripts:i,domain:"localhost:3333",productBackInStockSettings:c,customerReviewSettings:a,merchantSettings:t.merchantSettings,customerSettings:t.customerSettings}]}}))}))},S.getProdSettings=function(r){return t(this,void 0,void 0,(function(){var o=this;return e(this,(function(s){return[2,new Promise((function(s){return t(o,void 0,void 0,(function(){var t,o,i,c,a,l,p,d,g,f,m,h;return e(this,(function(e){switch(e.label){case 0:return[4,S.readSettingsFile()];case 1:return(t=e.sent())&&t.localizationMap?(o=t.storefront,i=t.salesChannel,c=t.localizationMap,a=t.storefrontJSScripts||[],l=t.domain,p=t.productBackInStockSettings?{customerLoginRequired:t.productBackInStockSettings.customerLoginRequired}:null,d=t.customerReviewSettings?{customerLoginRequired:t.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:t.customerReviewSettings.customerPurchaseRequired||!1}:null,(g=t.merchantSettings)?[3,3]:[4,u({})]):[2,s(null)];case 2:if(!(f=e.sent()).isSuccess||!f.data)return console.error("MERCHANT SETTINGS FETCH FAILED!"),[2,s(null)];g=f.data,e.label=3;case 3:return m=c[r],h=o.routings.find((function(t){return t.id===r||t.path===r})),m&&h?(n.readFile(m,{flag:"a+"},(function(e,r){if(e)return console.error("THEME LOCALIZATION FILE READ ERROR!!!"),console.error(e),s(null);var n=r.length?JSON.parse(r.toString()):{},c=n.themeJson.settings.favicon,u=n.themeJson.settings.stockPreference;if(n.themeJson.settings){var f=S.createColorScript(n.themeJson.settings),m=S.createFontScript(n.themeJson.settings);f&&a.push(f),m&&a.push(m)}var v=t.customerSettings;s({storefront:o,themeLocalization:n,salesChannel:i,routing:h,favicon:c,stockPreference:u,storefrontJSScripts:a,domain:l,productBackInStockSettings:p,customerReviewSettings:d,merchantSettings:g,customerSettings:v})})),[2]):(console.error("THEME LOCALIZATION PATH OR ROUTING MISSING!!!"),[2,s(null)])}}))}))}))]}))}))},S.getSettings=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return"local"===process.env.NEXT_PUBLIC_ENV?[4,this.getLocalSettings(r)]:[3,2];case 1:case 3:return[2,t.sent()];case 2:return[4,this.getProdSettings(r)]}}))}))},S.setStorefrontConfig=function(r){var o;return t(this,void 0,void 0,(function(){var t,n,s,i,c,l,u,d,g,f,m;return e(this,(function(e){return t=r.storefront,n=r.salesChannel,s=r.routing,i=r.favicon,c=r.stockPreference,l=r.storefrontJSScripts,u=r.domain,d=r.productBackInStockSettings,g=r.customerReviewSettings,f=r.merchantSettings,m=r.customerSettings,a.init({apiUrl:process.env.NEXT_PUBLIC_GQL_URL,adminApiUrl:process.env.NEXT_PUBLIC_UPLOAD_GQL_URL,cdnUrl:process.env.NEXT_PUBLIC_IMG_BASE_URL,storefrontId:t.id,storefrontRoutingId:s.id,storefrontThemeId:t.mainStorefrontThemeId,salesChannelId:t.salesChannelId,priceListId:s.priceListId||void 0,stockLocationIds:null===(o=n.stockLocations)||void 0===o?void 0:o.map((function(t){return t.id})),routings:t.routings,paymentGateways:n.paymentGateways||[],gtmId:t.gtmId||void 0,fbpId:t.fbpId||void 0,analytics4Id:t.analytics4Id||void 0,universalAnalyticsId:t.universalAnalyticsId||void 0,tiktokPixelId:t.tiktokPixelId||void 0,favicon:i||null,pickUpStockLocationIds:t.pickUpStockLocationIds&&t.pickUpStockLocationIds.length?t.pickUpStockLocationIds:null,stockPreference:c||null,storefrontJSScripts:l||[],domain:u,productBackInStockSettings:d,customerReviewSettings:g,merchantSettings:f,customerSettings:m,metaTemplates:t.metaTemplates||null}),p(),[2]}))}))},S.setTranslations=function(o,n,c,l){return t(this,void 0,void 0,(function(){var t,u,p,d,g,m,h,S;return e(this,(function(e){switch(e.label){case 0:return t=s().serverRuntimeConfig,u=o.routing,p="local"===process.env.NEXT_PUBLIC_ENV,d=o.themeLocalization.themeJson.components.filter((function(t){return l||n.includes(t.id)})),g=r(["common"],d.map((function(t){return t.dir})),!0),(c===i.CHECKOUT||l)&&g.push("checkout-page"),m=t.nextI18nConf,h=u.locale,[4,new f(h,g,p?void 0:m.localePath).read()];case 1:return S=e.sent(),a.init({translations:S}),[2]}}))}))},S.getExtraProps=function(r,o,n){var s,c,a;return t(this,void 0,void 0,(function(){var t,l,u,p,g;return e(this,(function(e){switch(e.label){case 0:return t={},l=r.themeLocalization,n!==i.CHECKOUT?[3,2]:(u=null===(s=o.page)||void 0===s?void 0:s.components[0])?[4,d({})]:[3,2];case 1:(p=e.sent()).isSuccess||(console.error("CHECKOUT SETTINGS FETCH FAILED!"),console.error(p.graphQLErrors),console.error(p.errorCodes)),g={showTax:null===(c=u.propValues.showTax)||void 0===c||c,buttonBgColor:u.propValues.buttonBgColor,buttonTextColor:u.propValues.buttonTextColor,buttonDisabledBgColor:u.propValues.buttonDisabledBgColor,buttonDisabledTextColor:u.propValues.buttonDisabledTextColor,primaryTextColor:u.propValues.primaryTextColor,secondaryTextColor:u.propValues.secondaryTextColor,primaryBgColor:u.propValues.primaryBgColor,secondaryBgColor:u.propValues.secondaryBgColor,borderColor:u.propValues.borderColor,cardBgColor:u.propValues.cardBgColor,errorColor:u.propValues.errorColor,errorLightColor:u.propValues.errorLightColor,warningColor:u.propValues.warningColor,warningLightColor:u.propValues.warningLightColor,successColor:u.propValues.successColor,successLightColor:u.propValues.successLightColor},t.customizationProps=g,t.returnPolicy=l.returnPolicy,t.privacyPolicy=l.privacyPolicy,t.termsOfService=l.termsOfService,t.imprint=l.imprint,t.shippingPolicy=l.shippingPolicy,t.checkoutSettings=(null===(a=null==p?void 0:p.data)||void 0===a?void 0:a.length)?p.data[0]:null,e.label=2;case 2:return[2,t]}}))}))},S.getPageData=function(r,n,s,i,l){var u;return t(this,void 0,void 0,(function(){var t,d,g,f,m,h,v,C;return e(this,(function(e){switch(e.label){case 0:return t="local"===process.env.NEXT_PUBLIC_ENV,d=!t&&l,a.init({apiUrl:process.env.NEXT_PUBLIC_GQL_URL,adminApiUrl:process.env.NEXT_PUBLIC_UPLOAD_GQL_URL,cdnUrl:process.env.NEXT_PUBLIC_IMG_BASE_URL}),p(),d?[3,7]:(g=r.locale)?[4,S.getSettings(g)]:[2,{props:{},notFound:!0}];case 1:return(f=e.sent())&&f.storefront.mainStorefrontThemeId&&f.storefront.salesChannelId?[4,this.setStorefrontConfig(f)]:[2,{props:{},notFound:!0}];case 2:return e.sent(),m=f.themeLocalization,(h=new c(m.themeJson,r.params,s)).possiblePageTypes=i||(s?[s]:[]),l?[3,4]:[4,h.getPageData()];case 3:if(e.sent(),!h.page)return[2,{props:{},notFound:!0}];e.label=4;case 4:return v=l?h.theme.components.map((function(t){return t.id})):(null===(u=h.page)||void 0===u?void 0:u.components.map((function(t){return t.componentId})))||[],[4,this.setTranslations(f,v,s,l)];case 5:return e.sent(),[4,this.getExtraProps(f,h,s)];case 6:return C=e.sent(),n?[2,{props:o(o({},h.nextPageData.props),C)}]:[2,{props:o(o({},h.nextPageData.props),C),revalidate:60}];case 7:return[2,{props:{}}];case 8:return[2]}}))}))},S.getStaticProps=function(r,o,n,s){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,S.getPageData(r,!1,o,n,s)];case 1:return[2,t.sent()]}}))}))},S.getServerSideProps=function(r,o){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,S.getPageData(r,!0,o)];case 1:return[2,t.sent()]}}))}))},S.createColorScript=function(t){if(t.colors)return"<script>".concat(t.colors.map((function(t){return'document.documentElement.style.setProperty("'.concat(t.key,'","').concat(t.color,'");')})).join("\r\n"),"<\/script> \n ")},S.createFontScript=function(t){var e=g(t.fontFamily);if(e)return'<link id="ikas-font" rel="stylesheet" href="'.concat(e,"\"> \n <style>\n body { \n font-family: '").concat(t.fontFamily.name,'\', -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;\n } \n </style>')},S.startTime=Date.now(),S}();export{S as IkasNextPageDataProvider};
1
+ import{__awaiter as t,__generator as e,__spreadArray as r,__assign as n}from'./../ext/tslib/tslib.es6.js';import o from"fs";import i from"next/config.js";import{IkasThemeJsonPageType as s}from"@ikas/storefront-models";import{IkasPageDataProvider as c}from"@ikas/storefront-providers";import{IkasStorefrontConfig as a}from"@ikas/storefront-config";import{getStorefrontSettings as u,listMerchantSettings as l,setAPIClientConfig as p,listCheckoutSettings as d}from"@ikas/storefront-api";import{getGoogleFontHref as g}from"../utils/google-fonts.js";import{I18NFileReader as f}from"../utils/i18n.js";import{createFile as m,deleteDirContent as h}from"../utils/fs.js";var S=function(){function S(){}return S.readLocalTheme=function(){return new Promise((function(t,e){o.readFile("./src/theme.json",{flag:"a+"},(function(r,n){if(r)return e(r);var o=n.length?JSON.parse(n.toString()):{};t(o)}))}))},S.readSettingsFile=function(){return new Promise((function(t){var e=i().serverRuntimeConfig.SETTINGS;o.readFile(e,{flag:"a+"},(function(e,r){if(e)return console.error("SETTINGS FILE READ ERROR!!!"),console.error(e),t(null);var n=r.length?JSON.parse(r.toString()):{};t(n)}))}))},S.cacheLocalSettingsFile=function(r){return t(this,void 0,void 0,(function(){var t,n;return e(this,(function(e){switch(e.label){case 0:return[4,h(t=".ikas")];case 1:return e.sent(),n="settings-".concat(this.startTime,".json"),[4,m(t,n,JSON.stringify(r,null,2))];case 2:return e.sent(),[2]}}))}))},S.readLocalSettingsFile=function(){try{var t=o.readFileSync(".ikas/settings-".concat(this.startTime,".json"));if(t&&t.length)return JSON.parse(t.toString())}catch(t){}},S.getLocalSettings=function(r){return t(this,void 0,void 0,(function(){var t,n,o,i,s,c,a,l,p,d;return e(this,(function(e){switch(e.label){case 0:return[4,S.readLocalSettingsFile()];case 1:return(t=e.sent())?[3,4]:[4,u()];case 2:return(n=e.sent()).isSuccess&&n.data?(t=n.data,[4,this.cacheLocalSettingsFile(t)]):(console.error("Storefront settings fetch failed!"),console.error(n),[2,null]);case 3:e.sent(),e.label=4;case 4:return o=t.storefront,i=t.salesChannel,s=[],c=t.productBackInStockSettings?{customerLoginRequired:t.productBackInStockSettings.customerLoginRequired}:null,a=t.customerReviewSettings?{customerLoginRequired:t.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:t.customerReviewSettings.customerPurchaseRequired||!1}:null,[4,S.readLocalTheme()];case 5:return l=e.sent(),p=S.createColorScript(l.settings),d=S.createFontScript(l.settings),p&&s.push(p),d&&s.push(d),[2,{storefront:o,themeLocalization:{id:"",locale:"en",privacyPolicy:null,returnPolicy:null,storefrontId:o.id,storefrontThemeId:"",termsOfService:null,imprint:null,shippingPolicy:null,themeJson:l},salesChannel:i,routing:o.routings.length?o.routings.find((function(t){return t.locale===r||t.id===r}))||o.routings[0]:{countryCodes:[],domain:"",dynamicCurrencySettings:{roundingFormat:null,targetCurrencyCode:""},id:"",locale:"en",path:null,priceListId:null,currencyCode:"USD",currencySymbol:"$"},favicon:l.settings.favicon,stockPreference:l.settings.stockPreference,storefrontJSScripts:s,domain:"localhost:3333",productBackInStockSettings:c,customerReviewSettings:a,merchantSettings:t.merchantSettings,customerSettings:t.customerSettings}]}}))}))},S.getProdSettings=function(r){return t(this,void 0,void 0,(function(){var n=this;return e(this,(function(i){return[2,new Promise((function(i){return t(n,void 0,void 0,(function(){var t,n,s,c,a,u,p,d,g,f,m,h;return e(this,(function(e){switch(e.label){case 0:return[4,S.readSettingsFile()];case 1:return(t=e.sent())&&t.localizationMap?(n=t.storefront,s=t.salesChannel,c=t.localizationMap,a=t.storefrontJSScripts||[],u=t.domain,p=t.productBackInStockSettings?{customerLoginRequired:t.productBackInStockSettings.customerLoginRequired}:null,d=t.customerReviewSettings?{customerLoginRequired:t.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:t.customerReviewSettings.customerPurchaseRequired||!1}:null,(g=t.merchantSettings)?[3,3]:[4,l({})]):[2,i(null)];case 2:if(!(f=e.sent()).isSuccess||!f.data)return console.error("MERCHANT SETTINGS FETCH FAILED!"),[2,i(null)];g=f.data,e.label=3;case 3:return m=c[r],h=n.routings.find((function(t){return t.id===r||t.path===r})),m&&h?(o.readFile(m,{flag:"a+"},(function(e,r){if(e)return console.error("THEME LOCALIZATION FILE READ ERROR!!!"),console.error(e),i(null);var o=r.length?JSON.parse(r.toString()):{},c=o.themeJson.settings.favicon,l=o.themeJson.settings.stockPreference;if(o.themeJson.settings){var f=S.createColorScript(o.themeJson.settings),m=S.createFontScript(o.themeJson.settings);f&&a.push(f),m&&a.push(m)}var v=t.customerSettings;i({storefront:n,themeLocalization:o,salesChannel:s,routing:h,favicon:c,stockPreference:l,storefrontJSScripts:a,domain:u,productBackInStockSettings:p,customerReviewSettings:d,merchantSettings:g,customerSettings:v})})),[2]):(console.error("THEME LOCALIZATION PATH OR ROUTING MISSING!!!"),[2,i(null)])}}))}))}))]}))}))},S.getSettings=function(r){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return"local"===process.env.NEXT_PUBLIC_ENV?[4,this.getLocalSettings(r)]:[3,2];case 1:case 3:return[2,t.sent()];case 2:return[4,this.getProdSettings(r)]}}))}))},S.setStorefrontConfig=function(r){var n;return t(this,void 0,void 0,(function(){var t,o,i,s,c,u,l,d,g,f,m;return e(this,(function(e){return t=r.storefront,o=r.salesChannel,i=r.routing,s=r.favicon,c=r.stockPreference,u=r.storefrontJSScripts,l=r.domain,d=r.productBackInStockSettings,g=r.customerReviewSettings,f=r.merchantSettings,m=r.customerSettings,a.init({apiUrl:process.env.NEXT_PUBLIC_GQL_URL,adminApiUrl:process.env.NEXT_PUBLIC_UPLOAD_GQL_URL,cdnUrl:process.env.NEXT_PUBLIC_IMG_BASE_URL,storefrontId:t.id,storefrontRoutingId:i.id,storefrontThemeId:t.mainStorefrontThemeId,salesChannelId:t.salesChannelId,priceListId:i.priceListId||void 0,stockLocationIds:null===(n=o.stockLocations)||void 0===n?void 0:n.map((function(t){return t.id})),routings:t.routings,paymentGateways:o.paymentGateways||[],gtmId:t.gtmId||void 0,fbpId:t.fbpId||void 0,analytics4Id:t.analytics4Id||void 0,universalAnalyticsId:t.universalAnalyticsId||void 0,tiktokPixelId:t.tiktokPixelId||void 0,favicon:s||null,pickUpStockLocationIds:t.pickUpStockLocationIds&&t.pickUpStockLocationIds.length?t.pickUpStockLocationIds:null,stockPreference:c||null,storefrontJSScripts:u||[],domain:l,productBackInStockSettings:d,customerReviewSettings:g,merchantSettings:f,customerSettings:m,metaTemplates:t.metaTemplates||null}),p(),[2]}))}))},S.setTranslations=function(n,o,c,u){return t(this,void 0,void 0,(function(){var t,l,p,d,g,m,h,S;return e(this,(function(e){switch(e.label){case 0:return t=i().serverRuntimeConfig,l=n.routing,p="local"===process.env.NEXT_PUBLIC_ENV,d=n.themeLocalization.themeJson.components.filter((function(t){return u||o.includes(t.id)})),g=r(["common"],d.map((function(t){return t.dir})),!0),(c===s.CHECKOUT||u)&&g.push("checkout-page"),m=t.nextI18nConf,h=l.locale,[4,new f(h,g,p?void 0:m.localePath).read()];case 1:return S=e.sent(),a.init({translations:S}),[2]}}))}))},S.getExtraProps=function(r,n,o){var i,c,a;return t(this,void 0,void 0,(function(){var t,u,l,p,g;return e(this,(function(e){switch(e.label){case 0:return t={},u=r.themeLocalization,o!==s.CHECKOUT?[3,2]:(l=null===(i=n.page)||void 0===i?void 0:i.components[0])?[4,d({})]:[3,2];case 1:p=e.sent(),g={showTax:null===(c=l.propValues.showTax)||void 0===c||c,buttonBgColor:l.propValues.buttonBgColor,buttonTextColor:l.propValues.buttonTextColor,buttonDisabledBgColor:l.propValues.buttonDisabledBgColor,buttonDisabledTextColor:l.propValues.buttonDisabledTextColor,primaryTextColor:l.propValues.primaryTextColor,secondaryTextColor:l.propValues.secondaryTextColor,primaryBgColor:l.propValues.primaryBgColor,secondaryBgColor:l.propValues.secondaryBgColor,borderColor:l.propValues.borderColor,cardBgColor:l.propValues.cardBgColor,errorColor:l.propValues.errorColor,errorLightColor:l.propValues.errorLightColor,warningColor:l.propValues.warningColor,warningLightColor:l.propValues.warningLightColor,successColor:l.propValues.successColor,successLightColor:l.propValues.successLightColor},t.customizationProps=g,t.returnPolicy=u.returnPolicy,t.privacyPolicy=u.privacyPolicy,t.termsOfService=u.termsOfService,t.imprint=u.imprint,t.shippingPolicy=u.shippingPolicy,t.checkoutSettings=(null===(a=null==p?void 0:p.data)||void 0===a?void 0:a.length)?p.data[0]:null,e.label=2;case 2:return[2,t]}}))}))},S.getPageData=function(r,o,i,s,u){var l;return t(this,void 0,void 0,(function(){var t,d,g,f,m,h,v,C;return e(this,(function(e){switch(e.label){case 0:return t="local"===process.env.NEXT_PUBLIC_ENV,d=!t&&u,a.init({apiUrl:process.env.NEXT_PUBLIC_GQL_URL,adminApiUrl:process.env.NEXT_PUBLIC_UPLOAD_GQL_URL,cdnUrl:process.env.NEXT_PUBLIC_IMG_BASE_URL}),p(),d?[3,7]:(g=r.locale)?[4,S.getSettings(g)]:[2,{props:{},notFound:!0}];case 1:return(f=e.sent())&&f.storefront.mainStorefrontThemeId&&f.storefront.salesChannelId?[4,this.setStorefrontConfig(f)]:[2,{props:{},notFound:!0}];case 2:return e.sent(),m=f.themeLocalization,(h=new c(m.themeJson,r.params,i)).possiblePageTypes=s||(i?[i]:[]),u?[3,4]:[4,h.getPageData()];case 3:if(e.sent(),!h.page)return[2,{props:{},notFound:!0}];e.label=4;case 4:return v=u?h.theme.components.map((function(t){return t.id})):(null===(l=h.page)||void 0===l?void 0:l.components.map((function(t){return t.componentId})))||[],[4,this.setTranslations(f,v,i,u)];case 5:return e.sent(),[4,this.getExtraProps(f,h,i)];case 6:return C=e.sent(),o?[2,{props:n(n({},h.nextPageData.props),C)}]:[2,{props:n(n({},h.nextPageData.props),C),revalidate:60}];case 7:return[2,{props:{}}];case 8:return[2]}}))}))},S.getStaticProps=function(r,n,o,i){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,S.getPageData(r,!1,n,o,i)];case 1:return[2,t.sent()]}}))}))},S.getServerSideProps=function(r,n){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,S.getPageData(r,!0,n)];case 1:return[2,t.sent()]}}))}))},S.createColorScript=function(t){if(t.colors)return"<script>".concat(t.colors.map((function(t){return'document.documentElement.style.setProperty("'.concat(t.key,'","').concat(t.color,'");')})).join("\r\n"),"<\/script> \n ")},S.createFontScript=function(t){var e=g(t.fontFamily);if(e)return'<link id="ikas-font" rel="stylesheet" href="'.concat(e,"\"> \n <style>\n body { \n font-family: '").concat(t.fontFamily.name,'\', -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;\n } \n </style>')},S.startTime=Date.now(),S}();export{S as IkasNextPageDataProvider};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from'./../ext/tslib/tslib.es6.js';import r from"fs";import s from"path";var o="checkout-page",n=function(){function o(e,t,r){this.locale=e,this.namespaces=t,this.localePath=r}return o.prototype.read=function(){return e(this,void 0,void 0,(function(){var e,o,n,a,c,i,l,u,h;return t(this,(function(t){switch(t.label){case 0:e={},o=0,n=this.namespaces,t.label=1;case 1:if(!(o<n.length))return[3,14];a=n[o],t.label=2;case 2:return t.trys.push([2,12,,13]),c=this.localePath?s.join(this.localePath,this.locale,a+".json"):s.join(process.cwd(),"public","locales",this.locale,a+".json"),r.existsSync(c)?[4,this.readLocaleFile(c)]:[3,4];case 3:return i=t.sent(),e[a]=i,[3,11];case 4:return"checkout-page"!==a?[3,11]:(l={},"tr"!==this.locale?[3,6]:[4,import("@ikas/storefront-assets/checkout/tr.js")]);case 5:return u=t.sent(),l=u.default,[3,10];case 6:return"de"!==this.locale?[3,8]:[4,import("@ikas/storefront-assets/checkout/de.js")];case 7:return u=t.sent(),l=u.default,[3,10];case 8:return[4,import("@ikas/storefront-assets/checkout/en.js")];case 9:u=t.sent(),l=u.default,t.label=10;case 10:e[a]=l,t.label=11;case 11:return[3,13];case 12:return h=t.sent(),console.error("I18N FILE READ ERROR!"),console.error(h),[3,13];case 13:return o++,[3,1];case 14:return[2,e]}}))}))},o.prototype.readLocaleFile=function(s){return e(this,void 0,void 0,(function(){return t(this,(function(e){return[2,new Promise((function(e,t){r.readFile(s,{flag:"r"},(function(r,s){if(r)return t(r);var o=s.length?JSON.parse(s.toString()):{};e(o)}))}))]}))}))},o}();export{o as CHECKOUT_TRANSLATION_NAMESPACE,n as I18NFileReader};
1
+ import{__awaiter as e,__generator as t}from'./../ext/tslib/tslib.es6.js';import s from"fs";import r from"path";var o="checkout-page",n=function(){function o(e,t,s){this.locale=e,this.namespaces=t,this.localePath=s}return o.prototype.read=function(){return e(this,void 0,void 0,(function(){var e,o,n,a,c,i,l,u,h;return t(this,(function(t){switch(t.label){case 0:e={},o=0,n=this.namespaces,t.label=1;case 1:if(!(o<n.length))return[3,14];a=n[o],t.label=2;case 2:return t.trys.push([2,12,,13]),c=this.localePath?r.join(this.localePath,this.locale,a+".json"):r.join(process.cwd(),"public","locales",this.locale,a+".json"),s.existsSync(c)?[4,this.readLocaleFile(c)]:[3,4];case 3:return i=t.sent(),e[a]=i,[3,11];case 4:return"checkout-page"!==a?[3,11]:(l={},"tr"!==this.locale?[3,6]:[4,import("@ikas/storefront-assets/checkout/tr.js")]);case 5:return u=t.sent(),l=u.default,[3,10];case 6:return"de"!==this.locale?[3,8]:[4,import("@ikas/storefront-assets/checkout/de.js")];case 7:return u=t.sent(),l=u.default,[3,10];case 8:return[4,import("@ikas/storefront-assets/checkout/en.js")];case 9:u=t.sent(),l=u.default,t.label=10;case 10:e[a]=l,t.label=11;case 11:return[3,13];case 12:return h=t.sent(),console.error(h),[3,13];case 13:return o++,[3,1];case 14:return[2,e]}}))}))},o.prototype.readLocaleFile=function(r){return e(this,void 0,void 0,(function(){return t(this,(function(e){return[2,new Promise((function(e,t){s.readFile(r,{flag:"r"},(function(s,r){if(s)return t(s);var o=r.length?JSON.parse(r.toString()):{};e(o)}))}))]}))}))},o}();export{o as CHECKOUT_TRANSLATION_NAMESPACE,n as I18NFileReader};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront-next",
3
- "version": "4.0.0-beta.26",
3
+ "version": "4.0.0-beta.3",
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": "^4.0.0-beta.26",
21
- "@ikas/storefront-providers": "^4.0.0-beta.26",
22
- "@ikas/storefront-models": "^4.0.0-beta.26",
23
- "@ikas/storefront-api": "^4.0.0-beta.26",
24
- "@ikas/storefront-assets": "^4.0.0-beta.26",
20
+ "@ikas/storefront-config": "^4.0.0-beta.3",
21
+ "@ikas/storefront-providers": "^4.0.0-beta.3",
22
+ "@ikas/storefront-models": "^4.0.0-beta.3",
23
+ "@ikas/storefront-api": "^4.0.0-beta.3",
24
+ "@ikas/storefront-assets": "^4.0.0-beta.3",
25
25
  "axios": "^0.21.0",
26
26
  "lodash": "^4.17.21",
27
27
  "archiver": "^5.3.0",
28
28
  "cors": "^2.8.5"
29
29
  },
30
30
  "devDependencies": {
31
- "@ikas/storefront-cmd": "^4.0.0-beta.26",
32
- "@ikas/storefront-config": "^4.0.0-beta.26",
33
- "@ikas/storefront-providers": "^4.0.0-beta.26",
34
- "@ikas/storefront-models": "^4.0.0-beta.26",
35
- "@ikas/storefront-api": "^4.0.0-beta.26",
36
- "@ikas/storefront-assets": "^4.0.0-beta.26",
31
+ "@ikas/storefront-cmd": "^4.0.0-beta.3",
32
+ "@ikas/storefront-config": "^4.0.0-beta.3",
33
+ "@ikas/storefront-providers": "^4.0.0-beta.3",
34
+ "@ikas/storefront-models": "^4.0.0-beta.3",
35
+ "@ikas/storefront-api": "^4.0.0-beta.3",
36
+ "@ikas/storefront-assets": "^4.0.0-beta.3",
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",