@ikas/storefront 0.0.162-alpha.7 → 0.0.162-alpha.9
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 +34 -36
- package/build/index.js +34 -36
- package/build/utils/settings.d.ts +12 -0
- package/package.json +1 -1
package/build/index.es.js
CHANGED
|
@@ -38268,11 +38268,14 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
38268
38268
|
SettingsHelper.getPageData = function (context, isServer, pageType, possiblePageTypes, isEditor) {
|
|
38269
38269
|
var _a;
|
|
38270
38270
|
return __awaiter(this, void 0, void 0, function () {
|
|
38271
|
-
var isLocal,
|
|
38271
|
+
var isLocal, isProdEditor, serverRuntimeConfig, locale, settings, storefront, themeLocalization, salesChannel, routing, favicon, stockPreference, provider, componentIds_1, components, componentDirs, nextI18nConf, currentLocale, i18nReader, translations;
|
|
38272
38272
|
return __generator(this, function (_b) {
|
|
38273
38273
|
switch (_b.label) {
|
|
38274
38274
|
case 0:
|
|
38275
38275
|
isLocal = process.env.NEXT_PUBLIC_ENV === "local";
|
|
38276
|
+
isProdEditor = !isLocal && isEditor;
|
|
38277
|
+
serverRuntimeConfig = getConfig().serverRuntimeConfig;
|
|
38278
|
+
if (!!isProdEditor) return [3 /*break*/, 4];
|
|
38276
38279
|
locale = context.locale;
|
|
38277
38280
|
if (!locale) {
|
|
38278
38281
|
return [2 /*return*/, {
|
|
@@ -38280,7 +38283,6 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
38280
38283
|
notFound: true,
|
|
38281
38284
|
}];
|
|
38282
38285
|
}
|
|
38283
|
-
serverRuntimeConfig = getConfig().serverRuntimeConfig;
|
|
38284
38286
|
return [4 /*yield*/, SettingsHelper.getSettings(locale)];
|
|
38285
38287
|
case 1:
|
|
38286
38288
|
settings = _b.sent();
|
|
@@ -38307,21 +38309,15 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
38307
38309
|
IkasStorefrontConfig.stockPreference = stockPreference || null;
|
|
38308
38310
|
provider = new IkasPageDataProvider(themeLocalization.themeJson, context.params, pageType);
|
|
38309
38311
|
provider.possiblePageTypes = possiblePageTypes;
|
|
38310
|
-
if (!!isEditor) return [3 /*break*/, 3];
|
|
38311
38312
|
return [4 /*yield*/, provider.getPageData()];
|
|
38312
38313
|
case 2:
|
|
38313
38314
|
_b.sent();
|
|
38314
|
-
_b.label = 3;
|
|
38315
|
-
case 3:
|
|
38316
38315
|
if (!provider.page) {
|
|
38317
|
-
|
|
38318
|
-
|
|
38319
|
-
|
|
38320
|
-
|
|
38321
|
-
}];
|
|
38316
|
+
return [2 /*return*/, {
|
|
38317
|
+
props: {},
|
|
38318
|
+
notFound: true,
|
|
38319
|
+
}];
|
|
38322
38320
|
}
|
|
38323
|
-
isProdEditor = !isLocal && isEditor;
|
|
38324
|
-
if (!!isProdEditor) return [3 /*break*/, 5];
|
|
38325
38321
|
componentIds_1 = isEditor
|
|
38326
38322
|
? provider.theme.components.map(function (c) { return c.id; })
|
|
38327
38323
|
: provider.page.components.map(function (pc) { return pc.componentId; });
|
|
@@ -38331,11 +38327,9 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
38331
38327
|
currentLocale = routing.locale;
|
|
38332
38328
|
i18nReader = new I18NFileReader(currentLocale, componentDirs, isLocal ? undefined : nextI18nConf.localePath);
|
|
38333
38329
|
return [4 /*yield*/, i18nReader.read()];
|
|
38334
|
-
case
|
|
38330
|
+
case 3:
|
|
38335
38331
|
translations = _b.sent();
|
|
38336
38332
|
IkasStorefrontConfig.translations = translations;
|
|
38337
|
-
_b.label = 5;
|
|
38338
|
-
case 5:
|
|
38339
38333
|
if (isServer)
|
|
38340
38334
|
return [2 /*return*/, {
|
|
38341
38335
|
props: provider.nextPageData.props,
|
|
@@ -38345,6 +38339,10 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
38345
38339
|
props: provider.nextPageData.props,
|
|
38346
38340
|
revalidate: 60,
|
|
38347
38341
|
}];
|
|
38342
|
+
case 4: return [2 /*return*/, {
|
|
38343
|
+
props: {},
|
|
38344
|
+
}];
|
|
38345
|
+
case 5: return [2 /*return*/];
|
|
38348
38346
|
}
|
|
38349
38347
|
});
|
|
38350
38348
|
});
|
|
@@ -38430,27 +38428,26 @@ var Page$1 = function (_a) {
|
|
|
38430
38428
|
};
|
|
38431
38429
|
var index$1 = observer(Page$1);
|
|
38432
38430
|
var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38433
|
-
var targetTypes, metaData;
|
|
38434
38431
|
return __generator(this, function (_a) {
|
|
38435
|
-
|
|
38436
|
-
|
|
38437
|
-
|
|
38438
|
-
|
|
38439
|
-
|
|
38440
|
-
|
|
38441
|
-
|
|
38442
|
-
|
|
38443
|
-
|
|
38444
|
-
|
|
38445
|
-
|
|
38446
|
-
|
|
38447
|
-
|
|
38448
|
-
|
|
38449
|
-
|
|
38450
|
-
|
|
38451
|
-
|
|
38452
|
-
|
|
38453
|
-
|
|
38432
|
+
// const targetTypes = [
|
|
38433
|
+
// IkasHTMLMetaDataTargetType.BRAND,
|
|
38434
|
+
// IkasHTMLMetaDataTargetType.CATEGORY,
|
|
38435
|
+
// ];
|
|
38436
|
+
// const metaData = await IkasHTMLMetaDataAPI.listHTMLMetaData(
|
|
38437
|
+
// undefined,
|
|
38438
|
+
// undefined,
|
|
38439
|
+
// targetTypes
|
|
38440
|
+
// );
|
|
38441
|
+
// metaData.map((m) => ({
|
|
38442
|
+
// params: {
|
|
38443
|
+
// slug: m.slug,
|
|
38444
|
+
// originalSlug: m.slug,
|
|
38445
|
+
// },
|
|
38446
|
+
// }))
|
|
38447
|
+
return [2 /*return*/, {
|
|
38448
|
+
paths: [],
|
|
38449
|
+
fallback: "blocking",
|
|
38450
|
+
}];
|
|
38454
38451
|
});
|
|
38455
38452
|
}); };
|
|
38456
38453
|
var getStaticProps$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -38885,7 +38882,8 @@ var cart = /*#__PURE__*/Object.freeze({
|
|
|
38885
38882
|
var IkasPageEditor$1 = dynamic(function () { return Promise.resolve().then(function () { return index; }).then(function (mod) { return mod.IkasPageEditor; }); }, { ssr: false });
|
|
38886
38883
|
var Page$c = function (_a) {
|
|
38887
38884
|
var configJson = _a.configJson;
|
|
38888
|
-
|
|
38885
|
+
if (configJson)
|
|
38886
|
+
IkasStorefrontConfig.initWithJson(configJson);
|
|
38889
38887
|
return createElement(IkasPageEditor$1, null);
|
|
38890
38888
|
};
|
|
38891
38889
|
var getStaticProps$b = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
package/build/index.js
CHANGED
|
@@ -38246,11 +38246,14 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
38246
38246
|
SettingsHelper.getPageData = function (context, isServer, pageType, possiblePageTypes, isEditor) {
|
|
38247
38247
|
var _a;
|
|
38248
38248
|
return __awaiter(this, void 0, void 0, function () {
|
|
38249
|
-
var isLocal,
|
|
38249
|
+
var isLocal, isProdEditor, serverRuntimeConfig, locale, settings, storefront, themeLocalization, salesChannel, routing, favicon, stockPreference, provider, componentIds_1, components, componentDirs, nextI18nConf, currentLocale, i18nReader, translations;
|
|
38250
38250
|
return __generator(this, function (_b) {
|
|
38251
38251
|
switch (_b.label) {
|
|
38252
38252
|
case 0:
|
|
38253
38253
|
isLocal = process.env.NEXT_PUBLIC_ENV === "local";
|
|
38254
|
+
isProdEditor = !isLocal && isEditor;
|
|
38255
|
+
serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
|
|
38256
|
+
if (!!isProdEditor) return [3 /*break*/, 4];
|
|
38254
38257
|
locale = context.locale;
|
|
38255
38258
|
if (!locale) {
|
|
38256
38259
|
return [2 /*return*/, {
|
|
@@ -38258,7 +38261,6 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
38258
38261
|
notFound: true,
|
|
38259
38262
|
}];
|
|
38260
38263
|
}
|
|
38261
|
-
serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
|
|
38262
38264
|
return [4 /*yield*/, SettingsHelper.getSettings(locale)];
|
|
38263
38265
|
case 1:
|
|
38264
38266
|
settings = _b.sent();
|
|
@@ -38285,21 +38287,15 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
38285
38287
|
IkasStorefrontConfig.stockPreference = stockPreference || null;
|
|
38286
38288
|
provider = new IkasPageDataProvider(themeLocalization.themeJson, context.params, pageType);
|
|
38287
38289
|
provider.possiblePageTypes = possiblePageTypes;
|
|
38288
|
-
if (!!isEditor) return [3 /*break*/, 3];
|
|
38289
38290
|
return [4 /*yield*/, provider.getPageData()];
|
|
38290
38291
|
case 2:
|
|
38291
38292
|
_b.sent();
|
|
38292
|
-
_b.label = 3;
|
|
38293
|
-
case 3:
|
|
38294
38293
|
if (!provider.page) {
|
|
38295
|
-
|
|
38296
|
-
|
|
38297
|
-
|
|
38298
|
-
|
|
38299
|
-
}];
|
|
38294
|
+
return [2 /*return*/, {
|
|
38295
|
+
props: {},
|
|
38296
|
+
notFound: true,
|
|
38297
|
+
}];
|
|
38300
38298
|
}
|
|
38301
|
-
isProdEditor = !isLocal && isEditor;
|
|
38302
|
-
if (!!isProdEditor) return [3 /*break*/, 5];
|
|
38303
38299
|
componentIds_1 = isEditor
|
|
38304
38300
|
? provider.theme.components.map(function (c) { return c.id; })
|
|
38305
38301
|
: provider.page.components.map(function (pc) { return pc.componentId; });
|
|
@@ -38309,11 +38305,9 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
38309
38305
|
currentLocale = routing.locale;
|
|
38310
38306
|
i18nReader = new I18NFileReader(currentLocale, componentDirs, isLocal ? undefined : nextI18nConf.localePath);
|
|
38311
38307
|
return [4 /*yield*/, i18nReader.read()];
|
|
38312
|
-
case
|
|
38308
|
+
case 3:
|
|
38313
38309
|
translations = _b.sent();
|
|
38314
38310
|
IkasStorefrontConfig.translations = translations;
|
|
38315
|
-
_b.label = 5;
|
|
38316
|
-
case 5:
|
|
38317
38311
|
if (isServer)
|
|
38318
38312
|
return [2 /*return*/, {
|
|
38319
38313
|
props: provider.nextPageData.props,
|
|
@@ -38323,6 +38317,10 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
38323
38317
|
props: provider.nextPageData.props,
|
|
38324
38318
|
revalidate: 60,
|
|
38325
38319
|
}];
|
|
38320
|
+
case 4: return [2 /*return*/, {
|
|
38321
|
+
props: {},
|
|
38322
|
+
}];
|
|
38323
|
+
case 5: return [2 /*return*/];
|
|
38326
38324
|
}
|
|
38327
38325
|
});
|
|
38328
38326
|
});
|
|
@@ -38408,27 +38406,26 @@ var Page$1 = function (_a) {
|
|
|
38408
38406
|
};
|
|
38409
38407
|
var index$1 = mobxReactLite.observer(Page$1);
|
|
38410
38408
|
var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38411
|
-
var targetTypes, metaData;
|
|
38412
38409
|
return __generator(this, function (_a) {
|
|
38413
|
-
|
|
38414
|
-
|
|
38415
|
-
|
|
38416
|
-
|
|
38417
|
-
|
|
38418
|
-
|
|
38419
|
-
|
|
38420
|
-
|
|
38421
|
-
|
|
38422
|
-
|
|
38423
|
-
|
|
38424
|
-
|
|
38425
|
-
|
|
38426
|
-
|
|
38427
|
-
|
|
38428
|
-
|
|
38429
|
-
|
|
38430
|
-
|
|
38431
|
-
|
|
38410
|
+
// const targetTypes = [
|
|
38411
|
+
// IkasHTMLMetaDataTargetType.BRAND,
|
|
38412
|
+
// IkasHTMLMetaDataTargetType.CATEGORY,
|
|
38413
|
+
// ];
|
|
38414
|
+
// const metaData = await IkasHTMLMetaDataAPI.listHTMLMetaData(
|
|
38415
|
+
// undefined,
|
|
38416
|
+
// undefined,
|
|
38417
|
+
// targetTypes
|
|
38418
|
+
// );
|
|
38419
|
+
// metaData.map((m) => ({
|
|
38420
|
+
// params: {
|
|
38421
|
+
// slug: m.slug,
|
|
38422
|
+
// originalSlug: m.slug,
|
|
38423
|
+
// },
|
|
38424
|
+
// }))
|
|
38425
|
+
return [2 /*return*/, {
|
|
38426
|
+
paths: [],
|
|
38427
|
+
fallback: "blocking",
|
|
38428
|
+
}];
|
|
38432
38429
|
});
|
|
38433
38430
|
}); };
|
|
38434
38431
|
var getStaticProps$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -38863,7 +38860,8 @@ var cart = /*#__PURE__*/Object.freeze({
|
|
|
38863
38860
|
var IkasPageEditor$1 = dynamic__default['default'](function () { return Promise.resolve().then(function () { return index; }).then(function (mod) { return mod.IkasPageEditor; }); }, { ssr: false });
|
|
38864
38861
|
var Page$c = function (_a) {
|
|
38865
38862
|
var configJson = _a.configJson;
|
|
38866
|
-
|
|
38863
|
+
if (configJson)
|
|
38864
|
+
IkasStorefrontConfig.initWithJson(configJson);
|
|
38867
38865
|
return React.createElement(IkasPageEditor$1, null);
|
|
38868
38866
|
};
|
|
38869
38867
|
var getStaticProps$b = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -66,6 +66,10 @@ export declare class SettingsHelper {
|
|
|
66
66
|
};
|
|
67
67
|
revalidate: number;
|
|
68
68
|
notFound?: undefined;
|
|
69
|
+
} | {
|
|
70
|
+
props: {};
|
|
71
|
+
notFound?: undefined;
|
|
72
|
+
revalidate?: undefined;
|
|
69
73
|
}>;
|
|
70
74
|
static getStaticProps(context: GetStaticPropsContext<ParsedUrlQuery>, pageType?: IkasThemePageType, possiblePageTypes?: IkasThemePageType[], isEditor?: boolean): Promise<{
|
|
71
75
|
props: {};
|
|
@@ -121,6 +125,10 @@ export declare class SettingsHelper {
|
|
|
121
125
|
};
|
|
122
126
|
revalidate: number;
|
|
123
127
|
notFound?: undefined;
|
|
128
|
+
} | {
|
|
129
|
+
props: {};
|
|
130
|
+
notFound?: undefined;
|
|
131
|
+
revalidate?: undefined;
|
|
124
132
|
}>;
|
|
125
133
|
static getServerSideProps(context: GetServerSidePropsContext<ParsedUrlQuery>, pageType?: IkasThemePageType): Promise<{
|
|
126
134
|
props: {};
|
|
@@ -176,6 +184,10 @@ export declare class SettingsHelper {
|
|
|
176
184
|
};
|
|
177
185
|
revalidate: number;
|
|
178
186
|
notFound?: undefined;
|
|
187
|
+
} | {
|
|
188
|
+
props: {};
|
|
189
|
+
notFound?: undefined;
|
|
190
|
+
revalidate?: undefined;
|
|
179
191
|
}>;
|
|
180
192
|
}
|
|
181
193
|
export declare type SettingsData = {
|