@ikas/storefront-next 4.0.0-alpha.9 → 4.0.0-beta.10

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 (110) hide show
  1. package/build/api/getComponentDirs.d.ts +3 -0
  2. package/build/api/getComponentDirs.js +1 -0
  3. package/build/api/getTheme.d.ts +3 -0
  4. package/build/api/getTheme.js +1 -0
  5. package/{src/api/index.ts → build/api/index.d.ts} +11 -14
  6. package/build/api/index.js +1 -0
  7. package/build/api/middleware.d.ts +3 -0
  8. package/build/api/middleware.js +1 -0
  9. package/build/api/updateTheme.d.ts +9 -0
  10. package/build/api/updateTheme.js +1 -0
  11. package/build/api/uploadTheme.d.ts +3 -0
  12. package/build/api/uploadTheme.js +1 -0
  13. package/build/ext/tslib/tslib.es6.js +1 -0
  14. package/{src/index.ts → build/index.d.ts} +4 -4
  15. package/build/index.js +1 -0
  16. package/build/packages/cmd/build/ext/tslib/tslib.es6.js +1 -0
  17. package/build/packages/cmd/build/scripts/generators/api/index.js +1 -0
  18. package/build/packages/cmd/build/scripts/generators/api/info.js +1 -0
  19. package/build/packages/cmd/build/scripts/generators/components/index.js +1 -0
  20. package/build/packages/cmd/build/scripts/generators/pages/index.js +1 -0
  21. package/build/packages/cmd/build/scripts/generators/pages/info.js +1 -0
  22. package/build/packages/cmd/build/scripts/generators/theme/index.js +1 -0
  23. package/build/packages/cmd/build/scripts/generators/types/index.js +1 -0
  24. package/build/packages/cmd/build/utils/fs.js +1 -0
  25. package/build/packages/cmd/build/utils/helper.js +1 -0
  26. package/build/pages/404.d.ts +2 -0
  27. package/build/pages/404.js +1 -0
  28. package/build/pages/[slug]/index.d.ts +3 -0
  29. package/build/pages/_slug_/index.js +1 -0
  30. package/build/pages/account/addresses.d.ts +2 -0
  31. package/build/pages/account/addresses.js +1 -0
  32. package/build/pages/account/favorite-products.d.ts +2 -0
  33. package/build/pages/account/favorite-products.js +1 -0
  34. package/build/pages/account/forgot-password.d.ts +2 -0
  35. package/build/pages/account/forgot-password.js +1 -0
  36. package/build/pages/account/index.d.ts +2 -0
  37. package/build/pages/account/index.js +1 -0
  38. package/build/pages/account/login.d.ts +2 -0
  39. package/build/pages/account/login.js +1 -0
  40. package/build/pages/account/orders/[id].d.ts +2 -0
  41. package/build/pages/account/orders/_id_.js +1 -0
  42. package/build/pages/account/orders/index.d.ts +2 -0
  43. package/build/pages/account/orders/index.js +1 -0
  44. package/build/pages/account/raffles.d.ts +2 -0
  45. package/build/pages/account/raffles.js +1 -0
  46. package/build/pages/account/recover-password.d.ts +2 -0
  47. package/build/pages/account/recover-password.js +1 -0
  48. package/build/pages/account/register.d.ts +2 -0
  49. package/build/pages/account/register.js +1 -0
  50. package/build/pages/blog/[slug].d.ts +3 -0
  51. package/build/pages/blog/_slug_.js +1 -0
  52. package/build/pages/blog/index.d.ts +2 -0
  53. package/build/pages/blog/index.js +1 -0
  54. package/build/pages/cart.d.ts +2 -0
  55. package/build/pages/cart.js +1 -0
  56. package/build/pages/checkout.d.ts +2 -0
  57. package/build/pages/checkout.js +1 -0
  58. package/build/pages/editor.d.ts +2 -0
  59. package/build/pages/editor.js +1 -0
  60. package/build/pages/home.d.ts +2 -0
  61. package/build/pages/home.js +1 -0
  62. package/{src/pages/index.ts → build/pages/index.d.ts} +22 -22
  63. package/build/pages/pages/[slug].d.ts +3 -0
  64. package/build/pages/pages/_slug_.js +1 -0
  65. package/build/pages/raffle/[slug].d.ts +3 -0
  66. package/build/pages/raffle/_slug_.js +1 -0
  67. package/build/pages/raffle/index.d.ts +2 -0
  68. package/build/pages/raffle/index.js +1 -0
  69. package/build/pages/search.d.ts +2 -0
  70. package/build/pages/search.js +1 -0
  71. package/build/provider/page-data-next.d.ts +94 -0
  72. package/build/provider/page-data-next.js +1 -0
  73. package/build/utils/fs.d.ts +28 -0
  74. package/build/utils/fs.js +1 -0
  75. package/build/utils/google-fonts.d.ts +2 -0
  76. package/build/utils/google-fonts.js +1 -0
  77. package/build/utils/i18n.d.ts +9 -0
  78. package/build/utils/i18n.js +1 -0
  79. package/package.json +19 -18
  80. package/src/api/getComponentDirs.ts +0 -39
  81. package/src/api/getTheme.ts +0 -22
  82. package/src/api/middleware.ts +0 -24
  83. package/src/api/updateTheme.ts +0 -33
  84. package/src/api/uploadTheme.ts +0 -307
  85. package/src/pages/404.tsx +0 -18
  86. package/src/pages/[slug]/index.tsx +0 -18
  87. package/src/pages/account/addresses.tsx +0 -10
  88. package/src/pages/account/favorite-products.tsx +0 -10
  89. package/src/pages/account/forgot-password.tsx +0 -10
  90. package/src/pages/account/index.tsx +0 -10
  91. package/src/pages/account/login.tsx +0 -10
  92. package/src/pages/account/orders/[id].tsx +0 -10
  93. package/src/pages/account/orders/index.tsx +0 -10
  94. package/src/pages/account/raffles.tsx +0 -10
  95. package/src/pages/account/recover-password.tsx +0 -10
  96. package/src/pages/account/register.tsx +0 -10
  97. package/src/pages/blog/[slug].tsx +0 -17
  98. package/src/pages/blog/index.tsx +0 -10
  99. package/src/pages/cart.tsx +0 -10
  100. package/src/pages/checkout.tsx +0 -10
  101. package/src/pages/editor.tsx +0 -11
  102. package/src/pages/home.tsx +0 -10
  103. package/src/pages/pages/[slug].tsx +0 -72
  104. package/src/pages/raffle/[slug].tsx +0 -17
  105. package/src/pages/raffle/index.tsx +0 -10
  106. package/src/pages/search.tsx +0 -10
  107. package/src/provider/page-data-next.ts +0 -618
  108. package/src/utils/fs.ts +0 -93
  109. package/src/utils/google-fonts.ts +0 -52
  110. package/src/utils/i18n.ts +0 -80
