@searchspring/snap-controller 0.46.0 → 0.48.0
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/dist/cjs/Autocomplete/AutocompleteController.d.ts +1 -1
- package/dist/cjs/Autocomplete/AutocompleteController.d.ts.map +1 -1
- package/dist/cjs/Autocomplete/AutocompleteController.js +20 -14
- package/dist/cjs/Finder/FinderController.d.ts.map +1 -1
- package/dist/cjs/Finder/FinderController.js +2 -11
- package/dist/esm/Autocomplete/AutocompleteController.d.ts +1 -1
- package/dist/esm/Autocomplete/AutocompleteController.d.ts.map +1 -1
- package/dist/esm/Autocomplete/AutocompleteController.js +15 -9
- package/dist/esm/Finder/FinderController.d.ts.map +1 -1
- package/dist/esm/Finder/FinderController.js +2 -4
- package/package.json +10 -10
|
@@ -28,7 +28,7 @@ export declare class AutocompleteController extends AbstractController {
|
|
|
28
28
|
focus: (e: FocusEvent) => void;
|
|
29
29
|
formSubmit: (e: React.FormEvent<HTMLInputElement>) => Promise<void>;
|
|
30
30
|
formElementChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
31
|
-
|
|
31
|
+
input: (e: Event) => void;
|
|
32
32
|
timeoutDelay: NodeJS.Timeout | undefined;
|
|
33
33
|
};
|
|
34
34
|
document: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteController.d.ts","sourceRoot":"","sources":["../../../src/Autocomplete/AutocompleteController.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAA0B,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,4BAA4B,EAAkD,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEnJ,O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AI,IAAI;IASb,QAAQ;;0BAEc,aAAa,KAAG,QAAQ,OAAO,GAAG,SAAS,CAAC;wBAkDpD,aAAa,KAAG,IAAI;uBAMrB,UAAU,KAAG,IAAI;4BAQN,MAAM,SAAS,CAAC,gBAAgB,CAAC,KAAG,QAAQ,IAAI,CAAC;mCAgDhD,MAAM,WAAW,CAAC,gBAAgB,CAAC,KAAG,IAAI;uBAqBtD,KAAK;;;;uBAqDL,UAAU,KAAG,IAAI;;MAS5B;IAEF,MAAM,IAAI,IAAI;IAgBR,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA6E3B,cAAc,QAAa,QAAQ,IAAI,CAAC,CAwBtC;IAEF,MAAM,QAAa,QAAQ,IAAI,CAAC,CAmI9B;CACF"}
|
|
@@ -93,6 +93,7 @@ var defaultConfig = {
|
|
|
93
93
|
},
|
|
94
94
|
redirects: {
|
|
95
95
|
merchandising: true,
|
|
96
|
+
singleResult: true,
|
|
96
97
|
},
|
|
97
98
|
},
|
|
98
99
|
};
|
|
@@ -277,12 +278,9 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
277
278
|
}
|
|
278
279
|
}
|
|
279
280
|
},
|
|
280
|
-
|
|
281
|
+
input: function (e) {
|
|
281
282
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
282
|
-
//
|
|
283
|
-
if ((e === null || e === void 0 ? void 0 : e.keyCode) == KEY_ENTER || (e === null || e === void 0 ? void 0 : e.keyCode) == KEY_ESCAPE)
|
|
284
|
-
return;
|
|
285
|
-
// return focus on keyup if it was lost
|
|
283
|
+
// return focus on input if it was lost
|
|
286
284
|
if (e.isTrusted && _this.store.state.focusedInput !== e.target) {
|
|
287
285
|
_this.setFocused(e.target);
|
|
288
286
|
}
|
|
@@ -580,18 +578,26 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
580
578
|
});
|
|
581
579
|
}); });
|
|
582
580
|
_this.eventManager.on('beforeSubmit', function (ac, next) { return __awaiter(_this, void 0, void 0, function () {
|
|
583
|
-
var redirectURL;
|
|
584
|
-
var _a, _b, _c, _d;
|
|
585
|
-
return __generator(this, function (
|
|
586
|
-
switch (
|
|
581
|
+
var redirectURL, results, singleResultUrl;
|
|
582
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
583
|
+
return __generator(this, function (_j) {
|
|
584
|
+
switch (_j.label) {
|
|
587
585
|
case 0: return [4 /*yield*/, next()];
|
|
588
586
|
case 1:
|
|
589
|
-
|
|
587
|
+
_j.sent();
|
|
590
588
|
redirectURL = (_a = ac.controller.store.merchandising) === null || _a === void 0 ? void 0 : _a.redirect;
|
|
591
589
|
if (redirectURL && ((_d = (_c = (_b = this.config) === null || _b === void 0 ? void 0 : _b.settings) === null || _c === void 0 ? void 0 : _c.redirects) === null || _d === void 0 ? void 0 : _d.merchandising)) {
|
|
592
590
|
window.location.href = redirectURL;
|
|
593
591
|
return [2 /*return*/, false];
|
|
594
592
|
}
|
|
593
|
+
if ((_g = (_f = (_e = this.config) === null || _e === void 0 ? void 0 : _e.settings) === null || _f === void 0 ? void 0 : _f.redirects) === null || _g === void 0 ? void 0 : _g.singleResult) {
|
|
594
|
+
results = ac.controller.store.results;
|
|
595
|
+
singleResultUrl = results.length === 1 && results[0].type === 'product' && ((_h = results[0].mappings.core) === null || _h === void 0 ? void 0 : _h.url);
|
|
596
|
+
if (singleResultUrl) {
|
|
597
|
+
window.location.href = singleResultUrl;
|
|
598
|
+
return [2 /*return*/, false];
|
|
599
|
+
}
|
|
600
|
+
}
|
|
595
601
|
return [2 /*return*/];
|
|
596
602
|
}
|
|
597
603
|
});
|
|
@@ -679,7 +685,7 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
679
685
|
}
|
|
680
686
|
return [3 /*break*/, 7];
|
|
681
687
|
case 7:
|
|
682
|
-
inputElement === null || inputElement === void 0 ? void 0 : inputElement.dispatchEvent(new Event('
|
|
688
|
+
inputElement === null || inputElement === void 0 ? void 0 : inputElement.dispatchEvent(new Event('input'));
|
|
683
689
|
return [2 /*return*/];
|
|
684
690
|
}
|
|
685
691
|
});
|
|
@@ -697,7 +703,7 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
697
703
|
var _this = this;
|
|
698
704
|
var inputs = document.querySelectorAll("input[".concat(INPUT_ATTRIBUTE, "]"));
|
|
699
705
|
inputs === null || inputs === void 0 ? void 0 : inputs.forEach(function (input) {
|
|
700
|
-
input.removeEventListener('
|
|
706
|
+
input.removeEventListener('input', _this.handlers.input.input);
|
|
701
707
|
input.removeEventListener('keydown', _this.handlers.input.enterKey);
|
|
702
708
|
input.removeEventListener('keydown', _this.handlers.input.escKey);
|
|
703
709
|
input.removeEventListener('focus', _this.handlers.input.focus);
|
|
@@ -731,7 +737,7 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
731
737
|
input.setAttribute('autocorrect', 'off');
|
|
732
738
|
input.setAttribute('autocapitalize', 'none');
|
|
733
739
|
input.setAttribute(INPUT_ATTRIBUTE, '');
|
|
734
|
-
input.addEventListener('
|
|
740
|
+
input.addEventListener('input', _this.handlers.input.input);
|
|
735
741
|
if (((_b = (_a = _this.config) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.initializeFromUrl) && !input.value && _this.store.state.input) {
|
|
736
742
|
input.value = _this.store.state.input;
|
|
737
743
|
}
|
|
@@ -764,7 +770,7 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
764
770
|
return __assign(__assign({}, translatorConfig), { urlRoot: formActionUrl });
|
|
765
771
|
}));
|
|
766
772
|
}
|
|
767
|
-
// if the input is currently focused, trigger setFocues which will eventually trigger
|
|
773
|
+
// if the input is currently focused, trigger setFocues which will eventually trigger input - but not if loading
|
|
768
774
|
if (document.activeElement === input && !_this.store.loading) {
|
|
769
775
|
_this.setFocused(input);
|
|
770
776
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FinderController.d.ts","sourceRoot":"","sources":["../../../src/Finder/FinderController.ts"],"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,MAAM,EAAE,GAAG,CAAC,CA+BhC;IAED,IAAI,QAAa,QAAQ,IAAI,CAAC,CAkB5B;IAEF,KAAK,QAAO,IAAI,CAId;IAEF,MAAM,QAAa,QAAQ,IAAI,CAAC,CAkI9B;CACF"}
|
|
@@ -106,6 +106,8 @@ var FinderController = /** @class */ (function (_super) {
|
|
|
106
106
|
})];
|
|
107
107
|
case 3:
|
|
108
108
|
_a.sent();
|
|
109
|
+
// redirect to configured URL after middleware completes
|
|
110
|
+
window.location.href = this.urlManager.href;
|
|
109
111
|
return [3 /*break*/, 5];
|
|
110
112
|
case 4:
|
|
111
113
|
err_1 = _a.sent();
|
|
@@ -315,17 +317,6 @@ var FinderController = /** @class */ (function (_super) {
|
|
|
315
317
|
}
|
|
316
318
|
});
|
|
317
319
|
}); });
|
|
318
|
-
_this.eventManager.on('beforeFind', function (finder, next) { return __awaiter(_this, void 0, void 0, function () {
|
|
319
|
-
return __generator(this, function (_a) {
|
|
320
|
-
switch (_a.label) {
|
|
321
|
-
case 0: return [4 /*yield*/, next()];
|
|
322
|
-
case 1:
|
|
323
|
-
_a.sent();
|
|
324
|
-
window.location.href = this.urlManager.href;
|
|
325
|
-
return [2 /*return*/];
|
|
326
|
-
}
|
|
327
|
-
});
|
|
328
|
-
}); });
|
|
329
320
|
// attach config plugins and event middleware
|
|
330
321
|
_this.use(_this.config);
|
|
331
322
|
_this.store.loadPersisted();
|
|
@@ -28,7 +28,7 @@ export declare class AutocompleteController extends AbstractController {
|
|
|
28
28
|
focus: (e: FocusEvent) => void;
|
|
29
29
|
formSubmit: (e: React.FormEvent<HTMLInputElement>) => Promise<void>;
|
|
30
30
|
formElementChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
31
|
-
|
|
31
|
+
input: (e: Event) => void;
|
|
32
32
|
timeoutDelay: NodeJS.Timeout | undefined;
|
|
33
33
|
};
|
|
34
34
|
document: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteController.d.ts","sourceRoot":"","sources":["../../../src/Autocomplete/AutocompleteController.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAA0B,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,4BAA4B,EAAkD,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEnJ,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAG1E,eAAO,MAAM,WAAW,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"AutocompleteController.d.ts","sourceRoot":"","sources":["../../../src/Autocomplete/AutocompleteController.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAA0B,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,4BAA4B,EAAkD,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEnJ,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAG1E,eAAO,MAAM,WAAW,MAAM,CAAC;AA2B/B,aAAK,wBAAwB,GAAG;IAC/B,OAAO,EAAE;QACR,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;KAC5C,CAAC;CACF,CAAC;AAEF,qBAAa,sBAAuB,SAAQ,kBAAkB;IACtD,IAAI,kBAAgC;IACnC,KAAK,EAAE,iBAAiB,CAAC;IACzB,MAAM,EAAE,4BAA4B,CAAC;IACtC,OAAO,EAAE,YAAY,CAAC;gBAG5B,MAAM,EAAE,4BAA4B,EACpC,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,kBAAkB,EAC1F,OAAO,CAAC,EAAE,gBAAgB;IAsE3B,KAAK,EAAE,wBAAwB,CAO7B;IAEF,IAAI,MAAM,IAAI,wBAAwB,CA0CrC;IAEK,UAAU,CAAC,YAAY,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BhE,KAAK,IAAI,IAAI;IASb,QAAQ;;0BAEc,aAAa,KAAG,QAAQ,OAAO,GAAG,SAAS,CAAC;wBAkDpD,aAAa,KAAG,IAAI;uBAMrB,UAAU,KAAG,IAAI;4BAQN,MAAM,SAAS,CAAC,gBAAgB,CAAC,KAAG,QAAQ,IAAI,CAAC;mCAgDhD,MAAM,WAAW,CAAC,gBAAgB,CAAC,KAAG,IAAI;uBAqBtD,KAAK;;;;uBAqDL,UAAU,KAAG,IAAI;;MAS5B;IAEF,MAAM,IAAI,IAAI;IAgBR,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA6E3B,cAAc,QAAa,QAAQ,IAAI,CAAC,CAwBtC;IAEF,MAAM,QAAa,QAAQ,IAAI,CAAC,CAmI9B;CACF"}
|
|
@@ -25,6 +25,7 @@ const defaultConfig = {
|
|
|
25
25
|
},
|
|
26
26
|
redirects: {
|
|
27
27
|
merchandising: true,
|
|
28
|
+
singleResult: true,
|
|
28
29
|
},
|
|
29
30
|
},
|
|
30
31
|
};
|
|
@@ -164,11 +165,8 @@ export class AutocompleteController extends AbstractController {
|
|
|
164
165
|
}
|
|
165
166
|
}
|
|
166
167
|
},
|
|
167
|
-
|
|
168
|
-
//
|
|
169
|
-
if (e?.keyCode == KEY_ENTER || e?.keyCode == KEY_ESCAPE)
|
|
170
|
-
return;
|
|
171
|
-
// return focus on keyup if it was lost
|
|
168
|
+
input: (e) => {
|
|
169
|
+
// return focus on input if it was lost
|
|
172
170
|
if (e.isTrusted && this.store.state.focusedInput !== e.target) {
|
|
173
171
|
this.setFocused(e.target);
|
|
174
172
|
}
|
|
@@ -410,6 +408,14 @@ export class AutocompleteController extends AbstractController {
|
|
|
410
408
|
window.location.href = redirectURL;
|
|
411
409
|
return false;
|
|
412
410
|
}
|
|
411
|
+
if (this.config?.settings?.redirects?.singleResult) {
|
|
412
|
+
const { results } = ac.controller.store;
|
|
413
|
+
const singleResultUrl = results.length === 1 && results[0].type === 'product' && results[0].mappings.core?.url;
|
|
414
|
+
if (singleResultUrl) {
|
|
415
|
+
window.location.href = singleResultUrl;
|
|
416
|
+
return false;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
413
419
|
});
|
|
414
420
|
// attach config plugins and event middleware
|
|
415
421
|
this.use(this.config);
|
|
@@ -476,7 +482,7 @@ export class AutocompleteController extends AbstractController {
|
|
|
476
482
|
}
|
|
477
483
|
}
|
|
478
484
|
}
|
|
479
|
-
inputElement?.dispatchEvent(new Event('
|
|
485
|
+
inputElement?.dispatchEvent(new Event('input'));
|
|
480
486
|
}
|
|
481
487
|
reset() {
|
|
482
488
|
// reset input values and state
|
|
@@ -489,7 +495,7 @@ export class AutocompleteController extends AbstractController {
|
|
|
489
495
|
unbind() {
|
|
490
496
|
const inputs = document.querySelectorAll(`input[${INPUT_ATTRIBUTE}]`);
|
|
491
497
|
inputs?.forEach((input) => {
|
|
492
|
-
input.removeEventListener('
|
|
498
|
+
input.removeEventListener('input', this.handlers.input.input);
|
|
493
499
|
input.removeEventListener('keydown', this.handlers.input.enterKey);
|
|
494
500
|
input.removeEventListener('keydown', this.handlers.input.escKey);
|
|
495
501
|
input.removeEventListener('focus', this.handlers.input.focus);
|
|
@@ -512,7 +518,7 @@ export class AutocompleteController extends AbstractController {
|
|
|
512
518
|
input.setAttribute('autocorrect', 'off');
|
|
513
519
|
input.setAttribute('autocapitalize', 'none');
|
|
514
520
|
input.setAttribute(INPUT_ATTRIBUTE, '');
|
|
515
|
-
input.addEventListener('
|
|
521
|
+
input.addEventListener('input', this.handlers.input.input);
|
|
516
522
|
if (this.config?.settings?.initializeFromUrl && !input.value && this.store.state.input) {
|
|
517
523
|
input.value = this.store.state.input;
|
|
518
524
|
}
|
|
@@ -548,7 +554,7 @@ export class AutocompleteController extends AbstractController {
|
|
|
548
554
|
};
|
|
549
555
|
}));
|
|
550
556
|
}
|
|
551
|
-
// if the input is currently focused, trigger setFocues which will eventually trigger
|
|
557
|
+
// if the input is currently focused, trigger setFocues which will eventually trigger input - but not if loading
|
|
552
558
|
if (document.activeElement === input && !this.store.loading) {
|
|
553
559
|
this.setFocused(input);
|
|
554
560
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FinderController.d.ts","sourceRoot":"","sources":["../../../src/Finder/FinderController.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,KAAK,EAAE,sBAAsB,EAAmC,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAiB9H,qBAAa,gBAAiB,SAAQ,kBAAkB;IAChD,IAAI,kBAA0B;IAC7B,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,sBAAsB,CAAC;gBAGtC,MAAM,EAAE,sBAAsB,EAC9B,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,kBAAkB,EAC1F,OAAO,CAAC,EAAE,gBAAgB;
|
|
1
|
+
{"version":3,"file":"FinderController.d.ts","sourceRoot":"","sources":["../../../src/Finder/FinderController.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,KAAK,EAAE,sBAAsB,EAAmC,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAiB9H,qBAAa,gBAAiB,SAAQ,kBAAkB;IAChD,IAAI,kBAA0B;IAC7B,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,sBAAsB,CAAC;gBAGtC,MAAM,EAAE,sBAAsB,EAC9B,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,kBAAkB,EAC1F,OAAO,CAAC,EAAE,gBAAgB;IAqC3B,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CA+BhC;IAED,IAAI,QAAa,QAAQ,IAAI,CAAC,CAkB5B;IAEF,KAAK,QAAO,IAAI,CAId;IAEF,MAAM,QAAa,QAAQ,IAAI,CAAC,CAkI9B;CACF"}
|
|
@@ -27,6 +27,8 @@ export class FinderController extends AbstractController {
|
|
|
27
27
|
await this.eventManager.fire('beforeFind', {
|
|
28
28
|
controller: this,
|
|
29
29
|
});
|
|
30
|
+
// redirect to configured URL after middleware completes
|
|
31
|
+
window.location.href = this.urlManager.href;
|
|
30
32
|
}
|
|
31
33
|
catch (err) {
|
|
32
34
|
if (err?.message == 'cancelled') {
|
|
@@ -187,10 +189,6 @@ export class FinderController extends AbstractController {
|
|
|
187
189
|
await next();
|
|
188
190
|
finder.controller.store.loading = false;
|
|
189
191
|
});
|
|
190
|
-
this.eventManager.on('beforeFind', async (finder, next) => {
|
|
191
|
-
await next();
|
|
192
|
-
window.location.href = this.urlManager.href;
|
|
193
|
-
});
|
|
194
192
|
// attach config plugins and event middleware
|
|
195
193
|
this.use(this.config);
|
|
196
194
|
this.store.loadPersisted();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@searchspring/snap-controller",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"description": "Snap Controllers",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -20,22 +20,22 @@
|
|
|
20
20
|
"test:watch": "jest --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@searchspring/snap-toolbox": "^0.
|
|
23
|
+
"@searchspring/snap-toolbox": "^0.48.0",
|
|
24
24
|
"css.escape": "1.5.1",
|
|
25
25
|
"deepmerge": "4.3.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@searchspring/snap-client": "^0.
|
|
29
|
-
"@searchspring/snap-event-manager": "^0.
|
|
30
|
-
"@searchspring/snap-logger": "^0.
|
|
31
|
-
"@searchspring/snap-profiler": "^0.
|
|
32
|
-
"@searchspring/snap-store-mobx": "^0.
|
|
33
|
-
"@searchspring/snap-tracker": "^0.
|
|
34
|
-
"@searchspring/snap-url-manager": "^0.
|
|
28
|
+
"@searchspring/snap-client": "^0.48.0",
|
|
29
|
+
"@searchspring/snap-event-manager": "^0.48.0",
|
|
30
|
+
"@searchspring/snap-logger": "^0.48.0",
|
|
31
|
+
"@searchspring/snap-profiler": "^0.48.0",
|
|
32
|
+
"@searchspring/snap-store-mobx": "^0.48.0",
|
|
33
|
+
"@searchspring/snap-tracker": "^0.48.0",
|
|
34
|
+
"@searchspring/snap-url-manager": "^0.48.0"
|
|
35
35
|
},
|
|
36
36
|
"sideEffects": false,
|
|
37
37
|
"files": [
|
|
38
38
|
"dist/**/*"
|
|
39
39
|
],
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "d6b208d3109772af36cefc76ad584b8f90a817fd"
|
|
41
41
|
}
|