@searchspring/snap-controller
Advanced tools
Comparing version 0.59.0 to 0.60.0
@@ -6,3 +6,3 @@ import { Product } from '@searchspring/snap-store-mobx'; | ||
import type { RecommendationStore } from '@searchspring/snap-store-mobx'; | ||
import type { RecommendCombinedRequestModel } from '@searchspring/snap-client'; | ||
import type { RecommendRequestModel } from '@searchspring/snap-client'; | ||
import type { RecommendationControllerConfig, ControllerServices, ContextVariables } from '../types'; | ||
@@ -37,3 +37,3 @@ type RecommendationTrackMethods = { | ||
track: RecommendationTrackMethods; | ||
get params(): RecommendCombinedRequestModel; | ||
get params(): RecommendRequestModel; | ||
search: () => Promise<void>; | ||
@@ -40,0 +40,0 @@ } |
@@ -95,10 +95,11 @@ "use strict"; | ||
var getSeed = function () { | ||
var _a, _b, _c, _d; | ||
var skus = []; | ||
switch (_this.store.profile.placement) { | ||
case snap_tracker_1.ProfilePlacement.PRODUCTPAGE: | ||
if (_this.config.globals.product) { | ||
skus = [_this.config.globals.product]; | ||
if ((_a = _this.config.globals) === null || _a === void 0 ? void 0 : _a.product) { | ||
skus = [(_b = _this.config.globals) === null || _b === void 0 ? void 0 : _b.product]; | ||
} | ||
else if (_this.config.globals.products) { | ||
skus = _this.config.globals.products; | ||
else if ((_c = _this.config.globals) === null || _c === void 0 ? void 0 : _c.products) { | ||
skus = (_d = _this.config.globals) === null || _d === void 0 ? void 0 : _d.products; | ||
} | ||
@@ -121,3 +122,3 @@ break; | ||
click: function (e, result) { | ||
var _a; | ||
var _a, _b, _c; | ||
if (!_this.store.profile.tag || !result) | ||
@@ -130,3 +131,3 @@ return; | ||
category: snap_tracker_1.BeaconCategory.RECOMMENDATIONS, | ||
context: _this.config.globals.siteId ? { website: { trackingCode: _this.config.globals.siteId } } : undefined, | ||
context: ((_a = _this.config.globals) === null || _a === void 0 ? void 0 : _a.siteId) ? { website: { trackingCode: (_b = _this.config.globals) === null || _b === void 0 ? void 0 : _b.siteId } } : undefined, | ||
event: { | ||
@@ -147,3 +148,3 @@ context: { | ||
}, | ||
pid: (_a = _this.events.click) === null || _a === void 0 ? void 0 : _a.id, | ||
pid: (_c = _this.events.click) === null || _c === void 0 ? void 0 : _c.id, | ||
}; | ||
@@ -155,3 +156,3 @@ var event = _this.tracker.track.event(payload); | ||
impression: function (result) { | ||
var _a; | ||
var _a, _b, _c; | ||
if (!_this.store.profile.tag || !result || !_this.events.impression || (_this.events.product && ((_a = _this.events.product[result.id]) === null || _a === void 0 ? void 0 : _a.impression))) | ||
@@ -162,3 +163,3 @@ return; | ||
category: snap_tracker_1.BeaconCategory.RECOMMENDATIONS, | ||
context: _this.config.globals.siteId ? { website: { trackingCode: _this.config.globals.siteId } } : undefined, | ||
context: ((_b = _this.config.globals) === null || _b === void 0 ? void 0 : _b.siteId) ? { website: { trackingCode: (_c = _this.config.globals) === null || _c === void 0 ? void 0 : _c.siteId } } : undefined, | ||
event: { | ||
@@ -186,3 +187,3 @@ context: { | ||
render: function (result) { | ||
var _a; | ||
var _a, _b, _c; | ||
if (!_this.store.profile.tag || !result || !_this.events.render || ((_a = _this.events.product[result.id]) === null || _a === void 0 ? void 0 : _a.render)) | ||
@@ -193,3 +194,3 @@ return; | ||
category: snap_tracker_1.BeaconCategory.RECOMMENDATIONS, | ||
context: _this.config.globals.siteId ? { website: { trackingCode: _this.config.globals.siteId } } : undefined, | ||
context: ((_b = _this.config.globals) === null || _b === void 0 ? void 0 : _b.siteId) ? { website: { trackingCode: (_c = _this.config.globals) === null || _c === void 0 ? void 0 : _c.siteId } } : undefined, | ||
event: { | ||
@@ -217,3 +218,3 @@ context: { | ||
removedFromBundle: function (result) { | ||
var _a, _b; | ||
var _a, _b, _c, _d; | ||
if (!_this.store.profile.tag || | ||
@@ -228,3 +229,3 @@ !result || | ||
category: snap_tracker_1.BeaconCategory.RECOMMENDATIONS, | ||
context: _this.config.globals.siteId ? { website: { trackingCode: _this.config.globals.siteId } } : undefined, | ||
context: ((_b = _this.config.globals) === null || _b === void 0 ? void 0 : _b.siteId) ? { website: { trackingCode: (_c = _this.config.globals) === null || _c === void 0 ? void 0 : _c.siteId } } : undefined, | ||
event: { | ||
@@ -244,3 +245,3 @@ context: { | ||
}, | ||
pid: (_b = _this.events.click) === null || _b === void 0 ? void 0 : _b.id, | ||
pid: (_d = _this.events.click) === null || _d === void 0 ? void 0 : _d.id, | ||
}; | ||
@@ -253,3 +254,3 @@ _this.events.product[result.id] = _this.events.product[result.id] || {}; | ||
addedToBundle: function (result) { | ||
var _a, _b; | ||
var _a, _b, _c, _d; | ||
if (!_this.store.profile.tag || | ||
@@ -264,3 +265,3 @@ !result || | ||
category: snap_tracker_1.BeaconCategory.RECOMMENDATIONS, | ||
context: _this.config.globals.siteId ? { website: { trackingCode: _this.config.globals.siteId } } : undefined, | ||
context: ((_b = _this.config.globals) === null || _b === void 0 ? void 0 : _b.siteId) ? { website: { trackingCode: (_c = _this.config.globals) === null || _c === void 0 ? void 0 : _c.siteId } } : undefined, | ||
event: { | ||
@@ -280,3 +281,3 @@ context: { | ||
}, | ||
pid: (_b = _this.events.click) === null || _b === void 0 ? void 0 : _b.id, | ||
pid: (_d = _this.events.click) === null || _d === void 0 ? void 0 : _d.id, | ||
}; | ||
@@ -290,2 +291,3 @@ _this.events.product[result.id] = _this.events.product[result.id] || {}; | ||
addBundle: function (e, results) { | ||
var _a, _b; | ||
if (!results.length || !_this.store.profile.tag || _this.store.profile.type != 'bundle') | ||
@@ -296,3 +298,3 @@ return; | ||
category: snap_tracker_1.BeaconCategory.RECOMMENDATIONS, | ||
context: _this.config.globals.siteId ? { website: { trackingCode: _this.config.globals.siteId } } : undefined, | ||
context: ((_a = _this.config.globals) === null || _a === void 0 ? void 0 : _a.siteId) ? { website: { trackingCode: (_b = _this.config.globals) === null || _b === void 0 ? void 0 : _b.siteId } } : undefined, | ||
event: { | ||
@@ -324,2 +326,3 @@ context: { | ||
click: function (e) { | ||
var _a, _b; | ||
if (!_this.store.profile.tag) | ||
@@ -330,3 +333,3 @@ return; | ||
category: snap_tracker_1.BeaconCategory.RECOMMENDATIONS, | ||
context: _this.config.globals.siteId ? { website: { trackingCode: _this.config.globals.siteId } } : undefined, | ||
context: ((_a = _this.config.globals) === null || _a === void 0 ? void 0 : _a.siteId) ? { website: { trackingCode: (_b = _this.config.globals) === null || _b === void 0 ? void 0 : _b.siteId } } : undefined, | ||
event: { | ||
@@ -353,2 +356,3 @@ context: { | ||
impression: function () { | ||
var _a, _b; | ||
if (!_this.store.profile.tag || _this.events.impression) | ||
@@ -359,3 +363,3 @@ return; | ||
category: snap_tracker_1.BeaconCategory.RECOMMENDATIONS, | ||
context: _this.config.globals.siteId ? { website: { trackingCode: _this.config.globals.siteId } } : undefined, | ||
context: ((_a = _this.config.globals) === null || _a === void 0 ? void 0 : _a.siteId) ? { website: { trackingCode: (_b = _this.config.globals) === null || _b === void 0 ? void 0 : _b.siteId } } : undefined, | ||
event: { | ||
@@ -381,2 +385,3 @@ context: { | ||
render: function () { | ||
var _a, _b; | ||
if (!_this.store.profile.tag || _this.events.render) | ||
@@ -387,3 +392,3 @@ return; | ||
category: snap_tracker_1.BeaconCategory.RECOMMENDATIONS, | ||
context: _this.config.globals.siteId ? { website: { trackingCode: _this.config.globals.siteId } } : undefined, | ||
context: ((_a = _this.config.globals) === null || _a === void 0 ? void 0 : _a.siteId) ? { website: { trackingCode: (_b = _this.config.globals) === null || _b === void 0 ? void 0 : _b.siteId } } : undefined, | ||
event: { | ||
@@ -610,3 +615,3 @@ context: { | ||
var _a, _b; | ||
var params = __assign({ tag: this.config.tag, batched: this.config.batched, branch: this.config.branch || 'production', order: (_b = (_a = this.context) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.order }, this.config.globals); | ||
var params = __assign({ tag: this.config.tag, batched: this.config.batched, branch: this.config.branch || 'production', order: (_b = (_a = this.context) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.order, batchId: this.config.batchId }, this.config.globals); | ||
var shopperId = this.tracker.getContext().shopperId; | ||
@@ -613,0 +618,0 @@ var cart = this.tracker.cookies.cart.get(); |
@@ -6,3 +6,3 @@ import { Product } from '@searchspring/snap-store-mobx'; | ||
import type { RecommendationStore } from '@searchspring/snap-store-mobx'; | ||
import type { RecommendCombinedRequestModel } from '@searchspring/snap-client'; | ||
import type { RecommendRequestModel } from '@searchspring/snap-client'; | ||
import type { RecommendationControllerConfig, ControllerServices, ContextVariables } from '../types'; | ||
@@ -37,3 +37,3 @@ type RecommendationTrackMethods = { | ||
track: RecommendationTrackMethods; | ||
get params(): RecommendCombinedRequestModel; | ||
get params(): RecommendRequestModel; | ||
search: () => Promise<void>; | ||
@@ -40,0 +40,0 @@ } |
@@ -28,7 +28,7 @@ import deepmerge from 'deepmerge'; | ||
case ProfilePlacement.PRODUCTPAGE: | ||
if (this.config.globals.product) { | ||
skus = [this.config.globals.product]; | ||
if (this.config.globals?.product) { | ||
skus = [this.config.globals?.product]; | ||
} | ||
else if (this.config.globals.products) { | ||
skus = this.config.globals.products; | ||
else if (this.config.globals?.products) { | ||
skus = this.config.globals?.products; | ||
} | ||
@@ -58,3 +58,3 @@ break; | ||
category: BeaconCategory.RECOMMENDATIONS, | ||
context: this.config.globals.siteId ? { website: { trackingCode: this.config.globals.siteId } } : undefined, | ||
context: this.config.globals?.siteId ? { website: { trackingCode: this.config.globals?.siteId } } : undefined, | ||
event: { | ||
@@ -87,3 +87,3 @@ context: { | ||
category: BeaconCategory.RECOMMENDATIONS, | ||
context: this.config.globals.siteId ? { website: { trackingCode: this.config.globals.siteId } } : undefined, | ||
context: this.config.globals?.siteId ? { website: { trackingCode: this.config.globals?.siteId } } : undefined, | ||
event: { | ||
@@ -116,3 +116,3 @@ context: { | ||
category: BeaconCategory.RECOMMENDATIONS, | ||
context: this.config.globals.siteId ? { website: { trackingCode: this.config.globals.siteId } } : undefined, | ||
context: this.config.globals?.siteId ? { website: { trackingCode: this.config.globals?.siteId } } : undefined, | ||
event: { | ||
@@ -149,3 +149,3 @@ context: { | ||
category: BeaconCategory.RECOMMENDATIONS, | ||
context: this.config.globals.siteId ? { website: { trackingCode: this.config.globals.siteId } } : undefined, | ||
context: this.config.globals?.siteId ? { website: { trackingCode: this.config.globals?.siteId } } : undefined, | ||
event: { | ||
@@ -182,3 +182,3 @@ context: { | ||
category: BeaconCategory.RECOMMENDATIONS, | ||
context: this.config.globals.siteId ? { website: { trackingCode: this.config.globals.siteId } } : undefined, | ||
context: this.config.globals?.siteId ? { website: { trackingCode: this.config.globals?.siteId } } : undefined, | ||
event: { | ||
@@ -212,3 +212,3 @@ context: { | ||
category: BeaconCategory.RECOMMENDATIONS, | ||
context: this.config.globals.siteId ? { website: { trackingCode: this.config.globals.siteId } } : undefined, | ||
context: this.config.globals?.siteId ? { website: { trackingCode: this.config.globals?.siteId } } : undefined, | ||
event: { | ||
@@ -245,3 +245,3 @@ context: { | ||
category: BeaconCategory.RECOMMENDATIONS, | ||
context: this.config.globals.siteId ? { website: { trackingCode: this.config.globals.siteId } } : undefined, | ||
context: this.config.globals?.siteId ? { website: { trackingCode: this.config.globals?.siteId } } : undefined, | ||
event: { | ||
@@ -273,3 +273,3 @@ context: { | ||
category: BeaconCategory.RECOMMENDATIONS, | ||
context: this.config.globals.siteId ? { website: { trackingCode: this.config.globals.siteId } } : undefined, | ||
context: this.config.globals?.siteId ? { website: { trackingCode: this.config.globals?.siteId } } : undefined, | ||
event: { | ||
@@ -300,3 +300,3 @@ context: { | ||
category: BeaconCategory.RECOMMENDATIONS, | ||
context: this.config.globals.siteId ? { website: { trackingCode: this.config.globals.siteId } } : undefined, | ||
context: this.config.globals?.siteId ? { website: { trackingCode: this.config.globals?.siteId } } : undefined, | ||
event: { | ||
@@ -473,2 +473,3 @@ context: { | ||
order: this.context?.options?.order, | ||
batchId: this.config.batchId, | ||
...this.config.globals, | ||
@@ -475,0 +476,0 @@ }; |
{ | ||
"name": "@searchspring/snap-controller", | ||
"version": "0.59.0", | ||
"version": "0.60.0", | ||
"description": "Snap Controllers", | ||
@@ -23,3 +23,3 @@ "main": "dist/cjs/index.js", | ||
"dependencies": { | ||
"@searchspring/snap-toolbox": "^0.59.0", | ||
"@searchspring/snap-toolbox": "^0.60.0", | ||
"css.escape": "1.5.1", | ||
@@ -29,9 +29,9 @@ "deepmerge": "4.3.1" | ||
"devDependencies": { | ||
"@searchspring/snap-client": "^0.59.0", | ||
"@searchspring/snap-event-manager": "^0.59.0", | ||
"@searchspring/snap-logger": "^0.59.0", | ||
"@searchspring/snap-profiler": "^0.59.0", | ||
"@searchspring/snap-store-mobx": "^0.59.0", | ||
"@searchspring/snap-tracker": "^0.59.0", | ||
"@searchspring/snap-url-manager": "^0.59.0" | ||
"@searchspring/snap-client": "^0.60.0", | ||
"@searchspring/snap-event-manager": "^0.60.0", | ||
"@searchspring/snap-logger": "^0.60.0", | ||
"@searchspring/snap-profiler": "^0.60.0", | ||
"@searchspring/snap-store-mobx": "^0.60.0", | ||
"@searchspring/snap-tracker": "^0.60.0", | ||
"@searchspring/snap-url-manager": "^0.60.0" | ||
}, | ||
@@ -42,3 +42,3 @@ "sideEffects": false, | ||
], | ||
"gitHead": "3106e08ab0114c0bb0de8f7d7beb6f65968f9c75" | ||
"gitHead": "c1b320737bc856b18032888f7b6825fd4706def9" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
312791
5468
+ Added@searchspring/snap-toolbox@0.60.4(transitive)
- Removed@searchspring/snap-toolbox@0.59.0(transitive)