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
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
const index = require('./index-9afe62b6.js');
|
|
4
4
|
const Image = require('./Image-67c52acd.js');
|
|
5
|
-
const chatCreds = require('./chat-creds-
|
|
5
|
+
const chatCreds = require('./chat-creds-7ddd5f40.js');
|
|
6
6
|
const dialogDrawer = require('./dialog-drawer-9d04911c.js');
|
|
7
7
|
const groupMembers = require('./group-members-a60fb1cb.js');
|
|
8
8
|
const toastHelper = require('./toast-helper-defae4a5.js');
|
|
9
|
-
const MessageSearch = require('./MessageSearch-
|
|
9
|
+
const MessageSearch = require('./MessageSearch-a73ca677.js');
|
|
10
10
|
const content = require('./content-eca5336c.js');
|
|
11
11
|
const groupcast = require('./groupcast-49dae5ab.js');
|
|
12
12
|
|
|
@@ -186,7 +186,13 @@ class InstagramAccountsPanel extends Image.h {
|
|
|
186
186
|
/** When true, hide the X close (e.g. Instagram gate — no chat to return to). */
|
|
187
187
|
hideClose: { type: Boolean },
|
|
188
188
|
socialAccounts: { type: Array },
|
|
189
|
+
linkedInAccounts: { type: Array },
|
|
189
190
|
isSocialLoading: { type: Boolean },
|
|
191
|
+
isLinkedInLoading: { type: Boolean },
|
|
192
|
+
linkedInUsername: { type: String },
|
|
193
|
+
linkedInPassword: { type: String },
|
|
194
|
+
linkedInCode: { type: String },
|
|
195
|
+
linkedInCheckpointAccountId: { type: String },
|
|
190
196
|
};
|
|
191
197
|
|
|
192
198
|
constructor() {
|
|
@@ -198,16 +204,31 @@ class InstagramAccountsPanel extends Image.h {
|
|
|
198
204
|
this.accountsChange = null;
|
|
199
205
|
this.hideClose = false;
|
|
200
206
|
this.socialAccounts = [];
|
|
207
|
+
this.linkedInAccounts = [];
|
|
201
208
|
this.isSocialLoading = false;
|
|
209
|
+
this.isLinkedInLoading = false;
|
|
210
|
+
this.linkedInUsername = '';
|
|
211
|
+
this.linkedInPassword = '';
|
|
212
|
+
this.linkedInCode = '';
|
|
213
|
+
this.linkedInCheckpointAccountId = '';
|
|
202
214
|
}
|
|
203
215
|
|
|
204
216
|
get connectedAccounts() {
|
|
205
|
-
return MessageSearch.
|
|
217
|
+
return MessageSearch.getConnectedSocialAccounts(this.socialAccounts);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
get connectedLinkedInAccounts() {
|
|
221
|
+
return MessageSearch.getConnectedSocialAccounts(this.linkedInAccounts);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
get resolvedAgentUserId() {
|
|
225
|
+
return this.agentUserId || chatCreds.CHAT_CREDS.isometrikUserId || '';
|
|
206
226
|
}
|
|
207
227
|
|
|
208
228
|
connectedCallback() {
|
|
209
229
|
super.connectedCallback();
|
|
210
230
|
this.loadSocialAccounts();
|
|
231
|
+
this.loadLinkedInAccounts();
|
|
211
232
|
}
|
|
212
233
|
|
|
213
234
|
notifyAccountsChange(accounts = this.socialAccounts) {
|
|
@@ -240,6 +261,21 @@ class InstagramAccountsPanel extends Image.h {
|
|
|
240
261
|
}
|
|
241
262
|
}
|
|
242
263
|
|
|
264
|
+
async loadLinkedInAccounts({ notify = false } = {}) {
|
|
265
|
+
this.isLinkedInLoading = true;
|
|
266
|
+
try {
|
|
267
|
+
const data = await MessageSearch.getSocialAccounts({ platform: 'linkedin' });
|
|
268
|
+
this.linkedInAccounts = data?.accounts || [];
|
|
269
|
+
if (notify) this.notifyAccountsChange();
|
|
270
|
+
} catch (error) {
|
|
271
|
+
console.error('Failed to load LinkedIn accounts:', error);
|
|
272
|
+
this.linkedInAccounts = [];
|
|
273
|
+
if (notify) this.notifyAccountsChange();
|
|
274
|
+
} finally {
|
|
275
|
+
this.isLinkedInLoading = false;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
243
279
|
formatSocialDate(ts) {
|
|
244
280
|
if (!ts) return '-';
|
|
245
281
|
try {
|
|
@@ -306,7 +342,6 @@ class InstagramAccountsPanel extends Image.h {
|
|
|
306
342
|
this.isSocialLoading = true;
|
|
307
343
|
try {
|
|
308
344
|
await MessageSearch.deleteSocialAccount({ accountId });
|
|
309
|
-
// API soft-disconnects (status=disconnected) — reload truth from server
|
|
310
345
|
await this.loadSocialAccounts();
|
|
311
346
|
toastHelper.showToast({
|
|
312
347
|
message: 'Instagram disconnected',
|
|
@@ -327,11 +362,144 @@ class InstagramAccountsPanel extends Image.h {
|
|
|
327
362
|
});
|
|
328
363
|
}
|
|
329
364
|
|
|
365
|
+
resetLinkedInForm() {
|
|
366
|
+
this.linkedInUsername = '';
|
|
367
|
+
this.linkedInPassword = '';
|
|
368
|
+
this.linkedInCode = '';
|
|
369
|
+
this.linkedInCheckpointAccountId = '';
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
async handleConnectLinkedIn(e) {
|
|
373
|
+
e?.preventDefault?.();
|
|
374
|
+
const username = (this.linkedInUsername || '').trim();
|
|
375
|
+
const password = this.linkedInPassword || '';
|
|
376
|
+
if (!username || !password) {
|
|
377
|
+
toastHelper.showToast({
|
|
378
|
+
message: 'Enter LinkedIn email and password',
|
|
379
|
+
type: 'error',
|
|
380
|
+
position: 'bottom-right',
|
|
381
|
+
});
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
this.isLinkedInLoading = true;
|
|
386
|
+
try {
|
|
387
|
+
const data = await MessageSearch.connectSocialAccount({
|
|
388
|
+
platform: 'linkedin',
|
|
389
|
+
username,
|
|
390
|
+
password,
|
|
391
|
+
agentUserId: this.resolvedAgentUserId,
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
const accountId = MessageSearch.getSocialAccountIdFromConnect(data);
|
|
395
|
+
const needsCheckpoint =
|
|
396
|
+
MessageSearch.isSocialCheckpointRequired(data) ||
|
|
397
|
+
(Boolean(accountId) && String(data?.status || '').toLowerCase() !== 'connected');
|
|
398
|
+
if (needsCheckpoint) {
|
|
399
|
+
if (!accountId) throw new Error('No accountId returned for LinkedIn checkpoint');
|
|
400
|
+
this.linkedInCheckpointAccountId = accountId;
|
|
401
|
+
this.linkedInPassword = '';
|
|
402
|
+
toastHelper.showToast({
|
|
403
|
+
message: 'Enter the verification code from LinkedIn',
|
|
404
|
+
type: 'success',
|
|
405
|
+
position: 'bottom-right',
|
|
406
|
+
});
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
this.resetLinkedInForm();
|
|
411
|
+
await this.loadLinkedInAccounts({ notify: true });
|
|
412
|
+
toastHelper.showToast({
|
|
413
|
+
message: 'LinkedIn connected',
|
|
414
|
+
type: 'success',
|
|
415
|
+
position: 'bottom-right',
|
|
416
|
+
});
|
|
417
|
+
} catch (error) {
|
|
418
|
+
console.error('Failed to connect LinkedIn:', error);
|
|
419
|
+
toastHelper.showToast({
|
|
420
|
+
message: error?.message || 'Failed to connect LinkedIn',
|
|
421
|
+
type: 'error',
|
|
422
|
+
position: 'bottom-right',
|
|
423
|
+
});
|
|
424
|
+
} finally {
|
|
425
|
+
this.isLinkedInLoading = false;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
async handleLinkedInCheckpoint(e) {
|
|
430
|
+
e?.preventDefault?.();
|
|
431
|
+
const code = (this.linkedInCode || '').trim();
|
|
432
|
+
if (!this.linkedInCheckpointAccountId || !code) {
|
|
433
|
+
toastHelper.showToast({
|
|
434
|
+
message: 'Enter the LinkedIn verification code',
|
|
435
|
+
type: 'error',
|
|
436
|
+
position: 'bottom-right',
|
|
437
|
+
});
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
this.isLinkedInLoading = true;
|
|
442
|
+
try {
|
|
443
|
+
await MessageSearch.submitSocialConnectCheckpoint({
|
|
444
|
+
platform: 'linkedin',
|
|
445
|
+
accountId: this.linkedInCheckpointAccountId,
|
|
446
|
+
code,
|
|
447
|
+
agentUserId: this.resolvedAgentUserId,
|
|
448
|
+
});
|
|
449
|
+
this.resetLinkedInForm();
|
|
450
|
+
await this.loadLinkedInAccounts({ notify: true });
|
|
451
|
+
toastHelper.showToast({
|
|
452
|
+
message: 'LinkedIn connected',
|
|
453
|
+
type: 'success',
|
|
454
|
+
position: 'bottom-right',
|
|
455
|
+
});
|
|
456
|
+
} catch (error) {
|
|
457
|
+
console.error('Failed LinkedIn checkpoint:', error);
|
|
458
|
+
toastHelper.showToast({
|
|
459
|
+
message: error?.message || 'Failed to verify LinkedIn code',
|
|
460
|
+
type: 'error',
|
|
461
|
+
position: 'bottom-right',
|
|
462
|
+
});
|
|
463
|
+
} finally {
|
|
464
|
+
this.isLinkedInLoading = false;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
handleDisconnectLinkedIn(accountId, username) {
|
|
469
|
+
dialogDrawer.drawerDialogService.openDialog('confirm-dialog', {
|
|
470
|
+
title: 'Disconnect LinkedIn',
|
|
471
|
+
description: `Disconnect ${username || 'this LinkedIn account'}?`,
|
|
472
|
+
handleConfirm: async () => {
|
|
473
|
+
dialogDrawer.drawerDialogService.closeDialog('confirm-dialog');
|
|
474
|
+
this.isLinkedInLoading = true;
|
|
475
|
+
try {
|
|
476
|
+
await MessageSearch.deleteSocialAccount({ accountId });
|
|
477
|
+
await this.loadLinkedInAccounts({ notify: true });
|
|
478
|
+
toastHelper.showToast({
|
|
479
|
+
message: 'LinkedIn disconnected',
|
|
480
|
+
type: 'success',
|
|
481
|
+
position: 'bottom-right',
|
|
482
|
+
});
|
|
483
|
+
} catch (error) {
|
|
484
|
+
console.error('Failed to disconnect LinkedIn:', error);
|
|
485
|
+
toastHelper.showToast({
|
|
486
|
+
message: error?.message || 'Failed to disconnect LinkedIn',
|
|
487
|
+
type: 'error',
|
|
488
|
+
position: 'bottom-right',
|
|
489
|
+
});
|
|
490
|
+
} finally {
|
|
491
|
+
this.isLinkedInLoading = false;
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
|
|
330
497
|
renderSocialAccount(account) {
|
|
331
498
|
const name = account.displayName || account.username || 'Instagram';
|
|
332
499
|
const handle = account.username ? `@${account.username}` : '';
|
|
333
500
|
const isConnected = account.status === 'connected';
|
|
334
|
-
const gradId = `igGrad-${account.zernioAccountId || account.username || 'acc'}`;
|
|
501
|
+
const gradId = `igGrad-${account.zernioAccountId || account.accountId || account.username || 'acc'}`;
|
|
502
|
+
const accountId = account.zernioAccountId || account.accountId;
|
|
335
503
|
|
|
336
504
|
return Image.ke`
|
|
337
505
|
<article class="ig-card">
|
|
@@ -368,7 +536,48 @@ class InstagramAccountsPanel extends Image.h {
|
|
|
368
536
|
<button
|
|
369
537
|
type="button"
|
|
370
538
|
class="ig-disconnect"
|
|
371
|
-
@click=${() => this.handleDisconnectInstagram(
|
|
539
|
+
@click=${() => this.handleDisconnectInstagram(accountId, account.username)}
|
|
540
|
+
>
|
|
541
|
+
Disconnect
|
|
542
|
+
</button>
|
|
543
|
+
</div>
|
|
544
|
+
</article>
|
|
545
|
+
`;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
renderLinkedInAccount(account) {
|
|
549
|
+
const name = account.displayName || account.username || 'LinkedIn';
|
|
550
|
+
const handle = account.handle || (account.username ? account.username : '');
|
|
551
|
+
const isConnected = account.status === 'connected';
|
|
552
|
+
const accountId = account.accountId || account.unipileAccountId || account.zernioAccountId;
|
|
553
|
+
|
|
554
|
+
return Image.ke`
|
|
555
|
+
<article class="ig-card li-card">
|
|
556
|
+
<div class="ig-card-top">
|
|
557
|
+
<div class="li-mark" aria-hidden="true">
|
|
558
|
+
<svg viewBox="0 0 24 24" width="22" height="22" fill="#0a66c2">
|
|
559
|
+
<path d="M20.45 20.45h-3.55v-5.57c0-1.33-.02-3.04-1.85-3.04-1.85 0-2.14 1.45-2.14 2.94v5.67H9.36V9h3.41v1.56h.05c.47-.9 1.64-1.85 3.37-1.85 3.6 0 4.27 2.37 4.27 5.46v6.28zM5.34 7.43a2.06 2.06 0 1 1 0-4.12 2.06 2.06 0 0 1 0 4.12zM7.12 20.45H3.56V9h3.56v11.45zM22.23 0H1.77C.79 0 0 .77 0 1.73v20.54C0 23.23.79 24 1.77 24h20.46c.98 0 1.77-.77 1.77-1.73V1.73C24 .77 23.21 0 22.23 0z" />
|
|
560
|
+
</svg>
|
|
561
|
+
</div>
|
|
562
|
+
<div class="ig-identity">
|
|
563
|
+
<div class="ig-name-row">
|
|
564
|
+
<h3 class="ig-name">${name}</h3>
|
|
565
|
+
${isConnected
|
|
566
|
+
? Image.ke`<span class="ig-badge">Connected</span>`
|
|
567
|
+
: Image.ke`<span class="ig-badge is-muted">${account.status || 'Unknown'}</span>`}
|
|
568
|
+
</div>
|
|
569
|
+
${handle ? Image.ke`<p class="ig-handle">${handle}</p>` : null}
|
|
570
|
+
<p class="ig-connected-on">Connected ${this.formatSocialDate(account.connectedAt)}</p>
|
|
571
|
+
</div>
|
|
572
|
+
</div>
|
|
573
|
+
<div class="ig-actions">
|
|
574
|
+
${account.profileUrl
|
|
575
|
+
? Image.ke`<a class="ig-link" href=${account.profileUrl} target="_blank" rel="noopener noreferrer">View profile</a>`
|
|
576
|
+
: Image.ke`<span></span>`}
|
|
577
|
+
<button
|
|
578
|
+
type="button"
|
|
579
|
+
class="ig-disconnect"
|
|
580
|
+
@click=${() => this.handleDisconnectLinkedIn(accountId, account.username || account.handle)}
|
|
372
581
|
>
|
|
373
582
|
Disconnect
|
|
374
583
|
</button>
|
|
@@ -380,9 +589,9 @@ class InstagramAccountsPanel extends Image.h {
|
|
|
380
589
|
renderConnectInstagram() {
|
|
381
590
|
return Image.ke`
|
|
382
591
|
<div class="ig-empty">
|
|
383
|
-
<p class="ig-empty-title">Connect
|
|
592
|
+
<p class="ig-empty-title">Connect a social account to see chats</p>
|
|
384
593
|
<p class="ig-empty-copy">
|
|
385
|
-
Link
|
|
594
|
+
Link Instagram or LinkedIn. Chats stay hidden until at least one account is connected.
|
|
386
595
|
</p>
|
|
387
596
|
<button type="button" class="ig-connect" @click=${() => this.handleConnectInstagram()} ?disabled=${this.isSocialLoading}>
|
|
388
597
|
<span class="ig-mark" aria-hidden="true">
|
|
@@ -408,6 +617,79 @@ class InstagramAccountsPanel extends Image.h {
|
|
|
408
617
|
`;
|
|
409
618
|
}
|
|
410
619
|
|
|
620
|
+
renderLinkedInForm() {
|
|
621
|
+
if (this.linkedInCheckpointAccountId) {
|
|
622
|
+
return Image.ke`
|
|
623
|
+
<form class="li-form" @submit=${(e) => this.handleLinkedInCheckpoint(e)}>
|
|
624
|
+
<p class="ig-empty-copy">Enter the verification code LinkedIn sent you.</p>
|
|
625
|
+
<label class="li-label">
|
|
626
|
+
<span>Verification code</span>
|
|
627
|
+
<input
|
|
628
|
+
class="li-input"
|
|
629
|
+
type="text"
|
|
630
|
+
inputmode="numeric"
|
|
631
|
+
autocomplete="one-time-code"
|
|
632
|
+
.value=${this.linkedInCode}
|
|
633
|
+
@input=${(e) => { this.linkedInCode = e.target.value; }}
|
|
634
|
+
placeholder="6-digit code"
|
|
635
|
+
?disabled=${this.isLinkedInLoading}
|
|
636
|
+
/>
|
|
637
|
+
</label>
|
|
638
|
+
<div class="li-form-actions">
|
|
639
|
+
<button type="button" class="li-secondary" @click=${() => this.resetLinkedInForm()} ?disabled=${this.isLinkedInLoading}>
|
|
640
|
+
Back
|
|
641
|
+
</button>
|
|
642
|
+
<button type="submit" class="li-primary" ?disabled=${this.isLinkedInLoading}>
|
|
643
|
+
${this.isLinkedInLoading ? 'Verifying…' : 'Verify & connect'}
|
|
644
|
+
</button>
|
|
645
|
+
</div>
|
|
646
|
+
</form>
|
|
647
|
+
`;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
return Image.ke`
|
|
651
|
+
<form class="li-form" @submit=${(e) => this.handleConnectLinkedIn(e)}>
|
|
652
|
+
<label class="li-label">
|
|
653
|
+
<span>Email or username</span>
|
|
654
|
+
<input
|
|
655
|
+
class="li-input"
|
|
656
|
+
type="text"
|
|
657
|
+
autocomplete="username"
|
|
658
|
+
.value=${this.linkedInUsername}
|
|
659
|
+
@input=${(e) => { this.linkedInUsername = e.target.value; }}
|
|
660
|
+
placeholder="you@example.com"
|
|
661
|
+
?disabled=${this.isLinkedInLoading}
|
|
662
|
+
/>
|
|
663
|
+
</label>
|
|
664
|
+
<label class="li-label">
|
|
665
|
+
<span>Password</span>
|
|
666
|
+
<input
|
|
667
|
+
class="li-input"
|
|
668
|
+
type="password"
|
|
669
|
+
autocomplete="current-password"
|
|
670
|
+
.value=${this.linkedInPassword}
|
|
671
|
+
@input=${(e) => { this.linkedInPassword = e.target.value; }}
|
|
672
|
+
placeholder="LinkedIn password"
|
|
673
|
+
?disabled=${this.isLinkedInLoading}
|
|
674
|
+
/>
|
|
675
|
+
</label>
|
|
676
|
+
<button type="submit" class="li-primary li-primary-full" ?disabled=${this.isLinkedInLoading}>
|
|
677
|
+
${this.isLinkedInLoading ? 'Connecting…' : 'Connect LinkedIn'}
|
|
678
|
+
</button>
|
|
679
|
+
</form>
|
|
680
|
+
`;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
renderSkeleton() {
|
|
684
|
+
return Image.ke`<div class="ig-skeleton" aria-hidden="true">
|
|
685
|
+
<div class="ig-skeleton-mark"></div>
|
|
686
|
+
<div class="ig-skeleton-lines">
|
|
687
|
+
<div class="ig-skeleton-line wide"></div>
|
|
688
|
+
<div class="ig-skeleton-line"></div>
|
|
689
|
+
</div>
|
|
690
|
+
</div>`;
|
|
691
|
+
}
|
|
692
|
+
|
|
411
693
|
render() {
|
|
412
694
|
return Image.ke`
|
|
413
695
|
<div class="panel">
|
|
@@ -419,21 +701,27 @@ class InstagramAccountsPanel extends Image.h {
|
|
|
419
701
|
<path d="m249-207-42-42 231-231-231-231 42-42 231 231 231-231 42 42-231 231 231 231-42 42-231-231-231 231Z" />
|
|
420
702
|
</svg>
|
|
421
703
|
</div>`}
|
|
422
|
-
<h1 class="title">
|
|
704
|
+
<h1 class="title">Connected accounts</h1>
|
|
423
705
|
</div>
|
|
424
706
|
|
|
425
707
|
<div class="body">
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
708
|
+
<section class="platform-section">
|
|
709
|
+
<h2 class="section-title">Instagram</h2>
|
|
710
|
+
${this.isSocialLoading
|
|
711
|
+
? this.renderSkeleton()
|
|
712
|
+
: this.connectedAccounts.length
|
|
713
|
+
? this.connectedAccounts.map(account => this.renderSocialAccount(account))
|
|
714
|
+
: this.renderConnectInstagram()}
|
|
715
|
+
</section>
|
|
716
|
+
|
|
717
|
+
<section class="platform-section">
|
|
718
|
+
<h2 class="section-title">LinkedIn</h2>
|
|
719
|
+
${this.isLinkedInLoading && !this.linkedInCheckpointAccountId && !this.linkedInUsername
|
|
720
|
+
? this.renderSkeleton()
|
|
721
|
+
: this.connectedLinkedInAccounts.length
|
|
722
|
+
? this.connectedLinkedInAccounts.map(account => this.renderLinkedInAccount(account))
|
|
723
|
+
: this.renderLinkedInForm()}
|
|
724
|
+
</section>
|
|
437
725
|
</div>
|
|
438
726
|
|
|
439
727
|
<div class="bottom-actions">
|
|
@@ -493,6 +781,24 @@ class InstagramAccountsPanel extends Image.h {
|
|
|
493
781
|
.body {
|
|
494
782
|
flex: 1;
|
|
495
783
|
min-height: 0;
|
|
784
|
+
display: flex;
|
|
785
|
+
flex-direction: column;
|
|
786
|
+
gap: 28px;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
.platform-section {
|
|
790
|
+
display: flex;
|
|
791
|
+
flex-direction: column;
|
|
792
|
+
gap: 12px;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
.section-title {
|
|
796
|
+
margin: 0;
|
|
797
|
+
font-size: 0.8125rem;
|
|
798
|
+
font-weight: 600;
|
|
799
|
+
letter-spacing: 0.04em;
|
|
800
|
+
text-transform: uppercase;
|
|
801
|
+
color: var(--text-secondary-color);
|
|
496
802
|
}
|
|
497
803
|
|
|
498
804
|
.ig-card {
|
|
@@ -503,7 +809,7 @@ class InstagramAccountsPanel extends Image.h {
|
|
|
503
809
|
border-radius: 12px;
|
|
504
810
|
border: 1px solid var(--border-subtle, color-mix(in srgb, var(--text-primary-color) 10%, transparent));
|
|
505
811
|
background: color-mix(in srgb, var(--bg-secondary-color, #f5f5f5) 70%, transparent);
|
|
506
|
-
margin-bottom:
|
|
812
|
+
margin-bottom: 0;
|
|
507
813
|
animation: ig-in 280ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
508
814
|
}
|
|
509
815
|
|
|
@@ -530,16 +836,24 @@ class InstagramAccountsPanel extends Image.h {
|
|
|
530
836
|
gap: 12px;
|
|
531
837
|
}
|
|
532
838
|
|
|
533
|
-
.ig-mark
|
|
839
|
+
.ig-mark,
|
|
840
|
+
.li-mark {
|
|
534
841
|
width: 40px;
|
|
535
842
|
height: 40px;
|
|
536
843
|
border-radius: 12px;
|
|
537
844
|
display: grid;
|
|
538
845
|
place-items: center;
|
|
539
846
|
flex-shrink: 0;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
.ig-mark {
|
|
540
850
|
background: color-mix(in srgb, #dd2a7b 8%, var(--bg-primary-color, #fff));
|
|
541
851
|
}
|
|
542
852
|
|
|
853
|
+
.li-mark {
|
|
854
|
+
background: color-mix(in srgb, #0a66c2 10%, var(--bg-primary-color, #fff));
|
|
855
|
+
}
|
|
856
|
+
|
|
543
857
|
.ig-identity {
|
|
544
858
|
min-width: 0;
|
|
545
859
|
flex: 1;
|
|
@@ -645,7 +959,7 @@ class InstagramAccountsPanel extends Image.h {
|
|
|
645
959
|
display: flex;
|
|
646
960
|
flex-direction: column;
|
|
647
961
|
gap: 12px;
|
|
648
|
-
padding:
|
|
962
|
+
padding: 0;
|
|
649
963
|
}
|
|
650
964
|
|
|
651
965
|
.ig-empty-title {
|
|
@@ -691,6 +1005,78 @@ class InstagramAccountsPanel extends Image.h {
|
|
|
691
1005
|
line-height: 1.35;
|
|
692
1006
|
}
|
|
693
1007
|
|
|
1008
|
+
.li-form {
|
|
1009
|
+
display: flex;
|
|
1010
|
+
flex-direction: column;
|
|
1011
|
+
gap: 12px;
|
|
1012
|
+
padding: 14px;
|
|
1013
|
+
border-radius: 12px;
|
|
1014
|
+
border: 1px solid var(--border-subtle, color-mix(in srgb, var(--text-primary-color) 10%, transparent));
|
|
1015
|
+
background: color-mix(in srgb, var(--bg-secondary-color, #f5f5f5) 70%, transparent);
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
.li-label {
|
|
1019
|
+
display: flex;
|
|
1020
|
+
flex-direction: column;
|
|
1021
|
+
gap: 6px;
|
|
1022
|
+
font-size: 0.75rem;
|
|
1023
|
+
font-weight: 500;
|
|
1024
|
+
color: var(--text-secondary-color);
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
.li-input {
|
|
1028
|
+
width: 100%;
|
|
1029
|
+
box-sizing: border-box;
|
|
1030
|
+
padding: 10px 12px;
|
|
1031
|
+
border-radius: 8px;
|
|
1032
|
+
border: 1px solid var(--border-subtle, color-mix(in srgb, var(--text-primary-color) 14%, transparent));
|
|
1033
|
+
background: var(--bg-primary-color, #fff);
|
|
1034
|
+
color: var(--text-primary-color);
|
|
1035
|
+
font-size: 0.875rem;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
.li-input:focus {
|
|
1039
|
+
outline: 2px solid color-mix(in srgb, #0a66c2 35%, transparent);
|
|
1040
|
+
outline-offset: 1px;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
.li-form-actions {
|
|
1044
|
+
display: flex;
|
|
1045
|
+
gap: 8px;
|
|
1046
|
+
justify-content: flex-end;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
.li-primary,
|
|
1050
|
+
.li-secondary {
|
|
1051
|
+
border: none;
|
|
1052
|
+
border-radius: 8px;
|
|
1053
|
+
padding: 10px 14px;
|
|
1054
|
+
font-size: 0.8125rem;
|
|
1055
|
+
font-weight: 600;
|
|
1056
|
+
cursor: pointer;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
.li-primary {
|
|
1060
|
+
background: #0a66c2;
|
|
1061
|
+
color: #fff;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
.li-primary-full {
|
|
1065
|
+
width: 100%;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
.li-primary:disabled,
|
|
1069
|
+
.li-secondary:disabled {
|
|
1070
|
+
opacity: 0.6;
|
|
1071
|
+
cursor: not-allowed;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
.li-secondary {
|
|
1075
|
+
background: transparent;
|
|
1076
|
+
color: var(--text-secondary-color);
|
|
1077
|
+
border: 1px solid var(--border-subtle, color-mix(in srgb, var(--text-primary-color) 14%, transparent));
|
|
1078
|
+
}
|
|
1079
|
+
|
|
694
1080
|
.ig-skeleton {
|
|
695
1081
|
display: flex;
|
|
696
1082
|
align-items: center;
|
|
@@ -930,9 +1316,29 @@ const WebChat = class {
|
|
|
930
1316
|
if (parts.length === 2)
|
|
931
1317
|
return parts.pop().split(';').shift();
|
|
932
1318
|
};
|
|
933
|
-
//
|
|
934
|
-
this.userTokenFromCookie =
|
|
935
|
-
this.isometrikUserIdFromCookie =
|
|
1319
|
+
// Filled from parent <web-chat> props in applyParentCreds()
|
|
1320
|
+
this.userTokenFromCookie = '';
|
|
1321
|
+
this.isometrikUserIdFromCookie = '';
|
|
1322
|
+
/** Copy parent props into CHAT_CREDS so API helpers use host values (no hardcode). */
|
|
1323
|
+
this.applyParentCreds = () => {
|
|
1324
|
+
var _a;
|
|
1325
|
+
const pick = (prop, fallback = '') => typeof prop === 'string' && prop.trim() ? prop.trim() : fallback;
|
|
1326
|
+
chatCreds.CHAT_CREDS.userToken = pick(this.userToken);
|
|
1327
|
+
chatCreds.CHAT_CREDS.appSecret = pick(this.appSecret);
|
|
1328
|
+
chatCreds.CHAT_CREDS.licenseKey = pick(this.licenseKey);
|
|
1329
|
+
chatCreds.CHAT_CREDS.userSecret = pick(this.userSecret);
|
|
1330
|
+
chatCreds.CHAT_CREDS.accountId = pick(this.accountId);
|
|
1331
|
+
chatCreds.CHAT_CREDS.keysetId = pick(this.keysetId);
|
|
1332
|
+
chatCreds.CHAT_CREDS.projectId = pick(this.projectId);
|
|
1333
|
+
chatCreds.CHAT_CREDS.isometrikUserId = pick(this.isometrikUserId);
|
|
1334
|
+
chatCreds.CHAT_CREDS.baseUrl = pick(this.baseUrl, chatCreds.CHAT_CREDS.baseUrl || 'https://apis.isometrik.ai');
|
|
1335
|
+
chatCreds.CHAT_CREDS.socialRedirectUrl = pick(this.socialRedirectUrl);
|
|
1336
|
+
if ((_a = this.hostUrl) === null || _a === void 0 ? void 0 : _a.trim()) {
|
|
1337
|
+
chatCreds.MQTT_CREDS.URL = this.hostUrl.trim();
|
|
1338
|
+
}
|
|
1339
|
+
this.userTokenFromCookie = chatCreds.CHAT_CREDS.userToken;
|
|
1340
|
+
this.isometrikUserIdFromCookie = chatCreds.CHAT_CREDS.isometrikUserId;
|
|
1341
|
+
};
|
|
936
1342
|
this.clearConversationState = () => {
|
|
937
1343
|
this.allConversationList = [];
|
|
938
1344
|
this.selectedConversationId = null;
|
|
@@ -956,8 +1362,7 @@ const WebChat = class {
|
|
|
956
1362
|
window.history.replaceState({}, '', url);
|
|
957
1363
|
}
|
|
958
1364
|
};
|
|
959
|
-
this.
|
|
960
|
-
const connected = MessageSearch.hasConnectedInstagramAccounts(accounts);
|
|
1365
|
+
this.applySocialGate = (connected, options = {}) => {
|
|
961
1366
|
const wasConnected = this.isInstagramConnected;
|
|
962
1367
|
this.isInstagramConnected = connected;
|
|
963
1368
|
if (!connected) {
|
|
@@ -971,9 +1376,15 @@ const WebChat = class {
|
|
|
971
1376
|
void this.loadConversationsAfterInstagramConnect();
|
|
972
1377
|
}
|
|
973
1378
|
};
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
1379
|
+
/** Unlock when Instagram OR LinkedIn has at least one connected account. */
|
|
1380
|
+
this.refreshInstagramConnectionGate = async (options = { bootstrap: true }) => {
|
|
1381
|
+
const [igData, liData] = await Promise.all([
|
|
1382
|
+
MessageSearch.getSocialAccounts({ platform: 'instagram' }).catch(() => ({ accounts: [] })),
|
|
1383
|
+
MessageSearch.getSocialAccounts({ platform: 'linkedin' }).catch(() => ({ accounts: [] })),
|
|
1384
|
+
]);
|
|
1385
|
+
const connected = MessageSearch.hasConnectedInstagramAccounts((igData === null || igData === void 0 ? void 0 : igData.accounts) || []) ||
|
|
1386
|
+
MessageSearch.hasConnectedInstagramAccounts((liData === null || liData === void 0 ? void 0 : liData.accounts) || []);
|
|
1387
|
+
this.applySocialGate(connected, options);
|
|
977
1388
|
};
|
|
978
1389
|
this.loadConversationsAfterInstagramConnect = async () => {
|
|
979
1390
|
if (!this.isInstagramConnected)
|
|
@@ -989,14 +1400,14 @@ const WebChat = class {
|
|
|
989
1400
|
await this.getConversations();
|
|
990
1401
|
}
|
|
991
1402
|
catch (error) {
|
|
992
|
-
console.error('Failed to load conversations after
|
|
1403
|
+
console.error('Failed to load conversations after social connect:', error);
|
|
993
1404
|
}
|
|
994
1405
|
finally {
|
|
995
1406
|
this.isConversationLoading = false;
|
|
996
1407
|
}
|
|
997
1408
|
};
|
|
998
|
-
this.handleInstagramAccountsChange = (
|
|
999
|
-
this.
|
|
1409
|
+
this.handleInstagramAccountsChange = (_accounts) => {
|
|
1410
|
+
void this.refreshInstagramConnectionGate({ bootstrap: false });
|
|
1000
1411
|
};
|
|
1001
1412
|
this.openChatTab = () => {
|
|
1002
1413
|
if (this.isInstagramConnected) {
|
|
@@ -1612,11 +2023,7 @@ const WebChat = class {
|
|
|
1612
2023
|
this.isMobileView = window.innerWidth <= 768;
|
|
1613
2024
|
}
|
|
1614
2025
|
componentWillLoad() {
|
|
1615
|
-
|
|
1616
|
-
// Instagram OAuth return URL — host page where accounts are linked
|
|
1617
|
-
if ((_a = this.socialRedirectUrl) === null || _a === void 0 ? void 0 : _a.trim()) {
|
|
1618
|
-
chatCreds.CHAT_CREDS.socialRedirectUrl = this.socialRedirectUrl.trim();
|
|
1619
|
-
}
|
|
2026
|
+
this.applyParentCreds();
|
|
1620
2027
|
// OAuth popup return: notify opener ASAP and close (skip full chat boot)
|
|
1621
2028
|
if (MessageSearch.notifyOpenerIfSocialPopupCallback())
|
|
1622
2029
|
return;
|
|
@@ -1656,12 +2063,13 @@ const WebChat = class {
|
|
|
1656
2063
|
// Initialize SDK
|
|
1657
2064
|
try {
|
|
1658
2065
|
this.updateLoading(25, 'Initializing chat SDK...');
|
|
2066
|
+
this.applyParentCreds();
|
|
1659
2067
|
Image.M.initializeInstance({
|
|
1660
2068
|
baseUrl: chatCreds.CHAT_CREDS.baseUrl,
|
|
1661
2069
|
licenseKey: chatCreds.CHAT_CREDS.licenseKey,
|
|
1662
2070
|
appSecret: chatCreds.CHAT_CREDS.appSecret,
|
|
1663
2071
|
userSecret: chatCreds.CHAT_CREDS.userSecret,
|
|
1664
|
-
userToken:
|
|
2072
|
+
userToken: chatCreds.CHAT_CREDS.userToken,
|
|
1665
2073
|
});
|
|
1666
2074
|
this.isInitialized = true;
|
|
1667
2075
|
}
|
|
@@ -1687,18 +2095,18 @@ const WebChat = class {
|
|
|
1687
2095
|
catch (userError) {
|
|
1688
2096
|
console.error('Failed to get user details:', userError);
|
|
1689
2097
|
}
|
|
1690
|
-
// Gate chats behind
|
|
2098
|
+
// Gate chats behind any connected social account (Instagram or LinkedIn)
|
|
1691
2099
|
try {
|
|
1692
|
-
this.updateLoading(65, 'Checking
|
|
2100
|
+
this.updateLoading(65, 'Checking social connections...');
|
|
1693
2101
|
await this.refreshInstagramConnectionGate();
|
|
1694
2102
|
}
|
|
1695
2103
|
catch (igError) {
|
|
1696
|
-
console.error('Failed to check
|
|
1697
|
-
this.
|
|
2104
|
+
console.error('Failed to check social accounts:', igError);
|
|
2105
|
+
this.applySocialGate(false, { bootstrap: true });
|
|
1698
2106
|
}
|
|
1699
2107
|
if (!this.isInstagramConnected) {
|
|
1700
2108
|
this.activeTab = 'Accounts';
|
|
1701
|
-
this.updateLoading(100, 'Connect Instagram to continue');
|
|
2109
|
+
this.updateLoading(100, 'Connect Instagram or LinkedIn to continue');
|
|
1702
2110
|
this.checkMobileView();
|
|
1703
2111
|
window.addEventListener('resize', this.checkMobileView.bind(this));
|
|
1704
2112
|
return;
|
|
@@ -1776,10 +2184,12 @@ const WebChat = class {
|
|
|
1776
2184
|
}
|
|
1777
2185
|
}
|
|
1778
2186
|
async setupMqttClient() {
|
|
2187
|
+
var _a;
|
|
1779
2188
|
// let retryToConnect:any = null;
|
|
1780
2189
|
const deviceID = await dialogDrawer.getDeviceID();
|
|
2190
|
+
this.applyParentCreds();
|
|
1781
2191
|
const mqttClient = Image.M.getInstance().initializeMqtt({
|
|
1782
|
-
hostUri: chatCreds.MQTT_CREDS.URL
|
|
2192
|
+
hostUri: ((_a = this.hostUrl) === null || _a === void 0 ? void 0 : _a.trim()) || chatCreds.MQTT_CREDS.URL,
|
|
1783
2193
|
clientId: chatCreds.CHAT_CREDS.isometrikUserId,
|
|
1784
2194
|
licenseKey: chatCreds.CHAT_CREDS.licenseKey,
|
|
1785
2195
|
projectId: chatCreds.CHAT_CREDS.projectId,
|
|
@@ -1787,15 +2197,6 @@ const WebChat = class {
|
|
|
1787
2197
|
accountId: chatCreds.CHAT_CREDS.accountId,
|
|
1788
2198
|
deviceId: deviceID,
|
|
1789
2199
|
});
|
|
1790
|
-
// const mqttClient = ChatSDK.getInstance().initializeMqtt({
|
|
1791
|
-
// hostUri: this.hostUrl,
|
|
1792
|
-
// clientId: this.isometrikUserId,
|
|
1793
|
-
// licenseKey: this.licenseKey,
|
|
1794
|
-
// projectId: this.projectId,
|
|
1795
|
-
// keysetId: this.keysetId,
|
|
1796
|
-
// accountId: this.accountId,
|
|
1797
|
-
// deviceId: deviceID,
|
|
1798
|
-
// });
|
|
1799
2200
|
this.mqttClient = mqttClient;
|
|
1800
2201
|
let refetchInterval = null;
|
|
1801
2202
|
this.isMqttConnected = false;
|
|
@@ -2817,7 +3218,7 @@ const WebChat = class {
|
|
|
2817
3218
|
}
|
|
2818
3219
|
render() {
|
|
2819
3220
|
var _a, _b, _c, _d, _e;
|
|
2820
|
-
return (index.h(index.Fragment, { key: '
|
|
3221
|
+
return (index.h(index.Fragment, { key: '48018669b503b2bb6fee4d774d69800cad5e913e' }, this.isLoading ? (index.h("chat-loading-placeholder", { progress: this.loadingProgress, loadingStatus: this.loadingStatus })) : (index.h(index.Fragment, null, this.isConversationLoading ? (index.h("div", { class: "loaderoverlay" }, index.h("spinner-loader", { height: "30px", width: "30px", spinTime: "1s", spinnerPrimaryColor: "var(--bg-primary-color)", spinnerSecondaryColor: "var(--text-primary-color)", spinnerBorderWidth: "2px" }))) : null, index.h("div", { class: {
|
|
2821
3222
|
'isometrik-quickchat': true,
|
|
2822
3223
|
'is-resizing': this.isResizingSidebar,
|
|
2823
3224
|
'is-instagram-gate': !this.isInstagramConnected,
|
|
@@ -2881,4 +3282,4 @@ WebChat.style = WebChatStyle0;
|
|
|
2881
3282
|
|
|
2882
3283
|
exports.WebChat = WebChat;
|
|
2883
3284
|
|
|
2884
|
-
//# sourceMappingURL=WebChat-
|
|
3285
|
+
//# sourceMappingURL=WebChat-11c06cb9.js.map
|