@ikas/storefront 0.0.160 → 0.0.161-alpha.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/index.es.js +26 -13
- package/build/index.js +26 -13
- package/build/utils/settings.d.ts +45 -9
- package/package.json +3 -1
package/build/index.es.js
CHANGED
|
@@ -7,6 +7,7 @@ import Link from 'next/link';
|
|
|
7
7
|
import NextImage from 'next/image';
|
|
8
8
|
import fs from 'fs';
|
|
9
9
|
import getConfig from 'next/config';
|
|
10
|
+
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
|
|
10
11
|
import dynamic from 'next/dynamic';
|
|
11
12
|
import Error$1 from 'next/error';
|
|
12
13
|
|
|
@@ -37902,7 +37903,7 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
37902
37903
|
id: storefront.salesChannelId,
|
|
37903
37904
|
}),
|
|
37904
37905
|
routing: storefront.routings.length
|
|
37905
|
-
? storefront.routings.find(function (r) { return !r.path && !r.domain
|
|
37906
|
+
? storefront.routings.find(function (r) { return r.locale === locale; }) || //storefront.routings.find((r) => !r.path && !r.domain) ||
|
|
37906
37907
|
storefront.routings[0]
|
|
37907
37908
|
: new IkasStorefrontRouting({}),
|
|
37908
37909
|
favicon: localTheme.settings.favicon,
|
|
@@ -37953,9 +37954,10 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
37953
37954
|
SettingsHelper.getPageData = function (context, isServer, pageType, possiblePageTypes) {
|
|
37954
37955
|
var _a;
|
|
37955
37956
|
return __awaiter(this, void 0, void 0, function () {
|
|
37956
|
-
var isLocal, locale, settings, storefront, themeLocalization, salesChannel, routing, favicon, stockPreference, provider;
|
|
37957
|
-
|
|
37958
|
-
|
|
37957
|
+
var isLocal, locale, settings, storefront, themeLocalization, salesChannel, routing, favicon, stockPreference, provider, componentIds, components, componentDirs, _b, _c;
|
|
37958
|
+
var _d, _e;
|
|
37959
|
+
return __generator(this, function (_f) {
|
|
37960
|
+
switch (_f.label) {
|
|
37959
37961
|
case 0:
|
|
37960
37962
|
isLocal = process.env.NEXT_PUBLIC_ENV === "local";
|
|
37961
37963
|
locale = isLocal ? "en" : context.locale;
|
|
@@ -37967,7 +37969,7 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
37967
37969
|
}
|
|
37968
37970
|
return [4 /*yield*/, SettingsHelper.getSettings(locale)];
|
|
37969
37971
|
case 1:
|
|
37970
|
-
settings =
|
|
37972
|
+
settings = _f.sent();
|
|
37971
37973
|
if (!settings ||
|
|
37972
37974
|
!settings.storefront.mainStorefrontThemeId ||
|
|
37973
37975
|
!settings.storefront.salesChannelId) {
|
|
@@ -37993,20 +37995,31 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
37993
37995
|
provider.possiblePageTypes = possiblePageTypes;
|
|
37994
37996
|
return [4 /*yield*/, provider.getPageData()];
|
|
37995
37997
|
case 2:
|
|
37996
|
-
|
|
37998
|
+
_f.sent();
|
|
37997
37999
|
if (!provider.page) {
|
|
37998
38000
|
return [2 /*return*/, {
|
|
37999
38001
|
props: {},
|
|
38000
38002
|
notFound: true,
|
|
38001
38003
|
}];
|
|
38002
38004
|
}
|
|
38003
|
-
|
|
38004
|
-
|
|
38005
|
-
|
|
38006
|
-
|
|
38007
|
-
|
|
38008
|
-
|
|
38009
|
-
|
|
38005
|
+
componentIds = provider.page.components.map(function (pc) { return pc.componentId; });
|
|
38006
|
+
components = themeLocalization.themeJson.components.filter(function (c) {
|
|
38007
|
+
return componentIds.includes(c.id);
|
|
38008
|
+
});
|
|
38009
|
+
componentDirs = __spreadArrays(["common"], components.map(function (c) { return c.dir; }));
|
|
38010
|
+
if (!isServer) return [3 /*break*/, 4];
|
|
38011
|
+
_d = {};
|
|
38012
|
+
_b = [{}];
|
|
38013
|
+
return [4 /*yield*/, serverSideTranslations(locale, componentDirs)];
|
|
38014
|
+
case 3: return [2 /*return*/, (_d.props = __assign.apply(void 0, [__assign.apply(void 0, _b.concat([(_f.sent())])), provider.nextPageData.props]),
|
|
38015
|
+
_d)];
|
|
38016
|
+
case 4:
|
|
38017
|
+
_e = {};
|
|
38018
|
+
_c = [{}];
|
|
38019
|
+
return [4 /*yield*/, serverSideTranslations(locale, componentDirs)];
|
|
38020
|
+
case 5: return [2 /*return*/, (_e.props = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_f.sent())])), provider.nextPageData.props]),
|
|
38021
|
+
_e.revalidate = 60,
|
|
38022
|
+
_e)];
|
|
38010
38023
|
}
|
|
38011
38024
|
});
|
|
38012
38025
|
});
|
package/build/index.js
CHANGED
|
@@ -11,6 +11,7 @@ var Link = require('next/link');
|
|
|
11
11
|
var NextImage = require('next/image');
|
|
12
12
|
var fs = require('fs');
|
|
13
13
|
var getConfig = require('next/config');
|
|
14
|
+
var serverSideTranslations = require('next-i18next/serverSideTranslations');
|
|
14
15
|
var dynamic = require('next/dynamic');
|
|
15
16
|
var Error$1 = require('next/error');
|
|
16
17
|
|
|
@@ -37879,7 +37880,7 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
37879
37880
|
id: storefront.salesChannelId,
|
|
37880
37881
|
}),
|
|
37881
37882
|
routing: storefront.routings.length
|
|
37882
|
-
? storefront.routings.find(function (r) { return !r.path && !r.domain
|
|
37883
|
+
? storefront.routings.find(function (r) { return r.locale === locale; }) || //storefront.routings.find((r) => !r.path && !r.domain) ||
|
|
37883
37884
|
storefront.routings[0]
|
|
37884
37885
|
: new IkasStorefrontRouting({}),
|
|
37885
37886
|
favicon: localTheme.settings.favicon,
|
|
@@ -37930,9 +37931,10 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
37930
37931
|
SettingsHelper.getPageData = function (context, isServer, pageType, possiblePageTypes) {
|
|
37931
37932
|
var _a;
|
|
37932
37933
|
return __awaiter(this, void 0, void 0, function () {
|
|
37933
|
-
var isLocal, locale, settings, storefront, themeLocalization, salesChannel, routing, favicon, stockPreference, provider;
|
|
37934
|
-
|
|
37935
|
-
|
|
37934
|
+
var isLocal, locale, settings, storefront, themeLocalization, salesChannel, routing, favicon, stockPreference, provider, componentIds, components, componentDirs, _b, _c;
|
|
37935
|
+
var _d, _e;
|
|
37936
|
+
return __generator(this, function (_f) {
|
|
37937
|
+
switch (_f.label) {
|
|
37936
37938
|
case 0:
|
|
37937
37939
|
isLocal = process.env.NEXT_PUBLIC_ENV === "local";
|
|
37938
37940
|
locale = isLocal ? "en" : context.locale;
|
|
@@ -37944,7 +37946,7 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
37944
37946
|
}
|
|
37945
37947
|
return [4 /*yield*/, SettingsHelper.getSettings(locale)];
|
|
37946
37948
|
case 1:
|
|
37947
|
-
settings =
|
|
37949
|
+
settings = _f.sent();
|
|
37948
37950
|
if (!settings ||
|
|
37949
37951
|
!settings.storefront.mainStorefrontThemeId ||
|
|
37950
37952
|
!settings.storefront.salesChannelId) {
|
|
@@ -37970,20 +37972,31 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
37970
37972
|
provider.possiblePageTypes = possiblePageTypes;
|
|
37971
37973
|
return [4 /*yield*/, provider.getPageData()];
|
|
37972
37974
|
case 2:
|
|
37973
|
-
|
|
37975
|
+
_f.sent();
|
|
37974
37976
|
if (!provider.page) {
|
|
37975
37977
|
return [2 /*return*/, {
|
|
37976
37978
|
props: {},
|
|
37977
37979
|
notFound: true,
|
|
37978
37980
|
}];
|
|
37979
37981
|
}
|
|
37980
|
-
|
|
37981
|
-
|
|
37982
|
-
|
|
37983
|
-
|
|
37984
|
-
|
|
37985
|
-
|
|
37986
|
-
|
|
37982
|
+
componentIds = provider.page.components.map(function (pc) { return pc.componentId; });
|
|
37983
|
+
components = themeLocalization.themeJson.components.filter(function (c) {
|
|
37984
|
+
return componentIds.includes(c.id);
|
|
37985
|
+
});
|
|
37986
|
+
componentDirs = __spreadArrays(["common"], components.map(function (c) { return c.dir; }));
|
|
37987
|
+
if (!isServer) return [3 /*break*/, 4];
|
|
37988
|
+
_d = {};
|
|
37989
|
+
_b = [{}];
|
|
37990
|
+
return [4 /*yield*/, serverSideTranslations.serverSideTranslations(locale, componentDirs)];
|
|
37991
|
+
case 3: return [2 /*return*/, (_d.props = __assign.apply(void 0, [__assign.apply(void 0, _b.concat([(_f.sent())])), provider.nextPageData.props]),
|
|
37992
|
+
_d)];
|
|
37993
|
+
case 4:
|
|
37994
|
+
_e = {};
|
|
37995
|
+
_c = [{}];
|
|
37996
|
+
return [4 /*yield*/, serverSideTranslations.serverSideTranslations(locale, componentDirs)];
|
|
37997
|
+
case 5: return [2 /*return*/, (_e.props = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_f.sent())])), provider.nextPageData.props]),
|
|
37998
|
+
_e.revalidate = 60,
|
|
37999
|
+
_e)];
|
|
37987
38000
|
}
|
|
37988
38001
|
});
|
|
37989
38002
|
});
|
|
@@ -13,6 +13,10 @@ export declare class SettingsHelper {
|
|
|
13
13
|
static readSettingsFile(): Promise<any>;
|
|
14
14
|
static getSettings(locale: string): Promise<SettingsData | null>;
|
|
15
15
|
static getPageData(context: GetStaticPropsContext<ParsedUrlQuery> | GetServerSidePropsContext<ParsedUrlQuery>, isServer: boolean, pageType?: IkasThemePageType, possiblePageTypes?: IkasThemePageType[]): Promise<{
|
|
16
|
+
props: {};
|
|
17
|
+
notFound: boolean;
|
|
18
|
+
revalidate?: undefined;
|
|
19
|
+
} | {
|
|
16
20
|
props: {
|
|
17
21
|
propValuesStr: string;
|
|
18
22
|
pageSpecificDataStr: string;
|
|
@@ -33,10 +37,13 @@ export declare class SettingsHelper {
|
|
|
33
37
|
favicon: any;
|
|
34
38
|
stockPreference: IkasThemeStockPreference;
|
|
35
39
|
};
|
|
40
|
+
_nextI18Next: {
|
|
41
|
+
initialI18nStore: any;
|
|
42
|
+
initialLocale: string;
|
|
43
|
+
userConfig: import("next-i18next").UserConfig | null;
|
|
44
|
+
};
|
|
36
45
|
};
|
|
37
|
-
|
|
38
|
-
props: {};
|
|
39
|
-
notFound: boolean;
|
|
46
|
+
notFound?: undefined;
|
|
40
47
|
revalidate?: undefined;
|
|
41
48
|
} | {
|
|
42
49
|
props: {
|
|
@@ -59,11 +66,20 @@ export declare class SettingsHelper {
|
|
|
59
66
|
favicon: any;
|
|
60
67
|
stockPreference: IkasThemeStockPreference;
|
|
61
68
|
};
|
|
69
|
+
_nextI18Next: {
|
|
70
|
+
initialI18nStore: any;
|
|
71
|
+
initialLocale: string;
|
|
72
|
+
userConfig: import("next-i18next").UserConfig | null;
|
|
73
|
+
};
|
|
62
74
|
};
|
|
63
75
|
revalidate: number;
|
|
64
76
|
notFound?: undefined;
|
|
65
77
|
}>;
|
|
66
78
|
static getStaticProps(context: GetStaticPropsContext<ParsedUrlQuery>, pageType?: IkasThemePageType, possiblePageTypes?: IkasThemePageType[]): Promise<{
|
|
79
|
+
props: {};
|
|
80
|
+
notFound: boolean;
|
|
81
|
+
revalidate?: undefined;
|
|
82
|
+
} | {
|
|
67
83
|
props: {
|
|
68
84
|
propValuesStr: string;
|
|
69
85
|
pageSpecificDataStr: string;
|
|
@@ -84,10 +100,13 @@ export declare class SettingsHelper {
|
|
|
84
100
|
favicon: any;
|
|
85
101
|
stockPreference: IkasThemeStockPreference;
|
|
86
102
|
};
|
|
103
|
+
_nextI18Next: {
|
|
104
|
+
initialI18nStore: any;
|
|
105
|
+
initialLocale: string;
|
|
106
|
+
userConfig: import("next-i18next").UserConfig | null;
|
|
107
|
+
};
|
|
87
108
|
};
|
|
88
|
-
|
|
89
|
-
props: {};
|
|
90
|
-
notFound: boolean;
|
|
109
|
+
notFound?: undefined;
|
|
91
110
|
revalidate?: undefined;
|
|
92
111
|
} | {
|
|
93
112
|
props: {
|
|
@@ -110,11 +129,20 @@ export declare class SettingsHelper {
|
|
|
110
129
|
favicon: any;
|
|
111
130
|
stockPreference: IkasThemeStockPreference;
|
|
112
131
|
};
|
|
132
|
+
_nextI18Next: {
|
|
133
|
+
initialI18nStore: any;
|
|
134
|
+
initialLocale: string;
|
|
135
|
+
userConfig: import("next-i18next").UserConfig | null;
|
|
136
|
+
};
|
|
113
137
|
};
|
|
114
138
|
revalidate: number;
|
|
115
139
|
notFound?: undefined;
|
|
116
140
|
}>;
|
|
117
141
|
static getServerSideProps(context: GetServerSidePropsContext<ParsedUrlQuery>, pageType?: IkasThemePageType): Promise<{
|
|
142
|
+
props: {};
|
|
143
|
+
notFound: boolean;
|
|
144
|
+
revalidate?: undefined;
|
|
145
|
+
} | {
|
|
118
146
|
props: {
|
|
119
147
|
propValuesStr: string;
|
|
120
148
|
pageSpecificDataStr: string;
|
|
@@ -135,10 +163,13 @@ export declare class SettingsHelper {
|
|
|
135
163
|
favicon: any;
|
|
136
164
|
stockPreference: IkasThemeStockPreference;
|
|
137
165
|
};
|
|
166
|
+
_nextI18Next: {
|
|
167
|
+
initialI18nStore: any;
|
|
168
|
+
initialLocale: string;
|
|
169
|
+
userConfig: import("next-i18next").UserConfig | null;
|
|
170
|
+
};
|
|
138
171
|
};
|
|
139
|
-
|
|
140
|
-
props: {};
|
|
141
|
-
notFound: boolean;
|
|
172
|
+
notFound?: undefined;
|
|
142
173
|
revalidate?: undefined;
|
|
143
174
|
} | {
|
|
144
175
|
props: {
|
|
@@ -161,6 +192,11 @@ export declare class SettingsHelper {
|
|
|
161
192
|
favicon: any;
|
|
162
193
|
stockPreference: IkasThemeStockPreference;
|
|
163
194
|
};
|
|
195
|
+
_nextI18Next: {
|
|
196
|
+
initialI18nStore: any;
|
|
197
|
+
initialLocale: string;
|
|
198
|
+
userConfig: import("next-i18next").UserConfig | null;
|
|
199
|
+
};
|
|
164
200
|
};
|
|
165
201
|
revalidate: number;
|
|
166
202
|
notFound?: undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.161-alpha.1",
|
|
4
4
|
"main": "./build/index.js",
|
|
5
5
|
"module": "./build/index.es.js",
|
|
6
6
|
"author": "Umut Ozan Yıldırım",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"mobx": "^6.1.3",
|
|
20
20
|
"mobx-react-lite": "^3.1.5",
|
|
21
21
|
"next": "10.0.6",
|
|
22
|
+
"next-i18next": "^8.5.5",
|
|
22
23
|
"react": "17.0.1",
|
|
23
24
|
"react-dom": "17.0.1"
|
|
24
25
|
},
|
|
@@ -70,6 +71,7 @@
|
|
|
70
71
|
"mobx": "^6.1.3",
|
|
71
72
|
"mobx-react-lite": "^3.1.5",
|
|
72
73
|
"next": "10.0.6",
|
|
74
|
+
"next-i18next": "^8.5.5",
|
|
73
75
|
"node-sass": "^5.0.0",
|
|
74
76
|
"postcss": "^8.2.4",
|
|
75
77
|
"prettier": "^2.2.1",
|