@ikas/storefront 0.0.96 → 0.0.97

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 CHANGED
@@ -8,6 +8,7 @@ import Link from 'next/link';
8
8
  import Head from 'next/head';
9
9
  import fs from 'fs';
10
10
  import dynamic from 'next/dynamic';
11
+ import Error$1 from 'next/error';
11
12
 
12
13
  /*! *****************************************************************************
13
14
  Copyright (c) Microsoft Corporation.
@@ -28382,8 +28383,7 @@ var SettingsHelper = /** @class */ (function () {
28382
28383
  settings = _b.sent();
28383
28384
  if (!settings ||
28384
28385
  !settings.storefront.mainStorefrontThemeId ||
28385
- !settings.storefront.salesChannelId ||
28386
- !settings.routing.priceListId) {
28386
+ !settings.storefront.salesChannelId) {
28387
28387
  return [2 /*return*/, {
28388
28388
  props: {},
28389
28389
  notFound: true,
@@ -28394,7 +28394,7 @@ var SettingsHelper = /** @class */ (function () {
28394
28394
  IkasStorefrontConfig.storefrontRoutingId = routing.id;
28395
28395
  IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
28396
28396
  IkasStorefrontConfig.salesChannelId = storefront.salesChannelId;
28397
- IkasStorefrontConfig.priceListId = routing.priceListId;
28397
+ IkasStorefrontConfig.priceListId = routing.priceListId || undefined;
28398
28398
  IkasStorefrontConfig.stockLocationIds = (_a = salesChannel.stockLocations) === null || _a === void 0 ? void 0 : _a.map(function (sl) { return sl.id; });
28399
28399
  provider = new IkasPageDataProvider(theme, context.params, pageType);
28400
28400
  return [4 /*yield*/, provider.getPageData()];
@@ -28410,7 +28410,9 @@ var SettingsHelper = /** @class */ (function () {
28410
28410
  return [2 /*return*/, provider.nextPageData];
28411
28411
  else
28412
28412
  return [2 /*return*/, {
28413
- props: __assign(__assign({}, provider.nextPageData.props), { pageSpecificDataStr: JSON.stringify(provider.pageSpecificData || {}) }),
28413
+ props: __assign(__assign({}, provider.nextPageData.props), { pageSpecificDataStr: provider.pageSpecificData
28414
+ ? JSON.stringify(provider.pageSpecificData || {})
28415
+ : "" }),
28414
28416
  revalidate: 60,
28415
28417
  }];
28416
28418
  }
@@ -28610,7 +28612,7 @@ var getStaticPaths$1 = function (context) { return __awaiter(void 0, void 0, voi
28610
28612
  !customPagePaths.some(function (p) { return p.params.slug === customPage.slug; })) {
28611
28613
  customPagePaths.push({
28612
28614
  params: { slug: customPage.slug },
28613
- locale: routing.locale,
28615
+ locale: routing.path || routing.id,
28614
28616
  });
28615
28617
  }
28616
28618
  });
@@ -28966,15 +28968,27 @@ var search = /*#__PURE__*/Object.freeze({
28966
28968
 
28967
28969
  var Page$f = function (_a) {
28968
28970
  var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
28971
+ if (!propValuesStr || !page)
28972
+ return createElement(Error$1, { statusCode: 404 });
28969
28973
  var router = useRouter();
28970
28974
  var propValues = useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router); }, [propValuesStr]);
28971
28975
  return (createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28972
28976
  };
28973
28977
  var getStaticProps$d = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28978
+ var props;
28974
28979
  return __generator(this, function (_a) {
28975
28980
  switch (_a.label) {
28976
28981
  case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.NOT_FOUND)];
28977
- case 1: return [2 /*return*/, _a.sent()];
28982
+ case 1:
28983
+ props = _a.sent();
28984
+ //@ts-ignore
28985
+ if (props.notFound)
28986
+ return [2 /*return*/, {
28987
+ props: {},
28988
+ revalidate: 60,
28989
+ }];
28990
+ else
28991
+ return [2 /*return*/, props];
28978
28992
  }
28979
28993
  });
28980
28994
  }); };
package/build/index.js CHANGED
@@ -12,6 +12,7 @@ var Link = require('next/link');
12
12
  var Head = require('next/head');
13
13
  var fs = require('fs');
14
14
  var dynamic = require('next/dynamic');
15
+ var Error$1 = require('next/error');
15
16
 
16
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
17
18
 
@@ -22,6 +23,7 @@ var Link__default = /*#__PURE__*/_interopDefaultLegacy(Link);
22
23
  var Head__default = /*#__PURE__*/_interopDefaultLegacy(Head);
23
24
  var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
24
25
  var dynamic__default = /*#__PURE__*/_interopDefaultLegacy(dynamic);
26
+ var Error__default = /*#__PURE__*/_interopDefaultLegacy(Error$1);
25
27
 
26
28
  /*! *****************************************************************************
27
29
  Copyright (c) Microsoft Corporation.
@@ -28361,8 +28363,7 @@ var SettingsHelper = /** @class */ (function () {
28361
28363
  settings = _b.sent();
28362
28364
  if (!settings ||
28363
28365
  !settings.storefront.mainStorefrontThemeId ||
28364
- !settings.storefront.salesChannelId ||
28365
- !settings.routing.priceListId) {
28366
+ !settings.storefront.salesChannelId) {
28366
28367
  return [2 /*return*/, {
28367
28368
  props: {},
28368
28369
  notFound: true,
@@ -28373,7 +28374,7 @@ var SettingsHelper = /** @class */ (function () {
28373
28374
  IkasStorefrontConfig.storefrontRoutingId = routing.id;
28374
28375
  IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
28375
28376
  IkasStorefrontConfig.salesChannelId = storefront.salesChannelId;
28376
- IkasStorefrontConfig.priceListId = routing.priceListId;
28377
+ IkasStorefrontConfig.priceListId = routing.priceListId || undefined;
28377
28378
  IkasStorefrontConfig.stockLocationIds = (_a = salesChannel.stockLocations) === null || _a === void 0 ? void 0 : _a.map(function (sl) { return sl.id; });
28378
28379
  provider = new IkasPageDataProvider(theme, context.params, pageType);
28379
28380
  return [4 /*yield*/, provider.getPageData()];
@@ -28389,7 +28390,9 @@ var SettingsHelper = /** @class */ (function () {
28389
28390
  return [2 /*return*/, provider.nextPageData];
28390
28391
  else
28391
28392
  return [2 /*return*/, {
28392
- props: __assign(__assign({}, provider.nextPageData.props), { pageSpecificDataStr: JSON.stringify(provider.pageSpecificData || {}) }),
28393
+ props: __assign(__assign({}, provider.nextPageData.props), { pageSpecificDataStr: provider.pageSpecificData
28394
+ ? JSON.stringify(provider.pageSpecificData || {})
28395
+ : "" }),
28393
28396
  revalidate: 60,
28394
28397
  }];
28395
28398
  }
@@ -28589,7 +28592,7 @@ var getStaticPaths$1 = function (context) { return __awaiter(void 0, void 0, voi
28589
28592
  !customPagePaths.some(function (p) { return p.params.slug === customPage.slug; })) {
28590
28593
  customPagePaths.push({
28591
28594
  params: { slug: customPage.slug },
28592
- locale: routing.locale,
28595
+ locale: routing.path || routing.id,
28593
28596
  });
28594
28597
  }
28595
28598
  });
@@ -28945,15 +28948,27 @@ var search = /*#__PURE__*/Object.freeze({
28945
28948
 
28946
28949
  var Page$f = function (_a) {
28947
28950
  var page = _a.page, propValuesStr = _a.propValuesStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings;
28951
+ if (!propValuesStr || !page)
28952
+ return React.createElement(Error__default['default'], { statusCode: 404 });
28948
28953
  var router$1 = router.useRouter();
28949
28954
  var propValues = React.useMemo(function () { return IkasPageDataProvider.initPropValues(propValuesStr, router$1); }, [propValuesStr]);
28950
28955
  return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
28951
28956
  };
28952
28957
  var getStaticProps$d = function (context) { return __awaiter(void 0, void 0, void 0, function () {
28958
+ var props;
28953
28959
  return __generator(this, function (_a) {
28954
28960
  switch (_a.label) {
28955
28961
  case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.NOT_FOUND)];
28956
- case 1: return [2 /*return*/, _a.sent()];
28962
+ case 1:
28963
+ props = _a.sent();
28964
+ //@ts-ignore
28965
+ if (props.notFound)
28966
+ return [2 /*return*/, {
28967
+ props: {},
28968
+ revalidate: 60,
28969
+ }];
28970
+ else
28971
+ return [2 /*return*/, props];
28957
28972
  }
28958
28973
  });
28959
28974
  }); };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.96",
3
+ "version": "0.0.97",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",