@mushi-mushi/web 1.2.0 → 1.2.1

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
@@ -21,6 +21,7 @@ declare class Mushi {
21
21
  * user-facing ARIA / keyboard wiring.
22
22
  */
23
23
 
24
+ type WidgetStep = 'category' | 'intent' | 'details' | 'success' | 'reports' | 'report-detail';
24
25
  interface WidgetRewardsState {
25
26
  tier: {
26
27
  slug: string;
@@ -182,6 +183,16 @@ declare class MushiWidget {
182
183
  private loadReporterReports;
183
184
  private loadReporterComments;
184
185
  private submitReporterReply;
186
+ getRecorderStep(): WidgetStep;
187
+ getRecorderTrigger(): Element | null;
188
+ getRecorderCategoryButton(category: MushiReportCategory): Element | null;
189
+ getRecorderIntentButton(label: string): Element | null;
190
+ getRecorderSubmitButton(): Element | null;
191
+ recorderClickTrigger(): void;
192
+ recorderSelectCategory(category: MushiReportCategory): void;
193
+ recorderSelectIntent(label: string): void;
194
+ recorderFocusDescription(): void;
195
+ recorderSubmit(): void;
185
196
  }
186
197
 
187
198
  interface ConsoleCapture {
package/dist/index.d.ts CHANGED
@@ -21,6 +21,7 @@ declare class Mushi {
21
21
  * user-facing ARIA / keyboard wiring.
22
22
  */
23
23
 
24
+ type WidgetStep = 'category' | 'intent' | 'details' | 'success' | 'reports' | 'report-detail';
24
25
  interface WidgetRewardsState {
25
26
  tier: {
26
27
  slug: string;
@@ -182,6 +183,16 @@ declare class MushiWidget {
182
183
  private loadReporterReports;
183
184
  private loadReporterComments;
184
185
  private submitReporterReply;
186
+ getRecorderStep(): WidgetStep;
187
+ getRecorderTrigger(): Element | null;
188
+ getRecorderCategoryButton(category: MushiReportCategory): Element | null;
189
+ getRecorderIntentButton(label: string): Element | null;
190
+ getRecorderSubmitButton(): Element | null;
191
+ recorderClickTrigger(): void;
192
+ recorderSelectCategory(category: MushiReportCategory): void;
193
+ recorderSelectIntent(label: string): void;
194
+ recorderFocusDescription(): void;
195
+ recorderSubmit(): void;
185
196
  }
186
197
 
187
198
  interface ConsoleCapture {
package/dist/index.js CHANGED
@@ -2054,8 +2054,81 @@ var MushiWidget = class {
2054
2054
  this.render();
2055
2055
  }
2056
2056
  }
2057
+ /* ── Marketing / Playwright recorder (debug GIF capture) ─────────── */
2058
+ getRecorderStep() {
2059
+ return this.step;
2060
+ }
2061
+ getRecorderTrigger() {
2062
+ return this.shadow.querySelector(".mushi-trigger");
2063
+ }
2064
+ getRecorderCategoryButton(category) {
2065
+ return this.shadow.querySelector(`[data-category="${category}"]`);
2066
+ }
2067
+ getRecorderIntentButton(label) {
2068
+ return Array.from(this.shadow.querySelectorAll("[data-intent]")).find(
2069
+ (el) => el.dataset.intent === label
2070
+ ) ?? null;
2071
+ }
2072
+ getRecorderSubmitButton() {
2073
+ return this.shadow.querySelector('[data-action="submit"]');
2074
+ }
2075
+ recorderClickTrigger() {
2076
+ if (this.isOpen) this.close();
2077
+ this.open();
2078
+ }
2079
+ recorderSelectCategory(category) {
2080
+ if (!this.isOpen) this.open();
2081
+ if (this.step !== "category") {
2082
+ this.selectedCategory = null;
2083
+ this.selectedIntent = null;
2084
+ this.step = "category";
2085
+ this.render();
2086
+ }
2087
+ this.selectedCategory = category;
2088
+ this.step = "intent";
2089
+ this.render();
2090
+ }
2091
+ recorderSelectIntent(label) {
2092
+ if (!this.isOpen || this.step !== "intent") return;
2093
+ this.selectedIntent = label;
2094
+ this.step = "details";
2095
+ this.render();
2096
+ }
2097
+ recorderFocusDescription() {
2098
+ const textarea = this.shadow.querySelector(".mushi-textarea");
2099
+ textarea?.focus();
2100
+ }
2101
+ recorderSubmit() {
2102
+ const submit = this.shadow.querySelector('[data-action="submit"]');
2103
+ submit?.click();
2104
+ }
2057
2105
  };
2058
2106
 
2107
+ // src/marketing-recorder.ts
2108
+ function centerOf(el) {
2109
+ if (!el) return null;
2110
+ const r = el.getBoundingClientRect();
2111
+ if (r.width === 0 && r.height === 0) return null;
2112
+ return { x: r.left + r.width / 2, y: r.top + r.height / 2 };
2113
+ }
2114
+ function exposeMarketingRecorder(widget) {
2115
+ if (typeof globalThis === "undefined") return;
2116
+ const api = {
2117
+ ready: () => widget.getIsMounted(),
2118
+ getStep: () => widget.getRecorderStep(),
2119
+ getTriggerCenter: () => centerOf(widget.getRecorderTrigger()),
2120
+ getCategoryCenter: (category) => centerOf(widget.getRecorderCategoryButton(category)),
2121
+ getIntentCenter: (label) => centerOf(widget.getRecorderIntentButton(label)),
2122
+ getSubmitCenter: () => centerOf(widget.getRecorderSubmitButton()),
2123
+ clickTrigger: () => widget.recorderClickTrigger(),
2124
+ selectCategory: (category) => widget.recorderSelectCategory(category),
2125
+ selectIntent: (label) => widget.recorderSelectIntent(label),
2126
+ focusDescription: () => widget.recorderFocusDescription(),
2127
+ submit: () => widget.recorderSubmit()
2128
+ };
2129
+ globalThis.__mushiRecorder = api;
2130
+ }
2131
+
2059
2132
  // src/rewards.ts
2060
2133
  var MIN_FLUSH_INTERVAL = 3e4;
2061
2134
  var DEFAULT_FLUSH_INTERVAL = 3e5;
@@ -3511,7 +3584,7 @@ function createProactiveManager(config = {}) {
3511
3584
 
3512
3585
  // src/version.ts
3513
3586
  var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
3514
- var MUSHI_SDK_VERSION = "1.2.0" ;
3587
+ var MUSHI_SDK_VERSION = "1.2.1" ;
3515
3588
 
3516
3589
  // src/mushi.ts
3517
3590
  var instance = null;
@@ -4259,6 +4332,9 @@ function createInstance(config) {
4259
4332
  enqueue({ action, metadata });
4260
4333
  }
4261
4334
  };
4335
+ if (typeof globalThis !== "undefined" && (bootstrapConfig.debug ?? false)) {
4336
+ exposeMarketingRecorder(widget);
4337
+ }
4262
4338
  return sdk;
4263
4339
  }
4264
4340
  function mergeRuntimeConfig(config, runtime) {