@athoscommerce/snap-store-mobx 1.2.3-beta.1 → 1.3.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.
Files changed (43) hide show
  1. package/dist/cjs/Autocomplete/AutocompleteStore.js +2 -2
  2. package/dist/cjs/Search/Stores/index.d.ts +1 -1
  3. package/dist/cjs/Search/Stores/index.d.ts.map +1 -1
  4. package/dist/cjs/Search/Stores/index.js +1 -2
  5. package/dist/cjs/index.d.ts +0 -4
  6. package/dist/cjs/index.d.ts.map +1 -1
  7. package/dist/cjs/index.js +1 -5
  8. package/dist/cjs/types.d.ts +2 -13
  9. package/dist/cjs/types.d.ts.map +1 -1
  10. package/dist/esm/Autocomplete/AutocompleteStore.js +1 -1
  11. package/dist/esm/Search/Stores/index.d.ts +1 -1
  12. package/dist/esm/Search/Stores/index.d.ts.map +1 -1
  13. package/dist/esm/Search/Stores/index.js +1 -1
  14. package/dist/esm/index.d.ts +0 -4
  15. package/dist/esm/index.d.ts.map +1 -1
  16. package/dist/esm/index.js +0 -2
  17. package/dist/esm/types.d.ts +2 -13
  18. package/dist/esm/types.d.ts.map +1 -1
  19. package/package.json +5 -5
  20. package/dist/cjs/Chat/ChatStore.d.ts +0 -55
  21. package/dist/cjs/Chat/ChatStore.d.ts.map +0 -1
  22. package/dist/cjs/Chat/ChatStore.js +0 -368
  23. package/dist/cjs/Chat/Stores/ChatAttachmentStore.d.ts +0 -98
  24. package/dist/cjs/Chat/Stores/ChatAttachmentStore.d.ts.map +0 -1
  25. package/dist/cjs/Chat/Stores/ChatAttachmentStore.js +0 -312
  26. package/dist/cjs/Chat/Stores/ChatCompareStore.d.ts +0 -14
  27. package/dist/cjs/Chat/Stores/ChatCompareStore.d.ts.map +0 -1
  28. package/dist/cjs/Chat/Stores/ChatCompareStore.js +0 -63
  29. package/dist/cjs/Chat/Stores/ChatSessionStore.d.ts +0 -103
  30. package/dist/cjs/Chat/Stores/ChatSessionStore.d.ts.map +0 -1
  31. package/dist/cjs/Chat/Stores/ChatSessionStore.js +0 -612
  32. package/dist/esm/Chat/ChatStore.d.ts +0 -55
  33. package/dist/esm/Chat/ChatStore.d.ts.map +0 -1
  34. package/dist/esm/Chat/ChatStore.js +0 -309
  35. package/dist/esm/Chat/Stores/ChatAttachmentStore.d.ts +0 -98
  36. package/dist/esm/Chat/Stores/ChatAttachmentStore.d.ts.map +0 -1
  37. package/dist/esm/Chat/Stores/ChatAttachmentStore.js +0 -220
  38. package/dist/esm/Chat/Stores/ChatCompareStore.d.ts +0 -14
  39. package/dist/esm/Chat/Stores/ChatCompareStore.d.ts.map +0 -1
  40. package/dist/esm/Chat/Stores/ChatCompareStore.js +0 -49
  41. package/dist/esm/Chat/Stores/ChatSessionStore.d.ts +0 -103
  42. package/dist/esm/Chat/Stores/ChatSessionStore.d.ts.map +0 -1
  43. package/dist/esm/Chat/Stores/ChatSessionStore.js +0 -581
