@ikas/storefront-next 4.5.13 → 4.7.0-beta.1
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/uploadTheme.js +1 -1
- package/build/utils/i18n.js +1 -1
- package/package.json +12 -12
package/build/api/uploadTheme.js
CHANGED
|
@@ -1 +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
|
|
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/fr.js";import u from"@ikas/storefront-assets/checkout/tr.js";import{corsMiddleware as l}from"./middleware.js";var d=function(s,d){return e(void 0,void 0,void 0,(function(){var e,h,y,v,g,S,j,w,b;return r(this,(function(r){switch(r.label){case 0:return[4,l(s,d)];case 1:r.sent(),e=function(){d.statusCode=200,d.setHeader("Content-Type","application/json"),d.json({status:"ok"})},h=function(){d.statusCode=400,d.setHeader("Content-Type","application/json"),d.json({status:"failed"})},y="",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 v=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(l,d){if(l)return r(l);var h=d.filter((function(e){return t.lstatSync(n.join(o,e)).isDirectory()})),f={},p=!1;h.forEach((function(e){var r=n.join(process.cwd(),"public","locales",e);f[e]={};try{var o=t.readdirSync(r);o.forEach((function(r){var o=t.readFileSync(n.join(process.cwd(),"public","locales",e,r)),l=s(e).toLowerCase(),d=s(r);f[l][d]=JSON.parse(o.toString()),f[l]["checkout-page"]="tr"===l?u:"de"===l?i:"fr"===l?a:c}))}catch(e){console.error("An error occurred while reading localization files!"),console.error(e),p=!0}})),p?r(null):e(f)}))}))];case 4:return g=r.sent(),[4,f(v,g)];case 5:return S=r.sent(),j=!1,"string"!=typeof S?[3,8]:(T=n.join(process.cwd()),N="theme.zip",L=n.join(process.cwd(),N),k=new o,C=["node_modules",".next","out",".git"],t.readdirSync(T).forEach((function(e){var r=n.join(T,e);if(t.lstatSync(r).isDirectory()){if(C.includes(e))return;k.addLocalFolder(r,e)}else k.addLocalFile(e)})),k.writeZip(L),y=L,w=t.statSync(y),[4,p(S,t.readFileSync(y),w.size)]);case 6:return(j=r.sent())?[4,m()]:[3,8];case 7:j=r.sent(),r.label=8;case 8:return j?e():h(),[3,11];case 9:return b=r.sent(),console.error(b),h(),[3,11];case 10:return y&&function(e){try{t.unlinkSync(e)}catch(e){console.error("An error occurrred while deleting the zip file!"),console.error(e)}}(y),[7];case 11:return[2]}var T,N,L,k,C}))}))},h={};function f(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,y()];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+""},maxBodyLength:104857600,maxContentLength:104857600},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 m(){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,y()];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 y(){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{h as config,d as uploadTheme};
|
package/build/utils/i18n.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'./../ext/tslib/tslib.es6.js';import
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../ext/tslib/tslib.es6.js';import s from"fs";import r from"path";var o="checkout-page",n=function(){function o(e,t,s){this.locale=e,this.namespaces=t,this.localePath=s}return o.prototype.read=function(){return e(this,void 0,void 0,(function(){var e,o,n,a,c,i,l,u,h;return t(this,(function(t){switch(t.label){case 0:e={},o=0,n=this.namespaces,t.label=1;case 1:if(!(o<n.length))return[3,16];a=n[o],t.label=2;case 2:return t.trys.push([2,14,,15]),c=this.localePath?r.join(this.localePath,this.locale,a+".json"):r.join(process.cwd(),"public","locales",this.locale,a+".json"),s.existsSync(c)?[4,this.readLocaleFile(c)]:[3,4];case 3:return i=t.sent(),e[a]=i,[3,13];case 4:return"checkout-page"!==a?[3,13]:(l={},"tr"!==this.locale?[3,6]:[4,import("@ikas/storefront-assets/checkout/tr.js")]);case 5:return u=t.sent(),l=u.default,[3,12];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,12];case 8:return"fr"!==this.locale?[3,10]:[4,import("@ikas/storefront-assets/checkout/fr.js")];case 9:return u=t.sent(),l=u.default,[3,12];case 10:return[4,import("@ikas/storefront-assets/checkout/en.js")];case 11:u=t.sent(),l=u.default,t.label=12;case 12:e[a]=l,t.label=13;case 13:return[3,15];case 14:return h=t.sent(),console.error("I18N FILE READ ERROR!"),console.error(h),[3,15];case 15:return o++,[3,1];case 16:return[2,e]}}))}))},o.prototype.readLocaleFile=function(r){return e(this,void 0,void 0,(function(){return t(this,(function(e){return[2,new Promise((function(e,t){s.readFile(r,{flag:"r"},(function(s,r){if(s)return t(s);var o=r.length?JSON.parse(r.toString()):{};e(o)}))}))]}))}))},o}();export{o as CHECKOUT_TRANSLATION_NAMESPACE,n as I18NFileReader};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront-next",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0-beta.1",
|
|
4
4
|
"description": "Next.js specific functions for ikas storefront themes.",
|
|
5
5
|
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -17,23 +17,23 @@
|
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"next": "12.2.0",
|
|
20
|
-
"@ikas/storefront-config": "^4.
|
|
21
|
-
"@ikas/storefront-providers": "^4.
|
|
22
|
-
"@ikas/storefront-models": "^4.
|
|
23
|
-
"@ikas/storefront-api": "^4.
|
|
24
|
-
"@ikas/storefront-assets": "^4.
|
|
20
|
+
"@ikas/storefront-config": "^4.7.0-beta.1",
|
|
21
|
+
"@ikas/storefront-providers": "^4.7.0-beta.1",
|
|
22
|
+
"@ikas/storefront-models": "^4.7.0-beta.1",
|
|
23
|
+
"@ikas/storefront-api": "^4.7.0-beta.1",
|
|
24
|
+
"@ikas/storefront-assets": "^4.7.0-beta.1",
|
|
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.
|
|
32
|
-
"@ikas/storefront-config": "^4.
|
|
33
|
-
"@ikas/storefront-providers": "^4.
|
|
34
|
-
"@ikas/storefront-models": "^4.
|
|
35
|
-
"@ikas/storefront-api": "^4.
|
|
36
|
-
"@ikas/storefront-assets": "^4.
|
|
31
|
+
"@ikas/storefront-cmd": "^4.7.0-beta.1",
|
|
32
|
+
"@ikas/storefront-config": "^4.7.0-beta.1",
|
|
33
|
+
"@ikas/storefront-providers": "^4.7.0-beta.1",
|
|
34
|
+
"@ikas/storefront-models": "^4.7.0-beta.1",
|
|
35
|
+
"@ikas/storefront-api": "^4.7.0-beta.1",
|
|
36
|
+
"@ikas/storefront-assets": "^4.7.0-beta.1",
|
|
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",
|