@athoscommerce/snap-store-mobx 1.2.3-beta.4 → 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.d.ts.map +1 -1
- package/dist/cjs/Autocomplete/Stores/AutocompleteFacetStore.js +1 -2
- package/dist/cjs/Chat/ChatStore.d.ts +35 -6
- package/dist/cjs/Chat/ChatStore.d.ts.map +1 -1
- package/dist/cjs/Chat/ChatStore.js +201 -77
- package/dist/cjs/Chat/Stores/ChatAttachmentStore.d.ts.map +1 -1
- package/dist/cjs/Chat/Stores/ChatAttachmentStore.js +3 -3
- 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 -20
- package/dist/cjs/Chat/Stores/ChatSessionStore.d.ts.map +1 -1
- package/dist/cjs/Chat/Stores/ChatSessionStore.js +33 -87
- 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 +12 -12
- package/dist/cjs/Search/Stores/SearchFacetStore.d.ts.map +1 -1
- package/dist/cjs/Search/Stores/SearchFacetStore.js +25 -32
- 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.d.ts.map +1 -1
- package/dist/esm/Autocomplete/Stores/AutocompleteFacetStore.js +4 -6
- package/dist/esm/Chat/ChatStore.d.ts +35 -6
- package/dist/esm/Chat/ChatStore.d.ts.map +1 -1
- package/dist/esm/Chat/ChatStore.js +188 -65
- package/dist/esm/Chat/Stores/ChatAttachmentStore.d.ts.map +1 -1
- package/dist/esm/Chat/Stores/ChatAttachmentStore.js +3 -3
- 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 -20
- package/dist/esm/Chat/Stores/ChatSessionStore.d.ts.map +1 -1
- package/dist/esm/Chat/Stores/ChatSessionStore.js +26 -86
- 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 +12 -12
- package/dist/esm/Search/Stores/SearchFacetStore.d.ts.map +1 -1
- package/dist/esm/Search/Stores/SearchFacetStore.js +25 -31
- 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
|
@@ -3,7 +3,6 @@ import { v4 as uuidv4 } from 'uuid';
|
|
|
3
3
|
import { ChatAttachmentStore, } from '../Stores/ChatAttachmentStore';
|
|
4
4
|
import { ChatCompareStore } from './ChatCompareStore';
|
|
5
5
|
import { SearchResultStore, Product } from '../../Search/Stores/SearchResultStore';
|
|
6
|
-
import { SearchFacetStore } from '../../Search/Stores/SearchFacetStore';
|
|
7
6
|
function createChatResultStore(results, meta) {
|
|
8
7
|
return new SearchResultStore({
|
|
9
8
|
config: {},
|
|
@@ -22,16 +21,6 @@ function createChatProduct(result, meta) {
|
|
|
22
21
|
responseId: '',
|
|
23
22
|
});
|
|
24
23
|
}
|
|
25
|
-
function createChatFacetStore(facets, meta, storage) {
|
|
26
|
-
return new SearchFacetStore({
|
|
27
|
-
config: {},
|
|
28
|
-
stores: { storage },
|
|
29
|
-
data: {
|
|
30
|
-
search: { facets },
|
|
31
|
-
meta,
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
24
|
/** Extract raw serializable data from a Product instance for storage. */
|
|
36
25
|
function serializeProduct(product) {
|
|
37
26
|
if (!(product instanceof Product))
|
|
@@ -141,47 +130,6 @@ function serializeChatForStorage(chat) {
|
|
|
141
130
|
}
|
|
142
131
|
});
|
|
143
132
|
}
|
|
144
|
-
/** Serialize SearchFacetStore instances in actions back to plain facet arrays for localStorage. */
|
|
145
|
-
function serializeActionsForStorage(actions) {
|
|
146
|
-
return actions.map((action) => {
|
|
147
|
-
if (action.type === 'facets') {
|
|
148
|
-
return {
|
|
149
|
-
...action,
|
|
150
|
-
data: serializeFacetStore(action.data),
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
return action;
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
/** Convert a SearchFacetStore (or raw array) back to plain serializable facet objects. */
|
|
157
|
-
function serializeFacetStore(facetStore) {
|
|
158
|
-
return Array.from(facetStore).map((facet) => {
|
|
159
|
-
const serialized = {
|
|
160
|
-
field: facet.field,
|
|
161
|
-
label: facet.label,
|
|
162
|
-
type: facet.type,
|
|
163
|
-
filtered: facet.filtered,
|
|
164
|
-
};
|
|
165
|
-
if (facet.values) {
|
|
166
|
-
serialized.values = facet.values.map((value) => {
|
|
167
|
-
if (facet.type === 'range-buckets') {
|
|
168
|
-
return { low: value.low, high: value.high, label: value.label, count: value.count, filtered: value.filtered };
|
|
169
|
-
}
|
|
170
|
-
return { value: value.value, label: value.label, count: value.count, filtered: value.filtered };
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
if (facet.range) {
|
|
174
|
-
serialized.range = facet.range;
|
|
175
|
-
}
|
|
176
|
-
if (facet.active) {
|
|
177
|
-
serialized.active = facet.active;
|
|
178
|
-
}
|
|
179
|
-
if (facet.step != null) {
|
|
180
|
-
serialized.step = facet.step;
|
|
181
|
-
}
|
|
182
|
-
return serialized;
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
133
|
export class ChatSessionStore {
|
|
186
134
|
constructor(params) {
|
|
187
135
|
this.chat = [];
|
|
@@ -197,25 +145,24 @@ export class ChatSessionStore {
|
|
|
197
145
|
this.dismissedSideChatMessageId = null;
|
|
198
146
|
this.activeMessageId = null;
|
|
199
147
|
this.sessionLimitReached = false;
|
|
200
|
-
/** Tracks server-filtered facets the user has explicitly unselected (pending next request). */
|
|
201
|
-
this.removedFacets = [];
|
|
202
148
|
/** Whether raw stored results have been hydrated into Product/SearchResultStore instances. */
|
|
203
149
|
this.hydrated = true;
|
|
204
150
|
this.saveTimerId = null;
|
|
205
|
-
const { id, sessionId, chat, attachments, actions, feedbacks, sessionFeedback, feedbackDismissed, createdAt, committedComparisons } = params.data || {};
|
|
151
|
+
const { id, sessionId, chat, attachments, actions, feedbacks, sessionFeedback, feedbackDismissed, createdAt, sessionEndTime, committedComparisons, } = params.data || {};
|
|
206
152
|
const { stores } = params;
|
|
207
153
|
this.id = id || uuidv4();
|
|
208
154
|
this.sessionId = sessionId;
|
|
209
155
|
this.storage = stores.storage;
|
|
210
156
|
this.actions = actions || [];
|
|
211
157
|
this.createdAt = createdAt ? new Date(createdAt) : new Date();
|
|
158
|
+
this.sessionEndTime = sessionEndTime ? new Date(sessionEndTime) : undefined;
|
|
212
159
|
this.feedbacks = feedbacks || [];
|
|
213
160
|
this.sessionFeedback = sessionFeedback || null;
|
|
214
161
|
this.feedbackDismissed = feedbackDismissed || false;
|
|
215
162
|
// if chat and attachments are passed, load them
|
|
216
163
|
if (chat && chat.length > 0) {
|
|
217
164
|
// productQuery messages only exist to drive the side-chat panel for an
|
|
218
|
-
// in-flight
|
|
165
|
+
// in-flight productQuery click; they must not be rehydrated on reload
|
|
219
166
|
// or the side chat would re-open without the matching primary-chat state
|
|
220
167
|
this.chat = chat.filter((message) => message.messageType !== 'productQuery');
|
|
221
168
|
}
|
|
@@ -261,7 +208,6 @@ export class ChatSessionStore {
|
|
|
261
208
|
dismissedSideChatMessageId: observable,
|
|
262
209
|
activeMessageId: observable,
|
|
263
210
|
sessionLimitReached: observable,
|
|
264
|
-
removedFacets: observable,
|
|
265
211
|
activeMessage: computed,
|
|
266
212
|
});
|
|
267
213
|
}
|
|
@@ -283,7 +229,7 @@ export class ChatSessionStore {
|
|
|
283
229
|
// capture the side-chat message that was active at click time so a back action
|
|
284
230
|
// can restore it even when it's not the last message in the chat
|
|
285
231
|
const sourceMessageId = this.activeMessage?.id;
|
|
286
|
-
// drop any trailing productQuery so a fresh
|
|
232
|
+
// drop any trailing productQuery so a fresh productQuery click replaces
|
|
287
233
|
// the side-chat target rather than stacking up
|
|
288
234
|
while (this.chat.length > 0 && this.chat[this.chat.length - 1]?.messageType === 'productQuery') {
|
|
289
235
|
this.chat.pop();
|
|
@@ -307,10 +253,13 @@ export class ChatSessionStore {
|
|
|
307
253
|
this.save();
|
|
308
254
|
}
|
|
309
255
|
get isExpired() {
|
|
256
|
+
// Prefer the server-provided end time (returned by chatInit); fall back to a
|
|
257
|
+
// 24-hour window from createdAt for sessions persisted before that field existed.
|
|
258
|
+
if (this.sessionEndTime) {
|
|
259
|
+
return Date.now() > this.sessionEndTime.getTime();
|
|
260
|
+
}
|
|
310
261
|
const ONE_DAY = 24 * 60 * 60 * 1000;
|
|
311
|
-
|
|
312
|
-
const diff = now.getTime() - this.createdAt.getTime();
|
|
313
|
-
return diff > ONE_DAY;
|
|
262
|
+
return Date.now() - this.createdAt.getTime() > ONE_DAY;
|
|
314
263
|
}
|
|
315
264
|
get topicDrift() {
|
|
316
265
|
const lastMessage = this.chat[this.chat.length - 1];
|
|
@@ -377,7 +326,6 @@ export class ChatSessionStore {
|
|
|
377
326
|
this.attachments.reset();
|
|
378
327
|
this.chat = [];
|
|
379
328
|
this.actions = [];
|
|
380
|
-
this.removedFacets = [];
|
|
381
329
|
this.feedbacks = [];
|
|
382
330
|
this.sessionFeedback = null;
|
|
383
331
|
}
|
|
@@ -391,11 +339,12 @@ export class ChatSessionStore {
|
|
|
391
339
|
sessionId: this.sessionId,
|
|
392
340
|
chat: serializeChatForStorage(this.chat),
|
|
393
341
|
attachments: serializeAttachmentsForStorage(this.attachments.items),
|
|
394
|
-
actions:
|
|
342
|
+
actions: this.actions,
|
|
395
343
|
feedbacks: this.feedbacks,
|
|
396
344
|
sessionFeedback: this.sessionFeedback,
|
|
397
345
|
feedbackDismissed: this.feedbackDismissed,
|
|
398
346
|
createdAt: this.createdAt,
|
|
347
|
+
sessionEndTime: this.sessionEndTime,
|
|
399
348
|
committedComparisons: this.comparisons.committedItems,
|
|
400
349
|
});
|
|
401
350
|
}
|
|
@@ -469,20 +418,10 @@ export class ChatSessionStore {
|
|
|
469
418
|
});
|
|
470
419
|
}
|
|
471
420
|
});
|
|
472
|
-
// Re-wrap raw stored facets as SearchFacetStore instances
|
|
473
|
-
this.actions.forEach((action, index) => {
|
|
474
|
-
if (action.type === 'facets' && action.data?.length > 0 && !(action.data instanceof SearchFacetStore)) {
|
|
475
|
-
this.actions[index] = {
|
|
476
|
-
...action,
|
|
477
|
-
data: createChatFacetStore(action.data, meta, this.storage),
|
|
478
|
-
};
|
|
479
|
-
}
|
|
480
|
-
});
|
|
481
421
|
}
|
|
482
|
-
request(request) {
|
|
422
|
+
request(request, filterLabels) {
|
|
483
423
|
// clear the questions on new request
|
|
484
424
|
this.actions = [];
|
|
485
|
-
this.removedFacets = [];
|
|
486
425
|
this.requestType = request.data.requestType;
|
|
487
426
|
this.activeMessageId = null;
|
|
488
427
|
// remove any attachments that failed to upload
|
|
@@ -494,11 +433,19 @@ export class ChatSessionStore {
|
|
|
494
433
|
if (searchFilters && searchFilters.length > 0) {
|
|
495
434
|
const filterTextArray = [];
|
|
496
435
|
searchFilters.forEach((filter) => {
|
|
497
|
-
const
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
436
|
+
const labelEntry = filterLabels?.[filter.key];
|
|
437
|
+
filter.options?.forEach((option) => {
|
|
438
|
+
const facetLabel = labelEntry?.facetLabel || filter.key;
|
|
439
|
+
if ('low' in option || 'high' in option) {
|
|
440
|
+
const low = option.low ?? '*';
|
|
441
|
+
const high = option.high ?? '*';
|
|
442
|
+
filterTextArray.push(`${facetLabel} ${low}-${high}`);
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
const key = option.key;
|
|
446
|
+
const optionLabel = labelEntry?.values[key] || key;
|
|
447
|
+
filterTextArray.push(`${facetLabel} ${optionLabel}`);
|
|
448
|
+
}
|
|
502
449
|
});
|
|
503
450
|
});
|
|
504
451
|
this.chat.push({
|
|
@@ -622,13 +569,6 @@ export class ChatSessionStore {
|
|
|
622
569
|
});
|
|
623
570
|
return;
|
|
624
571
|
}
|
|
625
|
-
if (messageData.messageType === 'productSearchResult' && messageData.facets?.length > 0) {
|
|
626
|
-
this.actions.push({
|
|
627
|
-
type: 'facets',
|
|
628
|
-
data: createChatFacetStore(messageData.facets, meta, this.storage),
|
|
629
|
-
filterSummary: messageData.filterSummary || [],
|
|
630
|
-
});
|
|
631
|
-
}
|
|
632
572
|
// convert raw results to Product instances (via SearchResultStore) so
|
|
633
573
|
// display components can use result.display for mask-aware rendering
|
|
634
574
|
if (messageData.messageType === 'productSearchResult' && messageData.results?.length) {
|
|
@@ -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/Finder/FinderStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACzF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"FinderStore.d.ts","sourceRoot":"","sources":["../../../src/Finder/FinderStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,qBAAa,WAAY,SAAQ,aAAa,CAAC,iBAAiB,CAAC;IACzD,QAAQ,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,YAAY,CAAC;IACtB,gBAAgB,EAAG,YAAY,CAAC;IAChC,UAAU,EAAG,qBAAqB,CAAC;IACnC,UAAU,EAAG,oBAAoB,CAAC;IAClC,SAAS,EAAE,OAAO,CAAS;gBAEtB,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAE,aAAa;IA0BvD,UAAU,CAAC,IAAI,EAAE,MAAM,aAAa,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI;IAQhE,IAAI,EAAE,MAAM,IAAI,CAAY;IAE5B,KAAK,QAAO,IAAI,CAWrB;IAEK,aAAa,IAAI,IAAI;IAyBrB,MAAM,CAAC,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,iBAAiB,CAAC;QAAC,MAAM,CAAC,EAAE,mBAAmB,CAAA;KAAE,EAAE,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,GAAG,IAAI;CAsDhI"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { makeObservable, observable } from 'mobx';
|
|
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 { MetaStore } from '../Meta/MetaStore';
|
|
7
7
|
export class FinderStore extends AbstractStore {
|
|
@@ -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,CA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M,+CAUhB;CACD;AAED,KAAK,aAAa,GAAG,IAAI,CAAC,0BAA0B,EAAE,QAAQ,GAAG,MAAM,CAAC,GAAG;IAC1E,MAAM,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,56 @@
|
|
|
1
|
+
import { makeObservable, observable } from 'mobx';
|
|
2
|
+
import { Variants } from '../Search/Stores/SearchResultStore';
|
|
3
|
+
import { cloneProductForQuickView } from './cloneProductForQuickView';
|
|
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 class ProductQuickViewStore {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.product = null;
|
|
10
|
+
this.error = null;
|
|
11
|
+
this.loading = false;
|
|
12
|
+
makeObservable(this, {
|
|
13
|
+
product: observable,
|
|
14
|
+
error: observable,
|
|
15
|
+
loading: observable,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/** Clone the supplied product and stash it as the quickview target. The clone
|
|
19
|
+
* isolates variant selections and mapping merges from the originating result. */
|
|
20
|
+
set(product, meta) {
|
|
21
|
+
this.product = cloneProductForQuickView(product, meta);
|
|
22
|
+
this.error = null;
|
|
23
|
+
}
|
|
24
|
+
/** Merge the parent-level products API response into the cloned product —
|
|
25
|
+
* core mappings get merged in and Variants are created or updated in place. */
|
|
26
|
+
update(response, meta) {
|
|
27
|
+
if (!this.product)
|
|
28
|
+
return;
|
|
29
|
+
this.product.mappings = {
|
|
30
|
+
...this.product.mappings,
|
|
31
|
+
core: { ...this.product.mappings.core, ...response.mappings.core },
|
|
32
|
+
};
|
|
33
|
+
if (this.product.variants) {
|
|
34
|
+
this.product.variants.optionConfig = response.variants.optionConfig;
|
|
35
|
+
this.product.variants.update(response.variants.data);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
this.product.variants = new Variants({
|
|
39
|
+
data: {
|
|
40
|
+
mask: this.product.mask,
|
|
41
|
+
variants: response.variants.data,
|
|
42
|
+
optionConfig: response.variants.optionConfig,
|
|
43
|
+
meta: meta || {},
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
setError(message) {
|
|
49
|
+
this.error = message;
|
|
50
|
+
}
|
|
51
|
+
clear() {
|
|
52
|
+
this.product = null;
|
|
53
|
+
this.error = null;
|
|
54
|
+
this.loading = false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -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,19 @@
|
|
|
1
|
+
import { Product } from '../Search/Stores/SearchResultStore';
|
|
2
|
+
/** Build a fresh observable Product from an existing one. Variants are intentionally
|
|
3
|
+
* omitted — they're populated from the products API response after the clone is set
|
|
4
|
+
* on the quickview store. */
|
|
5
|
+
export function cloneProductForQuickView(product, meta) {
|
|
6
|
+
const result = {
|
|
7
|
+
id: product.id,
|
|
8
|
+
responseId: product.responseId,
|
|
9
|
+
mappings: JSON.parse(JSON.stringify(product.mappings || {})),
|
|
10
|
+
attributes: JSON.parse(JSON.stringify(product.attributes || {})),
|
|
11
|
+
badges: product.badges?.all?.map((b) => ({ tag: b.tag })) || [],
|
|
12
|
+
};
|
|
13
|
+
return new Product({
|
|
14
|
+
config: {},
|
|
15
|
+
data: { result, meta: meta || {} },
|
|
16
|
+
position: product.position ?? 0,
|
|
17
|
+
responseId: product.responseId,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -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"}
|
|
@@ -5,12 +5,14 @@ import { SearchResultStore } from '../Search/Stores';
|
|
|
5
5
|
import { CartStore } from '../Cart/CartStore';
|
|
6
6
|
import { RecommendationProfileStore } from './Stores';
|
|
7
7
|
import { MetaStore } from '../Meta/MetaStore';
|
|
8
|
+
import { ProductQuickViewStore } from '../ProductQuickView/ProductQuickViewStore';
|
|
8
9
|
export class RecommendationStore extends AbstractStore {
|
|
9
10
|
constructor(config, services) {
|
|
10
11
|
super(config);
|
|
11
12
|
this.loaded = false;
|
|
12
13
|
this.profile = {};
|
|
13
14
|
this.results = [];
|
|
15
|
+
this.productQuickView = new ProductQuickViewStore();
|
|
14
16
|
if (typeof services != 'object' || typeof services.urlManager?.subscribe != 'function') {
|
|
15
17
|
throw new Error(`Invalid service 'urlManager' passed to AutocompleteStore. Missing "subscribe" function.`);
|
|
16
18
|
}
|
|
@@ -18,6 +20,7 @@ export class RecommendationStore extends AbstractStore {
|
|
|
18
20
|
makeObservable(this, {
|
|
19
21
|
profile: observable,
|
|
20
22
|
results: observable,
|
|
23
|
+
productQuickView: observable,
|
|
21
24
|
});
|
|
22
25
|
}
|
|
23
26
|
reset() {
|
|
@@ -14,7 +14,7 @@ export class RecommendationProfileStore {
|
|
|
14
14
|
this.tag = profile.tag;
|
|
15
15
|
this.placement = profile.placement;
|
|
16
16
|
this.display = profile.display;
|
|
17
|
-
this.type = profile.
|
|
17
|
+
this.type = profile.isBundle ? 'bundle' : 'default';
|
|
18
18
|
makeObservable(this, {
|
|
19
19
|
tag: observable,
|
|
20
20
|
placement: 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;A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AY,CAAC;IACtB,OAAO,EAAE,kBAAkB,CAAC;gBAEvB,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAE,aAAa;IA6BvD,KAAK,IAAI,IAAI;IAIb,MAAM,CAAC,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,iBAAiB,CAAC;QAAC,MAAM,CAAC,EAAE,mBAAmB,CAAA;KAAE,GAAG,IAAI;CA6EtF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { makeObservable, observable } from 'mobx';
|
|
2
|
+
import { StorageStore } from '@athoscommerce/snap-toolbox';
|
|
2
3
|
import { SearchMerchandisingStore, SearchFacetStore, SearchFilterStore, SearchResultStore, SearchPaginationStore, SearchSortingStore, SearchQueryStore, SearchHistoryStore, } from './Stores';
|
|
3
4
|
import { AbstractStore } from '../Abstract/AbstractStore';
|
|
4
|
-
import { StorageStore } from '../Storage/StorageStore';
|
|
5
5
|
import { MetaStore } from '../Meta/MetaStore';
|
|
6
6
|
export class SearchStore extends AbstractStore {
|
|
7
7
|
constructor(config, services) {
|
|
@@ -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 = {
|
|
@@ -7,7 +7,7 @@ export type SearchFacetStoreConfig = {
|
|
|
7
7
|
stores: {
|
|
8
8
|
storage: StorageStore;
|
|
9
9
|
};
|
|
10
|
-
services
|
|
10
|
+
services: StoreServices;
|
|
11
11
|
data: {
|
|
12
12
|
search?: SearchResponseModel;
|
|
13
13
|
meta: MetaResponseModel;
|
|
@@ -18,7 +18,7 @@ export declare class SearchFacetStore extends Array {
|
|
|
18
18
|
constructor(params: SearchFacetStoreConfig);
|
|
19
19
|
}
|
|
20
20
|
export declare class Facet {
|
|
21
|
-
services
|
|
21
|
+
services: StoreServices;
|
|
22
22
|
type: 'range' | 'value' | 'range-buckets';
|
|
23
23
|
field: string;
|
|
24
24
|
filtered: boolean;
|
|
@@ -27,9 +27,9 @@ export declare class Facet {
|
|
|
27
27
|
display: string;
|
|
28
28
|
label: string;
|
|
29
29
|
storage: StorageStore;
|
|
30
|
-
constructor(services: StoreServices
|
|
30
|
+
constructor(services: StoreServices, storage: StorageStore, facet: SearchResponseModelFacetValue | SearchResponseModelFacetRange, facetMeta: MetaResponseModelFacet, config: FacetStoreConfig);
|
|
31
31
|
get clear(): {
|
|
32
|
-
url: UrlManager
|
|
32
|
+
url: UrlManager;
|
|
33
33
|
};
|
|
34
34
|
toggleCollapse(): void;
|
|
35
35
|
}
|
|
@@ -39,7 +39,7 @@ export declare class RangeFacet extends Facet {
|
|
|
39
39
|
active?: SearchRequestModelFilterRangeAllOfValue;
|
|
40
40
|
formatSeparator: string;
|
|
41
41
|
formatValue: string;
|
|
42
|
-
constructor(services: StoreServices
|
|
42
|
+
constructor(services: StoreServices, storage: StorageStore, facet: SearchResponseModelFacetRange, facetMeta: MetaResponseModelFacetSlider, config: FacetStoreConfig);
|
|
43
43
|
get filteredCount(): number;
|
|
44
44
|
}
|
|
45
45
|
export declare class ValueFacet extends Facet {
|
|
@@ -57,7 +57,7 @@ export declare class ValueFacet extends Facet {
|
|
|
57
57
|
toggle: (val?: boolean) => void;
|
|
58
58
|
calculate: () => void;
|
|
59
59
|
};
|
|
60
|
-
constructor(services: StoreServices
|
|
60
|
+
constructor(services: StoreServices, storage: StorageStore, facet: SearchResponseModelFacetValue, facetMeta: MetaResponseModelFacet, config: FacetStoreConfig);
|
|
61
61
|
get filteredCount(): number;
|
|
62
62
|
get refinedValues(): (FacetHierarchyValue | FacetValue | FacetRangeValue | undefined)[];
|
|
63
63
|
}
|
|
@@ -67,14 +67,14 @@ export declare class FacetValue {
|
|
|
67
67
|
filtered: boolean;
|
|
68
68
|
value: string;
|
|
69
69
|
custom: object;
|
|
70
|
-
url
|
|
70
|
+
url: UrlManager;
|
|
71
71
|
preview?: () => void;
|
|
72
|
-
constructor(services: StoreServices
|
|
72
|
+
constructor(services: StoreServices, facet: ValueFacet, value: SearchResponseModelFacetValueAllOfValues);
|
|
73
73
|
}
|
|
74
74
|
export declare class FacetHierarchyValue extends FacetValue {
|
|
75
75
|
level: number;
|
|
76
76
|
history: boolean;
|
|
77
|
-
constructor(services: StoreServices
|
|
77
|
+
constructor(services: StoreServices, facet: ValueFacet & MetaResponseModelFacetHierarchyAllOf, value: SearchResponseModelFacetValueAllOfValues, filteredValues: SearchResponseModelFacetValueAllOfValues[]);
|
|
78
78
|
}
|
|
79
79
|
export declare class FacetRangeValue {
|
|
80
80
|
label: string;
|
|
@@ -83,7 +83,7 @@ export declare class FacetRangeValue {
|
|
|
83
83
|
low: number;
|
|
84
84
|
high: number;
|
|
85
85
|
custom: object;
|
|
86
|
-
url
|
|
87
|
-
constructor(services: StoreServices
|
|
86
|
+
url: UrlManager;
|
|
87
|
+
constructor(services: StoreServices, facet: ValueFacet, value: SearchResponseModelFacetValueAllOfValues);
|
|
88
88
|
}
|
|
89
89
|
//# sourceMappingURL=SearchFacetStore.d.ts.map
|
|
@@ -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":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