@athoscommerce/snap-store-mobx 1.2.3-beta.3 → 1.2.3-beta.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.
- package/dist/cjs/Autocomplete/AutocompleteStore.d.ts +1 -1
- package/dist/cjs/Autocomplete/AutocompleteStore.d.ts.map +1 -1
- package/dist/cjs/Autocomplete/AutocompleteStore.js +8 -5
- package/dist/cjs/Autocomplete/Stores/AutocompleteFacetStore.js +2 -1
- package/dist/cjs/Chat/ChatStore.d.ts +36 -5
- package/dist/cjs/Chat/ChatStore.d.ts.map +1 -1
- package/dist/cjs/Chat/ChatStore.js +214 -54
- package/dist/cjs/Chat/Stores/ChatAttachmentStore.d.ts.map +1 -1
- package/dist/cjs/Chat/Stores/ChatAttachmentStore.js +4 -2
- package/dist/cjs/Chat/Stores/ChatCompareStore.d.ts +2 -0
- package/dist/cjs/Chat/Stores/ChatCompareStore.d.ts.map +1 -1
- package/dist/cjs/Chat/Stores/ChatCompareStore.js +4 -2
- package/dist/cjs/Chat/Stores/ChatSessionStore.d.ts +10 -7
- package/dist/cjs/Chat/Stores/ChatSessionStore.d.ts.map +1 -1
- package/dist/cjs/Chat/Stores/ChatSessionStore.js +34 -23
- package/dist/cjs/Finder/FinderStore.d.ts +1 -1
- package/dist/cjs/Finder/FinderStore.d.ts.map +1 -1
- package/dist/cjs/Finder/FinderStore.js +3 -3
- package/dist/cjs/Finder/Stores/FinderSelectionStore.d.ts +1 -1
- package/dist/cjs/Finder/Stores/FinderSelectionStore.d.ts.map +1 -1
- package/dist/cjs/ProductQuickView/ProductQuickViewStore.d.ts +21 -0
- package/dist/cjs/ProductQuickView/ProductQuickViewStore.d.ts.map +1 -0
- package/dist/cjs/ProductQuickView/ProductQuickViewStore.js +69 -0
- package/dist/cjs/ProductQuickView/cloneProductForQuickView.d.ts +7 -0
- package/dist/cjs/ProductQuickView/cloneProductForQuickView.d.ts.map +1 -0
- package/dist/cjs/ProductQuickView/cloneProductForQuickView.js +23 -0
- package/dist/cjs/Recommendation/RecommendationStore.d.ts +2 -0
- package/dist/cjs/Recommendation/RecommendationStore.d.ts.map +1 -1
- package/dist/cjs/Recommendation/RecommendationStore.js +3 -0
- package/dist/cjs/Recommendation/Stores/RecommendationProfileStore.js +1 -1
- package/dist/cjs/Search/SearchStore.d.ts +1 -1
- package/dist/cjs/Search/SearchStore.d.ts.map +1 -1
- package/dist/cjs/Search/SearchStore.js +2 -2
- package/dist/cjs/Search/Stores/SearchFacetStore.d.ts +1 -1
- package/dist/cjs/Search/Stores/SearchFacetStore.d.ts.map +1 -1
- package/dist/cjs/Search/Stores/SearchFacetStore.js +13 -10
- package/dist/cjs/Search/Stores/SearchHistoryStore.js +2 -2
- package/dist/cjs/index.d.ts +4 -2
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +8 -4
- package/dist/cjs/types.d.ts +8 -2
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/Autocomplete/AutocompleteStore.d.ts +1 -1
- package/dist/esm/Autocomplete/AutocompleteStore.d.ts.map +1 -1
- package/dist/esm/Autocomplete/AutocompleteStore.js +5 -3
- package/dist/esm/Autocomplete/Stores/AutocompleteFacetStore.js +1 -1
- package/dist/esm/Chat/ChatStore.d.ts +36 -5
- package/dist/esm/Chat/ChatStore.d.ts.map +1 -1
- package/dist/esm/Chat/ChatStore.js +201 -43
- package/dist/esm/Chat/Stores/ChatAttachmentStore.d.ts.map +1 -1
- package/dist/esm/Chat/Stores/ChatAttachmentStore.js +4 -2
- package/dist/esm/Chat/Stores/ChatCompareStore.d.ts +2 -0
- package/dist/esm/Chat/Stores/ChatCompareStore.d.ts.map +1 -1
- package/dist/esm/Chat/Stores/ChatCompareStore.js +3 -1
- package/dist/esm/Chat/Stores/ChatSessionStore.d.ts +10 -7
- package/dist/esm/Chat/Stores/ChatSessionStore.d.ts.map +1 -1
- package/dist/esm/Chat/Stores/ChatSessionStore.js +26 -18
- package/dist/esm/Finder/FinderStore.d.ts +1 -1
- package/dist/esm/Finder/FinderStore.d.ts.map +1 -1
- package/dist/esm/Finder/FinderStore.js +1 -1
- package/dist/esm/Finder/Stores/FinderSelectionStore.d.ts +1 -1
- package/dist/esm/Finder/Stores/FinderSelectionStore.d.ts.map +1 -1
- package/dist/esm/ProductQuickView/ProductQuickViewStore.d.ts +21 -0
- package/dist/esm/ProductQuickView/ProductQuickViewStore.d.ts.map +1 -0
- package/dist/esm/ProductQuickView/ProductQuickViewStore.js +56 -0
- package/dist/esm/ProductQuickView/cloneProductForQuickView.d.ts +7 -0
- package/dist/esm/ProductQuickView/cloneProductForQuickView.d.ts.map +1 -0
- package/dist/esm/ProductQuickView/cloneProductForQuickView.js +19 -0
- package/dist/esm/Recommendation/RecommendationStore.d.ts +2 -0
- package/dist/esm/Recommendation/RecommendationStore.d.ts.map +1 -1
- package/dist/esm/Recommendation/RecommendationStore.js +3 -0
- package/dist/esm/Recommendation/Stores/RecommendationProfileStore.js +1 -1
- package/dist/esm/Search/SearchStore.d.ts +1 -1
- package/dist/esm/Search/SearchStore.d.ts.map +1 -1
- package/dist/esm/Search/SearchStore.js +1 -1
- package/dist/esm/Search/Stores/SearchFacetStore.d.ts +1 -1
- package/dist/esm/Search/Stores/SearchFacetStore.d.ts.map +1 -1
- package/dist/esm/Search/Stores/SearchFacetStore.js +13 -10
- package/dist/esm/Search/Stores/SearchHistoryStore.js +1 -1
- package/dist/esm/index.d.ts +4 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +3 -1
- package/dist/esm/types.d.ts +8 -2
- package/dist/esm/types.d.ts.map +1 -1
- package/package.json +11 -6
- package/dist/cjs/Storage/StorageStore.d.ts +0 -27
- package/dist/cjs/Storage/StorageStore.d.ts.map +0 -1
- package/dist/cjs/Storage/StorageStore.js +0 -176
- package/dist/esm/Storage/StorageStore.d.ts +0 -27
- package/dist/esm/Storage/StorageStore.d.ts.map +0 -1
- package/dist/esm/Storage/StorageStore.js +0 -169
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChatResponseModel, ChatRequestModel, ChatResponseTextData, ChatResponseProductSearchResultData, ChatResponseInspirationResultData, ChatResponseContentData, ChatResponseProductAnswerData, ChatResponseProductComparisonData, ChatResponseProductRecommendationData, ChatResponseErrorData, ChatResponseTopicDriftData } from '@athoscommerce/snap-client';
|
|
2
2
|
import { ChatAttachmentAddAttachment, ChatAttachmentStore } from '../Stores/ChatAttachmentStore';
|
|
3
|
-
import type { StorageStore } from '
|
|
3
|
+
import type { StorageStore } from '@athoscommerce/snap-toolbox';
|
|
4
4
|
import { MetaResponseModel } from '@athoscommerce/snapi-types';
|
|
5
5
|
import { ChatCompareStore } from './ChatCompareStore';
|
|
6
6
|
export type ChatFeedbacks = {
|
|
@@ -37,21 +37,23 @@ type ChatSessionStoreConfig = {
|
|
|
37
37
|
sessionFeedback?: ChatSessionFeedback | null;
|
|
38
38
|
feedbackDismissed?: boolean;
|
|
39
39
|
createdAt?: Date;
|
|
40
|
+
sessionEndTime?: Date;
|
|
40
41
|
committedComparisons?: any[];
|
|
41
42
|
};
|
|
42
43
|
stores: {
|
|
43
44
|
storage: StorageStore;
|
|
44
45
|
};
|
|
45
46
|
};
|
|
46
|
-
export type FacetsData = {
|
|
47
|
-
type: 'facets';
|
|
48
|
-
data: any;
|
|
49
|
-
};
|
|
50
47
|
export type ActionsData = {
|
|
51
48
|
type: 'actions';
|
|
52
49
|
data: any;
|
|
53
50
|
};
|
|
54
|
-
export type ChatActions =
|
|
51
|
+
export type ChatActions = ActionsData[];
|
|
52
|
+
/** Snapshot of facet labels keyed by field — used to render the user message text for a productSearch request. */
|
|
53
|
+
export type FilterLabelMap = Record<string, {
|
|
54
|
+
facetLabel: string;
|
|
55
|
+
values: Record<string, string>;
|
|
56
|
+
}>;
|
|
55
57
|
export declare class ChatSessionStore {
|
|
56
58
|
chat: ChatMessage[];
|
|
57
59
|
actions: ChatActions;
|
|
@@ -65,6 +67,7 @@ export declare class ChatSessionStore {
|
|
|
65
67
|
feedbackDismissed: boolean;
|
|
66
68
|
feedbackJustGiven: boolean;
|
|
67
69
|
createdAt: Date;
|
|
70
|
+
sessionEndTime?: Date;
|
|
68
71
|
requestType: string;
|
|
69
72
|
dismissedSideChatMessageId: string | null;
|
|
70
73
|
activeMessageId: string | null;
|
|
@@ -94,7 +97,7 @@ export declare class ChatSessionStore {
|
|
|
94
97
|
static pruneStoredSessions(storage: StorageStore, maxSessions?: number): void;
|
|
95
98
|
/** Re-wrap raw stored results as Product / SearchResultStore instances. */
|
|
96
99
|
hydrateResults(meta: MetaResponseModel): void;
|
|
97
|
-
request(request: ChatRequestModel): void;
|
|
100
|
+
request(request: ChatRequestModel, filterLabels?: FilterLabelMap): void;
|
|
98
101
|
update(data: {
|
|
99
102
|
chat: ChatResponseModel;
|
|
100
103
|
meta: MetaResponseModel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatSessionStore.d.ts","sourceRoot":"","sources":["../../../../src/Chat/Stores/ChatSessionStore.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,mCAAmC,EACnC,iCAAiC,EACjC,uBAAuB,EACvB,6BAA6B,EAC7B,iCAAiC,EACjC,qCAAqC,EACrC,qBAAqB,EACrB,0BAA0B,EAC1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,2BAA2B,EAI3B,mBAAmB,EACnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ChatSessionStore.d.ts","sourceRoot":"","sources":["../../../../src/Chat/Stores/ChatSessionStore.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,mCAAmC,EACnC,iCAAiC,EACjC,uBAAuB,EACvB,6BAA6B,EAC7B,iCAAiC,EACjC,qCAAqC,EACrC,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7 @@ function createChatProduct(result, meta) {
|
|
|
37
37
|
}
|
|
38
38
|
/** Extract raw serializable data from a Product instance for storage. */
|
|
39
39
|
function serializeProduct(product) {
|
|
40
|
+
var _a, _b;
|
|
40
41
|
if (!(product instanceof SearchResultStore_1.Product))
|
|
41
42
|
return product;
|
|
42
43
|
var raw = {
|
|
@@ -44,6 +45,7 @@ function serializeProduct(product) {
|
|
|
44
45
|
responseId: product.responseId,
|
|
45
46
|
mappings: product.mappings,
|
|
46
47
|
attributes: product.attributes,
|
|
48
|
+
badges: ((_b = (_a = product.badges) === null || _a === void 0 ? void 0 : _a.all) === null || _b === void 0 ? void 0 : _b.map(function (b) { return ({ tag: b.tag }); })) || [],
|
|
47
49
|
};
|
|
48
50
|
if (product.variants) {
|
|
49
51
|
raw.variants = {
|
|
@@ -150,20 +152,21 @@ var ChatSessionStore = /** @class */ (function () {
|
|
|
150
152
|
/** Whether raw stored results have been hydrated into Product/SearchResultStore instances. */
|
|
151
153
|
this.hydrated = true;
|
|
152
154
|
this.saveTimerId = null;
|
|
153
|
-
var _a = params.data || {}, id = _a.id, sessionId = _a.sessionId, chat = _a.chat, attachments = _a.attachments, actions = _a.actions, feedbacks = _a.feedbacks, sessionFeedback = _a.sessionFeedback, feedbackDismissed = _a.feedbackDismissed, createdAt = _a.createdAt, committedComparisons = _a.committedComparisons;
|
|
155
|
+
var _a = params.data || {}, id = _a.id, sessionId = _a.sessionId, chat = _a.chat, attachments = _a.attachments, actions = _a.actions, feedbacks = _a.feedbacks, sessionFeedback = _a.sessionFeedback, feedbackDismissed = _a.feedbackDismissed, createdAt = _a.createdAt, sessionEndTime = _a.sessionEndTime, committedComparisons = _a.committedComparisons;
|
|
154
156
|
var stores = params.stores;
|
|
155
157
|
this.id = id || (0, uuid_1.v4)();
|
|
156
158
|
this.sessionId = sessionId;
|
|
157
159
|
this.storage = stores.storage;
|
|
158
160
|
this.actions = actions || [];
|
|
159
161
|
this.createdAt = createdAt ? new Date(createdAt) : new Date();
|
|
162
|
+
this.sessionEndTime = sessionEndTime ? new Date(sessionEndTime) : undefined;
|
|
160
163
|
this.feedbacks = feedbacks || [];
|
|
161
164
|
this.sessionFeedback = sessionFeedback || null;
|
|
162
165
|
this.feedbackDismissed = feedbackDismissed || false;
|
|
163
166
|
// if chat and attachments are passed, load them
|
|
164
167
|
if (chat && chat.length > 0) {
|
|
165
168
|
// productQuery messages only exist to drive the side-chat panel for an
|
|
166
|
-
// in-flight
|
|
169
|
+
// in-flight productQuery click; they must not be rehydrated on reload
|
|
167
170
|
// or the side chat would re-open without the matching primary-chat state
|
|
168
171
|
this.chat = chat.filter(function (message) { return message.messageType !== 'productQuery'; });
|
|
169
172
|
}
|
|
@@ -231,7 +234,7 @@ var ChatSessionStore = /** @class */ (function () {
|
|
|
231
234
|
// capture the side-chat message that was active at click time so a back action
|
|
232
235
|
// can restore it even when it's not the last message in the chat
|
|
233
236
|
var sourceMessageId = (_a = this.activeMessage) === null || _a === void 0 ? void 0 : _a.id;
|
|
234
|
-
// drop any trailing productQuery so a fresh
|
|
237
|
+
// drop any trailing productQuery so a fresh productQuery click replaces
|
|
235
238
|
// the side-chat target rather than stacking up
|
|
236
239
|
while (this.chat.length > 0 && ((_b = this.chat[this.chat.length - 1]) === null || _b === void 0 ? void 0 : _b.messageType) === 'productQuery') {
|
|
237
240
|
this.chat.pop();
|
|
@@ -257,10 +260,13 @@ var ChatSessionStore = /** @class */ (function () {
|
|
|
257
260
|
};
|
|
258
261
|
Object.defineProperty(ChatSessionStore.prototype, "isExpired", {
|
|
259
262
|
get: function () {
|
|
263
|
+
// Prefer the server-provided end time (returned by chatInit); fall back to a
|
|
264
|
+
// 24-hour window from createdAt for sessions persisted before that field existed.
|
|
265
|
+
if (this.sessionEndTime) {
|
|
266
|
+
return Date.now() > this.sessionEndTime.getTime();
|
|
267
|
+
}
|
|
260
268
|
var ONE_DAY = 24 * 60 * 60 * 1000;
|
|
261
|
-
|
|
262
|
-
var diff = now.getTime() - this.createdAt.getTime();
|
|
263
|
-
return diff > ONE_DAY;
|
|
269
|
+
return Date.now() - this.createdAt.getTime() > ONE_DAY;
|
|
264
270
|
},
|
|
265
271
|
enumerable: false,
|
|
266
272
|
configurable: true
|
|
@@ -356,6 +362,7 @@ var ChatSessionStore = /** @class */ (function () {
|
|
|
356
362
|
sessionFeedback: this.sessionFeedback,
|
|
357
363
|
feedbackDismissed: this.feedbackDismissed,
|
|
358
364
|
createdAt: this.createdAt,
|
|
365
|
+
sessionEndTime: this.sessionEndTime,
|
|
359
366
|
committedComparisons: this.comparisons.committedItems,
|
|
360
367
|
});
|
|
361
368
|
};
|
|
@@ -436,7 +443,7 @@ var ChatSessionStore = /** @class */ (function () {
|
|
|
436
443
|
}
|
|
437
444
|
});
|
|
438
445
|
};
|
|
439
|
-
ChatSessionStore.prototype.request = function (request) {
|
|
446
|
+
ChatSessionStore.prototype.request = function (request, filterLabels) {
|
|
440
447
|
var _this = this;
|
|
441
448
|
var _a, _b;
|
|
442
449
|
// clear the questions on new request
|
|
@@ -452,11 +459,21 @@ var ChatSessionStore = /** @class */ (function () {
|
|
|
452
459
|
if (searchFilters && searchFilters.length > 0) {
|
|
453
460
|
var filterTextArray_1 = [];
|
|
454
461
|
searchFilters.forEach(function (filter) {
|
|
455
|
-
var
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
462
|
+
var _a;
|
|
463
|
+
var labelEntry = filterLabels === null || filterLabels === void 0 ? void 0 : filterLabels[filter.key];
|
|
464
|
+
(_a = filter.options) === null || _a === void 0 ? void 0 : _a.forEach(function (option) {
|
|
465
|
+
var _a, _b;
|
|
466
|
+
var facetLabel = (labelEntry === null || labelEntry === void 0 ? void 0 : labelEntry.facetLabel) || filter.key;
|
|
467
|
+
if ('low' in option || 'high' in option) {
|
|
468
|
+
var low = (_a = option.low) !== null && _a !== void 0 ? _a : '*';
|
|
469
|
+
var high = (_b = option.high) !== null && _b !== void 0 ? _b : '*';
|
|
470
|
+
filterTextArray_1.push("".concat(facetLabel, " ").concat(low, "-").concat(high));
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
var key = option.key;
|
|
474
|
+
var optionLabel = (labelEntry === null || labelEntry === void 0 ? void 0 : labelEntry.values[key]) || key;
|
|
475
|
+
filterTextArray_1.push("".concat(facetLabel, " ").concat(optionLabel));
|
|
476
|
+
}
|
|
460
477
|
});
|
|
461
478
|
});
|
|
462
479
|
this.chat.push({
|
|
@@ -575,7 +592,7 @@ var ChatSessionStore = /** @class */ (function () {
|
|
|
575
592
|
this.sessionId = data.chat.context.sessionId;
|
|
576
593
|
var meta = data.meta;
|
|
577
594
|
data.chat.data.forEach(function (messageData) {
|
|
578
|
-
var _a, _b, _c, _d
|
|
595
|
+
var _a, _b, _c, _d;
|
|
579
596
|
// check if the data has questions?
|
|
580
597
|
if (messageData.messageType === 'actions') {
|
|
581
598
|
_this.actions.push({
|
|
@@ -584,18 +601,12 @@ var ChatSessionStore = /** @class */ (function () {
|
|
|
584
601
|
});
|
|
585
602
|
return;
|
|
586
603
|
}
|
|
587
|
-
if (messageData.messageType === 'productSearchResult' && ((_a = messageData.facets) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
588
|
-
_this.actions.push({
|
|
589
|
-
type: 'facets',
|
|
590
|
-
data: messageData.facets,
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
604
|
// convert raw results to Product instances (via SearchResultStore) so
|
|
594
605
|
// display components can use result.display for mask-aware rendering
|
|
595
|
-
if (messageData.messageType === 'productSearchResult' && ((
|
|
606
|
+
if (messageData.messageType === 'productSearchResult' && ((_a = messageData.results) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
596
607
|
messageData.results = createChatResultStore(messageData.results, meta);
|
|
597
608
|
}
|
|
598
|
-
else if (messageData.messageType === 'inspirationResult' && ((
|
|
609
|
+
else if (messageData.messageType === 'inspirationResult' && ((_b = messageData.inspirationSections) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
599
610
|
messageData.inspirationSections = messageData.inspirationSections.map(function (section) {
|
|
600
611
|
var _a;
|
|
601
612
|
return (__assign(__assign({}, section), { products: ((_a = section.products) === null || _a === void 0 ? void 0 : _a.length)
|
|
@@ -606,10 +617,10 @@ var ChatSessionStore = /** @class */ (function () {
|
|
|
606
617
|
else if (messageData.messageType === 'productAnswer' && messageData.sourceProduct) {
|
|
607
618
|
messageData.sourceProduct = createChatProduct(messageData.sourceProduct, meta);
|
|
608
619
|
}
|
|
609
|
-
else if (messageData.messageType === 'productComparison' && ((
|
|
620
|
+
else if (messageData.messageType === 'productComparison' && ((_c = messageData.searchResults) === null || _c === void 0 ? void 0 : _c.length)) {
|
|
610
621
|
messageData.searchResults = createChatResultStore(messageData.searchResults, meta);
|
|
611
622
|
}
|
|
612
|
-
else if (messageData.messageType === 'productRecommendation' && ((
|
|
623
|
+
else if (messageData.messageType === 'productRecommendation' && ((_d = messageData.recommendationResult) === null || _d === void 0 ? void 0 : _d.length)) {
|
|
613
624
|
messageData.recommendationResult = messageData.recommendationResult.map(function (rec) {
|
|
614
625
|
var _a;
|
|
615
626
|
return (__assign(__assign({}, rec), { results: ((_a = rec.results) === null || _a === void 0 ? void 0 : _a.length) ? createChatResultStore(rec.results, meta) : rec.results }));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SearchResponseModel, MetaResponseModel } from '@athoscommerce/snapi-types';
|
|
2
|
+
import { StorageStore } from '@athoscommerce/snap-toolbox';
|
|
2
3
|
import { AbstractStore } from '../Abstract/AbstractStore';
|
|
3
4
|
import { SearchPaginationStore } from '../Search/Stores';
|
|
4
|
-
import { StorageStore } from '../Storage/StorageStore';
|
|
5
5
|
import { FinderSelectionStore } from './Stores';
|
|
6
6
|
import type { FinderStoreConfig, StoreServices, SelectedSelection } from '../types';
|
|
7
7
|
import { UrlManager } from '@athoscommerce/snap-url-manager';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FinderStore.d.ts","sourceRoot":"","sources":["../../../src/Fin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,CAAC,EAAE,iBAAiB,CAAC;QAAC,MAAM,CAAC,EAAE,mBAAmB,CAAA;KAAE,EAAE,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,GAAG,IAAI;CAsDhI"}
|
|
@@ -28,9 +28,9 @@ var __assign = (this && this.__assign) || function () {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.FinderStore = void 0;
|
|
30
30
|
var mobx_1 = require("mobx");
|
|
31
|
+
var snap_toolbox_1 = require("@athoscommerce/snap-toolbox");
|
|
31
32
|
var AbstractStore_1 = require("../Abstract/AbstractStore");
|
|
32
33
|
var Stores_1 = require("../Search/Stores");
|
|
33
|
-
var StorageStore_1 = require("../Storage/StorageStore");
|
|
34
34
|
var Stores_2 = require("./Stores");
|
|
35
35
|
var MetaStore_1 = require("../Meta/MetaStore");
|
|
36
36
|
var FinderStore = /** @class */ (function (_super) {
|
|
@@ -59,12 +59,12 @@ var FinderStore = /** @class */ (function (_super) {
|
|
|
59
59
|
}
|
|
60
60
|
_this.services = services;
|
|
61
61
|
if ((_b = _this.config.persist) === null || _b === void 0 ? void 0 : _b.enabled) {
|
|
62
|
-
_this.persistedStorage = new
|
|
62
|
+
_this.persistedStorage = new snap_toolbox_1.StorageStore({
|
|
63
63
|
type: 'local',
|
|
64
64
|
key: "athos-".concat(_this.config.id, "-persisted"),
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
_this.storage = new
|
|
67
|
+
_this.storage = new snap_toolbox_1.StorageStore();
|
|
68
68
|
_this.update();
|
|
69
69
|
(0, mobx_1.makeObservable)(_this, {
|
|
70
70
|
selections: mobx_1.observable,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FinderStoreConfig, FinderFieldConfig, StoreServices, SelectedSelection } from '../../types';
|
|
2
|
-
import type { StorageStore } from '
|
|
2
|
+
import type { StorageStore } from '@athoscommerce/snap-toolbox';
|
|
3
3
|
import type { MetaResponseModel, MetaResponseModelFacetGrid, MetaResponseModelFacetHierarchy, MetaResponseModelFacetList, MetaResponseModelFacetPalette, MetaResponseModelFacetSlider, SearchResponseModel, SearchResponseModelFacetRange, SearchResponseModelFacetRangeBuckets, SearchResponseModelFacetValue, SearchResponseModelFacetValueAllOfValues } from '@athoscommerce/snapi-types';
|
|
4
4
|
type FacetWithMeta = MetaResponseModelFacetGrid & MetaResponseModelFacetHierarchy & MetaResponseModelFacetList & MetaResponseModelFacetPalette & MetaResponseModelFacetSlider & SearchResponseModelFacetValue & SearchResponseModelFacetRange & SearchResponseModelFacetRangeBuckets;
|
|
5
5
|
type FinderSelectionStoreConfig = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FinderSelectionStore.d.ts","sourceRoot":"","sources":["../../../../src/Finder/Stores/FinderSelectionStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC1G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"FinderSelectionStore.d.ts","sourceRoot":"","sources":["../../../../src/Finder/Stores/FinderSelectionStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC1G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EACX,iBAAiB,EACjB,0BAA0B,EAC1B,+BAA+B,EAC/B,0BAA0B,EAC1B,6BAA6B,EAC7B,4BAA4B,EAC5B,mBAAmB,EACnB,6BAA6B,EAC7B,oCAAoC,EACpC,6BAA6B,EAC7B,wCAAwC,EACxC,MAAM,4BAA4B,CAAC;AAEpC,KAAK,aAAa,GAAG,0BAA0B,GAC9C,+BAA+B,GAC/B,0BAA0B,GAC1B,6BAA6B,GAC7B,4BAA4B,GAC5B,6B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EAAE,iBAAiB,GAAG,WAAW,CAAC;IACxC,IAAI,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,aAAa,CAAC;KACrB,CAAC;CACF,CAAC;AAEF,cAAM,SAAU,SAAQ,aAAa;IAC7B,MAAM,EAAG,iBAAiB,CAAC;gBAEtB,aAAa,EAAE,aAAa;IAejC,MAAM,CAAC,KAAK,SAAK;CAWxB;AAED,cAAM,kBAAmB,SAAQ,aAAa;IACtC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAG,WAAW,CAAC;gBAEhB,aAAa,EAAE,aAAa;IAuCjC,MAAM,CAAC,KAAK,SAAK;CA2BxB;AAED,KAAK,WAAW,GAAG;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACZ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { MetaResponseModel } from '@athoscommerce/snapi-types';
|
|
2
|
+
import type { ProductsResponseModel } from '@athoscommerce/snap-client';
|
|
3
|
+
import { Product } from '../Search/Stores/SearchResultStore';
|
|
4
|
+
/** Composable store holding the currently-displayed quickview product, plus the
|
|
5
|
+
* fetch/error state used by a ProductQuickView UI. Any results-bearing store
|
|
6
|
+
* (Recommendation, Search, Autocomplete, Chat) can hold one as a property. */
|
|
7
|
+
export declare class ProductQuickViewStore {
|
|
8
|
+
product: Product | null;
|
|
9
|
+
error: string | null;
|
|
10
|
+
loading: boolean;
|
|
11
|
+
constructor();
|
|
12
|
+
/** Clone the supplied product and stash it as the quickview target. The clone
|
|
13
|
+
* isolates variant selections and mapping merges from the originating result. */
|
|
14
|
+
set(product: Product, meta?: MetaResponseModel): void;
|
|
15
|
+
/** Merge the parent-level products API response into the cloned product —
|
|
16
|
+
* core mappings get merged in and Variants are created or updated in place. */
|
|
17
|
+
update(response: ProductsResponseModel, meta?: MetaResponseModel): void;
|
|
18
|
+
setError(message: string): void;
|
|
19
|
+
clear(): void;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=ProductQuickViewStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductQuickViewStore.d.ts","sourceRoot":"","sources":["../../../src/ProductQuickView/ProductQuickViewStore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,OAAO,EAAY,MAAM,oCAAoC,CAAC;AAGvE;;8EAE8E;AAC9E,qBAAa,qBAAqB;IAC1B,OAAO,EAAE,OAAO,GAAG,IAAI,CAAQ;IAC/B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC5B,OAAO,EAAE,OAAO,CAAS;;IAUhC;qFACiF;IAC1E,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,iBAAiB,GAAG,IAAI;IAK5D;mFAC+E;IACxE,MAAM,CAAC,QAAQ,EAAE,qBAAqB,EAAE,IAAI,CAAC,EAAE,iBAAiB,GAAG,IAAI;IAuBvE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI/B,KAAK,IAAI,IAAI;CAKpB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.ProductQuickViewStore = void 0;
|
|
15
|
+
var mobx_1 = require("mobx");
|
|
16
|
+
var SearchResultStore_1 = require("../Search/Stores/SearchResultStore");
|
|
17
|
+
var cloneProductForQuickView_1 = require("./cloneProductForQuickView");
|
|
18
|
+
/** Composable store holding the currently-displayed quickview product, plus the
|
|
19
|
+
* fetch/error state used by a ProductQuickView UI. Any results-bearing store
|
|
20
|
+
* (Recommendation, Search, Autocomplete, Chat) can hold one as a property. */
|
|
21
|
+
var ProductQuickViewStore = /** @class */ (function () {
|
|
22
|
+
function ProductQuickViewStore() {
|
|
23
|
+
this.product = null;
|
|
24
|
+
this.error = null;
|
|
25
|
+
this.loading = false;
|
|
26
|
+
(0, mobx_1.makeObservable)(this, {
|
|
27
|
+
product: mobx_1.observable,
|
|
28
|
+
error: mobx_1.observable,
|
|
29
|
+
loading: mobx_1.observable,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/** Clone the supplied product and stash it as the quickview target. The clone
|
|
33
|
+
* isolates variant selections and mapping merges from the originating result. */
|
|
34
|
+
ProductQuickViewStore.prototype.set = function (product, meta) {
|
|
35
|
+
this.product = (0, cloneProductForQuickView_1.cloneProductForQuickView)(product, meta);
|
|
36
|
+
this.error = null;
|
|
37
|
+
};
|
|
38
|
+
/** Merge the parent-level products API response into the cloned product —
|
|
39
|
+
* core mappings get merged in and Variants are created or updated in place. */
|
|
40
|
+
ProductQuickViewStore.prototype.update = function (response, meta) {
|
|
41
|
+
if (!this.product)
|
|
42
|
+
return;
|
|
43
|
+
this.product.mappings = __assign(__assign({}, this.product.mappings), { core: __assign(__assign({}, this.product.mappings.core), response.mappings.core) });
|
|
44
|
+
if (this.product.variants) {
|
|
45
|
+
this.product.variants.optionConfig = response.variants.optionConfig;
|
|
46
|
+
this.product.variants.update(response.variants.data);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.product.variants = new SearchResultStore_1.Variants({
|
|
50
|
+
data: {
|
|
51
|
+
mask: this.product.mask,
|
|
52
|
+
variants: response.variants.data,
|
|
53
|
+
optionConfig: response.variants.optionConfig,
|
|
54
|
+
meta: meta || {},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
ProductQuickViewStore.prototype.setError = function (message) {
|
|
60
|
+
this.error = message;
|
|
61
|
+
};
|
|
62
|
+
ProductQuickViewStore.prototype.clear = function () {
|
|
63
|
+
this.product = null;
|
|
64
|
+
this.error = null;
|
|
65
|
+
this.loading = false;
|
|
66
|
+
};
|
|
67
|
+
return ProductQuickViewStore;
|
|
68
|
+
}());
|
|
69
|
+
exports.ProductQuickViewStore = ProductQuickViewStore;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MetaResponseModel } from '@athoscommerce/snapi-types';
|
|
2
|
+
import { Product } from '../Search/Stores/SearchResultStore';
|
|
3
|
+
/** Build a fresh observable Product from an existing one. Variants are intentionally
|
|
4
|
+
* omitted — they're populated from the products API response after the clone is set
|
|
5
|
+
* on the quickview store. */
|
|
6
|
+
export declare function cloneProductForQuickView(product: Product, meta: MetaResponseModel | undefined): Product;
|
|
7
|
+
//# sourceMappingURL=cloneProductForQuickView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloneProductForQuickView.d.ts","sourceRoot":"","sources":["../../../src/ProductQuickView/cloneProductForQuickView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAE7D;;6BAE6B;AAC7B,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,GAAG,SAAS,GAAG,OAAO,CAcvG"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cloneProductForQuickView = cloneProductForQuickView;
|
|
4
|
+
var SearchResultStore_1 = require("../Search/Stores/SearchResultStore");
|
|
5
|
+
/** Build a fresh observable Product from an existing one. Variants are intentionally
|
|
6
|
+
* omitted — they're populated from the products API response after the clone is set
|
|
7
|
+
* on the quickview store. */
|
|
8
|
+
function cloneProductForQuickView(product, meta) {
|
|
9
|
+
var _a, _b, _c;
|
|
10
|
+
var result = {
|
|
11
|
+
id: product.id,
|
|
12
|
+
responseId: product.responseId,
|
|
13
|
+
mappings: JSON.parse(JSON.stringify(product.mappings || {})),
|
|
14
|
+
attributes: JSON.parse(JSON.stringify(product.attributes || {})),
|
|
15
|
+
badges: ((_b = (_a = product.badges) === null || _a === void 0 ? void 0 : _a.all) === null || _b === void 0 ? void 0 : _b.map(function (b) { return ({ tag: b.tag }); })) || [],
|
|
16
|
+
};
|
|
17
|
+
return new SearchResultStore_1.Product({
|
|
18
|
+
config: {},
|
|
19
|
+
data: { result: result, meta: meta || {} },
|
|
20
|
+
position: (_c = product.position) !== null && _c !== void 0 ? _c : 0,
|
|
21
|
+
responseId: product.responseId,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -5,6 +5,7 @@ import { RecommendationProfileStore } from './Stores';
|
|
|
5
5
|
import type { RecommendationStoreConfig, StoreServices } from '../types';
|
|
6
6
|
import type { RecommendCombinedResponseModel } from '@athoscommerce/snap-client';
|
|
7
7
|
import { MetaStore } from '../Meta/MetaStore';
|
|
8
|
+
import { ProductQuickViewStore } from '../ProductQuickView/ProductQuickViewStore';
|
|
8
9
|
export declare class RecommendationStore extends AbstractStore<RecommendationStoreConfig> {
|
|
9
10
|
services: StoreServices;
|
|
10
11
|
meta?: MetaStore;
|
|
@@ -12,6 +13,7 @@ export declare class RecommendationStore extends AbstractStore<RecommendationSto
|
|
|
12
13
|
profile: RecommendationProfileStore | Record<string, any>;
|
|
13
14
|
results: Product[];
|
|
14
15
|
cart?: CartStore;
|
|
16
|
+
productQuickView: ProductQuickViewStore;
|
|
15
17
|
constructor(config: RecommendationStoreConfig, services: StoreServices);
|
|
16
18
|
reset(): void;
|
|
17
19
|
update(data: RecommendCombinedResponseModel): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecommendationStore.d.ts","sourceRoot":"","sources":["../../../src/Recommendation/RecommendationStore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAqB,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"RecommendationStore.d.ts","sourceRoot":"","sources":["../../../src/Recommendation/RecommendationStore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAqB,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAElF,qBAAa,mBAAoB,SAAQ,aAAa,CAAC,yBAAyB,CAAC;IACzE,QAAQ,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,UAAS;IACf,OAAO,EAAE,0BAA0B,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAC/D,OAAO,EAAE,OAAO,EAAE,CAAM;IACxB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,gBAAgB,EAAE,qBAAqB,CAA+B;gBAEjE,MAAM,EAAE,yBAAyB,EAAE,QAAQ,EAAE,aAAa;IAgB/D,KAAK,IAAI,IAAI;IAOb,MAAM,CAAC,IAAI,EAAE,8BAA8B,GAAG,IAAI;CA+CzD"}
|
|
@@ -26,6 +26,7 @@ var Stores_1 = require("../Search/Stores");
|
|
|
26
26
|
var CartStore_1 = require("../Cart/CartStore");
|
|
27
27
|
var Stores_2 = require("./Stores");
|
|
28
28
|
var MetaStore_1 = require("../Meta/MetaStore");
|
|
29
|
+
var ProductQuickViewStore_1 = require("../ProductQuickView/ProductQuickViewStore");
|
|
29
30
|
var RecommendationStore = /** @class */ (function (_super) {
|
|
30
31
|
__extends(RecommendationStore, _super);
|
|
31
32
|
function RecommendationStore(config, services) {
|
|
@@ -34,6 +35,7 @@ var RecommendationStore = /** @class */ (function (_super) {
|
|
|
34
35
|
_this.loaded = false;
|
|
35
36
|
_this.profile = {};
|
|
36
37
|
_this.results = [];
|
|
38
|
+
_this.productQuickView = new ProductQuickViewStore_1.ProductQuickViewStore();
|
|
37
39
|
if (typeof services != 'object' || typeof ((_a = services.urlManager) === null || _a === void 0 ? void 0 : _a.subscribe) != 'function') {
|
|
38
40
|
throw new Error("Invalid service 'urlManager' passed to AutocompleteStore. Missing \"subscribe\" function.");
|
|
39
41
|
}
|
|
@@ -41,6 +43,7 @@ var RecommendationStore = /** @class */ (function (_super) {
|
|
|
41
43
|
(0, mobx_1.makeObservable)(_this, {
|
|
42
44
|
profile: mobx_1.observable,
|
|
43
45
|
results: mobx_1.observable,
|
|
46
|
+
productQuickView: mobx_1.observable,
|
|
44
47
|
});
|
|
45
48
|
return _this;
|
|
46
49
|
}
|
|
@@ -17,7 +17,7 @@ var RecommendationProfileStore = /** @class */ (function () {
|
|
|
17
17
|
this.tag = profile.tag;
|
|
18
18
|
this.placement = profile.placement;
|
|
19
19
|
this.display = profile.display;
|
|
20
|
-
this.type = profile.
|
|
20
|
+
this.type = profile.isBundle ? 'bundle' : 'default';
|
|
21
21
|
(0, mobx_1.makeObservable)(this, {
|
|
22
22
|
tag: mobx_1.observable,
|
|
23
23
|
placement: mobx_1.observable,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { SearchResponseModel, MetaResponseModel } from '@athoscommerce/snapi-types';
|
|
2
|
+
import { StorageStore } from '@athoscommerce/snap-toolbox';
|
|
2
3
|
import type { SearchStoreConfig, StoreServices } from '../types';
|
|
3
4
|
import { SearchMerchandisingStore, SearchFacetStore, SearchFilterStore, SearchResultStore, SearchPaginationStore, SearchSortingStore, SearchQueryStore, SearchHistoryStore } from './Stores';
|
|
4
5
|
import { AbstractStore } from '../Abstract/AbstractStore';
|
|
5
|
-
import { StorageStore } from '../Storage/StorageStore';
|
|
6
6
|
import { MetaStore } from '../Meta/MetaStore';
|
|
7
7
|
export declare class SearchStore extends AbstractStore<SearchStoreConfig> {
|
|
8
8
|
private previousSearch?;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchStore.d.ts","sourceRoot":"","sources":["../../../src/Search/SearchStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACzF,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EACN,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,E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9 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.SearchStore = void 0;
|
|
19
19
|
var mobx_1 = require("mobx");
|
|
20
|
+
var snap_toolbox_1 = require("@athoscommerce/snap-toolbox");
|
|
20
21
|
var Stores_1 = require("./Stores");
|
|
21
22
|
var AbstractStore_1 = require("../Abstract/AbstractStore");
|
|
22
|
-
var StorageStore_1 = require("../Storage/StorageStore");
|
|
23
23
|
var MetaStore_1 = require("../Meta/MetaStore");
|
|
24
24
|
var SearchStore = /** @class */ (function (_super) {
|
|
25
25
|
__extends(SearchStore, _super);
|
|
@@ -30,7 +30,7 @@ var SearchStore = /** @class */ (function (_super) {
|
|
|
30
30
|
throw new Error("Invalid service 'urlManager' passed to SearchStore. Missing \"subscribe\" function.");
|
|
31
31
|
}
|
|
32
32
|
_this.services = services;
|
|
33
|
-
_this.storage = new
|
|
33
|
+
_this.storage = new snap_toolbox_1.StorageStore();
|
|
34
34
|
_this.history = new Stores_1.SearchHistoryStore({
|
|
35
35
|
services: _this.services,
|
|
36
36
|
config: _this.config,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { UrlManager } from '@athoscommerce/snap-url-manager';
|
|
2
|
-
import type { StorageStore } from '
|
|
2
|
+
import type { StorageStore } from '@athoscommerce/snap-toolbox';
|
|
3
3
|
import type { AutocompleteStoreConfig, SearchStoreConfig, StoreServices, FacetStoreConfig } from '../../types';
|
|
4
4
|
import type { MetaResponseModelFacet, MetaResponseModelFacetSlider, MetaResponseModelFacetValueMultipleEnum, MetaResponseModelFacetHierarchyAllOf, SearchResponseModelFacetRange, SearchResponseModelFacetValue, SearchResponseModelFacetValueAllOfValues, SearchRequestModelFilterRangeAllOfValue, SearchResponseModel, MetaResponseModel } from '@athoscommerce/snapi-types';
|
|
5
5
|
export type SearchFacetStoreConfig = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchFacetStore.d.ts","sourceRoot":"","sources":["../../../../src/Search/Stores/SearchFacetStore.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SearchFacetStore.d.ts","sourceRoot":"","sources":["../../../../src/Search/Stores/SearchFacetStore.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/G,OAAO,KAAK,EACX,sBAAsB,EAEtB,4BAA4B,EAC5B,uCAAuC,EACvC,oCAAoC,EAEpC,6BAA6B,EAC7B,6BAA6B,EAE7B,wCAAwC,EACxC,uCAAuC,EACvC,mBAAmB,EACnB,iBAAiB,EACjB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,sBAAsB,GAAG;IACpC,MAAM,EAAE,iBAAiB,GAAG,uBAAuB,CAAC;IACpD,MAAM,EAAE;QACP,OAAO,EAAE,YAAY,CAAC;KACtB,CAAC;IACF,QAAQ,EAAE,aAAa,CAAC;IACxB,IAAI,EAAE;QACL,MAAM,CAAC,EAAE,mBAAmB,CAAC;QAC7B,IAAI,EAAE,iBAAiB,CAAC;KACxB,CAAC;CACF,CAAC;AAEF,qBAAa,gBAAiB,SAAQ,KAAK;IAC1C,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,gBAAgB,CAE9C;gBAEW,MAAM,EAAE,sBAAsB;CAgE1C;AAED,qBAAa,KAAK;IACV,QAAQ,EAAE,aAAa,CAAC;IACxB,IAAI,EAAG,OAAO,GAAG,OAAO,GAAG,eAAe,CAAC;IAC3C,KAAK,EAAG,MAAM,CAAC;IACf,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,KAAK,EAAE,6BAA6B,EACpC,SAAS,EAAE,sBAAsB,EACjC,MAAM,EAAE,gBAAgB;IAmDzB,IAAW,aAAa,WAEvB;IAED,IAAW,aAAa,uEAavB;CACD;AAED,qBAAa,UAAU;IACf,KAAK,EAAG,MAAM,CAAC;IACf,KAAK,EAAG,MAAM,CAAC;IACf,QAAQ,EAAG,OAAO,CAAC;IACnB,KAAK,EAAG,MAAM,CAAC;IACf,MAAM,EAAG,MAAM,CAAC;IAChB,GAAG,EAAE,UAAU,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;gBAEhB,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,wCAAwC;CAcvG;AAED,qBAAa,mBAAoB,SAAQ,UAAU;IAC3C,KAAK,SAAK;IACV,OAAO,UAAS;gBAGtB,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,UAAU,GAAG,oCAAoC,EACxD,KAAK,EAAE,wCAAwC,EAC/C,cAAc,EAAE,wCAAwC,EAAE;CAsB3D;AAED,qBAAa,eAAe;IACpB,KAAK,EAAG,MAAM,CAAC;IACf,KAAK,EAAG,MAAM,CAAC;IACf,QAAQ,EAAG,OAAO,CAAC;IACnB,GAAG,EAAG,MAAM,CAAC;IACb,IAAI,EAAG,MAAM,CAAC;IACd,MAAM,EAAG,MAAM,CAAC;IAChB,GAAG,EAAE,UAAU,CAAC;gBAEX,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,wCAAwC;CAgBvG"}
|
|
@@ -305,15 +305,16 @@ exports.ValueFacet = ValueFacet;
|
|
|
305
305
|
var FacetValue = /** @class */ (function () {
|
|
306
306
|
function FacetValue(services, facet, value) {
|
|
307
307
|
Object.assign(this, value);
|
|
308
|
+
var urlManager = services.urlManager;
|
|
308
309
|
if (this.filtered) {
|
|
309
|
-
this.url =
|
|
310
|
+
this.url = urlManager.remove('page').remove("filter.".concat(facet.field), value.value);
|
|
310
311
|
}
|
|
311
312
|
else {
|
|
312
|
-
var valueUrl =
|
|
313
|
+
var valueUrl = urlManager.remove('page');
|
|
313
314
|
if (facet.multiple == 'single') {
|
|
314
|
-
valueUrl = valueUrl
|
|
315
|
+
valueUrl = valueUrl.remove("filter.".concat(facet.field));
|
|
315
316
|
}
|
|
316
|
-
this.url = valueUrl
|
|
317
|
+
this.url = valueUrl.merge("filter.".concat(facet.field), value.value);
|
|
317
318
|
}
|
|
318
319
|
}
|
|
319
320
|
return FacetValue;
|
|
@@ -335,11 +336,12 @@ var FacetHierarchyValue = /** @class */ (function (_super) {
|
|
|
335
336
|
_this.history = true;
|
|
336
337
|
}
|
|
337
338
|
}
|
|
339
|
+
var urlManager = services.urlManager;
|
|
338
340
|
if (value.value) {
|
|
339
|
-
_this.url =
|
|
341
|
+
_this.url = urlManager.remove('page').set("filter.".concat(facet.field), value.value);
|
|
340
342
|
}
|
|
341
343
|
else {
|
|
342
|
-
_this.url =
|
|
344
|
+
_this.url = urlManager.remove('page').remove("filter.".concat(facet.field));
|
|
343
345
|
}
|
|
344
346
|
return _this;
|
|
345
347
|
}
|
|
@@ -349,15 +351,16 @@ exports.FacetHierarchyValue = FacetHierarchyValue;
|
|
|
349
351
|
var FacetRangeValue = /** @class */ (function () {
|
|
350
352
|
function FacetRangeValue(services, facet, value) {
|
|
351
353
|
Object.assign(this, value);
|
|
354
|
+
var urlManager = services.urlManager;
|
|
352
355
|
if (this.filtered) {
|
|
353
|
-
this.url =
|
|
356
|
+
this.url = urlManager.remove('page').remove("filter.".concat(facet.field), [{ low: this.low, high: this.high }]);
|
|
354
357
|
}
|
|
355
358
|
else {
|
|
356
|
-
var valueUrl =
|
|
359
|
+
var valueUrl = urlManager.remove('page');
|
|
357
360
|
if (facet.multiple == 'single') {
|
|
358
|
-
valueUrl = valueUrl
|
|
361
|
+
valueUrl = valueUrl.remove("filter.".concat(facet.field));
|
|
359
362
|
}
|
|
360
|
-
this.url = valueUrl
|
|
363
|
+
this.url = valueUrl.merge("filter.".concat(facet.field), [{ low: this.low, high: this.high }]);
|
|
361
364
|
}
|
|
362
365
|
}
|
|
363
366
|
return FacetRangeValue;
|