@morgan-and-morgan/intake-agent 1.5.0 → 1.6.0-beta.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/mm-intake-widget.js +13 -2
- package/package.json +1 -1
package/dist/mm-intake-widget.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const readLoaderConfig = (script, baseUri) => {
|
|
4
4
|
var _a;
|
|
5
5
|
const scriptUrl = new URL(script.src, baseUri);
|
|
6
|
-
const bundledChatUrl = "https://chat.mx2.
|
|
6
|
+
const bundledChatUrl = "https://chat-uat.mx2.dev/embed/intake";
|
|
7
7
|
const chatUrl = new URL((_a = script.dataset.chatUrl) != null ? _a : bundledChatUrl, scriptUrl).href;
|
|
8
8
|
return {
|
|
9
9
|
assetBaseUrl: new URL(".", scriptUrl).href,
|
|
@@ -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);
|
|
@@ -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;
|