@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.cjs +77 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +77 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2056,8 +2056,81 @@ var MushiWidget = class {
|
|
|
2056
2056
|
this.render();
|
|
2057
2057
|
}
|
|
2058
2058
|
}
|
|
2059
|
+
/* ── Marketing / Playwright recorder (debug GIF capture) ─────────── */
|
|
2060
|
+
getRecorderStep() {
|
|
2061
|
+
return this.step;
|
|
2062
|
+
}
|
|
2063
|
+
getRecorderTrigger() {
|
|
2064
|
+
return this.shadow.querySelector(".mushi-trigger");
|
|
2065
|
+
}
|
|
2066
|
+
getRecorderCategoryButton(category) {
|
|
2067
|
+
return this.shadow.querySelector(`[data-category="${category}"]`);
|
|
2068
|
+
}
|
|
2069
|
+
getRecorderIntentButton(label) {
|
|
2070
|
+
return Array.from(this.shadow.querySelectorAll("[data-intent]")).find(
|
|
2071
|
+
(el) => el.dataset.intent === label
|
|
2072
|
+
) ?? null;
|
|
2073
|
+
}
|
|
2074
|
+
getRecorderSubmitButton() {
|
|
2075
|
+
return this.shadow.querySelector('[data-action="submit"]');
|
|
2076
|
+
}
|
|
2077
|
+
recorderClickTrigger() {
|
|
2078
|
+
if (this.isOpen) this.close();
|
|
2079
|
+
this.open();
|
|
2080
|
+
}
|
|
2081
|
+
recorderSelectCategory(category) {
|
|
2082
|
+
if (!this.isOpen) this.open();
|
|
2083
|
+
if (this.step !== "category") {
|
|
2084
|
+
this.selectedCategory = null;
|
|
2085
|
+
this.selectedIntent = null;
|
|
2086
|
+
this.step = "category";
|
|
2087
|
+
this.render();
|
|
2088
|
+
}
|
|
2089
|
+
this.selectedCategory = category;
|
|
2090
|
+
this.step = "intent";
|
|
2091
|
+
this.render();
|
|
2092
|
+
}
|
|
2093
|
+
recorderSelectIntent(label) {
|
|
2094
|
+
if (!this.isOpen || this.step !== "intent") return;
|
|
2095
|
+
this.selectedIntent = label;
|
|
2096
|
+
this.step = "details";
|
|
2097
|
+
this.render();
|
|
2098
|
+
}
|
|
2099
|
+
recorderFocusDescription() {
|
|
2100
|
+
const textarea = this.shadow.querySelector(".mushi-textarea");
|
|
2101
|
+
textarea?.focus();
|
|
2102
|
+
}
|
|
2103
|
+
recorderSubmit() {
|
|
2104
|
+
const submit = this.shadow.querySelector('[data-action="submit"]');
|
|
2105
|
+
submit?.click();
|
|
2106
|
+
}
|
|
2059
2107
|
};
|
|
2060
2108
|
|
|
2109
|
+
// src/marketing-recorder.ts
|
|
2110
|
+
function centerOf(el) {
|
|
2111
|
+
if (!el) return null;
|
|
2112
|
+
const r = el.getBoundingClientRect();
|
|
2113
|
+
if (r.width === 0 && r.height === 0) return null;
|
|
2114
|
+
return { x: r.left + r.width / 2, y: r.top + r.height / 2 };
|
|
2115
|
+
}
|
|
2116
|
+
function exposeMarketingRecorder(widget) {
|
|
2117
|
+
if (typeof globalThis === "undefined") return;
|
|
2118
|
+
const api = {
|
|
2119
|
+
ready: () => widget.getIsMounted(),
|
|
2120
|
+
getStep: () => widget.getRecorderStep(),
|
|
2121
|
+
getTriggerCenter: () => centerOf(widget.getRecorderTrigger()),
|
|
2122
|
+
getCategoryCenter: (category) => centerOf(widget.getRecorderCategoryButton(category)),
|
|
2123
|
+
getIntentCenter: (label) => centerOf(widget.getRecorderIntentButton(label)),
|
|
2124
|
+
getSubmitCenter: () => centerOf(widget.getRecorderSubmitButton()),
|
|
2125
|
+
clickTrigger: () => widget.recorderClickTrigger(),
|
|
2126
|
+
selectCategory: (category) => widget.recorderSelectCategory(category),
|
|
2127
|
+
selectIntent: (label) => widget.recorderSelectIntent(label),
|
|
2128
|
+
focusDescription: () => widget.recorderFocusDescription(),
|
|
2129
|
+
submit: () => widget.recorderSubmit()
|
|
2130
|
+
};
|
|
2131
|
+
globalThis.__mushiRecorder = api;
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2061
2134
|
// src/rewards.ts
|
|
2062
2135
|
var MIN_FLUSH_INTERVAL = 3e4;
|
|
2063
2136
|
var DEFAULT_FLUSH_INTERVAL = 3e5;
|
|
@@ -3513,7 +3586,7 @@ function createProactiveManager(config = {}) {
|
|
|
3513
3586
|
|
|
3514
3587
|
// src/version.ts
|
|
3515
3588
|
var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
|
|
3516
|
-
var MUSHI_SDK_VERSION = "1.2.
|
|
3589
|
+
var MUSHI_SDK_VERSION = "1.2.1" ;
|
|
3517
3590
|
|
|
3518
3591
|
// src/mushi.ts
|
|
3519
3592
|
var instance = null;
|
|
@@ -4261,6 +4334,9 @@ function createInstance(config) {
|
|
|
4261
4334
|
enqueue({ action, metadata });
|
|
4262
4335
|
}
|
|
4263
4336
|
};
|
|
4337
|
+
if (typeof globalThis !== "undefined" && (bootstrapConfig.debug ?? false)) {
|
|
4338
|
+
exposeMarketingRecorder(widget);
|
|
4339
|
+
}
|
|
4264
4340
|
return sdk;
|
|
4265
4341
|
}
|
|
4266
4342
|
function mergeRuntimeConfig(config, runtime) {
|