@@ -1,312 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
28
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
- Object.defineProperty(exports, "__esModule", { value: true });
54
- exports.ChatAttachmentImage = exports.ChatAttachmentFacet = exports.ChatAttachmentProduct = exports.ChatAttachmentStore = void 0;
55
- // TODO: implement
56
- // how should localStorage be handled for attachments?
57
- var uuid_1 = require("uuid");
58
- var mobx_1 = require("mobx");
59
- var ChatAttachmentStore = /** @class */ (function () {
60
- function ChatAttachmentStore() {
61
- this.items = [];
62
- (0, mobx_1.makeObservable)(this, {
63
- items: mobx_1.observable,
64
- attached: mobx_1.computed,
65
- compared: mobx_1.computed,
66
- });
67
- }
68
- Object.defineProperty(ChatAttachmentStore.prototype, "attached", {
69
- get: function () {
70
- return this.items.filter(function (item) { return item.state !== 'saved'; });
71
- },
72
- enumerable: false,
73
- configurable: true
74
- });
75
- Object.defineProperty(ChatAttachmentStore.prototype, "compared", {
76
- get: function () {
77
- return this.items
78
- .filter(function (item) { return item.state !== 'saved'; })
79
- .filter(function (item) { return item.type === 'product'; })
80
- .filter(function (item) { return item.requestType === 'productComparison'; });
81
- },
82
- enumerable: false,
83
- configurable: true
84
- });
85
- ChatAttachmentStore.prototype.add = function (attachment) {
86
- var _this = this;
87
- // TODO: check if attachment already exists
88
- switch (attachment.type) {
89
- case 'image': {
90
- // if there are currently any other attachments remove them
91
- this.items.forEach(function (item) {
92
- _this.remove(item.id);
93
- });
94
- var newAttachment = new ChatAttachmentImage(attachment);
95
- this.items.push(newAttachment);
96
- return newAttachment;
97
- }
98
- case 'product': {
99
- // 'productSimilar' and 'productQuery' are single-product flows — replace any
100
- // existing attachments so the conversation only targets the latest product
101
- if (attachment.requestType === 'productSimilar' || attachment.requestType === 'productQuery') {
102
- this.items.forEach(function (item) {
103
- _this.remove(item.id);
104
- });
105
- var newAttachment_1 = new ChatAttachmentProduct(attachment);
106
- this.items.unshift(newAttachment_1);
107
- return newAttachment_1;
108
- }
109
- // For 'productQuery' or 'productComparison', continue with existing logic
110
- // if there are currently any other attachments remove them
111
- this.items.forEach(function (item) {
112
- if (item.type !== 'product') {
113
- _this.remove(item.id);
114
- }
115
- });
116
- // check if product is already attached
117
- var existingProductAttachment = this.items.find(function (item) {
118
- return item.type === 'product' &&
119
- (item.state === 'active' || item.state === 'attached') &&
120
- item.productId === attachment.productId;
121
- });
122
- if (existingProductAttachment) {
123
- existingProductAttachment.requestType = attachment.requestType; // changes existing attachments to the incoming requestType
124
- return existingProductAttachment;
125
- }
126
- // if there are already two product attachments, remove until only one remains
127
- var productAttachments = this.items.filter(function (item) { return item.type === 'product' && (item.state === 'active' || item.state === 'attached'); });
128
- while (productAttachments.length >= 2) {
129
- var toRemove = productAttachments.pop();
130
- if (toRemove) {
131
- this.remove(toRemove.id);
132
- }
133
- }
134
- this.items.forEach(function (item) {
135
- item.requestType = attachment.requestType; // changes existing attachments to the incoming requestType
136
- });
137
- var newAttachment = new ChatAttachmentProduct(attachment);
138
- this.items.unshift(newAttachment);
139
- return newAttachment;
140
- }
141
- case 'facet': {
142
- // if there are currently any non-facet attachments remove them
143
- this.items.forEach(function (item) {
144
- if (item.type !== 'facet') {
145
- _this.remove(item.id);
146
- }
147
- });
148
- // check if this exact facet value is already attached
149
- var existingFacet = this.items.find(function (item) {
150
- return item.type === 'facet' &&
151
- item.key === attachment.key &&
152
- item.value === attachment.value &&
153
- (item.state === 'active' || item.state === 'attached');
154
- });
155
- if (existingFacet) {
156
- return existingFacet;
157
- }
158
- var newAttachment = new ChatAttachmentFacet(attachment);
159
- this.items.push(newAttachment);
160
- return newAttachment;
161
- }
162
- }
163
- };
164
- ChatAttachmentStore.prototype.remove = function (id) {
165
- var index = this.items.findIndex(function (item) { return item.id === id; });
166
- var attachment = this.items[index];
167
- if (attachment.state === 'active' || attachment.state === 'saved') {
168
- attachment.save();
169
- }
170
- else {
171
- if (index !== -1) {
172
- this.items.splice(index, 1);
173
- }
174
- }
175
- };
176
- ChatAttachmentStore.prototype.get = function (id) {
177
- return this.items.find(function (item) { return item.id === id; });
178
- };
179
- ChatAttachmentStore.prototype.reset = function () {
180
- this.items = [];
181
- };
182
- // Restore serialized attachments from storage without running the add() dedup logic,
183
- // which would otherwise drop earlier images when multiple attachments are loaded.
184
- ChatAttachmentStore.prototype.hydrate = function (attachments) {
185
- var _this = this;
186
- attachments.forEach(function (attachment) {
187
- switch (attachment.type) {
188
- case 'image':
189
- _this.items.push(new ChatAttachmentImage(attachment));
190
- break;
191
- case 'product':
192
- _this.items.push(new ChatAttachmentProduct(attachment));
193
- break;
194
- case 'facet':
195
- _this.items.push(new ChatAttachmentFacet(attachment));
196
- break;
197
- }
198
- });
199
- };
200
- return ChatAttachmentStore;
201
- }());
202
- exports.ChatAttachmentStore = ChatAttachmentStore;
203
- var ChatAttachment = /** @class */ (function () {
204
- function ChatAttachment(params) {
205
- if (params === void 0) { params = {}; }
206
- var _a, _b, _c, _d;
207
- this.state = 'loading';
208
- this.error = undefined;
209
- this.id = (_b = (_a = params.data) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : (0, uuid_1.v4)();
210
- this.state = (_d = (_c = params.data) === null || _c === void 0 ? void 0 : _c.state) !== null && _d !== void 0 ? _d : 'loading';
211
- (0, mobx_1.makeObservable)(this, {
212
- id: mobx_1.observable,
213
- state: mobx_1.observable,
214
- error: mobx_1.observable,
215
- });
216
- }
217
- ChatAttachment.prototype.save = function () {
218
- this.state = 'saved';
219
- };
220
- ChatAttachment.prototype.activate = function () {
221
- this.state = 'active';
222
- };
223
- return ChatAttachment;
224
- }());
225
- var ChatAttachmentProduct = /** @class */ (function (_super) {
226
- __extends(ChatAttachmentProduct, _super);
227
- function ChatAttachmentProduct(_a) {
228
- var id = _a.id, productId = _a.productId, thumbnailUrl = _a.thumbnailUrl, name = _a.name, requestType = _a.requestType, state = _a.state, error = _a.error;
229
- var _this = _super.call(this, { data: { id: id, state: state, error: error } }) || this;
230
- _this.type = 'product';
231
- _this.state = state !== null && state !== void 0 ? state : 'attached';
232
- _this.productId = productId;
233
- _this.thumbnailUrl = thumbnailUrl;
234
- _this.name = name;
235
- _this.requestType = requestType;
236
- (0, mobx_1.makeObservable)(_this, {
237
- type: mobx_1.observable,
238
- productId: mobx_1.observable,
239
- thumbnailUrl: mobx_1.observable,
240
- name: mobx_1.observable,
241
- requestType: mobx_1.observable,
242
- });
243
- return _this;
244
- }
245
- return ChatAttachmentProduct;
246
- }(ChatAttachment));
247
- exports.ChatAttachmentProduct = ChatAttachmentProduct;
248
- var ChatAttachmentFacet = /** @class */ (function (_super) {
249
- __extends(ChatAttachmentFacet, _super);
250
- function ChatAttachmentFacet(_a) {
251
- var id = _a.id, key = _a.key, facetLabel = _a.facetLabel, value = _a.value, label = _a.label, count = _a.count, state = _a.state, error = _a.error;
252
- var _this = _super.call(this, { data: { id: id, state: state, error: error } }) || this;
253
- _this.type = 'facet';
254
- _this.state = state !== null && state !== void 0 ? state : 'attached';
255
- _this.key = key;
256
- _this.facetLabel = facetLabel;
257
- _this.value = value;
258
- _this.label = label;
259
- _this.count = count;
260
- (0, mobx_1.makeObservable)(_this, {
261
- type: mobx_1.observable,
262
- key: mobx_1.observable,
263
- facetLabel: mobx_1.observable,
264
- value: mobx_1.observable,
265
- label: mobx_1.observable,
266
- });
267
- return _this;
268
- }
269
- return ChatAttachmentFacet;
270
- }(ChatAttachment));
271
- exports.ChatAttachmentFacet = ChatAttachmentFacet;
272
- var ChatAttachmentImage = /** @class */ (function (_super) {
273
- __extends(ChatAttachmentImage, _super);
274
- function ChatAttachmentImage(_a) {
275
- var id = _a.id, base64 = _a.base64, fileName = _a.fileName, imageId = _a.imageId, imageUrl = _a.imageUrl, thumbnailUrl = _a.thumbnailUrl, state = _a.state, error = _a.error;
276
- var _this = _super.call(this, { data: { id: id, state: state, error: error } }) || this;
277
- _this.type = 'image';
278
- // used to update attachment after upload or from
279
- _this.update = function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
280
- var imageId = _b.imageId, imageUrl = _b.imageUrl, thumbnailUrl = _b.thumbnailUrl, error = _b.error;
281
- return __generator(this, function (_c) {
282
- if (imageId && imageUrl && thumbnailUrl) {
283
- this.state = 'attached';
284
- this.imageId = imageId;
285
- this.imageUrl = imageUrl;
286
- this.thumbnailUrl = thumbnailUrl;
287
- }
288
- else if (error) {
289
- this.state = 'error';
290
- this.error = error;
291
- }
292
- return [2 /*return*/];
293
- });
294
- }); };
295
- _this.base64 = base64;
296
- _this.fileName = fileName;
297
- _this.imageId = imageId;
298
- _this.imageUrl = imageUrl;
299
- _this.thumbnailUrl = thumbnailUrl;
300
- (0, mobx_1.makeObservable)(_this, {
301
- type: mobx_1.observable,
302
- imageId: mobx_1.observable,
303
- imageUrl: mobx_1.observable,
304
- thumbnailUrl: mobx_1.observable,
305
- base64: mobx_1.observable,
306
- fileName: mobx_1.observable,
307
- });
308
- return _this;
309
- }
310
- return ChatAttachmentImage;
311
- }(ChatAttachment));
312
- exports.ChatAttachmentImage = ChatAttachmentImage;
@@ -1,14 +0,0 @@
1
- export declare class ChatCompareStore {
2
- items: any[];
3
- committedItems: any[];
4
- maxItems: number;
5
- constructor();
6
- add(item: any): void;
7
- remove(itemId: string): void;
8
- reset(): void;
9
- resetCommitted(): void;
10
- commit(): void;
11
- get compared(): any[];
12
- get committed(): any[];
13
- }
14
- //# sourceMappingURL=ChatCompareStore.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChatCompareStore.d.ts","sourceRoot":"","sources":["../../../../src/Chat/Stores/ChatCompareStore.ts"],"names":[],"mappings":"AAEA,qBAAa,gBAAgB;IACrB,KAAK,EAAE,GAAG,EAAE,CAAM;IAClB,cAAc,EAAE,GAAG,EAAE,CAAM;IAC3B,QAAQ,EAAE,MAAM,CAAK;;IAa5B,GAAG,CAAC,IAAI,EAAE,GAAG;IAYb,MAAM,CAAC,MAAM,EAAE,MAAM;IAIrB,KAAK;IAIL,cAAc;IAKd,MAAM;IAON,IAAI,QAAQ,UAEX;IAED,IAAI,SAAS,UAEZ;CACD"}
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChatCompareStore = void 0;
4
- var mobx_1 = require("mobx");
5
- var ChatCompareStore = /** @class */ (function () {
6
- function ChatCompareStore() {
7
- this.items = [];
8
- this.committedItems = [];
9
- this.maxItems = 4;
10
- (0, mobx_1.makeObservable)(this, {
11
- items: mobx_1.observable,
12
- committedItems: mobx_1.observable,
13
- maxItems: mobx_1.observable,
14
- compared: mobx_1.computed,
15
- committed: mobx_1.computed,
16
- });
17
- }
18
- // add, remove, reset methods
19
- ChatCompareStore.prototype.add = function (item) {
20
- var _a;
21
- // prevent adding the same product to the comparison twice
22
- if (((_a = item.result) === null || _a === void 0 ? void 0 : _a.id) && this.items.some(function (existing) { var _a; return ((_a = existing.result) === null || _a === void 0 ? void 0 : _a.id) === item.result.id; })) {
23
- return;
24
- }
25
- if (this.items.length >= this.maxItems) {
26
- // handle max items reached, e.g. remove the oldest item
27
- this.items.shift();
28
- }
29
- this.items.push(item);
30
- };
31
- ChatCompareStore.prototype.remove = function (itemId) {
32
- this.items = this.items.filter(function (item) { var _a; return ((_a = item.result) === null || _a === void 0 ? void 0 : _a.id) !== itemId; });
33
- };
34
- ChatCompareStore.prototype.reset = function () {
35
- this.items = [];
36
- };
37
- ChatCompareStore.prototype.resetCommitted = function () {
38
- this.committedItems = [];
39
- };
40
- // move the current items to the committed list and clear items
41
- ChatCompareStore.prototype.commit = function () {
42
- if (this.items.length > 0) {
43
- this.committedItems = this.items.slice();
44
- this.items = [];
45
- }
46
- };
47
- Object.defineProperty(ChatCompareStore.prototype, "compared", {
48
- get: function () {
49
- return this.items;
50
- },
51
- enumerable: false,
52
- configurable: true
53
- });
54
- Object.defineProperty(ChatCompareStore.prototype, "committed", {
55
- get: function () {
56
- return this.committedItems;
57
- },
58
- enumerable: false,
59
- configurable: true
60
- });
61
- return ChatCompareStore;
62
- }());
63
- exports.ChatCompareStore = ChatCompareStore;
@@ -1,103 +0,0 @@
1
- import type { ChatResponseModel, ChatRequestModel, ChatResponseTextData, ChatResponseProductSearchResultData, ChatResponseInspirationResultData, ChatResponseContentData, ChatResponseProductAnswerData, ChatResponseProductComparisonData, ChatResponseProductRecommendationData, ChatResponseErrorData, ChatResponseTopicDriftData } from '@athoscommerce/snap-client';
2
- import { ChatAttachmentAddAttachment, ChatAttachmentStore } from '../Stores/ChatAttachmentStore';
3
- import type { StorageStore } from '../../Storage/StorageStore';
4
- import { MetaResponseModel } from '@athoscommerce/snapi-types';
5
- import { ChatCompareStore } from './ChatCompareStore';
6
- export type ChatFeedbacks = {
7
- messageId: string;
8
- rating: 'UP' | 'DOWN';
9
- };
10
- export type ChatSessionFeedback = {
11
- rating: 'UP' | 'DOWN';
12
- };
13
- export type ChatUserMessage = {
14
- id: string;
15
- messageType: 'user';
16
- text: string;
17
- attachments?: string[];
18
- requestType?: string;
19
- };
20
- export type ChatProductQueryMessageData = {
21
- id: string;
22
- messageType: 'productQuery';
23
- sourceProduct: any;
24
- sourceMessageId?: string;
25
- };
26
- export type ChatSystemMessage = ChatResponseTextData | ChatResponseContentData | ChatResponseProductSearchResultData | ChatResponseInspirationResultData | ChatResponseProductAnswerData | ChatResponseProductComparisonData | ChatResponseProductRecommendationData | ChatResponseErrorData | ChatResponseTopicDriftData | ChatProductQueryMessageData;
27
- export type ChatMessage = ChatUserMessage | ChatSystemMessage;
28
- type ChatSessionStoreConfig = {
29
- data?: {
30
- id?: string;
31
- sessionId?: string;
32
- chat?: ChatMessage[];
33
- attachments?: ChatAttachmentAddAttachment[];
34
- actions?: ChatActions;
35
- feedbacks?: ChatFeedbacks[];
36
- sessionFeedback?: ChatSessionFeedback | null;
37
- feedbackDismissed?: boolean;
38
- createdAt?: Date;
39
- committedComparisons?: any[];
40
- };
41
- stores: {
42
- storage: StorageStore;
43
- };
44
- };
45
- export type FacetsData = {
46
- type: 'facets';
47
- data: any;
48
- };
49
- export type ActionsData = {
50
- type: 'actions';
51
- data: any;
52
- };
53
- export type ChatActions = (FacetsData | ActionsData)[];
54
- export declare class ChatSessionStore {
55
- chat: ChatMessage[];
56
- actions: ChatActions;
57
- id: string;
58
- sessionId?: string;
59
- attachments: ChatAttachmentStore;
60
- comparisons: ChatCompareStore;
61
- storage: StorageStore;
62
- feedbacks: ChatFeedbacks[];
63
- sessionFeedback: ChatSessionFeedback | null;
64
- feedbackDismissed: boolean;
65
- feedbackJustGiven: boolean;
66
- createdAt: Date;
67
- requestType: string;
68
- dismissedSideChatMessageId: string | null;
69
- activeMessageId: string | null;
70
- sessionLimitReached: boolean;
71
- /** Whether raw stored results have been hydrated into Product/SearchResultStore instances. */
72
- hydrated: boolean;
73
- constructor(params: ChatSessionStoreConfig);
74
- dismissSideChat(): void;
75
- setActiveMessage(id: string): void;
76
- pushProductQueryMessage(result: any): void;
77
- popProductQueryMessage(restoreActiveMessageId?: string): void;
78
- get isExpired(): boolean;
79
- get topicDrift(): ChatResponseTopicDriftData | null;
80
- get activeMessage(): ChatMessage | null;
81
- dismissTopicDrift(): void;
82
- handleTopicDrift(): string | undefined;
83
- reset(): void;
84
- private saveTimerId;
85
- /** Persist the session to storage immediately (synchronous). */
86
- saveImmediate(): void;
87
- /**
88
- * Schedule a save — multiple calls within the debounce window are coalesced
89
- * into a single localStorage write.
90
- */
91
- save(): void;
92
- /** Remove oldest stored sessions when exceeding the limit. */
93
- static pruneStoredSessions(storage: StorageStore, maxSessions?: number): void;
94
- /** Re-wrap raw stored results as Product / SearchResultStore instances. */
95
- hydrateResults(meta: MetaResponseModel): void;
96
- request(request: ChatRequestModel): void;
97
- update(data: {
98
- chat: ChatResponseModel;
99
- meta: MetaResponseModel;
100
- }): void;
101
- }
102
- export {};
103
- //# sourceMappingURL=ChatSessionStore.d.ts.map
@@ -1 +0,0 @@
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,qBAA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