@ikas/storefront 0.0.161-alpha.2 → 0.0.161-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/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
|
|
|
@@ -37905,7 +37906,7 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
37905
37906
|
id: storefront.salesChannelId,
|
|
37906
37907
|
}),
|
|
37907
37908
|
routing: storefront.routings.length
|
|
37908
|
-
? storefront.routings.find(function (r) { return !r.path && !r.domain
|
|
37909
|
+
? storefront.routings.find(function (r) { return r.locale === locale; }) || //storefront.routings.find((r) => !r.path && !r.domain) ||
|
|
37909
37910
|
storefront.routings[0]
|
|
37910
37911
|
: new IkasStorefrontRouting({}),
|
|
37911
37912
|
favicon: localTheme.settings.favicon,
|
|
@@ -37956,9 +37957,10 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
37956
37957
|
SettingsHelper.getPageData = function (context, isServer, pageType, possiblePageTypes) {
|
|
37957
37958
|
var _a;
|
|
37958
37959
|
return __awaiter(this, void 0, void 0, function () {
|
|
37959
|
-
var isLocal, locale, settings, storefront, themeLocalization, salesChannel, routing, favicon, stockPreference, provider;
|
|
37960
|
-
|
|
37961
|
-
|
|
37960
|
+
var isLocal, locale, settings, storefront, themeLocalization, salesChannel, routing, favicon, stockPreference, provider, componentIds, components, componentDirs, _b, _c;
|
|
37961
|
+
var _d, _e;
|
|
37962
|
+
return __generator(this, function (_f) {
|
|
37963
|
+
switch (_f.label) {
|
|
37962
37964
|
case 0:
|
|
37963
37965
|
isLocal = process.env.NEXT_PUBLIC_ENV === "local";
|
|
37964
37966
|
locale = isLocal ? "en" : context.locale;
|
|
@@ -37970,7 +37972,7 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
37970
37972
|
}
|
|
37971
37973
|
return [4 /*yield*/, SettingsHelper.getSettings(locale)];
|
|
37972
37974
|
case 1:
|
|
37973
|
-
settings =
|
|
37975
|
+
settings = _f.sent();
|
|
37974
37976
|
if (!settings ||
|
|
37975
37977
|
!settings.storefront.mainStorefrontThemeId ||
|
|
37976
37978
|
!settings.storefront.salesChannelId) {
|
|
@@ -37996,20 +37998,31 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
37996
37998
|
provider.possiblePageTypes = possiblePageTypes;
|
|
37997
37999
|
return [4 /*yield*/, provider.getPageData()];
|
|
37998
38000
|
case 2:
|
|
37999
|
-
|
|
38001
|
+
_f.sent();
|
|
38000
38002
|
if (!provider.page) {
|
|
38001
38003
|
return [2 /*return*/, {
|
|
38002
38004
|
props: {},
|
|
38003
38005
|
notFound: true,
|
|
38004
38006
|
}];
|
|
38005
38007
|
}
|
|
38006
|
-
|
|
38007
|
-
|
|
38008
|
-
|
|
38009
|
-
|
|
38010
|
-
|
|
38011
|
-
|
|
38012
|
-
|
|
38008
|
+
componentIds = provider.page.components.map(function (pc) { return pc.componentId; });
|
|
38009
|
+
components = themeLocalization.themeJson.components.filter(function (c) {
|
|
38010
|
+
return componentIds.includes(c.id);
|
|
38011
|
+
});
|
|
38012
|
+
componentDirs = __spreadArrays(["common"], components.map(function (c) { return c.dir; }));
|
|
38013
|
+
if (!isServer) return [3 /*break*/, 4];
|
|
38014
|
+
_d = {};
|
|
38015
|
+
_b = [{}];
|
|
38016
|
+
return [4 /*yield*/, serverSideTranslations(locale, componentDirs)];
|
|
38017
|
+
case 3: return [2 /*return*/, (_d.props = __assign.apply(void 0, [__assign.apply(void 0, _b.concat([(_f.sent())])), provider.nextPageData.props]),
|
|
38018
|
+
_d)];
|
|
38019
|
+
case 4:
|
|
38020
|
+
_e = {};
|
|
38021
|
+
_c = [{}];
|
|
38022
|
+
return [4 /*yield*/, serverSideTranslations(locale, componentDirs)];
|
|
38023
|
+
case 5: return [2 /*return*/, (_e.props = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_f.sent())])), provider.nextPageData.props]),
|
|
38024
|
+
_e.revalidate = 60,
|
|
38025
|
+
_e)];
|
|
38013
38026
|
}
|
|
38014
38027
|
});
|
|
38015
38028
|
});
|
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
|
|
|
@@ -37882,7 +37883,7 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
37882
37883
|
id: storefront.salesChannelId,
|
|
37883
37884
|
}),
|
|
37884
37885
|
routing: storefront.routings.length
|
|
37885
|
-
? storefront.routings.find(function (r) { return !r.path && !r.domain
|
|
37886
|
+
? storefront.routings.find(function (r) { return r.locale === locale; }) || //storefront.routings.find((r) => !r.path && !r.domain) ||
|
|
37886
37887
|
storefront.routings[0]
|
|
37887
37888
|
: new IkasStorefrontRouting({}),
|
|
37888
37889
|
favicon: localTheme.settings.favicon,
|
|
@@ -37933,9 +37934,10 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
37933
37934
|
SettingsHelper.getPageData = function (context, isServer, pageType, possiblePageTypes) {
|
|
37934
37935
|
var _a;
|
|
37935
37936
|
return __awaiter(this, void 0, void 0, function () {
|
|
37936
|
-
var isLocal, locale, settings, storefront, themeLocalization, salesChannel, routing, favicon, stockPreference, provider;
|
|
37937
|
-
|
|
37938
|
-
|
|
37937
|
+
var isLocal, locale, settings, storefront, themeLocalization, salesChannel, routing, favicon, stockPreference, provider, componentIds, components, componentDirs, _b, _c;
|
|
37938
|
+
var _d, _e;
|
|
37939
|
+
return __generator(this, function (_f) {
|
|
37940
|
+
switch (_f.label) {
|
|
37939
37941
|
case 0:
|
|
37940
37942
|
isLocal = process.env.NEXT_PUBLIC_ENV === "local";
|
|
37941
37943
|
locale = isLocal ? "en" : context.locale;
|
|
@@ -37947,7 +37949,7 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
37947
37949
|
}
|
|
37948
37950
|
return [4 /*yield*/, SettingsHelper.getSettings(locale)];
|
|
37949
37951
|
case 1:
|
|
37950
|
-
settings =
|
|
37952
|
+
settings = _f.sent();
|
|
37951
37953
|
if (!settings ||
|
|
37952
37954
|
!settings.storefront.mainStorefrontThemeId ||
|
|
37953
37955
|
!settings.storefront.salesChannelId) {
|
|
@@ -37973,20 +37975,31 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
37973
37975
|
provider.possiblePageTypes = possiblePageTypes;
|
|
37974
37976
|
return [4 /*yield*/, provider.getPageData()];
|
|
37975
37977
|
case 2:
|
|
37976
|
-
|
|
37978
|
+
_f.sent();
|
|
37977
37979
|
if (!provider.page) {
|
|
37978
37980
|
return [2 /*return*/, {
|
|
37979
37981
|
props: {},
|
|
37980
37982
|
notFound: true,
|
|
37981
37983
|
}];
|
|
37982
37984
|
}
|
|
37983
|
-
|
|
37984
|
-
|
|
37985
|
-
|
|
37986
|
-
|
|
37987
|
-
|
|
37988
|
-
|
|
37989
|
-
|
|
37985
|
+
componentIds = provider.page.components.map(function (pc) { return pc.componentId; });
|
|
37986
|
+
components = themeLocalization.themeJson.components.filter(function (c) {
|
|
37987
|
+
return componentIds.includes(c.id);
|
|
37988
|
+
});
|
|
37989
|
+
componentDirs = __spreadArrays(["common"], components.map(function (c) { return c.dir; }));
|
|
37990
|
+
if (!isServer) return [3 /*break*/, 4];
|
|
37991
|
+
_d = {};
|
|
37992
|
+
_b = [{}];
|
|
37993
|
+
return [4 /*yield*/, serverSideTranslations.serverSideTranslations(locale, componentDirs)];
|
|
37994
|
+
case 3: return [2 /*return*/, (_d.props = __assign.apply(void 0, [__assign.apply(void 0, _b.concat([(_f.sent())])), provider.nextPageData.props]),
|
|
37995
|
+
_d)];
|
|
37996
|
+
case 4:
|
|
37997
|
+
_e = {};
|
|
37998
|
+
_c = [{}];
|
|
37999
|
+
return [4 /*yield*/, serverSideTranslations.serverSideTranslations(locale, componentDirs)];
|
|
38000
|
+
case 5: return [2 /*return*/, (_e.props = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_f.sent())])), provider.nextPageData.props]),
|
|
38001
|
+
_e.revalidate = 60,
|
|
38002
|
+
_e)];
|
|
37990
38003
|
}
|
|
37991
38004
|
});
|
|
37992
38005
|
});
|
|
@@ -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.161-alpha.
|
|
3
|
+
"version": "0.0.161-alpha.3",
|
|
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",
|