@mushi-mushi/web 1.7.2 → 1.7.5

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/index.d.cts CHANGED
@@ -179,6 +179,34 @@ declare class MushiWidget {
179
179
  }): void;
180
180
  setRewardsState(state: WidgetRewardsState | null): void;
181
181
  destroy(): void;
182
+ /**
183
+ * Apply the SDK-owned pass-through layout to the host element so it is
184
+ * always zero-sized and click/touch-transparent. Only the shadow-root
185
+ * internals (`.mushi-trigger`, `.mushi-banner`, `.mushi-panel`) opt back
186
+ * into pointer events. This is idempotent and safe to call repeatedly.
187
+ */
188
+ private syncHostChromeState;
189
+ /**
190
+ * Returns true when a DOM element matching `hideOnSelector` is currently
191
+ * present in the host document. Used by both the trigger and the banner
192
+ * so a single selector consistently hides ALL SDK-injected launcher
193
+ * surfaces. Invalid selectors are swallowed silently (non-fatal).
194
+ */
195
+ private isSuppressedByHost;
196
+ /**
197
+ * Returns a snapshot of the widget's host-layer health for use in
198
+ * `Mushi.diagnose()`. Callers check this to know whether the widget
199
+ * could ever block host-app UI without opening a browser devtools.
200
+ */
201
+ getWidgetDiagnostics(): {
202
+ widgetHostPointerSafe: boolean;
203
+ widgetHostBounds: {
204
+ width: number;
205
+ height: number;
206
+ } | null;
207
+ widgetSuppressed: boolean;
208
+ bannerRendered: boolean;
209
+ };
182
210
  private syncAttachedLaunchers;
183
211
  private syncSmartHide;
184
212
  private shouldRenderTrigger;
@@ -195,6 +223,16 @@ declare class MushiWidget {
195
223
  private isRouteHidden;
196
224
  private getTheme;
197
225
  private render;
226
+ /**
227
+ * Queries each `avoidSelectors` element in the host document and returns
228
+ * the minimum top-offset in px so that a top-anchored element clears all
229
+ * of them by `gap` pixels. Returns `null` when no selectors are provided
230
+ * or no matching elements have a non-zero bounding rect.
231
+ *
232
+ * Runs in the host document (not shadow DOM) so it can reach fixed headers,
233
+ * sticky nav bars, and sign-in CTAs.
234
+ */
235
+ private computeAvoidTopPx;
198
236
  private applyInsetVars;
199
237
  private renderStep;
200
238
  private renderOutdatedBanner;
@@ -397,6 +435,19 @@ interface ProactiveConfig {
397
435
  maxProactivePerSession: number;
398
436
  dismissCooldownHours: number;
399
437
  suppressAfterDismissals: number;
438
+ /**
439
+ * Cross-reload re-show cooldown, in minutes. When a proactive trigger is
440
+ * granted a show, the SDK persists a `mushi:lastShown` timestamp. On a fresh
441
+ * session (a brand-new JS context after a page reload or crash, before this
442
+ * manager has shown anything itself) prompts are suppressed if one was shown
443
+ * within this window — even if the user never cleanly dismissed it.
444
+ *
445
+ * The 24h `dismissCooldownHours` only engages once `recordDismissal()` runs,
446
+ * which requires a clean widget `onClose`. A reloading/broken page tears down
447
+ * the JS context before that, so without this guard the panel re-pops on every
448
+ * load. Set to `0` to disable (legacy behavior). Defaults to 30 minutes.
449
+ */
450
+ reshowCooldownMinutes: number;
400
451
  }
401
452
  interface ProactiveManager {
402
453
  shouldShow(triggerType: string): boolean;
package/dist/index.d.ts CHANGED
@@ -179,6 +179,34 @@ declare class MushiWidget {
179
179
  }): void;
180
180
  setRewardsState(state: WidgetRewardsState | null): void;
181
181
  destroy(): void;
182
+ /**
183
+ * Apply the SDK-owned pass-through layout to the host element so it is
184
+ * always zero-sized and click/touch-transparent. Only the shadow-root
185
+ * internals (`.mushi-trigger`, `.mushi-banner`, `.mushi-panel`) opt back
186
+ * into pointer events. This is idempotent and safe to call repeatedly.
187
+ */
188
+ private syncHostChromeState;
189
+ /**
190
+ * Returns true when a DOM element matching `hideOnSelector` is currently
191
+ * present in the host document. Used by both the trigger and the banner
192
+ * so a single selector consistently hides ALL SDK-injected launcher
193
+ * surfaces. Invalid selectors are swallowed silently (non-fatal).
194
+ */
195
+ private isSuppressedByHost;
196
+ /**
197
+ * Returns a snapshot of the widget's host-layer health for use in
198
+ * `Mushi.diagnose()`. Callers check this to know whether the widget
199
+ * could ever block host-app UI without opening a browser devtools.
200
+ */
201
+ getWidgetDiagnostics(): {
202
+ widgetHostPointerSafe: boolean;
203
+ widgetHostBounds: {
204
+ width: number;
205
+ height: number;
206
+ } | null;
207
+ widgetSuppressed: boolean;
208
+ bannerRendered: boolean;
209
+ };
182
210
  private syncAttachedLaunchers;
183
211
  private syncSmartHide;
184
212
  private shouldRenderTrigger;
@@ -195,6 +223,16 @@ declare class MushiWidget {
195
223
  private isRouteHidden;
196
224
  private getTheme;
197
225
  private render;
226
+ /**
227
+ * Queries each `avoidSelectors` element in the host document and returns
228
+ * the minimum top-offset in px so that a top-anchored element clears all
229
+ * of them by `gap` pixels. Returns `null` when no selectors are provided
230
+ * or no matching elements have a non-zero bounding rect.
231
+ *
232
+ * Runs in the host document (not shadow DOM) so it can reach fixed headers,
233
+ * sticky nav bars, and sign-in CTAs.
234
+ */
235
+ private computeAvoidTopPx;
198
236
  private applyInsetVars;
199
237
  private renderStep;
200
238
  private renderOutdatedBanner;
@@ -397,6 +435,19 @@ interface ProactiveConfig {
397
435
  maxProactivePerSession: number;
398
436
  dismissCooldownHours: number;
399
437
  suppressAfterDismissals: number;
438
+ /**
439
+ * Cross-reload re-show cooldown, in minutes. When a proactive trigger is
440
+ * granted a show, the SDK persists a `mushi:lastShown` timestamp. On a fresh
441
+ * session (a brand-new JS context after a page reload or crash, before this
442
+ * manager has shown anything itself) prompts are suppressed if one was shown
443
+ * within this window — even if the user never cleanly dismissed it.
444
+ *
445
+ * The 24h `dismissCooldownHours` only engages once `recordDismissal()` runs,
446
+ * which requires a clean widget `onClose`. A reloading/broken page tears down
447
+ * the JS context before that, so without this guard the panel re-pops on every
448
+ * load. Set to `0` to disable (legacy behavior). Defaults to 30 minutes.
449
+ */
450
+ reshowCooldownMinutes: number;
400
451
  }
401
452
  interface ProactiveManager {
402
453
  shouldShow(triggerType: string): boolean;