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.
Files changed (59) hide show
  1. package/dist/cjs/{MessageSearch-5fc9dc00.js → MessageSearch-a73ca677.js} +83 -12
  2. package/dist/cjs/MessageSearch-a73ca677.js.map +1 -0
  3. package/dist/cjs/{WebChat-403e7ab1.js → WebChat-11c06cb9.js} +458 -57
  4. package/dist/cjs/WebChat-11c06cb9.js.map +1 -0
  5. package/dist/cjs/audio-bubble_8.cjs.entry.js +2 -2
  6. package/dist/cjs/chat-app.cjs.entry.js +3 -3
  7. package/dist/cjs/chat-creds-7ddd5f40.js +27 -0
  8. package/dist/cjs/chat-creds-7ddd5f40.js.map +1 -0
  9. package/dist/cjs/login-page.cjs.entry.js +1 -1
  10. package/dist/cjs/signup-page.cjs.entry.js +1 -1
  11. package/dist/cjs/theme-provider_2.cjs.entry.js +3 -3
  12. package/dist/collection/api/social-accounts.js +77 -9
  13. package/dist/collection/components/my-component/web-chat/WebChat.js +48 -33
  14. package/dist/collection/components/my-component/web-chat/WebChat.js.map +1 -1
  15. package/dist/collection/constants/chat-creds.js +18 -29
  16. package/dist/collection/stories/Components/InstagramAccounts/InstagramAccountsPanel.js +412 -22
  17. package/dist/esm/{MessageSearch-4101a627.js → MessageSearch-69b3a0f3.js} +80 -12
  18. package/dist/esm/MessageSearch-69b3a0f3.js.map +1 -0
  19. package/dist/esm/{WebChat-5448d615.js → WebChat-372df148.js} +458 -57
  20. package/dist/esm/WebChat-372df148.js.map +1 -0
  21. package/dist/esm/audio-bubble_8.entry.js +3 -3
  22. package/dist/esm/chat-app.entry.js +3 -3
  23. package/dist/esm/chat-creds-99dd8834.js +24 -0
  24. package/dist/esm/chat-creds-99dd8834.js.map +1 -0
  25. package/dist/esm/login-page.entry.js +1 -1
  26. package/dist/esm/signup-page.entry.js +1 -1
  27. package/dist/esm/theme-provider_2.entry.js +3 -3
  28. package/dist/isometrik-webchat/isometrik-webchat.esm.js +1 -1
  29. package/dist/isometrik-webchat/{p-89108249.entry.js → p-56fbdbc3.entry.js} +2 -2
  30. package/dist/isometrik-webchat/p-70f4360e.js +2 -0
  31. package/dist/isometrik-webchat/p-70f4360e.js.map +1 -0
  32. package/dist/isometrik-webchat/{p-48e243ec.entry.js → p-72a0b844.entry.js} +2 -2
  33. package/dist/isometrik-webchat/{p-bfd51dd4.entry.js → p-8456ee94.entry.js} +2 -2
  34. package/dist/isometrik-webchat/{p-8dcdea59.js → p-9058d82c.js} +18 -18
  35. package/dist/isometrik-webchat/p-9058d82c.js.map +1 -0
  36. package/dist/isometrik-webchat/p-9588b7ec.js +780 -0
  37. package/dist/isometrik-webchat/p-9588b7ec.js.map +1 -0
  38. package/dist/isometrik-webchat/{p-bf0aeb22.entry.js → p-e36db3f6.entry.js} +2 -2
  39. package/dist/isometrik-webchat/{p-adbb398d.entry.js → p-e66e5e61.entry.js} +2 -2
  40. package/package.json +1 -1
  41. package/readme.md +5 -5
  42. package/dist/cjs/MessageSearch-5fc9dc00.js.map +0 -1
  43. package/dist/cjs/WebChat-403e7ab1.js.map +0 -1
  44. package/dist/cjs/chat-creds-f4cbf400.js +0 -38
  45. package/dist/cjs/chat-creds-f4cbf400.js.map +0 -1
  46. package/dist/esm/MessageSearch-4101a627.js.map +0 -1
  47. package/dist/esm/WebChat-5448d615.js.map +0 -1
  48. package/dist/esm/chat-creds-ff086f05.js +0 -35
  49. package/dist/esm/chat-creds-ff086f05.js.map +0 -1
  50. package/dist/isometrik-webchat/p-12774661.js +0 -2
  51. package/dist/isometrik-webchat/p-12774661.js.map +0 -1
  52. package/dist/isometrik-webchat/p-8dcdea59.js.map +0 -1
  53. package/dist/isometrik-webchat/p-e09b32eb.js +0 -591
  54. package/dist/isometrik-webchat/p-e09b32eb.js.map +0 -1
  55. /package/dist/isometrik-webchat/{p-89108249.entry.js.map → p-56fbdbc3.entry.js.map} +0 -0
  56. /package/dist/isometrik-webchat/{p-48e243ec.entry.js.map → p-72a0b844.entry.js.map} +0 -0
  57. /package/dist/isometrik-webchat/{p-bfd51dd4.entry.js.map → p-8456ee94.entry.js.map} +0 -0
  58. /package/dist/isometrik-webchat/{p-bf0aeb22.entry.js.map → p-e36db3f6.entry.js.map} +0 -0
  59. /package/dist/isometrik-webchat/{p-adbb398d.entry.js.map → p-e66e5e61.entry.js.map} +0 -0
