@morgan-and-morgan/intake-agent 1.0.0-alpha.8 → 1.0.0-alpha.9
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/mm-intake-widget.js +13 -2
- package/package.json +2 -2
package/dist/mm-intake-widget.js
CHANGED
|
@@ -149,7 +149,14 @@
|
|
|
149
149
|
// the protocol for a future unread affordance; the TEXT US sticky has no badge
|
|
150
150
|
// today. Payload-free: only the chat knows a message arrived while only the
|
|
151
151
|
// host knows whether the panel was closed at the time.
|
|
152
|
-
MESSAGE_RECEIVED: "mm:intake:message-received"
|
|
152
|
+
MESSAGE_RECEIVED: "mm:intake:message-received",
|
|
153
|
+
// Chat asks the host for a fresh attribution snapshot right before a /chat
|
|
154
|
+
// turn; the host answers with ATTRIBUTION as `{ attribution }`. The snapshot
|
|
155
|
+
// sent with HOST_READY is read once at mount and races the marketing site's
|
|
156
|
+
// async first-touch cookie write (MX2-26181), so the landing URL — and the
|
|
157
|
+
// gclid parsed out of it — can only be caught by re-reading at send time.
|
|
158
|
+
GET_ATTRIBUTION: "mm:intake:get-attribution",
|
|
159
|
+
ATTRIBUTION: "mm:intake:attribution"
|
|
153
160
|
});
|
|
154
161
|
const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
155
162
|
const isEmbedProtocolMessage = (value, type) => isRecord(value) && value.type === type && value.version === EMBED_PROTOCOL_VERSION && isRecord(value.payload);
|
|
@@ -316,7 +323,7 @@
|
|
|
316
323
|
};
|
|
317
324
|
};
|
|
318
325
|
const PANEL_ANIMATION_MS = 180;
|
|
319
|
-
const PROMPT_DELAY_MS =
|
|
326
|
+
const PROMPT_DELAY_MS = 5e3;
|
|
320
327
|
const PROMPT_COOLDOWN_MS = 24 * 60 * 60 * 1e3;
|
|
321
328
|
const PROMPT_COOLDOWN_KEY = "mm-intake-widget-prompt-dismissed-at";
|
|
322
329
|
const PROMPT_SESSION_KEY = "mm-intake-widget-prompt-dismissed";
|
|
@@ -656,6 +663,10 @@
|
|
|
656
663
|
void answerAuthTokenRequest();
|
|
657
664
|
return;
|
|
658
665
|
}
|
|
666
|
+
if (isEmbedProtocolMessage(message, EMBED_MESSAGE_TYPE.GET_ATTRIBUTION)) {
|
|
667
|
+
postToChat(createEmbedProtocolMessage(EMBED_MESSAGE_TYPE.ATTRIBUTION, { attribution: buildHostAttribution() }));
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
659
670
|
if (isEmbedProtocolMessage(message, EMBED_MESSAGE_TYPE.CARET_STATE)) {
|
|
660
671
|
if (message.payload.isFocused === true) {
|
|
661
672
|
hasReleasedKeyboardEarly = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morgan-and-morgan/intake-agent",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.9",
|
|
4
4
|
"description": "Embeddable chat widget loader.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"files": [
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"build": "pnpm run build:bundle",
|
|
24
24
|
"build:bundle": "node scripts/generate-icons.mjs && vite build",
|
|
25
25
|
"generate:icons": "node scripts/generate-icons.mjs",
|
|
26
|
-
"test": "node --test src
|
|
26
|
+
"test": "node --test 'src/*.test.mjs'",
|
|
27
27
|
"typecheck": "tsc --noEmit",
|
|
28
28
|
"lint": "eslint \"src/**/*.ts\" --quiet",
|
|
29
29
|
"lint:fix": "eslint \"src/**/*.ts\" --quiet --fix",
|