@momentco-ai/moment-sdk 0.9.0-dev.47 → 0.9.0-dev.49
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/CHANGELOG.md +5 -0
- package/README.md +1 -1
- package/dist/moment-sdk.js +4 -4
- package/dist/moment-sdk.mjs +349 -216
- package/dist/types/sdk/__tests__/feedback-layer.test.d.ts +1 -0
- package/dist/types/sdk/feedback-layer.d.ts +21 -0
- package/dist/types/sdk/moment-sdk.d.ts +4 -0
- package/dist/types/sdk/types.d.ts +30 -4
- package/package.json +1 -1
package/dist/moment-sdk.mjs
CHANGED
|
@@ -1,49 +1,171 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
function
|
|
1
|
+
const E = "moment_sync", L = "moment_campaign";
|
|
2
|
+
const K = /^(?:schedule|(moment|list):([a-z0-9-]+)|playlist:([a-z0-9-]+(?:,[a-z0-9-]+)*))$/, V = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
3
|
+
function Y(i, e) {
|
|
4
4
|
if (!e) return null;
|
|
5
|
-
const t = new URL(i),
|
|
6
|
-
if (
|
|
7
|
-
const r =
|
|
5
|
+
const t = new URL(i), n = t.searchParams.get(E);
|
|
6
|
+
if (n === null || n.length > 200) return null;
|
|
7
|
+
const r = K.exec(n);
|
|
8
8
|
if (!r) return null;
|
|
9
|
-
const [, o,
|
|
10
|
-
let
|
|
11
|
-
o === "moment" ?
|
|
12
|
-
const
|
|
13
|
-
return t.search = t.search.slice(1).split("&").filter((
|
|
14
|
-
const l =
|
|
15
|
-
return l !==
|
|
9
|
+
const [, o, s, a] = r;
|
|
10
|
+
let m;
|
|
11
|
+
o === "moment" ? m = { teamSlug: e, triggerType: "moment", momentSlug: s } : o === "list" ? m = { teamSlug: e, triggerType: "list", listSlug: s } : a ? m = { teamSlug: e, triggerType: "playlist", playlistSlugs: a.split(",") } : m = { teamSlug: e, triggerType: "schedule" };
|
|
12
|
+
const u = t.searchParams.get(L);
|
|
13
|
+
return t.search = t.search.slice(1).split("&").filter((f) => {
|
|
14
|
+
const l = f.split("=", 1)[0];
|
|
15
|
+
return l !== E && l !== L;
|
|
16
16
|
}).join("&"), {
|
|
17
|
-
payload:
|
|
18
|
-
...
|
|
17
|
+
payload: m,
|
|
18
|
+
...u && V.test(u) ? { campaignId: u } : {},
|
|
19
19
|
cleanUrl: t.href
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
let
|
|
23
|
-
function
|
|
24
|
-
return
|
|
22
|
+
let I = !1;
|
|
23
|
+
function q() {
|
|
24
|
+
return I ? !1 : (I = !0, !0);
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function X(i, e) {
|
|
27
27
|
i.body ? e() : i.addEventListener("DOMContentLoaded", e, { once: !0 });
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
|
|
29
|
+
const J = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='15.55 11.94 120.52 21.28'%3E%3Cpath d='M16.59 33.04L17.42 29.54C18.62 24.54 19.22 21.32 19.22 19.89C19.22 19.68 19.19 19.54 19.12 19.47C19.05 19.4 18.91 19.38 18.7 19.4C18.4 19.47 17.97 19.65 17.42 19.94C16.86 20.23 16.32 20.62 15.79 21.1C15.63 20.9 15.55 20.69 15.55 20.48C15.55 20.27 15.65 20.03 15.86 19.75C16.16 19.38 16.65 18.95 17.33 18.45C18.02 17.95 18.74 17.53 19.5 17.2C20.27 16.86 20.92 16.7 21.48 16.7C21.78 16.7 22 16.79 22.14 16.99C22.28 17.19 22.35 17.5 22.35 17.94C22.35 18.55 22.24 19.42 22.04 20.56C21.83 21.71 21.55 22.88 21.2 24.09C22.34 21.96 23.59 20.19 24.95 18.79C26.32 17.4 27.7 16.7 29.12 16.7C29.79 16.7 30.27 16.87 30.57 17.23C30.87 17.59 31.02 18.14 31.02 18.88C31.02 19.97 30.69 21.7 30.02 24.09C31.13 22.01 32.44 20.25 33.94 18.83C35.44 17.41 36.94 16.7 38.42 16.7C39.11 16.7 39.63 16.88 39.98 17.25C40.33 17.62 40.5 18.16 40.5 18.88C40.5 19.18 40.45 19.62 40.34 20.18C40.24 20.75 40.1 21.37 39.91 22.04L38.42 27.7C38.09 28.92 37.93 29.77 37.93 30.23C37.93 30.48 37.97 30.67 38.05 30.8C38.13 30.93 38.27 30.99 38.45 30.99C38.89 30.99 39.47 30.69 40.17 30.09C40.88 29.49 41.46 28.85 41.92 28.18C42.25 28.44 42.41 28.72 42.41 29.05C42.41 29.26 42.34 29.48 42.2 29.71C41.74 30.5 40.98 31.28 39.93 32.05C38.87 32.82 37.82 33.21 36.75 33.21C36.08 33.21 35.56 33.02 35.17 32.62C34.79 32.23 34.6 31.66 34.6 30.92C34.6 30.3 34.8 29.22 35.19 27.7L36.79 21.55C37 20.74 37.1 20.13 37.1 19.71C37.1 19.2 36.89 18.95 36.48 18.95C35.97 18.95 35.3 19.33 34.46 20.08C33.63 20.83 32.79 21.94 31.93 23.41C31.07 24.88 30.33 26.62 29.71 28.63L28.91 31.27C28.77 31.73 28.59 32.09 28.37 32.33C28.15 32.57 27.82 32.73 27.38 32.8L25.54 33.22L25.37 33.04L26.13 29.67C26.73 27.11 27.19 25.03 27.49 23.44C27.79 21.86 27.94 20.72 27.94 20.03C27.94 19.33 27.72 19.02 27.28 19.02C26.79 19.02 26.17 19.4 25.42 20.15C24.67 20.9 23.89 22 23.1 23.46C22.3 24.92 21.6 26.65 21 28.67L20.2 31.27C20.06 31.71 19.87 32.05 19.63 32.29C19.38 32.54 19.02 32.71 18.53 32.8L16.76 33.22L16.59 33.04L16.59 33.04Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M57.66 17.94C57 17.13 55.99 16.73 54.62 16.73C52.93 16.73 51.31 17.3 49.75 18.43C49.51 18.6 49.28 18.78 49.06 18.97C49.24 19.85 49.39 20.78 49.48 21.74C49.86 21.01 50.3 20.37 50.79 19.82C51.63 18.87 52.5 18.39 53.41 18.39C54.08 18.39 54.55 18.68 54.81 19.24C55.08 19.81 55.21 20.58 55.21 21.55C55.21 23.08 54.97 24.63 54.48 26.19C54 27.75 53.35 29.03 52.54 30.04C51.73 31.04 50.86 31.55 49.94 31.55C49.53 31.55 49.19 31.44 48.9 31.22C48.74 31.9 48.54 32.55 48.31 33.19C48.5 33.2 48.7 33.21 48.9 33.21C50.54 33.21 52.11 32.63 53.61 31.48C55.12 30.32 56.33 28.82 57.26 26.98C58.18 25.14 58.65 23.28 58.65 21.38C58.65 19.9 58.32 18.75 57.66 17.94L57.66 17.94Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M61.84 33.04L62.67 29.54C63.88 24.54 64.48 21.32 64.48 19.89C64.48 19.68 64.44 19.54 64.37 19.47C64.3 19.4 64.17 19.38 63.96 19.4C63.66 19.47 63.23 19.65 62.67 19.94C62.12 20.23 61.57 20.62 61.04 21.1C60.88 20.9 60.8 20.69 60.8 20.48C60.8 20.27 60.9 20.03 61.11 19.75C61.41 19.38 61.9 18.95 62.59 18.45C63.27 17.95 63.99 17.53 64.76 17.2C65.52 16.86 66.18 16.7 66.73 16.7C67.04 16.7 67.26 16.79 67.39 16.99C67.53 17.19 67.6 17.5 67.6 17.94C67.6 18.55 67.5 19.42 67.29 20.56C67.08 21.71 66.8 22.88 66.46 24.09C67.59 21.96 68.84 20.19 70.2 18.79C71.57 17.4 72.96 16.7 74.37 16.7C75.04 16.7 75.53 16.87 75.83 17.23C76.13 17.59 76.28 18.14 76.28 18.88C76.28 19.97 75.94 21.7 75.27 24.09C76.38 22.01 77.69 20.25 79.19 18.83C80.7 17.41 82.19 16.7 83.67 16.7C84.36 16.7 84.89 16.88 85.23 17.25C85.58 17.62 85.75 18.16 85.75 18.88C85.75 19.18 85.7 19.62 85.6 20.18C85.49 20.75 85.35 21.37 85.16 22.04L83.67 27.7C83.35 28.92 83.19 29.77 83.19 30.23C83.19 30.48 83.23 30.67 83.31 30.8C83.39 30.93 83.52 30.99 83.71 30.99C84.15 30.99 84.72 30.69 85.42 30.09C86.13 29.49 86.71 28.85 87.18 28.18C87.5 28.44 87.66 28.72 87.66 29.05C87.66 29.26 87.59 29.48 87.46 29.71C86.99 30.5 86.24 31.28 85.18 32.05C84.13 32.82 83.07 33.21 82.01 33.21C81.34 33.21 80.81 33.02 80.43 32.62C80.05 32.23 79.86 31.66 79.86 30.92C79.86 30.3 80.05 29.22 80.44 27.7L82.04 21.55C82.25 20.74 82.35 20.13 82.35 19.71C82.35 19.2 82.15 18.95 81.73 18.95C81.22 18.95 80.55 19.33 79.72 20.08C78.88 20.83 78.04 21.94 77.18 23.41C76.33 24.88 75.59 26.62 74.96 28.63L74.16 31.27C74.02 31.73 73.85 32.09 73.63 32.33C73.41 32.57 73.08 32.73 72.64 32.8L70.8 33.22L70.62 33.04L71.39 29.67C71.99 27.11 72.44 25.03 72.74 23.44C73.04 21.86 73.19 20.72 73.19 20.03C73.19 19.33 72.97 19.02 72.53 19.02C72.05 19.02 71.43 19.4 70.68 20.15C69.92 20.9 69.15 22 68.35 23.46C67.55 24.92 66.85 26.65 66.25 28.67L65.45 31.27C65.31 31.71 65.12 32.05 64.88 32.29C64.64 32.54 64.27 32.71 63.79 32.8L62.02 33.22L61.84 33.04L61.84 33.04Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M91.01 31.91C90.19 31.04 89.78 29.85 89.78 28.32C89.78 26.47 90.32 24.64 91.41 22.84C92.49 21.03 93.87 19.56 95.54 18.41C97.2 17.27 98.82 16.69 100.4 16.69C101.23 16.69 101.87 16.9 102.31 17.3C102.75 17.71 102.97 18.25 102.97 18.95C102.97 20.08 102.55 21.13 101.72 22.09C100.88 23.05 99.77 23.81 98.37 24.38C96.97 24.95 95.47 25.23 93.87 25.23H93.52C93.25 26.16 93.11 27.05 93.11 27.9C93.11 28.97 93.32 29.79 93.75 30.37C94.18 30.95 94.8 31.24 95.61 31.24C96.51 31.24 97.4 30.91 98.28 30.26C99.16 29.62 99.99 28.69 100.78 27.49C100.96 27.72 101.1 27.91 101.18 28.06C101.26 28.21 101.3 28.39 101.3 28.6C101.3 28.81 101.22 29.06 101.06 29.36C100.78 29.89 100.32 30.46 99.67 31.05C99.02 31.63 98.24 32.14 97.33 32.57C96.41 33 95.43 33.21 94.39 33.21C92.96 33.21 91.83 32.78 91.01 31.91V31.91ZM94.32 23.81C95.43 23.81 96.43 23.58 97.33 23.12C98.22 22.65 98.92 22.08 99.42 21.4C99.93 20.71 100.19 20.05 100.19 19.4C100.19 18.69 99.85 18.33 99.18 18.33C98.3 18.33 97.37 18.85 96.39 19.91C95.41 20.96 94.61 22.25 94.01 23.78C94.08 23.8 94.19 23.81 94.32 23.81L94.32 23.81Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M105.91 33.04L106.78 29.12C107.96 24.08 108.55 21.04 108.55 20.03C108.55 19.82 108.5 19.66 108.4 19.56C108.29 19.45 108.15 19.4 107.96 19.4C107.68 19.4 107.3 19.54 106.82 19.82C106.33 20.1 105.75 20.51 105.08 21.07C105.01 21 104.95 20.89 104.91 20.75C104.86 20.62 104.84 20.5 104.84 20.41C104.84 20.27 104.86 20.13 104.89 19.99C104.93 19.85 105.01 19.7 105.15 19.54C105.43 19.17 105.88 18.76 106.52 18.31C107.16 17.86 107.83 17.47 108.55 17.16C109.27 16.85 109.89 16.69 110.43 16.69C110.79 16.69 111.06 16.79 111.21 16.97C111.36 17.16 111.43 17.47 111.43 17.91C111.43 19.09 111.05 21.2 110.29 24.26C111.42 22.08 112.72 20.28 114.19 18.84C115.66 17.41 117.14 16.69 118.65 16.69C119.37 16.69 119.92 16.88 120.3 17.25C120.68 17.62 120.87 18.14 120.87 18.81C120.87 19.48 120.67 20.57 120.28 22.07L118.72 27.97C118.44 28.99 118.3 29.74 118.3 30.23C118.3 30.71 118.48 30.99 118.82 30.99C119.26 30.99 119.84 30.69 120.54 30.09C121.25 29.49 121.83 28.85 122.29 28.18C122.62 28.43 122.78 28.72 122.78 29.05C122.78 29.26 122.71 29.48 122.57 29.71C122.32 30.17 121.91 30.67 121.34 31.22C120.77 31.76 120.12 32.23 119.39 32.62C118.67 33.02 117.92 33.21 117.16 33.21C116.46 33.21 115.92 33.02 115.54 32.62C115.16 32.23 114.97 31.63 114.97 30.82C114.97 30.15 115.18 29.04 115.59 27.49L117.09 22.14C117.36 21.05 117.5 20.24 117.5 19.71C117.5 19.18 117.32 18.95 116.95 18.95C116.37 18.95 115.65 19.35 114.8 20.15C113.94 20.95 113.08 22.09 112.21 23.58C111.34 25.07 110.63 26.84 110.08 28.87L109.45 31.06C109.31 31.59 109.13 31.98 108.9 32.22C108.67 32.47 108.33 32.65 107.89 32.76L106.09 33.21L105.91 33.04L105.91 33.04Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M126.29 32.28C125.82 31.65 125.59 30.84 125.59 29.85C125.59 29.27 125.7 28.37 125.9 27.16C126.11 25.94 126.47 24.18 126.98 21.87L127.6 18.88H124.52L124.76 17.49L127.99 17.15L130.03 13.12C130.24 12.75 130.43 12.48 130.59 12.32C130.75 12.16 130.95 12.06 131.18 12.01C131.41 11.96 131.76 11.94 132.22 11.94L132.36 12.11L131.28 17.15H136.07L135.9 18.01C135.85 18.36 135.75 18.59 135.6 18.71C135.45 18.82 135.18 18.88 134.79 18.88H130.9L130.24 21.94C129.73 24.34 129.37 26.11 129.17 27.23C128.96 28.35 128.85 29.14 128.85 29.61C128.85 30 128.93 30.29 129.08 30.47C129.23 30.66 129.48 30.75 129.82 30.75C130.42 30.75 131.14 30.5 131.98 30.01C132.81 29.51 133.55 28.89 134.2 28.15C134.57 28.43 134.75 28.69 134.75 28.95C134.75 29.39 134.42 29.95 133.75 30.63C133.07 31.31 132.25 31.91 131.26 32.43C130.28 32.96 129.34 33.22 128.44 33.22C127.47 33.22 126.75 32.9 126.28 32.28L126.29 32.28Z' fill='%23FAFAF9'%3E%3C/path%3E%3C/svg%3E", Q = 120.52 / 21.28, ee = 4e3, te = 80, O = ["#f04a34", "#041abe", "#041139", "#1cd4ed", "#b8e070"], ie = 10, ne = 260, se = "M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z", re = "M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z", oe = "M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z", ae = "M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z", _ = {
|
|
30
|
+
success: { fill: "#1c1d22", glyph: "#fafafc", path: se },
|
|
31
|
+
info: { fill: "#146eaa", glyph: "#ffffff", path: re },
|
|
32
|
+
warning: { fill: "#aa4e19", glyph: "#ffffff", path: oe },
|
|
33
|
+
error: { fill: "#c62734", glyph: "#ffffff", path: ae }
|
|
34
|
+
}, le = {
|
|
35
|
+
position: "absolute",
|
|
36
|
+
top: "calc(56px + env(safe-area-inset-top, 0px))",
|
|
37
|
+
left: "0",
|
|
38
|
+
right: "0",
|
|
39
|
+
margin: "0 auto",
|
|
40
|
+
width: "max-content",
|
|
41
|
+
maxWidth: "min(320px, calc(100% - 32px))",
|
|
42
|
+
boxSizing: "border-box",
|
|
43
|
+
display: "flex",
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
gap: "8px",
|
|
46
|
+
padding: "4px 16px 4px 4px",
|
|
47
|
+
// A full pill at one line; a long message wraps instead of being cut off.
|
|
48
|
+
borderRadius: "20px",
|
|
49
|
+
backgroundColor: "#ffffff",
|
|
50
|
+
color: "#1c1d22",
|
|
51
|
+
boxShadow: "0 4px 8px 0 #0000000a, 0 12px 32px 0 #0000001f",
|
|
52
|
+
fontFamily: "Inter, system-ui, -apple-system, sans-serif",
|
|
53
|
+
fontSize: "14px",
|
|
54
|
+
lineHeight: "20px",
|
|
55
|
+
fontWeight: "400",
|
|
56
|
+
overflowWrap: "anywhere"
|
|
57
|
+
}, de = {
|
|
58
|
+
display: "flex",
|
|
59
|
+
alignItems: "center",
|
|
60
|
+
justifyContent: "center",
|
|
61
|
+
flexShrink: "0",
|
|
62
|
+
width: "28px",
|
|
63
|
+
height: "28px",
|
|
64
|
+
margin: "2px",
|
|
65
|
+
borderRadius: "50%"
|
|
66
|
+
}, ce = {
|
|
67
|
+
position: "absolute",
|
|
68
|
+
width: "1px",
|
|
69
|
+
height: "1px",
|
|
70
|
+
margin: "-1px",
|
|
71
|
+
padding: "0",
|
|
72
|
+
border: "0",
|
|
73
|
+
overflow: "hidden",
|
|
74
|
+
clipPath: "inset(50%)",
|
|
75
|
+
whiteSpace: "nowrap"
|
|
76
|
+
};
|
|
77
|
+
function y(i, e) {
|
|
78
|
+
const t = document.createElement(i);
|
|
79
|
+
return Object.assign(t.style, e), t;
|
|
80
|
+
}
|
|
81
|
+
function ue(i, e) {
|
|
82
|
+
const t = y("div", {
|
|
83
|
+
position: "absolute",
|
|
84
|
+
inset: "0",
|
|
85
|
+
overflow: "hidden",
|
|
86
|
+
pointerEvents: "none",
|
|
87
|
+
zIndex: "1"
|
|
88
|
+
});
|
|
89
|
+
t.setAttribute("aria-hidden", "true"), i.appendChild(t);
|
|
90
|
+
const n = y("span", ce);
|
|
91
|
+
n.setAttribute("role", "status"), (e.querySelector('[role="dialog"]') ?? e).appendChild(n);
|
|
92
|
+
let r = null, o = null, s = null, a = null;
|
|
93
|
+
const m = () => {
|
|
94
|
+
o && clearTimeout(o), o = null, a?.(), a = null, r?.remove(), r = null, n.textContent = "";
|
|
95
|
+
}, u = (l) => {
|
|
96
|
+
const d = () => {
|
|
97
|
+
a = null, n.textContent = l;
|
|
98
|
+
};
|
|
99
|
+
if (typeof requestAnimationFrame == "function") {
|
|
100
|
+
const c = requestAnimationFrame(d);
|
|
101
|
+
a = () => cancelAnimationFrame(c);
|
|
102
|
+
} else {
|
|
103
|
+
const c = setTimeout(d, 0);
|
|
104
|
+
a = () => clearTimeout(c);
|
|
105
|
+
}
|
|
106
|
+
}, f = () => {
|
|
107
|
+
s = null;
|
|
108
|
+
const l = e.getBoundingClientRect(), d = Math.max(0, l.top - ie);
|
|
109
|
+
for (let c = 0; c < te; c++) {
|
|
110
|
+
const p = 4 + Math.random() * 6, g = y("span", {
|
|
111
|
+
position: "absolute",
|
|
112
|
+
left: `${l.left + Math.random() * l.width}px`,
|
|
113
|
+
top: `${d}px`,
|
|
114
|
+
width: `${p}px`,
|
|
115
|
+
height: `${p * (0.5 + Math.random())}px`,
|
|
116
|
+
borderRadius: c % 3 === 0 ? "50%" : "1px",
|
|
117
|
+
backgroundColor: O[c % O.length]
|
|
118
|
+
});
|
|
119
|
+
g.setAttribute("data-moment-confetti", ""), t.appendChild(g);
|
|
120
|
+
const h = d * (0.35 + Math.random() * 0.55), C = (Math.random() - 0.5) * 120, b = (Math.random() - 0.5) * 1080;
|
|
121
|
+
g.animate(
|
|
122
|
+
[
|
|
123
|
+
{ transform: "translate(0px, 0px) rotate(0deg)", opacity: 1 },
|
|
124
|
+
{ opacity: 1, offset: 0.6 },
|
|
125
|
+
{ transform: `translate(${C}px, ${-h}px) rotate(${b}deg)`, opacity: 0 }
|
|
126
|
+
],
|
|
127
|
+
{
|
|
128
|
+
duration: 1200 + Math.random() * 800,
|
|
129
|
+
delay: Math.random() * 150,
|
|
130
|
+
easing: "cubic-bezier(0.2, 0.6, 0.35, 1)",
|
|
131
|
+
fill: "both"
|
|
132
|
+
}
|
|
133
|
+
).onfinish = () => g.remove();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
celebrate() {
|
|
138
|
+
window.matchMedia?.("(prefers-reduced-motion: reduce)").matches || typeof t.animate != "function" || s || (s = setTimeout(f, ne));
|
|
139
|
+
},
|
|
140
|
+
toast(l, d = "success") {
|
|
141
|
+
m();
|
|
142
|
+
const c = _[Object.hasOwn(_, d) ? d : "success"], p = y("span", { ...de, backgroundColor: c.fill, color: c.glyph });
|
|
143
|
+
p.innerHTML = `<svg width="16" height="16" viewBox="0 0 256 256" fill="currentColor" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="${c.path}"/></svg>`;
|
|
144
|
+
const g = y("span", { minWidth: "0" });
|
|
145
|
+
g.textContent = l, r = y("div", le), r.setAttribute("data-moment-toast", ""), r.appendChild(p), r.appendChild(g), t.appendChild(r), u(l), o = setTimeout(m, ee);
|
|
146
|
+
},
|
|
147
|
+
destroy() {
|
|
148
|
+
s && clearTimeout(s), s = null, m(), t.remove(), n.remove();
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function N() {
|
|
31
153
|
if (typeof window > "u") return "";
|
|
32
154
|
const i = window.location.origin, e = i === "null" ? self.origin : i;
|
|
33
155
|
return e === "null" && console.error(
|
|
34
156
|
'[MomentSdk] This page has an opaque origin ("null"), so Moment Live cannot message it and calendar sync will not work. Serve the page over http(s), and give a sandboxed iframe allow-same-origin.'
|
|
35
157
|
), e;
|
|
36
158
|
}
|
|
37
|
-
function
|
|
159
|
+
function pe(i, e, t = N(), n) {
|
|
38
160
|
if (e.triggerType === "schedule") {
|
|
39
161
|
const o = new URLSearchParams();
|
|
40
|
-
return o.set("teamSlug", e.teamSlug), o.set("returnOrigin", t), o.set("embed", "1"), o.set("sdkVersion", "0.9.0-dev.
|
|
162
|
+
return o.set("teamSlug", e.teamSlug), o.set("returnOrigin", t), o.set("embed", "1"), o.set("sdkVersion", "0.9.0-dev.49"), n && (o.set("entry", "link"), n.campaignId && o.set("campaignId", n.campaignId)), `${i}/en/embed/schedule?${o.toString()}`;
|
|
41
163
|
}
|
|
42
164
|
const r = new URLSearchParams();
|
|
43
|
-
return r.set("teamSlug", e.teamSlug), e.momentSlug && r.set("momentSlug", e.momentSlug), e.listSlug && r.set("listSlug", e.listSlug), r.set("triggerType", e.triggerType), e.ids?.length && r.set("ids", e.ids.join(",")), e.playlistSlugs?.length && r.set("playlistSlugs", e.playlistSlugs.join(",")), e.calendar && r.set("calendar", e.calendar), e.apiSourceId && r.set("subscriptionId", e.apiSourceId), e.externalEventId && r.set("externalId", e.externalEventId), e.externalEventIdPrefix && !e.externalEventId && r.set("externalIdPrefix", e.externalEventIdPrefix), r.set("returnOrigin", t), r.set("embed", "1"), r.set("sdkVersion", "0.9.0-dev.
|
|
165
|
+
return r.set("teamSlug", e.teamSlug), e.momentSlug && r.set("momentSlug", e.momentSlug), e.listSlug && r.set("listSlug", e.listSlug), r.set("triggerType", e.triggerType), e.ids?.length && r.set("ids", e.ids.join(",")), e.playlistSlugs?.length && r.set("playlistSlugs", e.playlistSlugs.join(",")), e.calendar && r.set("calendar", e.calendar), e.apiSourceId && r.set("subscriptionId", e.apiSourceId), e.externalEventId && r.set("externalId", e.externalEventId), e.externalEventIdPrefix && !e.externalEventId && r.set("externalIdPrefix", e.externalEventIdPrefix), r.set("returnOrigin", t), r.set("embed", "1"), r.set("sdkVersion", "0.9.0-dev.49"), n && (r.set("entry", "link"), n.campaignId && r.set("campaignId", n.campaignId)), `${i}/en/embed/sync?${r.toString()}`;
|
|
44
166
|
}
|
|
45
|
-
const
|
|
46
|
-
class
|
|
167
|
+
const M = 500, R = 700, me = 500;
|
|
168
|
+
class he {
|
|
47
169
|
popup = null;
|
|
48
170
|
pollTimer = null;
|
|
49
171
|
messageHandler = null;
|
|
@@ -57,19 +179,19 @@ class Q {
|
|
|
57
179
|
*/
|
|
58
180
|
open(e) {
|
|
59
181
|
this.cleanup(), this.resultReceived = !1;
|
|
60
|
-
const t = this.buildPopupUrl(e),
|
|
182
|
+
const t = this.buildPopupUrl(e), n = Math.round(window.screenX + (window.outerWidth - M) / 2), r = Math.round(window.screenY + (window.outerHeight - R) / 2);
|
|
61
183
|
if (this.popup = window.open(
|
|
62
184
|
t,
|
|
63
185
|
"moment-oauth-popup",
|
|
64
|
-
`width=${
|
|
186
|
+
`width=${M},height=${R},left=${n},top=${r},menubar=no,toolbar=no,location=yes,status=no`
|
|
65
187
|
), !this.popup || this.popup.closed) {
|
|
66
188
|
this.sendStatusToIframe("popup-blocked"), this.opts.onPopupBlocked();
|
|
67
189
|
return;
|
|
68
190
|
}
|
|
69
191
|
this.sendStatusToIframe("popup-opened"), this.startPolling(), this.messageHandler = (o) => {
|
|
70
192
|
if (o.origin !== this.opts.liveOrigin || o.source !== this.popup) return;
|
|
71
|
-
const
|
|
72
|
-
!
|
|
193
|
+
const s = o.data;
|
|
194
|
+
!s || typeof s != "object" || s.source !== "moment-live-embed" || s.type !== "moment.embed.result" || (this.resultReceived = !0, this.sendStatusToIframe("completed"), this.opts.iframeWindow && this.opts.iframeWindow.postMessage(s, this.opts.liveOrigin), this.opts.onResult(s), this.cleanup());
|
|
73
195
|
}, window.addEventListener("message", this.messageHandler);
|
|
74
196
|
}
|
|
75
197
|
/**
|
|
@@ -84,13 +206,13 @@ class Q {
|
|
|
84
206
|
this.popup = null;
|
|
85
207
|
}
|
|
86
208
|
buildPopupUrl(e) {
|
|
87
|
-
const t =
|
|
209
|
+
const t = ge(e, N());
|
|
88
210
|
return this.opts.campaignId && t.set("campaignId", this.opts.campaignId), `${this.opts.liveBaseUrl}/en/embed/oauth-popup?${t.toString()}`;
|
|
89
211
|
}
|
|
90
212
|
startPolling() {
|
|
91
213
|
this.pollTimer = setInterval(() => {
|
|
92
214
|
(!this.popup || this.popup.closed) && (this.pollTimer && (clearInterval(this.pollTimer), this.pollTimer = null), this.resultReceived || (this.sendStatusToIframe("popup-closed"), this.opts.onPopupClosed()), this.cleanup());
|
|
93
|
-
},
|
|
215
|
+
}, me);
|
|
94
216
|
}
|
|
95
217
|
sendStatusToIframe(e) {
|
|
96
218
|
if (!this.opts.iframeWindow) return;
|
|
@@ -102,7 +224,7 @@ class Q {
|
|
|
102
224
|
this.opts.iframeWindow.postMessage(t, this.opts.liveOrigin);
|
|
103
225
|
}
|
|
104
226
|
}
|
|
105
|
-
function
|
|
227
|
+
function ge(i, e) {
|
|
106
228
|
const t = new URLSearchParams({
|
|
107
229
|
provider: i.provider,
|
|
108
230
|
teamSlug: i.teamSlug,
|
|
@@ -111,16 +233,16 @@ function ee(i, e) {
|
|
|
111
233
|
returnOrigin: e
|
|
112
234
|
});
|
|
113
235
|
i.subscriptionType && t.set("subscriptionType", i.subscriptionType);
|
|
114
|
-
const
|
|
236
|
+
const n = {
|
|
115
237
|
scheduleMomentIds: i.scheduleMomentIds,
|
|
116
238
|
schedulePlaylistIds: i.schedulePlaylistIds,
|
|
117
239
|
scheduleListIds: i.scheduleListIds
|
|
118
240
|
};
|
|
119
|
-
for (const [r, o] of Object.entries(
|
|
241
|
+
for (const [r, o] of Object.entries(n))
|
|
120
242
|
o?.length && t.set(r, o.join(","));
|
|
121
243
|
return i.addons?.length && t.set("addons", i.addons.join(",")), t;
|
|
122
244
|
}
|
|
123
|
-
const
|
|
245
|
+
const k = "moment-sdk-styles", U = "moment-sdk-close", $ = "moment-sdk-tray", fe = `
|
|
124
246
|
:where(.moment-sync-trigger) {
|
|
125
247
|
background-color: #1c1917;
|
|
126
248
|
color: #ffffff;
|
|
@@ -145,7 +267,7 @@ const _ = "moment-sdk-styles", F = "moment-sdk-close", U = "moment-sdk-tray", te
|
|
|
145
267
|
outline-offset: 2px;
|
|
146
268
|
}
|
|
147
269
|
|
|
148
|
-
.${
|
|
270
|
+
.${U}:focus-visible {
|
|
149
271
|
outline: 2px solid #ffffff;
|
|
150
272
|
outline-offset: 0;
|
|
151
273
|
box-shadow: 0 0 0 4px #121316;
|
|
@@ -157,40 +279,40 @@ const _ = "moment-sdk-styles", F = "moment-sdk-close", U = "moment-sdk-tray", te
|
|
|
157
279
|
}
|
|
158
280
|
|
|
159
281
|
@media (prefers-reduced-motion: no-preference) {
|
|
160
|
-
.${
|
|
282
|
+
.${$} {
|
|
161
283
|
animation: moment-sdk-tray-in 0.35s cubic-bezier(0.32, 0.72, 0, 1);
|
|
162
284
|
}
|
|
163
285
|
}
|
|
164
286
|
`;
|
|
165
|
-
function
|
|
166
|
-
if (typeof document > "u" || document.getElementById(
|
|
287
|
+
function Ce() {
|
|
288
|
+
if (typeof document > "u" || document.getElementById(k)) return;
|
|
167
289
|
const i = document.createElement("style");
|
|
168
|
-
i.id =
|
|
290
|
+
i.id = k, i.textContent = fe, document.head.appendChild(i);
|
|
169
291
|
}
|
|
170
|
-
function
|
|
292
|
+
function be(i) {
|
|
171
293
|
return typeof i == "string" && i.startsWith("webcal://");
|
|
172
294
|
}
|
|
173
|
-
function
|
|
295
|
+
function ye(i) {
|
|
174
296
|
return !i || i.closed ? "blocked" : "opened";
|
|
175
297
|
}
|
|
176
|
-
const
|
|
177
|
-
backgroundColor:
|
|
298
|
+
const ve = 1024, w = 600, xe = 400, Ae = 40, H = 80, P = 90, we = 420, Te = 520, B = 48, j = "#0d0d0d", v = "#121316", Se = {
|
|
299
|
+
backgroundColor: j,
|
|
178
300
|
boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.25)",
|
|
179
301
|
backdropFilter: "none",
|
|
180
302
|
webkitBackdropFilter: "none"
|
|
181
|
-
},
|
|
303
|
+
}, W = "inset 0 0.5px 0.75px rgb(255 255 255 / 0.6)", Ee = "inset 0 -0.5px 0.75px rgb(255 255 255 / 0.3)", G = [
|
|
182
304
|
"0 0 0 0.5px #9c9c9c",
|
|
183
305
|
"0 4px 8px 0 #0000001f",
|
|
184
306
|
"0 12px 32px 0 #00000047"
|
|
185
|
-
],
|
|
307
|
+
], z = {
|
|
186
308
|
backgroundColor: "rgb(19 19 19 / 0.812)",
|
|
187
309
|
backdropFilter: "blur(14px)",
|
|
188
310
|
webkitBackdropFilter: "blur(14px)",
|
|
189
|
-
boxShadow: [
|
|
190
|
-
},
|
|
191
|
-
|
|
192
|
-
boxShadow: [
|
|
193
|
-
},
|
|
311
|
+
boxShadow: [W, Ee, ...G].join(", ")
|
|
312
|
+
}, Le = {
|
|
313
|
+
...z,
|
|
314
|
+
boxShadow: [W, ...G].join(", ")
|
|
315
|
+
}, T = 32, x = 12, Ie = "2147483647", Oe = 'button, [href], input, select, textarea, iframe, [tabindex]:not([tabindex="-1"])', Z = "#38393B", _e = "#4B4B4E", Me = {
|
|
194
316
|
position: "absolute",
|
|
195
317
|
top: "16px",
|
|
196
318
|
right: "16px",
|
|
@@ -200,23 +322,23 @@ const re = 1024, w = 600, oe = 400, ae = 40, M = 80, R = 90, le = 420, de = 520,
|
|
|
200
322
|
padding: "0",
|
|
201
323
|
border: "none",
|
|
202
324
|
borderRadius: "50%",
|
|
203
|
-
backgroundColor:
|
|
325
|
+
backgroundColor: Z,
|
|
204
326
|
color: "#F5F5F5",
|
|
205
327
|
cursor: "pointer",
|
|
206
328
|
display: "flex",
|
|
207
329
|
alignItems: "center",
|
|
208
330
|
justifyContent: "center"
|
|
209
331
|
};
|
|
210
|
-
function
|
|
211
|
-
const
|
|
212
|
-
showFooter: !
|
|
213
|
-
material:
|
|
214
|
-
wrapperMaterial:
|
|
215
|
-
card: { backgroundColor:
|
|
216
|
-
iframe:
|
|
217
|
-
},
|
|
332
|
+
function Re(i, e, t = x, n = "v1", r = 0, o = v) {
|
|
333
|
+
const s = n === "v2", a = i < ve, u = {
|
|
334
|
+
showFooter: !s,
|
|
335
|
+
material: s ? "glass" : "solid",
|
|
336
|
+
wrapperMaterial: s ? a ? Le : z : Se,
|
|
337
|
+
card: { backgroundColor: s ? "transparent" : o },
|
|
338
|
+
iframe: s ? { background: "transparent", colorScheme: "dark" } : { background: "", colorScheme: "" }
|
|
339
|
+
}, f = s ? "rgba(0, 0, 0, 0.4)" : "rgba(0, 0, 0, 0.5)", l = s ? x : t, d = `${l}px ${l}px 0px 0px`;
|
|
218
340
|
if (a) {
|
|
219
|
-
const
|
|
341
|
+
const p = s ? e - B - r : Math.floor(e * P / 100) - T;
|
|
220
342
|
return {
|
|
221
343
|
isTray: !0,
|
|
222
344
|
// No blur: iPhone Safari tints its status bar and toolbar from the page, and over a blurred
|
|
@@ -225,64 +347,65 @@ function Ce(i, e, t = x, s = "v1", r = 0, o = v) {
|
|
|
225
347
|
alignItems: "flex-end",
|
|
226
348
|
padding: "0",
|
|
227
349
|
backdropFilter: "none",
|
|
228
|
-
backgroundColor:
|
|
350
|
+
backgroundColor: f
|
|
229
351
|
},
|
|
230
352
|
wrapper: {
|
|
231
353
|
// The modal's width: at full width on a tablet the embed's pills and rows stretched. Only
|
|
232
354
|
// once that leaves 40px each side: at 600–679px it left a sliver of the page down each side.
|
|
233
|
-
maxWidth: i < w + 2 *
|
|
355
|
+
maxWidth: i < w + 2 * Ae ? "none" : `${w}px`,
|
|
234
356
|
minWidth: "0",
|
|
235
|
-
borderRadius:
|
|
357
|
+
borderRadius: d,
|
|
236
358
|
paddingBottom: "env(safe-area-inset-bottom, 0px)"
|
|
237
359
|
},
|
|
238
360
|
container: {
|
|
239
361
|
// ponytail: no vh fallback for browsers without dvh (Safari < 15.4); the iframe cap still
|
|
240
362
|
// holds there.
|
|
241
|
-
maxHeight:
|
|
242
|
-
borderRadius:
|
|
363
|
+
maxHeight: s ? `calc(100dvh - ${B}px - env(safe-area-inset-bottom, 0px))` : `calc(${P}dvh - ${T}px)`,
|
|
364
|
+
borderRadius: d
|
|
243
365
|
},
|
|
244
|
-
iframeMaxHeight:
|
|
245
|
-
iframeOpeningHeight: Math.min(
|
|
246
|
-
...
|
|
366
|
+
iframeMaxHeight: p,
|
|
367
|
+
iframeOpeningHeight: Math.min(we, p),
|
|
368
|
+
...u
|
|
247
369
|
};
|
|
248
370
|
}
|
|
249
|
-
const
|
|
371
|
+
const c = e - H;
|
|
250
372
|
return {
|
|
251
373
|
isTray: !1,
|
|
252
374
|
overlay: {
|
|
253
375
|
alignItems: "center",
|
|
254
376
|
padding: "16px",
|
|
255
|
-
|
|
256
|
-
|
|
377
|
+
// Roman (Q1): under v2 the page behind stays sharp; only the dim layer covers it.
|
|
378
|
+
backdropFilter: s ? "none" : "blur(2px)",
|
|
379
|
+
backgroundColor: f
|
|
257
380
|
},
|
|
258
381
|
wrapper: {
|
|
259
382
|
maxWidth: `${w}px`,
|
|
260
|
-
minWidth: `${
|
|
261
|
-
borderRadius: `${
|
|
383
|
+
minWidth: `${xe}px`,
|
|
384
|
+
borderRadius: `${l}px`,
|
|
262
385
|
paddingBottom: "0"
|
|
263
386
|
},
|
|
264
387
|
container: {
|
|
265
|
-
maxHeight: `calc(100vh - ${
|
|
266
|
-
borderRadius:
|
|
388
|
+
maxHeight: `calc(100vh - ${H}px)`,
|
|
389
|
+
borderRadius: d
|
|
267
390
|
},
|
|
268
|
-
iframeMaxHeight:
|
|
269
|
-
iframeOpeningHeight: Math.min(
|
|
270
|
-
...
|
|
391
|
+
iframeMaxHeight: c,
|
|
392
|
+
iframeOpeningHeight: Math.min(Te, c),
|
|
393
|
+
...u
|
|
271
394
|
};
|
|
272
395
|
}
|
|
273
|
-
function
|
|
396
|
+
function F(i, e) {
|
|
274
397
|
return Math.min(i, e);
|
|
275
398
|
}
|
|
276
|
-
function
|
|
399
|
+
function ke(i) {
|
|
277
400
|
return i.triggerType !== "schedule" && i.keepOpen !== !0;
|
|
278
401
|
}
|
|
279
|
-
const
|
|
280
|
-
function
|
|
402
|
+
const He = 32;
|
|
403
|
+
function Pe(i) {
|
|
281
404
|
const e = { hideCloseButton: i.closeControl === "embed" };
|
|
282
|
-
return typeof i.borderRadius == "number" && Number.isFinite(i.borderRadius) && (e.cardRadius = Math.max(0, Math.min(i.borderRadius,
|
|
405
|
+
return typeof i.borderRadius == "number" && Number.isFinite(i.borderRadius) && (e.cardRadius = Math.max(0, Math.min(i.borderRadius, He))), typeof i.surface == "string" && i.surface !== "" && (e.surface = i.surface), (i.design === "v1" || i.design === "v2") && (e.design = i.design), e;
|
|
283
406
|
}
|
|
284
|
-
const
|
|
285
|
-
class
|
|
407
|
+
const Be = ".moment-sync-trigger", Fe = 6, D = 60, De = "rgba(255, 255, 255, 0.216)", Ne = "https://live.dev.momentco.ai";
|
|
408
|
+
class Ue {
|
|
286
409
|
opts;
|
|
287
410
|
liveBaseUrl;
|
|
288
411
|
liveOrigin;
|
|
@@ -315,17 +438,21 @@ class Ae {
|
|
|
315
438
|
footer = null;
|
|
316
439
|
hairline = null;
|
|
317
440
|
viewportResizeHandler = null;
|
|
441
|
+
/** Confetti and toasts over the page, for the open sheet. */
|
|
442
|
+
feedback = null;
|
|
443
|
+
/** Set by a `keepOpen` (not `schedule`) result, which reports the close, so the sheet's close doesn't. */
|
|
444
|
+
closeReported = !1;
|
|
318
445
|
constructor(e) {
|
|
319
446
|
this.opts = {
|
|
320
|
-
triggerSelector:
|
|
447
|
+
triggerSelector: Be,
|
|
321
448
|
...e
|
|
322
|
-
}, this.liveBaseUrl =
|
|
449
|
+
}, this.liveBaseUrl = Ne;
|
|
323
450
|
try {
|
|
324
451
|
this.liveOrigin = new URL(this.liveBaseUrl).origin;
|
|
325
452
|
} catch {
|
|
326
453
|
throw new Error(`[MomentSdk] Invalid VITE_LIVE_BASE_URL: "${this.liveBaseUrl}"`);
|
|
327
454
|
}
|
|
328
|
-
|
|
455
|
+
Ce(), this.bindTriggers(), this.emitAnalytics("embed.init"), this.opts.autoOpen && this.autoOpenFromUrl(this.opts.autoOpen.teamSlug);
|
|
329
456
|
}
|
|
330
457
|
/**
|
|
331
458
|
* Programmatically open the sync modal.
|
|
@@ -357,31 +484,31 @@ class Ae {
|
|
|
357
484
|
e.externalEventId && e.externalEventIdPrefix && console.warn(
|
|
358
485
|
"[MomentSdk] Both externalEventId and externalEventIdPrefix provided; using externalEventId only."
|
|
359
486
|
);
|
|
360
|
-
const
|
|
487
|
+
const n = this.scopeOpenPayload(e);
|
|
361
488
|
this.emitAnalytics("embed.open", {
|
|
362
|
-
teamSlug:
|
|
363
|
-
triggerType:
|
|
489
|
+
teamSlug: n.teamSlug,
|
|
490
|
+
triggerType: n.triggerType,
|
|
364
491
|
...t ? { triggerSource: "url" } : {}
|
|
365
|
-
}), this.createModal(
|
|
492
|
+
}), this.createModal(n, t);
|
|
366
493
|
}
|
|
367
494
|
/**
|
|
368
495
|
* Open the sheet from the page URL's `moment_sync`, once per page load, then drop the link's
|
|
369
496
|
* params from the address bar so a reload doesn't reopen it.
|
|
370
497
|
*/
|
|
371
498
|
autoOpenFromUrl(e) {
|
|
372
|
-
if (!
|
|
373
|
-
const t =
|
|
374
|
-
t &&
|
|
499
|
+
if (!q()) return;
|
|
500
|
+
const t = Y(window.location.href, e);
|
|
501
|
+
t && X(document, () => {
|
|
375
502
|
this.openWith(t.payload, t), history.replaceState(history.state, "", t.cleanUrl);
|
|
376
503
|
});
|
|
377
504
|
}
|
|
378
505
|
// ── Private: trigger binding ──────────────────────────────────────
|
|
379
506
|
bindTriggers() {
|
|
380
507
|
document.querySelectorAll(this.opts.triggerSelector).forEach((t) => {
|
|
381
|
-
const
|
|
508
|
+
const n = (o) => {
|
|
382
509
|
o.preventDefault(), this.handleTriggerClick(t);
|
|
383
510
|
}, r = this.boundClickHandlers.get(t);
|
|
384
|
-
r && t.removeEventListener("click", r), t.addEventListener("click",
|
|
511
|
+
r && t.removeEventListener("click", r), t.addEventListener("click", n), this.boundClickHandlers.set(t, n);
|
|
385
512
|
});
|
|
386
513
|
}
|
|
387
514
|
unbindTriggers() {
|
|
@@ -390,38 +517,38 @@ class Ae {
|
|
|
390
517
|
}), this.boundClickHandlers.clear();
|
|
391
518
|
}
|
|
392
519
|
handleTriggerClick(e) {
|
|
393
|
-
const t = e.getAttribute("data-moment-team-slug") ?? "",
|
|
394
|
-
let
|
|
395
|
-
o != null && o !== "" && (o === "moment" || o === "list" || o === "team" || o === "brand-playlist" || o === "playlist" || o === "schedule" ?
|
|
520
|
+
const t = e.getAttribute("data-moment-team-slug") ?? "", n = e.getAttribute("data-moment-slug") ?? void 0, r = e.getAttribute("data-moment-list-slug") ?? void 0, o = e.getAttribute("data-moment-trigger-type");
|
|
521
|
+
let s = "moment";
|
|
522
|
+
o != null && o !== "" && (o === "moment" || o === "list" || o === "team" || o === "brand-playlist" || o === "playlist" || o === "schedule" ? s = o : console.warn(
|
|
396
523
|
"[MomentSdk] Invalid data-moment-trigger-type, falling back to 'moment':",
|
|
397
524
|
o
|
|
398
525
|
));
|
|
399
|
-
const a = e.getAttribute("data-moment-ids") ?? e.getAttribute("data-moment-game-id") ?? "",
|
|
400
|
-
let
|
|
401
|
-
l != null && l !== "" && (l === "google" || l === "outlook" ?
|
|
402
|
-
const
|
|
403
|
-
if (
|
|
526
|
+
const a = e.getAttribute("data-moment-ids") ?? e.getAttribute("data-moment-game-id") ?? "", m = a ? a.split(",").filter(Boolean) : [], u = e.getAttribute("data-moment-playlist-slugs") ?? "", f = u ? u.split(",").map((C) => C.trim()).filter(Boolean) : [], l = e.getAttribute("data-moment-calendar");
|
|
527
|
+
let d;
|
|
528
|
+
l != null && l !== "" && (l === "google" || l === "outlook" ? d = l : console.warn("[MomentSdk] Invalid data-moment-calendar, ignoring value:", l));
|
|
529
|
+
const c = e.getAttribute("data-api-source-id") ?? void 0, p = e.getAttribute("data-external-event-id") ?? void 0, g = e.getAttribute("data-external-event-id-prefix") ?? void 0;
|
|
530
|
+
if (p && g && console.warn(
|
|
404
531
|
"[MomentSdk] Both data-external-event-id and data-external-event-id-prefix are set; using data-external-event-id only."
|
|
405
532
|
), !t) {
|
|
406
533
|
console.warn("[MomentSdk] Missing data-moment-team-slug on trigger element");
|
|
407
534
|
return;
|
|
408
535
|
}
|
|
409
|
-
const
|
|
536
|
+
const h = s === "team" || s === "brand-playlist" || s === "playlist" || s === "schedule";
|
|
410
537
|
this.emitAnalytics("embed.trigger.click", {
|
|
411
538
|
teamSlug: t,
|
|
412
|
-
triggerType:
|
|
413
|
-
momentIds:
|
|
539
|
+
triggerType: s,
|
|
540
|
+
momentIds: h ? [] : m
|
|
414
541
|
}), this.open({
|
|
415
542
|
teamSlug: t,
|
|
416
|
-
momentSlug:
|
|
543
|
+
momentSlug: n,
|
|
417
544
|
listSlug: r,
|
|
418
|
-
triggerType:
|
|
419
|
-
ids:
|
|
420
|
-
playlistSlugs:
|
|
421
|
-
calendar:
|
|
422
|
-
apiSourceId:
|
|
423
|
-
externalEventId:
|
|
424
|
-
externalEventIdPrefix:
|
|
545
|
+
triggerType: s,
|
|
546
|
+
ids: m,
|
|
547
|
+
playlistSlugs: f,
|
|
548
|
+
calendar: d ?? void 0,
|
|
549
|
+
apiSourceId: c,
|
|
550
|
+
externalEventId: g && !p ? void 0 : p,
|
|
551
|
+
externalEventIdPrefix: p ? void 0 : g
|
|
425
552
|
});
|
|
426
553
|
}
|
|
427
554
|
/** Drop moment/list/source scoping for brand-level subscription triggers. */
|
|
@@ -443,19 +570,19 @@ class Ae {
|
|
|
443
570
|
// ── Private: modal creation ───────────────────────────────────────
|
|
444
571
|
createModal(e, t) {
|
|
445
572
|
this.cleanup(), this.previousFocusedElement = document.activeElement || null, this.activePayload = e, this.activeCampaignId = t?.campaignId;
|
|
446
|
-
const
|
|
573
|
+
const n = this.buildIframeUrl(e, t);
|
|
447
574
|
this.overlay = document.createElement("div"), this.overlay.setAttribute("role", "presentation"), Object.assign(this.overlay.style, {
|
|
448
575
|
position: "fixed",
|
|
449
576
|
inset: "0",
|
|
450
|
-
zIndex:
|
|
577
|
+
zIndex: Ie,
|
|
451
578
|
display: "flex",
|
|
452
579
|
justifyContent: "center"
|
|
453
580
|
// backgroundColor comes from the layout: 50%, or 40% for a v2 sheet.
|
|
454
|
-
}), this.overlay.addEventListener("click", (
|
|
455
|
-
|
|
581
|
+
}), this.overlay.addEventListener("click", (h) => {
|
|
582
|
+
h.target === this.overlay && this.handleCancel();
|
|
456
583
|
});
|
|
457
|
-
const r = (
|
|
458
|
-
|
|
584
|
+
const r = (h) => {
|
|
585
|
+
h.key === "Escape" && this.handleCancel();
|
|
459
586
|
};
|
|
460
587
|
document.addEventListener("keydown", r);
|
|
461
588
|
const o = document.createElement("div");
|
|
@@ -467,13 +594,13 @@ class Ae {
|
|
|
467
594
|
// smoothly instead of snapping.
|
|
468
595
|
transition: "border-radius 0.3s ease",
|
|
469
596
|
overflow: "hidden",
|
|
470
|
-
backgroundColor:
|
|
597
|
+
backgroundColor: j,
|
|
471
598
|
boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.25)",
|
|
472
599
|
display: "flex",
|
|
473
600
|
flexDirection: "column"
|
|
474
601
|
});
|
|
475
|
-
const
|
|
476
|
-
|
|
602
|
+
const s = document.createElement("div");
|
|
603
|
+
s.setAttribute("role", "dialog"), s.setAttribute("aria-modal", "true"), s.setAttribute("aria-label", "Calendar sync modal"), s.tabIndex = -1, Object.assign(s.style, {
|
|
477
604
|
position: "relative",
|
|
478
605
|
width: "100%",
|
|
479
606
|
transition: "border-radius 0.3s ease",
|
|
@@ -489,13 +616,13 @@ class Ae {
|
|
|
489
616
|
outline: "none"
|
|
490
617
|
});
|
|
491
618
|
const a = document.createElement("button");
|
|
492
|
-
a.type = "button", a.className =
|
|
493
|
-
a.style.backgroundColor =
|
|
619
|
+
a.type = "button", a.className = U, a.innerHTML = '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M18.75 5.25 5.25 18.75M5.25 5.25l13.5 13.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>', a.setAttribute("aria-label", "Close"), Object.assign(a.style, Me), a.addEventListener("mouseenter", () => {
|
|
620
|
+
a.style.backgroundColor = _e;
|
|
494
621
|
}), a.addEventListener("mouseleave", () => {
|
|
495
|
-
a.style.backgroundColor =
|
|
622
|
+
a.style.backgroundColor = Z;
|
|
496
623
|
}), a.addEventListener("click", () => this.handleCancel());
|
|
497
|
-
const
|
|
498
|
-
this.iframe = document.createElement("iframe"), this.iframe.src =
|
|
624
|
+
const m = e.triggerType !== "schedule";
|
|
625
|
+
this.iframe = document.createElement("iframe"), this.iframe.src = n, this.iframe.setAttribute("allow", "web-share; clipboard-write"), this.iframe.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups allow-forms"), this.iframe.setAttribute("scrolling", "no"), Object.assign(this.iframe.style, {
|
|
499
626
|
width: "100%",
|
|
500
627
|
border: "none",
|
|
501
628
|
display: "block",
|
|
@@ -504,14 +631,14 @@ class Ae {
|
|
|
504
631
|
// guess to the embed's real content height. Eased and a little slower so
|
|
505
632
|
// that reads as the sheet settling rather than a snap.
|
|
506
633
|
transition: "height 0.25s cubic-bezier(0.32, 0.72, 0, 1)"
|
|
507
|
-
}),
|
|
508
|
-
const
|
|
509
|
-
this.footer =
|
|
634
|
+
}), m && (s.appendChild(a), this.closeButton = a), s.appendChild(this.iframe);
|
|
635
|
+
const u = document.createElement("div");
|
|
636
|
+
this.footer = u, Object.assign(u.style, {
|
|
510
637
|
display: "flex",
|
|
511
638
|
alignItems: "center",
|
|
512
639
|
justifyContent: "center",
|
|
513
|
-
gap: `${
|
|
514
|
-
height: `${
|
|
640
|
+
gap: `${Fe}px`,
|
|
641
|
+
height: `${T}px`,
|
|
515
642
|
// The wrapper is a flex column, so without this the tray would be the
|
|
516
643
|
// first thing squeezed when the card hits its max height.
|
|
517
644
|
flexShrink: "0",
|
|
@@ -519,44 +646,44 @@ class Ae {
|
|
|
519
646
|
boxSizing: "border-box",
|
|
520
647
|
padding: "0"
|
|
521
648
|
});
|
|
522
|
-
const
|
|
523
|
-
|
|
649
|
+
const f = document.createElement("span");
|
|
650
|
+
f.textContent = "Powered by", Object.assign(f.style, {
|
|
524
651
|
fontFamily: "Inter, system-ui, -apple-system, sans-serif",
|
|
525
652
|
fontSize: "12px",
|
|
526
653
|
lineHeight: "16px",
|
|
527
654
|
color: "#ffffff"
|
|
528
655
|
});
|
|
529
656
|
const l = document.createElement("img");
|
|
530
|
-
l.alt = "Moment", l.src =
|
|
657
|
+
l.alt = "Moment", l.src = J, Object.assign(l.style, {
|
|
531
658
|
display: "block",
|
|
532
659
|
// Both dimensions are explicit so the tray has no reflow to do, even if
|
|
533
660
|
// the image is ever swapped for one that has to decode.
|
|
534
|
-
width: `${
|
|
535
|
-
height: `${(
|
|
536
|
-
}),
|
|
537
|
-
const
|
|
538
|
-
this.hairline =
|
|
661
|
+
width: `${D}px`,
|
|
662
|
+
height: `${(D / Q).toFixed(2)}px`
|
|
663
|
+
}), u.appendChild(f), u.appendChild(l), this.wrapper = o, this.container = s, this.applyFrameLayout();
|
|
664
|
+
const d = document.createElement("div");
|
|
665
|
+
this.hairline = d, d.setAttribute("aria-hidden", "true"), Object.assign(d.style, {
|
|
539
666
|
position: "absolute",
|
|
540
667
|
inset: "0",
|
|
541
668
|
borderRadius: "inherit",
|
|
542
|
-
boxShadow: `inset 0 0 0 1px ${
|
|
669
|
+
boxShadow: `inset 0 0 0 1px ${De}`,
|
|
543
670
|
pointerEvents: "none",
|
|
544
671
|
zIndex: "2"
|
|
545
|
-
}), o.appendChild(
|
|
546
|
-
const
|
|
547
|
-
if (
|
|
548
|
-
const
|
|
549
|
-
|
|
672
|
+
}), o.appendChild(s), o.appendChild(u), o.appendChild(d), this.overlay.appendChild(o), this.feedback = ue(this.overlay, o), document.body.appendChild(this.overlay), this.viewportResizeHandler = () => this.applyFrameLayout(), window.addEventListener("resize", this.viewportResizeHandler);
|
|
673
|
+
const c = () => s.querySelectorAll(Oe), p = (h) => {
|
|
674
|
+
if (h.key !== "Tab") return;
|
|
675
|
+
const C = c(), b = C[0], S = C[C.length - 1], A = document.activeElement;
|
|
676
|
+
h.shiftKey && (A === b || A === s) ? (h.preventDefault(), S.focus()) : !h.shiftKey && A === S && (h.preventDefault(), b.focus());
|
|
550
677
|
};
|
|
551
|
-
|
|
552
|
-
const
|
|
553
|
-
const
|
|
554
|
-
return
|
|
555
|
-
const b =
|
|
556
|
-
b[
|
|
557
|
-
}),
|
|
678
|
+
s.addEventListener("keydown", p);
|
|
679
|
+
const g = (h) => {
|
|
680
|
+
const C = document.createElement("span");
|
|
681
|
+
return C.tabIndex = 0, Object.assign(C.style, { position: "fixed", opacity: "0" }), C.addEventListener("focus", () => {
|
|
682
|
+
const b = c();
|
|
683
|
+
b[h === "first" ? 0 : b.length - 1].focus();
|
|
684
|
+
}), C;
|
|
558
685
|
};
|
|
559
|
-
|
|
686
|
+
s.before(g("last")), s.after(g("first")), s.focus(), this.previousBodyOverflow = document.body.style.overflow, document.body.style.overflow = "hidden", this.didManageBodyOverflow = !0, this.setupMessageListener(), this.overlay._escHandler = r, this.overlay._focusTrapHandler = p;
|
|
560
687
|
}
|
|
561
688
|
/**
|
|
562
689
|
* Size the frame for the current viewport: the one routine for open, window resize and a theme
|
|
@@ -566,9 +693,9 @@ class Ae {
|
|
|
566
693
|
if (!this.overlay || !this.wrapper || !this.container || !this.iframe) return;
|
|
567
694
|
Object.assign(this.wrapper.style, this.currentLayout().wrapper);
|
|
568
695
|
const e = this.currentLayout();
|
|
569
|
-
Object.assign(this.overlay.style, e.overlay), Object.assign(this.wrapper.style, e.wrapperMaterial), Object.assign(this.container.style, e.container), Object.assign(this.container.style, e.card), Object.assign(this.iframe.style, e.iframe), this.footer && (this.footer.style.display = e.showFooter ? "flex" : "none"), this.hairline && (this.hairline.style.display = e.material === "glass" ? "none" : ""), this.wrapper.classList.toggle(
|
|
570
|
-
const t = Number.parseFloat(this.iframe.style.height),
|
|
571
|
-
this.iframe.style.height = `${
|
|
696
|
+
Object.assign(this.overlay.style, e.overlay), Object.assign(this.wrapper.style, e.wrapperMaterial), Object.assign(this.container.style, e.container), Object.assign(this.container.style, e.card), Object.assign(this.iframe.style, e.iframe), this.footer && (this.footer.style.display = e.showFooter ? "flex" : "none"), this.hairline && (this.hairline.style.display = e.material === "glass" ? "none" : ""), this.wrapper.classList.toggle($, e.isTray);
|
|
697
|
+
const t = Number.parseFloat(this.iframe.style.height), n = this.lastRequestedHeight !== null ? F(this.lastRequestedHeight, e.iframeMaxHeight) : Number.isNaN(t) ? e.iframeOpeningHeight : Math.min(t, e.iframeMaxHeight);
|
|
698
|
+
this.iframe.style.height = `${n}px`;
|
|
572
699
|
}
|
|
573
700
|
/**
|
|
574
701
|
* The frame for the current viewport, design, radius and card colour. The bottom inset is the
|
|
@@ -576,7 +703,7 @@ class Ae {
|
|
|
576
703
|
*/
|
|
577
704
|
currentLayout() {
|
|
578
705
|
const e = this.wrapper && Number.parseFloat(getComputedStyle(this.wrapper).paddingBottom) || 0;
|
|
579
|
-
return
|
|
706
|
+
return Re(
|
|
580
707
|
window.innerWidth,
|
|
581
708
|
window.innerHeight,
|
|
582
709
|
this.cardRadius,
|
|
@@ -586,7 +713,7 @@ class Ae {
|
|
|
586
713
|
);
|
|
587
714
|
}
|
|
588
715
|
buildIframeUrl(e, t) {
|
|
589
|
-
return
|
|
716
|
+
return pe(this.liveBaseUrl, e, void 0, t);
|
|
590
717
|
}
|
|
591
718
|
// ── Private: message handling ─────────────────────────────────────
|
|
592
719
|
setupMessageListener() {
|
|
@@ -595,49 +722,58 @@ class Ae {
|
|
|
595
722
|
const t = e.data;
|
|
596
723
|
if (!(!t || typeof t != "object")) {
|
|
597
724
|
if (t.source === "moment-live-embed" && t.type === "moment.embed.oauth.start") {
|
|
598
|
-
const
|
|
725
|
+
const n = t;
|
|
599
726
|
this.emitAnalytics("oauth.start", {
|
|
600
|
-
provider:
|
|
601
|
-
teamSlug:
|
|
602
|
-
}), this.handleOAuthStart(
|
|
727
|
+
provider: n.provider,
|
|
728
|
+
teamSlug: n.teamSlug
|
|
729
|
+
}), this.handleOAuthStart(n);
|
|
603
730
|
return;
|
|
604
731
|
}
|
|
605
732
|
if (t.source === "moment-live-embed" && t.type === "moment.embed.resize") {
|
|
606
|
-
const
|
|
607
|
-
if (
|
|
608
|
-
this.lastRequestedHeight =
|
|
733
|
+
const n = typeof t.height == "number" ? t.height : 0;
|
|
734
|
+
if (n > 0 && this.iframe) {
|
|
735
|
+
this.lastRequestedHeight = n;
|
|
609
736
|
const { iframeMaxHeight: r } = this.currentLayout();
|
|
610
|
-
this.iframe.style.height = `${
|
|
737
|
+
this.iframe.style.height = `${F(n, r)}px`;
|
|
611
738
|
}
|
|
612
739
|
return;
|
|
613
740
|
}
|
|
614
741
|
if (t.source === "moment-live-embed" && t.type === "moment.embed.theme") {
|
|
615
|
-
const
|
|
616
|
-
|
|
742
|
+
const n = Pe(t);
|
|
743
|
+
n.design && n.design !== this.design && (this.design = n.design, this.applyFrameLayout()), n.cardRadius !== void 0 && (this.cardRadius = n.cardRadius, this.applyFrameLayout()), n.hideCloseButton && this.closeButton && (document.activeElement === this.closeButton && this.container?.focus(), this.closeButton.remove()), n.surface !== void 0 && (this.surface = n.surface, this.applyFrameLayout());
|
|
617
744
|
return;
|
|
618
745
|
}
|
|
619
746
|
if (t.source === "moment-live-embed" && t.type === "moment.embed.open.url") {
|
|
620
|
-
const { url:
|
|
621
|
-
if (
|
|
622
|
-
const r =
|
|
623
|
-
r === "blocked" && this.emitAnalytics("open.url.blocked", {}), this.sendOpenUrlStatus(r,
|
|
747
|
+
const { url: n } = t;
|
|
748
|
+
if (be(n)) {
|
|
749
|
+
const r = ye(window.open(n, "_blank"));
|
|
750
|
+
r === "blocked" && this.emitAnalytics("open.url.blocked", {}), this.sendOpenUrlStatus(r, n);
|
|
624
751
|
} else
|
|
625
|
-
this.sendOpenUrlStatus("blocked", typeof
|
|
752
|
+
this.sendOpenUrlStatus("blocked", typeof n == "string" ? n : "");
|
|
626
753
|
return;
|
|
627
754
|
}
|
|
628
755
|
if (t.source === "moment-live-embed" && t.type === "moment.embed.close") {
|
|
629
756
|
this.handleCancel();
|
|
630
757
|
return;
|
|
631
758
|
}
|
|
759
|
+
if (t.source === "moment-live-embed" && t.type === "moment.embed.celebrate") {
|
|
760
|
+
this.feedback?.celebrate();
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
if (t.source === "moment-live-embed" && t.type === "moment.embed.toast") {
|
|
764
|
+
const { text: n, variant: r } = t;
|
|
765
|
+
typeof n == "string" && n.trim() !== "" && this.feedback?.toast(n, r);
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
632
768
|
if (t.source === "moment-live-embed" && t.type === "moment.embed.result") {
|
|
633
|
-
const
|
|
634
|
-
this.handleResult(
|
|
769
|
+
const n = t;
|
|
770
|
+
this.handleResult(n);
|
|
635
771
|
}
|
|
636
772
|
}
|
|
637
773
|
}, window.addEventListener("message", this.messageHandler);
|
|
638
774
|
}
|
|
639
775
|
handleOAuthStart(e) {
|
|
640
|
-
this.popupBridge && (this.popupBridge.cleanup(), this.popupBridge = null), this.popupBridge = new
|
|
776
|
+
this.popupBridge && (this.popupBridge.cleanup(), this.popupBridge = null), this.popupBridge = new he({
|
|
641
777
|
liveBaseUrl: this.liveBaseUrl,
|
|
642
778
|
liveOrigin: this.liveOrigin,
|
|
643
779
|
iframeWindow: this.iframe?.contentWindow ?? null,
|
|
@@ -662,51 +798,48 @@ class Ae {
|
|
|
662
798
|
* real open from a blocked one instead of assuming success.
|
|
663
799
|
*/
|
|
664
800
|
sendOpenUrlStatus(e, t) {
|
|
665
|
-
const
|
|
666
|
-
if (!
|
|
801
|
+
const n = this.iframe?.contentWindow;
|
|
802
|
+
if (!n) return;
|
|
667
803
|
const r = {
|
|
668
804
|
source: "moment-sdk",
|
|
669
805
|
type: "moment.embed.open.url.status",
|
|
670
806
|
status: e,
|
|
671
807
|
url: t
|
|
672
808
|
};
|
|
673
|
-
|
|
809
|
+
n.postMessage(r, this.liveOrigin);
|
|
674
810
|
}
|
|
675
811
|
handleResult(e) {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
triggerType: e.triggerType,
|
|
686
|
-
momentIds: e.momentIds
|
|
687
|
-
}), this.opts.onError?.(e);
|
|
688
|
-
else if (e.result === "cancelled")
|
|
689
|
-
return;
|
|
690
|
-
this.opts.onClose?.(e), this.emitAnalytics("embed.close"), be(e) && (this.closeTimer = setTimeout(() => this.cleanup(), 1500));
|
|
812
|
+
e.result !== "cancelled" && (e.keepOpen === !0 && e.triggerType !== "schedule" && (this.closeReported = !0), e.result === "success" || e.result === "partial" ? (this.emitAnalytics("subscribe.success", {
|
|
813
|
+
provider: e.provider,
|
|
814
|
+
triggerType: e.triggerType,
|
|
815
|
+
momentIds: e.momentIds
|
|
816
|
+
}), this.opts.onSuccess?.(e)) : e.result === "error" && (this.emitAnalytics("subscribe.error", {
|
|
817
|
+
provider: e.provider,
|
|
818
|
+
triggerType: e.triggerType,
|
|
819
|
+
momentIds: e.momentIds
|
|
820
|
+
}), this.opts.onError?.(e)), this.opts.onClose?.(e), this.emitAnalytics("embed.close"), ke(e) && (this.closeTimer = setTimeout(() => this.cleanup(), 1500)));
|
|
691
821
|
}
|
|
692
822
|
handleCancel() {
|
|
693
|
-
this.
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
823
|
+
if (!this.closeReported) {
|
|
824
|
+
this.emitAnalytics("embed.close");
|
|
825
|
+
const t = {
|
|
826
|
+
source: "moment-live-embed",
|
|
827
|
+
type: "moment.embed.result",
|
|
828
|
+
result: "cancelled",
|
|
829
|
+
triggerType: this.activePayload?.triggerType ?? "moment",
|
|
830
|
+
momentIds: this.activePayload?.ids ?? []
|
|
831
|
+
};
|
|
832
|
+
this.opts.onClose?.(t);
|
|
833
|
+
}
|
|
834
|
+
this.cleanup();
|
|
702
835
|
}
|
|
703
836
|
// ── Private: cleanup ──────────────────────────────────────────────
|
|
704
837
|
cleanup() {
|
|
705
|
-
if (this.closeTimer && (clearTimeout(this.closeTimer), this.closeTimer = null), this.popupBridge && (this.popupBridge.cleanup(), this.popupBridge = null), this.messageHandler && (window.removeEventListener("message", this.messageHandler), this.messageHandler = null), this.design = "v1", this.surface = v, this.lastRequestedHeight = null, this.footer = null, this.hairline = null, this.viewportResizeHandler && (window.removeEventListener("resize", this.viewportResizeHandler), this.viewportResizeHandler = null), this.overlay) {
|
|
838
|
+
if (this.closeTimer && (clearTimeout(this.closeTimer), this.closeTimer = null), this.popupBridge && (this.popupBridge.cleanup(), this.popupBridge = null), this.messageHandler && (window.removeEventListener("message", this.messageHandler), this.messageHandler = null), this.feedback?.destroy(), this.feedback = null, this.closeReported = !1, this.design = "v1", this.surface = v, this.lastRequestedHeight = null, this.footer = null, this.hairline = null, this.viewportResizeHandler && (window.removeEventListener("resize", this.viewportResizeHandler), this.viewportResizeHandler = null), this.overlay) {
|
|
706
839
|
const { _escHandler: e, _focusTrapHandler: t } = this.overlay;
|
|
707
840
|
e && document.removeEventListener("keydown", e);
|
|
708
|
-
const
|
|
709
|
-
|
|
841
|
+
const n = this.overlay.firstElementChild;
|
|
842
|
+
n && t && n.removeEventListener("keydown", t), this.overlay.remove(), this.overlay = null;
|
|
710
843
|
}
|
|
711
844
|
this.iframe = null, this.wrapper = null, this.container = null, this.closeButton = null, this.activePayload = null, this.activeCampaignId = void 0, this.cardRadius = x, this.didManageBodyOverflow && (document.body.style.overflow = this.previousBodyOverflow, this.didManageBodyOverflow = !1), this.previousFocusedElement && typeof this.previousFocusedElement.focus == "function" && this.previousFocusedElement.focus(), this.previousFocusedElement = null;
|
|
712
845
|
}
|
|
@@ -719,7 +852,7 @@ class Ae {
|
|
|
719
852
|
});
|
|
720
853
|
}
|
|
721
854
|
}
|
|
722
|
-
function
|
|
855
|
+
function $e(i) {
|
|
723
856
|
const e = document.createElement("button");
|
|
724
857
|
return e.type = "button", e.classList.add("moment-sync-trigger"), i.className && i.className.split(" ").forEach((t) => {
|
|
725
858
|
t && e.classList.add(t);
|
|
@@ -727,9 +860,9 @@ function Le(i) {
|
|
|
727
860
|
}
|
|
728
861
|
if (typeof window < "u") {
|
|
729
862
|
const i = window;
|
|
730
|
-
i.MomentSdk =
|
|
863
|
+
i.MomentSdk = Ue, i.createMomentButton = $e;
|
|
731
864
|
}
|
|
732
865
|
export {
|
|
733
|
-
|
|
734
|
-
|
|
866
|
+
Ue as MomentSdk,
|
|
867
|
+
$e as createMomentButton
|
|
735
868
|
};
|