@morgan-and-morgan/intake-agent 1.0.0-alpha.7 → 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/README.md +5 -1
- package/dist/consultation-prompt.webp +0 -0
- package/dist/mm-intake-widget.js +15 -4
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -21,6 +21,10 @@ placeholder, don't bump it by hand.
|
|
|
21
21
|
| `release/**` | `x.y.z-beta.N` | `beta` |
|
|
22
22
|
| `main` | `x.y.z` | `latest` |
|
|
23
23
|
|
|
24
|
+
Each bundle also carries its matching chat environment: development for
|
|
25
|
+
`alpha`, UAT for `beta`, and production for `latest`. `data-chat-url` remains
|
|
26
|
+
an explicit override.
|
|
27
|
+
|
|
24
28
|
`fix:` bumps the patch, `feat:` the minor, a `BREAKING CHANGE:` footer the
|
|
25
29
|
major. Every release is tagged `intake-agent-vx.y.z`.
|
|
26
30
|
|
|
@@ -28,5 +32,5 @@ major. Every release is tagged `intake-agent-vx.y.z`.
|
|
|
28
32
|
|
|
29
33
|
| Attribute | Default | Purpose |
|
|
30
34
|
| --- | --- | --- |
|
|
31
|
-
| `data-chat-url` |
|
|
35
|
+
| `data-chat-url` | Release environment URL | Chat iframe target |
|
|
32
36
|
| `data-auto-open` | `false` | Open the chat immediately after mount |
|
|
Binary file
|
package/dist/mm-intake-widget.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
(function() {
|
|
2
2
|
"use strict";
|
|
3
|
-
const DEFAULT_CHAT_PATH = "/embed/intake";
|
|
4
3
|
const readLoaderConfig = (script, baseUri) => {
|
|
5
4
|
var _a;
|
|
6
5
|
const scriptUrl = new URL(script.src, baseUri);
|
|
7
|
-
const
|
|
6
|
+
const bundledChatUrl = "https://chat.mx2.dev/embed/intake";
|
|
7
|
+
const chatUrl = new URL((_a = script.dataset.chatUrl) != null ? _a : bundledChatUrl, scriptUrl).href;
|
|
8
8
|
return {
|
|
9
9
|
assetBaseUrl: new URL(".", scriptUrl).href,
|
|
10
10
|
autoOpen: script.dataset.autoOpen === "true",
|
|
@@ -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,6 +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/*.test.mjs'",
|
|
26
27
|
"typecheck": "tsc --noEmit",
|
|
27
28
|
"lint": "eslint \"src/**/*.ts\" --quiet",
|
|
28
29
|
"lint:fix": "eslint \"src/**/*.ts\" --quiet --fix",
|