@@ -1,10 +1,10 @@
1
1
  import { r as registerInstance, a as createEvent, h as h$1, F as Fragment } from './index-fddf30b7.js';
2
2
  import { h, i, k as ke, M } from './Image-bb9efda3.js';
3
- import { C as CHAT_CREDS, M as MQTT_CREDS } from './chat-creds-ff086f05.js';
3
+ 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-4101a627.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;
@@ -928,9 +1314,29 @@ const WebChat = class {
928
1314
  if (parts.length === 2)
929
1315
  return parts.pop().split(';').shift();
930
1316
  };
931
- // Auth from chat-creds (no login UI)
932
- this.userTokenFromCookie = CHAT_CREDS.userToken;
933
- this.isometrikUserIdFromCookie = CHAT_CREDS.isometrikUserId;
1317
+ // Filled from parent <web-chat> props in applyParentCreds()
1318
+ this.userTokenFromCookie = '';
1319
+ this.isometrikUserIdFromCookie = '';
1320
+ /** Copy parent props into CHAT_CREDS so API helpers use host values (no hardcode). */
1321
+ this.applyParentCreds = () => {
1322
+ var _a;
1323
+ const pick = (prop, fallback = '') => typeof prop === 'string' && prop.trim() ? prop.trim() : fallback;
1324
+ CHAT_CREDS.userToken = pick(this.userToken);
1325
+ CHAT_CREDS.appSecret = pick(this.appSecret);
1326
+ CHAT_CREDS.licenseKey = pick(this.licenseKey);
1327
+ CHAT_CREDS.userSecret = pick(this.userSecret);
1328
+ CHAT_CREDS.accountId = pick(this.accountId);
1329
+ CHAT_CREDS.keysetId = pick(this.keysetId);
1330
+ CHAT_CREDS.projectId = pick(this.projectId);
1331
+ CHAT_CREDS.isometrikUserId = pick(this.isometrikUserId);
1332
+ CHAT_CREDS.baseUrl = pick(this.baseUrl, CHAT_CREDS.baseUrl || 'https://apis.isometrik.ai');
1333
+ CHAT_CREDS.socialRedirectUrl = pick(this.socialRedirectUrl);
1334
+ if ((_a = this.hostUrl) === null || _a === void 0 ? void 0 : _a.trim()) {
1335
+ MQTT_CREDS.URL = this.hostUrl.trim();
1336
+ }
1337
+ this.userTokenFromCookie = CHAT_CREDS.userToken;
1338
+ this.isometrikUserIdFromCookie = CHAT_CREDS.isometrikUserId;
1339
+ };
934
1340
  this.clearConversationState = () => {
935
1341
  this.allConversationList = [];
936
1342
  this.selectedConversationId = null;
@@ -954,8 +1360,7 @@ const WebChat = class {
954
1360
  window.history.replaceState({}, '', url);
955
1361
  }
956
1362
  };
