@ikas/storefront 0.0.106 → 0.0.108
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 +14 -8
- package/build/index.js +15 -9
- package/build/storefront/index.d.ts +4 -0
- package/build/utils/settings.d.ts +12 -0
- package/package.json +1 -1
package/build/index.es.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { makeAutoObservable, toJS, runInAction, reaction, makeObservable, computed, observable, action, configure } from 'mobx';
|
|
2
2
|
import React, { createElement, Fragment, useState, useEffect, useCallback, useRef, useMemo } from 'react';
|
|
3
|
-
import getConfig from 'next/config';
|
|
4
3
|
import { observer } from 'mobx-react-lite';
|
|
5
4
|
import { useRouter } from 'next/router';
|
|
6
5
|
import Image$1 from 'next/image';
|
|
7
6
|
import Link from 'next/link';
|
|
8
7
|
import Head from 'next/head';
|
|
9
8
|
import fs from 'fs';
|
|
9
|
+
import getConfig from 'next/config';
|
|
10
10
|
import dynamic from 'next/dynamic';
|
|
11
11
|
import Error$1 from 'next/error';
|
|
12
12
|
|
|
@@ -10897,6 +10897,8 @@ var IkasStorefrontConfig = /** @class */ (function () {
|
|
|
10897
10897
|
priceListId: IkasStorefrontConfig.priceListId || null,
|
|
10898
10898
|
stockLocationIds: IkasStorefrontConfig.stockLocationIds || null,
|
|
10899
10899
|
routings: JSON.parse(JSON.stringify(IkasStorefrontConfig.routings)) || null,
|
|
10900
|
+
gtmId: IkasStorefrontConfig.gtmId || null,
|
|
10901
|
+
fbpId: IkasStorefrontConfig.fbpId || null,
|
|
10900
10902
|
};
|
|
10901
10903
|
};
|
|
10902
10904
|
IkasStorefrontConfig.components = {};
|
|
@@ -16889,9 +16891,8 @@ var Analytics = /** @class */ (function () {
|
|
|
16889
16891
|
|
|
16890
16892
|
var AnalyticsHead = function (_a) {
|
|
16891
16893
|
var blockHTML = _a.blockHTML;
|
|
16892
|
-
var
|
|
16893
|
-
var
|
|
16894
|
-
var fbpId = serverRuntimeConfig.FBP_ID;
|
|
16894
|
+
var gtmId = IkasStorefrontConfig.gtmId;
|
|
16895
|
+
var fbpId = IkasStorefrontConfig.fbpId;
|
|
16895
16896
|
return (createElement(Fragment, null,
|
|
16896
16897
|
blockHTML && (createElement("script", { dangerouslySetInnerHTML: {
|
|
16897
16898
|
__html: "dataLayer = [{'gtm.blocklist': ['html']}];",
|
|
@@ -16904,9 +16905,8 @@ var AnalyticsHead = function (_a) {
|
|
|
16904
16905
|
} }))));
|
|
16905
16906
|
};
|
|
16906
16907
|
var AnalyticsBody = function () {
|
|
16907
|
-
var
|
|
16908
|
-
var
|
|
16909
|
-
var fbpId = serverRuntimeConfig.FBP_ID;
|
|
16908
|
+
var gtmId = IkasStorefrontConfig.gtmId;
|
|
16909
|
+
var fbpId = IkasStorefrontConfig.fbpId;
|
|
16910
16910
|
return (createElement(Fragment, null,
|
|
16911
16911
|
gtmId && (createElement("noscript", { dangerouslySetInnerHTML: {
|
|
16912
16912
|
__html: "<iframe src=\"https://www.googletagmanager.com/ns.html?id=" + gtmId + "\" height=\"0\" width=\"0\" style=\"display:none;visibility:hidden\"></iframe>",
|
|
@@ -25709,7 +25709,11 @@ function simpleToProduct(simple) {
|
|
|
25709
25709
|
sku: v.sku,
|
|
25710
25710
|
barcodeList: v.barcodeList || undefined,
|
|
25711
25711
|
images: (_b = v.images) === null || _b === void 0 ? void 0 : _b.map(function (i) { return new IkasImage(i.id); }),
|
|
25712
|
-
price: new IkasProductPrice((_c = v.prices) === null || _c === void 0 ? void 0 : _c.find(function (p) {
|
|
25712
|
+
price: new IkasProductPrice((_c = v.prices) === null || _c === void 0 ? void 0 : _c.find(function (p) {
|
|
25713
|
+
return IkasStorefrontConfig.priceListId
|
|
25714
|
+
? p.priceListId === IkasStorefrontConfig.priceListId
|
|
25715
|
+
: p.priceListId === null;
|
|
25716
|
+
})),
|
|
25713
25717
|
stock: v.stocks.length ? v.stocks[0].stockCount : 0,
|
|
25714
25718
|
variantValues: (_d = v.variantValues) === null || _d === void 0 ? void 0 : _d.map(function (vv) {
|
|
25715
25719
|
var pvt = simple.productVariantTypes.find(function (pvt) { return pvt.variantType.id === vv.variantTypeId; });
|
|
@@ -28581,6 +28585,8 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
28581
28585
|
IkasStorefrontConfig.priceListId = routing.priceListId || undefined;
|
|
28582
28586
|
IkasStorefrontConfig.stockLocationIds = (_a = salesChannel.stockLocations) === null || _a === void 0 ? void 0 : _a.map(function (sl) { return sl.id; });
|
|
28583
28587
|
IkasStorefrontConfig.routings = storefront.routings;
|
|
28588
|
+
IkasStorefrontConfig.gtmId = storefront.gtmId || undefined;
|
|
28589
|
+
IkasStorefrontConfig.fbpId = storefront.fbpId || undefined;
|
|
28584
28590
|
provider = new IkasPageDataProvider(themeLocalization.themeJson, context.params, pageType);
|
|
28585
28591
|
return [4 /*yield*/, provider.getPageData()];
|
|
28586
28592
|
case 2:
|
package/build/index.js
CHANGED
|
@@ -4,24 +4,24 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var mobx = require('mobx');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var getConfig = require('next/config');
|
|
8
7
|
var mobxReactLite = require('mobx-react-lite');
|
|
9
8
|
var router = require('next/router');
|
|
10
9
|
var Image$1 = require('next/image');
|
|
11
10
|
var Link = require('next/link');
|
|
12
11
|
var Head = require('next/head');
|
|
13
12
|
var fs = require('fs');
|
|
13
|
+
var getConfig = require('next/config');
|
|
14
14
|
var dynamic = require('next/dynamic');
|
|
15
15
|
var Error$1 = require('next/error');
|
|
16
16
|
|
|
17
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
18
|
|
|
19
19
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
20
|
-
var getConfig__default = /*#__PURE__*/_interopDefaultLegacy(getConfig);
|
|
21
20
|
var Image__default = /*#__PURE__*/_interopDefaultLegacy(Image$1);
|
|
22
21
|
var Link__default = /*#__PURE__*/_interopDefaultLegacy(Link);
|
|
23
22
|
var Head__default = /*#__PURE__*/_interopDefaultLegacy(Head);
|
|
24
23
|
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
24
|
+
var getConfig__default = /*#__PURE__*/_interopDefaultLegacy(getConfig);
|
|
25
25
|
var dynamic__default = /*#__PURE__*/_interopDefaultLegacy(dynamic);
|
|
26
26
|
var Error__default = /*#__PURE__*/_interopDefaultLegacy(Error$1);
|
|
27
27
|
|
|
@@ -10912,6 +10912,8 @@ var IkasStorefrontConfig = /** @class */ (function () {
|
|
|
10912
10912
|
priceListId: IkasStorefrontConfig.priceListId || null,
|
|
10913
10913
|
stockLocationIds: IkasStorefrontConfig.stockLocationIds || null,
|
|
10914
10914
|
routings: JSON.parse(JSON.stringify(IkasStorefrontConfig.routings)) || null,
|
|
10915
|
+
gtmId: IkasStorefrontConfig.gtmId || null,
|
|
10916
|
+
fbpId: IkasStorefrontConfig.fbpId || null,
|
|
10915
10917
|
};
|
|
10916
10918
|
};
|
|
10917
10919
|
IkasStorefrontConfig.components = {};
|
|
@@ -16895,9 +16897,8 @@ var Analytics = /** @class */ (function () {
|
|
|
16895
16897
|
|
|
16896
16898
|
var AnalyticsHead = function (_a) {
|
|
16897
16899
|
var blockHTML = _a.blockHTML;
|
|
16898
|
-
var
|
|
16899
|
-
var
|
|
16900
|
-
var fbpId = serverRuntimeConfig.FBP_ID;
|
|
16900
|
+
var gtmId = IkasStorefrontConfig.gtmId;
|
|
16901
|
+
var fbpId = IkasStorefrontConfig.fbpId;
|
|
16901
16902
|
return (React.createElement(React.Fragment, null,
|
|
16902
16903
|
blockHTML && (React.createElement("script", { dangerouslySetInnerHTML: {
|
|
16903
16904
|
__html: "dataLayer = [{'gtm.blocklist': ['html']}];",
|
|
@@ -16910,9 +16911,8 @@ var AnalyticsHead = function (_a) {
|
|
|
16910
16911
|
} }))));
|
|
16911
16912
|
};
|
|
16912
16913
|
var AnalyticsBody = function () {
|
|
16913
|
-
var
|
|
16914
|
-
var
|
|
16915
|
-
var fbpId = serverRuntimeConfig.FBP_ID;
|
|
16914
|
+
var gtmId = IkasStorefrontConfig.gtmId;
|
|
16915
|
+
var fbpId = IkasStorefrontConfig.fbpId;
|
|
16916
16916
|
return (React.createElement(React.Fragment, null,
|
|
16917
16917
|
gtmId && (React.createElement("noscript", { dangerouslySetInnerHTML: {
|
|
16918
16918
|
__html: "<iframe src=\"https://www.googletagmanager.com/ns.html?id=" + gtmId + "\" height=\"0\" width=\"0\" style=\"display:none;visibility:hidden\"></iframe>",
|
|
@@ -25689,7 +25689,11 @@ function simpleToProduct(simple) {
|
|
|
25689
25689
|
sku: v.sku,
|
|
25690
25690
|
barcodeList: v.barcodeList || undefined,
|
|
25691
25691
|
images: (_b = v.images) === null || _b === void 0 ? void 0 : _b.map(function (i) { return new IkasImage(i.id); }),
|
|
25692
|
-
price: new IkasProductPrice((_c = v.prices) === null || _c === void 0 ? void 0 : _c.find(function (p) {
|
|
25692
|
+
price: new IkasProductPrice((_c = v.prices) === null || _c === void 0 ? void 0 : _c.find(function (p) {
|
|
25693
|
+
return IkasStorefrontConfig.priceListId
|
|
25694
|
+
? p.priceListId === IkasStorefrontConfig.priceListId
|
|
25695
|
+
: p.priceListId === null;
|
|
25696
|
+
})),
|
|
25693
25697
|
stock: v.stocks.length ? v.stocks[0].stockCount : 0,
|
|
25694
25698
|
variantValues: (_d = v.variantValues) === null || _d === void 0 ? void 0 : _d.map(function (vv) {
|
|
25695
25699
|
var pvt = simple.productVariantTypes.find(function (pvt) { return pvt.variantType.id === vv.variantTypeId; });
|
|
@@ -28561,6 +28565,8 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
28561
28565
|
IkasStorefrontConfig.priceListId = routing.priceListId || undefined;
|
|
28562
28566
|
IkasStorefrontConfig.stockLocationIds = (_a = salesChannel.stockLocations) === null || _a === void 0 ? void 0 : _a.map(function (sl) { return sl.id; });
|
|
28563
28567
|
IkasStorefrontConfig.routings = storefront.routings;
|
|
28568
|
+
IkasStorefrontConfig.gtmId = storefront.gtmId || undefined;
|
|
28569
|
+
IkasStorefrontConfig.fbpId = storefront.fbpId || undefined;
|
|
28564
28570
|
provider = new IkasPageDataProvider(themeLocalization.themeJson, context.params, pageType);
|
|
28565
28571
|
return [4 /*yield*/, provider.getPageData()];
|
|
28566
28572
|
case 2:
|
|
@@ -12,6 +12,8 @@ export declare class IkasStorefrontConfig {
|
|
|
12
12
|
static priceListId?: string;
|
|
13
13
|
static stockLocationIds?: string[];
|
|
14
14
|
static routings: IkasStorefrontRouting[];
|
|
15
|
+
static gtmId?: string;
|
|
16
|
+
static fbpId?: string;
|
|
15
17
|
static init(store: IkasBaseStore, components: any, config: Record<string, any>, apiUrlOverride?: string): void;
|
|
16
18
|
static initWithJson(json: Record<string, any>): void;
|
|
17
19
|
static getJson(): {
|
|
@@ -22,5 +24,7 @@ export declare class IkasStorefrontConfig {
|
|
|
22
24
|
priceListId: string | null;
|
|
23
25
|
stockLocationIds: string[] | null;
|
|
24
26
|
routings: any;
|
|
27
|
+
gtmId: string | null;
|
|
28
|
+
fbpId: string | null;
|
|
25
29
|
};
|
|
26
30
|
}
|
|
@@ -25,6 +25,8 @@ export declare class SettingsHelper {
|
|
|
25
25
|
priceListId: string | null;
|
|
26
26
|
stockLocationIds: string[] | null;
|
|
27
27
|
routings: any;
|
|
28
|
+
gtmId: string | null;
|
|
29
|
+
fbpId: string | null;
|
|
28
30
|
};
|
|
29
31
|
};
|
|
30
32
|
} | {
|
|
@@ -46,6 +48,8 @@ export declare class SettingsHelper {
|
|
|
46
48
|
priceListId: string | null;
|
|
47
49
|
stockLocationIds: string[] | null;
|
|
48
50
|
routings: any;
|
|
51
|
+
gtmId: string | null;
|
|
52
|
+
fbpId: string | null;
|
|
49
53
|
};
|
|
50
54
|
};
|
|
51
55
|
revalidate: number;
|
|
@@ -66,6 +70,8 @@ export declare class SettingsHelper {
|
|
|
66
70
|
priceListId: string | null;
|
|
67
71
|
stockLocationIds: string[] | null;
|
|
68
72
|
routings: any;
|
|
73
|
+
gtmId: string | null;
|
|
74
|
+
fbpId: string | null;
|
|
69
75
|
};
|
|
70
76
|
};
|
|
71
77
|
} | {
|
|
@@ -87,6 +93,8 @@ export declare class SettingsHelper {
|
|
|
87
93
|
priceListId: string | null;
|
|
88
94
|
stockLocationIds: string[] | null;
|
|
89
95
|
routings: any;
|
|
96
|
+
gtmId: string | null;
|
|
97
|
+
fbpId: string | null;
|
|
90
98
|
};
|
|
91
99
|
};
|
|
92
100
|
revalidate: number;
|
|
@@ -107,6 +115,8 @@ export declare class SettingsHelper {
|
|
|
107
115
|
priceListId: string | null;
|
|
108
116
|
stockLocationIds: string[] | null;
|
|
109
117
|
routings: any;
|
|
118
|
+
gtmId: string | null;
|
|
119
|
+
fbpId: string | null;
|
|
110
120
|
};
|
|
111
121
|
};
|
|
112
122
|
} | {
|
|
@@ -128,6 +138,8 @@ export declare class SettingsHelper {
|
|
|
128
138
|
priceListId: string | null;
|
|
129
139
|
stockLocationIds: string[] | null;
|
|
130
140
|
routings: any;
|
|
141
|
+
gtmId: string | null;
|
|
142
|
+
fbpId: string | null;
|
|
131
143
|
};
|
|
132
144
|
};
|
|
133
145
|
revalidate: number;
|