@momentco-ai/moment-sdk 0.9.0-dev.51 → 0.9.0-dev.52
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
CHANGED
|
@@ -16,11 +16,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
16
16
|
- **Collections in the sign-in popup.** A `schedule` selection can carry collection ids (`scheduleListIds`) alongside events and playlists, and `counts.lists` reports them.
|
|
17
17
|
- The sign-in popup carries the add-ons ticked in the sheet.
|
|
18
18
|
- **Connect-only sign-in.** `moment.embed.oauth.start` can carry `intent: "connect"`: the popup only connects the fan's calendar, subscribes nothing, and its result goes to the embed alone, with no `onSuccess`, `onError` or `onClose` and no `subscribe.*` analytics.
|
|
19
|
-
- **Confetti and toasts over the page.** Two new embed messages, drawn on a click-through layer over the host page instead of clipped inside the iframe. `moment.embed.celebrate` launches confetti
|
|
19
|
+
- **Confetti and toasts over the page.** Two new embed messages, drawn on a click-through layer over the host page instead of clipped inside the iframe. `moment.embed.celebrate` launches confetti once the sheet's height has settled, and is skipped when the visitor prefers reduced motion. `moment.embed.toast` (`text`, optional `variant`: `success`, `info`, `warning` or `error`) shows Roman's light toast 56px below the top of the screen for 4 s, replacing any current one. It is announced by a status region inside the dialog, the same message again included, and its text is drawn as text, never HTML.
|
|
20
20
|
- **The embed can own a tap outside the sheet.** A v2 `moment.embed.theme` with `dismiss: "embed"` makes a tap on the dim, or Escape on the page, post `moment.sdk.dismiss` to the embed instead of closing, so it does exactly what the sheet's own ✕ does: return to where the sync started, or ask before dropping a selection. The embed answers each `moment.sdk.dismiss` with `moment.embed.dismiss.ack` at once; without it within 0.5 s the SDK closes the sheet itself, so an embed that stops listening (an error page) never leaves the fan behind a dim that does nothing. The sheet closes on the embed's `moment.embed.close`, as before.
|
|
21
21
|
|
|
22
22
|
### Fixed
|
|
23
23
|
|
|
24
|
+
- **The confetti is Live's own again.** `moment.embed.celebrate` fires canvas-confetti's "Realistic" burst, as Moment Live did before v2: five bursts from one point halfway across and 70% down the screen, which rise, then fall back below it under gravity, drifting, turning and fluttering, and fade only at the end. Still 80 pieces in the same colours on the click-through layer, none under reduced motion, each removed when its flight ends.
|
|
24
25
|
- The v2 frame keeps Roman's fixed 12px radius whatever radius the partner sends, and no longer blurs the page behind the desktop modal (only the 40% dim covers it).
|
|
25
26
|
- **Done reports the close once.** A `keepOpen` result already calls `onClose` with the result and emits `embed.close`. Closing its sheet afterwards (the embed's Done or ✕, the SDK's ✕, Escape or a tap outside) no longer calls `onClose` again with `cancelled` or emits a second `embed.close`, even when the partner calls `sdk.close()` from `onSuccess`. A sheet closed without a result, or after a `schedule` result (which Live also marks `keepOpen`), still reports `cancelled`.
|
|
26
27
|
- **A full-height sheet grows back after a resize.** The frame re-caps from the height the embed last asked for, so rotating a phone back to portrait restores the sheet's full height instead of keeping the landscape one.
|
package/dist/moment-sdk.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(S){"use strict";const M="moment_sync",O="moment_campaign",ee=/^(?:schedule|(moment|list):([a-z0-9-]+)|playlist:([a-z0-9-]+(?:,[a-z0-9-]+)*))$/,te=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function ie(i,e){if(!e)return null;const t=new URL(i),s=t.searchParams.get(M);if(s===null||s.length>200)return null;const r=ee.exec(s);if(!r)return null;const[,o,n,a]=r;let h;o==="moment"?h={teamSlug:e,triggerType:"moment",momentSlug:n}:o==="list"?h={teamSlug:e,triggerType:"list",listSlug:n}:a?h={teamSlug:e,triggerType:"playlist",playlistSlugs:a.split(",")}:h={teamSlug:e,triggerType:"schedule"};const u=t.searchParams.get(O);return t.search=t.search.slice(1).split("&").filter(g=>{const l=g.split("=",1)[0];return l!==M&&l!==O}).join("&"),{payload:h,...u&&te.test(u)?{campaignId:u}:{},cleanUrl:t.href}}let k=!1;function se(){return k?!1:(k=!0,!0)}function ne(i,e){i.body?e():i.addEventListener("DOMContentLoaded",e,{once:!0})}const re="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",oe=120.52/21.28,ae=4e3,le=80,R=["#f04a34","#041abe","#041139","#1cd4ed","#b8e070"],de=10,ce=260,H={success:{fill:"#1c1d22",glyph:"#fafafc",path:"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"},info:{fill:"#146eaa",glyph:"#ffffff",path:"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"},warning:{fill:"#aa4e19",glyph:"#ffffff",path:"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"},error:{fill:"#c62734",glyph:"#ffffff",path:"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"}},ue={position:"absolute",top:"calc(56px + env(safe-area-inset-top, 0px))",left:"0",right:"0",margin:"0 auto",width:"max-content",maxWidth:"min(320px, calc(100% - 32px))",boxSizing:"border-box",display:"flex",alignItems:"center",gap:"8px",padding:"4px 16px 4px 4px",borderRadius:"20px",backgroundColor:"#ffffff",color:"#1c1d22",boxShadow:"0 4px 8px 0 #0000000a, 0 12px 32px 0 #0000001f",fontFamily:"Inter, system-ui, -apple-system, sans-serif",fontSize:"14px",lineHeight:"20px",fontWeight:"400",overflowWrap:"anywhere"},me={display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",width:"28px",height:"28px",margin:"2px",borderRadius:"50%"},he={position:"absolute",width:"1px",height:"1px",margin:"-1px",padding:"0",border:"0",overflow:"hidden",clipPath:"inset(50%)",whiteSpace:"nowrap"};function b(i,e){const t=document.createElement(i);return Object.assign(t.style,e),t}function pe(i,e){const t=b("div",{position:"absolute",inset:"0",overflow:"hidden",pointerEvents:"none",zIndex:"1"});t.setAttribute("aria-hidden","true"),i.appendChild(t);const s=b("span",he);s.setAttribute("role","status"),(e.querySelector('[role="dialog"]')??e).appendChild(s);let r=null,o=null,n=null,a=null;const h=()=>{o&&clearTimeout(o),o=null,a?.(),a=null,r?.remove(),r=null,s.textContent=""},u=l=>{const d=()=>{a=null,s.textContent=l};if(typeof requestAnimationFrame=="function"){const c=requestAnimationFrame(d);a=()=>cancelAnimationFrame(c)}else{const c=setTimeout(d,0);a=()=>clearTimeout(c)}},g=()=>{n=null;const l=e.getBoundingClientRect(),d=Math.max(0,l.top-de);for(let c=0;c<le;c++){const m=4+Math.random()*6,f=b("span",{position:"absolute",left:`${l.left+Math.random()*l.width}px`,top:`${d}px`,width:`${m}px`,height:`${m*(.5+Math.random())}px`,borderRadius:c%3===0?"50%":"1px",backgroundColor:R[c%R.length]});f.setAttribute("data-moment-confetti",""),t.appendChild(f);const T=d*(.35+Math.random()*.55),y=(Math.random()-.5)*120,p=(Math.random()-.5)*1080;f.animate([{transform:"translate(0px, 0px) rotate(0deg)",opacity:1},{opacity:1,offset:.6},{transform:`translate(${y}px, ${-T}px) rotate(${p}deg)`,opacity:0}],{duration:1200+Math.random()*800,delay:Math.random()*150,easing:"cubic-bezier(0.2, 0.6, 0.35, 1)",fill:"both"}).onfinish=()=>f.remove()}};return{celebrate(){window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||typeof t.animate!="function"||n||(n=setTimeout(g,ce))},toast(l,d="success"){h();const c=H[Object.hasOwn(H,d)?d:"success"],m=b("span",{...me,backgroundColor:c.fill,color:c.glyph});m.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>`;const f=b("span",{minWidth:"0"});f.textContent=l,r=b("div",ue),r.setAttribute("data-moment-toast",""),r.appendChild(m),r.appendChild(f),t.appendChild(r),u(l),o=setTimeout(h,ae)},destroy(){n&&clearTimeout(n),n=null,h(),t.remove(),s.remove()}}}function B(){if(typeof window>"u")return"";const i=window.location.origin,e=i==="null"?self.origin:i;return e==="null"&&console.error('[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.'),e}function fe(i,e,t=B(),s){if(e.triggerType==="schedule"){const o=new URLSearchParams;return o.set("teamSlug",e.teamSlug),o.set("returnOrigin",t),o.set("embed","1"),o.set("sdkVersion","0.9.0-dev.51"),s&&(o.set("entry","link"),s.campaignId&&o.set("campaignId",s.campaignId)),`${i}/en/embed/schedule?${o.toString()}`}const r=new URLSearchParams;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.51"),s&&(r.set("entry","link"),s.campaignId&&r.set("campaignId",s.campaignId)),`${i}/en/embed/sync?${r.toString()}`}const P=500,F=700,ge=500;class Ce{popup=null;pollTimer=null;messageHandler=null;resultReceived=!1;opts;constructor(e){this.opts=e}open(e){this.cleanup(),this.resultReceived=!1;const t=this.buildPopupUrl(e),s=Math.round(window.screenX+(window.outerWidth-P)/2),r=Math.round(window.screenY+(window.outerHeight-F)/2);if(this.popup=window.open(t,"moment-oauth-popup",`width=${P},height=${F},left=${s},top=${r},menubar=no,toolbar=no,location=yes,status=no`),!this.popup||this.popup.closed){this.sendStatusToIframe("popup-blocked"),this.opts.onPopupBlocked();return}this.sendStatusToIframe("popup-opened"),this.startPolling(),this.messageHandler=o=>{if(o.origin!==this.opts.liveOrigin||o.source!==this.popup)return;const n=o.data;!n||typeof n!="object"||n.source!=="moment-live-embed"||n.type!=="moment.embed.result"||(this.resultReceived=!0,this.sendStatusToIframe("completed"),this.opts.iframeWindow&&this.opts.iframeWindow.postMessage(n,this.opts.liveOrigin),e.intent!=="connect"&&this.opts.onResult(n),this.cleanup())},window.addEventListener("message",this.messageHandler)}cleanup(){if(this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null),this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.popup&&!this.popup.closed)try{this.popup.close()}catch{}this.popup=null}buildPopupUrl(e){const t=be(e,B());return this.opts.campaignId&&t.set("campaignId",this.opts.campaignId),`${this.opts.liveBaseUrl}/en/embed/oauth-popup?${t.toString()}`}startPolling(){this.pollTimer=setInterval(()=>{(!this.popup||this.popup.closed)&&(this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null),this.resultReceived||(this.sendStatusToIframe("popup-closed"),this.opts.onPopupClosed()),this.cleanup())},ge)}sendStatusToIframe(e){if(!this.opts.iframeWindow)return;const t={source:"moment-sdk",type:"moment.embed.oauth.status",status:e};this.opts.iframeWindow.postMessage(t,this.opts.liveOrigin)}}function be(i,e){const t=new URLSearchParams({provider:i.provider,teamSlug:i.teamSlug,ids:i.ids.join(","),triggerType:i.triggerType,returnOrigin:e});i.subscriptionType&&t.set("subscriptionType",i.subscriptionType);const s={scheduleMomentIds:i.scheduleMomentIds,schedulePlaylistIds:i.schedulePlaylistIds,scheduleListIds:i.scheduleListIds};for(const[r,o]of Object.entries(s))o?.length&&t.set(r,o.join(","));return i.addons?.length&&t.set("addons",i.addons.join(",")),i.intent==="connect"&&t.set("intent","connect"),t}const D="moment-sdk-styles",N="moment-sdk-close",L="moment-sdk-tray",x="moment-sdk-closing",ye=`
|
|
1
|
+
(function(k){"use strict";const P="moment_sync",B="moment_campaign",ae=/^(?:schedule|(moment|list):([a-z0-9-]+)|playlist:([a-z0-9-]+(?:,[a-z0-9-]+)*))$/,le=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function de(i,e){if(!e)return null;const t=new URL(i),s=t.searchParams.get(P);if(s===null||s.length>200)return null;const r=ae.exec(s);if(!r)return null;const[,o,n,a]=r;let h;o==="moment"?h={teamSlug:e,triggerType:"moment",momentSlug:n}:o==="list"?h={teamSlug:e,triggerType:"list",listSlug:n}:a?h={teamSlug:e,triggerType:"playlist",playlistSlugs:a.split(",")}:h={teamSlug:e,triggerType:"schedule"};const u=t.searchParams.get(B);return t.search=t.search.slice(1).split("&").filter(g=>{const d=g.split("=",1)[0];return d!==P&&d!==B}).join("&"),{payload:h,...u&&le.test(u)?{campaignId:u}:{},cleanUrl:t.href}}let N=!1;function ce(){return N?!1:(N=!0,!0)}function ue(i,e){i.body?e():i.addEventListener("DOMContentLoaded",e,{once:!0})}const me="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",he=120.52/21.28,pe=4e3,fe=80,D=["#f04a34","#041abe","#041139","#1cd4ed","#b8e070"],ge=260,U={x:.5,y:.7},Ce=[{share:.25,spread:26,velocity:55,decay:.91,scalar:1},{share:.2,spread:60,velocity:45,decay:.91,scalar:1},{share:.35,spread:100,velocity:45,decay:.91,scalar:.8},{share:.1,spread:120,velocity:25,decay:.92,scalar:1.2},{share:.1,spread:120,velocity:45,decay:.91,scalar:1}],ye=3,be=.2,ve=200,Te=1e3/60,Ae=4,xe=.75,$={success:{fill:"#1c1d22",glyph:"#fafafc",path:"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"},info:{fill:"#146eaa",glyph:"#ffffff",path:"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"},warning:{fill:"#aa4e19",glyph:"#ffffff",path:"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"},error:{fill:"#c62734",glyph:"#ffffff",path:"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"}},Ee={position:"absolute",top:"calc(56px + env(safe-area-inset-top, 0px))",left:"0",right:"0",margin:"0 auto",width:"max-content",maxWidth:"min(320px, calc(100% - 32px))",boxSizing:"border-box",display:"flex",alignItems:"center",gap:"8px",padding:"4px 16px 4px 4px",borderRadius:"20px",backgroundColor:"#ffffff",color:"#1c1d22",boxShadow:"0 4px 8px 0 #0000000a, 0 12px 32px 0 #0000001f",fontFamily:"Inter, system-ui, -apple-system, sans-serif",fontSize:"14px",lineHeight:"20px",fontWeight:"400",overflowWrap:"anywhere"},we={display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",width:"28px",height:"28px",margin:"2px",borderRadius:"50%"},Se={position:"absolute",width:"1px",height:"1px",margin:"-1px",padding:"0",border:"0",overflow:"hidden",clipPath:"inset(50%)",whiteSpace:"nowrap"};function A(i,e){const t=document.createElement(i);return Object.assign(t.style,e),t}function Ie(i,e){const t=A("div",{position:"absolute",inset:"0",overflow:"hidden",pointerEvents:"none",zIndex:"1"});t.setAttribute("aria-hidden","true"),i.appendChild(t);const s=A("span",Se);s.setAttribute("role","status"),(e.querySelector('[role="dialog"]')??e).appendChild(s);let r=null,o=null,n=null,a=null;const h=()=>{o&&clearTimeout(o),o=null,a?.(),a=null,r?.remove(),r=null,s.textContent=""},u=c=>{const m=()=>{a=null,s.textContent=c};if(typeof requestAnimationFrame=="function"){const l=requestAnimationFrame(m);a=()=>cancelAnimationFrame(l)}else{const l=setTimeout(m,0);a=()=>clearTimeout(l)}},g=({spread:c,velocity:m,decay:l,scalar:f},C,x,p)=>{const y=(4+Math.random()*6)*f,b=A("span",{position:"absolute",left:`${x}px`,top:`${p}px`,width:`${y}px`,height:`${y*(.5+Math.random())}px`,borderRadius:Math.random()<.5?"50%":"1px",backgroundColor:C});b.setAttribute("data-moment-confetti",""),t.appendChild(b);const w=-Math.PI/2+(Math.random()-.5)*c*Math.PI/180;let T=m*(.5+Math.random());const rt=(Math.random()*2-1)*be,ot=(.25+Math.random()*.5)*Math.PI,at=Math.random()<.5?.1:-.1,lt=Math.random()*10,dt=Math.min(.11,.05+Math.random()*.1),_=[{tick:0,x:0,y:0}];let[v,F,O]=[0,0,0];do F+=Math.cos(w)*T+rt,O+=Math.sin(w)*T+ye,T*=l,v++,v%Ae===0&&_.push({tick:v,x:F,y:O});while(v<ve||O<1);_.at(-1).tick!==v&&_.push({tick:v,x:F,y:O}),b.animate(_.map(S=>{const oe=S.tick/v,ct=(ot+S.tick*at)*180/Math.PI,ut=Math.cos(lt+S.tick*dt);return{offset:oe,transform:`translate(${S.x.toFixed(1)}px, ${S.y.toFixed(1)}px) rotate(${ct.toFixed(0)}deg) scaleY(${ut.toFixed(2)})`,opacity:Math.min(1,(1-oe)/(1-xe))}}),{duration:v*Te,fill:"both"}).onfinish=()=>b.remove()},d=()=>{n=null;const c=window.innerWidth*U.x,m=window.innerHeight*U.y;let l=0;for(const f of Ce)for(let C=Math.floor(fe*f.share);C>0;C--)g(f,D[l++%D.length],c,m)};return{celebrate(){window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||typeof t.animate!="function"||n||(n=setTimeout(d,ge))},toast(c,m="success"){h();const l=$[Object.hasOwn($,m)?m:"success"],f=A("span",{...we,backgroundColor:l.fill,color:l.glyph});f.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="${l.path}"/></svg>`;const C=A("span",{minWidth:"0"});C.textContent=c,r=A("div",Ee),r.setAttribute("data-moment-toast",""),r.appendChild(f),r.appendChild(C),t.appendChild(r),u(c),o=setTimeout(h,pe)},destroy(){n&&clearTimeout(n),n=null,h(),t.remove(),s.remove()}}}function W(){if(typeof window>"u")return"";const i=window.location.origin,e=i==="null"?self.origin:i;return e==="null"&&console.error('[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.'),e}function Le(i,e,t=W(),s){if(e.triggerType==="schedule"){const o=new URLSearchParams;return o.set("teamSlug",e.teamSlug),o.set("returnOrigin",t),o.set("embed","1"),o.set("sdkVersion","0.9.0-dev.52"),s&&(o.set("entry","link"),s.campaignId&&o.set("campaignId",s.campaignId)),`${i}/en/embed/schedule?${o.toString()}`}const r=new URLSearchParams;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.52"),s&&(r.set("entry","link"),s.campaignId&&r.set("campaignId",s.campaignId)),`${i}/en/embed/sync?${r.toString()}`}const j=500,G=700,Me=500;class _e{popup=null;pollTimer=null;messageHandler=null;resultReceived=!1;opts;constructor(e){this.opts=e}open(e){this.cleanup(),this.resultReceived=!1;const t=this.buildPopupUrl(e),s=Math.round(window.screenX+(window.outerWidth-j)/2),r=Math.round(window.screenY+(window.outerHeight-G)/2);if(this.popup=window.open(t,"moment-oauth-popup",`width=${j},height=${G},left=${s},top=${r},menubar=no,toolbar=no,location=yes,status=no`),!this.popup||this.popup.closed){this.sendStatusToIframe("popup-blocked"),this.opts.onPopupBlocked();return}this.sendStatusToIframe("popup-opened"),this.startPolling(),this.messageHandler=o=>{if(o.origin!==this.opts.liveOrigin||o.source!==this.popup)return;const n=o.data;!n||typeof n!="object"||n.source!=="moment-live-embed"||n.type!=="moment.embed.result"||(this.resultReceived=!0,this.sendStatusToIframe("completed"),this.opts.iframeWindow&&this.opts.iframeWindow.postMessage(n,this.opts.liveOrigin),e.intent!=="connect"&&this.opts.onResult(n),this.cleanup())},window.addEventListener("message",this.messageHandler)}cleanup(){if(this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null),this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.popup&&!this.popup.closed)try{this.popup.close()}catch{}this.popup=null}buildPopupUrl(e){const t=Oe(e,W());return this.opts.campaignId&&t.set("campaignId",this.opts.campaignId),`${this.opts.liveBaseUrl}/en/embed/oauth-popup?${t.toString()}`}startPolling(){this.pollTimer=setInterval(()=>{(!this.popup||this.popup.closed)&&(this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null),this.resultReceived||(this.sendStatusToIframe("popup-closed"),this.opts.onPopupClosed()),this.cleanup())},Me)}sendStatusToIframe(e){if(!this.opts.iframeWindow)return;const t={source:"moment-sdk",type:"moment.embed.oauth.status",status:e};this.opts.iframeWindow.postMessage(t,this.opts.liveOrigin)}}function Oe(i,e){const t=new URLSearchParams({provider:i.provider,teamSlug:i.teamSlug,ids:i.ids.join(","),triggerType:i.triggerType,returnOrigin:e});i.subscriptionType&&t.set("subscriptionType",i.subscriptionType);const s={scheduleMomentIds:i.scheduleMomentIds,schedulePlaylistIds:i.schedulePlaylistIds,scheduleListIds:i.scheduleListIds};for(const[r,o]of Object.entries(s))o?.length&&t.set(r,o.join(","));return i.addons?.length&&t.set("addons",i.addons.join(",")),i.intent==="connect"&&t.set("intent","connect"),t}const K="moment-sdk-styles",z="moment-sdk-close",R="moment-sdk-tray",I="moment-sdk-closing",ke=`
|
|
2
2
|
:where(.moment-sync-trigger) {
|
|
3
3
|
background-color: #1c1917;
|
|
4
4
|
color: #ffffff;
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
outline-offset: 2px;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
.${
|
|
26
|
+
.${z}:focus-visible {
|
|
27
27
|
outline: 2px solid #ffffff;
|
|
28
28
|
outline-offset: 0;
|
|
29
29
|
box-shadow: 0 0 0 4px #121316;
|
|
@@ -50,20 +50,20 @@
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
@media (prefers-reduced-motion: no-preference) {
|
|
53
|
-
.${
|
|
53
|
+
.${R} {
|
|
54
54
|
animation: moment-sdk-tray-in 0.35s cubic-bezier(0.32, 0.72, 0, 1);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
.${
|
|
57
|
+
.${I} {
|
|
58
58
|
animation: moment-sdk-dim-out 0.25s ease-in forwards;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
.${
|
|
61
|
+
.${I} > * {
|
|
62
62
|
animation: moment-sdk-fade-out 0.25s ease-in forwards;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
.${
|
|
65
|
+
.${I} .${R} {
|
|
66
66
|
animation: moment-sdk-tray-out 0.25s cubic-bezier(0.32, 0.72, 0, 1) forwards;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
`;function ve(){if(typeof document>"u"||document.getElementById(D))return;const i=document.createElement("style");i.id=D,i.textContent=ye,document.head.appendChild(i)}function Te(i){return typeof i=="string"&&i.startsWith("webcal://")}function Ae(i){return!i||i.closed?"blocked":"opened"}const xe=1024,I=600,we=400,Ee=40,U=80,$=90,Se=420,Le=520,W=48,j="#0d0d0d",w="#121316",Ie={backgroundColor:j,boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",backdropFilter:"none",webkitBackdropFilter:"none"},G="inset 0 0.5px 0.75px rgb(255 255 255 / 0.6)",_e="inset 0 -0.5px 0.75px rgb(255 255 255 / 0.3)",z=["0 0 0 0.5px #9c9c9c","0 4px 8px 0 #0000001f","0 12px 32px 0 #00000047"],K={backgroundColor:"rgb(19 19 19 / 0.812)",backdropFilter:"blur(14px)",webkitBackdropFilter:"blur(14px)",boxShadow:[G,_e,...z].join(", ")},Me={...K,boxShadow:[G,...z].join(", ")},v=32,Y="height 0.25s cubic-bezier(0.32, 0.72, 0, 1)",Oe=2e3,ke=500,Re=400,E=12,He="2147483647",Be='button, [href], input, select, textarea, iframe, [tabindex]:not([tabindex="-1"])',V="#38393B",Pe="#4B4B4E",Fe={position:"absolute",top:"16px",right:"16px",zIndex:"10",width:"40px",height:"40px",padding:"0",border:"none",borderRadius:"50%",backgroundColor:V,color:"#F5F5F5",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"};function De(i,e,t=E,s="v1",r=0,o=w){const n=s==="v2",a=i<xe,u={showFooter:!n,material:n?"glass":"solid",wrapperMaterial:n?a?Me:K:Ie,card:{backgroundColor:n?"transparent":o},iframe:n?{background:"transparent",colorScheme:"dark"}:{background:"",colorScheme:""}},g=n?"rgba(0, 0, 0, 0.4)":"rgba(0, 0, 0, 0.5)",l=n?E:t,d=`${l}px ${l}px 0px 0px`;if(a){const m=n?e-W-r:Math.floor(e*$/100)-v;return{isTray:!0,overlay:{alignItems:"flex-end",padding:"0",backdropFilter:"none",backgroundColor:g},wrapper:{maxWidth:i<I+2*Ee?"none":`${I}px`,minWidth:"0",borderRadius:d,paddingBottom:"env(safe-area-inset-bottom, 0px)"},container:{maxHeight:n?`calc(100dvh - ${W}px - env(safe-area-inset-bottom, 0px))`:`calc(${$}dvh - ${v}px)`,borderRadius:d},iframeMaxHeight:m,iframeOpeningHeight:Math.min(Se,m),...u}}const c=e-U;return{isTray:!1,overlay:{alignItems:"center",padding:"16px",backdropFilter:n?"none":"blur(2px)",backgroundColor:g},wrapper:{maxWidth:`${I}px`,minWidth:`${we}px`,borderRadius:`${l}px`,paddingBottom:"0"},container:{maxHeight:`calc(100vh - ${U}px)`,borderRadius:d},iframeMaxHeight:c,iframeOpeningHeight:Math.min(Le,c),...u}}function Z(i,e){return Math.min(i,e)}function Ne(i){return i.triggerType!=="schedule"&&i.keepOpen!==!0}const Ue=32;function $e(i){const e={hideCloseButton:i.closeControl==="embed",dismissByEmbed:i.dismiss==="embed"};return typeof i.borderRadius=="number"&&Number.isFinite(i.borderRadius)&&(e.cardRadius=Math.max(0,Math.min(i.borderRadius,Ue))),typeof i.surface=="string"&&i.surface!==""&&(e.surface=i.surface),(i.design==="v1"||i.design==="v2")&&(e.design=i.design),e}const We=".moment-sync-trigger",je=6,q=60,Ge="rgba(255, 255, 255, 0.216)",ze="https://live.dev.momentco.ai";class X{opts;liveBaseUrl;liveOrigin;overlay=null;iframe=null;wrapper=null;container=null;closeButton=null;popupBridge=null;messageHandler=null;boundClickHandlers=new Map;activePayload=null;activeCampaignId;previousFocusedElement=null;previousBodyOverflow="";didManageBodyOverflow=!1;previousBodyPaddingRight="";didManageBodyPadding=!1;closeTimer=null;revealed=!1;revealTimer=null;dismissAckTimer=null;cardRadius=E;design="v1";surface=w;dismissByEmbed=!1;lastRequestedHeight=null;footer=null;hairline=null;viewportResizeHandler=null;feedback=null;closeReported=!1;constructor(e){this.opts={triggerSelector:We,...e},this.liveBaseUrl=ze;try{this.liveOrigin=new URL(this.liveBaseUrl).origin}catch{throw new Error(`[MomentSdk] Invalid VITE_LIVE_BASE_URL: "${this.liveBaseUrl}"`)}ve(),this.bindTriggers(),this.emitAnalytics("embed.init"),this.opts.autoOpen&&this.autoOpenFromUrl(this.opts.autoOpen.teamSlug)}open(e){this.openWith(e)}close(){this.handleCancel()}rebind(){this.unbindTriggers(),this.bindTriggers()}destroy(){this.cleanup(),this.unbindTriggers()}openWith(e,t){if(this.overlay&&!this.revealed)return;e.externalEventId&&e.externalEventIdPrefix&&console.warn("[MomentSdk] Both externalEventId and externalEventIdPrefix provided; using externalEventId only.");const s=this.scopeOpenPayload(e);this.emitAnalytics("embed.open",{teamSlug:s.teamSlug,triggerType:s.triggerType,...t?{triggerSource:"url"}:{}}),this.createModal(s,t)}autoOpenFromUrl(e){if(!se())return;const t=ie(window.location.href,e);t&&ne(document,()=>{this.openWith(t.payload,t),history.replaceState(history.state,"",t.cleanUrl)})}bindTriggers(){document.querySelectorAll(this.opts.triggerSelector).forEach(t=>{const s=o=>{o.preventDefault(),this.handleTriggerClick(t)},r=this.boundClickHandlers.get(t);r&&t.removeEventListener("click",r),t.addEventListener("click",s),this.boundClickHandlers.set(t,s)})}unbindTriggers(){this.boundClickHandlers.forEach((e,t)=>{t.removeEventListener("click",e)}),this.boundClickHandlers.clear()}handleTriggerClick(e){const t=e.getAttribute("data-moment-team-slug")??"",s=e.getAttribute("data-moment-slug")??void 0,r=e.getAttribute("data-moment-list-slug")??void 0,o=e.getAttribute("data-moment-trigger-type");let n="moment";o!=null&&o!==""&&(o==="moment"||o==="list"||o==="team"||o==="brand-playlist"||o==="playlist"||o==="schedule"?n=o:console.warn("[MomentSdk] Invalid data-moment-trigger-type, falling back to 'moment':",o));const a=e.getAttribute("data-moment-ids")??e.getAttribute("data-moment-game-id")??"",h=a?a.split(",").filter(Boolean):[],u=e.getAttribute("data-moment-playlist-slugs")??"",g=u?u.split(",").map(y=>y.trim()).filter(Boolean):[],l=e.getAttribute("data-moment-calendar");let d;l!=null&&l!==""&&(l==="google"||l==="outlook"?d=l:console.warn("[MomentSdk] Invalid data-moment-calendar, ignoring value:",l));const c=e.getAttribute("data-api-source-id")??void 0,m=e.getAttribute("data-external-event-id")??void 0,f=e.getAttribute("data-external-event-id-prefix")??void 0;if(m&&f&&console.warn("[MomentSdk] Both data-external-event-id and data-external-event-id-prefix are set; using data-external-event-id only."),!t){console.warn("[MomentSdk] Missing data-moment-team-slug on trigger element");return}const T=n==="team"||n==="brand-playlist"||n==="playlist"||n==="schedule";this.emitAnalytics("embed.trigger.click",{teamSlug:t,triggerType:n,momentIds:T?[]:h}),this.open({teamSlug:t,momentSlug:s,listSlug:r,triggerType:n,ids:h,playlistSlugs:g,calendar:d??void 0,apiSourceId:c,externalEventId:f&&!m?void 0:m,externalEventIdPrefix:m?void 0:f})}scopeOpenPayload(e){return e.triggerType==="schedule"?{teamSlug:e.teamSlug,triggerType:e.triggerType}:e.triggerType==="playlist"?{teamSlug:e.teamSlug,triggerType:e.triggerType,playlistSlugs:e.playlistSlugs,calendar:e.calendar}:e.triggerType==="team"||e.triggerType==="brand-playlist"?{teamSlug:e.teamSlug,triggerType:e.triggerType,calendar:e.calendar}:e}createModal(e,t){this.cleanup(),this.previousFocusedElement=document.activeElement||null,this.activePayload=e,this.activeCampaignId=t?.campaignId;const s=this.buildIframeUrl(e,t);this.overlay=document.createElement("div"),this.overlay.setAttribute("role","presentation"),Object.assign(this.overlay.style,{position:"fixed",inset:"0",zIndex:He,display:"flex",justifyContent:"center",visibility:"hidden"}),this.overlay.addEventListener("click",p=>{p.target===this.overlay&&this.requestDismiss()});const r=p=>{p.key==="Escape"&&this.requestDismiss()};document.addEventListener("keydown",r);const o=document.createElement("div");Object.assign(o.style,{position:"relative",width:"100%",transition:"border-radius 0.3s ease",overflow:"hidden",backgroundColor:j,boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",display:"flex",flexDirection:"column"});const n=document.createElement("div");n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true"),n.setAttribute("aria-label","Calendar sync modal"),n.tabIndex=-1,Object.assign(n.style,{position:"relative",width:"100%",transition:"border-radius 0.3s ease",overflow:"auto",backgroundColor:w,outline:"none"});const a=document.createElement("button");a.type="button",a.className=N,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,Fe),a.addEventListener("mouseenter",()=>{a.style.backgroundColor=Pe}),a.addEventListener("mouseleave",()=>{a.style.backgroundColor=V}),a.addEventListener("click",()=>this.handleCancel());const h=e.triggerType!=="schedule";this.iframe=document.createElement("iframe"),this.iframe.src=s,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,{width:"100%",border:"none",display:"block",overflow:"hidden",transition:Y}),h&&(n.appendChild(a),this.closeButton=a),n.appendChild(this.iframe);const u=document.createElement("div");this.footer=u,Object.assign(u.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:`${je}px`,height:`${v}px`,flexShrink:"0",boxSizing:"border-box",padding:"0"});const g=document.createElement("span");g.textContent="Powered by",Object.assign(g.style,{fontFamily:"Inter, system-ui, -apple-system, sans-serif",fontSize:"12px",lineHeight:"16px",color:"#ffffff"});const l=document.createElement("img");l.alt="Moment",l.src=re,Object.assign(l.style,{display:"block",width:`${q}px`,height:`${(q/oe).toFixed(2)}px`}),u.appendChild(g),u.appendChild(l),this.wrapper=o,this.container=n,this.applyFrameLayout();const d=document.createElement("div");this.hairline=d,d.setAttribute("aria-hidden","true"),Object.assign(d.style,{position:"absolute",inset:"0",borderRadius:"inherit",boxShadow:`inset 0 0 0 1px ${Ge}`,pointerEvents:"none",zIndex:"2"}),o.appendChild(n),o.appendChild(u),o.appendChild(d),this.overlay.appendChild(o),this.feedback=pe(this.overlay,o),document.body.appendChild(this.overlay),this.revealTimer=setTimeout(()=>this.reveal(),Oe),this.viewportResizeHandler=()=>this.applyFrameLayout(),window.addEventListener("resize",this.viewportResizeHandler);const c=()=>n.querySelectorAll(Be),m=p=>{if(p.key!=="Tab")return;const C=c(),A=C[0],Q=C[C.length-1],_=document.activeElement;p.shiftKey&&(_===A||_===n)?(p.preventDefault(),Q.focus()):!p.shiftKey&&_===Q&&(p.preventDefault(),A.focus())};n.addEventListener("keydown",m);const f=p=>{const C=document.createElement("span");return C.tabIndex=0,Object.assign(C.style,{position:"fixed",opacity:"0"}),C.addEventListener("focus",()=>{const A=c();A[p==="first"?0:A.length-1].focus()}),C};n.before(f("last")),n.after(f("first"));const T=document.documentElement.clientWidth;this.previousBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.didManageBodyOverflow=!0;const y=document.documentElement.clientWidth-T;if(y>0){this.previousBodyPaddingRight=document.body.style.paddingRight;const p=Number.parseFloat(getComputedStyle(document.body).paddingRight)||0;document.body.style.paddingRight=`${p+y}px`,this.didManageBodyPadding=!0}this.setupMessageListener(),this.overlay._escHandler=r,this.overlay._focusTrapHandler=m}reveal(){this.revealed||!this.overlay||(this.revealTimer&&clearTimeout(this.revealTimer),this.revealTimer=null,this.revealed=!0,this.overlay.style.visibility="",this.applyFrameLayout(),this.container?.focus())}applyFrameLayout(){if(!this.overlay||!this.wrapper||!this.container||!this.iframe)return;Object.assign(this.wrapper.style,this.currentLayout().wrapper);const e=this.currentLayout();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);const t=this.footer?.style.display!=="none";if(this.footer&&this.revealed&&t!==e.showFooter){const o=this.iframe.offsetHeight;this.iframe.style.transition="none",this.iframe.style.height=`${o+(t?v:-v)}px`,this.iframe.offsetHeight,this.iframe.style.transition=Y}this.footer&&(this.footer.style.display=e.showFooter?"flex":"none"),this.hairline&&(this.hairline.style.display=e.material==="glass"?"none":""),this.wrapper.classList.toggle(L,e.isTray&&this.revealed);const s=Number.parseFloat(this.iframe.style.height),r=this.lastRequestedHeight!==null?Z(this.lastRequestedHeight,e.iframeMaxHeight):Number.isNaN(s)?e.iframeOpeningHeight:Math.min(s,e.iframeMaxHeight);this.iframe.style.height=`${r}px`}currentLayout(){const e=this.wrapper&&Number.parseFloat(getComputedStyle(this.wrapper).paddingBottom)||0;return De(window.innerWidth,window.innerHeight,this.cardRadius,this.design,e,this.surface)}buildIframeUrl(e,t){return fe(this.liveBaseUrl,e,void 0,t)}setupMessageListener(){this.messageHandler=e=>{if(e.origin!==this.liveOrigin||e.source!==this.iframe?.contentWindow)return;const t=e.data;if(!(!t||typeof t!="object")){if(t.source==="moment-live-embed"&&t.type==="moment.embed.oauth.start"){const s=t;this.emitAnalytics("oauth.start",{provider:s.provider,teamSlug:s.teamSlug}),this.handleOAuthStart(s);return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.resize"){const s=typeof t.height=="number"?t.height:0;if(s>0&&this.iframe){this.lastRequestedHeight=s;const{iframeMaxHeight:r}=this.currentLayout();this.iframe.style.height=`${Z(s,r)}px`}return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.theme"){const s=$e(t);s.design&&s.design!==this.design&&(this.design=s.design,this.applyFrameLayout()),s.cardRadius!==void 0&&(this.cardRadius=s.cardRadius,this.applyFrameLayout()),s.hideCloseButton&&this.closeButton&&(document.activeElement===this.closeButton&&this.container?.focus(),this.closeButton.remove()),s.surface!==void 0&&(this.surface=s.surface,this.applyFrameLayout()),s.dismissByEmbed&&(this.dismissByEmbed=!0),this.reveal();return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.open.url"){const{url:s}=t;if(Te(s)){const r=Ae(window.open(s,"_blank"));r==="blocked"&&this.emitAnalytics("open.url.blocked",{}),this.sendOpenUrlStatus(r,s)}else this.sendOpenUrlStatus("blocked",typeof s=="string"?s:"");return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.dismiss.ack"){this.clearDismissAckTimer();return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.close"){this.handleCancel();return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.celebrate"){this.feedback?.celebrate();return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.toast"){const{text:s,variant:r}=t;typeof s=="string"&&s.trim()!==""&&this.feedback?.toast(s,r);return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.result"){const s=t;this.handleResult(s)}}},window.addEventListener("message",this.messageHandler)}handleOAuthStart(e){this.popupBridge&&(this.popupBridge.cleanup(),this.popupBridge=null),this.popupBridge=new Ce({liveBaseUrl:this.liveBaseUrl,liveOrigin:this.liveOrigin,iframeWindow:this.iframe?.contentWindow??null,campaignId:this.activeCampaignId,onResult:t=>{this.handleResult(t)},onPopupBlocked:()=>{this.emitAnalytics("oauth.popup.blocked",{provider:e.provider})},onPopupClosed:()=>{this.emitAnalytics("oauth.popup.closed",{provider:e.provider})}}),this.popupBridge.open(e)}sendOpenUrlStatus(e,t){const s=this.iframe?.contentWindow;if(!s)return;const r={source:"moment-sdk",type:"moment.embed.open.url.status",status:e,url:t};s.postMessage(r,this.liveOrigin)}handleResult(e){e.result!=="cancelled"&&(e.keepOpen===!0&&e.triggerType!=="schedule"&&(this.closeReported=!0),e.result==="success"||e.result==="partial"?(this.emitAnalytics("subscribe.success",{provider:e.provider,triggerType:e.triggerType,momentIds:e.momentIds}),this.opts.onSuccess?.(e)):e.result==="error"&&(this.emitAnalytics("subscribe.error",{provider:e.provider,triggerType:e.triggerType,momentIds:e.momentIds}),this.opts.onError?.(e)),this.opts.onClose?.(e),this.emitAnalytics("embed.close"),Ne(e)&&(this.closeTimer=setTimeout(()=>this.cleanup(),1500)))}requestDismiss(){const e=this.iframe?.contentWindow;if(!this.dismissByEmbed||this.design!=="v2"||!e){this.handleCancel();return}const t={source:"moment-sdk",type:"moment.sdk.dismiss"};e.postMessage(t,this.liveOrigin),this.dismissAckTimer||(this.dismissAckTimer=setTimeout(()=>this.handleCancel(),ke))}clearDismissAckTimer(){this.dismissAckTimer&&clearTimeout(this.dismissAckTimer),this.dismissAckTimer=null}handleCancel(){if(!this.closeReported){this.emitAnalytics("embed.close");const t={source:"moment-live-embed",type:"moment.embed.result",result:"cancelled",triggerType:this.activePayload?.triggerType??"moment",momentIds:this.activePayload?.ids??[]};this.opts.onClose?.(t)}this.cleanup(!0)}cleanup(e=!1){const t=e&&this.design==="v2"&&this.revealed&&!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;if(this.closeTimer&&(clearTimeout(this.closeTimer),this.closeTimer=null),this.revealTimer&&(clearTimeout(this.revealTimer),this.revealTimer=null),this.clearDismissAckTimer(),this.revealed=!1,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=w,this.dismissByEmbed=!1,this.lastRequestedHeight=null,this.footer=null,this.hairline=null,this.viewportResizeHandler&&(window.removeEventListener("resize",this.viewportResizeHandler),this.viewportResizeHandler=null),this.overlay){const{_escHandler:s,_focusTrapHandler:r}=this.overlay;s&&document.removeEventListener("keydown",s);const o=this.overlay.firstElementChild;if(o&&r&&o.removeEventListener("keydown",r),t){const n=this.overlay;n.style.pointerEvents="none",n.style.width=`${document.documentElement.clientWidth}px`,n.classList.add(x);const a=setTimeout(()=>n.remove(),Re);n.addEventListener("animationend",()=>{clearTimeout(a),n.remove()},{once:!0})}else this.overlay.remove();this.overlay=null}this.iframe=null,this.wrapper=null,this.container=null,this.closeButton=null,this.activePayload=null,this.activeCampaignId=void 0,this.cardRadius=E,this.didManageBodyOverflow&&(document.body.style.overflow=this.previousBodyOverflow,this.didManageBodyOverflow=!1),this.didManageBodyPadding&&(document.body.style.paddingRight=this.previousBodyPaddingRight,this.didManageBodyPadding=!1),this.previousFocusedElement&&typeof this.previousFocusedElement.focus=="function"&&this.previousFocusedElement.focus(),this.previousFocusedElement=null}emitAnalytics(e,t){this.opts.onAnalytics?.({event:e,timestamp:Date.now(),...t})}}function J(i){const e=document.createElement("button");return e.type="button",e.classList.add("moment-sync-trigger"),i.className&&i.className.split(" ").forEach(t=>{t&&e.classList.add(t)}),e.setAttribute("data-moment-team-slug",i.teamSlug),i.momentSlug&&e.setAttribute("data-moment-slug",i.momentSlug),i.listSlug&&e.setAttribute("data-moment-list-slug",i.listSlug),i.triggerType&&e.setAttribute("data-moment-trigger-type",i.triggerType),i.ids?.length&&e.setAttribute("data-moment-ids",i.ids.join(",")),i.playlistSlugs?.length&&e.setAttribute("data-moment-playlist-slugs",i.playlistSlugs.join(",")),i.calendar&&e.setAttribute("data-moment-calendar",i.calendar),i.apiSourceId&&e.setAttribute("data-api-source-id",i.apiSourceId),i.externalEventId&&e.setAttribute("data-external-event-id",i.externalEventId),i.externalEventIdPrefix&&e.setAttribute("data-external-event-id-prefix",i.externalEventIdPrefix),e.textContent=i.label??"Add to Calendar",e}if(typeof window<"u"){const i=window;i.MomentSdk=X,i.createMomentButton=J}S.MomentSdk=X,S.createMomentButton=J,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})})(this.MomentSdk=this.MomentSdk||{});
|
|
69
|
+
`;function Re(){if(typeof document>"u"||document.getElementById(K))return;const i=document.createElement("style");i.id=K,i.textContent=ke,document.head.appendChild(i)}function He(i){return typeof i=="string"&&i.startsWith("webcal://")}function Fe(i){return!i||i.closed?"blocked":"opened"}const Pe=1024,H=600,Be=400,Ne=40,Y=80,V=90,De=420,Ue=520,Z=48,q="#0d0d0d",L="#121316",$e={backgroundColor:q,boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",backdropFilter:"none",webkitBackdropFilter:"none"},X="inset 0 0.5px 0.75px rgb(255 255 255 / 0.6)",We="inset 0 -0.5px 0.75px rgb(255 255 255 / 0.3)",Q=["0 0 0 0.5px #9c9c9c","0 4px 8px 0 #0000001f","0 12px 32px 0 #00000047"],J={backgroundColor:"rgb(19 19 19 / 0.812)",backdropFilter:"blur(14px)",webkitBackdropFilter:"blur(14px)",boxShadow:[X,We,...Q].join(", ")},je={...J,boxShadow:[X,...Q].join(", ")},E=32,ee="height 0.25s cubic-bezier(0.32, 0.72, 0, 1)",Ge=2e3,Ke=500,ze=400,M=12,Ye="2147483647",Ve='button, [href], input, select, textarea, iframe, [tabindex]:not([tabindex="-1"])',te="#38393B",Ze="#4B4B4E",qe={position:"absolute",top:"16px",right:"16px",zIndex:"10",width:"40px",height:"40px",padding:"0",border:"none",borderRadius:"50%",backgroundColor:te,color:"#F5F5F5",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"};function Xe(i,e,t=M,s="v1",r=0,o=L){const n=s==="v2",a=i<Pe,u={showFooter:!n,material:n?"glass":"solid",wrapperMaterial:n?a?je:J:$e,card:{backgroundColor:n?"transparent":o},iframe:n?{background:"transparent",colorScheme:"dark"}:{background:"",colorScheme:""}},g=n?"rgba(0, 0, 0, 0.4)":"rgba(0, 0, 0, 0.5)",d=n?M:t,c=`${d}px ${d}px 0px 0px`;if(a){const l=n?e-Z-r:Math.floor(e*V/100)-E;return{isTray:!0,overlay:{alignItems:"flex-end",padding:"0",backdropFilter:"none",backgroundColor:g},wrapper:{maxWidth:i<H+2*Ne?"none":`${H}px`,minWidth:"0",borderRadius:c,paddingBottom:"env(safe-area-inset-bottom, 0px)"},container:{maxHeight:n?`calc(100dvh - ${Z}px - env(safe-area-inset-bottom, 0px))`:`calc(${V}dvh - ${E}px)`,borderRadius:c},iframeMaxHeight:l,iframeOpeningHeight:Math.min(De,l),...u}}const m=e-Y;return{isTray:!1,overlay:{alignItems:"center",padding:"16px",backdropFilter:n?"none":"blur(2px)",backgroundColor:g},wrapper:{maxWidth:`${H}px`,minWidth:`${Be}px`,borderRadius:`${d}px`,paddingBottom:"0"},container:{maxHeight:`calc(100vh - ${Y}px)`,borderRadius:c},iframeMaxHeight:m,iframeOpeningHeight:Math.min(Ue,m),...u}}function ie(i,e){return Math.min(i,e)}function Qe(i){return i.triggerType!=="schedule"&&i.keepOpen!==!0}const Je=32;function et(i){const e={hideCloseButton:i.closeControl==="embed",dismissByEmbed:i.dismiss==="embed"};return typeof i.borderRadius=="number"&&Number.isFinite(i.borderRadius)&&(e.cardRadius=Math.max(0,Math.min(i.borderRadius,Je))),typeof i.surface=="string"&&i.surface!==""&&(e.surface=i.surface),(i.design==="v1"||i.design==="v2")&&(e.design=i.design),e}const tt=".moment-sync-trigger",it=6,se=60,st="rgba(255, 255, 255, 0.216)",nt="https://live.dev.momentco.ai";class ne{opts;liveBaseUrl;liveOrigin;overlay=null;iframe=null;wrapper=null;container=null;closeButton=null;popupBridge=null;messageHandler=null;boundClickHandlers=new Map;activePayload=null;activeCampaignId;previousFocusedElement=null;previousBodyOverflow="";didManageBodyOverflow=!1;previousBodyPaddingRight="";didManageBodyPadding=!1;closeTimer=null;revealed=!1;revealTimer=null;dismissAckTimer=null;cardRadius=M;design="v1";surface=L;dismissByEmbed=!1;lastRequestedHeight=null;footer=null;hairline=null;viewportResizeHandler=null;feedback=null;closeReported=!1;constructor(e){this.opts={triggerSelector:tt,...e},this.liveBaseUrl=nt;try{this.liveOrigin=new URL(this.liveBaseUrl).origin}catch{throw new Error(`[MomentSdk] Invalid VITE_LIVE_BASE_URL: "${this.liveBaseUrl}"`)}Re(),this.bindTriggers(),this.emitAnalytics("embed.init"),this.opts.autoOpen&&this.autoOpenFromUrl(this.opts.autoOpen.teamSlug)}open(e){this.openWith(e)}close(){this.handleCancel()}rebind(){this.unbindTriggers(),this.bindTriggers()}destroy(){this.cleanup(),this.unbindTriggers()}openWith(e,t){if(this.overlay&&!this.revealed)return;e.externalEventId&&e.externalEventIdPrefix&&console.warn("[MomentSdk] Both externalEventId and externalEventIdPrefix provided; using externalEventId only.");const s=this.scopeOpenPayload(e);this.emitAnalytics("embed.open",{teamSlug:s.teamSlug,triggerType:s.triggerType,...t?{triggerSource:"url"}:{}}),this.createModal(s,t)}autoOpenFromUrl(e){if(!ce())return;const t=de(window.location.href,e);t&&ue(document,()=>{this.openWith(t.payload,t),history.replaceState(history.state,"",t.cleanUrl)})}bindTriggers(){document.querySelectorAll(this.opts.triggerSelector).forEach(t=>{const s=o=>{o.preventDefault(),this.handleTriggerClick(t)},r=this.boundClickHandlers.get(t);r&&t.removeEventListener("click",r),t.addEventListener("click",s),this.boundClickHandlers.set(t,s)})}unbindTriggers(){this.boundClickHandlers.forEach((e,t)=>{t.removeEventListener("click",e)}),this.boundClickHandlers.clear()}handleTriggerClick(e){const t=e.getAttribute("data-moment-team-slug")??"",s=e.getAttribute("data-moment-slug")??void 0,r=e.getAttribute("data-moment-list-slug")??void 0,o=e.getAttribute("data-moment-trigger-type");let n="moment";o!=null&&o!==""&&(o==="moment"||o==="list"||o==="team"||o==="brand-playlist"||o==="playlist"||o==="schedule"?n=o:console.warn("[MomentSdk] Invalid data-moment-trigger-type, falling back to 'moment':",o));const a=e.getAttribute("data-moment-ids")??e.getAttribute("data-moment-game-id")??"",h=a?a.split(",").filter(Boolean):[],u=e.getAttribute("data-moment-playlist-slugs")??"",g=u?u.split(",").map(x=>x.trim()).filter(Boolean):[],d=e.getAttribute("data-moment-calendar");let c;d!=null&&d!==""&&(d==="google"||d==="outlook"?c=d:console.warn("[MomentSdk] Invalid data-moment-calendar, ignoring value:",d));const m=e.getAttribute("data-api-source-id")??void 0,l=e.getAttribute("data-external-event-id")??void 0,f=e.getAttribute("data-external-event-id-prefix")??void 0;if(l&&f&&console.warn("[MomentSdk] Both data-external-event-id and data-external-event-id-prefix are set; using data-external-event-id only."),!t){console.warn("[MomentSdk] Missing data-moment-team-slug on trigger element");return}const C=n==="team"||n==="brand-playlist"||n==="playlist"||n==="schedule";this.emitAnalytics("embed.trigger.click",{teamSlug:t,triggerType:n,momentIds:C?[]:h}),this.open({teamSlug:t,momentSlug:s,listSlug:r,triggerType:n,ids:h,playlistSlugs:g,calendar:c??void 0,apiSourceId:m,externalEventId:f&&!l?void 0:l,externalEventIdPrefix:l?void 0:f})}scopeOpenPayload(e){return e.triggerType==="schedule"?{teamSlug:e.teamSlug,triggerType:e.triggerType}:e.triggerType==="playlist"?{teamSlug:e.teamSlug,triggerType:e.triggerType,playlistSlugs:e.playlistSlugs,calendar:e.calendar}:e.triggerType==="team"||e.triggerType==="brand-playlist"?{teamSlug:e.teamSlug,triggerType:e.triggerType,calendar:e.calendar}:e}createModal(e,t){this.cleanup(),this.previousFocusedElement=document.activeElement||null,this.activePayload=e,this.activeCampaignId=t?.campaignId;const s=this.buildIframeUrl(e,t);this.overlay=document.createElement("div"),this.overlay.setAttribute("role","presentation"),Object.assign(this.overlay.style,{position:"fixed",inset:"0",zIndex:Ye,display:"flex",justifyContent:"center",visibility:"hidden"}),this.overlay.addEventListener("click",p=>{p.target===this.overlay&&this.requestDismiss()});const r=p=>{p.key==="Escape"&&this.requestDismiss()};document.addEventListener("keydown",r);const o=document.createElement("div");Object.assign(o.style,{position:"relative",width:"100%",transition:"border-radius 0.3s ease",overflow:"hidden",backgroundColor:q,boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",display:"flex",flexDirection:"column"});const n=document.createElement("div");n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true"),n.setAttribute("aria-label","Calendar sync modal"),n.tabIndex=-1,Object.assign(n.style,{position:"relative",width:"100%",transition:"border-radius 0.3s ease",overflow:"auto",backgroundColor:L,outline:"none"});const a=document.createElement("button");a.type="button",a.className=z,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,qe),a.addEventListener("mouseenter",()=>{a.style.backgroundColor=Ze}),a.addEventListener("mouseleave",()=>{a.style.backgroundColor=te}),a.addEventListener("click",()=>this.handleCancel());const h=e.triggerType!=="schedule";this.iframe=document.createElement("iframe"),this.iframe.src=s,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,{width:"100%",border:"none",display:"block",overflow:"hidden",transition:ee}),h&&(n.appendChild(a),this.closeButton=a),n.appendChild(this.iframe);const u=document.createElement("div");this.footer=u,Object.assign(u.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:`${it}px`,height:`${E}px`,flexShrink:"0",boxSizing:"border-box",padding:"0"});const g=document.createElement("span");g.textContent="Powered by",Object.assign(g.style,{fontFamily:"Inter, system-ui, -apple-system, sans-serif",fontSize:"12px",lineHeight:"16px",color:"#ffffff"});const d=document.createElement("img");d.alt="Moment",d.src=me,Object.assign(d.style,{display:"block",width:`${se}px`,height:`${(se/he).toFixed(2)}px`}),u.appendChild(g),u.appendChild(d),this.wrapper=o,this.container=n,this.applyFrameLayout();const c=document.createElement("div");this.hairline=c,c.setAttribute("aria-hidden","true"),Object.assign(c.style,{position:"absolute",inset:"0",borderRadius:"inherit",boxShadow:`inset 0 0 0 1px ${st}`,pointerEvents:"none",zIndex:"2"}),o.appendChild(n),o.appendChild(u),o.appendChild(c),this.overlay.appendChild(o),this.feedback=Ie(this.overlay,o),document.body.appendChild(this.overlay),this.revealTimer=setTimeout(()=>this.reveal(),Ge),this.viewportResizeHandler=()=>this.applyFrameLayout(),window.addEventListener("resize",this.viewportResizeHandler);const m=()=>n.querySelectorAll(Ve),l=p=>{if(p.key!=="Tab")return;const y=m(),b=y[0],w=y[y.length-1],T=document.activeElement;p.shiftKey&&(T===b||T===n)?(p.preventDefault(),w.focus()):!p.shiftKey&&T===w&&(p.preventDefault(),b.focus())};n.addEventListener("keydown",l);const f=p=>{const y=document.createElement("span");return y.tabIndex=0,Object.assign(y.style,{position:"fixed",opacity:"0"}),y.addEventListener("focus",()=>{const b=m();b[p==="first"?0:b.length-1].focus()}),y};n.before(f("last")),n.after(f("first"));const C=document.documentElement.clientWidth;this.previousBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.didManageBodyOverflow=!0;const x=document.documentElement.clientWidth-C;if(x>0){this.previousBodyPaddingRight=document.body.style.paddingRight;const p=Number.parseFloat(getComputedStyle(document.body).paddingRight)||0;document.body.style.paddingRight=`${p+x}px`,this.didManageBodyPadding=!0}this.setupMessageListener(),this.overlay._escHandler=r,this.overlay._focusTrapHandler=l}reveal(){this.revealed||!this.overlay||(this.revealTimer&&clearTimeout(this.revealTimer),this.revealTimer=null,this.revealed=!0,this.overlay.style.visibility="",this.applyFrameLayout(),this.container?.focus())}applyFrameLayout(){if(!this.overlay||!this.wrapper||!this.container||!this.iframe)return;Object.assign(this.wrapper.style,this.currentLayout().wrapper);const e=this.currentLayout();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);const t=this.footer?.style.display!=="none";if(this.footer&&this.revealed&&t!==e.showFooter){const o=this.iframe.offsetHeight;this.iframe.style.transition="none",this.iframe.style.height=`${o+(t?E:-E)}px`,this.iframe.offsetHeight,this.iframe.style.transition=ee}this.footer&&(this.footer.style.display=e.showFooter?"flex":"none"),this.hairline&&(this.hairline.style.display=e.material==="glass"?"none":""),this.wrapper.classList.toggle(R,e.isTray&&this.revealed);const s=Number.parseFloat(this.iframe.style.height),r=this.lastRequestedHeight!==null?ie(this.lastRequestedHeight,e.iframeMaxHeight):Number.isNaN(s)?e.iframeOpeningHeight:Math.min(s,e.iframeMaxHeight);this.iframe.style.height=`${r}px`}currentLayout(){const e=this.wrapper&&Number.parseFloat(getComputedStyle(this.wrapper).paddingBottom)||0;return Xe(window.innerWidth,window.innerHeight,this.cardRadius,this.design,e,this.surface)}buildIframeUrl(e,t){return Le(this.liveBaseUrl,e,void 0,t)}setupMessageListener(){this.messageHandler=e=>{if(e.origin!==this.liveOrigin||e.source!==this.iframe?.contentWindow)return;const t=e.data;if(!(!t||typeof t!="object")){if(t.source==="moment-live-embed"&&t.type==="moment.embed.oauth.start"){const s=t;this.emitAnalytics("oauth.start",{provider:s.provider,teamSlug:s.teamSlug}),this.handleOAuthStart(s);return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.resize"){const s=typeof t.height=="number"?t.height:0;if(s>0&&this.iframe){this.lastRequestedHeight=s;const{iframeMaxHeight:r}=this.currentLayout();this.iframe.style.height=`${ie(s,r)}px`}return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.theme"){const s=et(t);s.design&&s.design!==this.design&&(this.design=s.design,this.applyFrameLayout()),s.cardRadius!==void 0&&(this.cardRadius=s.cardRadius,this.applyFrameLayout()),s.hideCloseButton&&this.closeButton&&(document.activeElement===this.closeButton&&this.container?.focus(),this.closeButton.remove()),s.surface!==void 0&&(this.surface=s.surface,this.applyFrameLayout()),s.dismissByEmbed&&(this.dismissByEmbed=!0),this.reveal();return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.open.url"){const{url:s}=t;if(He(s)){const r=Fe(window.open(s,"_blank"));r==="blocked"&&this.emitAnalytics("open.url.blocked",{}),this.sendOpenUrlStatus(r,s)}else this.sendOpenUrlStatus("blocked",typeof s=="string"?s:"");return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.dismiss.ack"){this.clearDismissAckTimer();return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.close"){this.handleCancel();return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.celebrate"){this.feedback?.celebrate();return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.toast"){const{text:s,variant:r}=t;typeof s=="string"&&s.trim()!==""&&this.feedback?.toast(s,r);return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.result"){const s=t;this.handleResult(s)}}},window.addEventListener("message",this.messageHandler)}handleOAuthStart(e){this.popupBridge&&(this.popupBridge.cleanup(),this.popupBridge=null),this.popupBridge=new _e({liveBaseUrl:this.liveBaseUrl,liveOrigin:this.liveOrigin,iframeWindow:this.iframe?.contentWindow??null,campaignId:this.activeCampaignId,onResult:t=>{this.handleResult(t)},onPopupBlocked:()=>{this.emitAnalytics("oauth.popup.blocked",{provider:e.provider})},onPopupClosed:()=>{this.emitAnalytics("oauth.popup.closed",{provider:e.provider})}}),this.popupBridge.open(e)}sendOpenUrlStatus(e,t){const s=this.iframe?.contentWindow;if(!s)return;const r={source:"moment-sdk",type:"moment.embed.open.url.status",status:e,url:t};s.postMessage(r,this.liveOrigin)}handleResult(e){e.result!=="cancelled"&&(e.keepOpen===!0&&e.triggerType!=="schedule"&&(this.closeReported=!0),e.result==="success"||e.result==="partial"?(this.emitAnalytics("subscribe.success",{provider:e.provider,triggerType:e.triggerType,momentIds:e.momentIds}),this.opts.onSuccess?.(e)):e.result==="error"&&(this.emitAnalytics("subscribe.error",{provider:e.provider,triggerType:e.triggerType,momentIds:e.momentIds}),this.opts.onError?.(e)),this.opts.onClose?.(e),this.emitAnalytics("embed.close"),Qe(e)&&(this.closeTimer=setTimeout(()=>this.cleanup(),1500)))}requestDismiss(){const e=this.iframe?.contentWindow;if(!this.dismissByEmbed||this.design!=="v2"||!e){this.handleCancel();return}const t={source:"moment-sdk",type:"moment.sdk.dismiss"};e.postMessage(t,this.liveOrigin),this.dismissAckTimer||(this.dismissAckTimer=setTimeout(()=>this.handleCancel(),Ke))}clearDismissAckTimer(){this.dismissAckTimer&&clearTimeout(this.dismissAckTimer),this.dismissAckTimer=null}handleCancel(){if(!this.closeReported){this.emitAnalytics("embed.close");const t={source:"moment-live-embed",type:"moment.embed.result",result:"cancelled",triggerType:this.activePayload?.triggerType??"moment",momentIds:this.activePayload?.ids??[]};this.opts.onClose?.(t)}this.cleanup(!0)}cleanup(e=!1){const t=e&&this.design==="v2"&&this.revealed&&!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;if(this.closeTimer&&(clearTimeout(this.closeTimer),this.closeTimer=null),this.revealTimer&&(clearTimeout(this.revealTimer),this.revealTimer=null),this.clearDismissAckTimer(),this.revealed=!1,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=L,this.dismissByEmbed=!1,this.lastRequestedHeight=null,this.footer=null,this.hairline=null,this.viewportResizeHandler&&(window.removeEventListener("resize",this.viewportResizeHandler),this.viewportResizeHandler=null),this.overlay){const{_escHandler:s,_focusTrapHandler:r}=this.overlay;s&&document.removeEventListener("keydown",s);const o=this.overlay.firstElementChild;if(o&&r&&o.removeEventListener("keydown",r),t){const n=this.overlay;n.style.pointerEvents="none",n.style.width=`${document.documentElement.clientWidth}px`,n.classList.add(I);const a=setTimeout(()=>n.remove(),ze);n.addEventListener("animationend",()=>{clearTimeout(a),n.remove()},{once:!0})}else this.overlay.remove();this.overlay=null}this.iframe=null,this.wrapper=null,this.container=null,this.closeButton=null,this.activePayload=null,this.activeCampaignId=void 0,this.cardRadius=M,this.didManageBodyOverflow&&(document.body.style.overflow=this.previousBodyOverflow,this.didManageBodyOverflow=!1),this.didManageBodyPadding&&(document.body.style.paddingRight=this.previousBodyPaddingRight,this.didManageBodyPadding=!1),this.previousFocusedElement&&typeof this.previousFocusedElement.focus=="function"&&this.previousFocusedElement.focus(),this.previousFocusedElement=null}emitAnalytics(e,t){this.opts.onAnalytics?.({event:e,timestamp:Date.now(),...t})}}function re(i){const e=document.createElement("button");return e.type="button",e.classList.add("moment-sync-trigger"),i.className&&i.className.split(" ").forEach(t=>{t&&e.classList.add(t)}),e.setAttribute("data-moment-team-slug",i.teamSlug),i.momentSlug&&e.setAttribute("data-moment-slug",i.momentSlug),i.listSlug&&e.setAttribute("data-moment-list-slug",i.listSlug),i.triggerType&&e.setAttribute("data-moment-trigger-type",i.triggerType),i.ids?.length&&e.setAttribute("data-moment-ids",i.ids.join(",")),i.playlistSlugs?.length&&e.setAttribute("data-moment-playlist-slugs",i.playlistSlugs.join(",")),i.calendar&&e.setAttribute("data-moment-calendar",i.calendar),i.apiSourceId&&e.setAttribute("data-api-source-id",i.apiSourceId),i.externalEventId&&e.setAttribute("data-external-event-id",i.externalEventId),i.externalEventIdPrefix&&e.setAttribute("data-external-event-id-prefix",i.externalEventIdPrefix),e.textContent=i.label??"Add to Calendar",e}if(typeof window<"u"){const i=window;i.MomentSdk=ne,i.createMomentButton=re}k.MomentSdk=ne,k.createMomentButton=re,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})})(this.MomentSdk=this.MomentSdk||{});
|
package/dist/moment-sdk.mjs
CHANGED
|
@@ -1,37 +1,43 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
function
|
|
1
|
+
const B = "moment_sync", P = "moment_campaign";
|
|
2
|
+
const ue = /^(?:schedule|(moment|list):([a-z0-9-]+)|playlist:([a-z0-9-]+(?:,[a-z0-9-]+)*))$/, me = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
3
|
+
function he(i, e) {
|
|
4
4
|
if (!e) return null;
|
|
5
|
-
const t = new URL(i), s = t.searchParams.get(
|
|
5
|
+
const t = new URL(i), s = t.searchParams.get(B);
|
|
6
6
|
if (s === null || s.length > 200) return null;
|
|
7
|
-
const r =
|
|
7
|
+
const r = ue.exec(s);
|
|
8
8
|
if (!r) return null;
|
|
9
9
|
const [, o, n, a] = r;
|
|
10
10
|
let h;
|
|
11
11
|
o === "moment" ? h = { teamSlug: e, triggerType: "moment", momentSlug: n } : o === "list" ? h = { teamSlug: e, triggerType: "list", listSlug: n } : a ? h = { teamSlug: e, triggerType: "playlist", playlistSlugs: a.split(",") } : h = { teamSlug: e, triggerType: "schedule" };
|
|
12
|
-
const u = t.searchParams.get(
|
|
12
|
+
const u = t.searchParams.get(P);
|
|
13
13
|
return t.search = t.search.slice(1).split("&").filter((g) => {
|
|
14
|
-
const
|
|
15
|
-
return
|
|
14
|
+
const d = g.split("=", 1)[0];
|
|
15
|
+
return d !== B && d !== P;
|
|
16
16
|
}).join("&"), {
|
|
17
17
|
payload: h,
|
|
18
|
-
...u &&
|
|
18
|
+
...u && me.test(u) ? { campaignId: u } : {},
|
|
19
19
|
cleanUrl: t.href
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
let
|
|
23
|
-
function
|
|
24
|
-
return
|
|
22
|
+
let N = !1;
|
|
23
|
+
function pe() {
|
|
24
|
+
return N ? !1 : (N = !0, !0);
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function fe(i, e) {
|
|
27
27
|
i.body ? e() : i.addEventListener("DOMContentLoaded", e, { once: !0 });
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
const ge = "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", Ce = 120.52 / 21.28, ye = 4e3, be = 80, D = ["#f04a34", "#041abe", "#041139", "#1cd4ed", "#b8e070"], ve = 260, U = { x: 0.5, y: 0.7 }, Te = [
|
|
30
|
+
{ share: 0.25, spread: 26, velocity: 55, decay: 0.91, scalar: 1 },
|
|
31
|
+
{ share: 0.2, spread: 60, velocity: 45, decay: 0.91, scalar: 1 },
|
|
32
|
+
{ share: 0.35, spread: 100, velocity: 45, decay: 0.91, scalar: 0.8 },
|
|
33
|
+
{ share: 0.1, spread: 120, velocity: 25, decay: 0.92, scalar: 1.2 },
|
|
34
|
+
{ share: 0.1, spread: 120, velocity: 45, decay: 0.91, scalar: 1 }
|
|
35
|
+
], xe = 3, Ae = 0.2, Ee = 200, we = 1e3 / 60, Se = 4, Ie = 0.75, Le = "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", Me = "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", _e = "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", Oe = "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", $ = {
|
|
36
|
+
success: { fill: "#1c1d22", glyph: "#fafafc", path: Le },
|
|
37
|
+
info: { fill: "#146eaa", glyph: "#ffffff", path: Me },
|
|
38
|
+
warning: { fill: "#aa4e19", glyph: "#ffffff", path: _e },
|
|
39
|
+
error: { fill: "#c62734", glyph: "#ffffff", path: Oe }
|
|
40
|
+
}, ke = {
|
|
35
41
|
position: "absolute",
|
|
36
42
|
top: "calc(56px + env(safe-area-inset-top, 0px))",
|
|
37
43
|
left: "0",
|
|
@@ -54,7 +60,7 @@ const ie = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox
|
|
|
54
60
|
lineHeight: "20px",
|
|
55
61
|
fontWeight: "400",
|
|
56
62
|
overflowWrap: "anywhere"
|
|
57
|
-
},
|
|
63
|
+
}, Re = {
|
|
58
64
|
display: "flex",
|
|
59
65
|
alignItems: "center",
|
|
60
66
|
justifyContent: "center",
|
|
@@ -63,7 +69,7 @@ const ie = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox
|
|
|
63
69
|
height: "28px",
|
|
64
70
|
margin: "2px",
|
|
65
71
|
borderRadius: "50%"
|
|
66
|
-
},
|
|
72
|
+
}, He = {
|
|
67
73
|
position: "absolute",
|
|
68
74
|
width: "1px",
|
|
69
75
|
height: "1px",
|
|
@@ -74,12 +80,12 @@ const ie = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox
|
|
|
74
80
|
clipPath: "inset(50%)",
|
|
75
81
|
whiteSpace: "nowrap"
|
|
76
82
|
};
|
|
77
|
-
function
|
|
83
|
+
function A(i, e) {
|
|
78
84
|
const t = document.createElement(i);
|
|
79
85
|
return Object.assign(t.style, e), t;
|
|
80
86
|
}
|
|
81
|
-
function
|
|
82
|
-
const t =
|
|
87
|
+
function Fe(i, e) {
|
|
88
|
+
const t = A("div", {
|
|
83
89
|
position: "absolute",
|
|
84
90
|
inset: "0",
|
|
85
91
|
overflow: "hidden",
|
|
@@ -87,85 +93,92 @@ function fe(i, e) {
|
|
|
87
93
|
zIndex: "1"
|
|
88
94
|
});
|
|
89
95
|
t.setAttribute("aria-hidden", "true"), i.appendChild(t);
|
|
90
|
-
const s =
|
|
96
|
+
const s = A("span", He);
|
|
91
97
|
s.setAttribute("role", "status"), (e.querySelector('[role="dialog"]') ?? e).appendChild(s);
|
|
92
98
|
let r = null, o = null, n = null, a = null;
|
|
93
99
|
const h = () => {
|
|
94
100
|
o && clearTimeout(o), o = null, a?.(), a = null, r?.remove(), r = null, s.textContent = "";
|
|
95
|
-
}, u = (
|
|
96
|
-
const
|
|
97
|
-
a = null, s.textContent =
|
|
101
|
+
}, u = (c) => {
|
|
102
|
+
const m = () => {
|
|
103
|
+
a = null, s.textContent = c;
|
|
98
104
|
};
|
|
99
105
|
if (typeof requestAnimationFrame == "function") {
|
|
100
|
-
const
|
|
101
|
-
a = () => cancelAnimationFrame(
|
|
106
|
+
const l = requestAnimationFrame(m);
|
|
107
|
+
a = () => cancelAnimationFrame(l);
|
|
102
108
|
} else {
|
|
103
|
-
const
|
|
104
|
-
a = () => clearTimeout(
|
|
109
|
+
const l = setTimeout(m, 0);
|
|
110
|
+
a = () => clearTimeout(l);
|
|
105
111
|
}
|
|
106
|
-
}, g = () => {
|
|
112
|
+
}, g = ({ spread: c, velocity: m, decay: l, scalar: f }, C, x, p) => {
|
|
113
|
+
const y = (4 + Math.random() * 6) * f, b = A("span", {
|
|
114
|
+
position: "absolute",
|
|
115
|
+
left: `${x}px`,
|
|
116
|
+
top: `${p}px`,
|
|
117
|
+
width: `${y}px`,
|
|
118
|
+
height: `${y * (0.5 + Math.random())}px`,
|
|
119
|
+
borderRadius: Math.random() < 0.5 ? "50%" : "1px",
|
|
120
|
+
backgroundColor: C
|
|
121
|
+
});
|
|
122
|
+
b.setAttribute("data-moment-confetti", ""), t.appendChild(b);
|
|
123
|
+
const E = -Math.PI / 2 + (Math.random() - 0.5) * c * Math.PI / 180;
|
|
124
|
+
let T = m * (0.5 + Math.random());
|
|
125
|
+
const ne = (Math.random() * 2 - 1) * Ae, re = (0.25 + Math.random() * 0.5) * Math.PI, oe = Math.random() < 0.5 ? 0.1 : -0.1, ae = Math.random() * 10, le = Math.min(0.11, 0.05 + Math.random() * 0.1), I = [{ tick: 0, x: 0, y: 0 }];
|
|
126
|
+
let [v, k, L] = [0, 0, 0];
|
|
127
|
+
do
|
|
128
|
+
k += Math.cos(E) * T + ne, L += Math.sin(E) * T + xe, T *= l, v++, v % Se === 0 && I.push({ tick: v, x: k, y: L });
|
|
129
|
+
while (v < Ee || L < 1);
|
|
130
|
+
I.at(-1).tick !== v && I.push({ tick: v, x: k, y: L }), b.animate(
|
|
131
|
+
I.map((w) => {
|
|
132
|
+
const F = w.tick / v, de = (re + w.tick * oe) * 180 / Math.PI, ce = Math.cos(ae + w.tick * le);
|
|
133
|
+
return {
|
|
134
|
+
offset: F,
|
|
135
|
+
transform: `translate(${w.x.toFixed(1)}px, ${w.y.toFixed(1)}px) rotate(${de.toFixed(0)}deg) scaleY(${ce.toFixed(2)})`,
|
|
136
|
+
opacity: Math.min(1, (1 - F) / (1 - Ie))
|
|
137
|
+
};
|
|
138
|
+
}),
|
|
139
|
+
{ duration: v * we, fill: "both" }
|
|
140
|
+
).onfinish = () => b.remove();
|
|
141
|
+
}, d = () => {
|
|
107
142
|
n = null;
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
top: `${d}px`,
|
|
114
|
-
width: `${m}px`,
|
|
115
|
-
height: `${m * (0.5 + Math.random())}px`,
|
|
116
|
-
borderRadius: c % 3 === 0 ? "50%" : "1px",
|
|
117
|
-
backgroundColor: R[c % R.length]
|
|
118
|
-
});
|
|
119
|
-
f.setAttribute("data-moment-confetti", ""), t.appendChild(f);
|
|
120
|
-
const v = d * (0.35 + Math.random() * 0.55), b = (Math.random() - 0.5) * 120, p = (Math.random() - 0.5) * 1080;
|
|
121
|
-
f.animate(
|
|
122
|
-
[
|
|
123
|
-
{ transform: "translate(0px, 0px) rotate(0deg)", opacity: 1 },
|
|
124
|
-
{ opacity: 1, offset: 0.6 },
|
|
125
|
-
{ transform: `translate(${b}px, ${-v}px) rotate(${p}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 = () => f.remove();
|
|
134
|
-
}
|
|
143
|
+
const c = window.innerWidth * U.x, m = window.innerHeight * U.y;
|
|
144
|
+
let l = 0;
|
|
145
|
+
for (const f of Te)
|
|
146
|
+
for (let C = Math.floor(be * f.share); C > 0; C--)
|
|
147
|
+
g(f, D[l++ % D.length], c, m);
|
|
135
148
|
};
|
|
136
149
|
return {
|
|
137
150
|
celebrate() {
|
|
138
|
-
window.matchMedia?.("(prefers-reduced-motion: reduce)").matches || typeof t.animate != "function" || n || (n = setTimeout(
|
|
151
|
+
window.matchMedia?.("(prefers-reduced-motion: reduce)").matches || typeof t.animate != "function" || n || (n = setTimeout(d, ve));
|
|
139
152
|
},
|
|
140
|
-
toast(
|
|
153
|
+
toast(c, m = "success") {
|
|
141
154
|
h();
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
|
|
155
|
+
const l = $[Object.hasOwn($, m) ? m : "success"], f = A("span", { ...Re, backgroundColor: l.fill, color: l.glyph });
|
|
156
|
+
f.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="${l.path}"/></svg>`;
|
|
157
|
+
const C = A("span", { minWidth: "0" });
|
|
158
|
+
C.textContent = c, r = A("div", ke), r.setAttribute("data-moment-toast", ""), r.appendChild(f), r.appendChild(C), t.appendChild(r), u(c), o = setTimeout(h, ye);
|
|
146
159
|
},
|
|
147
160
|
destroy() {
|
|
148
161
|
n && clearTimeout(n), n = null, h(), t.remove(), s.remove();
|
|
149
162
|
}
|
|
150
163
|
};
|
|
151
164
|
}
|
|
152
|
-
function
|
|
165
|
+
function X() {
|
|
153
166
|
if (typeof window > "u") return "";
|
|
154
167
|
const i = window.location.origin, e = i === "null" ? self.origin : i;
|
|
155
168
|
return e === "null" && console.error(
|
|
156
169
|
'[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.'
|
|
157
170
|
), e;
|
|
158
171
|
}
|
|
159
|
-
function
|
|
172
|
+
function Be(i, e, t = X(), s) {
|
|
160
173
|
if (e.triggerType === "schedule") {
|
|
161
174
|
const o = new URLSearchParams();
|
|
162
|
-
return o.set("teamSlug", e.teamSlug), o.set("returnOrigin", t), o.set("embed", "1"), o.set("sdkVersion", "0.9.0-dev.
|
|
175
|
+
return o.set("teamSlug", e.teamSlug), o.set("returnOrigin", t), o.set("embed", "1"), o.set("sdkVersion", "0.9.0-dev.52"), s && (o.set("entry", "link"), s.campaignId && o.set("campaignId", s.campaignId)), `${i}/en/embed/schedule?${o.toString()}`;
|
|
163
176
|
}
|
|
164
177
|
const r = new URLSearchParams();
|
|
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.
|
|
178
|
+
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.52"), s && (r.set("entry", "link"), s.campaignId && r.set("campaignId", s.campaignId)), `${i}/en/embed/sync?${r.toString()}`;
|
|
166
179
|
}
|
|
167
|
-
const
|
|
168
|
-
class
|
|
180
|
+
const W = 500, j = 700, Pe = 500;
|
|
181
|
+
class Ne {
|
|
169
182
|
popup = null;
|
|
170
183
|
pollTimer = null;
|
|
171
184
|
messageHandler = null;
|
|
@@ -179,11 +192,11 @@ class be {
|
|
|
179
192
|
*/
|
|
180
193
|
open(e) {
|
|
181
194
|
this.cleanup(), this.resultReceived = !1;
|
|
182
|
-
const t = this.buildPopupUrl(e), s = Math.round(window.screenX + (window.outerWidth -
|
|
195
|
+
const t = this.buildPopupUrl(e), s = Math.round(window.screenX + (window.outerWidth - W) / 2), r = Math.round(window.screenY + (window.outerHeight - j) / 2);
|
|
183
196
|
if (this.popup = window.open(
|
|
184
197
|
t,
|
|
185
198
|
"moment-oauth-popup",
|
|
186
|
-
`width=${
|
|
199
|
+
`width=${W},height=${j},left=${s},top=${r},menubar=no,toolbar=no,location=yes,status=no`
|
|
187
200
|
), !this.popup || this.popup.closed) {
|
|
188
201
|
this.sendStatusToIframe("popup-blocked"), this.opts.onPopupBlocked();
|
|
189
202
|
return;
|
|
@@ -206,13 +219,13 @@ class be {
|
|
|
206
219
|
this.popup = null;
|
|
207
220
|
}
|
|
208
221
|
buildPopupUrl(e) {
|
|
209
|
-
const t =
|
|
222
|
+
const t = De(e, X());
|
|
210
223
|
return this.opts.campaignId && t.set("campaignId", this.opts.campaignId), `${this.opts.liveBaseUrl}/en/embed/oauth-popup?${t.toString()}`;
|
|
211
224
|
}
|
|
212
225
|
startPolling() {
|
|
213
226
|
this.pollTimer = setInterval(() => {
|
|
214
227
|
(!this.popup || this.popup.closed) && (this.pollTimer && (clearInterval(this.pollTimer), this.pollTimer = null), this.resultReceived || (this.sendStatusToIframe("popup-closed"), this.opts.onPopupClosed()), this.cleanup());
|
|
215
|
-
},
|
|
228
|
+
}, Pe);
|
|
216
229
|
}
|
|
217
230
|
sendStatusToIframe(e) {
|
|
218
231
|
if (!this.opts.iframeWindow) return;
|
|
@@ -224,7 +237,7 @@ class be {
|
|
|
224
237
|
this.opts.iframeWindow.postMessage(t, this.opts.liveOrigin);
|
|
225
238
|
}
|
|
226
239
|
}
|
|
227
|
-
function
|
|
240
|
+
function De(i, e) {
|
|
228
241
|
const t = new URLSearchParams({
|
|
229
242
|
provider: i.provider,
|
|
230
243
|
teamSlug: i.teamSlug,
|
|
@@ -242,7 +255,7 @@ function ye(i, e) {
|
|
|
242
255
|
o?.length && t.set(r, o.join(","));
|
|
243
256
|
return i.addons?.length && t.set("addons", i.addons.join(",")), i.intent === "connect" && t.set("intent", "connect"), t;
|
|
244
257
|
}
|
|
245
|
-
const
|
|
258
|
+
const G = "moment-sdk-styles", Q = "moment-sdk-close", H = "moment-sdk-tray", M = "moment-sdk-closing", Ue = `
|
|
246
259
|
:where(.moment-sync-trigger) {
|
|
247
260
|
background-color: #1c1917;
|
|
248
261
|
color: #ffffff;
|
|
@@ -267,7 +280,7 @@ const F = "moment-sdk-styles", z = "moment-sdk-close", I = "moment-sdk-tray", A
|
|
|
267
280
|
outline-offset: 2px;
|
|
268
281
|
}
|
|
269
282
|
|
|
270
|
-
.${
|
|
283
|
+
.${Q}:focus-visible {
|
|
271
284
|
outline: 2px solid #ffffff;
|
|
272
285
|
outline-offset: 0;
|
|
273
286
|
box-shadow: 0 0 0 4px #121316;
|
|
@@ -294,52 +307,52 @@ const F = "moment-sdk-styles", z = "moment-sdk-close", I = "moment-sdk-tray", A
|
|
|
294
307
|
}
|
|
295
308
|
|
|
296
309
|
@media (prefers-reduced-motion: no-preference) {
|
|
297
|
-
.${
|
|
310
|
+
.${H} {
|
|
298
311
|
animation: moment-sdk-tray-in 0.35s cubic-bezier(0.32, 0.72, 0, 1);
|
|
299
312
|
}
|
|
300
313
|
|
|
301
|
-
.${
|
|
314
|
+
.${M} {
|
|
302
315
|
animation: moment-sdk-dim-out 0.25s ease-in forwards;
|
|
303
316
|
}
|
|
304
317
|
|
|
305
|
-
.${
|
|
318
|
+
.${M} > * {
|
|
306
319
|
animation: moment-sdk-fade-out 0.25s ease-in forwards;
|
|
307
320
|
}
|
|
308
321
|
|
|
309
|
-
.${
|
|
322
|
+
.${M} .${H} {
|
|
310
323
|
animation: moment-sdk-tray-out 0.25s cubic-bezier(0.32, 0.72, 0, 1) forwards;
|
|
311
324
|
}
|
|
312
325
|
}
|
|
313
326
|
`;
|
|
314
|
-
function
|
|
315
|
-
if (typeof document > "u" || document.getElementById(
|
|
327
|
+
function $e() {
|
|
328
|
+
if (typeof document > "u" || document.getElementById(G)) return;
|
|
316
329
|
const i = document.createElement("style");
|
|
317
|
-
i.id =
|
|
330
|
+
i.id = G, i.textContent = Ue, document.head.appendChild(i);
|
|
318
331
|
}
|
|
319
|
-
function
|
|
332
|
+
function We(i) {
|
|
320
333
|
return typeof i == "string" && i.startsWith("webcal://");
|
|
321
334
|
}
|
|
322
|
-
function
|
|
335
|
+
function je(i) {
|
|
323
336
|
return !i || i.closed ? "blocked" : "opened";
|
|
324
337
|
}
|
|
325
|
-
const
|
|
326
|
-
backgroundColor:
|
|
338
|
+
const Ge = 1024, R = 600, Ke = 400, ze = 40, K = 80, z = 90, Ye = 420, Ve = 520, Y = 48, J = "#0d0d0d", _ = "#121316", Ze = {
|
|
339
|
+
backgroundColor: J,
|
|
327
340
|
boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.25)",
|
|
328
341
|
backdropFilter: "none",
|
|
329
342
|
webkitBackdropFilter: "none"
|
|
330
|
-
},
|
|
343
|
+
}, ee = "inset 0 0.5px 0.75px rgb(255 255 255 / 0.6)", qe = "inset 0 -0.5px 0.75px rgb(255 255 255 / 0.3)", te = [
|
|
331
344
|
"0 0 0 0.5px #9c9c9c",
|
|
332
345
|
"0 4px 8px 0 #0000001f",
|
|
333
346
|
"0 12px 32px 0 #00000047"
|
|
334
|
-
],
|
|
347
|
+
], ie = {
|
|
335
348
|
backgroundColor: "rgb(19 19 19 / 0.812)",
|
|
336
349
|
backdropFilter: "blur(14px)",
|
|
337
350
|
webkitBackdropFilter: "blur(14px)",
|
|
338
|
-
boxShadow: [
|
|
339
|
-
},
|
|
340
|
-
...
|
|
341
|
-
boxShadow: [
|
|
342
|
-
},
|
|
351
|
+
boxShadow: [ee, qe, ...te].join(", ")
|
|
352
|
+
}, Xe = {
|
|
353
|
+
...ie,
|
|
354
|
+
boxShadow: [ee, ...te].join(", ")
|
|
355
|
+
}, S = 32, V = "height 0.25s cubic-bezier(0.32, 0.72, 0, 1)", Qe = 2e3, Je = 500, et = 400, O = 12, tt = "2147483647", it = 'button, [href], input, select, textarea, iframe, [tabindex]:not([tabindex="-1"])', se = "#38393B", st = "#4B4B4E", nt = {
|
|
343
356
|
position: "absolute",
|
|
344
357
|
top: "16px",
|
|
345
358
|
right: "16px",
|
|
@@ -349,23 +362,23 @@ const we = 1024, L = 600, Ee = 400, Se = 40, D = 80, N = 90, Le = 420, Ie = 520,
|
|
|
349
362
|
padding: "0",
|
|
350
363
|
border: "none",
|
|
351
364
|
borderRadius: "50%",
|
|
352
|
-
backgroundColor:
|
|
365
|
+
backgroundColor: se,
|
|
353
366
|
color: "#F5F5F5",
|
|
354
367
|
cursor: "pointer",
|
|
355
368
|
display: "flex",
|
|
356
369
|
alignItems: "center",
|
|
357
370
|
justifyContent: "center"
|
|
358
371
|
};
|
|
359
|
-
function
|
|
360
|
-
const n = s === "v2", a = i <
|
|
372
|
+
function rt(i, e, t = O, s = "v1", r = 0, o = _) {
|
|
373
|
+
const n = s === "v2", a = i < Ge, u = {
|
|
361
374
|
showFooter: !n,
|
|
362
375
|
material: n ? "glass" : "solid",
|
|
363
|
-
wrapperMaterial: n ? a ?
|
|
376
|
+
wrapperMaterial: n ? a ? Xe : ie : Ze,
|
|
364
377
|
card: { backgroundColor: n ? "transparent" : o },
|
|
365
378
|
iframe: n ? { background: "transparent", colorScheme: "dark" } : { background: "", colorScheme: "" }
|
|
366
|
-
}, g = n ? "rgba(0, 0, 0, 0.4)" : "rgba(0, 0, 0, 0.5)",
|
|
379
|
+
}, g = n ? "rgba(0, 0, 0, 0.4)" : "rgba(0, 0, 0, 0.5)", d = n ? O : t, c = `${d}px ${d}px 0px 0px`;
|
|
367
380
|
if (a) {
|
|
368
|
-
const
|
|
381
|
+
const l = n ? e - Y - r : Math.floor(e * z / 100) - S;
|
|
369
382
|
return {
|
|
370
383
|
isTray: !0,
|
|
371
384
|
// No blur: iPhone Safari tints its status bar and toolbar from the page, and over a blurred
|
|
@@ -379,23 +392,23 @@ function Ne(i, e, t = E, s = "v1", r = 0, o = w) {
|
|
|
379
392
|
wrapper: {
|
|
380
393
|
// The modal's width: at full width on a tablet the embed's pills and rows stretched. Only
|
|
381
394
|
// once that leaves 40px each side: at 600–679px it left a sliver of the page down each side.
|
|
382
|
-
maxWidth: i <
|
|
395
|
+
maxWidth: i < R + 2 * ze ? "none" : `${R}px`,
|
|
383
396
|
minWidth: "0",
|
|
384
|
-
borderRadius:
|
|
397
|
+
borderRadius: c,
|
|
385
398
|
paddingBottom: "env(safe-area-inset-bottom, 0px)"
|
|
386
399
|
},
|
|
387
400
|
container: {
|
|
388
401
|
// ponytail: no vh fallback for browsers without dvh (Safari < 15.4); the iframe cap still
|
|
389
402
|
// holds there.
|
|
390
|
-
maxHeight: n ? `calc(100dvh - ${
|
|
391
|
-
borderRadius:
|
|
403
|
+
maxHeight: n ? `calc(100dvh - ${Y}px - env(safe-area-inset-bottom, 0px))` : `calc(${z}dvh - ${S}px)`,
|
|
404
|
+
borderRadius: c
|
|
392
405
|
},
|
|
393
|
-
iframeMaxHeight:
|
|
394
|
-
iframeOpeningHeight: Math.min(
|
|
406
|
+
iframeMaxHeight: l,
|
|
407
|
+
iframeOpeningHeight: Math.min(Ye, l),
|
|
395
408
|
...u
|
|
396
409
|
};
|
|
397
410
|
}
|
|
398
|
-
const
|
|
411
|
+
const m = e - K;
|
|
399
412
|
return {
|
|
400
413
|
isTray: !1,
|
|
401
414
|
overlay: {
|
|
@@ -406,36 +419,36 @@ function Ne(i, e, t = E, s = "v1", r = 0, o = w) {
|
|
|
406
419
|
backgroundColor: g
|
|
407
420
|
},
|
|
408
421
|
wrapper: {
|
|
409
|
-
maxWidth: `${
|
|
410
|
-
minWidth: `${
|
|
411
|
-
borderRadius: `${
|
|
422
|
+
maxWidth: `${R}px`,
|
|
423
|
+
minWidth: `${Ke}px`,
|
|
424
|
+
borderRadius: `${d}px`,
|
|
412
425
|
paddingBottom: "0"
|
|
413
426
|
},
|
|
414
427
|
container: {
|
|
415
|
-
maxHeight: `calc(100vh - ${
|
|
416
|
-
borderRadius:
|
|
428
|
+
maxHeight: `calc(100vh - ${K}px)`,
|
|
429
|
+
borderRadius: c
|
|
417
430
|
},
|
|
418
|
-
iframeMaxHeight:
|
|
419
|
-
iframeOpeningHeight: Math.min(
|
|
431
|
+
iframeMaxHeight: m,
|
|
432
|
+
iframeOpeningHeight: Math.min(Ve, m),
|
|
420
433
|
...u
|
|
421
434
|
};
|
|
422
435
|
}
|
|
423
|
-
function
|
|
436
|
+
function Z(i, e) {
|
|
424
437
|
return Math.min(i, e);
|
|
425
438
|
}
|
|
426
|
-
function
|
|
439
|
+
function ot(i) {
|
|
427
440
|
return i.triggerType !== "schedule" && i.keepOpen !== !0;
|
|
428
441
|
}
|
|
429
|
-
const
|
|
430
|
-
function
|
|
442
|
+
const at = 32;
|
|
443
|
+
function lt(i) {
|
|
431
444
|
const e = {
|
|
432
445
|
hideCloseButton: i.closeControl === "embed",
|
|
433
446
|
dismissByEmbed: i.dismiss === "embed"
|
|
434
447
|
};
|
|
435
|
-
return typeof i.borderRadius == "number" && Number.isFinite(i.borderRadius) && (e.cardRadius = Math.max(0, Math.min(i.borderRadius,
|
|
448
|
+
return typeof i.borderRadius == "number" && Number.isFinite(i.borderRadius) && (e.cardRadius = Math.max(0, Math.min(i.borderRadius, at))), typeof i.surface == "string" && i.surface !== "" && (e.surface = i.surface), (i.design === "v1" || i.design === "v2") && (e.design = i.design), e;
|
|
436
449
|
}
|
|
437
|
-
const
|
|
438
|
-
class
|
|
450
|
+
const dt = ".moment-sync-trigger", ct = 6, q = 60, ut = "rgba(255, 255, 255, 0.216)", mt = "https://live.dev.momentco.ai";
|
|
451
|
+
class ht {
|
|
439
452
|
opts;
|
|
440
453
|
liveBaseUrl;
|
|
441
454
|
liveOrigin;
|
|
@@ -465,11 +478,11 @@ class Ye {
|
|
|
465
478
|
/** A dismissal posted to the embed and not yet acknowledged: it closes the sheet when it fires. */
|
|
466
479
|
dismissAckTimer = null;
|
|
467
480
|
// The card radius the frame is laid out with: the default until a theme hint sends the brand's.
|
|
468
|
-
cardRadius =
|
|
481
|
+
cardRadius = O;
|
|
469
482
|
/** The frame the embed last asked for: `v2` (glass) or `v1` (the 0.8.0 look). */
|
|
470
483
|
design = "v1";
|
|
471
484
|
/** The card colour the embed last sent, kept through a v2 sheet so v1 gets it back. */
|
|
472
|
-
surface =
|
|
485
|
+
surface = _;
|
|
473
486
|
/** The embed sent `dismiss: 'embed'` this open; it counts only while the frame is v2. */
|
|
474
487
|
dismissByEmbed = !1;
|
|
475
488
|
/** The height the embed last asked for, so a re-cap after a resize can grow back to it. */
|
|
@@ -483,15 +496,15 @@ class Ye {
|
|
|
483
496
|
closeReported = !1;
|
|
484
497
|
constructor(e) {
|
|
485
498
|
this.opts = {
|
|
486
|
-
triggerSelector:
|
|
499
|
+
triggerSelector: dt,
|
|
487
500
|
...e
|
|
488
|
-
}, this.liveBaseUrl =
|
|
501
|
+
}, this.liveBaseUrl = mt;
|
|
489
502
|
try {
|
|
490
503
|
this.liveOrigin = new URL(this.liveBaseUrl).origin;
|
|
491
504
|
} catch {
|
|
492
505
|
throw new Error(`[MomentSdk] Invalid VITE_LIVE_BASE_URL: "${this.liveBaseUrl}"`);
|
|
493
506
|
}
|
|
494
|
-
|
|
507
|
+
$e(), this.bindTriggers(), this.emitAnalytics("embed.init"), this.opts.autoOpen && this.autoOpenFromUrl(this.opts.autoOpen.teamSlug);
|
|
495
508
|
}
|
|
496
509
|
/**
|
|
497
510
|
* Programmatically open the sync modal.
|
|
@@ -536,9 +549,9 @@ class Ye {
|
|
|
536
549
|
* params from the address bar so a reload doesn't reopen it.
|
|
537
550
|
*/
|
|
538
551
|
autoOpenFromUrl(e) {
|
|
539
|
-
if (!
|
|
540
|
-
const t =
|
|
541
|
-
t &&
|
|
552
|
+
if (!pe()) return;
|
|
553
|
+
const t = he(window.location.href, e);
|
|
554
|
+
t && fe(document, () => {
|
|
542
555
|
this.openWith(t.payload, t), history.replaceState(history.state, "", t.cleanUrl);
|
|
543
556
|
});
|
|
544
557
|
}
|
|
@@ -563,21 +576,21 @@ class Ye {
|
|
|
563
576
|
"[MomentSdk] Invalid data-moment-trigger-type, falling back to 'moment':",
|
|
564
577
|
o
|
|
565
578
|
));
|
|
566
|
-
const a = e.getAttribute("data-moment-ids") ?? e.getAttribute("data-moment-game-id") ?? "", h = a ? a.split(",").filter(Boolean) : [], u = e.getAttribute("data-moment-playlist-slugs") ?? "", g = u ? u.split(",").map((
|
|
567
|
-
let
|
|
568
|
-
|
|
569
|
-
const
|
|
570
|
-
if (
|
|
579
|
+
const a = e.getAttribute("data-moment-ids") ?? e.getAttribute("data-moment-game-id") ?? "", h = a ? a.split(",").filter(Boolean) : [], u = e.getAttribute("data-moment-playlist-slugs") ?? "", g = u ? u.split(",").map((x) => x.trim()).filter(Boolean) : [], d = e.getAttribute("data-moment-calendar");
|
|
580
|
+
let c;
|
|
581
|
+
d != null && d !== "" && (d === "google" || d === "outlook" ? c = d : console.warn("[MomentSdk] Invalid data-moment-calendar, ignoring value:", d));
|
|
582
|
+
const m = e.getAttribute("data-api-source-id") ?? void 0, l = e.getAttribute("data-external-event-id") ?? void 0, f = e.getAttribute("data-external-event-id-prefix") ?? void 0;
|
|
583
|
+
if (l && f && console.warn(
|
|
571
584
|
"[MomentSdk] Both data-external-event-id and data-external-event-id-prefix are set; using data-external-event-id only."
|
|
572
585
|
), !t) {
|
|
573
586
|
console.warn("[MomentSdk] Missing data-moment-team-slug on trigger element");
|
|
574
587
|
return;
|
|
575
588
|
}
|
|
576
|
-
const
|
|
589
|
+
const C = n === "team" || n === "brand-playlist" || n === "playlist" || n === "schedule";
|
|
577
590
|
this.emitAnalytics("embed.trigger.click", {
|
|
578
591
|
teamSlug: t,
|
|
579
592
|
triggerType: n,
|
|
580
|
-
momentIds:
|
|
593
|
+
momentIds: C ? [] : h
|
|
581
594
|
}), this.open({
|
|
582
595
|
teamSlug: t,
|
|
583
596
|
momentSlug: s,
|
|
@@ -585,10 +598,10 @@ class Ye {
|
|
|
585
598
|
triggerType: n,
|
|
586
599
|
ids: h,
|
|
587
600
|
playlistSlugs: g,
|
|
588
|
-
calendar:
|
|
589
|
-
apiSourceId:
|
|
590
|
-
externalEventId: f && !
|
|
591
|
-
externalEventIdPrefix:
|
|
601
|
+
calendar: c ?? void 0,
|
|
602
|
+
apiSourceId: m,
|
|
603
|
+
externalEventId: f && !l ? void 0 : l,
|
|
604
|
+
externalEventIdPrefix: l ? void 0 : f
|
|
592
605
|
});
|
|
593
606
|
}
|
|
594
607
|
/** Drop moment/list/source scoping for brand-level subscription triggers. */
|
|
@@ -614,7 +627,7 @@ class Ye {
|
|
|
614
627
|
this.overlay = document.createElement("div"), this.overlay.setAttribute("role", "presentation"), Object.assign(this.overlay.style, {
|
|
615
628
|
position: "fixed",
|
|
616
629
|
inset: "0",
|
|
617
|
-
zIndex:
|
|
630
|
+
zIndex: tt,
|
|
618
631
|
display: "flex",
|
|
619
632
|
justifyContent: "center",
|
|
620
633
|
// backgroundColor comes from the layout: 50%, or 40% for a v2 sheet.
|
|
@@ -637,7 +650,7 @@ class Ye {
|
|
|
637
650
|
// smoothly instead of snapping.
|
|
638
651
|
transition: "border-radius 0.3s ease",
|
|
639
652
|
overflow: "hidden",
|
|
640
|
-
backgroundColor:
|
|
653
|
+
backgroundColor: J,
|
|
641
654
|
boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.25)",
|
|
642
655
|
display: "flex",
|
|
643
656
|
flexDirection: "column"
|
|
@@ -650,7 +663,7 @@ class Ye {
|
|
|
650
663
|
overflow: "auto",
|
|
651
664
|
// The sheet colour Live's embeds paint, so the card never flashes white before the
|
|
652
665
|
// embed's theme (and its own `surface`) arrives.
|
|
653
|
-
backgroundColor:
|
|
666
|
+
backgroundColor: _,
|
|
654
667
|
// `tabIndex = -1` above makes this a programmatic focus target for the
|
|
655
668
|
// focus trap, never a Tab stop — but browsers still draw their platform
|
|
656
669
|
// focus ring (blue on stock macOS/Windows) around the whole card when we
|
|
@@ -659,10 +672,10 @@ class Ye {
|
|
|
659
672
|
outline: "none"
|
|
660
673
|
});
|
|
661
674
|
const a = document.createElement("button");
|
|
662
|
-
a.type = "button", a.className =
|
|
663
|
-
a.style.backgroundColor =
|
|
675
|
+
a.type = "button", a.className = Q, 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, nt), a.addEventListener("mouseenter", () => {
|
|
676
|
+
a.style.backgroundColor = st;
|
|
664
677
|
}), a.addEventListener("mouseleave", () => {
|
|
665
|
-
a.style.backgroundColor =
|
|
678
|
+
a.style.backgroundColor = se;
|
|
666
679
|
}), a.addEventListener("click", () => this.handleCancel());
|
|
667
680
|
const h = e.triggerType !== "schedule";
|
|
668
681
|
this.iframe = document.createElement("iframe"), this.iframe.src = s, 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, {
|
|
@@ -673,15 +686,15 @@ class Ye {
|
|
|
673
686
|
// The first resize is the big one — the frame grows from its opening
|
|
674
687
|
// guess to the embed's real content height. Eased and a little slower so
|
|
675
688
|
// that reads as the sheet settling rather than a snap.
|
|
676
|
-
transition:
|
|
689
|
+
transition: V
|
|
677
690
|
}), h && (n.appendChild(a), this.closeButton = a), n.appendChild(this.iframe);
|
|
678
691
|
const u = document.createElement("div");
|
|
679
692
|
this.footer = u, Object.assign(u.style, {
|
|
680
693
|
display: "flex",
|
|
681
694
|
alignItems: "center",
|
|
682
695
|
justifyContent: "center",
|
|
683
|
-
gap: `${
|
|
684
|
-
height: `${
|
|
696
|
+
gap: `${ct}px`,
|
|
697
|
+
height: `${S}px`,
|
|
685
698
|
// The wrapper is a flex column, so without this the tray would be the
|
|
686
699
|
// first thing squeezed when the card hits its max height.
|
|
687
700
|
flexShrink: "0",
|
|
@@ -696,46 +709,46 @@ class Ye {
|
|
|
696
709
|
lineHeight: "16px",
|
|
697
710
|
color: "#ffffff"
|
|
698
711
|
});
|
|
699
|
-
const
|
|
700
|
-
|
|
712
|
+
const d = document.createElement("img");
|
|
713
|
+
d.alt = "Moment", d.src = ge, Object.assign(d.style, {
|
|
701
714
|
display: "block",
|
|
702
715
|
// Both dimensions are explicit so the tray has no reflow to do, even if
|
|
703
716
|
// the image is ever swapped for one that has to decode.
|
|
704
|
-
width: `${
|
|
705
|
-
height: `${(
|
|
706
|
-
}), u.appendChild(g), u.appendChild(
|
|
707
|
-
const
|
|
708
|
-
this.hairline =
|
|
717
|
+
width: `${q}px`,
|
|
718
|
+
height: `${(q / Ce).toFixed(2)}px`
|
|
719
|
+
}), u.appendChild(g), u.appendChild(d), this.wrapper = o, this.container = n, this.applyFrameLayout();
|
|
720
|
+
const c = document.createElement("div");
|
|
721
|
+
this.hairline = c, c.setAttribute("aria-hidden", "true"), Object.assign(c.style, {
|
|
709
722
|
position: "absolute",
|
|
710
723
|
inset: "0",
|
|
711
724
|
borderRadius: "inherit",
|
|
712
|
-
boxShadow: `inset 0 0 0 1px ${
|
|
725
|
+
boxShadow: `inset 0 0 0 1px ${ut}`,
|
|
713
726
|
pointerEvents: "none",
|
|
714
727
|
zIndex: "2"
|
|
715
|
-
}), o.appendChild(n), o.appendChild(u), o.appendChild(
|
|
716
|
-
const
|
|
728
|
+
}), o.appendChild(n), o.appendChild(u), o.appendChild(c), this.overlay.appendChild(o), this.feedback = Fe(this.overlay, o), document.body.appendChild(this.overlay), this.revealTimer = setTimeout(() => this.reveal(), Qe), this.viewportResizeHandler = () => this.applyFrameLayout(), window.addEventListener("resize", this.viewportResizeHandler);
|
|
729
|
+
const m = () => n.querySelectorAll(it), l = (p) => {
|
|
717
730
|
if (p.key !== "Tab") return;
|
|
718
|
-
const
|
|
719
|
-
p.shiftKey && (
|
|
731
|
+
const y = m(), b = y[0], E = y[y.length - 1], T = document.activeElement;
|
|
732
|
+
p.shiftKey && (T === b || T === n) ? (p.preventDefault(), E.focus()) : !p.shiftKey && T === E && (p.preventDefault(), b.focus());
|
|
720
733
|
};
|
|
721
|
-
n.addEventListener("keydown",
|
|
734
|
+
n.addEventListener("keydown", l);
|
|
722
735
|
const f = (p) => {
|
|
723
|
-
const
|
|
724
|
-
return
|
|
725
|
-
const
|
|
726
|
-
|
|
727
|
-
}),
|
|
736
|
+
const y = document.createElement("span");
|
|
737
|
+
return y.tabIndex = 0, Object.assign(y.style, { position: "fixed", opacity: "0" }), y.addEventListener("focus", () => {
|
|
738
|
+
const b = m();
|
|
739
|
+
b[p === "first" ? 0 : b.length - 1].focus();
|
|
740
|
+
}), y;
|
|
728
741
|
};
|
|
729
742
|
n.before(f("last")), n.after(f("first"));
|
|
730
|
-
const
|
|
743
|
+
const C = document.documentElement.clientWidth;
|
|
731
744
|
this.previousBodyOverflow = document.body.style.overflow, document.body.style.overflow = "hidden", this.didManageBodyOverflow = !0;
|
|
732
|
-
const
|
|
733
|
-
if (
|
|
745
|
+
const x = document.documentElement.clientWidth - C;
|
|
746
|
+
if (x > 0) {
|
|
734
747
|
this.previousBodyPaddingRight = document.body.style.paddingRight;
|
|
735
748
|
const p = Number.parseFloat(getComputedStyle(document.body).paddingRight) || 0;
|
|
736
|
-
document.body.style.paddingRight = `${p +
|
|
749
|
+
document.body.style.paddingRight = `${p + x}px`, this.didManageBodyPadding = !0;
|
|
737
750
|
}
|
|
738
|
-
this.setupMessageListener(), this.overlay._escHandler = r, this.overlay._focusTrapHandler =
|
|
751
|
+
this.setupMessageListener(), this.overlay._escHandler = r, this.overlay._focusTrapHandler = l;
|
|
739
752
|
}
|
|
740
753
|
/** Show the hidden frame, in the look the embed has asked for so far. Runs once per open. */
|
|
741
754
|
reveal() {
|
|
@@ -753,10 +766,10 @@ class Ye {
|
|
|
753
766
|
const t = this.footer?.style.display !== "none";
|
|
754
767
|
if (this.footer && this.revealed && t !== e.showFooter) {
|
|
755
768
|
const o = this.iframe.offsetHeight;
|
|
756
|
-
this.iframe.style.transition = "none", this.iframe.style.height = `${o + (t ?
|
|
769
|
+
this.iframe.style.transition = "none", this.iframe.style.height = `${o + (t ? S : -S)}px`, this.iframe.offsetHeight, this.iframe.style.transition = V;
|
|
757
770
|
}
|
|
758
|
-
this.footer && (this.footer.style.display = e.showFooter ? "flex" : "none"), this.hairline && (this.hairline.style.display = e.material === "glass" ? "none" : ""), this.wrapper.classList.toggle(
|
|
759
|
-
const s = Number.parseFloat(this.iframe.style.height), r = this.lastRequestedHeight !== null ?
|
|
771
|
+
this.footer && (this.footer.style.display = e.showFooter ? "flex" : "none"), this.hairline && (this.hairline.style.display = e.material === "glass" ? "none" : ""), this.wrapper.classList.toggle(H, e.isTray && this.revealed);
|
|
772
|
+
const s = Number.parseFloat(this.iframe.style.height), r = this.lastRequestedHeight !== null ? Z(this.lastRequestedHeight, e.iframeMaxHeight) : Number.isNaN(s) ? e.iframeOpeningHeight : Math.min(s, e.iframeMaxHeight);
|
|
760
773
|
this.iframe.style.height = `${r}px`;
|
|
761
774
|
}
|
|
762
775
|
/**
|
|
@@ -765,7 +778,7 @@ class Ye {
|
|
|
765
778
|
*/
|
|
766
779
|
currentLayout() {
|
|
767
780
|
const e = this.wrapper && Number.parseFloat(getComputedStyle(this.wrapper).paddingBottom) || 0;
|
|
768
|
-
return
|
|
781
|
+
return rt(
|
|
769
782
|
window.innerWidth,
|
|
770
783
|
window.innerHeight,
|
|
771
784
|
this.cardRadius,
|
|
@@ -775,7 +788,7 @@ class Ye {
|
|
|
775
788
|
);
|
|
776
789
|
}
|
|
777
790
|
buildIframeUrl(e, t) {
|
|
778
|
-
return
|
|
791
|
+
return Be(this.liveBaseUrl, e, void 0, t);
|
|
779
792
|
}
|
|
780
793
|
// ── Private: message handling ─────────────────────────────────────
|
|
781
794
|
setupMessageListener() {
|
|
@@ -796,19 +809,19 @@ class Ye {
|
|
|
796
809
|
if (s > 0 && this.iframe) {
|
|
797
810
|
this.lastRequestedHeight = s;
|
|
798
811
|
const { iframeMaxHeight: r } = this.currentLayout();
|
|
799
|
-
this.iframe.style.height = `${
|
|
812
|
+
this.iframe.style.height = `${Z(s, r)}px`;
|
|
800
813
|
}
|
|
801
814
|
return;
|
|
802
815
|
}
|
|
803
816
|
if (t.source === "moment-live-embed" && t.type === "moment.embed.theme") {
|
|
804
|
-
const s =
|
|
817
|
+
const s = lt(t);
|
|
805
818
|
s.design && s.design !== this.design && (this.design = s.design, this.applyFrameLayout()), s.cardRadius !== void 0 && (this.cardRadius = s.cardRadius, this.applyFrameLayout()), s.hideCloseButton && this.closeButton && (document.activeElement === this.closeButton && this.container?.focus(), this.closeButton.remove()), s.surface !== void 0 && (this.surface = s.surface, this.applyFrameLayout()), s.dismissByEmbed && (this.dismissByEmbed = !0), this.reveal();
|
|
806
819
|
return;
|
|
807
820
|
}
|
|
808
821
|
if (t.source === "moment-live-embed" && t.type === "moment.embed.open.url") {
|
|
809
822
|
const { url: s } = t;
|
|
810
|
-
if (
|
|
811
|
-
const r =
|
|
823
|
+
if (We(s)) {
|
|
824
|
+
const r = je(window.open(s, "_blank"));
|
|
812
825
|
r === "blocked" && this.emitAnalytics("open.url.blocked", {}), this.sendOpenUrlStatus(r, s);
|
|
813
826
|
} else
|
|
814
827
|
this.sendOpenUrlStatus("blocked", typeof s == "string" ? s : "");
|
|
@@ -839,7 +852,7 @@ class Ye {
|
|
|
839
852
|
}, window.addEventListener("message", this.messageHandler);
|
|
840
853
|
}
|
|
841
854
|
handleOAuthStart(e) {
|
|
842
|
-
this.popupBridge && (this.popupBridge.cleanup(), this.popupBridge = null), this.popupBridge = new
|
|
855
|
+
this.popupBridge && (this.popupBridge.cleanup(), this.popupBridge = null), this.popupBridge = new Ne({
|
|
843
856
|
liveBaseUrl: this.liveBaseUrl,
|
|
844
857
|
liveOrigin: this.liveOrigin,
|
|
845
858
|
iframeWindow: this.iframe?.contentWindow ?? null,
|
|
@@ -883,7 +896,7 @@ class Ye {
|
|
|
883
896
|
provider: e.provider,
|
|
884
897
|
triggerType: e.triggerType,
|
|
885
898
|
momentIds: e.momentIds
|
|
886
|
-
}), this.opts.onError?.(e)), this.opts.onClose?.(e), this.emitAnalytics("embed.close"),
|
|
899
|
+
}), this.opts.onError?.(e)), this.opts.onClose?.(e), this.emitAnalytics("embed.close"), ot(e) && (this.closeTimer = setTimeout(() => this.cleanup(), 1500)));
|
|
887
900
|
}
|
|
888
901
|
/**
|
|
889
902
|
* A tap outside the sheet or Escape on the page. A v2 sheet that claimed it hears it, answers
|
|
@@ -897,7 +910,7 @@ class Ye {
|
|
|
897
910
|
return;
|
|
898
911
|
}
|
|
899
912
|
const t = { source: "moment-sdk", type: "moment.sdk.dismiss" };
|
|
900
|
-
e.postMessage(t, this.liveOrigin), this.dismissAckTimer || (this.dismissAckTimer = setTimeout(() => this.handleCancel(),
|
|
913
|
+
e.postMessage(t, this.liveOrigin), this.dismissAckTimer || (this.dismissAckTimer = setTimeout(() => this.handleCancel(), Je));
|
|
901
914
|
}
|
|
902
915
|
clearDismissAckTimer() {
|
|
903
916
|
this.dismissAckTimer && clearTimeout(this.dismissAckTimer), this.dismissAckTimer = null;
|
|
@@ -923,14 +936,14 @@ class Ye {
|
|
|
923
936
|
*/
|
|
924
937
|
cleanup(e = !1) {
|
|
925
938
|
const t = e && this.design === "v2" && this.revealed && !window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
926
|
-
if (this.closeTimer && (clearTimeout(this.closeTimer), this.closeTimer = null), this.revealTimer && (clearTimeout(this.revealTimer), this.revealTimer = null), this.clearDismissAckTimer(), this.revealed = !1, 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 =
|
|
939
|
+
if (this.closeTimer && (clearTimeout(this.closeTimer), this.closeTimer = null), this.revealTimer && (clearTimeout(this.revealTimer), this.revealTimer = null), this.clearDismissAckTimer(), this.revealed = !1, 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 = _, this.dismissByEmbed = !1, this.lastRequestedHeight = null, this.footer = null, this.hairline = null, this.viewportResizeHandler && (window.removeEventListener("resize", this.viewportResizeHandler), this.viewportResizeHandler = null), this.overlay) {
|
|
927
940
|
const { _escHandler: s, _focusTrapHandler: r } = this.overlay;
|
|
928
941
|
s && document.removeEventListener("keydown", s);
|
|
929
942
|
const o = this.overlay.firstElementChild;
|
|
930
943
|
if (o && r && o.removeEventListener("keydown", r), t) {
|
|
931
944
|
const n = this.overlay;
|
|
932
|
-
n.style.pointerEvents = "none", n.style.width = `${document.documentElement.clientWidth}px`, n.classList.add(
|
|
933
|
-
const a = setTimeout(() => n.remove(),
|
|
945
|
+
n.style.pointerEvents = "none", n.style.width = `${document.documentElement.clientWidth}px`, n.classList.add(M);
|
|
946
|
+
const a = setTimeout(() => n.remove(), et);
|
|
934
947
|
n.addEventListener(
|
|
935
948
|
"animationend",
|
|
936
949
|
() => {
|
|
@@ -942,7 +955,7 @@ class Ye {
|
|
|
942
955
|
this.overlay.remove();
|
|
943
956
|
this.overlay = null;
|
|
944
957
|
}
|
|
945
|
-
this.iframe = null, this.wrapper = null, this.container = null, this.closeButton = null, this.activePayload = null, this.activeCampaignId = void 0, this.cardRadius =
|
|
958
|
+
this.iframe = null, this.wrapper = null, this.container = null, this.closeButton = null, this.activePayload = null, this.activeCampaignId = void 0, this.cardRadius = O, this.didManageBodyOverflow && (document.body.style.overflow = this.previousBodyOverflow, this.didManageBodyOverflow = !1), this.didManageBodyPadding && (document.body.style.paddingRight = this.previousBodyPaddingRight, this.didManageBodyPadding = !1), this.previousFocusedElement && typeof this.previousFocusedElement.focus == "function" && this.previousFocusedElement.focus(), this.previousFocusedElement = null;
|
|
946
959
|
}
|
|
947
960
|
// ── Private: analytics ────────────────────────────────────────────
|
|
948
961
|
emitAnalytics(e, t) {
|
|
@@ -953,7 +966,7 @@ class Ye {
|
|
|
953
966
|
});
|
|
954
967
|
}
|
|
955
968
|
}
|
|
956
|
-
function
|
|
969
|
+
function pt(i) {
|
|
957
970
|
const e = document.createElement("button");
|
|
958
971
|
return e.type = "button", e.classList.add("moment-sync-trigger"), i.className && i.className.split(" ").forEach((t) => {
|
|
959
972
|
t && e.classList.add(t);
|
|
@@ -961,9 +974,9 @@ function Ve(i) {
|
|
|
961
974
|
}
|
|
962
975
|
if (typeof window < "u") {
|
|
963
976
|
const i = window;
|
|
964
|
-
i.MomentSdk =
|
|
977
|
+
i.MomentSdk = ht, i.createMomentButton = pt;
|
|
965
978
|
}
|
|
966
979
|
export {
|
|
967
|
-
|
|
968
|
-
|
|
980
|
+
ht as MomentSdk,
|
|
981
|
+
pt as createMomentButton
|
|
969
982
|
};
|
|
@@ -28,7 +28,7 @@ export declare class FakeElement {
|
|
|
28
28
|
readonly animate: import("vitest").Mock<(keyframes: Keyframe[], options: KeyframeAnimationOptions) => {
|
|
29
29
|
keyframes: Keyframe[];
|
|
30
30
|
options: KeyframeAnimationOptions;
|
|
31
|
-
onfinish: null;
|
|
31
|
+
onfinish: (() => void) | null;
|
|
32
32
|
}>;
|
|
33
33
|
private readonly classes;
|
|
34
34
|
readonly classList: {
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
import type { MomentToastVariant } from './types';
|
|
7
7
|
/** What the SDK can draw over the page while the sheet is open. */
|
|
8
8
|
export interface FeedbackLayer {
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Once the sheet settles, Live's confetti: a burst up from 70% down the screen that falls back
|
|
11
|
+
* below it. None under reduced motion.
|
|
12
|
+
*/
|
|
10
13
|
celebrate(): void;
|
|
11
14
|
/** Show a toast for 4 s, replacing the current one. `text` is drawn as text, never HTML. */
|
|
12
15
|
toast(text: string, variant?: MomentToastVariant): void;
|
package/package.json
CHANGED