957
- this.applyInstagramAccounts = (accounts = [], options = {}) => {
958
- const connected = hasConnectedInstagramAccounts(accounts);
1363
+ this.applySocialGate = (connected, options = {}) => {
959
1364
  const wasConnected = this.isInstagramConnected;
960
1365
  this.isInstagramConnected = connected;
961
1366
  if (!connected) {
@@ -969,9 +1374,15 @@ const WebChat = class {
969
1374
  void this.loadConversationsAfterInstagramConnect();
970
1375
  }
971
1376
  };
972
- this.refreshInstagramConnectionGate = async () => {
973
- const data = await getSocialAccounts({ platform: 'instagram' });
974
- 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);
975
1386
  };
976
1387
  this.loadConversationsAfterInstagramConnect = async () => {
977
1388
  if (!this.isInstagramConnected)
@@ -987,14 +1398,14 @@ const WebChat = class {
987
1398
  await this.getConversations();
988
1399
  }
989
1400
  catch (error) {
990
- console.error('Failed to load conversations after Instagram connect:', error);
1401
+ console.error('Failed to load conversations after social connect:', error);
991
1402
  }
992
1403
  finally {
993
1404
  this.isConversationLoading = false;
994
1405
  }
995
1406
  };
996
- this.handleInstagramAccountsChange = (accounts = []) => {
997
- this.applyInstagramAccounts(accounts);
1407
+ this.handleInstagramAccountsChange = (_accounts) => {
1408
+ void this.refreshInstagramConnectionGate({ bootstrap: false });
998
1409
  };
999
1410
  this.openChatTab = () => {
1000
1411
  if (this.isInstagramConnected) {
@@ -1610,11 +2021,7 @@ const WebChat = class {
1610
2021
  this.isMobileView = window.innerWidth <= 768;
1611
2022
  }
1612
2023
  componentWillLoad() {
1613
- var _a;
1614
- // Instagram OAuth return URL — host page where accounts are linked
1615
- if ((_a = this.socialRedirectUrl) === null || _a === void 0 ? void 0 : _a.trim()) {
1616
- CHAT_CREDS.socialRedirectUrl = this.socialRedirectUrl.trim();
1617
- }
2024
+ this.applyParentCreds();
1618
2025
  // OAuth popup return: notify opener ASAP and close (skip full chat boot)
1619
2026
  if (notifyOpenerIfSocialPopupCallback())
1620
2027
  return;
@@ -1654,12 +2061,13 @@ const WebChat = class {
1654
2061
  // Initialize SDK
1655
2062
  try {
1656
2063
  this.updateLoading(25, 'Initializing chat SDK...');
2064
+ this.applyParentCreds();
1657
2065
  M.initializeInstance({
1658
2066
  baseUrl: CHAT_CREDS.baseUrl,
1659
2067
  licenseKey: CHAT_CREDS.licenseKey,
1660
2068
  appSecret: CHAT_CREDS.appSecret,
1661
2069
  userSecret: CHAT_CREDS.userSecret,
1662
- userToken: this.userTokenFromCookie,
2070
+ userToken: CHAT_CREDS.userToken,
1663
2071
  });
1664
2072
  this.isInitialized = true;
1665
2073
  }
@@ -1685,18 +2093,18 @@ const WebChat = class {
1685
2093
  catch (userError) {
1686
2094
  console.error('Failed to get user details:', userError);
1687
2095
  }
1688
- // Gate chats behind a connected Instagram account
2096
+ // Gate chats behind any connected social account (Instagram or LinkedIn)
1689
2097
  try {
1690
- this.updateLoading(65, 'Checking Instagram connection...');
2098
+ this.updateLoading(65, 'Checking social connections...');
1691
2099
  await this.refreshInstagramConnectionGate();
1692
2100
  }
1693
2101
  catch (igError) {
1694
- console.error('Failed to check Instagram accounts:', igError);
1695
- this.applyInstagramAccounts([]);
2102
+ console.error('Failed to check social accounts:', igError);
2103
+ this.applySocialGate(false, { bootstrap: true });
1696
2104
  }
1697
2105
  if (!this.isInstagramConnected) {
1698
2106
  this.activeTab = 'Accounts';
1699
- this.updateLoading(100, 'Connect Instagram to continue');
2107
+ this.updateLoading(100, 'Connect Instagram or LinkedIn to continue');
1700
2108
  this.checkMobileView();
1701
2109
  window.addEventListener('resize', this.checkMobileView.bind(this));
1702
2110
  return;
@@ -1774,10 +2182,12 @@ const WebChat = class {
1774
2182
  }
1775
2183
  }
1776
2184
  async setupMqttClient() {
2185
+ var _a;
1777
2186
  // let retryToConnect:any = null;
1778
2187
  const deviceID = await getDeviceID();
2188
+ this.applyParentCreds();
1779
2189
  const mqttClient = M.getInstance().initializeMqtt({
1780
- hostUri: MQTT_CREDS.URL ,
2190
+ hostUri: ((_a = this.hostUrl) === null || _a === void 0 ? void 0 : _a.trim()) || MQTT_CREDS.URL,
1781
2191
  clientId: CHAT_CREDS.isometrikUserId,
1782
2192
  licenseKey: CHAT_CREDS.licenseKey,
1783
2193
  projectId: CHAT_CREDS.projectId,
@@ -1785,15 +2195,6 @@ const WebChat = class {
1785
2195
  accountId: CHAT_CREDS.accountId,
1786
2196
  deviceId: deviceID,
1787
2197
  });
1788
- // const mqttClient = ChatSDK.getInstance().initializeMqtt({
1789
- // hostUri: this.hostUrl,
1790
- // clientId: this.isometrikUserId,
1791
- // licenseKey: this.licenseKey,
1792
- // projectId: this.projectId,
1793
- // keysetId: this.keysetId,
1794
- // accountId: this.accountId,
1795
- // deviceId: deviceID,
1796
- // });
1797
2198
  this.mqttClient = mqttClient;
1798
2199
  let refetchInterval = null;
1799
2200
  this.isMqttConnected = false;
@@ -2815,7 +3216,7 @@ const WebChat = class {
2815
3216
  }
2816
3217
  render() {
2817
3218
  var _a, _b, _c, _d, _e;
2818
- return (h$1(Fragment, { key: '54bf58235570d4cd19ae3bbc1ac54dda2346d644' }, 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: {
2819
3220
  'isometrik-quickchat': true,
2820
3221
  'is-resizing': this.isResizingSidebar,
2821
3222
  'is-instagram-gate': !this.isInstagramConnected,
@@ -2879,4 +3280,4 @@ WebChat.style = WebChatStyle0;
2879
3280
 
2880
3281
  export { WebChat as W };
2881
3282
 
2882
- //# sourceMappingURL=WebChat-5448d615.js.map
3283
+ //# sourceMappingURL=WebChat-372df148.js.map