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.
Files changed (38) hide show
  1. package/dist/cjs/{MessageSearch-f5b72462.js → MessageSearch-a73ca677.js} +82 -11
  2. package/dist/cjs/MessageSearch-a73ca677.js.map +1 -0
  3. package/dist/cjs/{WebChat-2329244b.js → WebChat-11c06cb9.js} +428 -37
  4. package/dist/cjs/WebChat-11c06cb9.js.map +1 -0
  5. package/dist/cjs/audio-bubble_8.cjs.entry.js +1 -1
  6. package/dist/cjs/chat-app.cjs.entry.js +2 -2
  7. package/dist/cjs/theme-provider_2.cjs.entry.js +2 -2
  8. package/dist/collection/api/social-accounts.js +77 -9
  9. package/dist/collection/components/my-component/web-chat/WebChat.js +19 -14
  10. package/dist/collection/components/my-component/web-chat/WebChat.js.map +1 -1
  11. package/dist/collection/stories/Components/InstagramAccounts/InstagramAccountsPanel.js +412 -22
  12. package/dist/esm/{MessageSearch-4010486c.js → MessageSearch-69b3a0f3.js} +79 -11
  13. package/dist/esm/MessageSearch-69b3a0f3.js.map +1 -0
  14. package/dist/esm/{WebChat-95518d72.js → WebChat-372df148.js} +428 -37
  15. package/dist/esm/WebChat-372df148.js.map +1 -0
  16. package/dist/esm/audio-bubble_8.entry.js +2 -2
  17. package/dist/esm/chat-app.entry.js +2 -2
  18. package/dist/esm/theme-provider_2.entry.js +2 -2
  19. package/dist/isometrik-webchat/isometrik-webchat.esm.js +1 -1
  20. package/dist/isometrik-webchat/{p-d7e335cb.entry.js → p-56fbdbc3.entry.js} +2 -2
  21. package/dist/isometrik-webchat/{p-35f143c9.entry.js → p-8456ee94.entry.js} +2 -2
  22. package/dist/isometrik-webchat/{p-55355714.js → p-9058d82c.js} +17 -17
  23. package/dist/isometrik-webchat/p-9058d82c.js.map +1 -0
  24. package/dist/isometrik-webchat/p-9588b7ec.js +780 -0
  25. package/dist/isometrik-webchat/p-9588b7ec.js.map +1 -0
  26. package/dist/isometrik-webchat/{p-675c105e.entry.js → p-e66e5e61.entry.js} +2 -2
  27. package/package.json +1 -1
  28. package/readme.md +5 -5
  29. package/dist/cjs/MessageSearch-f5b72462.js.map +0 -1
  30. package/dist/cjs/WebChat-2329244b.js.map +0 -1
  31. package/dist/esm/MessageSearch-4010486c.js.map +0 -1
  32. package/dist/esm/WebChat-95518d72.js.map +0 -1
  33. package/dist/isometrik-webchat/p-55355714.js.map +0 -1
  34. package/dist/isometrik-webchat/p-e954c29f.js +0 -591
  35. package/dist/isometrik-webchat/p-e954c29f.js.map +0 -1
  36. /package/dist/isometrik-webchat/{p-d7e335cb.entry.js.map → p-56fbdbc3.entry.js.map} +0 -0
  37. /package/dist/isometrik-webchat/{p-35f143c9.entry.js.map → p-8456ee94.entry.js.map} +0 -0
  38. /package/dist/isometrik-webchat/{p-675c105e.entry.js.map → p-e66e5e61.entry.js.map} +0 -0
@@ -4,7 +4,7 @@ import { C as CHAT_CREDS, M as MQTT_CREDS } from './chat-creds-99dd8834.js';
4
4
  import { a as drawerDialogService, b as getDeviceID, c as getGroupcastUrlQuery } from './dialog-drawer-9fa083b1.js';
5
5
  import { r as removeConversationMember, g as getConversationEligibleMembers } from './group-members-bb3c8db7.js';
6
6
  import { s as showToast } from './toast-helper-840fd8dc.js';