@@ -0,0 +1,3 @@
1
+ import { NextApiRequest, NextApiResponse } from "next";
2
+ export declare const getComponentDirs: (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
3
+ export declare const config: {};
@@ -0,0 +1 @@
1
+ import{__awaiter as r,__generator as t}from'./../ext/tslib/tslib.es6.js';import e from"fs";import n from"path";import{corsMiddleware as o}from"./middleware.js";var i=function(i,s){return r(void 0,void 0,void 0,(function(){var r;return t(this,(function(t){switch(t.label){case 0:return[4,o(i,s)];case 1:return t.sent(),[4,new Promise((function(r,t){var o=n.join(process.cwd(),"src","components");e.readdir(o,(function(i,s){if(i)return t(i);r(s.filter((function(r){return e.lstatSync(n.join(o,r)).isDirectory()})))}))}))];case 2:return r=t.sent(),s.statusCode=200,s.setHeader("Content-Type","application/json"),s.json({componentDirNames:r.filter((function(r){return"__generated__"!==r}))}),[2]}}))}))},s={};export{s as config,i as getComponentDirs};
@@ -0,0 +1,3 @@
1
+ import { NextApiRequest, NextApiResponse } from "next";
2
+ export declare const getTheme: (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
3
+ export declare const config: {};
@@ -0,0 +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,14 +1,11 @@
1
- // API
2
- import * as GetComponentDirs from "./getComponentDirs";
3
- import * as GetTheme from "./getTheme";
4
- import * as UpdateTheme from "./updateTheme";
5
- import * as UploadTheme from "./uploadTheme";
6
-
7
- const IkasLocalThemeAPI = {
8
- GetComponentDirs,
9
- GetTheme,
10
- UpdateTheme,
11
- UploadTheme,
12
- };
13
-
14
- export { IkasLocalThemeAPI };
1
+ import * as GetComponentDirs from "./getComponentDirs";
2
+ import * as GetTheme from "./getTheme";
3
+ import * as UpdateTheme from "./updateTheme";
4
+ import * as UploadTheme from "./uploadTheme";
5
+ declare const IkasLocalThemeAPI: {
6
+ GetComponentDirs: typeof GetComponentDirs;
7
+ GetTheme: typeof GetTheme;
8
+ UpdateTheme: typeof UpdateTheme;
9
+ UploadTheme: typeof UploadTheme;
10
+ };
11
+ export { IkasLocalThemeAPI };
@@ -0,0 +1 @@
1
+ import*as e from"./getComponentDirs.js";import*as m from"./getTheme.js";import*as o from"./updateTheme.js";import*as t from"./uploadTheme.js";var r={GetComponentDirs:e,GetTheme:m,UpdateTheme:o,UploadTheme:t};export{r as IkasLocalThemeAPI};
@@ -0,0 +1,3 @@
1
+ import { NextApiRequest, NextApiResponse } from "next";
2
+ export declare function runMiddleware(req: NextApiRequest, res: NextApiResponse, fn: any): Promise<unknown>;
3
+ export declare function corsMiddleware(req: NextApiRequest, res: NextApiResponse): Promise<unknown>;
@@ -0,0 +1 @@
1
+ import r from"cors";var n=r();function o(r,n,o){return new Promise((function(t,e){o(r,n,(function(r){return r instanceof Error?e(r):t(r)}))}))}function t(r,t){return o(r,t,n)}export{t as corsMiddleware,o as runMiddleware};
@@ -0,0 +1,9 @@
1
+ import { NextApiRequest, NextApiResponse } from "next";
2
+ export declare const updateTheme: (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
3
+ export declare const config: {
4
+ api: {
5
+ bodyParser: {
6
+ sizeLimit: string;
7
+ };
8
+ };
9
+ };
@@ -0,0 +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};
@@ -0,0 +1,3 @@
1
+ import { NextApiRequest, NextApiResponse } from "next";
2
+ export declare const uploadTheme: (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
3
+ export declare const config: {};
@@ -0,0 +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};
@@ -0,0 +1 @@
1
+ var n=function(){return n=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++)for(var o in t=arguments[e])Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n},n.apply(this,arguments)};function t(n,t,e,r){return new(e||(e=Promise))((function(o,a){function l(n){try{i(r.next(n))}catch(n){a(n)}}function c(n){try{i(r.throw(n))}catch(n){a(n)}}function i(n){var t;n.done?o(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(l,c)}i((r=r.apply(n,t||[])).next())}))}function e(n,t){var e,r,o,a,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(e)throw new TypeError("Generator is already executing.");for(;l;)try{if(e=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!(o=l.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(n,l)}catch(n){a=[6,n],r=0}finally{e=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function r(n,t,e){if(e||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return n.concat(r||Array.prototype.slice.call(t))}export{n as __assign,t as __awaiter,e as __generator,r as __spreadArray};
@@ -1,4 +1,4 @@
1
- export * from "./api";
2
- export * from "./pages";
3
- export * from "./provider/page-data-next";
4
- export { getGoogleFontHref } from "./utils/google-fonts";
1
+ export * from "./api";
2
+ export * from "./pages";
3
+ export * from "./provider/page-data-next";
4
+ export { getGoogleFontHref } from "./utils/google-fonts";
package/build/index.js ADDED
@@ -0,0 +1 @@
1
+ export{IkasLocalThemeAPI}from"./api/index.js";import*as a from"./pages/home.js";export{a as IndexPage};import*as s from"./pages/_slug_/index.js";export{s as SlugPage};import*as o from"./pages/pages/_slug_.js";export{o as CustomPage};import*as e from"./pages/checkout.js";export{e as CheckoutPage};import*as r from"./pages/account/index.js";export{r as AccountPage};import*as t from"./pages/account/addresses.js";export{t as AddressesPage};import*as p from"./pages/account/orders/index.js";export{p as OrdersPage};import*as g from"./pages/account/orders/_id_.js";export{g as OrderDetailPage};import*as m from"./pages/account/login.js";export{m as LoginPage};import*as i from"./pages/account/register.js";export{i as RegisterPage};import*as f from"./pages/account/forgot-password.js";export{f as ForgotPasswordPage};import*as c from"./pages/account/recover-password.js";export{c as RecoverPasswordPage};import*as x from"./pages/cart.js";export{x as CartPage};import*as d from"./pages/editor.js";export{d as EditorPage};import*as P from"./pages/account/favorite-products.js";export{P as FavoriteProductsPage};import*as j from"./pages/search.js";export{j as SearchPage};import*as n from"./pages/404.js";export{n as NotFoundPage};import*as u from"./pages/blog/index.js";export{u as BlogPage};import*as l from"./pages/blog/_slug_.js";export{l as BlogSlugPage};import*as _ from"./pages/raffle/_slug_.js";export{_ as RafflePage};import*as h from"./pages/raffle/index.js";export{h as RafflesPage};import*as v from"./pages/account/raffles.js";export{v as AccountRafflesPage};export{IkasNextPageDataProvider}from"./provider/page-data-next.js";export{getGoogleFontHref}from"./utils/google-fonts.js";
@@ -0,0 +1 @@
1
+ function e(e,n,t,r){return new(t||(t=Promise))((function(o,a){function l(e){try{i(r.next(e))}catch(e){a(e)}}function c(e){try{i(r.throw(e))}catch(e){a(e)}}function i(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(l,c)}i((r=r.apply(e,n||[])).next())}))}function n(e,n){var t,r,o,a,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;l;)try{if(t=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!((o=(o=l.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=n.call(e,l)}catch(e){a=[6,e],r=0}finally{t=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function t(e,n,t){if(t||2===arguments.length)for(var r,o=0,a=n.length;o<a;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}export{e as __awaiter,n as __generator,t as __spreadArray};
@@ -0,0 +1 @@
1
+ import{__awaiter as e,__generator as t}from"../../../ext/tslib/tslib.es6.js";import r from"path";import{createFile as n,deleteDirContent as s}from"../../../utils/fs.js";import{API_INFO as a}from"./info.js";var i=function(){function i(){}return i.generate=function(){return e(this,void 0,void 0,(function(){var e,n,o,c,l,u;return t(this,(function(t){switch(t.label){case 0:return e=r.join(process.cwd(),"src","pages","api"),[4,s(e)];case 1:t.sent(),n=!0,o=0,c=a,t.label=2;case 2:return o<c.length?(l=c[o],(u=n)?[4,i.generateAPI(l)]:[3,4]):[3,6];case 3:u=t.sent(),t.label=4;case 4:n=u,t.label=5;case 5:return o++,[3,2];case 6:return[2,n]}}))}))},i.generateAPI=function(e){return n(r.join(process.cwd(),"src","pages","api"),e.fileName,e.content)},i}();export{i as APIGenerator};
@@ -0,0 +1 @@
1
+ var e='import { IkasLocalThemeAPI } from "@ikas/storefront-next";\n\nexport default IkasLocalThemeAPI.GetComponentDirs.getComponentDirs;\nexport const config = IkasLocalThemeAPI.GetComponentDirs.config;\n',o='import { IkasLocalThemeAPI } from "@ikas/storefront-next";\n\nexport default IkasLocalThemeAPI.GetTheme.getTheme;\nexport const config = IkasLocalThemeAPI.GetTheme.config;\n',t='import { IkasLocalThemeAPI } from "@ikas/storefront-next";\n\nexport default IkasLocalThemeAPI.UpdateTheme.updateTheme;\nexport const config = IkasLocalThemeAPI.UpdateTheme.config;\n',n='import { IkasLocalThemeAPI } from "@ikas/storefront-next";\n\nexport default IkasLocalThemeAPI.UploadTheme.uploadTheme;\nexport const config = IkasLocalThemeAPI.UploadTheme.config;\n',a=[{content:e,fileName:"getComponentDirs.ts"},{content:o,fileName:"getTheme.ts"},{content:t,fileName:"updateTheme.ts"},{content:n,fileName:"uploadTheme.ts"}];export{a as API_INFO,e as GET_COMPONENT_DIRS_API_CONTENT,o as GET_THEME_API_CONTENT,t as UPDATE_THEME_API_CONTENT,n as UPLOAD_THEME_API_CONTENT};
@@ -0,0 +1 @@
1
+ import{__awaiter as n,__generator as t}from"../../../ext/tslib/tslib.es6.js";import e from"path";import{createFile as o,deleteDirContent as r}from"../../../utils/fs.js";import{IkasThemeJsonPageType as c}from"@ikas/storefront-models";import{PAGE_INFO as i,CHECKOUT_COMPONENT_ID as s}from"../pages/info.js";import{findAllByKey as a}from"../../../utils/helper.js";var u=function(){function u(){}return u.generate=function(o,c){return n(this,void 0,void 0,(function(){var n;return t(this,(function(t){switch(t.label){case 0:return[4,r(e.join(c||process.cwd(),"src","components","__generated__"))];case 1:return t.sent(),[4,u.generateAllPageComponentImportsFiles(o,c)];case 2:return(n=t.sent())?[4,u.generateAllComponentImportsFileForEditor(o,c)]:[3,4];case 3:n=t.sent(),t.label=4;case 4:return[2,n]}}))}))},u.generateAllPageComponentImportsFiles=function(e,o){return n(this,void 0,void 0,(function(){var n,r,c,s,a;return t(this,(function(t){switch(t.label){case 0:n=!0,r=0,c=i,t.label=1;case 1:return r<c.length?(s=c[r],(a=n)?[4,u.generatePageComponentImportsFileWithInfo(s,e,o)]:[3,3]):[3,5];case 2:a=t.sent(),t.label=3;case 3:n=a,t.label=4;case 4:return r++,[3,1];case 5:return[2,n]}}))}))},u.generatePageComponentImportsFileWithInfo=function(e,o,r){return n(this,void 0,void 0,(function(){var n,c,i,p;return t(this,(function(t){switch(t.label){case 0:if(e.isCheckout||e.isEditor)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),n=o.components,c=[],e.pageTypes.forEach((function(t){var e=o.pages.filter((function(n){return n.type===t}));e.length&&e.forEach((function(t){var e,o=t.components;(null===(e=t.specifications)||void 0===e?void 0:e.length)&&t.specifications.forEach((function(n){o.push.apply(o,n.components)})),c.push.apply(c,o.map((function(n){return n.componentId}))),o.forEach((function(t){if(n.find((function(n){return n.id===t.componentId}))){var e=a(t.propValues,"componentId");c.push.apply(c,e)}}))}))})),i=n.filter((function(n){return c.includes(n.id)&&n.id!==s})),[4,u.generateComponentImportsFile(i,e,r)];case 2:return[2,t.sent()];case 3:return p=t.sent(),console.error(p),[2,!1];case 4:return[2]}}))}))},u.generatePageComponentImportsFileWithType=function(n,t,e){if(n!==c.CHECKOUT){try{var o=i.find((function(t){return t.pageTypes.includes(n)}));if(o)return u.generatePageComponentImportsFileWithInfo(o,t,e)}catch(n){console.error(n)}return!1}},u.generateComponentImportsFile=function(n,t,r){try{var c="";return n.filter((function(n){return"checkout"!==n.id})).forEach((function(n,t){c+="import Component".concat(t,' from "src/components/').concat(n.dir,'";\r\n')})),c+="\n const Components = {\n ".concat(n.map((function(n,t){return'"'.concat(n.id,'": Component').concat(t)})),"\n };\n "),c+="\r\n",c+="export default Components;",o(e.join(r||process.cwd(),"src","components","__generated__","pages"),t.path.replace("tsx","ts"),c)}catch(n){return console.error(n),!1}},u.generateAllComponentImportsFileForEditor=function(r,c){return n(this,void 0,void 0,(function(){var n,i,s,a;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),n='import dynamic from "next/dynamic";\r\n',n+='import { IkasEditorComponentLoader } from "@ikas/storefront";\r\n',n+="\r\n",n+="\r\n",(i=r.components.filter((function(n){return"checkout"!==n.id}))).filter((function(n){return"checkout"!==n.id})).forEach((function(t,e){n+="const Component".concat(e,' = dynamic(() => import("../').concat(t.dir,'"), { loading: () => <IkasEditorComponentLoader /> });\r\n')})),n+="\r\n",n+="\nconst Components = {\n ".concat(i.map((function(n,t){return'"'.concat(n.id,'": Component').concat(t)})),"\n};\n"),n+="\r\n",n+="export default Components;",s=e.join(c||process.cwd(),"src","components","__generated__"),[4,o(s,"editor.tsx",n)];case 1:return[2,t.sent()];case 2:return a=t.sent(),console.error(a),[2,!1];case 3:return[2]}}))}))},u.generateAllComponentImportsFile=function(r,c){return n(this,void 0,void 0,(function(){var n,i,s,a;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),n="",(i=r.components.filter((function(n){return"checkout"!==n.id}))).filter((function(n){return"checkout"!==n.id})).forEach((function(t,e){n+="import Component".concat(e,' from "../').concat(t.dir,'";\r\n')})),n+="\r\n",n+="\nconst Components = {\n ".concat(i.map((function(n,t){return'"'.concat(n.id,'": Component').concat(t)})),"\n};\n"),n+="\r\n",n+="export default Components;",s=e.join(c||process.cwd(),"src","components","__generated__"),[4,o(s,"index.tsx",n)];case 1:return[2,t.sent()];case 2:return a=t.sent(),console.error(a),[2,!1];case 3:return[2]}}))}))},u}();export{u as ComponentImportsGenerator};
@@ -0,0 +1 @@
1
+ import{__awaiter as e,__generator as t}from"../../../ext/tslib/tslib.es6.js";import n from"path";import{deleteDirContent as r,createFile as a}from"../../../utils/fs.js";import{PAGE_INFO as o,CHECKOUT_PAGE_CONTENT as s,EDITOR_PAGE_CONTENT as c}from"./info.js";var i=function(){function i(){}return i.generate=function(a){return e(this,void 0,void 0,(function(){var e,s,c,p,u,f,g,m,l,h,d,P;return t(this,(function(t){switch(t.label){case 0:return e=n.join(a||process.cwd(),"src","pages"),[4,r(e,["_app.tsx","_document.tsx","api"])];case 1:t.sent(),s=!0,c=0,p=o,t.label=2;case 2:return c<p.length?(u=p[c],(f=s)?[4,i.generatePageWithInfo(u,a)]:[3,4]):[3,6];case 3:f=t.sent(),t.label=4;case 4:s=f,t.label=5;case 5:return c++,[3,2];case 6:return g=o.find((function(e){return e.isCheckout})),m=o.find((function(e){return e.isEditor})),g?[4,i.generatePageWithInfo(g,a)]:[3,8];case 7:return h=t.sent(),[3,9];case 8:h=!1,t.label=9;case 9:return l=h,m?[4,i.generatePageWithInfo(m,a)]:[3,11];case 10:return P=t.sent(),[3,12];case 11:P=!1,t.label=12;case 12:return d=P,[2,s&&l&&d]}}))}))},i.generatePageWithInfo=function(r,o){return e(this,void 0,void 0,(function(){var e,i,p,u,f,g,m,l,h;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e="",r.isCheckout?e=s:r.isEditor?e=c:(i=r.pageComponentName+"Next",p="import { ".concat(r.pageComponentName,' } from "@ikas/storefront";\r\n'),u="import { ".concat(r.pageComponentName," as ").concat(i,' } from "@ikas/storefront-next";\r\n'),f='import Components from "src/components/__generated__/pages/'.concat(r.path.replace(".tsx",""),'";\r\n'),g="\nconst PageComponent = ".concat(r.pageComponentName,".default;\n\nconst Page = (props: any) => {\n return <PageComponent components={Components} {...props} />;\n};\n\nexport default Page;\r\n"),m=r.isDynamicSSG?"export const getStaticPaths = ".concat(i,".getStaticPaths;\r\n"):"",l=r.isSSR?"export const getServerSideProps = ".concat(i,".getServerSideProps;\r\n"):"export const getStaticProps = ".concat(i,".getStaticProps;\r\n"),e=p+u+f+g+m+l),[4,a(n.join(o||process.cwd(),"src","pages"),r.path,e)];case 1:return[2,t.sent()];case 2:return h=t.sent(),console.error(h),[2,!1];case 3:return[2]}}))}))},i.generatePageWithType=function(n){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return(e=o.find((function(e){return e.pageTypes.includes(n)})))?[4,i.generatePageWithInfo(e)]:[3,2];case 1:return[2,t.sent()];case 2:return[2,!1]}}))}))},i}();export{i as PageGenerator};
@@ -0,0 +1 @@
1
+ import{IkasThemeJsonPageType as e}from"@ikas/storefront-models";var a="checkout",t=[{path:"[slug]/index.tsx",pageComponentName:"SlugPage",pageTypes:[e.PRODUCT,e.CATEGORY,e.BRAND],isDynamicSSG:!0},{path:"account/orders/[id].tsx",pageComponentName:"OrderDetailPage",pageTypes:[e.ORDER_DETAIL],isSSR:!0},{path:"account/orders/index.tsx",pageComponentName:"OrdersPage",pageTypes:[e.ORDERS]},{path:"account/addresses.tsx",pageComponentName:"AddressesPage",pageTypes:[e.ADDRESSES]},{path:"account/favorite-products.tsx",pageComponentName:"FavoriteProductsPage",pageTypes:[e.FAVORITE_PRODUCTS]},{path:"account/forgot-password.tsx",pageComponentName:"ForgotPasswordPage",pageTypes:[e.FORGOT_PASSWORD]},{path:"account/index.tsx",pageComponentName:"AccountPage",pageTypes:[e.ACCOUNT]},{path:"account/login.tsx",pageComponentName:"LoginPage",pageTypes:[e.LOGIN]},{path:"account/raffles.tsx",pageComponentName:"AccountRafflesPage",pageTypes:[e.RAFFLE_ACCOUNT]},{path:"account/recover-password.tsx",pageComponentName:"RecoverPasswordPage",pageTypes:[e.RECOVER_PASSWORD]},{path:"account/register.tsx",pageComponentName:"RegisterPage",pageTypes:[e.REGISTER]},{path:"blog/[slug].tsx",pageComponentName:"BlogSlugPage",pageTypes:[e.BLOG,e.BLOG_CATEGORY],isDynamicSSG:!0},{path:"blog/index.tsx",pageComponentName:"BlogPage",pageTypes:[e.BLOG_INDEX]},{path:"pages/[slug].tsx",pageComponentName:"CustomPage",pageTypes:[e.CUSTOM],isDynamicSSG:!0},{path:"raffle/[slug].tsx",pageComponentName:"RafflePage",pageTypes:[e.RAFFLE_DETAIL],isDynamicSSG:!0},{path:"raffle/index.tsx",pageComponentName:"RafflesPage",pageTypes:[e.RAFFLE]},{path:"404.tsx",pageComponentName:"NotFoundPage",pageTypes:[e.NOT_FOUND]},{path:"cart.tsx",pageComponentName:"CartPage",pageTypes:[e.CART]},{path:"index.tsx",pageComponentName:"IndexPage",pageTypes:[e.INDEX]},{path:"search.tsx",pageComponentName:"SearchPage",pageTypes:[e.SEARCH]},{path:"checkout.tsx",pageComponentName:"CheckoutPage",pageTypes:[],isCheckout:!0},{path:"editor.tsx",pageComponentName:"EditorPage",pageTypes:[],isEditor:!0}],o='import { CheckoutPage } from "@ikas/storefront";\nimport { CheckoutPage as CheckoutPageNext } from "@ikas/storefront-next";\n\nexport default CheckoutPage.default;\nexport const getStaticProps = CheckoutPageNext.getStaticProps;\n',p='import { EditorPage } from "@ikas/storefront";\nimport { EditorPage as EditorPageNext } from "@ikas/storefront-next";\nimport Components from "../components/__generated__/editor";\n\nconst PageComponent = EditorPage.default;\n\nconst Page = (props: any) => {\n return <PageComponent components={Components} {...props} />;\n};\n\nexport default Page;\nexport const getStaticProps = EditorPageNext.getStaticProps;\n';export{a as CHECKOUT_COMPONENT_ID,o as CHECKOUT_PAGE_CONTENT,p as EDITOR_PAGE_CONTENT,t as PAGE_INFO};
@@ -0,0 +1 @@
1
+ import{__awaiter as e,__generator as n}from"../../../ext/tslib/tslib.es6.js";import t from"path";import r from"fs";import{createFile as o}from"../../../utils/fs.js";import{IkasThemeJsonStockPreference as s,IkasThemeJsonPageType as i}from"@ikas/storefront-models";var l=function(){function l(){}return l.generate=function(e){return o(t.join(process.cwd(),"src","theme.json"),"",JSON.stringify(e,null,2))},l.generateInitialThemeJsonFile=function(){var e={pages:[],components:[],name:"My Theme",customData:[],settings:{colors:[],favicon:{id:null},fontFamily:{name:null,variants:null},stockPreference:s.SHOW_ALL}};return e.pages.push({id:"1",components:[],canonicals:null,description:null,disableIndex:null,name:null,pageTitle:null,slug:null,specifications:[],type:i.INDEX}),l.generate(e)},l.getTheme=function(){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){try{return e=t.join(process.cwd(),"src","theme.json"),[2,(o=r.readFileSync(e)).length?JSON.parse(o.toString()):null]}catch(e){console.error(e)}return[2]}))}))},l}();export{l as ThemeJsonGenerator};
@@ -0,0 +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};
@@ -0,0 +1 @@
1
+ import{__awaiter as r,__generator as t,__spreadArray as n}from"../ext/tslib/tslib.es6.js";import i from"fs";import e from"path";function o(r){var t=r.split("/");return t.length>1?{dirParts:t.slice(0,t.length-1),filePart:t[t.length-1]}:{filePart:r}}function a(n,o){return r(this,void 0,void 0,(function(){return t(this,(function(r){try{return i.readdirSync(n).forEach((function(r){(null==o?void 0:o.includes(r))||i.unlinkSync(e.join(n,r))})),[2,!0]}catch(r){return[2,!1]}return[2]}))}))}function s(a,s,u){var c;return r(this,void 0,void 0,(function(){var r,l,d;return t(this,(function(t){try{return r=a,l=o(s),(null===(c=l.dirParts)||void 0===c?void 0:c.length)&&(r=e.join.apply(e,n([r],l.dirParts,!1))),i.existsSync(r)||i.mkdirSync(r,{recursive:!0}),d=e.join(r,l.filePart),i.writeFileSync(d,u),[2,!0]}catch(r){return console.error(r),[2,!1]}return[2]}))}))}export{s as createFile,a as deleteDirContent,o as getFilePathParts};
@@ -0,0 +1 @@
1
+ function e(t,n){return Object.entries(t||{}).reduce((function(t,c){var r=c[0],o=c[1];return r===n?t.concat(o):"object"==typeof o?t.concat(e(o,n)):t}),[])}export{e as findAllByKey};
@@ -0,0 +1,2 @@
1
+ import { GetStaticProps } from "next";
2
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as r}from'./../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import{IkasNextPageDataProvider as e}from"../provider/page-data-next.js";var i=function(i){return t(void 0,void 0,void 0,(function(){var t;return r(this,(function(r){switch(r.label){case 0:return[4,e.getStaticProps(i,o.NOT_FOUND)];case 1:return(t=r.sent()).notFound?[2,{props:{},revalidate:60}]:[2,t]}}))}))};export{i as getStaticProps};
@@ -0,0 +1,3 @@
1
+ import { GetStaticPaths, GetStaticProps } from "next";
2
+ export declare const getStaticPaths: GetStaticPaths;
3
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as o}from'./../../ext/tslib/tslib.es6.js';import{IkasNextPageDataProvider as r}from"../../provider/page-data-next.js";import{IkasThemeJsonPageType as i}from"@ikas/storefront-models";var n=function(){return t(void 0,void 0,void 0,(function(){return o(this,(function(t){return[2,{paths:[],fallback:"blocking"}]}))}))},e=function(n){return t(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,r.getStaticProps(n,void 0,[i.BRAND,i.CATEGORY,i.PRODUCT])];case 1:return[2,t.sent()]}}))}))};export{n as getStaticPaths,e as getStaticProps};
@@ -0,0 +1,2 @@
1
+ import { GetStaticProps } from "next";
2
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as r}from'./../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import{IkasNextPageDataProvider as e}from"../../provider/page-data-next.js";var i=function(i){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,e.getStaticProps(i,o.ADDRESSES)];case 1:return[2,t.sent()]}}))}))};export{i as getStaticProps};
@@ -0,0 +1,2 @@
1
+ import { GetStaticProps } from "next";
2
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as r}from'./../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import{IkasNextPageDataProvider as e}from"../../provider/page-data-next.js";var i=function(i){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,e.getStaticProps(i,o.FAVORITE_PRODUCTS)];case 1:return[2,t.sent()]}}))}))};export{i as getStaticProps};
@@ -0,0 +1,2 @@
1
+ import { GetStaticProps } from "next";
2
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as r}from'./../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import{IkasNextPageDataProvider as e}from"../../provider/page-data-next.js";var i=function(i){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,e.getStaticProps(i,o.FORGOT_PASSWORD)];case 1:return[2,t.sent()]}}))}))};export{i as getStaticProps};
@@ -0,0 +1,2 @@
1
+ import { GetStaticProps } from "next";
2
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as r}from'./../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import{IkasNextPageDataProvider as e}from"../../provider/page-data-next.js";var i=function(i){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,e.getStaticProps(i,o.ACCOUNT)];case 1:return[2,t.sent()]}}))}))};export{i as getStaticProps};
@@ -0,0 +1,2 @@
1
+ import { GetStaticProps } from "next";
2
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as r}from'./../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import{IkasNextPageDataProvider as e}from"../../provider/page-data-next.js";var i=function(i){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,e.getStaticProps(i,o.LOGIN)];case 1:return[2,t.sent()]}}))}))};export{i as getStaticProps};
@@ -0,0 +1,2 @@
1
+ import { GetServerSideProps } from "next";
2
+ export declare const getServerSideProps: GetServerSideProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as r,__generator as e}from'./../../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as t}from"@ikas/storefront-models";import{IkasNextPageDataProvider as o}from"../../../provider/page-data-next.js";var i=function(i){return r(void 0,void 0,void 0,(function(){return e(this,(function(r){switch(r.label){case 0:return[4,o.getServerSideProps(i,t.ORDER_DETAIL)];case 1:return[2,r.sent()]}}))}))};export{i as getServerSideProps};
@@ -0,0 +1,2 @@
1
+ import { GetStaticProps } from "next";
2
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as r}from'./../../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import{IkasNextPageDataProvider as e}from"../../../provider/page-data-next.js";var i=function(i){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,e.getStaticProps(i,o.ORDERS)];case 1:return[2,t.sent()]}}))}))};export{i as getStaticProps};
@@ -0,0 +1,2 @@
1
+ import { GetStaticProps } from "next";
2
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as r}from'./../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import{IkasNextPageDataProvider as e}from"../../provider/page-data-next.js";var i=function(i){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,e.getStaticProps(i,o.RAFFLE_ACCOUNT)];case 1:return[2,t.sent()]}}))}))};export{i as getStaticProps};
@@ -0,0 +1,2 @@
1
+ import { GetStaticProps } from "next";
2
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as r}from'./../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import{IkasNextPageDataProvider as e}from"../../provider/page-data-next.js";var i=function(i){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,e.getStaticProps(i,o.RECOVER_PASSWORD)];case 1:return[2,t.sent()]}}))}))};export{i as getStaticProps};
@@ -0,0 +1,2 @@
1
+ import { GetStaticProps } from "next";
2
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as r}from'./../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import{IkasNextPageDataProvider as e}from"../../provider/page-data-next.js";var i=function(i){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,e.getStaticProps(i,o.REGISTER)];case 1:return[2,t.sent()]}}))}))};export{i as getStaticProps};
@@ -0,0 +1,3 @@
1
+ import { GetStaticPaths, GetStaticProps } from "next";
2
+ export declare const getStaticPaths: GetStaticPaths;
3
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as o}from'./../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as r}from"@ikas/storefront-models";import{IkasNextPageDataProvider as i}from"../../provider/page-data-next.js";var n=function(){return t(void 0,void 0,void 0,(function(){return o(this,(function(t){return[2,{paths:[],fallback:"blocking"}]}))}))},e=function(n){return t(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,i.getStaticProps(n,void 0,[r.BLOG,r.BLOG_CATEGORY])];case 1:return[2,t.sent()]}}))}))};export{n as getStaticPaths,e as getStaticProps};
@@ -0,0 +1,2 @@
1
+ import { GetStaticProps } from "next";
2
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as r}from'./../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import{IkasNextPageDataProvider as e}from"../../provider/page-data-next.js";var i=function(i){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,e.getStaticProps(i,o.BLOG_INDEX)];case 1:return[2,t.sent()]}}))}))};export{i as getStaticProps};
@@ -0,0 +1,2 @@
1
+ import { GetStaticProps } from "next";
2
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as r}from'./../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import{IkasNextPageDataProvider as e}from"../provider/page-data-next.js";var i=function(i){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,e.getStaticProps(i,o.CART)];case 1:return[2,t.sent()]}}))}))};export{i as getStaticProps};
@@ -0,0 +1,2 @@
1
+ import { GetStaticProps } from "next";
2
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as r}from'./../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import{IkasNextPageDataProvider as e}from"../provider/page-data-next.js";var i=function(i){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,e.getStaticProps(i,o.CHECKOUT)];case 1:return[2,t.sent()]}}))}))};export{i as getStaticProps};
@@ -0,0 +1,2 @@
1
+ import { GetStaticProps } from "next";
2
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as o}from'./../ext/tslib/tslib.es6.js';import{IkasNextPageDataProvider as r}from"../provider/page-data-next.js";var e=function(e){return t(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,r.getStaticProps(e,void 0,void 0,!0)];case 1:return[2,t.sent()]}}))}))};export{e as getStaticProps};
@@ -0,0 +1,2 @@
1
+ import { GetStaticProps } from "next";
2
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as r}from'./../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import{IkasNextPageDataProvider as e}from"../provider/page-data-next.js";var i=function(i){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,e.getStaticProps(i,o.INDEX)];case 1:return[2,t.sent()]}}))}))};export{i as getStaticProps};
@@ -1,22 +1,22 @@
1
- export * as IndexPage from "./home";
2
- export * as SlugPage from "./[slug]";
3
- export * as CustomPage from "./pages/[slug]";
4
- export * as CheckoutPage from "./checkout";
5
- export * as AccountPage from "./account/index";
6
- export * as AddressesPage from "./account/addresses";
7
- export * as OrdersPage from "./account/orders";
8
- export * as OrderDetailPage from "./account/orders/[id]";
9
- export * as LoginPage from "./account/login";
10
- export * as RegisterPage from "./account/register";
11
- export * as ForgotPasswordPage from "./account/forgot-password";
12
- export * as RecoverPasswordPage from "./account/recover-password";
13
- export * as CartPage from "./cart";
14
- export * as EditorPage from "./editor";
15
- export * as FavoriteProductsPage from "./account/favorite-products";
16
- export * as SearchPage from "./search";
17
- export * as NotFoundPage from "./404";
18
- export * as BlogPage from "./blog";
19
- export * as BlogSlugPage from "./blog/[slug]";
20
- export * as RafflePage from "./raffle/[slug]";
21
- export * as RafflesPage from "./raffle/index";
22
- export * as AccountRafflesPage from "./account/raffles";
1
+ export * as IndexPage from "./home";
2
+ export * as SlugPage from "./[slug]";
3
+ export * as CustomPage from "./pages/[slug]";
4
+ export * as CheckoutPage from "./checkout";
5
+ export * as AccountPage from "./account/index";
6
+ export * as AddressesPage from "./account/addresses";
7
+ export * as OrdersPage from "./account/orders";
8
+ export * as OrderDetailPage from "./account/orders/[id]";
9
+ export * as LoginPage from "./account/login";
10
+ export * as RegisterPage from "./account/register";
11
+ export * as ForgotPasswordPage from "./account/forgot-password";
12
+ export * as RecoverPasswordPage from "./account/recover-password";
13
+ export * as CartPage from "./cart";
14
+ export * as EditorPage from "./editor";
15
+ export * as FavoriteProductsPage from "./account/favorite-products";
16
+ export * as SearchPage from "./search";
17
+ export * as NotFoundPage from "./404";
18
+ export * as BlogPage from "./blog";
19
+ export * as BlogSlugPage from "./blog/[slug]";
20
+ export * as RafflePage from "./raffle/[slug]";
21
+ export * as RafflesPage from "./raffle/index";
22
+ export * as AccountRafflesPage from "./account/raffles";
@@ -0,0 +1,3 @@
1
+ import { GetStaticProps, GetStaticPaths } from "next";
2
+ export declare const getStaticPaths: GetStaticPaths;
3
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as r}from'./../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import{IkasNextPageDataProvider as e}from"../../provider/page-data-next.js";var n=function(n){return t(void 0,void 0,void 0,(function(){var t,a;return r(this,(function(r){switch(r.label){case 0:return n.locales?[4,Promise.all(n.locales.map((function(t){return e.getSettings(t)})))]:[2,{paths:[],fallback:"blocking"}];case 1:return t=r.sent(),a=[],t.forEach((function(t){var r=t.themeLocalization,e=t.routing;r&&r.themeJson.pages.filter((function(t){return t.type===o.CUSTOM})).forEach((function(t){t.slug&&!a.some((function(r){return r.params.slug===t.slug}))&&("local"===process.env.NEXT_PUBLIC_ENV?a.push({params:{slug:t.slug}}):a.push({params:{slug:t.slug},locale:e.path||e.id}))}))})),[2,{paths:a.map((function(t){return{params:t.params,locale:t.locale}})),fallback:"blocking"}]}}))}))},a=function(n){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,e.getStaticProps(n,o.CUSTOM)];case 1:return[2,t.sent()]}}))}))};export{n as getStaticPaths,a as getStaticProps};
@@ -0,0 +1,3 @@
1
+ import { GetStaticProps, GetStaticPaths } from "next";
2
+ export declare const getStaticPaths: GetStaticPaths;
3
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as o}from'./../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as r}from"@ikas/storefront-models";import{IkasNextPageDataProvider as i}from"../../provider/page-data-next.js";var n=function(){return t(void 0,void 0,void 0,(function(){return o(this,(function(t){return[2,{paths:[],fallback:"blocking"}]}))}))},e=function(n){return t(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,i.getStaticProps(n,r.RAFFLE_DETAIL)];case 1:return[2,t.sent()]}}))}))};export{n as getStaticPaths,e as getStaticProps};
@@ -0,0 +1,2 @@
1
+ import { GetStaticProps } from "next";
2
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as r}from'./../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import{IkasNextPageDataProvider as e}from"../../provider/page-data-next.js";var i=function(i){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,e.getStaticProps(i,o.RAFFLE)];case 1:return[2,t.sent()]}}))}))};export{i as getStaticProps};
@@ -0,0 +1,2 @@
1
+ import { GetStaticProps } from "next";
2
+ export declare const getStaticProps: GetStaticProps;
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as r}from'./../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import{IkasNextPageDataProvider as e}from"../provider/page-data-next.js";var i=function(i){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,e.getStaticProps(i,o.SEARCH)];case 1:return[2,t.sent()]}}))}))};export{i as getStaticProps};
@@ -0,0 +1,94 @@
1
+ /// <reference types="node" />
2
+ import { GetServerSidePropsContext, GetStaticPropsContext } from "next";
3
+ import { ParsedUrlQuery } from "querystring";
4
+ import { IkasCustomerReviewSettings, IkasCustomerSettings, IkasMerchantSettings, IkasProductBackInStockSettings, IkasSalesChannel, IkasStorefront, IkasStorefrontRouting, IkasStorefrontThemeLocalization, IkasThemeJson, IkasThemeJsonFavicon, IkasThemeJsonPageType, IkasThemeJsonSettings, IkasThemeJsonStockPreference } from "@ikas/storefront-models";
5
+ import { IkasPageDataProvider } from "@ikas/storefront-providers";
6
+ import { IkasStorefrontSettings } from "@ikas/storefront-api";
7
+ export declare class IkasNextPageDataProvider {
8
+ static startTime: number;
9
+ static readLocalTheme(): Promise<IkasThemeJson>;
10
+ static readSettingsFile(): Promise<SettingsData | null>;
11
+ static cacheLocalSettingsFile(settings: IkasStorefrontSettings): Promise<void>;
12
+ static readLocalSettingsFile(): any;
13
+ static getLocalSettings(locale: string): Promise<SettingsData | null>;
14
+ static getProdSettings(locale: string): Promise<SettingsData | null>;
15
+ static getSettings(locale: string): Promise<SettingsData | null>;
16
+ static setStorefrontConfig(settings: SettingsData): Promise<void>;
17
+ static setTranslations(settings: SettingsData, componentIds: string[], pageType?: IkasThemeJsonPageType, isEditor?: boolean): Promise<void>;
18
+ static getExtraProps(settings: SettingsData, provider: IkasPageDataProvider, pageType?: IkasThemeJsonPageType): Promise<Record<string, any>>;
19
+ static getPageData(context: GetStaticPropsContext<ParsedUrlQuery> | GetServerSidePropsContext<ParsedUrlQuery>, isServer: boolean, pageType?: IkasThemeJsonPageType, possiblePageTypes?: IkasThemeJsonPageType[], isEditor?: boolean): Promise<{
20
+ props: {};
21
+ notFound: boolean;
22
+ revalidate?: undefined;
23
+ } | {
24
+ props: any;
25
+ notFound?: undefined;
26
+ revalidate?: undefined;
27
+ } | {
28
+ props: any;
29
+ revalidate: number;
30
+ notFound?: undefined;
31
+ }>;
32
+ static getStaticProps(context: GetStaticPropsContext<ParsedUrlQuery>, pageType?: IkasThemeJsonPageType, possiblePageTypes?: IkasThemeJsonPageType[], isEditor?: boolean): Promise<{
33
+ props: {};
34
+ notFound: boolean;
35
+ revalidate?: undefined;
36
+ } | {
37
+ props: any;
38
+ notFound?: undefined;
39
+ revalidate?: undefined;
40
+ } | {
41
+ props: any;
42
+ revalidate: number;
43
+ notFound?: undefined;
44
+ }>;
45
+ static getServerSideProps(context: GetServerSidePropsContext<ParsedUrlQuery>, pageType?: IkasThemeJsonPageType): Promise<{
46
+ props: {};
47
+ notFound: boolean;
48
+ revalidate?: undefined;
49
+ } | {
50
+ props: any;
51
+ notFound?: undefined;
52
+ revalidate?: undefined;
53
+ } | {
54
+ props: any;
55
+ revalidate: number;
56
+ notFound?: undefined;
57
+ }>;
58
+ static createColorScript(settings: IkasThemeJsonSettings): string | undefined;
59
+ static createFontScript(settings: IkasThemeJsonSettings): string | undefined;
60
+ }
61
+ export declare type SettingsData = {
62
+ storefront: IkasStorefront;
63
+ themeLocalization: IkasStorefrontThemeLocalization;
64
+ salesChannel: IkasSalesChannel;
65
+ routing: IkasStorefrontRouting;
66
+ localizationMap?: Record<string, any>;
67
+ favicon: IkasThemeJsonFavicon;
68
+ stockPreference: IkasThemeJsonStockPreference;
69
+ storefrontJSScripts: string[];
70
+ domain: string;
71
+ productBackInStockSettings: IkasProductBackInStockSettings | null;
72
+ customerReviewSettings: IkasCustomerReviewSettings | null;
73
+ merchantSettings: IkasMerchantSettings;
74
+ customerSettings?: IkasCustomerSettings;
75
+ };
76
+ export declare type IkasCheckoutCustomizationProps = {
77
+ showTax?: boolean;
78
+ buttonBgColor?: string;
79
+ buttonTextColor?: string;
80
+ buttonDisabledBgColor?: string;
81
+ buttonDisabledTextColor?: string;
82
+ primaryTextColor?: string;
83
+ secondaryTextColor?: string;
84
+ primaryBgColor?: string;
85
+ secondaryBgColor?: string;
86
+ borderColor?: string;
87
+ cardBgColor?: string;
88
+ errorColor?: string;
89
+ errorLightColor?: string;
90
+ warningColor?: string;
91
+ warningLightColor?: string;
92
+ successColor?: string;
93
+ successLightColor?: string;
94
+ };
@@ -0,0 +1 @@
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};