@ikas/storefront-next 4.4.0-beta.3 → 4.4.0-beta.4
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/package.json +17 -17
package/build/api/uploadTheme.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'./../ext/tslib/tslib.es6.js';import n from"fs";import r from"path";import s from"
|
|
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"adm-zip";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(o,l){return e(void 0,void 0,void 0,(function(){var e,d,m,y,v,S,j,w,b;return t(this,(function(t){switch(t.label){case 0:return[4,u(o,l)];case 1:t.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="",t.label=2;case 2:return t.trys.push([2,9,10,11]),[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 y=t.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()})),p={},f=!1;d.forEach((function(e){var t=r.join(process.cwd(),"public","locales",e);p[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);p[u][l]=JSON.parse(s.toString()),p[u]["checkout-page"]="tr"===u?c:"de"===u?i:a}))}catch(e){console.error(e),f=!0}})),f?t(null):e(p)}))}))];case 4:return v=t.sent(),[4,p(y,v)];case 5:return S=t.sent(),j=!1,"string"!=typeof S?[3,8]:(g=r.join(process.cwd()),T="theme.zip",N=r.join(process.cwd(),T),L=new s,k=["node_modules",".next","out",".git"],n.readdirSync(g).forEach((function(e){var t=r.join(g,e);if(n.lstatSync(t).isDirectory()){if(k.includes(e))return;L.addLocalFolder(t,e)}else L.addLocalFile(e)})),L.writeZip(N),m=N,w=n.statSync(m),[4,f(S,n.readFileSync(m),w.size)]);case 6:return(j=t.sent())?[4,h()]:[3,8];case 7:j=t.sent(),t.label=8;case 8:return j?e():d(),[3,11];case 9:return b=t.sent(),console.error(b),d(),[3,11];case 10:return m&&function(e){try{n.unlinkSync(e)}catch(e){console.error(e)}}(m),[7];case 11:return[2]}var g,T,N,L,k}))}))},d={};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_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(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.createNewThemeVersion?[2,a.data.createNewThemeVersion.uploadUrl]:[3,5];case 4:return c=t.sent(),console.log(c),[3,5];case 5:return[2]}}))}))}function f(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 h(){return e(this,void 0,void 0,(function(){var e,n;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_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,t.sent().json()];case 3:return t.sent(),[2,!0];case 4:return n=t.sent(),console.log(n),[2,!1];case 5: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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront-next",
|
|
3
|
-
"version": "4.4.0-beta.
|
|
3
|
+
"version": "4.4.0-beta.4",
|
|
4
4
|
"description": "Next.js specific functions for ikas storefront themes.",
|
|
5
5
|
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -17,32 +17,32 @@
|
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"next": "12.2.0",
|
|
20
|
-
"@ikas/storefront-config": "^4.4.0-beta.
|
|
21
|
-
"@ikas/storefront-providers": "^4.4.0-beta.
|
|
22
|
-
"@ikas/storefront-models": "^4.4.0-beta.
|
|
23
|
-
"@ikas/storefront-api": "^4.4.0-beta.
|
|
24
|
-
"@ikas/storefront-assets": "^4.4.0-beta.
|
|
20
|
+
"@ikas/storefront-config": "^4.4.0-beta.4",
|
|
21
|
+
"@ikas/storefront-providers": "^4.4.0-beta.4",
|
|
22
|
+
"@ikas/storefront-models": "^4.4.0-beta.4",
|
|
23
|
+
"@ikas/storefront-api": "^4.4.0-beta.4",
|
|
24
|
+
"@ikas/storefront-assets": "^4.4.0-beta.4",
|
|
25
25
|
"axios": "^0.26.0",
|
|
26
26
|
"lodash": "^4.17.21",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
27
|
+
"cors": "^2.8.5",
|
|
28
|
+
"adm-zip": "^0.5.9"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@ikas/storefront-cmd": "^4.4.0-beta.
|
|
32
|
-
"@ikas/storefront-config": "^4.4.0-beta.
|
|
33
|
-
"@ikas/storefront-providers": "^4.4.0-beta.
|
|
34
|
-
"@ikas/storefront-models": "^4.4.0-beta.
|
|
35
|
-
"@ikas/storefront-api": "^4.4.0-beta.
|
|
36
|
-
"@ikas/storefront-assets": "^4.4.0-beta.
|
|
31
|
+
"@ikas/storefront-cmd": "^4.4.0-beta.4",
|
|
32
|
+
"@ikas/storefront-config": "^4.4.0-beta.4",
|
|
33
|
+
"@ikas/storefront-providers": "^4.4.0-beta.4",
|
|
34
|
+
"@ikas/storefront-models": "^4.4.0-beta.4",
|
|
35
|
+
"@ikas/storefront-api": "^4.4.0-beta.4",
|
|
36
|
+
"@ikas/storefront-assets": "^4.4.0-beta.4",
|
|
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",
|
|
40
40
|
"rollup-plugin-rename-node-modules": "^1.2.0",
|
|
41
|
-
"@types/archiver": "^5.1.0",
|
|
42
41
|
"@types/node": "^14.14.6",
|
|
43
42
|
"@types/node-fetch": "^2.5.7",
|
|
44
43
|
"@types/cors": "^2.8.9",
|
|
45
44
|
"@types/lodash": "^4.14.168",
|
|
45
|
+
"@types/adm-zip": "^0.5.0",
|
|
46
46
|
"next": "12.2.0",
|
|
47
47
|
"prettier": "^2.2.1",
|
|
48
48
|
"rollup": "^2.75.6",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"typescript-transform-paths": "^2.2.2",
|
|
55
55
|
"axios": "^0.26.0",
|
|
56
56
|
"lodash": "^4.17.21",
|
|
57
|
-
"
|
|
58
|
-
"
|
|
57
|
+
"cors": "^2.8.5",
|
|
58
|
+
"adm-zip": "^0.5.9"
|
|
59
59
|
}
|
|
60
60
|
}
|