@morgan-and-morgan/intake-agent 1.0.0-alpha.3 → 1.0.0-alpha.4
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 +15 -3
- package/package.json +1 -1
package/dist/mm-intake-widget.js
CHANGED
|
@@ -105,6 +105,13 @@
|
|
|
105
105
|
return null;
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
|
+
const hasCompletedSigningEvent = (currentUrl = globalThis.location.href) => {
|
|
109
|
+
try {
|
|
110
|
+
return new URL(currentUrl).searchParams.get("event") === SIGNING_COMPLETE_EVENT;
|
|
111
|
+
} catch {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
108
115
|
const LUCIDE_ICON_PATHS = {
|
|
109
116
|
"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"/>',
|
|
110
117
|
"x": '<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',
|
|
@@ -213,7 +220,7 @@
|
|
|
213
220
|
} catch {
|
|
214
221
|
}
|
|
215
222
|
}
|
|
216
|
-
const
|
|
223
|
+
const returnedFromSigning = hasCompletedSigningEvent();
|
|
217
224
|
let chatHasLoaded = false;
|
|
218
225
|
let chatCloseTimer;
|
|
219
226
|
let chatReadyTimer;
|
|
@@ -235,7 +242,12 @@
|
|
|
235
242
|
postToChat(
|
|
236
243
|
createEmbedProtocolMessage(EMBED_MESSAGE_TYPE.HOST_READY, {
|
|
237
244
|
...hostUrl === null ? {} : { hostUrl },
|
|
238
|
-
...completedEnvelopeId === null ? {} : { completedEnvelopeId }
|
|
245
|
+
...completedEnvelopeId === null ? {} : { completedEnvelopeId },
|
|
246
|
+
// Sent even without an envelope id: the Salesforce service is what
|
|
247
|
+
// appends `envelope_id` to the return URL, and the prod org has shipped
|
|
248
|
+
// without that append. The chat's signing card falls back to its own
|
|
249
|
+
// envelope id on this flag.
|
|
250
|
+
...hasCompletedSigningEvent(currentUrl) ? { signingComplete: true } : {}
|
|
239
251
|
})
|
|
240
252
|
);
|
|
241
253
|
};
|
|
@@ -491,7 +503,7 @@
|
|
|
491
503
|
globalThis.addEventListener("message", handleMessage);
|
|
492
504
|
document.addEventListener("keydown", handleKeydown);
|
|
493
505
|
syncLauncherLabel();
|
|
494
|
-
if (
|
|
506
|
+
if (returnedFromSigning || readOpenState()) {
|
|
495
507
|
openChat();
|
|
496
508
|
}
|
|
497
509
|
return Object.freeze({
|