isometrik-plugin-chat-sdk 1.0.1 → 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-f5b72462.js → MessageSearch-a73ca677.js} +82 -11
- package/dist/cjs/MessageSearch-a73ca677.js.map +1 -0
- package/dist/cjs/{WebChat-2329244b.js → WebChat-11c06cb9.js} +428 -37
- package/dist/cjs/WebChat-11c06cb9.js.map +1 -0
- package/dist/cjs/audio-bubble_8.cjs.entry.js +1 -1
- package/dist/cjs/chat-app.cjs.entry.js +2 -2
- package/dist/cjs/theme-provider_2.cjs.entry.js +2 -2
- package/dist/collection/api/social-accounts.js +77 -9
- package/dist/collection/components/my-component/web-chat/WebChat.js +19 -14
- package/dist/collection/components/my-component/web-chat/WebChat.js.map +1 -1
- package/dist/collection/stories/Components/InstagramAccounts/InstagramAccountsPanel.js +412 -22
- package/dist/esm/{MessageSearch-4010486c.js → MessageSearch-69b3a0f3.js} +79 -11
- package/dist/esm/MessageSearch-69b3a0f3.js.map +1 -0
- package/dist/esm/{WebChat-95518d72.js → WebChat-372df148.js} +428 -37
- package/dist/esm/WebChat-372df148.js.map +1 -0
- package/dist/esm/audio-bubble_8.entry.js +2 -2
- package/dist/esm/chat-app.entry.js +2 -2
- package/dist/esm/theme-provider_2.entry.js +2 -2
- package/dist/isometrik-webchat/isometrik-webchat.esm.js +1 -1
- package/dist/isometrik-webchat/{p-d7e335cb.entry.js → p-56fbdbc3.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-35f143c9.entry.js → p-8456ee94.entry.js} +2 -2
- package/dist/isometrik-webchat/{p-55355714.js → p-9058d82c.js} +17 -17
- 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-675c105e.entry.js → p-e66e5e61.entry.js} +2 -2
- package/package.json +1 -1
- package/readme.md +5 -5
- package/dist/cjs/MessageSearch-f5b72462.js.map +0 -1
- package/dist/cjs/WebChat-2329244b.js.map +0 -1
- package/dist/esm/MessageSearch-4010486c.js.map +0 -1
- package/dist/esm/WebChat-95518d72.js.map +0 -1
- package/dist/isometrik-webchat/p-55355714.js.map +0 -1
- package/dist/isometrik-webchat/p-e954c29f.js +0 -591
- package/dist/isometrik-webchat/p-e954c29f.js.map +0 -1
- /package/dist/isometrik-webchat/{p-d7e335cb.entry.js.map → p-56fbdbc3.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-35f143c9.entry.js.map → p-8456ee94.entry.js.map} +0 -0
- /package/dist/isometrik-webchat/{p-675c105e.entry.js.map → p-e66e5e61.entry.js.map} +0 -0
|
@@ -6,7 +6,7 @@ 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;
|
|
@@ -976,8 +1362,7 @@ const WebChat = class {
|
|
|
976
1362
|
window.history.replaceState({}, '', url);
|
|
977
1363
|
}
|
|
978
1364
|
};
|
|
979
|
-
this.
|
|
980
|
-
const connected = MessageSearch.hasConnectedInstagramAccounts(accounts);
|
|
1365
|
+
this.applySocialGate = (connected, options = {}) => {
|
|
981
1366
|
const wasConnected = this.isInstagramConnected;
|
|
982
1367
|
this.isInstagramConnected = connected;
|
|
983
1368
|
if (!connected) {
|
|
@@ -991,9 +1376,15 @@ const WebChat = class {
|
|
|
991
1376
|
void this.loadConversationsAfterInstagramConnect();
|
|
992
1377
|
}
|
|
993
1378
|
};
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
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);
|
|
997
1388
|
};
|
|
998
1389
|
this.loadConversationsAfterInstagramConnect = async () => {
|
|
999
1390
|
if (!this.isInstagramConnected)
|
|
@@ -1009,14 +1400,14 @@ const WebChat = class {
|
|
|
1009
1400
|
await this.getConversations();
|
|
1010
1401
|
}
|
|
1011
1402
|
catch (error) {
|
|
1012
|
-
console.error('Failed to load conversations after
|
|
1403
|
+
console.error('Failed to load conversations after social connect:', error);
|
|
1013
1404
|
}
|
|
1014
1405
|
finally {
|
|
1015
1406
|
this.isConversationLoading = false;
|
|
1016
1407
|
}
|
|
1017
1408
|
};
|
|
1018
|
-
this.handleInstagramAccountsChange = (
|
|
1019
|
-
this.
|
|
1409
|
+
this.handleInstagramAccountsChange = (_accounts) => {
|
|
1410
|
+
void this.refreshInstagramConnectionGate({ bootstrap: false });
|
|
1020
1411
|
};
|
|
1021
1412
|
this.openChatTab = () => {
|
|
1022
1413
|
if (this.isInstagramConnected) {
|
|
@@ -1704,18 +2095,18 @@ const WebChat = class {
|
|
|
1704
2095
|
catch (userError) {
|
|
1705
2096
|
console.error('Failed to get user details:', userError);
|
|
1706
2097
|
}
|
|
1707
|
-
// Gate chats behind
|
|
2098
|
+
// Gate chats behind any connected social account (Instagram or LinkedIn)
|
|
1708
2099
|
try {
|
|
1709
|
-
this.updateLoading(65, 'Checking
|
|
2100
|
+
this.updateLoading(65, 'Checking social connections...');
|
|
1710
2101
|
await this.refreshInstagramConnectionGate();
|
|
1711
2102
|
}
|
|
1712
2103
|
catch (igError) {
|
|
1713
|
-
console.error('Failed to check
|
|
1714
|
-
this.
|
|
2104
|
+
console.error('Failed to check social accounts:', igError);
|
|
2105
|
+
this.applySocialGate(false, { bootstrap: true });
|
|
1715
2106
|
}
|
|
1716
2107
|
if (!this.isInstagramConnected) {
|
|
1717
2108
|
this.activeTab = 'Accounts';
|
|
1718
|
-
this.updateLoading(100, 'Connect Instagram to continue');
|
|
2109
|
+
this.updateLoading(100, 'Connect Instagram or LinkedIn to continue');
|
|
1719
2110
|
this.checkMobileView();
|
|
1720
2111
|
window.addEventListener('resize', this.checkMobileView.bind(this));
|
|
1721
2112
|
return;
|
|
@@ -2827,7 +3218,7 @@ const WebChat = class {
|
|
|
2827
3218
|
}
|
|
2828
3219
|
render() {
|
|
2829
3220
|
var _a, _b, _c, _d, _e;
|
|
2830
|
-
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: {
|
|
2831
3222
|
'isometrik-quickchat': true,
|
|
2832
3223
|
'is-resizing': this.isResizingSidebar,
|
|
2833
3224
|
'is-instagram-gate': !this.isInstagramConnected,
|
|
@@ -2891,4 +3282,4 @@ WebChat.style = WebChatStyle0;
|
|
|
2891
3282
|
|
|
2892
3283
|
exports.WebChat = WebChat;
|
|
2893
3284
|
|
|
2894
|
-
//# sourceMappingURL=WebChat-
|
|
3285
|
+
//# sourceMappingURL=WebChat-11c06cb9.js.map
|