@ikas/storefront 0.0.95 → 0.0.96

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
@@ -15929,7 +15929,7 @@ var CheckoutViewModel = /** @class */ (function () {
15929
15929
  variantId: i.variant.id,
15930
15930
  productId: i.variant.productId,
15931
15931
  }); });
15932
- return [4 /*yield*/, IkasCheckoutAPI.checkStocks(lines, [])];
15932
+ return [4 /*yield*/, IkasCheckoutAPI.checkStocks(lines, IkasStorefrontConfig.stockLocationIds || [])];
15933
15933
  case 1:
15934
15934
  result = _b.sent();
15935
15935
  if (!result) {
@@ -28318,6 +28318,26 @@ var IkasStorefront = /** @class */ (function () {
28318
28318
  return IkasStorefront;
28319
28319
  }());
28320
28320
 
28321
+ var IkasSalesChannel = /** @class */ (function () {
28322
+ function IkasSalesChannel(data) {
28323
+ var _a;
28324
+ this.id = data.id || "";
28325
+ this.name = data.name || "";
28326
+ this.priceListId = data.priceListId || "";
28327
+ this.stockLocations =
28328
+ ((_a = data.stockLocations) === null || _a === void 0 ? void 0 : _a.map(function (sl) { return new IkasSalesChannelStockLocation(sl); })) ||
28329
+ [];
28330
+ }
28331
+ return IkasSalesChannel;
28332
+ }());
28333
+ var IkasSalesChannelStockLocation = /** @class */ (function () {
28334
+ function IkasSalesChannelStockLocation(data) {
28335
+ this.id = data.id || "";
28336
+ this.order = data.order || 0;
28337
+ }
28338
+ return IkasSalesChannelStockLocation;
28339
+ }());
28340
+
28321
28341
  var SettingsHelper = /** @class */ (function () {
28322
28342
  function SettingsHelper() {
28323
28343
  }
@@ -28326,6 +28346,7 @@ var SettingsHelper = /** @class */ (function () {
28326
28346
  var serverRuntimeConfig = getConfig().serverRuntimeConfig;
28327
28347
  var settings = serverRuntimeConfig.SETTINGS;
28328
28348
  var storefront = new IkasStorefront(settings.storefront);
28349
+ var salesChannel = new IkasSalesChannel(settings.salesChannel);
28329
28350
  var localizationMap = settings.localizationMap;
28330
28351
  var themeJSONPath = localizationMap[locale];
28331
28352
  var routing = storefront.routings.find(function (r) { return r.id === locale || r.path === locale; });
@@ -28342,21 +28363,23 @@ var SettingsHelper = /** @class */ (function () {
28342
28363
  resolve({
28343
28364
  storefront: storefront,
28344
28365
  theme: new IkasTheme(result),
28366
+ salesChannel: salesChannel,
28345
28367
  routing: routing,
28346
28368
  });
28347
28369
  });
28348
28370
  });
28349
28371
  };
28350
28372
  SettingsHelper.getPageData = function (context, isServer, pageType) {
28373
+ var _a;
28351
28374
  return __awaiter(this, void 0, void 0, function () {
28352
- var locale, settings, storefront, theme, routing, provider;
28353
- return __generator(this, function (_a) {
28354
- switch (_a.label) {
28375
+ var locale, settings, storefront, theme, salesChannel, routing, provider;
28376
+ return __generator(this, function (_b) {
28377
+ switch (_b.label) {
28355
28378
  case 0:
28356
28379
  locale = context.locale || context.defaultLocale || "en";
28357
28380
  return [4 /*yield*/, SettingsHelper.getSettings(locale)];
28358
28381
  case 1:
28359
- settings = _a.sent();
28382
+ settings = _b.sent();
28360
28383
  if (!settings ||
28361
28384
  !settings.storefront.mainStorefrontThemeId ||
28362
28385
  !settings.storefront.salesChannelId ||
@@ -28366,16 +28389,17 @@ var SettingsHelper = /** @class */ (function () {
28366
28389
  notFound: true,
28367
28390
  }];
28368
28391
  }
28369
- storefront = settings.storefront, theme = settings.theme, routing = settings.routing;
28392
+ storefront = settings.storefront, theme = settings.theme, salesChannel = settings.salesChannel, routing = settings.routing;
28370
28393
  IkasStorefrontConfig.storefrontId = storefront.id;
28371
28394
  IkasStorefrontConfig.storefrontRoutingId = routing.id;
28372
28395
  IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
28373
28396
  IkasStorefrontConfig.salesChannelId = storefront.salesChannelId;
28374
28397
  IkasStorefrontConfig.priceListId = routing.priceListId;
28398
+ IkasStorefrontConfig.stockLocationIds = (_a = salesChannel.stockLocations) === null || _a === void 0 ? void 0 : _a.map(function (sl) { return sl.id; });
28375
28399
  provider = new IkasPageDataProvider(theme, context.params, pageType);
28376
28400
  return [4 /*yield*/, provider.getPageData()];
28377
28401
  case 2:
28378
- _a.sent();
28402
+ _b.sent();
28379
28403
  if (!provider.page) {
28380
28404
  return [2 /*return*/, {
28381
28405
  props: {},
package/build/index.js CHANGED
@@ -15934,7 +15934,7 @@ var CheckoutViewModel = /** @class */ (function () {
15934
15934
  variantId: i.variant.id,
15935
15935
  productId: i.variant.productId,
15936
15936
  }); });
15937
- return [4 /*yield*/, IkasCheckoutAPI.checkStocks(lines, [])];
15937
+ return [4 /*yield*/, IkasCheckoutAPI.checkStocks(lines, IkasStorefrontConfig.stockLocationIds || [])];
15938
15938
  case 1:
15939
15939
  result = _b.sent();
15940
15940
  if (!result) {
@@ -28297,6 +28297,26 @@ var IkasStorefront = /** @class */ (function () {
28297
28297
  return IkasStorefront;
28298
28298
  }());
28299
28299
 
28300
+ var IkasSalesChannel = /** @class */ (function () {
28301
+ function IkasSalesChannel(data) {
28302
+ var _a;
28303
+ this.id = data.id || "";
28304
+ this.name = data.name || "";
28305
+ this.priceListId = data.priceListId || "";
28306
+ this.stockLocations =
28307
+ ((_a = data.stockLocations) === null || _a === void 0 ? void 0 : _a.map(function (sl) { return new IkasSalesChannelStockLocation(sl); })) ||
28308
+ [];
28309
+ }
28310
+ return IkasSalesChannel;
28311
+ }());
28312
+ var IkasSalesChannelStockLocation = /** @class */ (function () {
28313
+ function IkasSalesChannelStockLocation(data) {
28314
+ this.id = data.id || "";
28315
+ this.order = data.order || 0;
28316
+ }
28317
+ return IkasSalesChannelStockLocation;
28318
+ }());
28319
+
28300
28320
  var SettingsHelper = /** @class */ (function () {
28301
28321
  function SettingsHelper() {
28302
28322
  }
@@ -28305,6 +28325,7 @@ var SettingsHelper = /** @class */ (function () {
28305
28325
  var serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
28306
28326
  var settings = serverRuntimeConfig.SETTINGS;
28307
28327
  var storefront = new IkasStorefront(settings.storefront);
28328
+ var salesChannel = new IkasSalesChannel(settings.salesChannel);
28308
28329
  var localizationMap = settings.localizationMap;
28309
28330
  var themeJSONPath = localizationMap[locale];
28310
28331
  var routing = storefront.routings.find(function (r) { return r.id === locale || r.path === locale; });
@@ -28321,21 +28342,23 @@ var SettingsHelper = /** @class */ (function () {
28321
28342
  resolve({
28322
28343
  storefront: storefront,
28323
28344
  theme: new IkasTheme(result),
28345
+ salesChannel: salesChannel,
28324
28346
  routing: routing,
28325
28347
  });
28326
28348
  });
28327
28349
  });
28328
28350
  };
28329
28351
  SettingsHelper.getPageData = function (context, isServer, pageType) {
28352
+ var _a;
28330
28353
  return __awaiter(this, void 0, void 0, function () {
28331
- var locale, settings, storefront, theme, routing, provider;
28332
- return __generator(this, function (_a) {
28333
- switch (_a.label) {
28354
+ var locale, settings, storefront, theme, salesChannel, routing, provider;
28355
+ return __generator(this, function (_b) {
28356
+ switch (_b.label) {
28334
28357
  case 0:
28335
28358
  locale = context.locale || context.defaultLocale || "en";
28336
28359
  return [4 /*yield*/, SettingsHelper.getSettings(locale)];
28337
28360
  case 1:
28338
- settings = _a.sent();
28361
+ settings = _b.sent();
28339
28362
  if (!settings ||
28340
28363
  !settings.storefront.mainStorefrontThemeId ||
28341
28364
  !settings.storefront.salesChannelId ||
@@ -28345,16 +28368,17 @@ var SettingsHelper = /** @class */ (function () {
28345
28368
  notFound: true,
28346
28369
  }];
28347
28370
  }
28348
- storefront = settings.storefront, theme = settings.theme, routing = settings.routing;
28371
+ storefront = settings.storefront, theme = settings.theme, salesChannel = settings.salesChannel, routing = settings.routing;
28349
28372
  IkasStorefrontConfig.storefrontId = storefront.id;
28350
28373
  IkasStorefrontConfig.storefrontRoutingId = routing.id;
28351
28374
  IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
28352
28375
  IkasStorefrontConfig.salesChannelId = storefront.salesChannelId;
28353
28376
  IkasStorefrontConfig.priceListId = routing.priceListId;
28377
+ IkasStorefrontConfig.stockLocationIds = (_a = salesChannel.stockLocations) === null || _a === void 0 ? void 0 : _a.map(function (sl) { return sl.id; });
28354
28378
  provider = new IkasPageDataProvider(theme, context.params, pageType);
28355
28379
  return [4 /*yield*/, provider.getPageData()];
28356
28380
  case 2:
28357
- _a.sent();
28381
+ _b.sent();
28358
28382
  if (!provider.page) {
28359
28383
  return [2 /*return*/, {
28360
28384
  props: {},
@@ -0,0 +1,12 @@
1
+ export declare class IkasSalesChannel {
2
+ id: string;
3
+ name: string;
4
+ priceListId: string | null;
5
+ stockLocations: IkasSalesChannelStockLocation[] | null;
6
+ constructor(data: Partial<IkasSalesChannel>);
7
+ }
8
+ export declare class IkasSalesChannelStockLocation {
9
+ id: string;
10
+ order: number;
11
+ constructor(data: Partial<IkasSalesChannelStockLocation>);
12
+ }
@@ -9,5 +9,6 @@ export declare class IkasStorefrontConfig {
9
9
  static storefrontThemeId?: string;
10
10
  static salesChannelId?: string;
11
11
  static priceListId?: string;
12
+ static stockLocationIds?: string[];
12
13
  static init(store: IkasBaseStore, components: any, config: Record<string, any>, apiUrlOverride?: string): void;
13
14
  }
@@ -1,9 +1,10 @@
1
1
  /// <reference types="node" />
2
+ import { GetServerSidePropsContext, GetStaticPropsContext } from "next";
3
+ import { ParsedUrlQuery } from "querystring";
2
4
  import { IkasTheme, IkasThemePageType } from "../models/index";
3
5
  import { IkasStorefront } from "../models/data/storefront/index";
6
+ import { IkasSalesChannel } from "../models/data/sales-channel/index";
4
7
  import { IkasStorefrontRouting } from "../models/data/storefront/routing/index";
5
- import { GetServerSidePropsContext, GetStaticPropsContext } from "next";
6
- import { ParsedUrlQuery } from "querystring";
7
8
  export declare class SettingsHelper {
8
9
  static getSettings(locale: string): Promise<SettingsData | null>;
9
10
  static getPageData(context: GetStaticPropsContext<ParsedUrlQuery> | GetServerSidePropsContext<ParsedUrlQuery>, isServer: boolean, pageType?: IkasThemePageType): Promise<{
@@ -76,5 +77,6 @@ export declare class SettingsHelper {
76
77
  export declare type SettingsData = {
77
78
  storefront: IkasStorefront;
78
79
  theme: IkasTheme;
80
+ salesChannel: IkasSalesChannel;
79
81
  routing: IkasStorefrontRouting;
80
82
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.95",
3
+ "version": "0.0.96",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",