7
- import { g as getConnectedInstagramAccounts, a as getSocialAccounts, c as connectSocialAccountCallback, b as connectSocialAccount, o as openSocialAuthPopup, d as deleteSocialAccount, e as getSocialRedirectUrl, f as createStore, h as hasConnectedInstagramAccounts, n as notifyOpenerIfSocialPopupCallback, p as parseSocialCallbackParams, i as clearSocialCallbackParamsFromUrl, j as groupMembersStore } from './MessageSearch-4010486c.js';
7
+ import { g as getConnectedSocialAccounts, a as getSocialAccounts, c as connectSocialAccountCallback, b as connectSocialAccount, o as openSocialAuthPopup, d as deleteSocialAccount, i as isSocialCheckpointRequired, s as submitSocialConnectCheckpoint, e as getSocialRedirectUrl, f as getSocialAccountIdFromConnect, h as createStore, j as hasConnectedInstagramAccounts, n as notifyOpenerIfSocialPopupCallback, p as parseSocialCallbackParams, k as clearSocialCallbackParamsFromUrl, l as groupMembersStore } from './MessageSearch-69b3a0f3.js';
8
8
  import { W as WEB_CONTENT } from './content-5aea5e39.js';
9
9
  import { g as getGroupcast, a as getGroupcastMembers, b as getGroupcastMessage, r as removeGroupcastMember, d as deleteGroupCast } from './groupcast-d1c54a27.js';
10
10
 
@@ -184,7 +184,13 @@ class InstagramAccountsPanel extends h {
184
184
  /** When true, hide the X close (e.g. Instagram gate — no chat to return to). */
185
185
  hideClose: { type: Boolean },
186
186
  socialAccounts: { type: Array },
187
+ linkedInAccounts: { type: Array },
187
188
  isSocialLoading: { type: Boolean },
189
+ isLinkedInLoading: { type: Boolean },
190
+ linkedInUsername: { type: String },
191
+ linkedInPassword: { type: String },
192
+ linkedInCode: { type: String },
193
+ linkedInCheckpointAccountId: { type: String },
188
194
  };
189
195
 
