@sentecacommerce-theme/lib 0.14.6 → 0.14.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/analytics/purchase.js +10 -10
- package/dist/cjs/listing/utils/buildCategoryQuery.js +1 -1
- package/dist/cjs/product/api/keys.js +6 -4
- package/dist/cjs/product/api/queries/useBnpOffersQuery.js +1 -1
- package/dist/cjs/product/api/queries/useUniCreditOffersQuery.js +1 -1
- package/dist/esm/analytics/purchase.js +10 -10
- package/dist/esm/listing/utils/buildCategoryQuery.js +1 -1
- package/dist/esm/product/api/keys.js +6 -4
- package/dist/esm/product/api/queries/useBnpOffersQuery.js +1 -1
- package/dist/esm/product/api/queries/useUniCreditOffersQuery.js +1 -1
- package/dist/types/product/api/keys.d.ts +2 -2
- package/package.json +4 -4
@@ -15,7 +15,7 @@ var purchase = function(order, config) {
|
|
15
15
|
var isGtagLoaded = Boolean(window.gtag);
|
16
16
|
var hasGoogleId = Boolean((ref8 = config.google) === null || ref8 === void 0 ? void 0 : ref8.analytics);
|
17
17
|
if (isGtagLoaded && hasGoogleId) {
|
18
|
-
var ref9, ref10, ref11;
|
18
|
+
var ref9, ref10, ref11, ref12;
|
19
19
|
var items = ((ref9 = order.lineItems) === null || ref9 === void 0 ? void 0 : ref9.map(function(item, i) {
|
20
20
|
return {
|
21
21
|
id: item.variant.sku,
|
@@ -23,36 +23,36 @@ var purchase = function(order, config) {
|
|
23
23
|
list_name: config.defaultMerchant,
|
24
24
|
list_position: i + 1,
|
25
25
|
quantity: item.quantity,
|
26
|
-
price: (0, _decodePrice).decodePrice(item.totalPrice)
|
26
|
+
price: (item === null || item === void 0 ? void 0 : item.totalPrice) && (0, _decodePrice).decodePrice(item.totalPrice)
|
27
27
|
};
|
28
28
|
})) || [];
|
29
|
-
(
|
29
|
+
(ref12 = window.gtag) === null || ref12 === void 0 ? void 0 : ref12.call(window, 'event', 'purchase', {
|
30
30
|
transaction_id: order._id,
|
31
31
|
send_to: (ref10 = config.google) === null || ref10 === void 0 ? void 0 : ref10.analytics,
|
32
32
|
affiliation: config.defaultMerchant,
|
33
33
|
value: (0, _decodePrice).decodePrice(order.grandTotalPrice),
|
34
34
|
currency: order.currencyCode,
|
35
35
|
tax: (0, _decodePrice).decodePrice(centAmount),
|
36
|
-
shipping: (order === null || order === void 0 ? void 0 : order.shippings) ? (0, _decodePrice).decodePrice(order.shippings[0].price) : 0,
|
36
|
+
shipping: (order === null || order === void 0 ? void 0 : order.shippings) ? (0, _decodePrice).decodePrice((ref11 = order.shippings[0]) === null || ref11 === void 0 ? void 0 : ref11.price) : 0,
|
37
37
|
items: items
|
38
38
|
});
|
39
39
|
}
|
40
40
|
if (isGtagLoaded && hasGoogleReMarketing) {
|
41
|
-
var
|
42
|
-
(
|
43
|
-
send_to: "".concat((
|
41
|
+
var ref13, ref14, ref15, ref16, ref17;
|
42
|
+
(ref17 = window.gtag) === null || ref17 === void 0 ? void 0 : ref17.call(window, 'event', 'conversion', {
|
43
|
+
send_to: "".concat((ref13 = config.google) === null || ref13 === void 0 ? void 0 : (ref14 = ref13.reMarketing) === null || ref14 === void 0 ? void 0 : ref14.id, "/").concat((ref15 = config.google) === null || ref15 === void 0 ? void 0 : (ref16 = ref15.reMarketing) === null || ref16 === void 0 ? void 0 : ref16.label),
|
44
44
|
value: (0, _decodePrice).decodePrice(order.grandTotalPrice),
|
45
45
|
currency: order.currencyCode,
|
46
46
|
transaction_id: order._id
|
47
47
|
});
|
48
48
|
}
|
49
49
|
if (facebookPixelLoaded) {
|
50
|
-
var
|
51
|
-
(
|
50
|
+
var ref18, ref19;
|
51
|
+
(ref19 = window.fbq) === null || ref19 === void 0 ? void 0 : ref19.call(window, 'track', 'Purchase', {
|
52
52
|
currency: order.currencyCode,
|
53
53
|
value: (0, _decodePrice).decodePrice(order.grandTotalPrice),
|
54
54
|
content_type: 'product',
|
55
|
-
contents: ((
|
55
|
+
contents: ((ref18 = order.lineItems) === null || ref18 === void 0 ? void 0 : ref18.map(function(product) {
|
56
56
|
return {
|
57
57
|
id: product.variant.sku,
|
58
58
|
quantity: product.quantity
|
@@ -106,7 +106,7 @@ var buildCategoryQuery = function(param) {
|
|
106
106
|
};
|
107
107
|
var _obj;
|
108
108
|
var query = (_obj = {}, _defineProperty(_obj, type, aggValue), _defineProperty(_obj, "filter", getFilters()), _obj);
|
109
|
-
if (pageType === _index.ListingTypesEnum.Collection) {
|
109
|
+
if (pageType === _index.ListingTypesEnum.Collection && (config === null || config === void 0 ? void 0 : config.collapseMode)) {
|
110
110
|
var collapseMode = config === null || config === void 0 ? void 0 : config.collapseMode;
|
111
111
|
query = _objectSpread({}, query, {
|
112
112
|
collapseMode: collapseMode
|
@@ -2,17 +2,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
2
2
|
value: true
|
3
3
|
});
|
4
4
|
exports.getUniCreditProductOffersKey = exports.getBnpProductOffersKey = void 0;
|
5
|
-
var getBnpProductOffersKey = function(sku) {
|
5
|
+
var getBnpProductOffersKey = function(sku, downPaymentCentAmount) {
|
6
6
|
return [
|
7
7
|
'product-bnp-offers',
|
8
|
-
sku
|
8
|
+
sku,
|
9
|
+
downPaymentCentAmount
|
9
10
|
];
|
10
11
|
};
|
11
12
|
exports.getBnpProductOffersKey = getBnpProductOffersKey;
|
12
|
-
var getUniCreditProductOffersKey = function(sku) {
|
13
|
+
var getUniCreditProductOffersKey = function(sku, downPaymentCentAmount) {
|
13
14
|
return [
|
14
15
|
'product-unicredit-offers',
|
15
|
-
sku
|
16
|
+
sku,
|
17
|
+
downPaymentCentAmount
|
16
18
|
];
|
17
19
|
};
|
18
20
|
exports.getUniCreditProductOffersKey = getUniCreditProductOffersKey;
|
@@ -43,7 +43,7 @@ function _interopRequireDefault(obj) {
|
|
43
43
|
}
|
44
44
|
var useBnpOffersQuery = function(param) {
|
45
45
|
var sku = param.sku, _preferredInstallmentCentAmount = param.preferredInstallmentCentAmount, preferredInstallmentCentAmount = _preferredInstallmentCentAmount === void 0 ? 0 : _preferredInstallmentCentAmount, _downPaymentCentAmount = param.downPaymentCentAmount, downPaymentCentAmount = _downPaymentCentAmount === void 0 ? 0 : _downPaymentCentAmount;
|
46
|
-
return (0, _reactQuery).useQuery((0, _keys).getBnpProductOffersKey(sku), _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee() {
|
46
|
+
return (0, _reactQuery).useQuery((0, _keys).getBnpProductOffersKey(sku, downPaymentCentAmount), _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee() {
|
47
47
|
return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
|
48
48
|
while(1)switch(_ctx.prev = _ctx.next){
|
49
49
|
case 0:
|
@@ -43,7 +43,7 @@ function _interopRequireDefault(obj) {
|
|
43
43
|
}
|
44
44
|
var useUniCreditOffersQuery = function(param) {
|
45
45
|
var sku = param.sku, _downPaymentCentAmount = param.downPaymentCentAmount, downPaymentCentAmount = _downPaymentCentAmount === void 0 ? 0 : _downPaymentCentAmount;
|
46
|
-
return (0, _reactQuery).useQuery((0, _keys).getUniCreditProductOffersKey(sku), _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee() {
|
46
|
+
return (0, _reactQuery).useQuery((0, _keys).getUniCreditProductOffersKey(sku, downPaymentCentAmount), _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee() {
|
47
47
|
return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
|
48
48
|
while(1)switch(_ctx.prev = _ctx.next){
|
49
49
|
case 0:
|
@@ -11,7 +11,7 @@ export var purchase = function(order, config) {
|
|
11
11
|
var isGtagLoaded = Boolean(window.gtag);
|
12
12
|
var hasGoogleId = Boolean((ref8 = config.google) === null || ref8 === void 0 ? void 0 : ref8.analytics);
|
13
13
|
if (isGtagLoaded && hasGoogleId) {
|
14
|
-
var ref9, ref10, ref11;
|
14
|
+
var ref9, ref10, ref11, ref12;
|
15
15
|
var items = ((ref9 = order.lineItems) === null || ref9 === void 0 ? void 0 : ref9.map(function(item, i) {
|
16
16
|
return {
|
17
17
|
id: item.variant.sku,
|
@@ -19,36 +19,36 @@ export var purchase = function(order, config) {
|
|
19
19
|
list_name: config.defaultMerchant,
|
20
20
|
list_position: i + 1,
|
21
21
|
quantity: item.quantity,
|
22
|
-
price: decodePrice(item.totalPrice)
|
22
|
+
price: (item === null || item === void 0 ? void 0 : item.totalPrice) && decodePrice(item.totalPrice)
|
23
23
|
};
|
24
24
|
})) || [];
|
25
|
-
(
|
25
|
+
(ref12 = window.gtag) === null || ref12 === void 0 ? void 0 : ref12.call(window, 'event', 'purchase', {
|
26
26
|
transaction_id: order._id,
|
27
27
|
send_to: (ref10 = config.google) === null || ref10 === void 0 ? void 0 : ref10.analytics,
|
28
28
|
affiliation: config.defaultMerchant,
|
29
29
|
value: decodePrice(order.grandTotalPrice),
|
30
30
|
currency: order.currencyCode,
|
31
31
|
tax: decodePrice(centAmount),
|
32
|
-
shipping: (order === null || order === void 0 ? void 0 : order.shippings) ? decodePrice(order.shippings[0].price) : 0,
|
32
|
+
shipping: (order === null || order === void 0 ? void 0 : order.shippings) ? decodePrice((ref11 = order.shippings[0]) === null || ref11 === void 0 ? void 0 : ref11.price) : 0,
|
33
33
|
items: items
|
34
34
|
});
|
35
35
|
}
|
36
36
|
if (isGtagLoaded && hasGoogleReMarketing) {
|
37
|
-
var
|
38
|
-
(
|
39
|
-
send_to: "".concat((
|
37
|
+
var ref13, ref14, ref15, ref16, ref17;
|
38
|
+
(ref17 = window.gtag) === null || ref17 === void 0 ? void 0 : ref17.call(window, 'event', 'conversion', {
|
39
|
+
send_to: "".concat((ref13 = config.google) === null || ref13 === void 0 ? void 0 : (ref14 = ref13.reMarketing) === null || ref14 === void 0 ? void 0 : ref14.id, "/").concat((ref15 = config.google) === null || ref15 === void 0 ? void 0 : (ref16 = ref15.reMarketing) === null || ref16 === void 0 ? void 0 : ref16.label),
|
40
40
|
value: decodePrice(order.grandTotalPrice),
|
41
41
|
currency: order.currencyCode,
|
42
42
|
transaction_id: order._id
|
43
43
|
});
|
44
44
|
}
|
45
45
|
if (facebookPixelLoaded) {
|
46
|
-
var
|
47
|
-
(
|
46
|
+
var ref18, ref19;
|
47
|
+
(ref19 = window.fbq) === null || ref19 === void 0 ? void 0 : ref19.call(window, 'track', 'Purchase', {
|
48
48
|
currency: order.currencyCode,
|
49
49
|
value: decodePrice(order.grandTotalPrice),
|
50
50
|
content_type: 'product',
|
51
|
-
contents: ((
|
51
|
+
contents: ((ref18 = order.lineItems) === null || ref18 === void 0 ? void 0 : ref18.map(function(product) {
|
52
52
|
return {
|
53
53
|
id: product.variant.sku,
|
54
54
|
quantity: product.quantity
|
@@ -102,7 +102,7 @@ export var buildCategoryQuery = function(param) {
|
|
102
102
|
};
|
103
103
|
var _obj;
|
104
104
|
var query = (_obj = {}, _defineProperty(_obj, type, aggValue), _defineProperty(_obj, "filter", getFilters()), _obj);
|
105
|
-
if (pageType === ListingTypesEnum.Collection) {
|
105
|
+
if (pageType === ListingTypesEnum.Collection && (config === null || config === void 0 ? void 0 : config.collapseMode)) {
|
106
106
|
var collapseMode = config === null || config === void 0 ? void 0 : config.collapseMode;
|
107
107
|
query = _objectSpread({}, query, {
|
108
108
|
collapseMode: collapseMode
|
@@ -1,12 +1,14 @@
|
|
1
|
-
export var getBnpProductOffersKey = function(sku) {
|
1
|
+
export var getBnpProductOffersKey = function(sku, downPaymentCentAmount) {
|
2
2
|
return [
|
3
3
|
'product-bnp-offers',
|
4
|
-
sku
|
4
|
+
sku,
|
5
|
+
downPaymentCentAmount
|
5
6
|
];
|
6
7
|
};
|
7
|
-
export var getUniCreditProductOffersKey = function(sku) {
|
8
|
+
export var getUniCreditProductOffersKey = function(sku, downPaymentCentAmount) {
|
8
9
|
return [
|
9
10
|
'product-unicredit-offers',
|
10
|
-
sku
|
11
|
+
sku,
|
12
|
+
downPaymentCentAmount
|
11
13
|
];
|
12
14
|
};
|
@@ -34,7 +34,7 @@ function _asyncToGenerator(fn) {
|
|
34
34
|
}
|
35
35
|
export var useBnpOffersQuery = function(param) {
|
36
36
|
var sku = param.sku, _preferredInstallmentCentAmount = param.preferredInstallmentCentAmount, preferredInstallmentCentAmount = _preferredInstallmentCentAmount === void 0 ? 0 : _preferredInstallmentCentAmount, _downPaymentCentAmount = param.downPaymentCentAmount, downPaymentCentAmount = _downPaymentCentAmount === void 0 ? 0 : _downPaymentCentAmount;
|
37
|
-
return useQuery(getBnpProductOffersKey(sku), _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
|
37
|
+
return useQuery(getBnpProductOffersKey(sku, downPaymentCentAmount), _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
|
38
38
|
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
39
39
|
while(1)switch(_ctx.prev = _ctx.next){
|
40
40
|
case 0:
|
@@ -34,7 +34,7 @@ function _asyncToGenerator(fn) {
|
|
34
34
|
}
|
35
35
|
export var useUniCreditOffersQuery = function(param) {
|
36
36
|
var sku = param.sku, _downPaymentCentAmount = param.downPaymentCentAmount, downPaymentCentAmount = _downPaymentCentAmount === void 0 ? 0 : _downPaymentCentAmount;
|
37
|
-
return useQuery(getUniCreditProductOffersKey(sku), _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
|
37
|
+
return useQuery(getUniCreditProductOffersKey(sku, downPaymentCentAmount), _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
|
38
38
|
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
39
39
|
while(1)switch(_ctx.prev = _ctx.next){
|
40
40
|
case 0:
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export declare const getBnpProductOffersKey: (sku: string) => string[];
|
2
|
-
export declare const getUniCreditProductOffersKey: (sku: string) => string[];
|
1
|
+
export declare const getBnpProductOffersKey: (sku: string, downPaymentCentAmount?: number | undefined) => (string | number | undefined)[];
|
2
|
+
export declare const getUniCreditProductOffersKey: (sku: string, downPaymentCentAmount?: number | undefined) => (string | number | undefined)[];
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sentecacommerce-theme/lib",
|
3
3
|
"sideEffects": false,
|
4
|
-
"version": "0.14.
|
4
|
+
"version": "0.14.9",
|
5
5
|
"main": "dist/cjs/index.js",
|
6
6
|
"module": "dist/esm/index.js",
|
7
7
|
"types": "dist/types/index.d.ts",
|
@@ -31,13 +31,13 @@
|
|
31
31
|
"watch:cjs": "swc src --out-dir dist/cjs -w",
|
32
32
|
"watch:esm": "swc src --out-dir dist/esm --no-swcrc -w"
|
33
33
|
},
|
34
|
-
"gitHead": "
|
34
|
+
"gitHead": "704001f1791d48eef43ecd862836cc22da13a067",
|
35
35
|
"peerDependencies": {
|
36
36
|
"react-query": "^2.26.2"
|
37
37
|
},
|
38
38
|
"dependencies": {
|
39
|
-
"@sentecacommerce-theme/base": "^0.14.
|
40
|
-
"@sentecacommerce-theme/cms": "^0.14.
|
39
|
+
"@sentecacommerce-theme/base": "^0.14.9",
|
40
|
+
"@sentecacommerce-theme/cms": "^0.14.9",
|
41
41
|
"@sentecacommerce/sdk": "2.0.175",
|
42
42
|
"body-scroll-lock": "^3.1.5",
|
43
43
|
"copy-to-clipboard": "^3.3.1",
|