@searchspring/snap-preact 0.61.4 → 0.61.5

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.
@@ -245,14 +245,14 @@ var RecommendationInstantiator = /** @class */ (function () {
245
245
  }());
246
246
  exports.RecommendationInstantiator = RecommendationInstantiator;
247
247
  function readyTheController(instance, injectedElem, context, profileCount, elem, controllerGlobals) {
248
- var _a, _b, _c, _d, _e, _f, _g, _h;
248
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
249
249
  return __awaiter(this, void 0, void 0, function () {
250
- var profile, batchId, cart, tag, batched, globals, controllerConfig, controller, createRecommendationController, profileVars, component, RecommendationsComponent, _j;
251
- return __generator(this, function (_k) {
252
- switch (_k.label) {
250
+ var profile, batchId, cart, tag, batched, globals, controllerConfig, controller, createRecommendationController, profileVars, component, RecommendationsComponent, _k;
251
+ return __generator(this, function (_l) {
252
+ switch (_l.label) {
253
253
  case 0:
254
254
  profile = controllerGlobals.profile, batchId = controllerGlobals.batchId, cart = controllerGlobals.cart, tag = controllerGlobals.tag;
255
- batched = (_a = ((profile === null || profile === void 0 ? void 0 : profile.batched) || controllerGlobals.batched)) !== null && _a !== void 0 ? _a : true;
255
+ batched = (_b = (_a = profile === null || profile === void 0 ? void 0 : profile.batched) !== null && _a !== void 0 ? _a : controllerGlobals.batched) !== null && _b !== void 0 ? _b : true;
256
256
  if (!tag) {
257
257
  // FEEDBACK: change message depending on script integration type (profile vs. legacy)
258
258
  instance.logger.warn("'tag' is missing from <script> tag, skipping this profile", elem);
@@ -263,11 +263,11 @@ function readyTheController(instance, injectedElem, context, profileCount, elem,
263
263
  }
264
264
  profileCount[tag] = profileCount[tag] + 1 || 1;
265
265
  globals = deepmerge_1.default.all([
266
- ((_b = instance.config.client) === null || _b === void 0 ? void 0 : _b.globals) || {},
267
- ((_c = instance.config.config) === null || _c === void 0 ? void 0 : _c.globals) || {},
266
+ ((_c = instance.config.client) === null || _c === void 0 ? void 0 : _c.globals) || {},
267
+ ((_d = instance.config.config) === null || _d === void 0 ? void 0 : _d.globals) || {},
268
268
  controllerGlobals,
269
269
  ]);
270
- controllerConfig = __assign(__assign({ id: "recommend_".concat(tag, "_").concat(profileCount[tag] - 1), tag: tag, batched: batched !== null && batched !== void 0 ? batched : true, realtime: Boolean((_e = (_d = context.options) === null || _d === void 0 ? void 0 : _d.realtime) !== null && _e !== void 0 ? _e : (_g = (_f = context.profile) === null || _f === void 0 ? void 0 : _f.options) === null || _g === void 0 ? void 0 : _g.realtime), batchId: batchId }, instance.config.config), { globals: globals });
270
+ controllerConfig = __assign(__assign({ id: "recommend_".concat(tag, "_").concat(profileCount[tag] - 1), tag: tag, batched: batched !== null && batched !== void 0 ? batched : true, realtime: Boolean((_f = (_e = context.options) === null || _e === void 0 ? void 0 : _e.realtime) !== null && _f !== void 0 ? _f : (_h = (_g = context.profile) === null || _g === void 0 ? void 0 : _g.options) === null || _h === void 0 ? void 0 : _h.realtime), batchId: batchId }, instance.config.config), { globals: globals });
271
271
  if (profile === null || profile === void 0 ? void 0 : profile.branch) {
272
272
  controllerConfig.branch = profile === null || profile === void 0 ? void 0 : profile.branch;
273
273
  }
@@ -292,7 +292,7 @@ function readyTheController(instance, injectedElem, context, profileCount, elem,
292
292
  if (!!controller) return [3 /*break*/, 2];
293
293
  return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require('../create/createRecommendationController')); })];
294
294
  case 1:
295
- createRecommendationController = (_k.sent()).default;
295
+ createRecommendationController = (_l.sent()).default;
296
296
  controller = createRecommendationController({
297
297
  url: instance.config.url,
298
298
  controller: controllerConfig,
@@ -302,20 +302,20 @@ function readyTheController(instance, injectedElem, context, profileCount, elem,
302
302
  instance.uses.forEach(function (attachements) { return controller.use(attachements); });
303
303
  instance.plugins.forEach(function (plugin) { return controller.plugin.apply(controller, __spreadArray([plugin.func], plugin.args, false)); });
304
304
  instance.middleware.forEach(function (middleware) { return controller.on.apply(controller, __spreadArray([middleware.event], middleware.func, false)); });
305
- _k.label = 2;
305
+ _l.label = 2;
306
306
  case 2:
307
307
  if (!(!controller.store.loaded && !controller.store.loading)) return [3 /*break*/, 4];
308
308
  return [4 /*yield*/, controller.search()];
309
309
  case 3:
310
- _k.sent();
311
- _k.label = 4;
310
+ _l.sent();
311
+ _l.label = 4;
312
312
  case 4:
313
313
  controller.addTargeter(instance.targeter);
314
314
  instance.controller[controller.config.id] = controller;
315
315
  window.searchspring.controller = window.searchspring.controller || {};
316
316
  window.searchspring.controller[controller.config.id] = controller;
317
317
  profileVars = controller.store.profile.display.templateParameters;
318
- component = (_h = controller.store.profile.display.template) === null || _h === void 0 ? void 0 : _h.component;
318
+ component = (_j = controller.store.profile.display.template) === null || _j === void 0 ? void 0 : _j.component;
319
319
  if (controller.store.error) {
320
320
  //something went wrong
321
321
  //err was already logged - nothing to do.
@@ -333,14 +333,14 @@ function readyTheController(instance, injectedElem, context, profileCount, elem,
333
333
  instance.logger.error("profile '".concat(tag, "' found on the following element is missing a component!\n").concat(elem === null || elem === void 0 ? void 0 : elem.outerHTML));
334
334
  return [2 /*return*/];
335
335
  }
336
- _j = instance.config.components[component];
337
- if (!_j) return [3 /*break*/, 6];
336
+ _k = instance.config.components[component];
337
+ if (!_k) return [3 /*break*/, 6];
338
338
  return [4 /*yield*/, instance.config.components[component]()];
339
339
  case 5:
340
- _j = (_k.sent());
341
- _k.label = 6;
340
+ _k = (_l.sent());
341
+ _l.label = 6;
342
342
  case 6:
343
- RecommendationsComponent = _j;
343
+ RecommendationsComponent = _k;
344
344
  if (!RecommendationsComponent) {
345
345
  instance.logger.error("profile '".concat(tag, "' found on the following element is expecting component mapping for '").concat(component, "' - verify instantiator config.\n").concat(elem === null || elem === void 0 ? void 0 : elem.outerHTML));
346
346
  return [2 /*return*/];
@@ -151,7 +151,7 @@ export class RecommendationInstantiator {
151
151
  }
152
152
  async function readyTheController(instance, injectedElem, context, profileCount, elem, controllerGlobals) {
153
153
  const { profile, batchId, cart, tag } = controllerGlobals;
154
- const batched = (profile?.batched || controllerGlobals.batched) ?? true;
154
+ const batched = profile?.batched ?? controllerGlobals.batched ?? true;
155
155
  if (!tag) {
156
156
  // FEEDBACK: change message depending on script integration type (profile vs. legacy)
157
157
  instance.logger.warn(`'tag' is missing from <script> tag, skipping this profile`, elem);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@searchspring/snap-preact",
3
- "version": "0.61.4",
3
+ "version": "0.61.5",
4
4
  "description": "Snap Preact",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -20,17 +20,17 @@
20
20
  "test:watch": "jest --watch"
21
21
  },
22
22
  "dependencies": {
23
- "@searchspring/snap-client": "^0.61.4",
24
- "@searchspring/snap-controller": "^0.61.4",
25
- "@searchspring/snap-event-manager": "^0.61.4",
26
- "@searchspring/snap-logger": "^0.61.4",
27
- "@searchspring/snap-platforms": "^0.61.4",
28
- "@searchspring/snap-preact-components": "^0.61.4",
29
- "@searchspring/snap-profiler": "^0.61.4",
30
- "@searchspring/snap-store-mobx": "^0.61.4",
31
- "@searchspring/snap-toolbox": "^0.61.4",
32
- "@searchspring/snap-tracker": "^0.61.4",
33
- "@searchspring/snap-url-manager": "^0.61.4",
23
+ "@searchspring/snap-client": "^0.61.5",
24
+ "@searchspring/snap-controller": "^0.61.5",
25
+ "@searchspring/snap-event-manager": "^0.61.5",
26
+ "@searchspring/snap-logger": "^0.61.5",
27
+ "@searchspring/snap-platforms": "^0.61.5",
28
+ "@searchspring/snap-preact-components": "^0.61.5",
29
+ "@searchspring/snap-profiler": "^0.61.5",
30
+ "@searchspring/snap-store-mobx": "^0.61.5",
31
+ "@searchspring/snap-toolbox": "^0.61.5",
32
+ "@searchspring/snap-tracker": "^0.61.5",
33
+ "@searchspring/snap-url-manager": "^0.61.5",
34
34
  "deepmerge": "4.3.1",
35
35
  "intersection-observer": "0.12.0",
36
36
  "is-plain-object": "5.0.0"
@@ -43,5 +43,5 @@
43
43
  "files": [
44
44
  "dist/**/*"
45
45
  ],
46
- "gitHead": "13e39b72deb62eb103e39729201de494903969c1"
46
+ "gitHead": "bae1305742558d1736e535d77a76da7b845bc046"
47
47
  }