@morgan-and-morgan/intake-agent 1.0.0-alpha.14 → 1.0.0-alpha.16
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 +14 -0
- package/dist/consultation-chat.svg +3 -0
- package/dist/consultation-close.svg +3 -0
- package/dist/consultation-john-morgan.png +0 -0
- package/dist/consultation-kuunari.woff2 +0 -0
- package/dist/consultation-nunito-sans.woff2 +0 -0
- package/dist/consultation-online-desktop.svg +3 -0
- package/dist/consultation-online-mobile.svg +3 -0
- package/dist/consultation-team.png +0 -0
- package/dist/mm-intake-widget.js +136 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,3 +40,17 @@ The consultation modal reads `window.drupalSettings.mxPopup`, falling back to
|
|
|
40
40
|
boolean `false` suppresses the modal, including calls to `showPrompt()`.
|
|
41
41
|
Missing settings preserve the usual display rules. Settings are read when the
|
|
42
42
|
modal is about to appear; the launcher and chat remain available.
|
|
43
|
+
|
|
44
|
+
## Consultation prompt design
|
|
45
|
+
|
|
46
|
+
The responsive prompt follows the [desktop and mobile Figma layouts](https://www.figma.com/design/0SxWl42gdhx08KFe2ldpd8/MM-Design-System-v4.0?node-id=21250-169311).
|
|
47
|
+
Portrait, avatar, status dots, and icons are exported from those layers.
|
|
48
|
+
The fonts are the existing website's [Kuunari Bold Compressed](https://www.forthepeople.com/themes/custom/morgan/fonts/Kuunari/kuunari-bold-compressed.woff2)
|
|
49
|
+
and [Nunito Sans](https://www.forthepeople.com/themes/custom/morgan/fonts/NunitoSans/NunitoSans.woff2).
|
|
50
|
+
On forthepeople.com, the prompt loads these fonts from the host site to respect
|
|
51
|
+
its font security policy. Other hosts use the bundled copies.
|
|
52
|
+
Keep prompt assets in `public/` and `apps/expo/public/intake-widget/` identical;
|
|
53
|
+
the asset tests check both the CDN and portal copies.
|
|
54
|
+
|
|
55
|
+
Retain `consultation-prompt.webp` at both asset origins for older deployed widget
|
|
56
|
+
versions. The redesigned prompt does not request it.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="29" viewBox="0 0 24 29" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M9.75 22.5V23.25L13.125 20.7188C13.5 20.4375 13.9688 20.25 14.4844 20.25H21C21.375 20.25 21.75 19.9219 21.75 19.5V6C21.75 5.625 21.375 5.25 21 5.25H3C2.57812 5.25 2.25 5.625 2.25 6V19.5C2.25 19.9219 2.57812 20.25 3 20.25H7.5C8.71875 20.25 9.75 21.2812 9.75 22.5ZM9.70312 26.1094L9.46875 26.25L8.67188 26.8594C8.4375 27.0469 8.15625 27.0469 7.875 26.9531C7.64062 26.8125 7.5 26.5781 7.5 26.25V25.2656V24.9844V24.9375V24.75V22.5H5.25H3C1.3125 22.5 0 21.1875 0 19.5V6C0 4.35938 1.3125 3 3 3H21C22.6406 3 24 4.35938 24 6V19.5C24 21.1875 22.6406 22.5 21 22.5H14.4844L9.75 26.0625L9.70312 26.1094ZM7.125 9.75H16.875C17.4844 9.75 18 10.2656 18 10.875C18 11.5312 17.4844 12 16.875 12H7.125C6.46875 12 6 11.5312 6 10.875C6 10.2656 6.46875 9.75 7.125 9.75ZM7.125 14.25H12.375C12.9844 14.25 13.5 14.7656 13.5 15.375C13.5 16.0312 12.9844 16.5 12.375 16.5H7.125C6.46875 16.5 6 16.0312 6 15.375C6 14.7656 6.46875 14.25 7.125 14.25Z" fill="#061E39"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="18" height="29" viewBox="0 0 18 29" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M15.1875 22.3125L9 16.0781L2.76562 22.3125C2.48438 22.5938 2.01562 22.5938 1.6875 22.3125C1.40625 21.9844 1.40625 21.5156 1.6875 21.2344L7.92188 15L1.73438 8.8125C1.40625 8.53125 1.40625 8.0625 1.73438 7.73438C2.01562 7.45312 2.48438 7.45312 2.76562 7.73438L9 13.9688L15.1875 7.73438C15.4688 7.45312 15.9375 7.45312 16.2656 7.73438C16.5469 8.0625 16.5469 8.53125 16.2656 8.8125L10.0312 15L16.2656 21.2344C16.5469 21.5156 16.5469 21.9844 16.2656 22.3125C15.9375 22.5938 15.4688 22.5938 15.1875 22.3125Z" fill="white"/>
|
|
3
|
+
</svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="14.6667" height="14.6667" viewBox="0 0 14.6667 14.6667" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path id="Ellipse 52" d="M13.6667 7.33333C13.6667 10.8311 10.8311 13.6667 7.33333 13.6667C3.83553 13.6667 1 10.8311 1 7.33333C1 3.83553 3.83553 1 7.33333 1C10.8311 1 13.6667 3.83553 13.6667 7.33333Z" fill="#1FC16B" stroke-width="2" stroke="#132A4E"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="11.619" height="11.619" viewBox="0 0 11.619 11.619" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path id="Ellipse 52" d="M10.619 5.80952C10.619 8.46575 8.46575 10.619 5.80952 10.619C3.1533 10.619 1 8.46575 1 5.80952C1 3.1533 3.1533 1 5.80952 1C8.46575 1 10.619 3.1533 10.619 5.80952Z" fill="#1FC16B" stroke-width="2" stroke="#132A4E"/>
|
|
3
|
+
</svg>
|
|
Binary file
|
package/dist/mm-intake-widget.js
CHANGED
|
@@ -125,6 +125,8 @@
|
|
|
125
125
|
const EMBED_MESSAGE_TYPE = Object.freeze({
|
|
126
126
|
HOST_READY: "mm:intake:host-ready",
|
|
127
127
|
CHILD_READY: "mm:intake:child-ready",
|
|
128
|
+
NEW_CHAT: "mm:intake:new-chat",
|
|
129
|
+
SESSION_RESET: "mm:intake:session-reset",
|
|
128
130
|
// Host asks the embedded chat to put the caret in its composer. Kept
|
|
129
131
|
// separate from HOST_READY so signing-card handshakes never steal focus.
|
|
130
132
|
FOCUS_COMPOSER: "mm:intake:focus-composer",
|
|
@@ -218,6 +220,130 @@
|
|
|
218
220
|
return false;
|
|
219
221
|
}
|
|
220
222
|
};
|
|
223
|
+
const designSystemColors = {
|
|
224
|
+
// Colors/Base/black
|
|
225
|
+
"base-black": "#000000",
|
|
226
|
+
// Colors/Primary/100
|
|
227
|
+
"primary-100": "#f3f8ff",
|
|
228
|
+
// Colors/Primary/800
|
|
229
|
+
"primary-800": "#132a4e",
|
|
230
|
+
// Colors/Primary/900
|
|
231
|
+
"primary-900": "#061e39",
|
|
232
|
+
// Colors/Secondary/500
|
|
233
|
+
"secondary-500": "#ffec00",
|
|
234
|
+
// Colors/Secondary/700
|
|
235
|
+
"secondary-700": "#e2d100"
|
|
236
|
+
};
|
|
237
|
+
const PROMPT_FONTS = [
|
|
238
|
+
{
|
|
239
|
+
family: "MMIntakeKuunari",
|
|
240
|
+
file: "consultation-kuunari.woff2",
|
|
241
|
+
hostPath: "/themes/custom/morgan/fonts/Kuunari/kuunari-bold-compressed.woff2",
|
|
242
|
+
weight: "700",
|
|
243
|
+
fallbackClass: "mm-prompt-fallback-title"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
family: "MMIntakeNunitoSans",
|
|
247
|
+
file: "consultation-nunito-sans.woff2",
|
|
248
|
+
hostPath: "/themes/custom/morgan/fonts/NunitoSans/NunitoSans.woff2",
|
|
249
|
+
weight: "100 900",
|
|
250
|
+
fallbackClass: "mm-prompt-fallback-status"
|
|
251
|
+
}
|
|
252
|
+
];
|
|
253
|
+
const ownedPromptFonts = /* @__PURE__ */ new WeakMap();
|
|
254
|
+
const updateFontFallback = async (font, target, fallbackClass) => {
|
|
255
|
+
var _a, _b, _c;
|
|
256
|
+
if (font.status !== "loaded") (_a = target.backdrop) == null ? void 0 : _a.classList.add(fallbackClass);
|
|
257
|
+
try {
|
|
258
|
+
await font.loaded;
|
|
259
|
+
(_b = target.backdrop) == null ? void 0 : _b.classList.remove(fallbackClass);
|
|
260
|
+
} catch {
|
|
261
|
+
(_c = target.backdrop) == null ? void 0 : _c.classList.add(fallbackClass);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
const registerPromptFonts = (assetUrl, backdrop, host = globalThis.location) => {
|
|
265
|
+
const target = { backdrop };
|
|
266
|
+
const registrations = [];
|
|
267
|
+
const dispose = () => {
|
|
268
|
+
if (target.backdrop === void 0) return;
|
|
269
|
+
target.backdrop = void 0;
|
|
270
|
+
for (const registration of registrations) {
|
|
271
|
+
registration.users -= 1;
|
|
272
|
+
if (registration.users === 0) {
|
|
273
|
+
document.fonts.delete(registration.font);
|
|
274
|
+
ownedPromptFonts.delete(registration.font);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
if (typeof FontFace === "undefined") {
|
|
279
|
+
backdrop.classList.add(...PROMPT_FONTS.map(({ fallbackClass }) => fallbackClass));
|
|
280
|
+
return dispose;
|
|
281
|
+
}
|
|
282
|
+
const useHostFonts = ["forthepeople.com", "www.forthepeople.com"].includes(host.hostname);
|
|
283
|
+
for (const { family, file, hostPath, weight, fallbackClass } of PROMPT_FONTS) {
|
|
284
|
+
let font = [...document.fonts].find((registered) => registered.family === family);
|
|
285
|
+
if (font === void 0) {
|
|
286
|
+
const url = useHostFonts ? new URL(hostPath, host.origin).href : assetUrl(file);
|
|
287
|
+
font = new FontFace(family, `url(${JSON.stringify(url)})`, { weight, display: "swap" });
|
|
288
|
+
document.fonts.add(font);
|
|
289
|
+
ownedPromptFonts.set(font, { font, users: 0 });
|
|
290
|
+
}
|
|
291
|
+
const registration = ownedPromptFonts.get(font);
|
|
292
|
+
if (registration !== void 0) {
|
|
293
|
+
registration.users += 1;
|
|
294
|
+
registrations.push(registration);
|
|
295
|
+
}
|
|
296
|
+
void updateFontFallback(font, target, fallbackClass);
|
|
297
|
+
}
|
|
298
|
+
return dispose;
|
|
299
|
+
};
|
|
300
|
+
const PROMPT_STYLES = [
|
|
301
|
+
`.mm-prompt-backdrop{--mm-prompt-blue:${designSystemColors["primary-800"]};--mm-prompt-dark:${designSystemColors["primary-900"]};--mm-prompt-yellow:${designSystemColors["secondary-500"]};--mm-prompt-yellow-end:${designSystemColors["secondary-700"]};--mm-prompt-text:${designSystemColors["primary-100"]};position:fixed;inset:0;z-index:2147483002;display:flex;flex-direction:column;align-items:center;padding:12px;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y pinch-zoom;background:rgba(0,0,0,.5);animation:mm-prompt-backdrop-in .25s cubic-bezier(.23,1,.32,1) both;font-family:"MMIntakeNunitoSans",var(--mm-font);font-variation-settings:"YTLC" 500,"wdth" 100;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}`,
|
|
302
|
+
// Auto margins center the card when it fits and keep its top reachable when it overflows.
|
|
303
|
+
".mm-prompt-card{position:relative;isolation:isolate;display:flex;flex:none;flex-direction:column;margin-block:auto;width:600px;max-width:100%;padding:16px 16px 32px;border-radius:16px;background:var(--mm-prompt-blue);color:var(--mm-white);box-shadow:0 4px 5px rgba(0,0,0,.1),0 7px 10px rgba(0,0,0,.07),0 2px 16px rgba(0,0,0,.08);animation:mm-prompt-card-in .25s cubic-bezier(.23,1,.32,1) both}",
|
|
304
|
+
".mm-prompt-status{position:relative;z-index:1;display:flex;align-items:center;gap:13px;align-self:flex-start;max-width:calc(100% - 52px);padding:8px 40px 8px 8px;border-radius:999px;background:var(--mm-prompt-dark);color:var(--mm-prompt-text)}",
|
|
305
|
+
".mm-prompt-avatar{position:relative;flex:none;width:56px;height:56px}",
|
|
306
|
+
".mm-prompt-team{display:block;width:100%;height:100%;border-radius:50%}",
|
|
307
|
+
// The exported indicator bounds include Figma's 2px outside stroke.
|
|
308
|
+
".mm-prompt-online{position:absolute;right:-2px;top:40.17px;display:block;line-height:0}",
|
|
309
|
+
".mm-prompt-online img{display:block}",
|
|
310
|
+
".mm-prompt-status-text{margin:0;font-size:20px;font-weight:700;line-height:27px;white-space:nowrap}",
|
|
311
|
+
".mm-prompt-hero{position:relative;display:flex;align-items:center;height:304px;margin-top:-40px;padding-left:16px}",
|
|
312
|
+
// The heading extends over the portrait's transparent edge.
|
|
313
|
+
'.mm-prompt-title{position:relative;z-index:1;flex:1;min-width:0;height:232px;display:flex;flex-direction:column;justify-content:flex-end;margin:0;font-family:"MMIntakeKuunari",Impact,sans-serif;font-size:72px;font-weight:700;line-height:64px;letter-spacing:-2px;text-transform:uppercase}',
|
|
314
|
+
".mm-prompt-title-line{display:block;white-space:nowrap}",
|
|
315
|
+
".mm-prompt-mobile-break{display:none}",
|
|
316
|
+
".mm-prompt-portrait{position:relative;flex:none;width:270px;height:304px}",
|
|
317
|
+
".mm-prompt-image{display:block;width:100%;height:100%;pointer-events:none}",
|
|
318
|
+
`.mm-prompt-cta{position:relative;display:flex;align-items:center;justify-content:center;gap:16px;height:56px;margin:0 16px;border-radius:8px;background:linear-gradient(to bottom,var(--mm-prompt-yellow) 41.827%,var(--mm-prompt-yellow-end));box-shadow:0 2px 4px rgba(0,0,0,.05),0 4px 3px rgba(0,0,0,.04),0 1px 2px rgba(0,0,0,.03);color:${designSystemColors["base-black"]};font-size:20px;font-weight:700;line-height:24px}`,
|
|
319
|
+
".mm-prompt-cta-label{min-width:90px}",
|
|
320
|
+
// Preserve the Figma text frames in the SVG exports so centering retains their alignment.
|
|
321
|
+
".mm-prompt-chat-icon{display:block;width:24px;height:29px}",
|
|
322
|
+
// Keep the existing whole-card click target and the two-control focus loop.
|
|
323
|
+
".mm-prompt-open{position:absolute;inset:0;z-index:2;border:0;padding:0;border-radius:16px;background:transparent;cursor:pointer}",
|
|
324
|
+
".mm-prompt-close{position:absolute;top:16px;right:16px;z-index:3;display:grid;place-items:center;width:44px;height:44px;padding:0;border:2px solid var(--mm-prompt-yellow);border-radius:50%;background:var(--mm-prompt-dark);cursor:pointer}",
|
|
325
|
+
".mm-prompt-close-icon{display:block;width:18px;height:29px;pointer-events:none}",
|
|
326
|
+
".mm-prompt-close:hover{background:var(--mm-prompt-blue)}",
|
|
327
|
+
".mm-prompt-open:focus-visible,.mm-prompt-close:focus-visible{outline:3px solid var(--mm-prompt-yellow);outline-offset:3px}",
|
|
328
|
+
'@media(max-width:623px){.mm-prompt-backdrop{background:rgba(0,0,0,.7)}.mm-prompt-card{width:min(360px,calc(100vw - 24px));min-height:496px;padding:16px 12px;overflow:hidden}.mm-prompt-status{align-self:stretch;padding-right:40px}.mm-prompt-avatar{width:40px;height:40px}.mm-prompt-online{top:28.12px}.mm-prompt-status-text{min-width:0;font-size:18px;line-height:22px}.mm-prompt-hero{position:static;flex:1;min-height:332px;align-items:flex-end;height:auto;margin-top:0;padding:0}.mm-prompt-title{top:1px;flex:none;width:100%;height:auto;font-size:64px;line-height:56px;letter-spacing:-1.28px}.mm-prompt-mobile-break{display:block}.mm-prompt-portrait{position:absolute;top:93px;right:-37px;width:253px;height:285px}.mm-prompt-portrait::after{content:"";position:absolute;left:10px;right:0;bottom:0;height:60px;background:linear-gradient(to top,var(--mm-prompt-blue) 8.772%,transparent 94.737%)}.mm-prompt-cta{flex:none;height:48px;margin:24px 0 0}.mm-prompt-close{right:12px}.mm-prompt-open:focus-visible{outline-offset:-4px}}',
|
|
329
|
+
'.mm-prompt-fallback-title .mm-prompt-title{font-family:"MMIntakeKuunari",Arial,sans-serif;font-size:32px;letter-spacing:0}',
|
|
330
|
+
'.mm-prompt-fallback-status .mm-prompt-status-text{font-family:"MMIntakeNunitoSans",Arial,sans-serif;font-size:16px}',
|
|
331
|
+
".mm-prompt-close-contrast{display:none}",
|
|
332
|
+
"@media(forced-colors:active){.mm-prompt-card,.mm-prompt-cta,.mm-prompt-close{border:1px solid ButtonText}.mm-prompt-close-icon,.mm-prompt-chat-icon{display:none}.mm-prompt-close-contrast{display:block;color:ButtonText;font:28px/1 Arial,sans-serif}.mm-prompt-open:focus-visible,.mm-prompt-close:focus-visible{outline:2px solid ButtonText;outline-offset:-4px}}"
|
|
333
|
+
].join("");
|
|
334
|
+
const promptMarkup = (assetUrl) => [
|
|
335
|
+
'<div class="mm-prompt-card">',
|
|
336
|
+
'<div class="mm-prompt-status"><span class="mm-prompt-avatar" aria-hidden="true">',
|
|
337
|
+
`<img loading="lazy" class="mm-prompt-team" src="${assetUrl("consultation-team.png")}" alt="" width="56" height="56" decoding="async" />`,
|
|
338
|
+
`<picture class="mm-prompt-online"><source media="(max-width:623px)" srcset="${assetUrl("consultation-online-mobile.svg")}" /><img loading="lazy" src="${assetUrl("consultation-online-desktop.svg")}" alt="" /></picture>`,
|
|
339
|
+
'</span><p class="mm-prompt-status-text">Our team is <br class="mm-prompt-mobile-break" />available 24/7</p></div>',
|
|
340
|
+
'<div class="mm-prompt-hero"><h2 class="mm-prompt-title"><span class="mm-prompt-title-line">Click <br class="mm-prompt-mobile-break" />to start</span><span class="mm-prompt-title-line">your free</span><span class="mm-prompt-title-line">consultation</span></h2>',
|
|
341
|
+
`<div class="mm-prompt-portrait" aria-hidden="true"><img loading="lazy" class="mm-prompt-image" src="${assetUrl("consultation-john-morgan.png")}" alt="" width="270" height="304" decoding="async" /></div></div>`,
|
|
342
|
+
`<span class="mm-prompt-cta" aria-hidden="true"><img loading="lazy" class="mm-prompt-chat-icon" src="${assetUrl("consultation-chat.svg")}" alt="" width="24" height="29" /><span class="mm-prompt-cta-label">Chat now</span></span>`,
|
|
343
|
+
'<button class="mm-prompt-open" type="button" aria-label="Chat now about a free consultation"></button>',
|
|
344
|
+
`<button class="mm-prompt-close" type="button" aria-label="Dismiss consultation prompt"><img class="mm-prompt-close-icon" src="${assetUrl("consultation-close.svg")}" alt="" width="18" height="29" /><span class="mm-prompt-close-contrast" aria-hidden="true">×</span></button>`,
|
|
345
|
+
"</div>"
|
|
346
|
+
].join("");
|
|
221
347
|
const LUCIDE_ICON_PATHS = {
|
|
222
348
|
"message-circle": '<path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"/>',
|
|
223
349
|
"x": '<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',
|
|
@@ -233,7 +359,6 @@
|
|
|
233
359
|
const FULL_PAGE_PANEL_QUERY = "(max-width:600px),(max-height:500px)";
|
|
234
360
|
const lucideIcon = (name, className, strokeWidth = 2) => `<svg class="${className}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${String(strokeWidth)}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${LUCIDE_ICON_PATHS[name]}</svg>`;
|
|
235
361
|
const OPEN_CLOSE_ICON = lucideIcon("x", "mm-icon mm-icon-close");
|
|
236
|
-
const PROMPT_CLOSE_ICON = lucideIcon("x", "mm-prompt-close-icon", 2.5);
|
|
237
362
|
const WIDGET_STYLES = [
|
|
238
363
|
':host{all:initial;color-scheme:light;--mm-yellow:#fdeb01;--mm-yellow-hover:#f5de00;--mm-yellow-pressed:#e6cc00;--mm-blue:#115099;--mm-blue-hover:#0b3568;--mm-ink:#111;--mm-white:#fff;--mm-surface-blue:#f3f8ff;--mm-chrome:#e8eef2;--mm-line:#e2e8f0;--mm-muted:#545454;--mm-green:#0f9d58;--mm-font:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif}',
|
|
239
364
|
"*,*::before,*::after{box-sizing:border-box}",
|
|
@@ -276,31 +401,19 @@
|
|
|
276
401
|
".mm-dot{width:8px;height:8px;border-radius:999px;background:var(--mm-muted);animation:mm-dot 1.2s ease-in-out infinite}",
|
|
277
402
|
".mm-dot:nth-child(2){animation-delay:.15s}",
|
|
278
403
|
".mm-dot:nth-child(3){animation-delay:.3s}",
|
|
279
|
-
|
|
280
|
-
".mm-prompt-card{position:relative;width:min(632px,calc(100vw - 32px),calc((100vh - 32px)*1.26148));aspect-ratio:632/501;animation:mm-prompt-card-in .25s cubic-bezier(.23,1,.32,1) both}",
|
|
281
|
-
".mm-prompt-image{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none}",
|
|
282
|
-
".mm-prompt-open,.mm-prompt-close{position:absolute;border:0;outline:none;background:transparent;cursor:pointer}",
|
|
283
|
-
".mm-prompt-open{inset:0;border-radius:24px}",
|
|
284
|
-
".mm-prompt-close{top:4.5%;right:3.1%;z-index:1;display:grid;place-items:center;width:44px;height:44px;border-radius:999px;color:var(--mm-white)}",
|
|
285
|
-
'.mm-prompt-close::before{content:"";position:absolute;width:28px;height:28px;border-radius:999px;background:#050505;box-shadow:0 1px 4px rgba(0,0,0,.35);transition:background-color .12s ease}',
|
|
286
|
-
".mm-prompt-close-icon{position:relative;display:block;width:16px;height:16px;pointer-events:none}",
|
|
287
|
-
".mm-prompt-close:hover::before{background:#252525}",
|
|
288
|
-
".mm-prompt-open:focus-visible{outline:3px solid var(--mm-yellow);outline-offset:-8px}",
|
|
289
|
-
".mm-prompt-close:focus-visible{outline:none}",
|
|
290
|
-
".mm-prompt-close:focus-visible::before{background:#050505;box-shadow:inset 0 0 0 2px var(--mm-yellow),0 1px 4px rgba(0,0,0,.35)}",
|
|
404
|
+
PROMPT_STYLES,
|
|
291
405
|
"[hidden]{display:none!important}",
|
|
292
406
|
`@media ${FULL_PAGE_PANEL_QUERY}{.mm-launcher[aria-expanded="true"]{top:calc(var(--mm-viewport-top,0px) + 10px);right:10px;bottom:auto;width:44px;height:44px}.mm-chat{left:0;right:0;top:var(--mm-viewport-top,auto);bottom:0;width:auto;height:var(--mm-viewport-height,100dvh);min-height:0;border:0;border-radius:0;box-shadow:0 calc(100lvh - 100svh) 0 var(--mm-panel-bottom,var(--mm-chrome))}}`,
|
|
293
|
-
"@media(forced-colors:active){.mm-prompt-close:focus-visible{outline:2px solid ButtonText;outline-offset:-9px}}",
|
|
294
407
|
"@media(prefers-reduced-motion:reduce){.mm-launcher,.mm-chat{animation:none;transition:none}.mm-prompt-card{animation-name:mm-prompt-backdrop-in}.mm-dot{animation:none}}"
|
|
295
408
|
].join("");
|
|
296
|
-
const widgetMarkup = (
|
|
409
|
+
const widgetMarkup = (assetUrl) => [
|
|
297
410
|
`<style>${WIDGET_STYLES}</style>`,
|
|
298
|
-
`<button class="mm-launcher" type="button" aria-label="Open intake chat" aria-expanded="false" draggable="false"><img class="mm-text-us" src="${
|
|
411
|
+
`<button class="mm-launcher" type="button" aria-label="Open intake chat" aria-expanded="false" draggable="false"><img class="mm-text-us" src="${assetUrl("button-text-us.png")}" alt="" width="38" height="147" decoding="async" />${OPEN_CLOSE_ICON}</button>`,
|
|
299
412
|
'<section class="mm-chat" role="dialog" aria-label="Morgan and Morgan intake chat" inert hidden>',
|
|
300
413
|
'<div class="mm-frame-wrap"><div class="mm-loading" role="status" aria-label="Loading secure chat"><span class="mm-dot"></span><span class="mm-dot"></span><span class="mm-dot"></span></div><iframe class="mm-frame mm-chat-frame" title="Morgan and Morgan intake chat" referrerpolicy="strict-origin-when-cross-origin"></iframe></div>',
|
|
301
414
|
"</section>",
|
|
302
415
|
'<section class="mm-prompt-backdrop" role="dialog" aria-modal="true" aria-label="Start your free consultation" inert hidden>',
|
|
303
|
-
|
|
416
|
+
promptMarkup(assetUrl),
|
|
304
417
|
"</section>"
|
|
305
418
|
].join("");
|
|
306
419
|
const requireElement = (shadow, selector) => {
|
|
@@ -310,9 +423,11 @@
|
|
|
310
423
|
}
|
|
311
424
|
return element;
|
|
312
425
|
};
|
|
313
|
-
const renderWidgetShell = (shadow,
|
|
314
|
-
shadow.innerHTML = widgetMarkup(
|
|
426
|
+
const renderWidgetShell = (shadow, assetUrl) => {
|
|
427
|
+
shadow.innerHTML = widgetMarkup(assetUrl);
|
|
428
|
+
const disposePromptFonts = registerPromptFonts(assetUrl, requireElement(shadow, ".mm-prompt-backdrop"));
|
|
315
429
|
return {
|
|
430
|
+
disposePromptFonts,
|
|
316
431
|
chatDialog: requireElement(shadow, ".mm-chat"),
|
|
317
432
|
chatFrame: requireElement(shadow, ".mm-chat-frame"),
|
|
318
433
|
chatLoading: requireElement(shadow, ".mm-loading"),
|
|
@@ -372,7 +487,7 @@
|
|
|
372
487
|
var _a;
|
|
373
488
|
return new URL(fileName, (_a = config.assetBaseUrl) != null ? _a : `${config.chatOrigin}/intake-widget/`).href;
|
|
374
489
|
};
|
|
375
|
-
const elements = renderWidgetShell(shadow, assetUrl
|
|
490
|
+
const elements = renderWidgetShell(shadow, assetUrl);
|
|
376
491
|
document.body.append(mount);
|
|
377
492
|
if (typeof mount.showPopover === "function") {
|
|
378
493
|
mount.setAttribute("popover", "manual");
|
|
@@ -698,6 +813,7 @@
|
|
|
698
813
|
}
|
|
699
814
|
};
|
|
700
815
|
const destroy = () => {
|
|
816
|
+
elements.disposePromptFonts();
|
|
701
817
|
stopViewportTracking();
|
|
702
818
|
globalThis.clearTimeout(chatCloseTimer);
|
|
703
819
|
globalThis.clearTimeout(chatReadyTimer);
|