@athoscommerce/snap-store-mobx 1.7.0 → 1.7.1-beta.129

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.
Files changed (47) hide show
  1. package/dist/cjs/Autocomplete/Stores/AutocompleteFacetStore.js +2 -1
  2. package/dist/cjs/Chat/ChatStore.d.ts +107 -0
  3. package/dist/cjs/Chat/ChatStore.d.ts.map +1 -0
  4. package/dist/cjs/Chat/ChatStore.js +680 -0
  5. package/dist/cjs/Chat/Stores/ChatAttachmentStore.d.ts +98 -0
  6. package/dist/cjs/Chat/Stores/ChatAttachmentStore.d.ts.map +1 -0
  7. package/dist/cjs/Chat/Stores/ChatAttachmentStore.js +316 -0
  8. package/dist/cjs/Chat/Stores/ChatCompareStore.d.ts +16 -0
  9. package/dist/cjs/Chat/Stores/ChatCompareStore.d.ts.map +1 -0
  10. package/dist/cjs/Chat/Stores/ChatCompareStore.js +64 -0
  11. package/dist/cjs/Chat/Stores/ChatSessionStore.d.ts +104 -0
  12. package/dist/cjs/Chat/Stores/ChatSessionStore.d.ts.map +1 -0
  13. package/dist/cjs/Chat/Stores/ChatSessionStore.js +638 -0
  14. package/dist/cjs/Search/Stores/SearchFacetStore.d.ts.map +1 -1
  15. package/dist/cjs/Search/Stores/SearchFacetStore.js +13 -10
  16. package/dist/cjs/Search/Stores/index.d.ts +1 -1
  17. package/dist/cjs/Search/Stores/index.d.ts.map +1 -1
  18. package/dist/cjs/Search/Stores/index.js +2 -1
  19. package/dist/cjs/index.d.ts +4 -0
  20. package/dist/cjs/index.d.ts.map +1 -1
  21. package/dist/cjs/index.js +5 -1
  22. package/dist/cjs/types.d.ts +24 -2
  23. package/dist/cjs/types.d.ts.map +1 -1
  24. package/dist/esm/Autocomplete/Stores/AutocompleteFacetStore.js +1 -1
  25. package/dist/esm/Chat/ChatStore.d.ts +107 -0
  26. package/dist/esm/Chat/ChatStore.d.ts.map +1 -0
  27. package/dist/esm/Chat/ChatStore.js +605 -0
  28. package/dist/esm/Chat/Stores/ChatAttachmentStore.d.ts +98 -0
  29. package/dist/esm/Chat/Stores/ChatAttachmentStore.d.ts.map +1 -0
  30. package/dist/esm/Chat/Stores/ChatAttachmentStore.js +224 -0
  31. package/dist/esm/Chat/Stores/ChatCompareStore.d.ts +16 -0
  32. package/dist/esm/Chat/Stores/ChatCompareStore.d.ts.map +1 -0
  33. package/dist/esm/Chat/Stores/ChatCompareStore.js +50 -0
  34. package/dist/esm/Chat/Stores/ChatSessionStore.d.ts +104 -0
  35. package/dist/esm/Chat/Stores/ChatSessionStore.d.ts.map +1 -0
  36. package/dist/esm/Chat/Stores/ChatSessionStore.js +603 -0
  37. package/dist/esm/Search/Stores/SearchFacetStore.d.ts.map +1 -1
  38. package/dist/esm/Search/Stores/SearchFacetStore.js +13 -10
  39. package/dist/esm/Search/Stores/index.d.ts +1 -1
  40. package/dist/esm/Search/Stores/index.d.ts.map +1 -1
  41. package/dist/esm/Search/Stores/index.js +1 -1
  42. package/dist/esm/index.d.ts +4 -0
  43. package/dist/esm/index.d.ts.map +1 -1
  44. package/dist/esm/index.js +2 -0
  45. package/dist/esm/types.d.ts +24 -2
  46. package/dist/esm/types.d.ts.map +1 -1
  47. package/package.json +5 -5
