@ikas/storefront-next 4.5.0-beta.5 → 4.5.0-beta.6
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.
- package/build/api/getComponentDirs.d.ts +3 -0
- package/build/api/getComponentDirs.js +1 -0
- package/build/api/getConfig.d.ts +3 -0
- package/build/api/getConfig.js +1 -0
- package/build/api/getTheme.d.ts +3 -0
- package/build/api/getTheme.js +1 -0
- package/build/api/index.d.ts +13 -0
- package/build/api/index.js +1 -0
- package/build/api/middleware.d.ts +3 -0
- package/build/api/middleware.js +1 -0
- package/build/api/updateTheme.d.ts +9 -0
- package/build/api/updateTheme.js +1 -0
- package/build/api/uploadTheme.d.ts +3 -0
- package/build/api/uploadTheme.js +1 -0
- package/build/ext/tslib/tslib.es6.js +1 -0
- package/build/index.d.ts +4 -0
- package/build/index.js +1 -0
- package/build/packages/cmd/build/ext/tslib/tslib.es6.js +1 -0
- package/build/packages/cmd/build/scripts/generators/api/index.js +1 -0
- package/build/packages/cmd/build/scripts/generators/api/info.js +1 -0
- package/build/packages/cmd/build/scripts/generators/components/index.js +1 -0
- package/build/packages/cmd/build/scripts/generators/pages/index.js +1 -0
- package/build/packages/cmd/build/scripts/generators/pages/info.js +1 -0
- package/build/packages/cmd/build/scripts/generators/theme/index.js +1 -0
- package/build/packages/cmd/build/scripts/generators/types/index.js +1 -0
- package/build/packages/cmd/build/utils/fs.js +1 -0
- package/build/packages/cmd/build/utils/helper.js +1 -0
- package/build/pages/404.d.ts +2 -0
- package/build/pages/404.js +1 -0
- package/build/pages/[slug]/index.d.ts +3 -0
- package/build/pages/_slug_/index.js +1 -0
- package/build/pages/account/addresses.d.ts +2 -0
- package/build/pages/account/addresses.js +1 -0
- package/build/pages/account/favorite-products.d.ts +2 -0
- package/build/pages/account/favorite-products.js +1 -0
- package/build/pages/account/forgot-password.d.ts +2 -0
- package/build/pages/account/forgot-password.js +1 -0
- package/build/pages/account/index.d.ts +2 -0
- package/build/pages/account/index.js +1 -0
- package/build/pages/account/login.d.ts +2 -0
- package/build/pages/account/login.js +1 -0
- package/build/pages/account/orders/[id].d.ts +2 -0
- package/build/pages/account/orders/_id_.js +1 -0
- package/build/pages/account/orders/index.d.ts +2 -0
- package/build/pages/account/orders/index.js +1 -0
- package/build/pages/account/raffles.d.ts +2 -0
- package/build/pages/account/raffles.js +1 -0
- package/build/pages/account/recover-password.d.ts +2 -0
- package/build/pages/account/recover-password.js +1 -0
- package/build/pages/account/register.d.ts +2 -0
- package/build/pages/account/register.js +1 -0
- package/build/pages/blog/[slug].d.ts +3 -0
- package/build/pages/blog/_slug_.js +1 -0
- package/build/pages/blog/index.d.ts +2 -0
- package/build/pages/blog/index.js +1 -0
- package/build/pages/cart.d.ts +2 -0
- package/build/pages/cart.js +1 -0
- package/build/pages/checkout.d.ts +2 -0
- package/build/pages/checkout.js +1 -0
- package/build/pages/editor.d.ts +2 -0
- package/build/pages/editor.js +1 -0
- package/build/pages/home.d.ts +2 -0
- package/build/pages/home.js +1 -0
- package/build/pages/index.d.ts +22 -0
- package/build/pages/pages/[slug].d.ts +3 -0
- package/build/pages/pages/_slug_.js +1 -0
- package/build/pages/raffle/[slug].d.ts +3 -0
- package/build/pages/raffle/_slug_.js +1 -0
- package/build/pages/raffle/index.d.ts +2 -0
- package/build/pages/raffle/index.js +1 -0
- package/build/pages/search.d.ts +2 -0
- package/build/pages/search.js +1 -0
- package/build/provider/page-data-next.d.ts +94 -0
- package/build/provider/page-data-next.js +1 -0
- package/build/utils/fs.d.ts +28 -0
- package/build/utils/fs.js +1 -0
- package/build/utils/google-fonts.d.ts +2 -0
- package/build/utils/google-fonts.js +1 -0
- package/build/utils/i18n.d.ts +9 -0
- package/build/utils/i18n.js +1 -0
- package/package.json +15 -15
|
@@ -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 @@
|
|
|
1
|
+
import{__awaiter as r,__generator as t}from'./../ext/tslib/tslib.es6.js';import e from"fs";import o from"path";import{corsMiddleware as n}from"./middleware.js";var s=function(e,o){return r(void 0,void 0,void 0,(function(){var r,s;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,n(e,o)];case 1:return t.sent(),[4,a()];case 2:return r=t.sent(),o.statusCode=200,o.setHeader("Content-Type","application/json"),o.json((null==r?void 0:r.storefrontId)?{storefrontId:r.storefrontId}:{}),[3,4];case 3:return s=t.sent(),console.error(s),o.statusCode=500,o.send(s),[3,4];case 4:return[2]}}))}))},i={},a=function(){try{var r=o.join(process.cwd(),"config.json"),t=e.readFileSync(r);return t.length?JSON.parse(t.toString()):null}catch(r){console.error(r)}};export{i as config,s as getConfig};
|
|
@@ -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";import"lodash/uniq";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};
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
import * as GetConfig from "./getConfig";
|
|
6
|
+
declare const IkasLocalThemeAPI: {
|
|
7
|
+
GetComponentDirs: typeof GetComponentDirs;
|
|
8
|
+
GetTheme: typeof GetTheme;
|
|
9
|
+
GetConfig: typeof GetConfig;
|
|
10
|
+
UpdateTheme: typeof UpdateTheme;
|
|
11
|
+
UploadTheme: typeof UploadTheme;
|
|
12
|
+
};
|
|
13
|
+
export { IkasLocalThemeAPI };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"./getComponentDirs.js";import*as o from"./getTheme.js";import*as m from"./updateTheme.js";import*as t from"./uploadTheme.js";import*as r from"./getConfig.js";var p={GetComponentDirs:e,GetTheme:o,GetConfig:r,UpdateTheme:m,UploadTheme:t};export{p as IkasLocalThemeAPI};
|
|
@@ -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 @@
|
|
|
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";import"lodash/uniq";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 @@
|
|
|
1
|
+
import{__awaiter as e,__generator as r}from'./../ext/tslib/tslib.es6.js';import t from"fs";import n from"path";import o from"adm-zip";import s from"axios";import i from"@ikas/storefront-assets/checkout/de.js";import c from"@ikas/storefront-assets/checkout/en.js";import a from"@ikas/storefront-assets/checkout/tr.js";import{corsMiddleware as u}from"./middleware.js";var l=function(s,l){return e(void 0,void 0,void 0,(function(){var e,d,m,y,v,S,w,g,j;return r(this,(function(r){switch(r.label){case 0:return[4,u(s,l)];case 1:r.sent(),e=function(){l.statusCode=200,l.setHeader("Content-Type","application/json"),l.json({status:"ok"})},d=function(){l.statusCode=400,l.setHeader("Content-Type","application/json"),l.json({status:"failed"})},m="",r.label=2;case 2:return r.trys.push([2,9,10,11]),[4,new Promise((function(e,r){var o=n.join(process.cwd(),"src","theme.json");t.readFile(o,(function(t,n){if(t)return console.error("An error occurred while reading the theme.json file!"),r(t);e(JSON.parse(n.toString()))}))}))];case 3:return y=r.sent(),[4,new Promise((function(e,r){var o=n.join(process.cwd(),"public","locales"),s=function(e){return e.length?e.split(".")[0]:e};t.readdir(o,(function(u,l){if(u)return r(u);var d=l.filter((function(e){return t.lstatSync(n.join(o,e)).isDirectory()})),h={},p=!1;d.forEach((function(e){var r=n.join(process.cwd(),"public","locales",e);h[e]={};try{var o=t.readdirSync(r);o.forEach((function(r){var o=t.readFileSync(n.join(process.cwd(),"public","locales",e,r)),u=s(e).toLowerCase(),l=s(r);h[u][l]=JSON.parse(o.toString()),h[u]["checkout-page"]="tr"===u?a:"de"===u?i:c}))}catch(e){console.error("An error occurred while reading localization files!"),console.error(e),p=!0}})),p?r(null):e(h)}))}))];case 4:return v=r.sent(),[4,h(y,v)];case 5:return S=r.sent(),w=!1,"string"!=typeof S?[3,8]:(b=n.join(process.cwd()),T="theme.zip",N=n.join(process.cwd(),T),L=new o,k=["node_modules",".next","out",".git"],t.readdirSync(b).forEach((function(e){var r=n.join(b,e);if(t.lstatSync(r).isDirectory()){if(k.includes(e))return;L.addLocalFolder(r,e)}else L.addLocalFile(e)})),L.writeZip(N),m=N,g=t.statSync(m),[4,p(S,t.readFileSync(m),g.size)]);case 6:return(w=r.sent())?[4,f()]:[3,8];case 7:w=r.sent(),r.label=8;case 8:return w?e():d(),[3,11];case 9:return j=r.sent(),console.error(j),d(),[3,11];case 10:return m&&function(e){try{t.unlinkSync(e)}catch(e){console.error("An error occurrred while deleting the zip file!"),console.error(e)}}(m),[7];case 11:return[2]}var b,T,N,L,k}))}))},d={};function h(t,n){return e(this,void 0,void 0,(function(){var e,o,i,c,a;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),e=Object.keys(n),o=e.some((function(e){return"en"===e}))?"en":e[0],[4,m()];case 1:return i=r.sent(),[4,s({method:"post",url:process.env.NEXT_PUBLIC_PARTNER_GQL_URL,headers:{"x-api-key":i.apiKey,"Content-Type":"application/json"},data:JSON.stringify({query:"\n mutation createNewThemeVersion($input: CreateNewThemeVersionInput!) {\n createNewThemeVersion(input: $input) {\n themeVersionId\n uploadUrl\n }\n }\n ",variables:{input:{themeId:i.themeId,themeSecret:i.themeSecret,themeJson:JSON.stringify(t),locales:Object.entries(n).map((function(e){var r=e[0],t=e[1];return{isDefaultLocale:r===o,locale:r,localeJson:JSON.stringify(t)}}))}}})})];case 2:return[4,r.sent().data];case 3:return(c=r.sent()).data&&c.data.createNewThemeVersion?[2,c.data.createNewThemeVersion.uploadUrl]:[3,5];case 4:return a=r.sent(),console.error("An error occurred during saveTheme!"),console.log(a),[3,5];case 5:return[2]}}))}))}function p(t,n,o){return e(this,void 0,void 0,(function(){var e,i;return r(this,(function(r){switch(r.label){case 0:e={headers:{"Content-Type":"application/zip","Content-Length":o+""}},r.label=1;case 1:return r.trys.push([1,3,,4]),[4,s.put(t,n,e)];case 2:return[2,200===r.sent().status];case 3:return i=r.sent(),console.error("An error occurred during uploadTheme!"),console.log(i),[2,!1];case 4:return[2]}}))}))}function f(){return e(this,void 0,void 0,(function(){var e,t;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),[4,m()];case 1:return e=r.sent(),[4,fetch(process.env.NEXT_PUBLIC_PARTNER_GQL_URL,{method:"POST",body:JSON.stringify({query:"\n mutation buildThemeLatestVersion(\n $themeSecret: String!\n $themeId: String!\n ) {\n buildThemeLatestVersion(\n themeSecret: $themeSecret\n themeId: $themeId\n )\n }\n ",variables:{themeSecret:e.themeSecret,themeId:e.themeId}}),headers:{"x-api-key":e.apiKey,"Content-Type":"application/json"}})];case 2:return[4,r.sent().json()];case 3:return r.sent(),[2,!0];case 4:return t=r.sent(),console.error("An error occurred during buildTheme!"),console.log(t),[2,!1];case 5:return[2]}}))}))}function m(){return new Promise((function(e,r){var o=n.join(process.cwd(),"config.json");t.readFile(o,(function(t,n){if(t)return console.error("An error occurred while reading the storefront config!"),r(t);e(JSON.parse(n.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};
|
package/build/index.d.ts
ADDED
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='import { IkasLocalThemeAPI } from "@ikas/storefront-next";\n\nexport default IkasLocalThemeAPI.GetConfig.getConfig;\nexport const config = IkasLocalThemeAPI.GetConfig.config;\n',m=[{content:e,fileName:"getComponentDirs.ts"},{content:o,fileName:"getTheme.ts"},{content:t,fileName:"updateTheme.ts"},{content:n,fileName:"uploadTheme.ts"},{content:a,fileName:"getConfig.ts"}];export{m as API_INFO,e as GET_COMPONENT_DIRS_API_CONTENT,a as GET_CONFIG_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,I,k,m,T,L;return t(this,(function(t){switch(t.label){case 0:return[4,n(s.join(p||process.cwd(),"src","components","__generated__","types"))];case 1:t.sent(),e={content:"",imports:[],internalCustomDatas:[]},t.label=2;case 2:t.trys.push([2,5,,6]),a.customData.forEach((function(t){c.generateAllCustomDataTypes(t,e,a)})),u=0,I=0;do{u=e.internalCustomDatas.length,e.internalCustomDatas.forEach((function(t){c.generateAllCustomDataTypes(t,e,a)})),(I=e.internalCustomDatas.length)!==u&&(e.internalCustomDatas=e.internalCustomDatas.splice(u,I))}while(u!==I);return[4,i.generate(a,e)];case 3:return t.sent(),k=s.join(p||process.cwd(),"src","components","__generated__"),e.imports=o(e.imports),m="import {\r\n",e.imports.forEach((function(e){m+="\t".concat(e,",\r\n")})),T=(m+='} from "@ikas/storefront"\r\n\r\n')+e.content,[4,r(k,"types.ts",T)];case 4:return[2,t.sent()];case 5:return L=t.sent(),console.log(L),[2,!1];case 6:return[2]}}))}))},c.generateAllCustomDataTypes=function(e,t,s){var r=e.type===a.ENUM,n="export ".concat(r?"enum":"type"," ").concat(c.generateTypeName(e)).concat(r?"":" = ","{ \r\n"),o="};\r\n\r\n";e.type!==a.DYNAMIC_LIST&&e.type!==a.STATIC_LIST||!e.nestedData?e.type===a.ENUM&&e.enumOptions?(t.content+=n,e.enumOptions.forEach((function(e){var a=e.value;e.value&&!isNaN(parseInt(e.value))&&(a="_"+e.value),t.content+='\t"'.concat(a,'" = "').concat(null==e?void 0:e.value,'",'),t.content+="\r\n"})),t.content+=o):(t.content+=n,e.nestedData&&e.nestedData.forEach((function(e){c.genenateCustomDataType(e,t,s),t.content+="\r\n"})),t.content+=o):c.generateAllCustomDataTypes(e.nestedData[0],t,s)},c.genenateCustomDataType=function(e,t,s){var r=c.getType(e,t,s);e.key&&e.key[0].match(/^\d/)&&(e.key="_"+e.key),t.content+="\t".concat(e.key).concat(e.isRequired?"":"?",": ").concat(r).concat([a.DYNAMIC_LIST,a.STATIC_LIST].includes(e.type)?"[]":"").concat(e.type===a.ENUM?",":";")},c.getType=function(e,t,s){var r="";switch(e.type){case a.TEXT:case a.RICH_TEXT:case a.COLOR:r="string";break;case a.BOOLEAN:r="boolean";break;case a.IMAGE:r="IkasImage",t.imports.push(r);break;case a.IMAGE_LIST:r="IkasImage[]",t.imports.push("IkasImage");break;case a.LINK:r="IkasNavigationLink",t.imports.push(r);break;case a.LIST_OF_LINK:r="IkasNavigationLink[]",t.imports.push("IkasNavigationLink");break;case a.PRODUCT_DETAIL:r="IkasProduct",t.imports.push(r);break;case a.PRODUCT_LIST:r="IkasProductList",t.imports.push("IkasProductList");break;case a.PRODUCT_ATTRIBUTE:r="IkasAttributeDetail",t.imports.push(r);break;case a.PRODUCT_ATTRIBUTE_LIST:r="IkasAttributeList",t.imports.push("IkasAttributeList");break;case a.BRAND:r="IkasBrand",t.imports.push(r);break;case a.BRAND_LIST:r="IkasBrandList",t.imports.push(r);break;case a.CATEGORY:r="IkasCategory",t.imports.push(r);break;case a.CATEGORY_LIST:r="IkasCategoryList",t.imports.push(r);break;case a.CUSTOM:var n=s.customData.find((function(t){return t.id===e.customDataId}));n&&(r=c.generateTypeName(n));break;case a.COMPONENT:r="IkasComponentRenderer",t.imports.push(r);break;case a.COMPONENT_LIST:r="IkasComponentRenderer[]",t.imports.push("IkasComponentRenderer");break;case a.BLOG:r="IkasBlog",t.imports.push(r);break;case a.BLOG_LIST:r="IkasBlogList",t.imports.push(r);break;case a.BLOG_CATEGORY:r="IkasBlogCategory",t.imports.push(r);break;case a.BLOG_CATEGORY_LIST:r="IkasBlogCategoryList",t.imports.push(r);break;case a.RAFFLE:r="IkasRaffle",t.imports.push(r);break;case a.RAFFLE_LIST:r="IkasRaffleList",t.imports.push(r);break;case a.SLIDER:r="IkasSlider",t.imports.push(r);break;case a.ENUM:case a.OBJECT:r=c.generateTypeName(e),t.content.includes("export enum ".concat(r))||t.internalCustomDatas.push(e);break;case a.DYNAMIC_LIST:case a.STATIC_LIST:e.nestedData&&(e.nestedData[0].type===a.OBJECT||e.nestedData[0].type===a.ENUM?(r=c.generateTypeName(e.nestedData[0]),t.content.includes("export type ".concat(r))||t.internalCustomDatas.push(e.nestedData[0])):r=c.getType(e.nestedData[0],t,s))}return r},c.generateTypeName=function(e){if(e.typescriptName)return e.typescriptName;var t=e.name||"";return(t=(t=t.replace(/\s/g,"")).replace(/\W/g,""))[0].match(/^\d/)&&(t="_"+t),e.type===a.ENUM&&(t+="Enum"),t},c}(),i=function(){function s(){}return s.generate=function(a,r){return e(this,void 0,void 0,(function(){return t(this,(function(e){return a.components.forEach((function(e){e.props.length>0&&"checkout"!==e.id&&(r.content+="export type ".concat(s.generatePropTypeName(e),"Props = {\n"),e.props.forEach((function(e){r.content+="\t".concat(e.name).concat(e.isRequired?"":"?",": ").concat(s.getType(e,a,r),";\n")})),r.content+="};\r\n\r\n")})),[2]}))}))},s.getType=function(e,t,s){var r="";switch(e.type){case a.TEXT:case a.RICH_TEXT:case a.COLOR:r="string";break;case a.BOOLEAN:r="boolean";break;case a.IMAGE:r="IkasImage",s.imports.push(r);break;case a.IMAGE_LIST:r="IkasImage[]",s.imports.push("IkasImage");break;case a.LINK:r="IkasNavigationLink",s.imports.push(r);break;case a.LIST_OF_LINK:r="IkasNavigationLink[]",s.imports.push("IkasNavigationLink");break;case a.PRODUCT_DETAIL:r="IkasProduct",s.imports.push(r);break;case a.PRODUCT_LIST:r="IkasProductList",s.imports.push("IkasProductList");break;case a.PRODUCT_ATTRIBUTE:r="IkasAttributeDetail",s.imports.push(r);break;case a.PRODUCT_ATTRIBUTE_LIST:r="IkasAttributeList[]",s.imports.push("IkasAttributeList");break;case a.BRAND:r="IkasBrand",s.imports.push(r);break;case a.BRAND_LIST:r="IkasBrandList",s.imports.push(r);break;case a.CATEGORY:r="IkasCategory",s.imports.push(r);break;case a.CATEGORY_LIST:r="IkasCategoryList",s.imports.push(r);break;case a.CUSTOM:var n=t.customData.find((function(t){return t.id===e.customDataId}));n&&(r=c.getType(n,s,t),n.type!==a.DYNAMIC_LIST&&n.type!==a.STATIC_LIST||(r+="[]"));break;case a.COMPONENT:r="IkasComponentRenderer",s.imports.push(r);break;case a.COMPONENT_LIST:r="IkasComponentRenderer[]",s.imports.push("IkasComponentRenderer");break;case a.BLOG:r="IkasBlog",s.imports.push(r);break;case a.BLOG_LIST:r="IkasBlogList",s.imports.push(r);break;case a.BLOG_CATEGORY:r="IkasBlogCategory",s.imports.push(r);break;case a.BLOG_CATEGORY_LIST:r="IkasBlogCategoryList",s.imports.push(r);break;case a.RAFFLE:r="IkasRaffle",s.imports.push(r);break;case a.RAFFLE_LIST:r="IkasRaffleList",s.imports.push(r);break;case a.SLIDER:r="IkasSlider",s.imports.push(r)}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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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};
|
|
@@ -0,0 +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";
|
|
@@ -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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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, contextLocale?: string): 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): Promise<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 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 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=s().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,s,i,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,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 l=e.sent(),p=S.createColorScript(l.settings),[4,S.createFontScript(l.settings)];case 6:return d=e.sent(),p&&i.push(p),d&&i.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:s,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: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 n=this;return e(this,(function(s){return[2,new Promise((function(s){return t(n,void 0,void 0,(function(){var n,i,c,a,u,p,d,g,f,m,h,v;return e(this,(function(C){switch(C.label){case 0:return[4,S.readSettingsFile()];case 1:return(n=C.sent())&&n.localizationMap?(i=n.storefront,c=n.salesChannel,a=n.localizationMap,u=n.storefrontJSScripts||[],p=n.domain,d=n.productBackInStockSettings?{customerLoginRequired:n.productBackInStockSettings.customerLoginRequired}:null,g=n.customerReviewSettings?{customerLoginRequired:n.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:n.customerReviewSettings.customerPurchaseRequired||!1}:null,(f=n.merchantSettings)?[3,3]:[4,l({})]):[2,s(null)];case 2:if(!(m=C.sent()).isSuccess||!m.data)return console.error("MERCHANT SETTINGS FETCH FAILED!"),[2,s(null)];f=m.data,C.label=3;case 3:return h=a[r],v=i.routings.find((function(t){return t.id===r||t.path===r})),h&&v?(o.readFile(h,{flag:"a+"},(function(r,o){return t(this,void 0,void 0,(function(){var t,a,l,m,h,C,I;return e(this,(function(e){switch(e.label){case 0:return r?(console.error("THEME LOCALIZATION FILE READ ERROR!!!"),console.error(r),[2,s(null)]):(t=o.length?JSON.parse(o.toString()):{},l=(a=t).themeJson.settings.favicon,m=a.themeJson.settings.stockPreference,a.themeJson.settings?(h=S.createColorScript(a.themeJson.settings),[4,S.createFontScript(a.themeJson.settings)]):[3,2]);case 1:C=e.sent(),h&&u.push(h),C&&u.push(C),e.label=2;case 2:return I=n.customerSettings,s({storefront:i,themeLocalization:a,salesChannel:c,routing:v,favicon:l,stockPreference:m,storefrontJSScripts:u,domain:p,productBackInStockSettings:d,customerReviewSettings:g,merchantSettings:f,customerSettings:I}),[2]}}))}))})),[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 n;return t(this,void 0,void 0,(function(){var t,o,s,i,c,u,l,d,g,f,m;return e(this,(function(e){return t=r.storefront,o=r.salesChannel,s=r.routing,i=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,cdnUrl:process.env.NEXT_PUBLIC_CDN_URL,storefrontId:t.id,storefrontRoutingId:s.id,storefrontThemeId:t.mainStorefrontThemeId,salesChannelId:t.salesChannelId,priceListId:s.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:i||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,l){return t(this,void 0,void 0,(function(){var t,p,d,g,m,h,S,v;return e(this,(function(e){switch(e.label){case 0:return t=s().serverRuntimeConfig,p=n.routing,d="local"===process.env.NEXT_PUBLIC_ENV,g=n.themeLocalization.themeJson.components.filter((function(t){return u||o.includes(t.id)})),m=r(["common"],g.map((function(t){return t.dir})),!0),(c===i.CHECKOUT||u)&&m.push("checkout-page"),h=t.nextI18nConf,S=d&&l?l:p.locale,[4,new f(S,m,d?void 0:h.localePath).read()];case 1:return v=e.sent(),a.init({translations:v}),[2]}}))}))},S.getExtraProps=function(r,n,o){var s,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!==i.CHECKOUT?[3,2]:(l=null===(s=n.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=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,s,i,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,cdnUrl:process.env.NEXT_PUBLIC_CDN_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]:[]),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,s,u,g)];case 5:return e.sent(),[4,this.getExtraProps(f,h,s)];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,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,n,o,s)];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(r){return t(this,void 0,void 0,(function(){var t,n,o;return e(this,(function(e){switch(e.label){case 0:return(t=g(r.fontFamily))?[4,fetch(t,{headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"}})]:[3,3];case 1:return[4,e.sent().text()];case 2:return n=e.sent(),o=n.replace(new RegExp("fonts.gstatic.com","g"),"fonts.myikas.com"),[2,"<style>\n ".concat(o,"\n\n body { \n font-family: '").concat(r.fontFamily.name,'\', -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;\n } \n\n </style>')];case 3:return[2]}}))}))},S.startTime=Date.now(),S}();export{S as IkasNextPageDataProvider};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Divides the given filePath string into directory part and fileName part
|
|
3
|
+
* @param path Path for the file
|
|
4
|
+
*/
|
|
5
|
+
export declare function getFilePathParts(path: string): {
|
|
6
|
+
dirParts: string[];
|
|
7
|
+
filePart: string;
|
|
8
|
+
} | {
|
|
9
|
+
filePart: string;
|
|
10
|
+
dirParts?: undefined;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Deletes the contents of the given directory, exluding the ignoreFiles
|
|
14
|
+
* @param dirPath Path for the directory
|
|
15
|
+
* @param ignoreFiles List of files to keep in directory. Does not accept recursive paths, only first level files
|
|
16
|
+
*
|
|
17
|
+
* @returns true for successfull operation, false otherwise
|
|
18
|
+
*/
|
|
19
|
+
export declare function deleteDirContent(dirPath: string, ignoreFiles?: string[]): Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Creates the given file and directories for the filePath
|
|
22
|
+
* @param basePath Base directory path for the file
|
|
23
|
+
* @param fileSubPath Filename or the sub directory path for the file to write
|
|
24
|
+
* @param fileStr File contents
|
|
25
|
+
*
|
|
26
|
+
* @returns true for successfull operation, false otherwise
|
|
27
|
+
*/
|
|
28
|
+
export declare function createFile(basePath: string, fileSubPath: string, fileStr: string): Promise<boolean>;
|
|
@@ -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 u(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 c(u,c,l){var s;return r(this,void 0,void 0,(function(){var r,d,f;return t(this,(function(t){try{return r=u,d=o(c),(null===(s=d.dirParts)||void 0===s?void 0:s.length)&&(r=e.join.apply(e,n([r],d.dirParts,!1))),i.existsSync(r)||i.mkdirSync(r,{recursive:!0}),f=e.join(r,d.filePart),i.writeFileSync(f,l),[2,!0]}catch(r){return console.error(r),[2,!1]}return[2]}))}))}export{c as createFile,u as deleteDirContent,o as getFilePathParts};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a=function(a){if(a.name){var t=a.name.replace(/ /g,"+"),e="";if(a.variants){e+=":";var r=a.variants.some((function(a){return"italic"===a}));if(r&&(e+="ital,"),e+="wght@",r){var n=new RegExp("italic","i");e+=a.variants.reduce((function(a,t){return n.test(t)?a:a+"0,".concat(t.replace("regular","400"),";")}),""),e+=a.variants.reduce((function(a,t){return n.test(t)?a+"1,".concat("italic"===t?"400":t.replace("italic",""),";"):a}),"")}else e+=a.variants.reduce((function(a,t){return a+"".concat(t.replace("regular","400"),";")}),"");e=e.substring(0,e.length-1),e+="&display=swap"}return"https://fonts.myikas.com/css2?family=".concat(t).concat(e)}};export{a as getGoogleFontHref};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const CHECKOUT_TRANSLATION_NAMESPACE = "checkout-page";
|
|
2
|
+
export declare class I18NFileReader {
|
|
3
|
+
locale: string;
|
|
4
|
+
namespaces: string[];
|
|
5
|
+
localePath?: string;
|
|
6
|
+
constructor(locale: string, namespaces: string[], localePath?: string);
|
|
7
|
+
read(): Promise<Record<string, any>>;
|
|
8
|
+
private readLocaleFile;
|
|
9
|
+
}
|
|
@@ -0,0 +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};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront-next",
|
|
3
|
-
"version": "4.5.0-beta.
|
|
3
|
+
"version": "4.5.0-beta.6",
|
|
4
4
|
"description": "Next.js specific functions for ikas storefront themes.",
|
|
5
5
|
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
7
|
-
"main": "
|
|
8
|
-
"module": "
|
|
7
|
+
"main": "build/index.js",
|
|
8
|
+
"module": "build/index.js",
|
|
9
9
|
"files": [
|
|
10
|
-
"
|
|
10
|
+
"build"
|
|
11
11
|
],
|
|
12
12
|
"type": "module",
|
|
13
13
|
"scripts": {
|
|
@@ -17,23 +17,23 @@
|
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"next": "12.2.0",
|
|
20
|
-
"@ikas/storefront-config": "^4.5.0-beta.
|
|
21
|
-
"@ikas/storefront-providers": "^4.5.0-beta.
|
|
22
|
-
"@ikas/storefront-models": "^4.5.0-beta.
|
|
23
|
-
"@ikas/storefront-api": "^4.5.0-beta.
|
|
24
|
-
"@ikas/storefront-assets": "^4.5.0-beta.
|
|
20
|
+
"@ikas/storefront-config": "^4.5.0-beta.6",
|
|
21
|
+
"@ikas/storefront-providers": "^4.5.0-beta.6",
|
|
22
|
+
"@ikas/storefront-models": "^4.5.0-beta.6",
|
|
23
|
+
"@ikas/storefront-api": "^4.5.0-beta.6",
|
|
24
|
+
"@ikas/storefront-assets": "^4.5.0-beta.6",
|
|
25
25
|
"axios": "^0.26.0",
|
|
26
26
|
"lodash": "^4.17.21",
|
|
27
27
|
"cors": "^2.8.5",
|
|
28
28
|
"adm-zip": "^0.5.9"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@ikas/storefront-cmd": "^4.5.0-beta.
|
|
32
|
-
"@ikas/storefront-config": "^4.5.0-beta.
|
|
33
|
-
"@ikas/storefront-providers": "^4.5.0-beta.
|
|
34
|
-
"@ikas/storefront-models": "^4.5.0-beta.
|
|
35
|
-
"@ikas/storefront-api": "^4.5.0-beta.
|
|
36
|
-
"@ikas/storefront-assets": "^4.5.0-beta.
|
|
31
|
+
"@ikas/storefront-cmd": "^4.5.0-beta.6",
|
|
32
|
+
"@ikas/storefront-config": "^4.5.0-beta.6",
|
|
33
|
+
"@ikas/storefront-providers": "^4.5.0-beta.6",
|
|
34
|
+
"@ikas/storefront-models": "^4.5.0-beta.6",
|
|
35
|
+
"@ikas/storefront-api": "^4.5.0-beta.6",
|
|
36
|
+
"@ikas/storefront-assets": "^4.5.0-beta.6",
|
|
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",
|