190
196
  constructor() {
@@ -196,16 +202,31 @@ class InstagramAccountsPanel extends h {
196
202
  this.accountsChange = null;
197
203
  this.hideClose = false;
198
204
  this.socialAccounts = [];
205
+ this.linkedInAccounts = [];
199
206
  this.isSocialLoading = false;
207
+ this.isLinkedInLoading = false;
208
+ this.linkedInUsername = '';
209
+ this.linkedInPassword = '';
210
+ this.linkedInCode = '';
211
+ this.linkedInCheckpointAccountId = '';
200
212
  }
201
213
 
202
214
  get connectedAccounts() {
203
- return getConnectedInstagramAccounts(this.socialAccounts);
215
+ return getConnectedSocialAccounts(this.socialAccounts);
216
+ }
217
+
218
+ get connectedLinkedInAccounts() {
219
+ return getConnectedSocialAccounts(this.linkedInAccounts);
220
+ }
221
+
222
+ get resolvedAgentUserId() {
223
+ return this.agentUserId || CHAT_CREDS.isometrikUserId || '';
204
224
  }
205
225
 
206
226
  connectedCallback() {
207
227
  super.connectedCallback();
208
228
  this.loadSocialAccounts();
229
+ this.loadLinkedInAccounts();
209
230
  }
210
231
 
211
232
  notifyAccountsChange(accounts = this.socialAccounts) {
@@ -238,6 +259,21 @@ class InstagramAccountsPanel extends h {
238
259
  }
239
260
  }
240
261
 
262
+ async loadLinkedInAccounts({ notify = false } = {}) {
263
+ this.isLinkedInLoading = true;
264
+ try {
265
+ const data = await getSocialAccounts({ platform: 'linkedin' });
266
+ this.linkedInAccounts = data?.accounts || [];
267
+ if (notify) this.notifyAccountsChange();
268
+ } catch (error) {
269
+ console.error('Failed to load LinkedIn accounts:', error);
270
+ this.linkedInAccounts = [];
271
+ if (notify) this.notifyAccountsChange();
272
+ } finally {
273
+ this.isLinkedInLoading = false;
274
+ }
275
+ }
276
+
241
277
  formatSocialDate(ts) {
242
278
  if (!ts) return '-';
243
279
  try {
@@ -304,7 +340,6 @@ class InstagramAccountsPanel extends h {
304
340
  this.isSocialLoading = true;
305
341
  try {
306
342
  await deleteSocialAccount({ accountId });
307
- // API soft-disconnects (status=disconnected) — reload truth from server
308
343
  await this.loadSocialAccounts();
309
344
  showToast({
310
345
  message: 'Instagram disconnected',
@@ -325,11 +360,144 @@ class InstagramAccountsPanel extends h {
325
360
  });
326
361
  }
327
362
 
363
+ resetLinkedInForm() {
364
+ this.linkedInUsername = '';
365
+ this.linkedInPassword = '';
366
+ this.linkedInCode = '';
367
+ this.linkedInCheckpointAccountId = '';
368
+ }
369
+
370
+ async handleConnectLinkedIn(e) {
371
+ e?.preventDefault?.();
372
+ const username = (this.linkedInUsername || '').trim();
373
+ const password = this.linkedInPassword || '';
374
+ if (!username || !password) {
375
+ showToast({
376
+ message: 'Enter LinkedIn email and password',
377
+ type: 'error',
378
+ position: 'bottom-right',
379
+ });
380
+ return;
381
+ }
382
+
383
+ this.isLinkedInLoading = true;
384
+ try {
385
+ const data = await connectSocialAccount({
386
+ platform: 'linkedin',
387
+ username,
388
+ password,
389
+ agentUserId: this.resolvedAgentUserId,
390
+ });
391
+
392
+ const accountId = getSocialAccountIdFromConnect(data);
393
+ const needsCheckpoint =
394
+ isSocialCheckpointRequired(data) ||
395
+ (Boolean(accountId) && String(data?.status || '').toLowerCase() !== 'connected');
396
+ if (needsCheckpoint) {
397
+ if (!accountId) throw new Error('No accountId returned for LinkedIn checkpoint');
398
+ this.linkedInCheckpointAccountId = accountId;
399
+ this.linkedInPassword = '';
400
+ showToast({
401
+ message: 'Enter the verification code from LinkedIn',
402
+ type: 'success',
403
+ position: 'bottom-right',
404
+ });
405
+ return;
406
+ }
407
+
408
+ this.resetLinkedInForm();
409
+ await this.loadLinkedInAccounts({ notify: true });
410
+ showToast({
411
+ message: 'LinkedIn connected',
412
+ type: 'success',
413
+ position: 'bottom-right',
414
+ });
415
+ } catch (error) {
416
+ console.error('Failed to connect LinkedIn:', error);
417
+ showToast({
418
+ message: error?.message || 'Failed to connect LinkedIn',
419
+ type: 'error',
420
+ position: 'bottom-right',
421
+ });
422
+ } finally {
423
+ this.isLinkedInLoading = false;
424
+ }
425
+ }
426
+
427
+ async handleLinkedInCheckpoint(e) {
428
+ e?.preventDefault?.();
429
+ const code = (this.linkedInCode || '').trim();
430
+ if (!this.linkedInCheckpointAccountId || !code) {
431
+ showToast({
432
+ message: 'Enter the LinkedIn verification code',
433
+ type: 'error',
434
+ position: 'bottom-right',
435
+ });
436
+ return;
437
+ }
438
+
439
+ this.isLinkedInLoading = true;
440
+ try {
441
+ await submitSocialConnectCheckpoint({
442
+ platform: 'linkedin',
443
+ accountId: this.linkedInCheckpointAccountId,
444
+ code,
445
+ agentUserId: this.resolvedAgentUserId,
446
+ });
447
+ this.resetLinkedInForm();
448
+ await this.loadLinkedInAccounts({ notify: true });
449
+ showToast({
450
+ message: 'LinkedIn connected',
451
+ type: 'success',
452
+ position: 'bottom-right',
453
+ });
454
+ } catch (error) {
455
+ console.error('Failed LinkedIn checkpoint:', error);
456
+ showToast({
457
+ message: error?.message || 'Failed to verify LinkedIn code',
458
+ type: 'error',
459
+ position: 'bottom-right',
460
+ });
461
+ } finally {
462
+ this.isLinkedInLoading = false;
463
+ }
464
+ }
465
+
466
+ handleDisconnectLinkedIn(accountId, username) {
467
+ drawerDialogService.openDialog('confirm-dialog', {
468
+ title: 'Disconnect LinkedIn',
469
+ description: `Disconnect ${username || 'this LinkedIn account'}?`,
470
+ handleConfirm: async () => {
471
+ drawerDialogService.closeDialog('confirm-dialog');
472
+ this.isLinkedInLoading = true;
473
+ try {
474
+ await deleteSocialAccount({ accountId });
475
+ await this.loadLinkedInAccounts({ notify: true });
476
+ showToast({
477
+ message: 'LinkedIn disconnected',
478
+ type: 'success',
479
+ position: 'bottom-right',
480
+ });
481
+ } catch (error) {
482
+ console.error('Failed to disconnect LinkedIn:', error);
483
+ showToast({
484
+ message: error?.message || 'Failed to disconnect LinkedIn',
485
+ type: 'error',
486
+ position: 'bottom-right',
487
+ });
488
+ } finally {
489
+ this.isLinkedInLoading = false;
490
+ }
491
+ },
492
+ });
493
+ }
494
+
328
495
  renderSocialAccount(account) {
329
496
  const name = account.displayName || account.username || 'Instagram';
330
497
  const handle = account.username ? `@${account.username}` : '';
331
498
  const isConnected = account.status === 'connected';
332
- const gradId = `igGrad-${account.zernioAccountId || account.username || 'acc'}`;
499
+ const gradId = `igGrad-${account.zernioAccountId || account.accountId || account.username || 'acc'}`;
500
+ const accountId = account.zernioAccountId || account.accountId;
333
501
 
334
502
  return ke`
335
503
  <article class="ig-card">
@@ -366,7 +534,48 @@ class InstagramAccountsPanel extends h {
366
534
  <button
367
535
  type="button"
368
536
  class="ig-disconnect"
369
- @click=${() => this.handleDisconnectInstagram(account.zernioAccountId, account.username)}
537
+ @click=${() => this.handleDisconnectInstagram(accountId, account.username)}
538
+ >
539
+ Disconnect
540
+ </button>
541
+ </div>
542
+ </article>
543
+ `;
544
+ }
545
+
546
+ renderLinkedInAccount(account) {
547
+ const name = account.displayName || account.username || 'LinkedIn';
548
+ const handle = account.handle || (account.username ? account.username : '');
549
+ const isConnected = account.status === 'connected';
550
+ const accountId = account.accountId || account.unipileAccountId || account.zernioAccountId;
551
+
552
+ return ke`
553
+ <article class="ig-card li-card">
554
+ <div class="ig-card-top">
555
+ <div class="li-mark" aria-hidden="true">
556
+ <svg viewBox="0 0 24 24" width="22" height="22" fill="#0a66c2">
557
+ <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" />
558
+ </svg>
559
+ </div>
560
+ <div class="ig-identity">
561
+ <div class="ig-name-row">
562
+ <h3 class="ig-name">${name}</h3>
563
+ ${isConnected
564
+ ? ke`<span class="ig-badge">Connected</span>`
565
+ : ke`<span class="ig-badge is-muted">${account.status || 'Unknown'}</span>`}
566
+ </div>
567
+ ${handle ? ke`<p class="ig-handle">${handle}</p>` : null}
568
+ <p class="ig-connected-on">Connected ${this.formatSocialDate(account.connectedAt)}</p>
569
+ </div>
570
+ </div>
571
+ <div class="ig-actions">
572
+ ${account.profileUrl
573
+ ? ke`<a class="ig-link" href=${account.profileUrl} target="_blank" rel="noopener noreferrer">View profile</a>`
574
+ : ke`<span></span>`}
575
+ <button
576
+ type="button"
577
+ class="ig-disconnect"
578
+ @click=${() => this.handleDisconnectLinkedIn(accountId, account.username || account.handle)}
370
579
  >
371
580
  Disconnect
372
581
  </button>
@@ -378,9 +587,9 @@ class InstagramAccountsPanel extends h {
378
587
  renderConnectInstagram() {
379
588
  return ke`
380
589
  <div class="ig-empty">
381
- <p class="ig-empty-title">Connect Instagram to see chats</p>
590
+ <p class="ig-empty-title">Connect a social account to see chats</p>
382
591
  <p class="ig-empty-copy">
383
- Link your Instagram account first. After you disconnect, chats stay hidden until you connect again.
592
+ Link Instagram or LinkedIn. Chats stay hidden until at least one account is connected.
384
593
  </p>
385
594
  <button type="button" class="ig-connect" @click=${() => this.handleConnectInstagram()} ?disabled=${this.isSocialLoading}>
386
595
  <span class="ig-mark" aria-hidden="true">
@@ -406,6 +615,79 @@ class InstagramAccountsPanel extends h {
406
615
  `;
407
616
  }
408
617
 
618
+ renderLinkedInForm() {
619
+ if (this.linkedInCheckpointAccountId) {
620
+ return ke`
621
+ <form class="li-form" @submit=${(e) => this.handleLinkedInCheckpoint(e)}>
622
+ <p class="ig-empty-copy">Enter the verification code LinkedIn sent you.</p>
623
+ <label class="li-label">
624
+ <span>Verification code</span>
625
+ <input
626
+ class="li-input"
627
+ type="text"
628
+ inputmode="numeric"
629
+ autocomplete="one-time-code"
630
+ .value=${this.linkedInCode}
631
+ @input=${(e) => { this.linkedInCode = e.target.value; }}
632
+ placeholder="6-digit code"
633
+ ?disabled=${this.isLinkedInLoading}
634
+ />
635
+ </label>
636
+ <div class="li-form-actions">
637
+ <button type="button" class="li-secondary" @click=${() => this.resetLinkedInForm()} ?disabled=${this.isLinkedInLoading}>
638
+ Back
639
+ </button>
640
+ <button type="submit" class="li-primary" ?disabled=${this.isLinkedInLoading}>
641
+ ${this.isLinkedInLoading ? 'Verifying…' : 'Verify & connect'}
642
+ </button>
643
+ </div>
644
+ </form>
645
+ `;
646
+ }
647
+
648
+ return ke`
649
+ <form class="li-form" @submit=${(e) => this.handleConnectLinkedIn(e)}>
650
+ <label class="li-label">
651
+ <span>Email or username</span>
652
+ <input
653
+ class="li-input"
654
+ type="text"
655
+ autocomplete="username"
656
+ .value=${this.linkedInUsername}
657
+ @input=${(e) => { this.linkedInUsername = e.target.value; }}
658
+ placeholder="you@example.com"
659
+ ?disabled=${this.isLinkedInLoading}
660
+ />
661
+ </label>
662
+ <label class="li-label">
663
+ <span>Password</span>
664
+ <input
665
+ class="li-input"
666
+ type="password"
667
+ autocomplete="current-password"
668
+ .value=${this.linkedInPassword}
669
+ @input=${(e) => { this.linkedInPassword = e.target.value; }}
670
+ placeholder="LinkedIn password"
671
+ ?disabled=${this.isLinkedInLoading}
672
+ />
673
+ </label>
674
+ <button type="submit" class="li-primary li-primary-full" ?disabled=${this.isLinkedInLoading}>
675
+ ${this.isLinkedInLoading ? 'Connecting…' : 'Connect LinkedIn'}
676
+ </button>
677
+ </form>
678
+ `;
679
+ }
680
+
681
+ renderSkeleton() {
682
+ return ke`<div class="ig-skeleton" aria-hidden="true">
683
+ <div class="ig-skeleton-mark"></div>
684
+ <div class="ig-skeleton-lines">
685
+ <div class="ig-skeleton-line wide"></div>
686
+ <div class="ig-skeleton-line"></div>
687
+ </div>
688
+ </div>`;
689
+ }
690
+
409
691
  render() {
410
692
  return ke`
411
693
  <div class="panel">
@@ -417,21 +699,27 @@ class InstagramAccountsPanel extends h {
417
699
  <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" />
418
700
  </svg>
419
701
  </div>`}
420
- <h1 class="title">Instagram connected accounts</h1>
702
+ <h1 class="title">Connected accounts</h1>
421
703
  </div>
422
704
 
423
705
  <div class="body">
424
- ${this.isSocialLoading
425
- ? ke`<div class="ig-skeleton" aria-hidden="true">
426
- <div class="ig-skeleton-mark"></div>
427
- <div class="ig-skeleton-lines">
428
- <div class="ig-skeleton-line wide"></div>
429
- <div class="ig-skeleton-line"></div>
430
- </div>
431
- </div>`
432
- : this.connectedAccounts.length
433
- ? this.connectedAccounts.map(account => this.renderSocialAccount(account))
434
- : this.renderConnectInstagram()}
706
+ <section class="platform-section">
707
+ <h2 class="section-title">Instagram</h2>
708
+ ${this.isSocialLoading
709
+ ? this.renderSkeleton()
710
+ : this.connectedAccounts.length
711
+ ? this.connectedAccounts.map(account => this.renderSocialAccount(account))
712
+ : this.renderConnectInstagram()}
713
+ </section>
714
+
715
+ <section class="platform-section">
716
+ <h2 class="section-title">LinkedIn</h2>
717
+ ${this.isLinkedInLoading && !this.linkedInCheckpointAccountId && !this.linkedInUsername
718
+ ? this.renderSkeleton()
719
+ : this.connectedLinkedInAccounts.length
720
+ ? this.connectedLinkedInAccounts.map(account => this.renderLinkedInAccount(account))
721
+ : this.renderLinkedInForm()}
722
+ </section>
435
723
  </div>
436
724
 
437
725
  <div class="bottom-actions">
@@ -491,6 +779,24 @@ class InstagramAccountsPanel extends h {
491
779
  .body {
492
780
  flex: 1;
493
781
  min-height: 0;
782
+ display: flex;
783
+ flex-direction: column;
784
+ gap: 28px;
785
+ }
786
+
787
+ .platform-section {
788
+ display: flex;
789
+ flex-direction: column;
790
+ gap: 12px;
791
+ }
792
+
793
+ .section-title {
794
+ margin: 0;
795
+ font-size: 0.8125rem;
796
+ font-weight: 600;
797
+ letter-spacing: 0.04em;
798
+ text-transform: uppercase;
799
+ color: var(--text-secondary-color);
494
800
  }
495
801
 
496
802
  .ig-card {
@@ -501,7 +807,7 @@ class InstagramAccountsPanel extends h {
501
807
  border-radius: 12px;
502
808
  border: 1px solid var(--border-subtle, color-mix(in srgb, var(--text-primary-color) 10%, transparent));
503
809
  background: color-mix(in srgb, var(--bg-secondary-color, #f5f5f5) 70%, transparent);
504
- margin-bottom: 12px;
810
+ margin-bottom: 0;
505
811
  animation: ig-in 280ms cubic-bezier(0.16, 1, 0.3, 1);
506
812
  }
507
813
 
@@ -528,16 +834,24 @@ class InstagramAccountsPanel extends h {
528
834
  gap: 12px;
529
835
  }
530
836
 
531
- .ig-mark {
837
+ .ig-mark,
838
+ .li-mark {
532
839
  width: 40px;
533
840
  height: 40px;
534
841
  border-radius: 12px;
535
842
  display: grid;
536
843
  place-items: center;
537
844
  flex-shrink: 0;
845
+ }
846
+
847
+ .ig-mark {
538
848
  background: color-mix(in srgb, #dd2a7b 8%, var(--bg-primary-color, #fff));
539
849
  }
540
850
 
851
+ .li-mark {
852
+ background: color-mix(in srgb, #0a66c2 10%, var(--bg-primary-color, #fff));
853
+ }
854
+
541
855
  .ig-identity {
542
856
  min-width: 0;
543
857
  flex: 1;
@@ -643,7 +957,7 @@ class InstagramAccountsPanel extends h {
643
957
  display: flex;
644
958
  flex-direction: column;
645
959
  gap: 12px;
646
- padding: 8px 0 4px;
960
+ padding: 0;
647
961
  }
648
962
 
649
963
  .ig-empty-title {
@@ -689,6 +1003,78 @@ class InstagramAccountsPanel extends h {
689
1003
  line-height: 1.35;
690
1004
  }
691
1005
 
1006
+ .li-form {
1007
+ display: flex;
1008
+ flex-direction: column;
1009
+ gap: 12px;
1010
+ padding: 14px;
1011
+ border-radius: 12px;
1012
+ border: 1px solid var(--border-subtle, color-mix(in srgb, var(--text-primary-color) 10%, transparent));
1013
+ background: color-mix(in srgb, var(--bg-secondary-color, #f5f5f5) 70%, transparent);
1014
+ }
1015
+
1016
+ .li-label {
1017
+ display: flex;
1018
+ flex-direction: column;
1019
+ gap: 6px;
1020
+ font-size: 0.75rem;
1021
+ font-weight: 500;
1022
+ color: var(--text-secondary-color);
1023
+ }
1024
+
1025
+ .li-input {
1026
+ width: 100%;
1027
+ box-sizing: border-box;
1028
+ padding: 10px 12px;
1029
+ border-radius: 8px;
1030
+ border: 1px solid var(--border-subtle, color-mix(in srgb, var(--text-primary-color) 14%, transparent));
1031
+ background: var(--bg-primary-color, #fff);
1032
+ color: var(--text-primary-color);
1033
+ font-size: 0.875rem;
1034
+ }
1035
+
1036
+ .li-input:focus {
1037
+ outline: 2px solid color-mix(in srgb, #0a66c2 35%, transparent);
1038
+ outline-offset: 1px;
1039
+ }
1040
+
1041
+ .li-form-actions {
1042
+ display: flex;
1043
+ gap: 8px;
1044
+ justify-content: flex-end;
1045
+ }
1046
+
1047
+ .li-primary,
1048
+ .li-secondary {
1049
+ border: none;
1050
+ border-radius: 8px;
1051
+ padding: 10px 14px;
1052
+ font-size: 0.8125rem;
1053
+ font-weight: 600;
1054
+ cursor: pointer;
1055
+ }
1056
+
1057
+ .li-primary {
1058
+ background: #0a66c2;
1059
+ color: #fff;
1060
+ }
1061
+
1062
+ .li-primary-full {
1063
+ width: 100%;
1064
+ }
1065
+
1066
+ .li-primary:disabled,
1067
+ .li-secondary:disabled {
1068
+ opacity: 0.6;
1069
+ cursor: not-allowed;
1070
+ }
1071
+
1072
+ .li-secondary {
1073
+ background: transparent;
1074
+ color: var(--text-secondary-color);
1075
+ border: 1px solid var(--border-subtle, color-mix(in srgb, var(--text-primary-color) 14%, transparent));
1076
+ }
1077
+
692
1078
  .ig-skeleton {
693
1079
  display: flex;
694
1080
  align-items: center;
@@ -974,8 +1360,7 @@ const WebChat = class {
974
1360
  window.history.replaceState({}, '', url);
975
1361
  }
976
1362
  };
977
- this.applyInstagramAccounts = (accounts = [], options = {}) => {
978
- const connected = hasConnectedInstagramAccounts(accounts);
1363
+ this.applySocialGate = (connected, options = {}) => {
979
1364
  const wasConnected = this.isInstagramConnected;
980
1365
  this.isInstagramConnected = connected;
981
1366
  if (!connected) {
@@ -989,9 +1374,15 @@ const WebChat = class {
989
1374
  void this.loadConversationsAfterInstagramConnect();
990
1375
  }
991
1376
  };
992
- this.refreshInstagramConnectionGate = async () => {
993
- const data = await getSocialAccounts({ platform: 'instagram' });
994
- this.applyInstagramAccounts((data === null || data === void 0 ? void 0 : data.accounts) || [], { bootstrap: true });
1377
+ /** Unlock when Instagram OR LinkedIn has at least one connected account. */
1378
+ this.refreshInstagramConnectionGate = async (options = { bootstrap: true }) => {
1379
+ const [igData, liData] = await Promise.all([
1380
+ getSocialAccounts({ platform: 'instagram' }).catch(() => ({ accounts: [] })),
1381
+ getSocialAccounts({ platform: 'linkedin' }).catch(() => ({ accounts: [] })),
1382
+ ]);
1383
+ const connected = hasConnectedInstagramAccounts((igData === null || igData === void 0 ? void 0 : igData.accounts) || []) ||
1384
+ hasConnectedInstagramAccounts((liData === null || liData === void 0 ? void 0 : liData.accounts) || []);
1385
+ this.applySocialGate(connected, options);
995
1386
  };
996
1387
  this.loadConversationsAfterInstagramConnect = async () => {
997
1388
  if (!this.isInstagramConnected)
@@ -1007,14 +1398,14 @@ const WebChat = class {
1007
1398
  await this.getConversations();
1008
1399
  }
1009
1400
  catch (error) {
1010
- console.error('Failed to load conversations after Instagram connect:', error);
1401
+ console.error('Failed to load conversations after social connect:', error);
1011
1402
  }
1012
1403
  finally {
1013
1404
  this.isConversationLoading = false;
1014
1405
  }
1015
1406
  };
1016
- this.handleInstagramAccountsChange = (accounts = []) => {
1017
- this.applyInstagramAccounts(accounts);
1407
+ this.handleInstagramAccountsChange = (_accounts) => {
1408
+ void this.refreshInstagramConnectionGate({ bootstrap: false });
1018
1409
  };
1019
1410
  this.openChatTab = () => {
1020
1411
  if (this.isInstagramConnected) {
@@ -1702,18 +2093,18 @@ const WebChat = class {
1702
2093
  catch (userError) {
1703
2094
  console.error('Failed to get user details:', userError);
1704
2095
  }
1705
- // Gate chats behind a connected Instagram account
2096
+ // Gate chats behind any connected social account (Instagram or LinkedIn)
1706
2097
  try {
1707
- this.updateLoading(65, 'Checking Instagram connection...');
2098
+ this.updateLoading(65, 'Checking social connections...');
1708
2099
  await this.refreshInstagramConnectionGate();
1709
2100
  }
1710
2101
  catch (igError) {
1711
- console.error('Failed to check Instagram accounts:', igError);
1712
- this.applyInstagramAccounts([]);
2102
+ console.error('Failed to check social accounts:', igError);
2103
+ this.applySocialGate(false, { bootstrap: true });
1713
2104
  }
1714
2105
  if (!this.isInstagramConnected) {
1715
2106
  this.activeTab = 'Accounts';
1716
- this.updateLoading(100, 'Connect Instagram to continue');
2107
+ this.updateLoading(100, 'Connect Instagram or LinkedIn to continue');
1717
2108
  this.checkMobileView();
1718
2109
  window.addEventListener('resize', this.checkMobileView.bind(this));
1719
2110
  return;
@@ -2825,7 +3216,7 @@ const WebChat = class {
2825
3216
  }
2826
3217
  render() {
2827
3218
  var _a, _b, _c, _d, _e;
2828
- return (h$1(Fragment, { key: '120ba07af7eb93f1f6cbed603f6e25bfd48b0900' }, this.isLoading ? (h$1("chat-loading-placeholder", { progress: this.loadingProgress, loadingStatus: this.loadingStatus })) : (h$1(Fragment, null, this.isConversationLoading ? (h$1("div", { class: "loaderoverlay" }, h$1("spinner-loader", { height: "30px", width: "30px", spinTime: "1s", spinnerPrimaryColor: "var(--bg-primary-color)", spinnerSecondaryColor: "var(--text-primary-color)", spinnerBorderWidth: "2px" }))) : null, h$1("div", { class: {
3219
+ return (h$1(Fragment, { key: '48018669b503b2bb6fee4d774d69800cad5e913e' }, this.isLoading ? (h$1("chat-loading-placeholder", { progress: this.loadingProgress, loadingStatus: this.loadingStatus })) : (h$1(Fragment, null, this.isConversationLoading ? (h$1("div", { class: "loaderoverlay" }, h$1("spinner-loader", { height: "30px", width: "30px", spinTime: "1s", spinnerPrimaryColor: "var(--bg-primary-color)", spinnerSecondaryColor: "var(--text-primary-color)", spinnerBorderWidth: "2px" }))) : null, h$1("div", { class: {
2829
3220
  'isometrik-quickchat': true,
2830
3221
  'is-resizing': this.isResizingSidebar,
2831
3222
  'is-instagram-gate': !this.isInstagramConnected,
@@ -2889,4 +3280,4 @@ WebChat.style = WebChatStyle0;
2889
3280
 
2890
3281
  export { WebChat as W };
2891
3282
 
2892
- //# sourceMappingURL=WebChat-95518d72.js.map
3283
+ //# sourceMappingURL=WebChat-372df148.js.map