@athoscommerce/snap-store-mobx 1.2.2 → 1.2.3-beta.1
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/Chat/ChatStore.d.ts +55 -0
- package/dist/cjs/Chat/ChatStore.d.ts.map +1 -0
- package/dist/cjs/Chat/ChatStore.js +368 -0
- package/dist/cjs/Chat/Stores/ChatAttachmentStore.d.ts +98 -0
- package/dist/cjs/Chat/Stores/ChatAttachmentStore.d.ts.map +1 -0
- package/dist/cjs/Chat/Stores/ChatAttachmentStore.js +312 -0
- package/dist/cjs/Chat/Stores/ChatCompareStore.d.ts +14 -0
- package/dist/cjs/Chat/Stores/ChatCompareStore.d.ts.map +1 -0
- package/dist/cjs/Chat/Stores/ChatCompareStore.js +63 -0
- package/dist/cjs/Chat/Stores/ChatSessionStore.d.ts +103 -0
- package/dist/cjs/Chat/Stores/ChatSessionStore.d.ts.map +1 -0
- package/dist/cjs/Chat/Stores/ChatSessionStore.js +612 -0
- package/dist/cjs/Search/Stores/index.d.ts +1 -1
- package/dist/cjs/Search/Stores/index.d.ts.map +1 -1
- package/dist/cjs/Search/Stores/index.js +2 -1
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/types.d.ts +13 -2
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/Chat/ChatStore.d.ts +55 -0
- package/dist/esm/Chat/ChatStore.d.ts.map +1 -0
- package/dist/esm/Chat/ChatStore.js +309 -0
- package/dist/esm/Chat/Stores/ChatAttachmentStore.d.ts +98 -0
- package/dist/esm/Chat/Stores/ChatAttachmentStore.d.ts.map +1 -0
- package/dist/esm/Chat/Stores/ChatAttachmentStore.js +220 -0
- package/dist/esm/Chat/Stores/ChatCompareStore.d.ts +14 -0
- package/dist/esm/Chat/Stores/ChatCompareStore.d.ts.map +1 -0
- package/dist/esm/Chat/Stores/ChatCompareStore.js +49 -0
- package/dist/esm/Chat/Stores/ChatSessionStore.d.ts +103 -0
- package/dist/esm/Chat/Stores/ChatSessionStore.d.ts.map +1 -0
- package/dist/esm/Chat/Stores/ChatSessionStore.js +581 -0
- package/dist/esm/Search/Stores/index.d.ts +1 -1
- package/dist/esm/Search/Stores/index.d.ts.map +1 -1
- package/dist/esm/Search/Stores/index.js +1 -1
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/types.d.ts +13 -2
- package/dist/esm/types.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/cjs/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.MetaStore = exports.StorageType = exports.StorageStore = exports.CartStore = exports.RecommendationStore = exports.SearchStore = exports.FinderStore = exports.AutocompleteStore = exports.AbstractStore = void 0;
|
|
17
|
+
exports.ChatSessionStore = exports.MetaStore = exports.StorageType = exports.StorageStore = exports.CartStore = exports.RecommendationStore = exports.ChatStore = exports.SearchStore = exports.FinderStore = exports.AutocompleteStore = exports.AbstractStore = void 0;
|
|
18
18
|
var AbstractStore_1 = require("./Abstract/AbstractStore");
|
|
19
19
|
Object.defineProperty(exports, "AbstractStore", { enumerable: true, get: function () { return AbstractStore_1.AbstractStore; } });
|
|
20
20
|
var AutocompleteStore_1 = require("./Autocomplete/AutocompleteStore");
|
|
@@ -23,6 +23,8 @@ var FinderStore_1 = require("./Finder/FinderStore");
|
|
|
23
23
|
Object.defineProperty(exports, "FinderStore", { enumerable: true, get: function () { return FinderStore_1.FinderStore; } });
|
|
24
24
|
var SearchStore_1 = require("./Search/SearchStore");
|
|
25
25
|
Object.defineProperty(exports, "SearchStore", { enumerable: true, get: function () { return SearchStore_1.SearchStore; } });
|
|
26
|
+
var ChatStore_1 = require("./Chat/ChatStore");
|
|
27
|
+
Object.defineProperty(exports, "ChatStore", { enumerable: true, get: function () { return ChatStore_1.ChatStore; } });
|
|
26
28
|
__exportStar(require("./Search/Stores/"), exports);
|
|
27
29
|
__exportStar(require("./Autocomplete/Stores/"), exports);
|
|
28
30
|
var RecommendationStore_1 = require("./Recommendation/RecommendationStore");
|
|
@@ -35,3 +37,5 @@ Object.defineProperty(exports, "StorageType", { enumerable: true, get: function
|
|
|
35
37
|
var MetaStore_1 = require("./Meta/MetaStore");
|
|
36
38
|
Object.defineProperty(exports, "MetaStore", { enumerable: true, get: function () { return MetaStore_1.MetaStore; } });
|
|
37
39
|
__exportStar(require("./types"), exports);
|
|
40
|
+
var ChatSessionStore_1 = require("./Chat/Stores/ChatSessionStore");
|
|
41
|
+
Object.defineProperty(exports, "ChatSessionStore", { enumerable: true, get: function () { return ChatSessionStore_1.ChatSessionStore; } });
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { UrlManager } from '@athoscommerce/snap-url-manager';
|
|
2
|
-
import type { RecommendRequestModel } from '@athoscommerce/snap-client';
|
|
2
|
+
import type { ChatRequestModel, RecommendRequestModel } from '@athoscommerce/snap-client';
|
|
3
3
|
import type { SearchResponseModelFacetValueAllOfValues, AutocompleteRequestModel, SearchRequestModel, MetaResponseModelBadgeTag, SearchResponseModelResultBadges } from '@athoscommerce/snapi-types';
|
|
4
4
|
export type BeaconSettings = {
|
|
5
5
|
enabled: boolean;
|
|
@@ -69,6 +69,17 @@ export type VariantOptionConfigMappings = {
|
|
|
69
69
|
backgroundImageUrl?: string;
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
|
+
export type ChatStoreConfig = StoreConfig & {
|
|
73
|
+
globals?: Partial<ChatRequestModel>;
|
|
74
|
+
settings?: ChatStoreConfigSettings;
|
|
75
|
+
siteId?: string;
|
|
76
|
+
};
|
|
77
|
+
export type ChatStoreConfigSettings = {
|
|
78
|
+
displayFields?: string[];
|
|
79
|
+
addToCart?: (products: any) => void;
|
|
80
|
+
feedbackAfterMessages?: number;
|
|
81
|
+
[key: string]: unknown;
|
|
82
|
+
};
|
|
72
83
|
export type SearchStoreConfig = StoreConfig & {
|
|
73
84
|
globals?: Partial<SearchRequestModel>;
|
|
74
85
|
settings?: SearchStoreConfigSettings;
|
|
@@ -153,7 +164,7 @@ export type RecommendationStoreConfig = StoreConfig & {
|
|
|
153
164
|
searchOnPageShow?: boolean;
|
|
154
165
|
};
|
|
155
166
|
};
|
|
156
|
-
export type StoreConfigs = SearchStoreConfig | AutocompleteStoreConfig | FinderStoreConfig | RecommendationStoreConfig;
|
|
167
|
+
export type StoreConfigs = SearchStoreConfig | AutocompleteStoreConfig | FinderStoreConfig | RecommendationStoreConfig | ChatStoreConfig;
|
|
157
168
|
export type StoreServices = {
|
|
158
169
|
urlManager: UrlManager;
|
|
159
170
|
};
|
package/dist/cjs/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAC1F,OAAO,KAAK,EACX,wCAAwC,EACxC,wBAAwB,EACxB,kBAAkB,EAClB,yBAAyB,EACzB,+BAA+B,EAC/B,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,cAAc,GAAG;IAC5B,OAAO,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,YAAY,GAAG,iBAAiB,GAAG,uBAAuB,GAAG,iBAAiB,GAAG,yBAAyB,GAAG,eAAe,CAAC;AAEzI,MAAM,MAAM,aAAa,GAAG;IAC3B,UAAU,EAAE,UAAU,CAAC;CACvB,CAAC;AAEF,oBAAY,SAAS;IACpB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,KAAK,UAAU;CACf;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,wCAAwC,EAAE,CAAC;IACjD,KAAK,EAAE,GAAG,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,yBAAyB,GAAG,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ChatStoreConfig } from '../types';
|
|
2
|
+
import { MetaStore } from '../Meta/MetaStore';
|
|
3
|
+
import type { MetaResponseModel } from '@athoscommerce/snapi-types';
|
|
4
|
+
import { AbstractStore } from '../Abstract/AbstractStore';
|
|
5
|
+
import type { ChatResponseModel, ChatRequestModel, ProductsResponseModel } from '@athoscommerce/snap-client';
|
|
6
|
+
import { StorageStore } from '../Storage/StorageStore';
|
|
7
|
+
import { ChatSessionStore } from './Stores/ChatSessionStore';
|
|
8
|
+
import { ChatStatusResponse } from '@athoscommerce/snap-client';
|
|
9
|
+
import { Product } from '../Search/Stores/SearchResultStore';
|
|
10
|
+
export declare class ChatStore extends AbstractStore<ChatStoreConfig> {
|
|
11
|
+
meta?: MetaStore;
|
|
12
|
+
inputValue: string;
|
|
13
|
+
open: boolean;
|
|
14
|
+
storage: StorageStore;
|
|
15
|
+
chats: ChatSessionStore[];
|
|
16
|
+
currentChatId: string;
|
|
17
|
+
chatEnabled: boolean | null;
|
|
18
|
+
initChatLoading: boolean;
|
|
19
|
+
suggestedQuestions: string[];
|
|
20
|
+
welcomeMessage: string;
|
|
21
|
+
features: ChatStatusResponse['features'];
|
|
22
|
+
productQuickview: Product | null;
|
|
23
|
+
productQuickviewError: string | null;
|
|
24
|
+
/** Raw meta kept for lazy hydration of inactive chat sessions. */
|
|
25
|
+
private storedMetaData;
|
|
26
|
+
constructor(config: ChatStoreConfig);
|
|
27
|
+
get currentChat(): ChatSessionStore | undefined;
|
|
28
|
+
get chatsIds(): string[];
|
|
29
|
+
get blocked(): boolean;
|
|
30
|
+
handleChatStatusResponse(response: ChatStatusResponse): boolean;
|
|
31
|
+
reset(): void;
|
|
32
|
+
setProductQuickview(product: Product): void;
|
|
33
|
+
updateProductQuickview(response: ProductsResponseModel): void;
|
|
34
|
+
setProductQuickviewError(message: string): void;
|
|
35
|
+
clearProductQuickview(): void;
|
|
36
|
+
clearHistory(): void;
|
|
37
|
+
createChat(data?: {
|
|
38
|
+
sessionId: string;
|
|
39
|
+
}): ChatSessionStore;
|
|
40
|
+
switchChat(id: string): void;
|
|
41
|
+
sendProductQuery(result: any, options: {
|
|
42
|
+
requestType: 'productQuery' | 'productSimilar' | 'productComparison';
|
|
43
|
+
}): void;
|
|
44
|
+
compareProduct(result: any): void;
|
|
45
|
+
addFacet(facet: any): void;
|
|
46
|
+
removeFacet(key: string, value: string): void;
|
|
47
|
+
clearPendingFacets(): void;
|
|
48
|
+
isFacetSelected(key: string, value: string): boolean;
|
|
49
|
+
request(request: ChatRequestModel): void;
|
|
50
|
+
update(data: {
|
|
51
|
+
chat: ChatResponseModel;
|
|
52
|
+
meta: MetaResponseModel;
|
|
53
|
+
}): void;
|
|
54
|
+
}
|
|
55
|
+
//# 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,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACp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,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI;IA8B7D,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI/C,qBAAqB,IAAI,IAAI;IAK7B,YAAY,IAAI,IAAI;IAoBpB,UAAU,CAAC,IAAI,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,gBAAgB;IAkB1D,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAY5B,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE;QAAE,WAAW,EAAE,cAAc,GAAG,gBAAgB,GAAG,mBAAmB,CAAA;KAAE,GAAG,IAAI;IAkBtH,cAAc,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI;IAMjC,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;IAW1B,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAgB7C,kBAAkB,IAAI,IAAI;IAW1B,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAYpD,OAAO,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAmBxC,MAAM,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,iBAAiB,CAAC;QAAC,IAAI,EAAE,iBAAiB,CAAA;KAAE,GAAG,IAAI;CAkB/E"}
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { makeObservable, observable, computed } from 'mobx';
|
|
2
|
+
import { MetaStore } from '../Meta/MetaStore';
|
|
3
|
+
import { AbstractStore } from '../Abstract/AbstractStore';
|
|
4
|
+
import { StorageStore } from '../Storage/StorageStore';
|
|
5
|
+
import { ChatSessionStore } from './Stores/ChatSessionStore';
|
|
6
|
+
import { Variants } from '../Search/Stores/SearchResultStore';
|
|
7
|
+
const CHAT_STATUS_EXPIRATION_TIME = 1000 * 60 * 60 * 12; // 12 hours
|
|
8
|
+
export class ChatStore extends AbstractStore {
|
|
9
|
+
constructor(config) {
|
|
10
|
+
super(config);
|
|
11
|
+
this.meta = undefined;
|
|
12
|
+
this.inputValue = '';
|
|
13
|
+
this.open = false;
|
|
14
|
+
this.chats = [];
|
|
15
|
+
this.chatEnabled = null;
|
|
16
|
+
this.initChatLoading = false;
|
|
17
|
+
this.suggestedQuestions = [];
|
|
18
|
+
this.welcomeMessage = '';
|
|
19
|
+
this.features = { imageSearch: { enabled: false }, similarProducts: { enabled: false } };
|
|
20
|
+
this.productQuickview = null;
|
|
21
|
+
this.productQuickviewError = null;
|
|
22
|
+
/** Raw meta kept for lazy hydration of inactive chat sessions. */
|
|
23
|
+
this.storedMetaData = null;
|
|
24
|
+
const legacyKey = `ss-${this.config.id}`;
|
|
25
|
+
const storageKey = this.config.siteId ? `ss-${this.config.siteId}-${this.config.id}` : legacyKey;
|
|
26
|
+
this.storage = new StorageStore({
|
|
27
|
+
type: 'local',
|
|
28
|
+
key: storageKey,
|
|
29
|
+
});
|
|
30
|
+
const storedChatStatusResponse = this.storage.get('chatStatusResponse');
|
|
31
|
+
if (storedChatStatusResponse) {
|
|
32
|
+
try {
|
|
33
|
+
const storedChatStatus = JSON.parse(storedChatStatusResponse);
|
|
34
|
+
if (storedChatStatus.checkTime && Date.now() - storedChatStatus.checkTime > CHAT_STATUS_EXPIRATION_TIME) {
|
|
35
|
+
// chat status is expired, remove from storage to trigger a new check
|
|
36
|
+
this.storage.set('chatStatusResponse', null);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this.handleChatStatusResponse(storedChatStatus.response);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
this.storage.set('chatStatusResponse', null);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// check for entries in storage
|
|
47
|
+
let latestChatId = '';
|
|
48
|
+
const storedChats = this.storage.get('chats');
|
|
49
|
+
storedChats &&
|
|
50
|
+
Object.keys(storedChats || {}).forEach((chatId) => {
|
|
51
|
+
const chatData = storedChats[chatId];
|
|
52
|
+
if (chatData) {
|
|
53
|
+
const restoredChat = new ChatSessionStore({
|
|
54
|
+
data: {
|
|
55
|
+
...chatData,
|
|
56
|
+
id: chatId,
|
|
57
|
+
},
|
|
58
|
+
stores: {
|
|
59
|
+
storage: this.storage,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
// Mark as unhydrated — results are still raw JSON from storage.
|
|
63
|
+
// Only the active session will be hydrated below.
|
|
64
|
+
restoredChat.hydrated = false;
|
|
65
|
+
this.chats.push(restoredChat);
|
|
66
|
+
latestChatId = chatId;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
const storedMeta = this.storage.get('meta');
|
|
70
|
+
if (storedMeta) {
|
|
71
|
+
try {
|
|
72
|
+
const metaData = JSON.parse(storedMeta);
|
|
73
|
+
this.meta = new MetaStore({
|
|
74
|
+
data: {
|
|
75
|
+
meta: metaData,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
// Keep raw meta for lazy hydration of inactive sessions
|
|
79
|
+
this.storedMetaData = metaData;
|
|
80
|
+
// Only hydrate the active chat session — inactive sessions will be
|
|
81
|
+
// hydrated lazily when switched to via switchChat()
|
|
82
|
+
const activeChat = this.chats.find((chat) => chat.id === latestChatId);
|
|
83
|
+
if (activeChat) {
|
|
84
|
+
activeChat.hydrateResults(metaData);
|
|
85
|
+
activeChat.hydrated = true;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
this.storage.set('meta', null);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
this.currentChatId = latestChatId;
|
|
93
|
+
makeObservable(this, {
|
|
94
|
+
meta: observable,
|
|
95
|
+
inputValue: observable,
|
|
96
|
+
open: observable,
|
|
97
|
+
chats: observable,
|
|
98
|
+
currentChatId: observable,
|
|
99
|
+
chatEnabled: observable,
|
|
100
|
+
initChatLoading: observable,
|
|
101
|
+
blocked: computed,
|
|
102
|
+
currentChat: computed,
|
|
103
|
+
chatsIds: computed,
|
|
104
|
+
features: observable,
|
|
105
|
+
suggestedQuestions: observable,
|
|
106
|
+
welcomeMessage: observable,
|
|
107
|
+
productQuickview: observable,
|
|
108
|
+
productQuickviewError: observable,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
get currentChat() {
|
|
112
|
+
return this.chats.find((chat) => chat.id === this.currentChatId);
|
|
113
|
+
}
|
|
114
|
+
get chatsIds() {
|
|
115
|
+
return this.chats.map((chat) => chat.id);
|
|
116
|
+
}
|
|
117
|
+
get blocked() {
|
|
118
|
+
let isBlocked = false;
|
|
119
|
+
const blockedAttachments = this.currentChat?.attachments.items.some((item) => item.type === 'image' && item.state === 'loading');
|
|
120
|
+
if (this.loading || blockedAttachments) {
|
|
121
|
+
isBlocked = true;
|
|
122
|
+
}
|
|
123
|
+
return isBlocked;
|
|
124
|
+
}
|
|
125
|
+
handleChatStatusResponse(response) {
|
|
126
|
+
const { chatbot, features } = response;
|
|
127
|
+
const { status, suggestedQuestions, welcomeMessage } = chatbot;
|
|
128
|
+
this.chatEnabled = status.enabled === true;
|
|
129
|
+
this.features = features;
|
|
130
|
+
this.suggestedQuestions = suggestedQuestions || [];
|
|
131
|
+
this.welcomeMessage = welcomeMessage || '';
|
|
132
|
+
this.storage.set('chatStatusResponse', JSON.stringify({ response, checkTime: Date.now() }));
|
|
133
|
+
return this.chatEnabled;
|
|
134
|
+
}
|
|
135
|
+
reset() {
|
|
136
|
+
this.chats = [];
|
|
137
|
+
this.clearProductQuickview();
|
|
138
|
+
this.storage.clear();
|
|
139
|
+
this.createChat();
|
|
140
|
+
}
|
|
141
|
+
setProductQuickview(product) {
|
|
142
|
+
this.productQuickview = product;
|
|
143
|
+
this.productQuickviewError = null;
|
|
144
|
+
}
|
|
145
|
+
updateProductQuickview(response) {
|
|
146
|
+
if (!this.productQuickview) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
// merge parent-level mappings from the API response into the Product
|
|
150
|
+
this.productQuickview.mappings = {
|
|
151
|
+
...this.productQuickview.mappings,
|
|
152
|
+
core: { ...this.productQuickview.mappings.core, ...response.mappings.core },
|
|
153
|
+
};
|
|
154
|
+
const meta = this.meta?.data || {};
|
|
155
|
+
if (this.productQuickview.variants) {
|
|
156
|
+
// update existing Variants with new data from the Products API
|
|
157
|
+
this.productQuickview.variants.optionConfig = response.variants.optionConfig;
|
|
158
|
+
this.productQuickview.variants.update(response.variants.data);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
// create Variants for the first time using the Products API data
|
|
162
|
+
this.productQuickview.variants = new Variants({
|
|
163
|
+
data: {
|
|
164
|
+
mask: this.productQuickview.mask,
|
|
165
|
+
variants: response.variants.data,
|
|
166
|
+
optionConfig: response.variants.optionConfig,
|
|
167
|
+
meta,
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
setProductQuickviewError(message) {
|
|
173
|
+
this.productQuickviewError = message;
|
|
174
|
+
}
|
|
175
|
+
clearProductQuickview() {
|
|
176
|
+
this.productQuickview = null;
|
|
177
|
+
this.productQuickviewError = null;
|
|
178
|
+
}
|
|
179
|
+
clearHistory() {
|
|
180
|
+
// drop previous chats while keeping the conversation the user is currently in;
|
|
181
|
+
// if there is no current chat, fall back to a full reset
|
|
182
|
+
const currentChat = this.currentChat;
|
|
183
|
+
if (!currentChat) {
|
|
184
|
+
this.reset();
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const storedChats = this.storage.get('chats') || {};
|
|
188
|
+
const filtered = {};
|
|
189
|
+
if (storedChats[currentChat.id]) {
|
|
190
|
+
filtered[currentChat.id] = storedChats[currentChat.id];
|
|
191
|
+
}
|
|
192
|
+
this.storage.set('chats', filtered);
|
|
193
|
+
this.chats = [currentChat];
|
|
194
|
+
}
|
|
195
|
+
createChat(data) {
|
|
196
|
+
// Prune old sessions before creating a new one to keep storage bounded
|
|
197
|
+
ChatSessionStore.pruneStoredSessions(this.storage);
|
|
198
|
+
const newChat = new ChatSessionStore({
|
|
199
|
+
data: {
|
|
200
|
+
sessionId: data?.sessionId,
|
|
201
|
+
},
|
|
202
|
+
stores: {
|
|
203
|
+
storage: this.storage,
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
this.currentChatId = newChat.id;
|
|
207
|
+
this.chats.push(newChat);
|
|
208
|
+
return newChat;
|
|
209
|
+
}
|
|
210
|
+
switchChat(id) {
|
|
211
|
+
const chatExists = this.chats.find((chat) => chat.id === id);
|
|
212
|
+
if (chatExists) {
|
|
213
|
+
// Lazily hydrate results when switching to a session for the first time
|
|
214
|
+
if (!chatExists.hydrated && this.storedMetaData) {
|
|
215
|
+
chatExists.hydrateResults(this.storedMetaData);
|
|
216
|
+
chatExists.hydrated = true;
|
|
217
|
+
}
|
|
218
|
+
this.currentChatId = id;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
sendProductQuery(result, options) {
|
|
222
|
+
const display = result?.display || result;
|
|
223
|
+
this.currentChat?.attachments.add({
|
|
224
|
+
type: 'product',
|
|
225
|
+
requestType: options.requestType,
|
|
226
|
+
productId: result.id,
|
|
227
|
+
name: display.mappings?.core?.name,
|
|
228
|
+
thumbnailUrl: display.mappings?.core?.thumbnailImageUrl || display.mappings?.core?.imageUrl,
|
|
229
|
+
});
|
|
230
|
+
// for the productQuery flow we want the secondary chat to immediately
|
|
231
|
+
// show the product details panel — push a productQuery message so it
|
|
232
|
+
// becomes the active side-chat message until a productAnswer arrives
|
|
233
|
+
if (options.requestType === 'productQuery' && this.currentChat) {
|
|
234
|
+
this.currentChat.pushProductQueryMessage(result);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
compareProduct(result) {
|
|
238
|
+
this.currentChat?.comparisons.add({
|
|
239
|
+
result,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
addFacet(facet) {
|
|
243
|
+
this.currentChat?.attachments.add({
|
|
244
|
+
type: 'facet',
|
|
245
|
+
key: facet.key,
|
|
246
|
+
facetLabel: facet.facetLabel,
|
|
247
|
+
value: facet.value,
|
|
248
|
+
label: facet.label,
|
|
249
|
+
count: facet.count,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
removeFacet(key, value) {
|
|
253
|
+
const facetAttachment = this.currentChat?.attachments.items.find((item) => item.type === 'facet' &&
|
|
254
|
+
item.key === key &&
|
|
255
|
+
item.value === value &&
|
|
256
|
+
(item.state === 'active' || item.state === 'attached'));
|
|
257
|
+
if (facetAttachment) {
|
|
258
|
+
const index = this.currentChat?.attachments.items.indexOf(facetAttachment);
|
|
259
|
+
if (index !== undefined && index !== -1) {
|
|
260
|
+
this.currentChat?.attachments.items.splice(index, 1);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
clearPendingFacets() {
|
|
265
|
+
const facetAttachments = this.currentChat?.attachments.items.filter((item) => item.type === 'facet' && (item.state === 'active' || item.state === 'attached')) || [];
|
|
266
|
+
facetAttachments.forEach((item) => {
|
|
267
|
+
const index = this.currentChat?.attachments.items.indexOf(item);
|
|
268
|
+
if (index !== undefined && index !== -1) {
|
|
269
|
+
this.currentChat?.attachments.items.splice(index, 1);
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
isFacetSelected(key, value) {
|
|
274
|
+
return (this.currentChat?.attachments.items.some((item) => item.type === 'facet' &&
|
|
275
|
+
item.key === key &&
|
|
276
|
+
item.value === value &&
|
|
277
|
+
(item.state === 'active' || item.state === 'attached')) || false);
|
|
278
|
+
}
|
|
279
|
+
request(request) {
|
|
280
|
+
this.currentChat?.request(request);
|
|
281
|
+
// remove any facet attachments after request
|
|
282
|
+
const facetAttachments = this.currentChat?.attachments.attached.filter((item) => item.type === 'facet') || [];
|
|
283
|
+
facetAttachments.forEach((item) => {
|
|
284
|
+
this.currentChat?.attachments.remove(item.id);
|
|
285
|
+
});
|
|
286
|
+
// remove any productSimilar attachments after request
|
|
287
|
+
const productSimilarAttachments = this.currentChat?.attachments.attached.filter((item) => item.type === 'product' && item.requestType === 'productSimilar') || [];
|
|
288
|
+
productSimilarAttachments.forEach((item) => {
|
|
289
|
+
this.currentChat?.attachments.remove(item.id);
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
update(data) {
|
|
293
|
+
// TODO: handle error
|
|
294
|
+
// if(err?.responseBody?.errorMessage || err?.responseBody?.errorCode) {
|
|
295
|
+
// const errorMessage = err?.responseBody?.errorMessage || 'An unknown error has occurred.';
|
|
296
|
+
// }
|
|
297
|
+
this.currentChat?.update(data);
|
|
298
|
+
if (!this.meta) {
|
|
299
|
+
this.storage.set('meta', JSON.stringify(data.meta));
|
|
300
|
+
}
|
|
301
|
+
this.meta = new MetaStore({
|
|
302
|
+
data: {
|
|
303
|
+
meta: data.meta,
|
|
304
|
+
},
|
|
305
|
+
});
|
|
306
|
+
// Keep raw meta in sync for lazy hydration of inactive sessions
|
|
307
|
+
this.storedMetaData = data.meta;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
type AttachmentState = 'loading' | 'error' | 'attached' | 'active' | 'saved';
|
|
2
|
+
type AttachmentError = {
|
|
3
|
+
message: string;
|
|
4
|
+
};
|
|
5
|
+
export type ChatAttachmentAddAttachment = ChatAttachmentImageConfig | ChatAttachmentProductConfig | ChatAttachmentFacetConfig;
|
|
6
|
+
export declare class ChatAttachmentStore {
|
|
7
|
+
items: ChatAttachments[];
|
|
8
|
+
constructor();
|
|
9
|
+
get attached(): ChatAttachments[];
|
|
10
|
+
get compared(): ChatAttachmentProduct[];
|
|
11
|
+
add<T extends ChatAttachments>(attachment: ChatAttachmentAddAttachment): T;
|
|
12
|
+
remove(id: string): void;
|
|
13
|
+
get(id: string): ChatAttachments | undefined;
|
|
14
|
+
reset(): void;
|
|
15
|
+
hydrate(attachments: ChatAttachmentAddAttachment[]): void;
|
|
16
|
+
}
|
|
17
|
+
type ChatAttachments = ChatAttachmentImage | ChatAttachmentProduct | ChatAttachmentFacet;
|
|
18
|
+
declare abstract class ChatAttachment {
|
|
19
|
+
abstract type: string;
|
|
20
|
+
id: string;
|
|
21
|
+
state: AttachmentState;
|
|
22
|
+
error?: AttachmentError;
|
|
23
|
+
constructor(params?: {
|
|
24
|
+
data?: {
|
|
25
|
+
id?: string;
|
|
26
|
+
state?: AttachmentState;
|
|
27
|
+
error?: AttachmentError;
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
save(): void;
|
|
31
|
+
activate(): void;
|
|
32
|
+
}
|
|
33
|
+
type ChatAttachmentImageConfig = {
|
|
34
|
+
type: 'image';
|
|
35
|
+
id?: string;
|
|
36
|
+
base64?: string;
|
|
37
|
+
fileName?: string;
|
|
38
|
+
imageId?: string;
|
|
39
|
+
imageUrl?: string;
|
|
40
|
+
thumbnailUrl?: string;
|
|
41
|
+
state?: AttachmentState;
|
|
42
|
+
error?: AttachmentError;
|
|
43
|
+
};
|
|
44
|
+
type ChatAttachmentProductConfig = {
|
|
45
|
+
type: 'product';
|
|
46
|
+
id?: string;
|
|
47
|
+
productId: string;
|
|
48
|
+
thumbnailUrl: string;
|
|
49
|
+
name: string;
|
|
50
|
+
requestType: 'productQuery' | 'productSimilar' | 'productComparison';
|
|
51
|
+
state?: AttachmentState;
|
|
52
|
+
error?: AttachmentError;
|
|
53
|
+
};
|
|
54
|
+
type ChatAttachmentFacetConfig = {
|
|
55
|
+
type: 'facet';
|
|
56
|
+
id?: string;
|
|
57
|
+
key: string;
|
|
58
|
+
facetLabel: string;
|
|
59
|
+
value: string;
|
|
60
|
+
label: string;
|
|
61
|
+
count: number;
|
|
62
|
+
state?: AttachmentState;
|
|
63
|
+
error?: AttachmentError;
|
|
64
|
+
};
|
|
65
|
+
export declare class ChatAttachmentProduct extends ChatAttachment {
|
|
66
|
+
type: 'product' | never;
|
|
67
|
+
productId: string;
|
|
68
|
+
thumbnailUrl: string;
|
|
69
|
+
name: string;
|
|
70
|
+
requestType: 'productQuery' | 'productSimilar' | 'productComparison';
|
|
71
|
+
constructor({ id, productId, thumbnailUrl, name, requestType, state, error }: ChatAttachmentProductConfig);
|
|
72
|
+
}
|
|
73
|
+
export declare class ChatAttachmentFacet extends ChatAttachment {
|
|
74
|
+
type: 'facet' | never;
|
|
75
|
+
key: string;
|
|
76
|
+
facetLabel: string;
|
|
77
|
+
value: string;
|
|
78
|
+
label: string;
|
|
79
|
+
count: number;
|
|
80
|
+
constructor({ id, key, facetLabel, value, label, count, state, error }: ChatAttachmentFacetConfig);
|
|
81
|
+
}
|
|
82
|
+
export declare class ChatAttachmentImage extends ChatAttachment {
|
|
83
|
+
type: 'image' | never;
|
|
84
|
+
fileName?: string;
|
|
85
|
+
imageId?: string;
|
|
86
|
+
imageUrl?: string;
|
|
87
|
+
thumbnailUrl?: string;
|
|
88
|
+
base64?: string;
|
|
89
|
+
constructor({ id, base64, fileName, imageId, imageUrl, thumbnailUrl, state, error }: ChatAttachmentImageConfig);
|
|
90
|
+
update: ({ imageId, imageUrl, thumbnailUrl, error, }: {
|
|
91
|
+
imageId?: string;
|
|
92
|
+
imageUrl?: string;
|
|
93
|
+
thumbnailUrl?: string;
|
|
94
|
+
error?: AttachmentError;
|
|
95
|
+
}) => Promise<void>;
|
|
96
|
+
}
|
|
97
|
+
export {};
|
|
98
|
+
//# sourceMappingURL=ChatAttachmentStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatAttachmentStore.d.ts","sourceRoot":"","sources":["../../../../src/Chat/Stores/ChatAttachmentStore.ts"],"names":[],"mappings":"AAKA,KAAK,eAAe,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;AAC7E,KAAK,eAAe,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,yBAAyB,GAAG,2BAA2B,GAAG,yBAAyB,CAAC;A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