@ikas/storefront-next 4.0.0-alpha.28 → 4.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +14 -14
- package/src/api/getTheme.ts +1 -1
- package/src/api/uploadTheme.ts +1 -5
- package/src/provider/page-data-next.ts +16 -2
- package/src/utils/i18n.ts +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront-next",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.3",
|
|
4
4
|
"description": "Next.js specific functions for ikas storefront themes.",
|
|
5
5
|
"author": "Umut Ozan Yıldırım",
|
|
6
6
|
"license": "ISC",
|
|
@@ -16,24 +16,24 @@
|
|
|
16
16
|
"build": "rm -rf build && rollup -c"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"next": "
|
|
20
|
-
"@ikas/storefront-config": "^4.0.0-alpha.
|
|
21
|
-
"@ikas/storefront-providers": "^4.0.0-alpha.
|
|
22
|
-
"@ikas/storefront-models": "^4.0.0-alpha.
|
|
23
|
-
"@ikas/storefront-api": "^4.0.0-alpha.
|
|
24
|
-
"@ikas/storefront-assets": "^4.0.0-alpha.
|
|
19
|
+
"next": "canary",
|
|
20
|
+
"@ikas/storefront-config": "^4.0.0-alpha.3",
|
|
21
|
+
"@ikas/storefront-providers": "^4.0.0-alpha.3",
|
|
22
|
+
"@ikas/storefront-models": "^4.0.0-alpha.3",
|
|
23
|
+
"@ikas/storefront-api": "^4.0.0-alpha.3",
|
|
24
|
+
"@ikas/storefront-assets": "^4.0.0-alpha.3",
|
|
25
25
|
"axios": "^0.21.0",
|
|
26
26
|
"lodash": "^4.17.21",
|
|
27
27
|
"archiver": "^5.3.0",
|
|
28
28
|
"cors": "^2.8.5"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@ikas/storefront-cmd": "^4.0.0-alpha.
|
|
32
|
-
"@ikas/storefront-config": "^4.0.0-alpha.
|
|
33
|
-
"@ikas/storefront-providers": "^4.0.0-alpha.
|
|
34
|
-
"@ikas/storefront-models": "^4.0.0-alpha.
|
|
35
|
-
"@ikas/storefront-api": "^4.0.0-alpha.
|
|
36
|
-
"@ikas/storefront-assets": "^4.0.0-alpha.
|
|
31
|
+
"@ikas/storefront-cmd": "^4.0.0-alpha.3",
|
|
32
|
+
"@ikas/storefront-config": "^4.0.0-alpha.3",
|
|
33
|
+
"@ikas/storefront-providers": "^4.0.0-alpha.3",
|
|
34
|
+
"@ikas/storefront-models": "^4.0.0-alpha.3",
|
|
35
|
+
"@ikas/storefront-api": "^4.0.0-alpha.3",
|
|
36
|
+
"@ikas/storefront-assets": "^4.0.0-alpha.3",
|
|
37
37
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
38
38
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
39
39
|
"@rollup/plugin-json": "^4.1.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@types/node-fetch": "^2.5.7",
|
|
43
43
|
"@types/cors": "^2.8.9",
|
|
44
44
|
"@types/lodash": "^4.14.168",
|
|
45
|
-
"next": "
|
|
45
|
+
"next": "canary",
|
|
46
46
|
"prettier": "^2.2.1",
|
|
47
47
|
"rollup": "^2.75.6",
|
|
48
48
|
"rollup-plugin-terser": "^7.0.2",
|
package/src/api/getTheme.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NextApiRequest, NextApiResponse } from "next";
|
|
2
2
|
import { corsMiddleware } from "./middleware";
|
|
3
|
-
import { ThemeJsonGenerator } from "@ikas/storefront-cmd";
|
|
3
|
+
import { ThemeJsonGenerator } from "@ikas/storefront-cmd/build/scripts/generators/theme";
|
|
4
4
|
|
|
5
5
|
export const getTheme = async (req: NextApiRequest, res: NextApiResponse) => {
|
|
6
6
|
try {
|
package/src/api/uploadTheme.ts
CHANGED
|
@@ -4,8 +4,6 @@ import archiver from "archiver";
|
|
|
4
4
|
import { NextApiRequest, NextApiResponse } from "next";
|
|
5
5
|
import axios from "axios";
|
|
6
6
|
|
|
7
|
-
//@ts-ignore
|
|
8
|
-
import CheckoutDE from "@ikas/storefront-assets/checkout/de.js";
|
|
9
7
|
//@ts-ignore
|
|
10
8
|
import CheckoutEN from "@ikas/storefront-assets/checkout/en.js";
|
|
11
9
|
//@ts-ignore
|
|
@@ -168,7 +166,7 @@ async function saveTheme(theme: any, localization: Record<string, any>) {
|
|
|
168
166
|
// "Content-Type": "application/json",
|
|
169
167
|
// },
|
|
170
168
|
// });
|
|
171
|
-
const responseJSON = await response.data;
|
|
169
|
+
const responseJSON = await response.data();
|
|
172
170
|
|
|
173
171
|
if (responseJSON.data && responseJSON.data.saveTheme) {
|
|
174
172
|
return responseJSON.data.saveTheme.uploadUrl as string;
|
|
@@ -292,8 +290,6 @@ function readLocalizationFiles(): Promise<Record<string, any>> {
|
|
|
292
290
|
|
|
293
291
|
if (strippedLocale === "tr") {
|
|
294
292
|
locales[strippedLocale]["checkout-page"] = CheckoutTR;
|
|
295
|
-
} else if (strippedLocale === "de") {
|
|
296
|
-
locales[strippedLocale]["checkout-page"] = CheckoutDE;
|
|
297
293
|
} else {
|
|
298
294
|
locales[strippedLocale]["checkout-page"] = CheckoutEN;
|
|
299
295
|
}
|
|
@@ -21,7 +21,7 @@ import { IkasStorefrontConfig } from "@ikas/storefront-config";
|
|
|
21
21
|
import {
|
|
22
22
|
listCheckoutSettings,
|
|
23
23
|
listMerchantSettings,
|
|
24
|
-
|
|
24
|
+
IkasAPIClientConfig,
|
|
25
25
|
getStorefrontSettings,
|
|
26
26
|
IkasStorefrontSettings,
|
|
27
27
|
} from "@ikas/storefront-api";
|
|
@@ -98,6 +98,19 @@ export class IkasNextPageDataProvider {
|
|
|
98
98
|
} catch {}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
static setAPIClientConfig() {
|
|
102
|
+
IkasAPIClientConfig.URL = IkasStorefrontConfig.getApiUrl() || "";
|
|
103
|
+
IkasAPIClientConfig.HEADERS = {
|
|
104
|
+
"x-api-key": IkasStorefrontConfig.getApiKey() || "",
|
|
105
|
+
"x-sfid": IkasStorefrontConfig.getStorefrontId() || "",
|
|
106
|
+
"x-sfrid": IkasStorefrontConfig.getStorefrontRoutingId() || "",
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
if (IkasStorefrontConfig.getCustomerToken()) {
|
|
110
|
+
IkasAPIClientConfig.TOKEN = IkasStorefrontConfig.getCustomerToken() || "";
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
101
114
|
static async getLocalSettings(locale: string): Promise<SettingsData | null> {
|
|
102
115
|
let settings: IkasStorefrontSettings =
|
|
103
116
|
await IkasNextPageDataProvider.readLocalSettingsFile();
|
|
@@ -435,12 +448,13 @@ export class IkasNextPageDataProvider {
|
|
|
435
448
|
const isLocal = process.env.NEXT_PUBLIC_ENV === "local";
|
|
436
449
|
const isProdEditor = !isLocal && isEditor;
|
|
437
450
|
|
|
451
|
+
IkasNextPageDataProvider.setAPIClientConfig();
|
|
452
|
+
|
|
438
453
|
IkasStorefrontConfig.init({
|
|
439
454
|
apiUrl: process.env.NEXT_PUBLIC_GQL_URL,
|
|
440
455
|
adminApiUrl: process.env.NEXT_PUBLIC_UPLOAD_GQL_URL,
|
|
441
456
|
cdnUrl: process.env.NEXT_PUBLIC_IMG_BASE_URL,
|
|
442
457
|
});
|
|
443
|
-
setAPIClientConfig();
|
|
444
458
|
|
|
445
459
|
// Local editor - prod deploy - local build
|
|
446
460
|
if (!isProdEditor) {
|
package/src/utils/i18n.ts
CHANGED
|
@@ -42,12 +42,6 @@ export class I18NFileReader {
|
|
|
42
42
|
"@ikas/storefront-assets/checkout/tr.js"
|
|
43
43
|
);
|
|
44
44
|
checkoutTranslation = imported.default;
|
|
45
|
-
} else if (this.locale === "de") {
|
|
46
|
-
const imported = await import(
|
|
47
|
-
//@ts-ignore
|
|
48
|
-
"@ikas/storefront-assets/checkout/de.js"
|
|
49
|
-
);
|
|
50
|
-
checkoutTranslation = imported.default;
|
|
51
45
|
} else {
|
|
52
46
|
const imported = await import(
|
|
53
47
|
//@ts-ignore
|