isometrik-plugin-chat-sdk 1.0.0 → 1.0.2
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/{MessageSearch-5fc9dc00.js → MessageSearch-a73ca677.js} +83 -12
- package/dist/cjs/MessageSearch-a73ca677.js.map +1 -0
- package/dist/cjs/{WebChat-403e7ab1.js → WebChat-11c06cb9.js} +458 -57
- package/dist/cjs/WebChat-11c06cb9.js.map +1 -0
- package/dist/cjs/audio-bubble_8.cjs.entry.js +2 -2
- package/dist/cjs/chat-app.cjs.entry.js +3 -3
- package/dist/cjs/chat-creds-7ddd5f40.js +27 -0
- package/dist/cjs/chat-creds-7ddd5f40.js.map +1 -0
- package/dist/cjs/login-page.cjs.entry.js +1 -1
- package/dist/cjs/signup-page.cjs.entry.js +1 -1
- package/dist/cjs/theme-provider_2.cjs.entry.js +3 -3
- package/dist/collection/api/social-accounts.js +77 -9
- package/dist/collection/components/my-component/web-chat/WebChat.js +48 -33
- package/dist/collection/components/my-component/web-chat/WebChat.js.map +1 -1
- package/dist/collection/constants/chat-creds.js +18 -29
- package/dist/collection/stories/Components/InstagramAccounts/InstagramAccountsPanel.js +412 -22
- package/dist/esm/{MessageSearch-4101a627.js → MessageSearch-69b3a0f3.js} +80 -12
- package/dist/esm/MessageSearch-69b3a0f3.js.map +1 -0
- package/dist/esm/{WebChat-5448d615.js → WebChat-372df148.js} +458 -57
- package/dist/esm/WebChat-372df148.js.map +1 -0
- package/dist/esm/audio-bubble_8.entry.js +3 -3
- package/dist/esm/chat-app.entry.js +3 -3
- package/dist/esm/chat-creds-99dd8834.js +24 -0
- package/dist/esm/chat-creds-99dd8834.js.map +1 -0
- package/dist/esm/login-page.entry.js +1 -1
- package/dist/esm/signup-page.entry.js +1 -1
- package/dist/esm/theme-provider_2.entry.js +3 -3
- package/dist/isometrik-webchat/isometrik-webchat.esm.js +1 -1
- package/dist/isometrik-webchat/{p-89108249.entry.js → p-56fbdbc3.entry.js} +2 -2
- package/dist/isometrik-webchat/p-70f4360e.js +2 -0
- package/dist/isometrik-webchat/p-70f4360e.js.map +1 -0
- package/dist/isometrik-webchat/{p-48e243ec.entry.js → p-72a0b844.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-bfd51dd4.entry.js → p-8456ee94.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-8dcdea59.js → p-9058d82c.js} +18 -18
- package/dist/isometrik-webchat/p-9058d82c.js.map +1 -0
- package/dist/isometrik-webchat/p-9588b7ec.js +780 -0
- package/dist/isometrik-webchat/p-9588b7ec.js.map +1 -0
- package/dist/isometrik-webchat/{p-bf0aeb22.entry.js → p-e36db3f6.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-adbb398d.entry.js → p-e66e5e61.entry.js} +2 -2
- package/package.json +1 -1
- package/readme.md +5 -5
- package/dist/cjs/MessageSearch-5fc9dc00.js.map +0 -1
- package/dist/cjs/WebChat-403e7ab1.js.map +0 -1
- package/dist/cjs/chat-creds-f4cbf400.js +0 -38
- package/dist/cjs/chat-creds-f4cbf400.js.map +0 -1
- package/dist/esm/MessageSearch-4101a627.js.map +0 -1
- package/dist/esm/WebChat-5448d615.js.map +0 -1
- package/dist/esm/chat-creds-ff086f05.js +0 -35
- package/dist/esm/chat-creds-ff086f05.js.map +0 -1
- package/dist/isometrik-webchat/p-12774661.js +0 -2
- package/dist/isometrik-webchat/p-12774661.js.map +0 -1
- package/dist/isometrik-webchat/p-8dcdea59.js.map +0 -1
- package/dist/isometrik-webchat/p-e09b32eb.js +0 -591
- package/dist/isometrik-webchat/p-e09b32eb.js.map +0 -1
- /package/dist/isometrik-webchat/{p-89108249.entry.js.map → p-56fbdbc3.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-48e243ec.entry.js.map → p-72a0b844.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-bfd51dd4.entry.js.map → p-8456ee94.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-bf0aeb22.entry.js.map → p-e36db3f6.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-adbb398d.entry.js.map → p-e66e5e61.entry.js.map} +0 -0
|
@@ -6,7 +6,7 @@ const index = require('./index-9afe62b6.js');
|
|
|
6
6
|
const imagePlaceholder = require('./imagePlaceholder-030cc566.js');
|
|
7
7
|
const dialogDrawer = require('./dialog-drawer-9d04911c.js');
|
|
8
8
|
const Image$1 = require('./Image-67c52acd.js');
|
|
9
|
-
const MessageSearch = require('./MessageSearch-
|
|
9
|
+
const MessageSearch = require('./MessageSearch-a73ca677.js');
|
|
10
10
|
const Text = require('./Text-fedf6eab.js');
|
|
11
11
|
const chatAssets = require('./chat-assets-6ab1faa6.js');
|
|
12
12
|
const toastHelper = require('./toast-helper-defae4a5.js');
|
|
@@ -19,7 +19,7 @@ require('./VideoMessageBubble-c4694a78.js');
|
|
|
19
19
|
require('./ReactionsContainer-a6ce9059.js');
|
|
20
20
|
const messageReaction = require('./message-reaction-976f6261.js');
|
|
21
21
|
require('./BlockChatList-720a703e.js');
|
|
22
|
-
require('./chat-creds-
|
|
22
|
+
require('./chat-creds-7ddd5f40.js');
|
|
23
23
|
|
|
24
24
|
const AudioBubble = class {
|
|
25
25
|
constructor(hostRef) {
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-9afe62b6.js');
|
|
6
|
-
require('./WebChat-
|
|
6
|
+
require('./WebChat-11c06cb9.js');
|
|
7
7
|
require('./Image-67c52acd.js');
|
|
8
|
-
require('./chat-creds-
|
|
8
|
+
require('./chat-creds-7ddd5f40.js');
|
|
9
9
|
require('./dialog-drawer-9d04911c.js');
|
|
10
10
|
require('./content-eca5336c.js');
|
|
11
11
|
require('./Text-fedf6eab.js');
|
|
12
12
|
require('./group-members-a60fb1cb.js');
|
|
13
13
|
require('./toast-helper-defae4a5.js');
|
|
14
|
-
require('./MessageSearch-
|
|
14
|
+
require('./MessageSearch-a73ca677.js');
|
|
15
15
|
require('./BlockChatList-720a703e.js');
|
|
16
16
|
require('./imagePlaceholder-030cc566.js');
|
|
17
17
|
require('./taguser-aca04ed9.js');
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Filled at runtime from <web-chat> props (parent). Do not hardcode secrets here.
|
|
4
|
+
const CHAT_CREDS = {
|
|
5
|
+
userToken: '',
|
|
6
|
+
appSecret: '',
|
|
7
|
+
licenseKey: '',
|
|
8
|
+
userSecret: '',
|
|
9
|
+
accountId: '',
|
|
10
|
+
keysetId: '',
|
|
11
|
+
projectId: '',
|
|
12
|
+
isometrikUserId: '',
|
|
13
|
+
// Public API host — parent can override via base-url prop
|
|
14
|
+
baseUrl: 'https://apis.isometrik.ai',
|
|
15
|
+
// Instagram/Zernio OAuth return URL — parent should set via social-redirect-url
|
|
16
|
+
socialRedirectUrl: '',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const MQTT_CREDS = {
|
|
20
|
+
// Public broker — parent can override via host-url prop
|
|
21
|
+
URL: 'wss://connections.isometrik.io:2053/mqtt',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.CHAT_CREDS = CHAT_CREDS;
|
|
25
|
+
exports.MQTT_CREDS = MQTT_CREDS;
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=chat-creds-7ddd5f40.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"chat-creds-7ddd5f40.js","mappings":";;AAAA;AACY,MAAC,UAAU,GAAG;AAC1B,EAAE,SAAS,EAAE,EAAE;AACf,EAAE,SAAS,EAAE,EAAE;AACf,EAAE,UAAU,EAAE,EAAE;AAChB,EAAE,UAAU,EAAE,EAAE;AAChB,EAAE,SAAS,EAAE,EAAE;AACf,EAAE,QAAQ,EAAE,EAAE;AACd,EAAE,SAAS,EAAE,EAAE;AACf,EAAE,eAAe,EAAE,EAAE;AACrB;AACA,EAAE,OAAO,EAAE,2BAA2B;AACtC;AACA,EAAE,iBAAiB,EAAE,EAAE;AACvB,EAAE;AACF;AACY,MAAC,UAAU,GAAG;AAC1B;AACA,EAAE,GAAG,EAAE,0CAA0C;AACjD;;;;;","names":[],"sources":["src/constants/chat-creds.js"],"sourcesContent":["// Filled at runtime from <web-chat> props (parent). Do not hardcode secrets here.\nexport const CHAT_CREDS = {\n userToken: '',\n appSecret: '',\n licenseKey: '',\n userSecret: '',\n accountId: '',\n keysetId: '',\n projectId: '',\n isometrikUserId: '',\n // Public API host — parent can override via base-url prop\n baseUrl: 'https://apis.isometrik.ai',\n // Instagram/Zernio OAuth return URL — parent should set via social-redirect-url\n socialRedirectUrl: '',\n};\n\nexport const MQTT_CREDS = {\n // Public broker — parent can override via host-url prop\n URL: 'wss://connections.isometrik.io:2053/mqtt',\n};\n"],"version":3}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-9afe62b6.js');
|
|
6
|
-
const chatCreds = require('./chat-creds-
|
|
6
|
+
const chatCreds = require('./chat-creds-7ddd5f40.js');
|
|
7
7
|
const IsometrikLogo = require('./IsometrikLogo-976b1c34.js');
|
|
8
8
|
const content = require('./content-eca5336c.js');
|
|
9
9
|
const chatAssets = require('./chat-assets-6ab1faa6.js');
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-9afe62b6.js');
|
|
6
6
|
const IsometrikLogo = require('./IsometrikLogo-976b1c34.js');
|
|
7
|
-
const chatCreds = require('./chat-creds-
|
|
7
|
+
const chatCreds = require('./chat-creds-7ddd5f40.js');
|
|
8
8
|
|
|
9
9
|
const onboardingImagePath = index.getAssetPath('../assets/images/onboarding.webp');
|
|
10
10
|
const Signup = class {
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-9afe62b6.js');
|
|
6
|
-
const WebChat = require('./WebChat-
|
|
6
|
+
const WebChat = require('./WebChat-11c06cb9.js');
|
|
7
7
|
require('./Image-67c52acd.js');
|
|
8
|
-
require('./chat-creds-
|
|
8
|
+
require('./chat-creds-7ddd5f40.js');
|
|
9
9
|
require('./dialog-drawer-9d04911c.js');
|
|
10
10
|
require('./content-eca5336c.js');
|
|
11
11
|
require('./Text-fedf6eab.js');
|
|
12
12
|
require('./group-members-a60fb1cb.js');
|
|
13
13
|
require('./toast-helper-defae4a5.js');
|
|
14
|
-
require('./MessageSearch-
|
|
14
|
+
require('./MessageSearch-a73ca677.js');
|
|
15
15
|
require('./BlockChatList-720a703e.js');
|
|
16
16
|
require('./imagePlaceholder-030cc566.js');
|
|
17
17
|
require('./taguser-aca04ed9.js');
|
|
@@ -149,7 +149,7 @@ export const openSocialAuthPopup = (authUrl) =>
|
|
|
149
149
|
}, 400);
|
|
150
150
|
});
|
|
151
151
|
|
|
152
|
-
/** POST /chat/social/connect */
|
|
152
|
+
/** POST /chat/social/connect — Instagram OAuth (authUrl) or LinkedIn credentials */
|
|
153
153
|
export const connectSocialAccount = async ({
|
|
154
154
|
baseUrl,
|
|
155
155
|
appSecret,
|
|
@@ -157,24 +157,86 @@ export const connectSocialAccount = async ({
|
|
|
157
157
|
platform = 'instagram',
|
|
158
158
|
redirectUrl,
|
|
159
159
|
loginMethod = 'instagram_login',
|
|
160
|
+
username,
|
|
161
|
+
password,
|
|
162
|
+
agentUserId,
|
|
160
163
|
} = {}) => {
|
|
161
164
|
const creds = getCreds({ baseUrl, appSecret, licenseKey });
|
|
165
|
+
const body =
|
|
166
|
+
platform === 'linkedin'
|
|
167
|
+
? {
|
|
168
|
+
platform: 'linkedin',
|
|
169
|
+
username,
|
|
170
|
+
password,
|
|
171
|
+
agentUserId: agentUserId || CHAT_CREDS.isometrikUserId,
|
|
172
|
+
}
|
|
173
|
+
: {
|
|
174
|
+
platform,
|
|
175
|
+
redirectUrl: redirectUrl || getSocialRedirectUrl(),
|
|
176
|
+
loginMethod,
|
|
177
|
+
};
|
|
178
|
+
|
|
162
179
|
const response = await fetch(`${creds.baseUrl}/chat/social/connect`, {
|
|
180
|
+
method: 'POST',
|
|
181
|
+
headers: getHeaders(creds.appSecret, creds.licenseKey),
|
|
182
|
+
body: JSON.stringify(body),
|
|
183
|
+
});
|
|
184
|
+
const data = await response.json();
|
|
185
|
+
if (!response.ok) {
|
|
186
|
+
throw new Error(data.message || 'Failed to connect social account');
|
|
187
|
+
}
|
|
188
|
+
return data;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
/** POST /chat/social/connect/checkpoint — LinkedIn OTP / 2FA */
|
|
192
|
+
export const submitSocialConnectCheckpoint = async ({
|
|
193
|
+
baseUrl,
|
|
194
|
+
appSecret,
|
|
195
|
+
licenseKey,
|
|
196
|
+
platform = 'linkedin',
|
|
197
|
+
accountId,
|
|
198
|
+
code,
|
|
199
|
+
agentUserId,
|
|
200
|
+
} = {}) => {
|
|
201
|
+
const creds = getCreds({ baseUrl, appSecret, licenseKey });
|
|
202
|
+
const response = await fetch(`${creds.baseUrl}/chat/social/connect/checkpoint`, {
|
|
163
203
|
method: 'POST',
|
|
164
204
|
headers: getHeaders(creds.appSecret, creds.licenseKey),
|
|
165
205
|
body: JSON.stringify({
|
|
166
206
|
platform,
|
|
167
|
-
|
|
168
|
-
|
|
207
|
+
accountId,
|
|
208
|
+
code,
|
|
209
|
+
agentUserId: agentUserId || CHAT_CREDS.isometrikUserId,
|
|
169
210
|
}),
|
|
170
211
|
});
|
|
171
212
|
const data = await response.json();
|
|
172
213
|
if (!response.ok) {
|
|
173
|
-
throw new Error(data.message || 'Failed to
|
|
214
|
+
throw new Error(data.message || 'Failed to complete social checkpoint');
|
|
174
215
|
}
|
|
175
216
|
return data;
|
|
176
217
|
};
|
|
177
218
|
|
|
219
|
+
/** True when connect response still needs OTP / 2FA. */
|
|
220
|
+
export const isSocialCheckpointRequired = (data = {}) => {
|
|
221
|
+
if (!data || typeof data !== 'object') return false;
|
|
222
|
+
const status = String(data.status || data.checkpointStatus || '').toLowerCase();
|
|
223
|
+
if (status.includes('checkpoint') || status === 'pending' || status === 'otp_required') {
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
if (data.checkpoint || data.checkpointType || data.checkpointRequired) return true;
|
|
227
|
+
if (data.object === 'Checkpoint' || data.object === 'checkpoint') return true;
|
|
228
|
+
return false;
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export const getSocialAccountIdFromConnect = (data = {}) =>
|
|
232
|
+
data?.accountId ||
|
|
233
|
+
data?.zernioAccountId ||
|
|
234
|
+
data?.unipileAccountId ||
|
|
235
|
+
data?.checkpoint?.account_id ||
|
|
236
|
+
data?.checkpoint?.accountId ||
|
|
237
|
+
data?.data?.accountId ||
|
|
238
|
+
'';
|
|
239
|
+
|
|
178
240
|
/** POST /chat/social/connect/callback — zernioAccountId from GET /chat/social/accounts */
|
|
179
241
|
export const connectSocialAccountCallback = async ({
|
|
180
242
|
baseUrl,
|
|
@@ -218,24 +280,30 @@ export const connectSocialAccountCallback = async ({
|
|
|
218
280
|
return data;
|
|
219
281
|
};
|
|
220
282
|
|
|
221
|
-
/** True when at least one
|
|
222
|
-
export const
|
|
283
|
+
/** True when at least one social account is actively linked. */
|
|
284
|
+
export const hasConnectedSocialAccounts = (accounts = []) =>
|
|
223
285
|
(accounts || []).some(
|
|
224
286
|
(account) =>
|
|
225
287
|
account &&
|
|
226
|
-
(account.zernioAccountId || account.accountId) &&
|
|
288
|
+
(account.zernioAccountId || account.accountId || account.unipileAccountId) &&
|
|
227
289
|
account.status === 'connected'
|
|
228
290
|
);
|
|
229
291
|
|
|
230
292
|
/** Only accounts that are actively connected (API keeps disconnected rows). */
|
|
231
|
-
export const
|
|
293
|
+
export const getConnectedSocialAccounts = (accounts = []) =>
|
|
232
294
|
(accounts || []).filter(
|
|
233
295
|
(account) =>
|
|
234
296
|
account &&
|
|
235
|
-
(account.zernioAccountId || account.accountId) &&
|
|
297
|
+
(account.zernioAccountId || account.accountId || account.unipileAccountId) &&
|
|
236
298
|
account.status === 'connected'
|
|
237
299
|
);
|
|
238
300
|
|
|
301
|
+
/** @deprecated use hasConnectedSocialAccounts */
|
|
302
|
+
export const hasConnectedInstagramAccounts = hasConnectedSocialAccounts;
|
|
303
|
+
|
|
304
|
+
/** @deprecated use getConnectedSocialAccounts */
|
|
305
|
+
export const getConnectedInstagramAccounts = getConnectedSocialAccounts;
|
|
306
|
+
|
|
239
307
|
/** GET /chat/social/accounts?platform=... */
|
|
240
308
|
export const getSocialAccounts = async ({
|
|
241
309
|
baseUrl,
|
|
@@ -75,9 +75,29 @@ export class WebChat {
|
|
|
75
75
|
if (parts.length === 2)
|
|
76
76
|
return parts.pop().split(';').shift();
|
|
77
77
|
};
|
|
78
|
-
//
|
|
79
|
-
this.userTokenFromCookie =
|
|
80
|
-
this.isometrikUserIdFromCookie =
|
|
78
|
+
// Filled from parent <web-chat> props in applyParentCreds()
|
|
79
|
+
this.userTokenFromCookie = '';
|
|
80
|
+
this.isometrikUserIdFromCookie = '';
|
|
81
|
+
/** Copy parent props into CHAT_CREDS so API helpers use host values (no hardcode). */
|
|
82
|
+
this.applyParentCreds = () => {
|
|
83
|
+
var _a;
|
|
84
|
+
const pick = (prop, fallback = '') => typeof prop === 'string' && prop.trim() ? prop.trim() : fallback;
|
|
85
|
+
CHAT_CREDS.userToken = pick(this.userToken);
|
|
86
|
+
CHAT_CREDS.appSecret = pick(this.appSecret);
|
|
87
|
+
CHAT_CREDS.licenseKey = pick(this.licenseKey);
|
|
88
|
+
CHAT_CREDS.userSecret = pick(this.userSecret);
|
|
89
|
+
CHAT_CREDS.accountId = pick(this.accountId);
|
|
90
|
+
CHAT_CREDS.keysetId = pick(this.keysetId);
|
|
91
|
+
CHAT_CREDS.projectId = pick(this.projectId);
|
|
92
|
+
CHAT_CREDS.isometrikUserId = pick(this.isometrikUserId);
|
|
93
|
+
CHAT_CREDS.baseUrl = pick(this.baseUrl, CHAT_CREDS.baseUrl || 'https://apis.isometrik.ai');
|
|
94
|
+
CHAT_CREDS.socialRedirectUrl = pick(this.socialRedirectUrl);
|
|
95
|
+
if ((_a = this.hostUrl) === null || _a === void 0 ? void 0 : _a.trim()) {
|
|
96
|
+
MQTT_CREDS.URL = this.hostUrl.trim();
|
|
97
|
+
}
|
|
98
|
+
this.userTokenFromCookie = CHAT_CREDS.userToken;
|
|
99
|
+
this.isometrikUserIdFromCookie = CHAT_CREDS.isometrikUserId;
|
|
100
|
+
};
|
|
81
101
|
this.clearConversationState = () => {
|
|
82
102
|
this.allConversationList = [];
|
|
83
103
|
this.selectedConversationId = null;
|
|
@@ -101,8 +121,7 @@ export class WebChat {
|
|
|
101
121
|
window.history.replaceState({}, '', url);
|
|
102
122
|
}
|
|
103
123
|
};
|
|
104
|
-
this.
|
|
105
|
-
const connected = hasConnectedInstagramAccounts(accounts);
|
|
124
|
+
this.applySocialGate = (connected, options = {}) => {
|
|
106
125
|
const wasConnected = this.isInstagramConnected;
|
|
107
126
|
this.isInstagramConnected = connected;
|
|
108
127
|
if (!connected) {
|
|
@@ -116,9 +135,15 @@ export class WebChat {
|
|
|
116
135
|
void this.loadConversationsAfterInstagramConnect();
|
|
117
136
|
}
|
|
118
137
|
};
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
138
|
+
/** Unlock when Instagram OR LinkedIn has at least one connected account. */
|
|
139
|
+
this.refreshInstagramConnectionGate = async (options = { bootstrap: true }) => {
|
|
140
|
+
const [igData, liData] = await Promise.all([
|
|
141
|
+
getSocialAccounts({ platform: 'instagram' }).catch(() => ({ accounts: [] })),
|
|
142
|
+
getSocialAccounts({ platform: 'linkedin' }).catch(() => ({ accounts: [] })),
|
|
143
|
+
]);
|
|
144
|
+
const connected = hasConnectedInstagramAccounts((igData === null || igData === void 0 ? void 0 : igData.accounts) || []) ||
|
|
145
|
+
hasConnectedInstagramAccounts((liData === null || liData === void 0 ? void 0 : liData.accounts) || []);
|
|
146
|
+
this.applySocialGate(connected, options);
|
|
122
147
|
};
|
|
123
148
|
this.loadConversationsAfterInstagramConnect = async () => {
|
|
124
149
|
if (!this.isInstagramConnected)
|
|
@@ -134,14 +159,14 @@ export class WebChat {
|
|
|
134
159
|
await this.getConversations();
|
|
135
160
|
}
|
|
136
161
|
catch (error) {
|
|
137
|
-
console.error('Failed to load conversations after
|
|
162
|
+
console.error('Failed to load conversations after social connect:', error);
|
|
138
163
|
}
|
|
139
164
|
finally {
|
|
140
165
|
this.isConversationLoading = false;
|
|
141
166
|
}
|
|
142
167
|
};
|
|
143
|
-
this.handleInstagramAccountsChange = (
|
|
144
|
-
this.
|
|
168
|
+
this.handleInstagramAccountsChange = (_accounts) => {
|
|
169
|
+
void this.refreshInstagramConnectionGate({ bootstrap: false });
|
|
145
170
|
};
|
|
146
171
|
this.openChatTab = () => {
|
|
147
172
|
if (this.isInstagramConnected) {
|
|
@@ -760,11 +785,7 @@ export class WebChat {
|
|
|
760
785
|
this.isMobileView = window.innerWidth <= 768;
|
|
761
786
|
}
|
|
762
787
|
componentWillLoad() {
|
|
763
|
-
|
|
764
|
-
// Instagram OAuth return URL — host page where accounts are linked
|
|
765
|
-
if ((_a = this.socialRedirectUrl) === null || _a === void 0 ? void 0 : _a.trim()) {
|
|
766
|
-
CHAT_CREDS.socialRedirectUrl = this.socialRedirectUrl.trim();
|
|
767
|
-
}
|
|
788
|
+
this.applyParentCreds();
|
|
768
789
|
// OAuth popup return: notify opener ASAP and close (skip full chat boot)
|
|
769
790
|
if (notifyOpenerIfSocialPopupCallback())
|
|
770
791
|
return;
|
|
@@ -804,12 +825,13 @@ export class WebChat {
|
|
|
804
825
|
// Initialize SDK
|
|
805
826
|
try {
|
|
806
827
|
this.updateLoading(25, 'Initializing chat SDK...');
|
|
828
|
+
this.applyParentCreds();
|
|
807
829
|
ChatSDK.initializeInstance({
|
|
808
830
|
baseUrl: CHAT_CREDS.baseUrl,
|
|
809
831
|
licenseKey: CHAT_CREDS.licenseKey,
|
|
810
832
|
appSecret: CHAT_CREDS.appSecret,
|
|
811
833
|
userSecret: CHAT_CREDS.userSecret,
|
|
812
|
-
userToken:
|
|
834
|
+
userToken: CHAT_CREDS.userToken,
|
|
813
835
|
});
|
|
814
836
|
this.isInitialized = true;
|
|
815
837
|
}
|
|
@@ -835,18 +857,18 @@ export class WebChat {
|
|
|
835
857
|
catch (userError) {
|
|
836
858
|
console.error('Failed to get user details:', userError);
|
|
837
859
|
}
|
|
838
|
-
// Gate chats behind
|
|
860
|
+
// Gate chats behind any connected social account (Instagram or LinkedIn)
|
|
839
861
|
try {
|
|
840
|
-
this.updateLoading(65, 'Checking
|
|
862
|
+
this.updateLoading(65, 'Checking social connections...');
|
|
841
863
|
await this.refreshInstagramConnectionGate();
|
|
842
864
|
}
|
|
843
865
|
catch (igError) {
|
|
844
|
-
console.error('Failed to check
|
|
845
|
-
this.
|
|
866
|
+
console.error('Failed to check social accounts:', igError);
|
|
867
|
+
this.applySocialGate(false, { bootstrap: true });
|
|
846
868
|
}
|
|
847
869
|
if (!this.isInstagramConnected) {
|
|
848
870
|
this.activeTab = 'Accounts';
|
|
849
|
-
this.updateLoading(100, 'Connect Instagram to continue');
|
|
871
|
+
this.updateLoading(100, 'Connect Instagram or LinkedIn to continue');
|
|
850
872
|
this.checkMobileView();
|
|
851
873
|
window.addEventListener('resize', this.checkMobileView.bind(this));
|
|
852
874
|
return;
|
|
@@ -924,10 +946,12 @@ export class WebChat {
|
|
|
924
946
|
}
|
|
925
947
|
}
|
|
926
948
|
async setupMqttClient() {
|
|
949
|
+
var _a;
|
|
927
950
|
// let retryToConnect:any = null;
|
|
928
951
|
const deviceID = await getDeviceID();
|
|
952
|
+
this.applyParentCreds();
|
|
929
953
|
const mqttClient = ChatSDK.getInstance().initializeMqtt({
|
|
930
|
-
hostUri:
|
|
954
|
+
hostUri: ((_a = this.hostUrl) === null || _a === void 0 ? void 0 : _a.trim()) || MQTT_CREDS.URL,
|
|
931
955
|
clientId: CHAT_CREDS.isometrikUserId,
|
|
932
956
|
licenseKey: CHAT_CREDS.licenseKey,
|
|
933
957
|
projectId: CHAT_CREDS.projectId,
|
|
@@ -935,15 +959,6 @@ export class WebChat {
|
|
|
935
959
|
accountId: CHAT_CREDS.accountId,
|
|
936
960
|
deviceId: deviceID,
|
|
937
961
|
});
|
|
938
|
-
// const mqttClient = ChatSDK.getInstance().initializeMqtt({
|
|
939
|
-
// hostUri: this.hostUrl,
|
|
940
|
-
// clientId: this.isometrikUserId,
|
|
941
|
-
// licenseKey: this.licenseKey,
|
|
942
|
-
// projectId: this.projectId,
|
|
943
|
-
// keysetId: this.keysetId,
|
|
944
|
-
// accountId: this.accountId,
|
|
945
|
-
// deviceId: deviceID,
|
|
946
|
-
// });
|
|
947
962
|
this.mqttClient = mqttClient;
|
|
948
963
|
let refetchInterval = null;
|
|
949
964
|
this.isMqttConnected = false;
|
|
@@ -1965,7 +1980,7 @@ export class WebChat {
|
|
|
1965
1980
|
}
|
|
1966
1981
|
render() {
|
|
1967
1982
|
var _a, _b, _c, _d, _e;
|
|
1968
|
-
return (h(Fragment, { key: '
|
|
1983
|
+
return (h(Fragment, { key: '48018669b503b2bb6fee4d774d69800cad5e913e' }, this.isLoading ? (h("chat-loading-placeholder", { progress: this.loadingProgress, loadingStatus: this.loadingStatus })) : (h(Fragment, null, this.isConversationLoading ? (h("div", { class: "loaderoverlay" }, h("spinner-loader", { height: "30px", width: "30px", spinTime: "1s", spinnerPrimaryColor: "var(--bg-primary-color)", spinnerSecondaryColor: "var(--text-primary-color)", spinnerBorderWidth: "2px" }))) : null, h("div", { class: {
|
|
1969
1984
|
'isometrik-quickchat': true,
|
|
1970
1985
|
'is-resizing': this.isResizingSidebar,
|
|
1971
1986
|
'is-instagram-gate': !this.isInstagramConnected,
|