@@ -39,6 +39,7 @@ var AutocompleteFacetStore = /** @class */ (function (_super) {
39
39
  var _a;
40
40
  (_a = facet.values) === null || _a === void 0 ? void 0 : _a.forEach(function (value) {
41
41
  value.preview = function () {
42
+ var _a;
42
43
  facets.map(function (facet) {
43
44
  var _a;
44
45
  facet.filtered = false;
@@ -49,7 +50,7 @@ var AutocompleteFacetStore = /** @class */ (function (_super) {
49
50
  facet.filtered = true;
50
51
  value.filtered = true;
51
52
  state === null || state === void 0 ? void 0 : state.autocomplete.locks.facets.lock();
52
- value.url.go();
53
+ (_a = value.url) === null || _a === void 0 ? void 0 : _a.go();
53
54
  };
54
55
  });
55
56
  });
@@ -0,0 +1,107 @@
1
+ import { ChatStoreConfig, StoreServices } from '../types';
2
+ import { MetaStore } from '../Meta/MetaStore';
3
+ import type { MetaResponseModel, SearchResponseModelFacet } from '@athoscommerce/snapi-types';
4
+ import { AbstractStore } from '../Abstract/AbstractStore';
5
+ import type { ChatResponseModel, ChatRequestModel, ProductsResponseModel } from '@athoscommerce/snap-client';
6
+ import type { UrlManager } from '@athoscommerce/snap-url-manager';
7
+ import { StorageStore } from '@athoscommerce/snap-toolbox';
8
+ import { ChatSessionStore } from './Stores/ChatSessionStore';
9
+ import { ChatStatusResponse } from '@athoscommerce/snap-client';
10
+ import { Product } from '../Search/Stores/SearchResultStore';
11
+ import { SearchFacetStore } from '../Search/Stores/SearchFacetStore';
12
+ export declare class ChatStore extends AbstractStore<ChatStoreConfig> {
13
+ meta?: MetaStore;
14
+ inputValue: string;
15
+ open: boolean;
16
+ storage: StorageStore;
17
+ /** Session-scoped storage for the chat status response — cleared when a new
18
+ * browser session starts, so the status is rechecked on each new session. */
19
+ statusStorage: StorageStore;
20
+ services: StoreServices;
21
+ /** Detached UrlManager — holds the in-progress facet selection for the active facets display.
22
+ * Detached so .go() updates state without navigating the page. */
23
+ urlManager: UrlManager;
24
+ /** The single facet store rendered in chat — backed by the active message's facets. */
25
+ facets: SearchFacetStore;
26
+ chats: ChatSessionStore[];
27
+ currentChatId: string;
28
+ chatEnabled: boolean | null;
29
+ initChatLoading: boolean;
30
+ suggestedQuestions: string[];
31
+ welcomeMessage: string;
32
+ features: ChatStatusResponse['features'];
33
+ productQuickview: Product | null;
34
+ productQuickviewError: string | null;
35
+ /** Raw meta kept for lazy hydration of inactive chat sessions. */
36
+ private storedMetaData;
37
+ /** Tracks which message currently owns the displayed facets — guards against redundant rebuilds. */
38
+ private activeFacetsMessageId;
39
+ /** Bumps on every detached-urlManager change so observers re-evaluate isFacetSelected. */
40
+ urlVersion: number;
41
+ /** Snapshot of the applied filter state captured the last time the active message was seeded.
42
+ * Compared against the live urlManager state to decide whether there are pending changes.
43
+ * `null` means no facets have been seeded yet — there are no pending changes in that case. */
44
+ private appliedFilterSnapshot;
45
+ constructor(config: ChatStoreConfig, services: StoreServices);
46
+ /** Build a SearchFacetStore from raw facet data using the current detached urlManager.
47
+ * Synthesizes meta entries for each facet so SearchFacetStore's display/meta filter
48
+ * doesn't drop chat facets (the chat backend already decided what to send). */
49
+ private buildFacetStore;
50
+ /** Reset the detached urlManager and seed it with this message's filtered facet values,
51
+ * then rebuild the root SearchFacetStore so the UI shows the matching display. */
52
+ setActiveFacets(facets: SearchResponseModelFacet[], messageId: string | null): void;
53
+ /** Total number of selected facet values in the in-progress urlManager state, summed
54
+ * across all filter fields. Each value in a value facet, each range in a range-bucket
55
+ * facet, and the single range on a slider facet each count as one. */
56
+ get pendingFacetCount(): number;
57
+ /** Current in-progress facet selection translated into the API's `searchFilters` shape.
58
+ * Returned unconditionally (not gated on `hasPendingFacetChanges`) so callers that need
59
+ * to explicitly force a `productSearch` request — e.g. the non-multiselect facet
60
+ * click handlers — can attach the current filters without re-implementing the mapping. */
61
+ get searchFilters(): {
62
+ key: string;
63
+ options: ({
64
+ key: string;
65
+ } | {
66
+ low: string;
67
+ high: string;
68
+ })[];
69
+ }[];
70
+ /** True when the in-progress facet selection differs from the filters that were applied
71
+ * by the active productSearchResult — i.e. the user has selected/removed something that
72
+ * hasn't been sent yet. Used to decide whether to show the Apply button. */
73
+ get hasPendingFacetChanges(): boolean;
74
+ get currentChat(): ChatSessionStore | undefined;
75
+ get chatsIds(): string[];
76
+ get blocked(): boolean;
77
+ private applyChatStatusResponse;
78
+ handleChatStatusResponse(response: ChatStatusResponse): boolean;
79
+ reset(): void;
80
+ setProductQuickview(product: Product): void;
81
+ updateProductQuickview(response: ProductsResponseModel): void;
82
+ setProductQuickviewError(message: string): void;
83
+ clearProductQuickview(): void;
84
+ clearHistory(): void;
85
+ createChat(data?: {
86
+ sessionId: string;
87
+ sessionEndTime?: Date;
88
+ }): ChatSessionStore;
89
+ switchChat(id: string): void;
90
+ sendProductQuery(result: any, options: {
91
+ requestType: 'productQuery' | 'productSimilar' | 'productComparison';
92
+ }): void;
93
+ compareProduct(result: any): void;
94
+ addFacet(facet: {
95
+ key: string;
96
+ value: string;
97
+ }): void;
98
+ removeFacet(key: string, value: string): void;
99
+ clearPendingFacets(): void;
100
+ isFacetSelected(key: string, value: string): boolean;
101
+ request(request: ChatRequestModel): void;
102
+ update(data: {
103
+ chat: ChatResponseModel;
104
+ meta: MetaResponseModel;
105
+ }): void;
106
+ }
107
+ //# sourceMappingURL=ChatStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatStore.d.ts","sourceRoot":"","sources":["../../../src/Chat/ChatStore.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAC7G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAY,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAIrE,qBAAa,SAAU,SAAQ,aAAa,CAAC,eAAe,CAAC;IACrD,IAAI,CAAC,EAAE,SAAS,CAAa;IAC7B,UAAU,EAAE,MAAM,CAAM;IACxB,IAAI,EAAE,OAAO,CAAS;IACtB,OAAO,EAAE,YAAY,CA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