@weldsuite/helpdesk-widget-sdk 1.0.4 → 1.0.6

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/angular.d.ts CHANGED
@@ -456,7 +456,13 @@ declare class WeldSDK {
456
456
  private status;
457
457
  private readyPromise;
458
458
  private readyResolve;
459
+ private boundHandleLauncherClick;
460
+ private subscriptionIds;
459
461
  constructor(config: WeldConfig);
462
+ /**
463
+ * Handle launcher click messages from iframe
464
+ */
465
+ private handleLauncherClickMessage;
460
466
  /**
461
467
  * Initialize the SDK and render widget
462
468
  */
@@ -470,7 +476,7 @@ declare class WeldSDK {
470
476
  */
471
477
  private mapIframeNameToType;
472
478
  /**
473
- * Wait for all iframes to be ready
479
+ * Wait for all iframes JS to be ready (weld:ready messages received)
474
480
  */
475
481
  private waitForIframesReady;
476
482
  /**
@@ -545,6 +551,69 @@ declare class WeldSDK {
545
551
  * Track custom event
546
552
  */
547
553
  track(eventName: string, properties?: Record<string, any>): void;
554
+ /**
555
+ * Boot the widget with user context (Intercom-style)
556
+ * Use this after authentication to pass user information
557
+ *
558
+ * @example
559
+ * ```typescript
560
+ * weld.boot({
561
+ * userId: 'user_123',
562
+ * email: 'user@example.com',
563
+ * name: 'John Doe',
564
+ * createdAt: new Date('2024-01-01'),
565
+ * customAttributes: { plan: 'pro', company: 'Acme Inc' }
566
+ * });
567
+ * ```
568
+ */
569
+ boot(settings: {
570
+ userId?: string;
571
+ email?: string;
572
+ name?: string;
573
+ avatar?: string;
574
+ createdAt?: Date;
575
+ customAttributes?: Record<string, any>;
576
+ }): void;
577
+ /**
578
+ * Shutdown the widget and clear session (Intercom-style)
579
+ * Use this on logout to clear user data and session cookies
580
+ */
581
+ shutdown(): void;
582
+ /**
583
+ * Update user attributes (Intercom-style, with rate limiting)
584
+ * Limited to 20 calls per page load to prevent abuse
585
+ *
586
+ * @example
587
+ * ```typescript
588
+ * weld.update({ lastOrderDate: new Date(), orderCount: 5 });
589
+ * ```
590
+ */
591
+ private updateCallCount;
592
+ private readonly updateRateLimit;
593
+ update(data: Record<string, any>): void;
594
+ /**
595
+ * Register callback for when widget is shown (Intercom-style)
596
+ * @returns Unsubscribe function
597
+ */
598
+ onShow(callback: () => void): () => void;
599
+ /**
600
+ * Register callback for when widget is hidden (Intercom-style)
601
+ * @returns Unsubscribe function
602
+ */
603
+ onHide(callback: () => void): () => void;
604
+ /**
605
+ * Register callback for unread message count changes (Intercom-style)
606
+ * @returns Unsubscribe function
607
+ */
608
+ onUnreadCountChange(callback: (count: number) => void): () => void;
609
+ /**
610
+ * Show the widget (alias for open, Intercom-style)
611
+ */
612
+ show(): void;
613
+ /**
614
+ * Hide the widget (alias for close, Intercom-style)
615
+ */
616
+ hide(): void;
548
617
  /**
549
618
  * Get current state
550
619
  */