@momentco-ai/moment-sdk 0.9.0-dev.45 → 0.9.0-dev.46

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
@@ -12,10 +12,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
12
12
  - **Open the sheet from a link.** `autoOpen: { teamSlug }` opens the sheet from the page's `moment_sync` (`moment:<slug>`, `list:<slug>`, `playlist:<slug>[,<slug>]`, `schedule`) once per page load, then removes its own parameters with `history.replaceState`. The team comes from `autoOpen`, never the URL, and malformed values are ignored.
13
13
  - `triggerSource: "url"` on those `embed.open` events.
14
14
  - Link opens also pass the campaign to the sign-in popup.
15
+ - **Roman's v2 sheet, on request.** When the embed's `moment.embed.theme` carries `design: "v2"`, the tray stops 48px below the top of the screen, home indicator included: its cap leaves room for the bottom safe area the frame pads by. The 90% cap and the "Powered by" strip go, because the sheet draws its own footer. The frame becomes translucent thick glass that blurs the page behind it, the page dims to 40% instead of 50%, and the card and iframe turn transparent, with the iframe's own `color-scheme` so a dark-scheme host page can't paint behind it. `design: "v1"` puts the 0.8.0 look back, card colour included (the default, or the `surface` the embed last sent), so the frame can follow an embed between a v2 sheet and its older steps. Without the hint nothing changes.
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
+
18
+ ### Fixed
19
+
20
+ - **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.
15
21
 
16
22
  ### Compatibility
17
23
 
18
24
  - Additive: sites without `autoOpen` are unchanged. Link opens add `entry=link` (and `campaignId` when present) to the iframe URL, which an older Moment Live ignores.
25
+ - Additive: an embed that never sends `design: "v2"` gets the 0.8.0 frame, and `scheduleListIds` is optional.
19
26
 
20
27
  ## [0.8.0] - Unreleased
21
28
 
@@ -1,4 +1,4 @@
1
- (function(b){"use strict";const A="moment_sync",T="moment_campaign",$=/^(?:schedule|(moment|list):([a-z0-9-]+)|playlist:([a-z0-9-]+(?:,[a-z0-9-]+)*))$/,j=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function W(i,e){if(!e)return null;const t=new URL(i),n=t.searchParams.get(A);if(n===null||n.length>200)return null;const s=$.exec(n);if(!s)return null;const[,r,o,a]=s;let u;r==="moment"?u={teamSlug:e,triggerType:"moment",momentSlug:o}:r==="list"?u={teamSlug:e,triggerType:"list",listSlug:o}:a?u={teamSlug:e,triggerType:"playlist",playlistSlugs:a.split(",")}:u={teamSlug:e,triggerType:"schedule"};const c=t.searchParams.get(T);return t.search=t.search.slice(1).split("&").filter(p=>{const l=p.split("=",1)[0];return l!==A&&l!==T}).join("&"),{payload:u,...c&&j.test(c)?{campaignId:c}:{},cleanUrl:t.href}}let L=!1;function z(){return L?!1:(L=!0,!0)}function G(i,e){i.body?e():i.addEventListener("DOMContentLoaded",e,{once:!0})}const K="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",Y=120.52/21.28;function x(){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 V(i,e,t=x(),n){if(e.triggerType==="schedule"){const r=new URLSearchParams;return r.set("teamSlug",e.teamSlug),r.set("returnOrigin",t),r.set("embed","1"),r.set("sdkVersion","0.9.0-dev.45"),n&&(r.set("entry","link"),n.campaignId&&r.set("campaignId",n.campaignId)),`${i}/en/embed/schedule?${r.toString()}`}const s=new URLSearchParams;return s.set("teamSlug",e.teamSlug),e.momentSlug&&s.set("momentSlug",e.momentSlug),e.listSlug&&s.set("listSlug",e.listSlug),s.set("triggerType",e.triggerType),e.ids?.length&&s.set("ids",e.ids.join(",")),e.playlistSlugs?.length&&s.set("playlistSlugs",e.playlistSlugs.join(",")),e.calendar&&s.set("calendar",e.calendar),e.apiSourceId&&s.set("subscriptionId",e.apiSourceId),e.externalEventId&&s.set("externalId",e.externalEventId),e.externalEventIdPrefix&&!e.externalEventId&&s.set("externalIdPrefix",e.externalEventIdPrefix),s.set("returnOrigin",t),s.set("embed","1"),s.set("sdkVersion","0.9.0-dev.45"),n&&(s.set("entry","link"),n.campaignId&&s.set("campaignId",n.campaignId)),`${i}/en/embed/sync?${s.toString()}`}const I=500,O=700,Z=500;class X{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),n=Math.round(window.screenX+(window.outerWidth-I)/2),s=Math.round(window.screenY+(window.outerHeight-O)/2);if(this.popup=window.open(t,"moment-oauth-popup",`width=${I},height=${O},left=${n},top=${s},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=r=>{if(r.origin!==this.opts.liveOrigin||r.source!==this.popup)return;const o=r.data;!o||typeof o!="object"||o.source!=="moment-live-embed"||o.type!=="moment.embed.result"||(this.resultReceived=!0,this.sendStatusToIframe("completed"),this.opts.iframeWindow&&this.opts.iframeWindow.postMessage(o,this.opts.liveOrigin),this.opts.onResult(o),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=x(),n=new URLSearchParams({provider:e.provider,teamSlug:e.teamSlug,ids:e.ids.join(","),triggerType:e.triggerType,returnOrigin:t});return e.subscriptionType&&n.set("subscriptionType",e.subscriptionType),e.scheduleMomentIds?.length&&n.set("scheduleMomentIds",e.scheduleMomentIds.join(",")),e.schedulePlaylistIds?.length&&n.set("schedulePlaylistIds",e.schedulePlaylistIds.join(",")),this.opts.campaignId&&n.set("campaignId",this.opts.campaignId),`${this.opts.liveBaseUrl}/en/embed/oauth-popup?${n.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())},Z)}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)}}const M="moment-sdk-styles",_="moment-sdk-close",R="moment-sdk-tray",q=`
1
+ (function(y){"use strict";const A="moment_sync",L="moment_campaign",V=/^(?:schedule|(moment|list):([a-z0-9-]+)|playlist:([a-z0-9-]+(?:,[a-z0-9-]+)*))$/,Y=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function q(i,e){if(!e)return null;const t=new URL(i),s=t.searchParams.get(A);if(s===null||s.length>200)return null;const r=V.exec(s);if(!r)return null;const[,o,n,a]=r;let u;o==="moment"?u={teamSlug:e,triggerType:"moment",momentSlug:n}:o==="list"?u={teamSlug:e,triggerType:"list",listSlug:n}:a?u={teamSlug:e,triggerType:"playlist",playlistSlugs:a.split(",")}:u={teamSlug:e,triggerType:"schedule"};const d=t.searchParams.get(L);return t.search=t.search.slice(1).split("&").filter(m=>{const l=m.split("=",1)[0];return l!==A&&l!==L}).join("&"),{payload:u,...d&&Y.test(d)?{campaignId:d}:{},cleanUrl:t.href}}let T=!1;function Z(){return T?!1:(T=!0,!0)}function X(i,e){i.body?e():i.addEventListener("DOMContentLoaded",e,{once:!0})}const J="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='15.55 11.94 120.52 21.28'%3E%3Cpath d='M16.59 33.04L17.42 29.54C18.62 24.54 19.22 21.32 19.22 19.89C19.22 19.68 19.19 19.54 19.12 19.47C19.05 19.4 18.91 19.38 18.7 19.4C18.4 19.47 17.97 19.65 17.42 19.94C16.86 20.23 16.32 20.62 15.79 21.1C15.63 20.9 15.55 20.69 15.55 20.48C15.55 20.27 15.65 20.03 15.86 19.75C16.16 19.38 16.65 18.95 17.33 18.45C18.02 17.95 18.74 17.53 19.5 17.2C20.27 16.86 20.92 16.7 21.48 16.7C21.78 16.7 22 16.79 22.14 16.99C22.28 17.19 22.35 17.5 22.35 17.94C22.35 18.55 22.24 19.42 22.04 20.56C21.83 21.71 21.55 22.88 21.2 24.09C22.34 21.96 23.59 20.19 24.95 18.79C26.32 17.4 27.7 16.7 29.12 16.7C29.79 16.7 30.27 16.87 30.57 17.23C30.87 17.59 31.02 18.14 31.02 18.88C31.02 19.97 30.69 21.7 30.02 24.09C31.13 22.01 32.44 20.25 33.94 18.83C35.44 17.41 36.94 16.7 38.42 16.7C39.11 16.7 39.63 16.88 39.98 17.25C40.33 17.62 40.5 18.16 40.5 18.88C40.5 19.18 40.45 19.62 40.34 20.18C40.24 20.75 40.1 21.37 39.91 22.04L38.42 27.7C38.09 28.92 37.93 29.77 37.93 30.23C37.93 30.48 37.97 30.67 38.05 30.8C38.13 30.93 38.27 30.99 38.45 30.99C38.89 30.99 39.47 30.69 40.17 30.09C40.88 29.49 41.46 28.85 41.92 28.18C42.25 28.44 42.41 28.72 42.41 29.05C42.41 29.26 42.34 29.48 42.2 29.71C41.74 30.5 40.98 31.28 39.93 32.05C38.87 32.82 37.82 33.21 36.75 33.21C36.08 33.21 35.56 33.02 35.17 32.62C34.79 32.23 34.6 31.66 34.6 30.92C34.6 30.3 34.8 29.22 35.19 27.7L36.79 21.55C37 20.74 37.1 20.13 37.1 19.71C37.1 19.2 36.89 18.95 36.48 18.95C35.97 18.95 35.3 19.33 34.46 20.08C33.63 20.83 32.79 21.94 31.93 23.41C31.07 24.88 30.33 26.62 29.71 28.63L28.91 31.27C28.77 31.73 28.59 32.09 28.37 32.33C28.15 32.57 27.82 32.73 27.38 32.8L25.54 33.22L25.37 33.04L26.13 29.67C26.73 27.11 27.19 25.03 27.49 23.44C27.79 21.86 27.94 20.72 27.94 20.03C27.94 19.33 27.72 19.02 27.28 19.02C26.79 19.02 26.17 19.4 25.42 20.15C24.67 20.9 23.89 22 23.1 23.46C22.3 24.92 21.6 26.65 21 28.67L20.2 31.27C20.06 31.71 19.87 32.05 19.63 32.29C19.38 32.54 19.02 32.71 18.53 32.8L16.76 33.22L16.59 33.04L16.59 33.04Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M57.66 17.94C57 17.13 55.99 16.73 54.62 16.73C52.93 16.73 51.31 17.3 49.75 18.43C49.51 18.6 49.28 18.78 49.06 18.97C49.24 19.85 49.39 20.78 49.48 21.74C49.86 21.01 50.3 20.37 50.79 19.82C51.63 18.87 52.5 18.39 53.41 18.39C54.08 18.39 54.55 18.68 54.81 19.24C55.08 19.81 55.21 20.58 55.21 21.55C55.21 23.08 54.97 24.63 54.48 26.19C54 27.75 53.35 29.03 52.54 30.04C51.73 31.04 50.86 31.55 49.94 31.55C49.53 31.55 49.19 31.44 48.9 31.22C48.74 31.9 48.54 32.55 48.31 33.19C48.5 33.2 48.7 33.21 48.9 33.21C50.54 33.21 52.11 32.63 53.61 31.48C55.12 30.32 56.33 28.82 57.26 26.98C58.18 25.14 58.65 23.28 58.65 21.38C58.65 19.9 58.32 18.75 57.66 17.94L57.66 17.94Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M61.84 33.04L62.67 29.54C63.88 24.54 64.48 21.32 64.48 19.89C64.48 19.68 64.44 19.54 64.37 19.47C64.3 19.4 64.17 19.38 63.96 19.4C63.66 19.47 63.23 19.65 62.67 19.94C62.12 20.23 61.57 20.62 61.04 21.1C60.88 20.9 60.8 20.69 60.8 20.48C60.8 20.27 60.9 20.03 61.11 19.75C61.41 19.38 61.9 18.95 62.59 18.45C63.27 17.95 63.99 17.53 64.76 17.2C65.52 16.86 66.18 16.7 66.73 16.7C67.04 16.7 67.26 16.79 67.39 16.99C67.53 17.19 67.6 17.5 67.6 17.94C67.6 18.55 67.5 19.42 67.29 20.56C67.08 21.71 66.8 22.88 66.46 24.09C67.59 21.96 68.84 20.19 70.2 18.79C71.57 17.4 72.96 16.7 74.37 16.7C75.04 16.7 75.53 16.87 75.83 17.23C76.13 17.59 76.28 18.14 76.28 18.88C76.28 19.97 75.94 21.7 75.27 24.09C76.38 22.01 77.69 20.25 79.19 18.83C80.7 17.41 82.19 16.7 83.67 16.7C84.36 16.7 84.89 16.88 85.23 17.25C85.58 17.62 85.75 18.16 85.75 18.88C85.75 19.18 85.7 19.62 85.6 20.18C85.49 20.75 85.35 21.37 85.16 22.04L83.67 27.7C83.35 28.92 83.19 29.77 83.19 30.23C83.19 30.48 83.23 30.67 83.31 30.8C83.39 30.93 83.52 30.99 83.71 30.99C84.15 30.99 84.72 30.69 85.42 30.09C86.13 29.49 86.71 28.85 87.18 28.18C87.5 28.44 87.66 28.72 87.66 29.05C87.66 29.26 87.59 29.48 87.46 29.71C86.99 30.5 86.24 31.28 85.18 32.05C84.13 32.82 83.07 33.21 82.01 33.21C81.34 33.21 80.81 33.02 80.43 32.62C80.05 32.23 79.86 31.66 79.86 30.92C79.86 30.3 80.05 29.22 80.44 27.7L82.04 21.55C82.25 20.74 82.35 20.13 82.35 19.71C82.35 19.2 82.15 18.95 81.73 18.95C81.22 18.95 80.55 19.33 79.72 20.08C78.88 20.83 78.04 21.94 77.18 23.41C76.33 24.88 75.59 26.62 74.96 28.63L74.16 31.27C74.02 31.73 73.85 32.09 73.63 32.33C73.41 32.57 73.08 32.73 72.64 32.8L70.8 33.22L70.62 33.04L71.39 29.67C71.99 27.11 72.44 25.03 72.74 23.44C73.04 21.86 73.19 20.72 73.19 20.03C73.19 19.33 72.97 19.02 72.53 19.02C72.05 19.02 71.43 19.4 70.68 20.15C69.92 20.9 69.15 22 68.35 23.46C67.55 24.92 66.85 26.65 66.25 28.67L65.45 31.27C65.31 31.71 65.12 32.05 64.88 32.29C64.64 32.54 64.27 32.71 63.79 32.8L62.02 33.22L61.84 33.04L61.84 33.04Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M91.01 31.91C90.19 31.04 89.78 29.85 89.78 28.32C89.78 26.47 90.32 24.64 91.41 22.84C92.49 21.03 93.87 19.56 95.54 18.41C97.2 17.27 98.82 16.69 100.4 16.69C101.23 16.69 101.87 16.9 102.31 17.3C102.75 17.71 102.97 18.25 102.97 18.95C102.97 20.08 102.55 21.13 101.72 22.09C100.88 23.05 99.77 23.81 98.37 24.38C96.97 24.95 95.47 25.23 93.87 25.23H93.52C93.25 26.16 93.11 27.05 93.11 27.9C93.11 28.97 93.32 29.79 93.75 30.37C94.18 30.95 94.8 31.24 95.61 31.24C96.51 31.24 97.4 30.91 98.28 30.26C99.16 29.62 99.99 28.69 100.78 27.49C100.96 27.72 101.1 27.91 101.18 28.06C101.26 28.21 101.3 28.39 101.3 28.6C101.3 28.81 101.22 29.06 101.06 29.36C100.78 29.89 100.32 30.46 99.67 31.05C99.02 31.63 98.24 32.14 97.33 32.57C96.41 33 95.43 33.21 94.39 33.21C92.96 33.21 91.83 32.78 91.01 31.91V31.91ZM94.32 23.81C95.43 23.81 96.43 23.58 97.33 23.12C98.22 22.65 98.92 22.08 99.42 21.4C99.93 20.71 100.19 20.05 100.19 19.4C100.19 18.69 99.85 18.33 99.18 18.33C98.3 18.33 97.37 18.85 96.39 19.91C95.41 20.96 94.61 22.25 94.01 23.78C94.08 23.8 94.19 23.81 94.32 23.81L94.32 23.81Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M105.91 33.04L106.78 29.12C107.96 24.08 108.55 21.04 108.55 20.03C108.55 19.82 108.5 19.66 108.4 19.56C108.29 19.45 108.15 19.4 107.96 19.4C107.68 19.4 107.3 19.54 106.82 19.82C106.33 20.1 105.75 20.51 105.08 21.07C105.01 21 104.95 20.89 104.91 20.75C104.86 20.62 104.84 20.5 104.84 20.41C104.84 20.27 104.86 20.13 104.89 19.99C104.93 19.85 105.01 19.7 105.15 19.54C105.43 19.17 105.88 18.76 106.52 18.31C107.16 17.86 107.83 17.47 108.55 17.16C109.27 16.85 109.89 16.69 110.43 16.69C110.79 16.69 111.06 16.79 111.21 16.97C111.36 17.16 111.43 17.47 111.43 17.91C111.43 19.09 111.05 21.2 110.29 24.26C111.42 22.08 112.72 20.28 114.19 18.84C115.66 17.41 117.14 16.69 118.65 16.69C119.37 16.69 119.92 16.88 120.3 17.25C120.68 17.62 120.87 18.14 120.87 18.81C120.87 19.48 120.67 20.57 120.28 22.07L118.72 27.97C118.44 28.99 118.3 29.74 118.3 30.23C118.3 30.71 118.48 30.99 118.82 30.99C119.26 30.99 119.84 30.69 120.54 30.09C121.25 29.49 121.83 28.85 122.29 28.18C122.62 28.43 122.78 28.72 122.78 29.05C122.78 29.26 122.71 29.48 122.57 29.71C122.32 30.17 121.91 30.67 121.34 31.22C120.77 31.76 120.12 32.23 119.39 32.62C118.67 33.02 117.92 33.21 117.16 33.21C116.46 33.21 115.92 33.02 115.54 32.62C115.16 32.23 114.97 31.63 114.97 30.82C114.97 30.15 115.18 29.04 115.59 27.49L117.09 22.14C117.36 21.05 117.5 20.24 117.5 19.71C117.5 19.18 117.32 18.95 116.95 18.95C116.37 18.95 115.65 19.35 114.8 20.15C113.94 20.95 113.08 22.09 112.21 23.58C111.34 25.07 110.63 26.84 110.08 28.87L109.45 31.06C109.31 31.59 109.13 31.98 108.9 32.22C108.67 32.47 108.33 32.65 107.89 32.76L106.09 33.21L105.91 33.04L105.91 33.04Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M126.29 32.28C125.82 31.65 125.59 30.84 125.59 29.85C125.59 29.27 125.7 28.37 125.9 27.16C126.11 25.94 126.47 24.18 126.98 21.87L127.6 18.88H124.52L124.76 17.49L127.99 17.15L130.03 13.12C130.24 12.75 130.43 12.48 130.59 12.32C130.75 12.16 130.95 12.06 131.18 12.01C131.41 11.96 131.76 11.94 132.22 11.94L132.36 12.11L131.28 17.15H136.07L135.9 18.01C135.85 18.36 135.75 18.59 135.6 18.71C135.45 18.82 135.18 18.88 134.79 18.88H130.9L130.24 21.94C129.73 24.34 129.37 26.11 129.17 27.23C128.96 28.35 128.85 29.14 128.85 29.61C128.85 30 128.93 30.29 129.08 30.47C129.23 30.66 129.48 30.75 129.82 30.75C130.42 30.75 131.14 30.5 131.98 30.01C132.81 29.51 133.55 28.89 134.2 28.15C134.57 28.43 134.75 28.69 134.75 28.95C134.75 29.39 134.42 29.95 133.75 30.63C133.07 31.31 132.25 31.91 131.26 32.43C130.28 32.96 129.34 33.22 128.44 33.22C127.47 33.22 126.75 32.9 126.28 32.28L126.29 32.28Z' fill='%23FAFAF9'%3E%3C/path%3E%3C/svg%3E",Q=120.52/21.28;function I(){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 ee(i,e,t=I(),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.46"),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.46"),s&&(r.set("entry","link"),s.campaignId&&r.set("campaignId",s.campaignId)),`${i}/en/embed/sync?${r.toString()}`}const O=500,_=700,te=500;class ie{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-O)/2),r=Math.round(window.screenY+(window.outerHeight-_)/2);if(this.popup=window.open(t,"moment-oauth-popup",`width=${O},height=${_},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),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=se(e,I());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())},te)}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 se(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 t}const M="moment-sdk-styles",k="moment-sdk-close",R="moment-sdk-tray",ne=`
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
- .${_}:focus-visible {
26
+ .${k}:focus-visible {
27
27
  outline: 2px solid #ffffff;
28
28
  outline-offset: 0;
29
29
  box-shadow: 0 0 0 4px #121316;
@@ -39,4 +39,4 @@
39
39
  animation: moment-sdk-tray-in 0.35s cubic-bezier(0.32, 0.72, 0, 1);
40
40
  }
41
41
  }
42
- `;function J(){if(typeof document>"u"||document.getElementById(M))return;const i=document.createElement("style");i.id=M,i.textContent=q,document.head.appendChild(i)}function Q(i){return typeof i=="string"&&i.startsWith("webcal://")}function ee(i){return!i||i.closed?"blocked":"opened"}const te=1024,y=600,ie=400,ne=40,k=80,H=90,se=420,re=520,w=32,E=12,oe="2147483647",ae='button, [href], input, select, textarea, iframe, [tabindex]:not([tabindex="-1"])',B="#38393B",le="#4B4B4E",de={position:"absolute",top:"16px",right:"16px",zIndex:"10",width:"40px",height:"40px",padding:"0",border:"none",borderRadius:"50%",backgroundColor:B,color:"#F5F5F5",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"};function P(i,e,t=E){const n=`${t}px ${t}px 0px 0px`;if(i<te){const r=Math.floor(e*H/100)-w;return{isTray:!0,overlay:{alignItems:"flex-end",padding:"0",backdropFilter:"none"},wrapper:{maxWidth:i<y+2*ne?"none":`${y}px`,minWidth:"0",borderRadius:n,paddingBottom:"env(safe-area-inset-bottom, 0px)"},container:{maxHeight:`calc(${H}dvh - ${w}px)`,borderRadius:n},iframeMaxHeight:r,iframeOpeningHeight:Math.min(se,r)}}const s=e-k;return{isTray:!1,overlay:{alignItems:"center",padding:"16px",backdropFilter:"blur(2px)"},wrapper:{maxWidth:`${y}px`,minWidth:`${ie}px`,borderRadius:`${t}px`,paddingBottom:"0"},container:{maxHeight:`calc(100vh - ${k}px)`,borderRadius:n},iframeMaxHeight:s,iframeOpeningHeight:Math.min(re,s)}}function ce(i){return i.triggerType!=="schedule"&&i.keepOpen!==!0}const ue=32;function me(i){const e={hideCloseButton:i.closeControl==="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),e}const pe=".moment-sync-trigger",he=6,F=60,ge="#0d0d0d",fe="rgba(255, 255, 255, 0.216)",Ce="#121316",ve="https://live.dev.momentco.ai";class U{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;closeTimer=null;cardRadius=E;viewportResizeHandler=null;constructor(e){this.opts={triggerSelector:pe,...e},this.liveBaseUrl=ve;try{this.liveOrigin=new URL(this.liveBaseUrl).origin}catch{throw new Error(`[MomentSdk] Invalid VITE_LIVE_BASE_URL: "${this.liveBaseUrl}"`)}J(),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){e.externalEventId&&e.externalEventIdPrefix&&console.warn("[MomentSdk] Both externalEventId and externalEventIdPrefix provided; using externalEventId only.");const n=this.scopeOpenPayload(e);this.emitAnalytics("embed.open",{teamSlug:n.teamSlug,triggerType:n.triggerType,...t?{triggerSource:"url"}:{}}),this.createModal(n,t)}autoOpenFromUrl(e){if(!z())return;const t=W(window.location.href,e);t&&G(document,()=>{this.openWith(t.payload,t),history.replaceState(history.state,"",t.cleanUrl)})}bindTriggers(){document.querySelectorAll(this.opts.triggerSelector).forEach(t=>{const n=r=>{r.preventDefault(),this.handleTriggerClick(t)},s=this.boundClickHandlers.get(t);s&&t.removeEventListener("click",s),t.addEventListener("click",n),this.boundClickHandlers.set(t,n)})}unbindTriggers(){this.boundClickHandlers.forEach((e,t)=>{t.removeEventListener("click",e)}),this.boundClickHandlers.clear()}handleTriggerClick(e){const t=e.getAttribute("data-moment-team-slug")??"",n=e.getAttribute("data-moment-slug")??void 0,s=e.getAttribute("data-moment-list-slug")??void 0,r=e.getAttribute("data-moment-trigger-type");let o="moment";r!=null&&r!==""&&(r==="moment"||r==="list"||r==="team"||r==="brand-playlist"||r==="playlist"||r==="schedule"?o=r:console.warn("[MomentSdk] Invalid data-moment-trigger-type, falling back to 'moment':",r));const a=e.getAttribute("data-moment-ids")??e.getAttribute("data-moment-game-id")??"",u=a?a.split(",").filter(Boolean):[],c=e.getAttribute("data-moment-playlist-slugs")??"",p=c?c.split(",").map(m=>m.trim()).filter(Boolean):[],l=e.getAttribute("data-moment-calendar");let g;l!=null&&l!==""&&(l==="google"||l==="outlook"?g=l:console.warn("[MomentSdk] Invalid data-moment-calendar, ignoring value:",l));const v=e.getAttribute("data-api-source-id")??void 0,h=e.getAttribute("data-external-event-id")??void 0,f=e.getAttribute("data-external-event-id-prefix")??void 0;if(h&&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 d=o==="team"||o==="brand-playlist"||o==="playlist"||o==="schedule";this.emitAnalytics("embed.trigger.click",{teamSlug:t,triggerType:o,momentIds:d?[]:u}),this.open({teamSlug:t,momentSlug:n,listSlug:s,triggerType:o,ids:u,playlistSlugs:p,calendar:g??void 0,apiSourceId:v,externalEventId:f&&!h?void 0:h,externalEventIdPrefix:h?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 n=this.buildIframeUrl(e,t);this.overlay=document.createElement("div"),this.overlay.setAttribute("role","presentation"),Object.assign(this.overlay.style,{position:"fixed",inset:"0",zIndex:oe,display:"flex",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.5)"}),this.overlay.addEventListener("click",d=>{d.target===this.overlay&&this.handleCancel()});const s=d=>{d.key==="Escape"&&this.handleCancel()};document.addEventListener("keydown",s);const r=document.createElement("div");Object.assign(r.style,{position:"relative",width:"100%",transition:"border-radius 0.3s ease",overflow:"hidden",backgroundColor:ge,boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",display:"flex",flexDirection:"column"});const o=document.createElement("div");o.setAttribute("role","dialog"),o.setAttribute("aria-modal","true"),o.setAttribute("aria-label","Calendar sync modal"),o.tabIndex=-1,Object.assign(o.style,{position:"relative",width:"100%",transition:"border-radius 0.3s ease",overflow:"auto",backgroundColor:Ce,outline:"none"});const a=document.createElement("button");a.type="button",a.className=_,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,de),a.addEventListener("mouseenter",()=>{a.style.backgroundColor=le}),a.addEventListener("mouseleave",()=>{a.style.backgroundColor=B}),a.addEventListener("click",()=>this.handleCancel());const u=e.triggerType!=="schedule";this.iframe=document.createElement("iframe"),this.iframe.src=n,this.iframe.setAttribute("allow","web-share; clipboard-write"),this.iframe.setAttribute("sandbox","allow-scripts allow-same-origin allow-popups allow-forms"),this.iframe.setAttribute("scrolling","no"),Object.assign(this.iframe.style,{width:"100%",border:"none",display:"block",overflow:"hidden",transition:"height 0.25s cubic-bezier(0.32, 0.72, 0, 1)"}),u&&(o.appendChild(a),this.closeButton=a),o.appendChild(this.iframe);const c=document.createElement("div");Object.assign(c.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:`${he}px`,height:`${w}px`,flexShrink:"0",boxSizing:"border-box",padding:"0"});const p=document.createElement("span");p.textContent="Powered by",Object.assign(p.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=K,Object.assign(l.style,{display:"block",width:`${F}px`,height:`${(F/Y).toFixed(2)}px`}),c.appendChild(p),c.appendChild(l),this.wrapper=r,this.container=o,this.applyFrameLayout();const g=document.createElement("div");g.setAttribute("aria-hidden","true"),Object.assign(g.style,{position:"absolute",inset:"0",borderRadius:"inherit",boxShadow:`inset 0 0 0 1px ${fe}`,pointerEvents:"none",zIndex:"2"}),r.appendChild(o),r.appendChild(c),r.appendChild(g),this.overlay.appendChild(r),document.body.appendChild(this.overlay),this.viewportResizeHandler=()=>this.applyFrameLayout(),window.addEventListener("resize",this.viewportResizeHandler);const v=()=>o.querySelectorAll(ae),h=d=>{if(d.key!=="Tab")return;const m=v(),C=m[0],N=m[m.length-1],S=document.activeElement;d.shiftKey&&(S===C||S===o)?(d.preventDefault(),N.focus()):!d.shiftKey&&S===N&&(d.preventDefault(),C.focus())};o.addEventListener("keydown",h);const f=d=>{const m=document.createElement("span");return m.tabIndex=0,Object.assign(m.style,{position:"fixed",opacity:"0"}),m.addEventListener("focus",()=>{const C=v();C[d==="first"?0:C.length-1].focus()}),m};o.before(f("last")),o.after(f("first")),o.focus(),this.previousBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.didManageBodyOverflow=!0,this.setupMessageListener(),this.overlay._escHandler=s,this.overlay._focusTrapHandler=h}applyFrameLayout(){if(!this.overlay||!this.wrapper||!this.container||!this.iframe)return;const e=P(window.innerWidth,window.innerHeight,this.cardRadius);Object.assign(this.overlay.style,e.overlay),Object.assign(this.wrapper.style,e.wrapper),Object.assign(this.container.style,e.container),this.wrapper.classList.toggle(R,e.isTray);const t=Number.parseFloat(this.iframe.style.height),n=Number.isNaN(t)?e.iframeOpeningHeight:Math.min(t,e.iframeMaxHeight);this.iframe.style.height=`${n}px`}buildIframeUrl(e,t){return V(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 n=t;this.emitAnalytics("oauth.start",{provider:n.provider,teamSlug:n.teamSlug}),this.handleOAuthStart(n);return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.resize"){const n=typeof t.height=="number"?t.height:0;if(n>0&&this.iframe){const{iframeMaxHeight:s}=P(window.innerWidth,window.innerHeight);this.iframe.style.height=`${Math.min(n,s)}px`}return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.theme"){const n=me(t);n.cardRadius!==void 0&&(this.cardRadius=n.cardRadius,this.applyFrameLayout()),n.hideCloseButton&&this.closeButton&&(document.activeElement===this.closeButton&&this.container?.focus(),this.closeButton.remove()),n.surface!==void 0&&this.container&&(this.container.style.backgroundColor=n.surface);return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.open.url"){const{url:n}=t;if(Q(n)){const s=ee(window.open(n,"_blank"));s==="blocked"&&this.emitAnalytics("open.url.blocked",{}),this.sendOpenUrlStatus(s,n)}else this.sendOpenUrlStatus("blocked",typeof n=="string"?n:"");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.result"){const n=t;this.handleResult(n)}}},window.addEventListener("message",this.messageHandler)}handleOAuthStart(e){this.popupBridge&&(this.popupBridge.cleanup(),this.popupBridge=null),this.popupBridge=new X({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 n=this.iframe?.contentWindow;if(!n)return;const s={source:"moment-sdk",type:"moment.embed.open.url.status",status:e,url:t};n.postMessage(s,this.liveOrigin)}handleResult(e){if(e.result==="success"||e.result==="partial")this.emitAnalytics("subscribe.success",{provider:e.provider,triggerType:e.triggerType,momentIds:e.momentIds}),this.opts.onSuccess?.(e);else if(e.result==="error")this.emitAnalytics("subscribe.error",{provider:e.provider,triggerType:e.triggerType,momentIds:e.momentIds}),this.opts.onError?.(e);else if(e.result==="cancelled")return;this.opts.onClose?.(e),this.emitAnalytics("embed.close"),ce(e)&&(this.closeTimer=setTimeout(()=>this.cleanup(),1500))}handleCancel(){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()}cleanup(){if(this.closeTimer&&(clearTimeout(this.closeTimer),this.closeTimer=null),this.popupBridge&&(this.popupBridge.cleanup(),this.popupBridge=null),this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.viewportResizeHandler&&(window.removeEventListener("resize",this.viewportResizeHandler),this.viewportResizeHandler=null),this.overlay){const{_escHandler:e,_focusTrapHandler:t}=this.overlay;e&&document.removeEventListener("keydown",e);const n=this.overlay.firstElementChild;n&&t&&n.removeEventListener("keydown",t),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.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 D(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=U,i.createMomentButton=D}b.MomentSdk=U,b.createMomentButton=D,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})(this.MomentSdk=this.MomentSdk||{});
42
+ `;function re(){if(typeof document>"u"||document.getElementById(M))return;const i=document.createElement("style");i.id=M,i.textContent=ne,document.head.appendChild(i)}function oe(i){return typeof i=="string"&&i.startsWith("webcal://")}function ae(i){return!i||i.closed?"blocked":"opened"}const le=1024,w=600,de=400,ce=40,H=80,B=90,ue=420,me=520,P=48,F="#0d0d0d",v="#121316",pe={backgroundColor:F,boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",backdropFilter:"none",webkitBackdropFilter:"none"},U="inset 0 0.5px 0.75px rgb(255 255 255 / 0.6)",he="inset 0 -0.5px 0.75px rgb(255 255 255 / 0.3)",D=["0 0 0 0.5px #9c9c9c","0 4px 8px 0 #0000001f","0 12px 32px 0 #00000047"],N={backgroundColor:"rgb(19 19 19 / 0.812)",backdropFilter:"blur(14px)",webkitBackdropFilter:"blur(14px)",boxShadow:[U,he,...D].join(", ")},ge={...N,boxShadow:[U,...D].join(", ")},S=32,E=12,fe="2147483647",Ce='button, [href], input, select, textarea, iframe, [tabindex]:not([tabindex="-1"])',j="#38393B",be="#4B4B4E",ve={position:"absolute",top:"16px",right:"16px",zIndex:"10",width:"40px",height:"40px",padding:"0",border:"none",borderRadius:"50%",backgroundColor:j,color:"#F5F5F5",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"};function ye(i,e,t=E,s="v1",r=0,o=v){const n=s==="v2",a=i<le,d={showFooter:!n,material:n?"glass":"solid",wrapperMaterial:n?a?ge:N:pe,card:{backgroundColor:n?"transparent":o},iframe:n?{background:"transparent",colorScheme:"dark"}:{background:"",colorScheme:""}},m=n?"rgba(0, 0, 0, 0.4)":"rgba(0, 0, 0, 0.5)",l=`${t}px ${t}px 0px 0px`;if(a){const g=n?e-P-r:Math.floor(e*B/100)-S;return{isTray:!0,overlay:{alignItems:"flex-end",padding:"0",backdropFilter:"none",backgroundColor:m},wrapper:{maxWidth:i<w+2*ce?"none":`${w}px`,minWidth:"0",borderRadius:l,paddingBottom:"env(safe-area-inset-bottom, 0px)"},container:{maxHeight:n?`calc(100dvh - ${P}px - env(safe-area-inset-bottom, 0px))`:`calc(${B}dvh - ${S}px)`,borderRadius:l},iframeMaxHeight:g,iframeOpeningHeight:Math.min(ue,g),...d}}const p=e-H;return{isTray:!1,overlay:{alignItems:"center",padding:"16px",backdropFilter:"blur(2px)",backgroundColor:m},wrapper:{maxWidth:`${w}px`,minWidth:`${de}px`,borderRadius:`${t}px`,paddingBottom:"0"},container:{maxHeight:`calc(100vh - ${H}px)`,borderRadius:l},iframeMaxHeight:p,iframeOpeningHeight:Math.min(me,p),...d}}function $(i,e){return Math.min(i,e)}function we(i){return i.triggerType!=="schedule"&&i.keepOpen!==!0}const Se=32;function Ee(i){const e={hideCloseButton:i.closeControl==="embed"};return typeof i.borderRadius=="number"&&Number.isFinite(i.borderRadius)&&(e.cardRadius=Math.max(0,Math.min(i.borderRadius,Se))),typeof i.surface=="string"&&i.surface!==""&&(e.surface=i.surface),(i.design==="v1"||i.design==="v2")&&(e.design=i.design),e}const xe=".moment-sync-trigger",Ae=6,G=60,Le="rgba(255, 255, 255, 0.216)",Te="https://live.dev.momentco.ai";class W{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;closeTimer=null;cardRadius=E;design="v1";surface=v;lastRequestedHeight=null;footer=null;hairline=null;viewportResizeHandler=null;constructor(e){this.opts={triggerSelector:xe,...e},this.liveBaseUrl=Te;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){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(!Z())return;const t=q(window.location.href,e);t&&X(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")??"",u=a?a.split(",").filter(Boolean):[],d=e.getAttribute("data-moment-playlist-slugs")??"",m=d?d.split(",").map(h=>h.trim()).filter(Boolean):[],l=e.getAttribute("data-moment-calendar");let p;l!=null&&l!==""&&(l==="google"||l==="outlook"?p=l:console.warn("[MomentSdk] Invalid data-moment-calendar, ignoring value:",l));const g=e.getAttribute("data-api-source-id")??void 0,f=e.getAttribute("data-external-event-id")??void 0,C=e.getAttribute("data-external-event-id-prefix")??void 0;if(f&&C&&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?[]:u}),this.open({teamSlug:t,momentSlug:s,listSlug:r,triggerType:n,ids:u,playlistSlugs:m,calendar:p??void 0,apiSourceId:g,externalEventId:C&&!f?void 0:f,externalEventIdPrefix:f?void 0:C})}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:fe,display:"flex",justifyContent:"center"}),this.overlay.addEventListener("click",c=>{c.target===this.overlay&&this.handleCancel()});const r=c=>{c.key==="Escape"&&this.handleCancel()};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:F,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:v,outline:"none"});const a=document.createElement("button");a.type="button",a.className=k,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,ve),a.addEventListener("mouseenter",()=>{a.style.backgroundColor=be}),a.addEventListener("mouseleave",()=>{a.style.backgroundColor=j}),a.addEventListener("click",()=>this.handleCancel());const u=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:"height 0.25s cubic-bezier(0.32, 0.72, 0, 1)"}),u&&(n.appendChild(a),this.closeButton=a),n.appendChild(this.iframe);const d=document.createElement("div");this.footer=d,Object.assign(d.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:`${Ae}px`,height:`${S}px`,flexShrink:"0",boxSizing:"border-box",padding:"0"});const m=document.createElement("span");m.textContent="Powered by",Object.assign(m.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=J,Object.assign(l.style,{display:"block",width:`${G}px`,height:`${(G/Q).toFixed(2)}px`}),d.appendChild(m),d.appendChild(l),this.wrapper=o,this.container=n,this.applyFrameLayout();const p=document.createElement("div");this.hairline=p,p.setAttribute("aria-hidden","true"),Object.assign(p.style,{position:"absolute",inset:"0",borderRadius:"inherit",boxShadow:`inset 0 0 0 1px ${Le}`,pointerEvents:"none",zIndex:"2"}),o.appendChild(n),o.appendChild(d),o.appendChild(p),this.overlay.appendChild(o),document.body.appendChild(this.overlay),this.viewportResizeHandler=()=>this.applyFrameLayout(),window.addEventListener("resize",this.viewportResizeHandler);const g=()=>n.querySelectorAll(Ce),f=c=>{if(c.key!=="Tab")return;const h=g(),b=h[0],K=h[h.length-1],x=document.activeElement;c.shiftKey&&(x===b||x===n)?(c.preventDefault(),K.focus()):!c.shiftKey&&x===K&&(c.preventDefault(),b.focus())};n.addEventListener("keydown",f);const C=c=>{const h=document.createElement("span");return h.tabIndex=0,Object.assign(h.style,{position:"fixed",opacity:"0"}),h.addEventListener("focus",()=>{const b=g();b[c==="first"?0:b.length-1].focus()}),h};n.before(C("last")),n.after(C("first")),n.focus(),this.previousBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.didManageBodyOverflow=!0,this.setupMessageListener(),this.overlay._escHandler=r,this.overlay._focusTrapHandler=f}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),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);const t=Number.parseFloat(this.iframe.style.height),s=this.lastRequestedHeight!==null?$(this.lastRequestedHeight,e.iframeMaxHeight):Number.isNaN(t)?e.iframeOpeningHeight:Math.min(t,e.iframeMaxHeight);this.iframe.style.height=`${s}px`}currentLayout(){const e=this.wrapper&&Number.parseFloat(getComputedStyle(this.wrapper).paddingBottom)||0;return ye(window.innerWidth,window.innerHeight,this.cardRadius,this.design,e,this.surface)}buildIframeUrl(e,t){return ee(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=`${$(s,r)}px`}return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.theme"){const s=Ee(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());return}if(t.source==="moment-live-embed"&&t.type==="moment.embed.open.url"){const{url:s}=t;if(oe(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.close"){this.handleCancel();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 ie({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){if(e.result==="success"||e.result==="partial")this.emitAnalytics("subscribe.success",{provider:e.provider,triggerType:e.triggerType,momentIds:e.momentIds}),this.opts.onSuccess?.(e);else if(e.result==="error")this.emitAnalytics("subscribe.error",{provider:e.provider,triggerType:e.triggerType,momentIds:e.momentIds}),this.opts.onError?.(e);else if(e.result==="cancelled")return;this.opts.onClose?.(e),this.emitAnalytics("embed.close"),we(e)&&(this.closeTimer=setTimeout(()=>this.cleanup(),1500))}handleCancel(){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()}cleanup(){if(this.closeTimer&&(clearTimeout(this.closeTimer),this.closeTimer=null),this.popupBridge&&(this.popupBridge.cleanup(),this.popupBridge=null),this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.design="v1",this.surface=v,this.lastRequestedHeight=null,this.footer=null,this.hairline=null,this.viewportResizeHandler&&(window.removeEventListener("resize",this.viewportResizeHandler),this.viewportResizeHandler=null),this.overlay){const{_escHandler:e,_focusTrapHandler:t}=this.overlay;e&&document.removeEventListener("keydown",e);const s=this.overlay.firstElementChild;s&&t&&s.removeEventListener("keydown",t),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.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 z(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=W,i.createMomentButton=z}y.MomentSdk=W,y.createMomentButton=z,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})})(this.MomentSdk=this.MomentSdk||{});
@@ -1,49 +1,49 @@
1
- const S = "moment_sync", T = "moment_campaign";
2
- const U = /^(?:schedule|(moment|list):([a-z0-9-]+)|playlist:([a-z0-9-]+(?:,[a-z0-9-]+)*))$/, D = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
3
- function N(i, e) {
1
+ const A = "moment_sync", L = "moment_campaign";
2
+ const W = /^(?:schedule|(moment|list):([a-z0-9-]+)|playlist:([a-z0-9-]+(?:,[a-z0-9-]+)*))$/, z = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
3
+ function K(i, e) {
4
4
  if (!e) return null;
5
- const t = new URL(i), n = t.searchParams.get(S);
6
- if (n === null || n.length > 200) return null;
7
- const s = U.exec(n);
8
- if (!s) return null;
9
- const [, r, o, a] = s;
5
+ const t = new URL(i), s = t.searchParams.get(A);
6
+ if (s === null || s.length > 200) return null;
7
+ const r = W.exec(s);
8
+ if (!r) return null;
9
+ const [, o, n, a] = r;
10
10
  let u;
11
- r === "moment" ? u = { teamSlug: e, triggerType: "moment", momentSlug: o } : r === "list" ? u = { teamSlug: e, triggerType: "list", listSlug: o } : a ? u = { teamSlug: e, triggerType: "playlist", playlistSlugs: a.split(",") } : u = { teamSlug: e, triggerType: "schedule" };
12
- const c = t.searchParams.get(T);
11
+ o === "moment" ? u = { teamSlug: e, triggerType: "moment", momentSlug: n } : o === "list" ? u = { teamSlug: e, triggerType: "list", listSlug: n } : a ? u = { teamSlug: e, triggerType: "playlist", playlistSlugs: a.split(",") } : u = { teamSlug: e, triggerType: "schedule" };
12
+ const d = t.searchParams.get(L);
13
13
  return t.search = t.search.slice(1).split("&").filter((p) => {
14
14
  const l = p.split("=", 1)[0];
15
- return l !== S && l !== T;
15
+ return l !== A && l !== L;
16
16
  }).join("&"), {
17
17
  payload: u,
18
- ...c && D.test(c) ? { campaignId: c } : {},
18
+ ...d && z.test(d) ? { campaignId: d } : {},
19
19
  cleanUrl: t.href
20
20
  };
21
21
  }
22
- let x = !1;
23
- function $() {
24
- return x ? !1 : (x = !0, !0);
22
+ let T = !1;
23
+ function V() {
24
+ return T ? !1 : (T = !0, !0);
25
25
  }
26
- function W(i, e) {
26
+ function Y(i, e) {
27
27
  i.body ? e() : i.addEventListener("DOMContentLoaded", e, { once: !0 });
28
28
  }
29
- const j = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='15.55 11.94 120.52 21.28'%3E%3Cpath d='M16.59 33.04L17.42 29.54C18.62 24.54 19.22 21.32 19.22 19.89C19.22 19.68 19.19 19.54 19.12 19.47C19.05 19.4 18.91 19.38 18.7 19.4C18.4 19.47 17.97 19.65 17.42 19.94C16.86 20.23 16.32 20.62 15.79 21.1C15.63 20.9 15.55 20.69 15.55 20.48C15.55 20.27 15.65 20.03 15.86 19.75C16.16 19.38 16.65 18.95 17.33 18.45C18.02 17.95 18.74 17.53 19.5 17.2C20.27 16.86 20.92 16.7 21.48 16.7C21.78 16.7 22 16.79 22.14 16.99C22.28 17.19 22.35 17.5 22.35 17.94C22.35 18.55 22.24 19.42 22.04 20.56C21.83 21.71 21.55 22.88 21.2 24.09C22.34 21.96 23.59 20.19 24.95 18.79C26.32 17.4 27.7 16.7 29.12 16.7C29.79 16.7 30.27 16.87 30.57 17.23C30.87 17.59 31.02 18.14 31.02 18.88C31.02 19.97 30.69 21.7 30.02 24.09C31.13 22.01 32.44 20.25 33.94 18.83C35.44 17.41 36.94 16.7 38.42 16.7C39.11 16.7 39.63 16.88 39.98 17.25C40.33 17.62 40.5 18.16 40.5 18.88C40.5 19.18 40.45 19.62 40.34 20.18C40.24 20.75 40.1 21.37 39.91 22.04L38.42 27.7C38.09 28.92 37.93 29.77 37.93 30.23C37.93 30.48 37.97 30.67 38.05 30.8C38.13 30.93 38.27 30.99 38.45 30.99C38.89 30.99 39.47 30.69 40.17 30.09C40.88 29.49 41.46 28.85 41.92 28.18C42.25 28.44 42.41 28.72 42.41 29.05C42.41 29.26 42.34 29.48 42.2 29.71C41.74 30.5 40.98 31.28 39.93 32.05C38.87 32.82 37.82 33.21 36.75 33.21C36.08 33.21 35.56 33.02 35.17 32.62C34.79 32.23 34.6 31.66 34.6 30.92C34.6 30.3 34.8 29.22 35.19 27.7L36.79 21.55C37 20.74 37.1 20.13 37.1 19.71C37.1 19.2 36.89 18.95 36.48 18.95C35.97 18.95 35.3 19.33 34.46 20.08C33.63 20.83 32.79 21.94 31.93 23.41C31.07 24.88 30.33 26.62 29.71 28.63L28.91 31.27C28.77 31.73 28.59 32.09 28.37 32.33C28.15 32.57 27.82 32.73 27.38 32.8L25.54 33.22L25.37 33.04L26.13 29.67C26.73 27.11 27.19 25.03 27.49 23.44C27.79 21.86 27.94 20.72 27.94 20.03C27.94 19.33 27.72 19.02 27.28 19.02C26.79 19.02 26.17 19.4 25.42 20.15C24.67 20.9 23.89 22 23.1 23.46C22.3 24.92 21.6 26.65 21 28.67L20.2 31.27C20.06 31.71 19.87 32.05 19.63 32.29C19.38 32.54 19.02 32.71 18.53 32.8L16.76 33.22L16.59 33.04L16.59 33.04Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M57.66 17.94C57 17.13 55.99 16.73 54.62 16.73C52.93 16.73 51.31 17.3 49.75 18.43C49.51 18.6 49.28 18.78 49.06 18.97C49.24 19.85 49.39 20.78 49.48 21.74C49.86 21.01 50.3 20.37 50.79 19.82C51.63 18.87 52.5 18.39 53.41 18.39C54.08 18.39 54.55 18.68 54.81 19.24C55.08 19.81 55.21 20.58 55.21 21.55C55.21 23.08 54.97 24.63 54.48 26.19C54 27.75 53.35 29.03 52.54 30.04C51.73 31.04 50.86 31.55 49.94 31.55C49.53 31.55 49.19 31.44 48.9 31.22C48.74 31.9 48.54 32.55 48.31 33.19C48.5 33.2 48.7 33.21 48.9 33.21C50.54 33.21 52.11 32.63 53.61 31.48C55.12 30.32 56.33 28.82 57.26 26.98C58.18 25.14 58.65 23.28 58.65 21.38C58.65 19.9 58.32 18.75 57.66 17.94L57.66 17.94Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M61.84 33.04L62.67 29.54C63.88 24.54 64.48 21.32 64.48 19.89C64.48 19.68 64.44 19.54 64.37 19.47C64.3 19.4 64.17 19.38 63.96 19.4C63.66 19.47 63.23 19.65 62.67 19.94C62.12 20.23 61.57 20.62 61.04 21.1C60.88 20.9 60.8 20.69 60.8 20.48C60.8 20.27 60.9 20.03 61.11 19.75C61.41 19.38 61.9 18.95 62.59 18.45C63.27 17.95 63.99 17.53 64.76 17.2C65.52 16.86 66.18 16.7 66.73 16.7C67.04 16.7 67.26 16.79 67.39 16.99C67.53 17.19 67.6 17.5 67.6 17.94C67.6 18.55 67.5 19.42 67.29 20.56C67.08 21.71 66.8 22.88 66.46 24.09C67.59 21.96 68.84 20.19 70.2 18.79C71.57 17.4 72.96 16.7 74.37 16.7C75.04 16.7 75.53 16.87 75.83 17.23C76.13 17.59 76.28 18.14 76.28 18.88C76.28 19.97 75.94 21.7 75.27 24.09C76.38 22.01 77.69 20.25 79.19 18.83C80.7 17.41 82.19 16.7 83.67 16.7C84.36 16.7 84.89 16.88 85.23 17.25C85.58 17.62 85.75 18.16 85.75 18.88C85.75 19.18 85.7 19.62 85.6 20.18C85.49 20.75 85.35 21.37 85.16 22.04L83.67 27.7C83.35 28.92 83.19 29.77 83.19 30.23C83.19 30.48 83.23 30.67 83.31 30.8C83.39 30.93 83.52 30.99 83.71 30.99C84.15 30.99 84.72 30.69 85.42 30.09C86.13 29.49 86.71 28.85 87.18 28.18C87.5 28.44 87.66 28.72 87.66 29.05C87.66 29.26 87.59 29.48 87.46 29.71C86.99 30.5 86.24 31.28 85.18 32.05C84.13 32.82 83.07 33.21 82.01 33.21C81.34 33.21 80.81 33.02 80.43 32.62C80.05 32.23 79.86 31.66 79.86 30.92C79.86 30.3 80.05 29.22 80.44 27.7L82.04 21.55C82.25 20.74 82.35 20.13 82.35 19.71C82.35 19.2 82.15 18.95 81.73 18.95C81.22 18.95 80.55 19.33 79.72 20.08C78.88 20.83 78.04 21.94 77.18 23.41C76.33 24.88 75.59 26.62 74.96 28.63L74.16 31.27C74.02 31.73 73.85 32.09 73.63 32.33C73.41 32.57 73.08 32.73 72.64 32.8L70.8 33.22L70.62 33.04L71.39 29.67C71.99 27.11 72.44 25.03 72.74 23.44C73.04 21.86 73.19 20.72 73.19 20.03C73.19 19.33 72.97 19.02 72.53 19.02C72.05 19.02 71.43 19.4 70.68 20.15C69.92 20.9 69.15 22 68.35 23.46C67.55 24.92 66.85 26.65 66.25 28.67L65.45 31.27C65.31 31.71 65.12 32.05 64.88 32.29C64.64 32.54 64.27 32.71 63.79 32.8L62.02 33.22L61.84 33.04L61.84 33.04Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M91.01 31.91C90.19 31.04 89.78 29.85 89.78 28.32C89.78 26.47 90.32 24.64 91.41 22.84C92.49 21.03 93.87 19.56 95.54 18.41C97.2 17.27 98.82 16.69 100.4 16.69C101.23 16.69 101.87 16.9 102.31 17.3C102.75 17.71 102.97 18.25 102.97 18.95C102.97 20.08 102.55 21.13 101.72 22.09C100.88 23.05 99.77 23.81 98.37 24.38C96.97 24.95 95.47 25.23 93.87 25.23H93.52C93.25 26.16 93.11 27.05 93.11 27.9C93.11 28.97 93.32 29.79 93.75 30.37C94.18 30.95 94.8 31.24 95.61 31.24C96.51 31.24 97.4 30.91 98.28 30.26C99.16 29.62 99.99 28.69 100.78 27.49C100.96 27.72 101.1 27.91 101.18 28.06C101.26 28.21 101.3 28.39 101.3 28.6C101.3 28.81 101.22 29.06 101.06 29.36C100.78 29.89 100.32 30.46 99.67 31.05C99.02 31.63 98.24 32.14 97.33 32.57C96.41 33 95.43 33.21 94.39 33.21C92.96 33.21 91.83 32.78 91.01 31.91V31.91ZM94.32 23.81C95.43 23.81 96.43 23.58 97.33 23.12C98.22 22.65 98.92 22.08 99.42 21.4C99.93 20.71 100.19 20.05 100.19 19.4C100.19 18.69 99.85 18.33 99.18 18.33C98.3 18.33 97.37 18.85 96.39 19.91C95.41 20.96 94.61 22.25 94.01 23.78C94.08 23.8 94.19 23.81 94.32 23.81L94.32 23.81Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M105.91 33.04L106.78 29.12C107.96 24.08 108.55 21.04 108.55 20.03C108.55 19.82 108.5 19.66 108.4 19.56C108.29 19.45 108.15 19.4 107.96 19.4C107.68 19.4 107.3 19.54 106.82 19.82C106.33 20.1 105.75 20.51 105.08 21.07C105.01 21 104.95 20.89 104.91 20.75C104.86 20.62 104.84 20.5 104.84 20.41C104.84 20.27 104.86 20.13 104.89 19.99C104.93 19.85 105.01 19.7 105.15 19.54C105.43 19.17 105.88 18.76 106.52 18.31C107.16 17.86 107.83 17.47 108.55 17.16C109.27 16.85 109.89 16.69 110.43 16.69C110.79 16.69 111.06 16.79 111.21 16.97C111.36 17.16 111.43 17.47 111.43 17.91C111.43 19.09 111.05 21.2 110.29 24.26C111.42 22.08 112.72 20.28 114.19 18.84C115.66 17.41 117.14 16.69 118.65 16.69C119.37 16.69 119.92 16.88 120.3 17.25C120.68 17.62 120.87 18.14 120.87 18.81C120.87 19.48 120.67 20.57 120.28 22.07L118.72 27.97C118.44 28.99 118.3 29.74 118.3 30.23C118.3 30.71 118.48 30.99 118.82 30.99C119.26 30.99 119.84 30.69 120.54 30.09C121.25 29.49 121.83 28.85 122.29 28.18C122.62 28.43 122.78 28.72 122.78 29.05C122.78 29.26 122.71 29.48 122.57 29.71C122.32 30.17 121.91 30.67 121.34 31.22C120.77 31.76 120.12 32.23 119.39 32.62C118.67 33.02 117.92 33.21 117.16 33.21C116.46 33.21 115.92 33.02 115.54 32.62C115.16 32.23 114.97 31.63 114.97 30.82C114.97 30.15 115.18 29.04 115.59 27.49L117.09 22.14C117.36 21.05 117.5 20.24 117.5 19.71C117.5 19.18 117.32 18.95 116.95 18.95C116.37 18.95 115.65 19.35 114.8 20.15C113.94 20.95 113.08 22.09 112.21 23.58C111.34 25.07 110.63 26.84 110.08 28.87L109.45 31.06C109.31 31.59 109.13 31.98 108.9 32.22C108.67 32.47 108.33 32.65 107.89 32.76L106.09 33.21L105.91 33.04L105.91 33.04Z' fill='%23FAFAF9'%3E%3C/path%3E%3Cpath d='M126.29 32.28C125.82 31.65 125.59 30.84 125.59 29.85C125.59 29.27 125.7 28.37 125.9 27.16C126.11 25.94 126.47 24.18 126.98 21.87L127.6 18.88H124.52L124.76 17.49L127.99 17.15L130.03 13.12C130.24 12.75 130.43 12.48 130.59 12.32C130.75 12.16 130.95 12.06 131.18 12.01C131.41 11.96 131.76 11.94 132.22 11.94L132.36 12.11L131.28 17.15H136.07L135.9 18.01C135.85 18.36 135.75 18.59 135.6 18.71C135.45 18.82 135.18 18.88 134.79 18.88H130.9L130.24 21.94C129.73 24.34 129.37 26.11 129.17 27.23C128.96 28.35 128.85 29.14 128.85 29.61C128.85 30 128.93 30.29 129.08 30.47C129.23 30.66 129.48 30.75 129.82 30.75C130.42 30.75 131.14 30.5 131.98 30.01C132.81 29.51 133.55 28.89 134.2 28.15C134.57 28.43 134.75 28.69 134.75 28.95C134.75 29.39 134.42 29.95 133.75 30.63C133.07 31.31 132.25 31.91 131.26 32.43C130.28 32.96 129.34 33.22 128.44 33.22C127.47 33.22 126.75 32.9 126.28 32.28L126.29 32.28Z' fill='%23FAFAF9'%3E%3C/path%3E%3C/svg%3E", z = 120.52 / 21.28;
30
- function H() {
29
+ const q = "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", Z = 120.52 / 21.28;
30
+ function P() {
31
31
  if (typeof window > "u") return "";
32
32
  const i = window.location.origin, e = i === "null" ? self.origin : i;
33
33
  return e === "null" && console.error(
34
34
  '[MomentSdk] This page has an opaque origin ("null"), so Moment Live cannot message it and calendar sync will not work. Serve the page over http(s), and give a sandboxed iframe allow-same-origin.'
35
35
  ), e;
36
36
  }
37
- function G(i, e, t = H(), n) {
37
+ function X(i, e, t = P(), s) {
38
38
  if (e.triggerType === "schedule") {
39
- const r = new URLSearchParams();
40
- return r.set("teamSlug", e.teamSlug), r.set("returnOrigin", t), r.set("embed", "1"), r.set("sdkVersion", "0.9.0-dev.45"), n && (r.set("entry", "link"), n.campaignId && r.set("campaignId", n.campaignId)), `${i}/en/embed/schedule?${r.toString()}`;
39
+ const o = new URLSearchParams();
40
+ return o.set("teamSlug", e.teamSlug), o.set("returnOrigin", t), o.set("embed", "1"), o.set("sdkVersion", "0.9.0-dev.46"), s && (o.set("entry", "link"), s.campaignId && o.set("campaignId", s.campaignId)), `${i}/en/embed/schedule?${o.toString()}`;
41
41
  }
42
- const s = new URLSearchParams();
43
- return s.set("teamSlug", e.teamSlug), e.momentSlug && s.set("momentSlug", e.momentSlug), e.listSlug && s.set("listSlug", e.listSlug), s.set("triggerType", e.triggerType), e.ids?.length && s.set("ids", e.ids.join(",")), e.playlistSlugs?.length && s.set("playlistSlugs", e.playlistSlugs.join(",")), e.calendar && s.set("calendar", e.calendar), e.apiSourceId && s.set("subscriptionId", e.apiSourceId), e.externalEventId && s.set("externalId", e.externalEventId), e.externalEventIdPrefix && !e.externalEventId && s.set("externalIdPrefix", e.externalEventIdPrefix), s.set("returnOrigin", t), s.set("embed", "1"), s.set("sdkVersion", "0.9.0-dev.45"), n && (s.set("entry", "link"), n.campaignId && s.set("campaignId", n.campaignId)), `${i}/en/embed/sync?${s.toString()}`;
42
+ const r = new URLSearchParams();
43
+ return r.set("teamSlug", e.teamSlug), e.momentSlug && r.set("momentSlug", e.momentSlug), e.listSlug && r.set("listSlug", e.listSlug), r.set("triggerType", e.triggerType), e.ids?.length && r.set("ids", e.ids.join(",")), e.playlistSlugs?.length && r.set("playlistSlugs", e.playlistSlugs.join(",")), e.calendar && r.set("calendar", e.calendar), e.apiSourceId && r.set("subscriptionId", e.apiSourceId), e.externalEventId && r.set("externalId", e.externalEventId), e.externalEventIdPrefix && !e.externalEventId && r.set("externalIdPrefix", e.externalEventIdPrefix), r.set("returnOrigin", t), r.set("embed", "1"), r.set("sdkVersion", "0.9.0-dev.46"), s && (r.set("entry", "link"), s.campaignId && r.set("campaignId", s.campaignId)), `${i}/en/embed/sync?${r.toString()}`;
44
44
  }
45
- const L = 500, I = 700, K = 500;
46
- class Y {
45
+ const I = 500, O = 700, J = 500;
46
+ class Q {
47
47
  popup = null;
48
48
  pollTimer = null;
49
49
  messageHandler = null;
@@ -57,19 +57,19 @@ class Y {
57
57
  */
58
58
  open(e) {
59
59
  this.cleanup(), this.resultReceived = !1;
60
- const t = this.buildPopupUrl(e), n = Math.round(window.screenX + (window.outerWidth - L) / 2), s = Math.round(window.screenY + (window.outerHeight - I) / 2);
60
+ const t = this.buildPopupUrl(e), s = Math.round(window.screenX + (window.outerWidth - I) / 2), r = Math.round(window.screenY + (window.outerHeight - O) / 2);
61
61
  if (this.popup = window.open(
62
62
  t,
63
63
  "moment-oauth-popup",
64
- `width=${L},height=${I},left=${n},top=${s},menubar=no,toolbar=no,location=yes,status=no`
64
+ `width=${I},height=${O},left=${s},top=${r},menubar=no,toolbar=no,location=yes,status=no`
65
65
  ), !this.popup || this.popup.closed) {
66
66
  this.sendStatusToIframe("popup-blocked"), this.opts.onPopupBlocked();
67
67
  return;
68
68
  }
69
- this.sendStatusToIframe("popup-opened"), this.startPolling(), this.messageHandler = (r) => {
70
- if (r.origin !== this.opts.liveOrigin || r.source !== this.popup) return;
71
- const o = r.data;
72
- !o || typeof o != "object" || o.source !== "moment-live-embed" || o.type !== "moment.embed.result" || (this.resultReceived = !0, this.sendStatusToIframe("completed"), this.opts.iframeWindow && this.opts.iframeWindow.postMessage(o, this.opts.liveOrigin), this.opts.onResult(o), this.cleanup());
69
+ this.sendStatusToIframe("popup-opened"), this.startPolling(), this.messageHandler = (o) => {
70
+ if (o.origin !== this.opts.liveOrigin || o.source !== this.popup) return;
71
+ const n = o.data;
72
+ !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), this.opts.onResult(n), this.cleanup());
73
73
  }, window.addEventListener("message", this.messageHandler);
74
74
  }
75
75
  /**
@@ -84,19 +84,13 @@ class Y {
84
84
  this.popup = null;
85
85
  }
86
86
  buildPopupUrl(e) {
87
- const t = H(), n = new URLSearchParams({
88
- provider: e.provider,
89
- teamSlug: e.teamSlug,
90
- ids: e.ids.join(","),
91
- triggerType: e.triggerType,
92
- returnOrigin: t
93
- });
94
- return e.subscriptionType && n.set("subscriptionType", e.subscriptionType), e.scheduleMomentIds?.length && n.set("scheduleMomentIds", e.scheduleMomentIds.join(",")), e.schedulePlaylistIds?.length && n.set("schedulePlaylistIds", e.schedulePlaylistIds.join(",")), this.opts.campaignId && n.set("campaignId", this.opts.campaignId), `${this.opts.liveBaseUrl}/en/embed/oauth-popup?${n.toString()}`;
87
+ const t = ee(e, P());
88
+ return this.opts.campaignId && t.set("campaignId", this.opts.campaignId), `${this.opts.liveBaseUrl}/en/embed/oauth-popup?${t.toString()}`;
95
89
  }
96
90
  startPolling() {
97
91
  this.pollTimer = setInterval(() => {
98
92
  (!this.popup || this.popup.closed) && (this.pollTimer && (clearInterval(this.pollTimer), this.pollTimer = null), this.resultReceived || (this.sendStatusToIframe("popup-closed"), this.opts.onPopupClosed()), this.cleanup());
99
- }, K);
93
+ }, J);
100
94
  }
101
95
  sendStatusToIframe(e) {
102
96
  if (!this.opts.iframeWindow) return;
@@ -108,7 +102,25 @@ class Y {
108
102
  this.opts.iframeWindow.postMessage(t, this.opts.liveOrigin);
109
103
  }
110
104
  }
111
- const O = "moment-sdk-styles", B = "moment-sdk-close", P = "moment-sdk-tray", V = `
105
+ function ee(i, e) {
106
+ const t = new URLSearchParams({
107
+ provider: i.provider,
108
+ teamSlug: i.teamSlug,
109
+ ids: i.ids.join(","),
110
+ triggerType: i.triggerType,
111
+ returnOrigin: e
112
+ });
113
+ i.subscriptionType && t.set("subscriptionType", i.subscriptionType);
114
+ const s = {
115
+ scheduleMomentIds: i.scheduleMomentIds,
116
+ schedulePlaylistIds: i.schedulePlaylistIds,
117
+ scheduleListIds: i.scheduleListIds
118
+ };
119
+ for (const [r, o] of Object.entries(s))
120
+ o?.length && t.set(r, o.join(","));
121
+ return t;
122
+ }
123
+ const _ = "moment-sdk-styles", F = "moment-sdk-close", U = "moment-sdk-tray", te = `
112
124
  :where(.moment-sync-trigger) {
113
125
  background-color: #1c1917;
114
126
  color: #ffffff;
@@ -133,7 +145,7 @@ const O = "moment-sdk-styles", B = "moment-sdk-close", P = "moment-sdk-tray", V
133
145
  outline-offset: 2px;
134
146
  }
135
147
 
136
- .${B}:focus-visible {
148
+ .${F}:focus-visible {
137
149
  outline: 2px solid #ffffff;
138
150
  outline-offset: 0;
139
151
  box-shadow: 0 0 0 4px #121316;
@@ -145,23 +157,40 @@ const O = "moment-sdk-styles", B = "moment-sdk-close", P = "moment-sdk-tray", V
145
157
  }
146
158
 
147
159
  @media (prefers-reduced-motion: no-preference) {
148
- .${P} {
160
+ .${U} {
149
161
  animation: moment-sdk-tray-in 0.35s cubic-bezier(0.32, 0.72, 0, 1);
150
162
  }
151
163
  }
152
164
  `;
153
- function Z() {
154
- if (typeof document > "u" || document.getElementById(O)) return;
165
+ function ie() {
166
+ if (typeof document > "u" || document.getElementById(_)) return;
155
167
  const i = document.createElement("style");
156
- i.id = O, i.textContent = V, document.head.appendChild(i);
168
+ i.id = _, i.textContent = te, document.head.appendChild(i);
157
169
  }
158
- function X(i) {
170
+ function se(i) {
159
171
  return typeof i == "string" && i.startsWith("webcal://");
160
172
  }
161
- function q(i) {
173
+ function ne(i) {
162
174
  return !i || i.closed ? "blocked" : "opened";
163
175
  }
164
- const J = 1024, y = 600, Q = 400, ee = 40, M = 80, _ = 90, te = 420, ie = 520, w = 32, E = 12, ne = "2147483647", se = 'button, [href], input, select, textarea, iframe, [tabindex]:not([tabindex="-1"])', F = "#38393B", re = "#4B4B4E", oe = {
176
+ const re = 1024, w = 600, oe = 400, ae = 40, M = 80, R = 90, le = 420, de = 520, k = 48, D = "#0d0d0d", v = "#121316", ce = {
177
+ backgroundColor: D,
178
+ boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.25)",
179
+ backdropFilter: "none",
180
+ webkitBackdropFilter: "none"
181
+ }, N = "inset 0 0.5px 0.75px rgb(255 255 255 / 0.6)", ue = "inset 0 -0.5px 0.75px rgb(255 255 255 / 0.3)", j = [
182
+ "0 0 0 0.5px #9c9c9c",
183
+ "0 4px 8px 0 #0000001f",
184
+ "0 12px 32px 0 #00000047"
185
+ ], $ = {
186
+ backgroundColor: "rgb(19 19 19 / 0.812)",
187
+ backdropFilter: "blur(14px)",
188
+ webkitBackdropFilter: "blur(14px)",
189
+ boxShadow: [N, ue, ...j].join(", ")
190
+ }, pe = {
191
+ ...$,
192
+ boxShadow: [N, ...j].join(", ")
193
+ }, E = 32, x = 12, me = "2147483647", he = 'button, [href], input, select, textarea, iframe, [tabindex]:not([tabindex="-1"])', G = "#38393B", ge = "#4B4B4E", fe = {
165
194
  position: "absolute",
166
195
  top: "16px",
167
196
  right: "16px",
@@ -171,68 +200,89 @@ const J = 1024, y = 600, Q = 400, ee = 40, M = 80, _ = 90, te = 420, ie = 520, w
171
200
  padding: "0",
172
201
  border: "none",
173
202
  borderRadius: "50%",
174
- backgroundColor: F,
203
+ backgroundColor: G,
175
204
  color: "#F5F5F5",
176
205
  cursor: "pointer",
177
206
  display: "flex",
178
207
  alignItems: "center",
179
208
  justifyContent: "center"
180
209
  };
181
- function R(i, e, t = E) {
182
- const n = `${t}px ${t}px 0px 0px`;
183
- if (i < J) {
184
- const r = Math.floor(e * _ / 100) - w;
210
+ function Ce(i, e, t = x, s = "v1", r = 0, o = v) {
211
+ const n = s === "v2", a = i < re, d = {
212
+ showFooter: !n,
213
+ material: n ? "glass" : "solid",
214
+ wrapperMaterial: n ? a ? pe : $ : ce,
215
+ card: { backgroundColor: n ? "transparent" : o },
216
+ iframe: n ? { background: "transparent", colorScheme: "dark" } : { background: "", colorScheme: "" }
217
+ }, p = n ? "rgba(0, 0, 0, 0.4)" : "rgba(0, 0, 0, 0.5)", l = `${t}px ${t}px 0px 0px`;
218
+ if (a) {
219
+ const g = n ? e - k - r : Math.floor(e * R / 100) - E;
185
220
  return {
186
221
  isTray: !0,
187
222
  // No blur: iPhone Safari tints its status bar and toolbar from the page, and over a blurred
188
223
  // backdrop it keeps the host page's colours instead of dimming them with the page.
189
- overlay: { alignItems: "flex-end", padding: "0", backdropFilter: "none" },
224
+ overlay: {
225
+ alignItems: "flex-end",
226
+ padding: "0",
227
+ backdropFilter: "none",
228
+ backgroundColor: p
229
+ },
190
230
  wrapper: {
191
231
  // The modal's width: at full width on a tablet the embed's pills and rows stretched. Only
192
232
  // once that leaves 40px each side: at 600–679px it left a sliver of the page down each side.
193
- maxWidth: i < y + 2 * ee ? "none" : `${y}px`,
233
+ maxWidth: i < w + 2 * ae ? "none" : `${w}px`,
194
234
  minWidth: "0",
195
- borderRadius: n,
235
+ borderRadius: l,
196
236
  paddingBottom: "env(safe-area-inset-bottom, 0px)"
197
237
  },
198
238
  container: {
199
239
  // ponytail: no vh fallback for browsers without dvh (Safari < 15.4); the iframe cap still
200
240
  // holds there.
201
- maxHeight: `calc(${_}dvh - ${w}px)`,
202
- borderRadius: n
241
+ maxHeight: n ? `calc(100dvh - ${k}px - env(safe-area-inset-bottom, 0px))` : `calc(${R}dvh - ${E}px)`,
242
+ borderRadius: l
203
243
  },
204
- iframeMaxHeight: r,
205
- iframeOpeningHeight: Math.min(te, r)
244
+ iframeMaxHeight: g,
245
+ iframeOpeningHeight: Math.min(le, g),
246
+ ...d
206
247
  };
207
248
  }
208
- const s = e - M;
249
+ const m = e - M;
209
250
  return {
210
251
  isTray: !1,
211
- overlay: { alignItems: "center", padding: "16px", backdropFilter: "blur(2px)" },
252
+ overlay: {
253
+ alignItems: "center",
254
+ padding: "16px",
255
+ backdropFilter: "blur(2px)",
256
+ backgroundColor: p
257
+ },
212
258
  wrapper: {
213
- maxWidth: `${y}px`,
214
- minWidth: `${Q}px`,
259
+ maxWidth: `${w}px`,
260
+ minWidth: `${oe}px`,
215
261
  borderRadius: `${t}px`,
216
262
  paddingBottom: "0"
217
263
  },
218
264
  container: {
219
265
  maxHeight: `calc(100vh - ${M}px)`,
220
- borderRadius: n
266
+ borderRadius: l
221
267
  },
222
- iframeMaxHeight: s,
223
- iframeOpeningHeight: Math.min(ie, s)
268
+ iframeMaxHeight: m,
269
+ iframeOpeningHeight: Math.min(de, m),
270
+ ...d
224
271
  };
225
272
  }
226
- function ae(i) {
273
+ function H(i, e) {
274
+ return Math.min(i, e);
275
+ }
276
+ function be(i) {
227
277
  return i.triggerType !== "schedule" && i.keepOpen !== !0;
228
278
  }
229
- const le = 32;
230
- function de(i) {
279
+ const ve = 32;
280
+ function ye(i) {
231
281
  const e = { hideCloseButton: i.closeControl === "embed" };
232
- return typeof i.borderRadius == "number" && Number.isFinite(i.borderRadius) && (e.cardRadius = Math.max(0, Math.min(i.borderRadius, le))), typeof i.surface == "string" && i.surface !== "" && (e.surface = i.surface), e;
282
+ return typeof i.borderRadius == "number" && Number.isFinite(i.borderRadius) && (e.cardRadius = Math.max(0, Math.min(i.borderRadius, ve))), typeof i.surface == "string" && i.surface !== "" && (e.surface = i.surface), (i.design === "v1" || i.design === "v2") && (e.design = i.design), e;
233
283
  }
234
- const ce = ".moment-sync-trigger", ue = 6, k = 60, me = "#0d0d0d", pe = "rgba(255, 255, 255, 0.216)", he = "#121316", ge = "https://live.dev.momentco.ai";
235
- class fe {
284
+ const we = ".moment-sync-trigger", Ee = 6, B = 60, xe = "rgba(255, 255, 255, 0.216)", Se = "https://live.dev.momentco.ai";
285
+ class Ae {
236
286
  opts;
237
287
  liveBaseUrl;
238
288
  liveOrigin;
@@ -255,19 +305,27 @@ class fe {
255
305
  didManageBodyOverflow = !1;
256
306
  closeTimer = null;
257
307
  // The card radius the frame is laid out with: the default until a theme hint sends the brand's.
258
- cardRadius = E;
308
+ cardRadius = x;
309
+ /** The frame the embed last asked for: `v2` (glass) or `v1` (the 0.8.0 look). */
310
+ design = "v1";
311
+ /** The card colour the embed last sent, kept through a v2 sheet so v1 gets it back. */
312
+ surface = v;
313
+ /** The height the embed last asked for, so a re-cap after a resize can grow back to it. */
314
+ lastRequestedHeight = null;
315
+ footer = null;
316
+ hairline = null;
259
317
  viewportResizeHandler = null;
260
318
  constructor(e) {
261
319
  this.opts = {
262
- triggerSelector: ce,
320
+ triggerSelector: we,
263
321
  ...e
264
- }, this.liveBaseUrl = ge;
322
+ }, this.liveBaseUrl = Se;
265
323
  try {
266
324
  this.liveOrigin = new URL(this.liveBaseUrl).origin;
267
325
  } catch {
268
326
  throw new Error(`[MomentSdk] Invalid VITE_LIVE_BASE_URL: "${this.liveBaseUrl}"`);
269
327
  }
270
- Z(), this.bindTriggers(), this.emitAnalytics("embed.init"), this.opts.autoOpen && this.autoOpenFromUrl(this.opts.autoOpen.teamSlug);
328
+ ie(), this.bindTriggers(), this.emitAnalytics("embed.init"), this.opts.autoOpen && this.autoOpenFromUrl(this.opts.autoOpen.teamSlug);
271
329
  }
272
330
  /**
273
331
  * Programmatically open the sync modal.
@@ -299,31 +357,31 @@ class fe {
299
357
  e.externalEventId && e.externalEventIdPrefix && console.warn(
300
358
  "[MomentSdk] Both externalEventId and externalEventIdPrefix provided; using externalEventId only."
301
359
  );
302
- const n = this.scopeOpenPayload(e);
360
+ const s = this.scopeOpenPayload(e);
303
361
  this.emitAnalytics("embed.open", {
304
- teamSlug: n.teamSlug,
305
- triggerType: n.triggerType,
362
+ teamSlug: s.teamSlug,
363
+ triggerType: s.triggerType,
306
364
  ...t ? { triggerSource: "url" } : {}
307
- }), this.createModal(n, t);
365
+ }), this.createModal(s, t);
308
366
  }
309
367
  /**
310
368
  * Open the sheet from the page URL's `moment_sync`, once per page load, then drop the link's
311
369
  * params from the address bar so a reload doesn't reopen it.
312
370
  */
313
371
  autoOpenFromUrl(e) {
314
- if (!$()) return;
315
- const t = N(window.location.href, e);
316
- t && W(document, () => {
372
+ if (!V()) return;
373
+ const t = K(window.location.href, e);
374
+ t && Y(document, () => {
317
375
  this.openWith(t.payload, t), history.replaceState(history.state, "", t.cleanUrl);
318
376
  });
319
377
  }
320
378
  // ── Private: trigger binding ──────────────────────────────────────
321
379
  bindTriggers() {
322
380
  document.querySelectorAll(this.opts.triggerSelector).forEach((t) => {
323
- const n = (r) => {
324
- r.preventDefault(), this.handleTriggerClick(t);
325
- }, s = this.boundClickHandlers.get(t);
326
- s && t.removeEventListener("click", s), t.addEventListener("click", n), this.boundClickHandlers.set(t, n);
381
+ const s = (o) => {
382
+ o.preventDefault(), this.handleTriggerClick(t);
383
+ }, r = this.boundClickHandlers.get(t);
384
+ r && t.removeEventListener("click", r), t.addEventListener("click", s), this.boundClickHandlers.set(t, s);
327
385
  });
328
386
  }
329
387
  unbindTriggers() {
@@ -332,38 +390,38 @@ class fe {
332
390
  }), this.boundClickHandlers.clear();
333
391
  }
334
392
  handleTriggerClick(e) {
335
- const t = e.getAttribute("data-moment-team-slug") ?? "", n = e.getAttribute("data-moment-slug") ?? void 0, s = e.getAttribute("data-moment-list-slug") ?? void 0, r = e.getAttribute("data-moment-trigger-type");
336
- let o = "moment";
337
- r != null && r !== "" && (r === "moment" || r === "list" || r === "team" || r === "brand-playlist" || r === "playlist" || r === "schedule" ? o = r : console.warn(
393
+ 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");
394
+ let n = "moment";
395
+ o != null && o !== "" && (o === "moment" || o === "list" || o === "team" || o === "brand-playlist" || o === "playlist" || o === "schedule" ? n = o : console.warn(
338
396
  "[MomentSdk] Invalid data-moment-trigger-type, falling back to 'moment':",
339
- r
397
+ o
340
398
  ));
341
- const a = e.getAttribute("data-moment-ids") ?? e.getAttribute("data-moment-game-id") ?? "", u = a ? a.split(",").filter(Boolean) : [], c = e.getAttribute("data-moment-playlist-slugs") ?? "", p = c ? c.split(",").map((m) => m.trim()).filter(Boolean) : [], l = e.getAttribute("data-moment-calendar");
342
- let g;
343
- l != null && l !== "" && (l === "google" || l === "outlook" ? g = l : console.warn("[MomentSdk] Invalid data-moment-calendar, ignoring value:", l));
344
- const v = e.getAttribute("data-api-source-id") ?? void 0, h = e.getAttribute("data-external-event-id") ?? void 0, f = e.getAttribute("data-external-event-id-prefix") ?? void 0;
345
- if (h && f && console.warn(
399
+ const a = e.getAttribute("data-moment-ids") ?? e.getAttribute("data-moment-game-id") ?? "", u = a ? a.split(",").filter(Boolean) : [], d = e.getAttribute("data-moment-playlist-slugs") ?? "", p = d ? d.split(",").map((h) => h.trim()).filter(Boolean) : [], l = e.getAttribute("data-moment-calendar");
400
+ let m;
401
+ l != null && l !== "" && (l === "google" || l === "outlook" ? m = l : console.warn("[MomentSdk] Invalid data-moment-calendar, ignoring value:", l));
402
+ const g = e.getAttribute("data-api-source-id") ?? void 0, f = e.getAttribute("data-external-event-id") ?? void 0, C = e.getAttribute("data-external-event-id-prefix") ?? void 0;
403
+ if (f && C && console.warn(
346
404
  "[MomentSdk] Both data-external-event-id and data-external-event-id-prefix are set; using data-external-event-id only."
347
405
  ), !t) {
348
406
  console.warn("[MomentSdk] Missing data-moment-team-slug on trigger element");
349
407
  return;
350
408
  }
351
- const d = o === "team" || o === "brand-playlist" || o === "playlist" || o === "schedule";
409
+ const c = n === "team" || n === "brand-playlist" || n === "playlist" || n === "schedule";
352
410
  this.emitAnalytics("embed.trigger.click", {
353
411
  teamSlug: t,
354
- triggerType: o,
355
- momentIds: d ? [] : u
412
+ triggerType: n,
413
+ momentIds: c ? [] : u
356
414
  }), this.open({
357
415
  teamSlug: t,
358
- momentSlug: n,
359
- listSlug: s,
360
- triggerType: o,
416
+ momentSlug: s,
417
+ listSlug: r,
418
+ triggerType: n,
361
419
  ids: u,
362
420
  playlistSlugs: p,
363
- calendar: g ?? void 0,
364
- apiSourceId: v,
365
- externalEventId: f && !h ? void 0 : h,
366
- externalEventIdPrefix: h ? void 0 : f
421
+ calendar: m ?? void 0,
422
+ apiSourceId: g,
423
+ externalEventId: C && !f ? void 0 : f,
424
+ externalEventIdPrefix: f ? void 0 : C
367
425
  });
368
426
  }
369
427
  /** Drop moment/list/source scoping for brand-level subscription triggers. */
@@ -385,23 +443,23 @@ class fe {
385
443
  // ── Private: modal creation ───────────────────────────────────────
386
444
  createModal(e, t) {
387
445
  this.cleanup(), this.previousFocusedElement = document.activeElement || null, this.activePayload = e, this.activeCampaignId = t?.campaignId;
388
- const n = this.buildIframeUrl(e, t);
446
+ const s = this.buildIframeUrl(e, t);
389
447
  this.overlay = document.createElement("div"), this.overlay.setAttribute("role", "presentation"), Object.assign(this.overlay.style, {
390
448
  position: "fixed",
391
449
  inset: "0",
392
- zIndex: ne,
450
+ zIndex: me,
393
451
  display: "flex",
394
- justifyContent: "center",
395
- backgroundColor: "rgba(0, 0, 0, 0.5)"
396
- }), this.overlay.addEventListener("click", (d) => {
397
- d.target === this.overlay && this.handleCancel();
452
+ justifyContent: "center"
453
+ // backgroundColor comes from the layout: 50%, or 40% for a v2 sheet.
454
+ }), this.overlay.addEventListener("click", (c) => {
455
+ c.target === this.overlay && this.handleCancel();
398
456
  });
399
- const s = (d) => {
400
- d.key === "Escape" && this.handleCancel();
457
+ const r = (c) => {
458
+ c.key === "Escape" && this.handleCancel();
401
459
  };
402
- document.addEventListener("keydown", s);
403
- const r = document.createElement("div");
404
- Object.assign(r.style, {
460
+ document.addEventListener("keydown", r);
461
+ const o = document.createElement("div");
462
+ Object.assign(o.style, {
405
463
  position: "relative",
406
464
  width: "100%",
407
465
  // Ease radius changes so a brand's configured radius (arriving via
@@ -409,20 +467,20 @@ class fe {
409
467
  // smoothly instead of snapping.
410
468
  transition: "border-radius 0.3s ease",
411
469
  overflow: "hidden",
412
- backgroundColor: me,
470
+ backgroundColor: D,
413
471
  boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.25)",
414
472
  display: "flex",
415
473
  flexDirection: "column"
416
474
  });
417
- const o = document.createElement("div");
418
- o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Calendar sync modal"), o.tabIndex = -1, Object.assign(o.style, {
475
+ const n = document.createElement("div");
476
+ n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "true"), n.setAttribute("aria-label", "Calendar sync modal"), n.tabIndex = -1, Object.assign(n.style, {
419
477
  position: "relative",
420
478
  width: "100%",
421
479
  transition: "border-radius 0.3s ease",
422
480
  overflow: "auto",
423
481
  // The sheet colour Live's embeds paint, so the card never flashes white before the
424
482
  // embed's theme (and its own `surface`) arrives.
425
- backgroundColor: he,
483
+ backgroundColor: v,
426
484
  // `tabIndex = -1` above makes this a programmatic focus target for the
427
485
  // focus trap, never a Tab stop — but browsers still draw their platform
428
486
  // focus ring (blue on stock macOS/Windows) around the whole card when we
@@ -431,13 +489,13 @@ class fe {
431
489
  outline: "none"
432
490
  });
433
491
  const a = document.createElement("button");
434
- a.type = "button", a.className = B, 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, oe), a.addEventListener("mouseenter", () => {
435
- a.style.backgroundColor = re;
492
+ a.type = "button", a.className = F, 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", () => {
493
+ a.style.backgroundColor = ge;
436
494
  }), a.addEventListener("mouseleave", () => {
437
- a.style.backgroundColor = F;
495
+ a.style.backgroundColor = G;
438
496
  }), a.addEventListener("click", () => this.handleCancel());
439
497
  const u = e.triggerType !== "schedule";
440
- this.iframe = document.createElement("iframe"), this.iframe.src = n, this.iframe.setAttribute("allow", "web-share; clipboard-write"), this.iframe.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups allow-forms"), this.iframe.setAttribute("scrolling", "no"), Object.assign(this.iframe.style, {
498
+ 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, {
441
499
  width: "100%",
442
500
  border: "none",
443
501
  display: "block",
@@ -446,14 +504,14 @@ class fe {
446
504
  // guess to the embed's real content height. Eased and a little slower so
447
505
  // that reads as the sheet settling rather than a snap.
448
506
  transition: "height 0.25s cubic-bezier(0.32, 0.72, 0, 1)"
449
- }), u && (o.appendChild(a), this.closeButton = a), o.appendChild(this.iframe);
450
- const c = document.createElement("div");
451
- Object.assign(c.style, {
507
+ }), u && (n.appendChild(a), this.closeButton = a), n.appendChild(this.iframe);
508
+ const d = document.createElement("div");
509
+ this.footer = d, Object.assign(d.style, {
452
510
  display: "flex",
453
511
  alignItems: "center",
454
512
  justifyContent: "center",
455
- gap: `${ue}px`,
456
- height: `${w}px`,
513
+ gap: `${Ee}px`,
514
+ height: `${E}px`,
457
515
  // The wrapper is a flex column, so without this the tray would be the
458
516
  // first thing squeezed when the card hits its max height.
459
517
  flexShrink: "0",
@@ -469,36 +527,36 @@ class fe {
469
527
  color: "#ffffff"
470
528
  });
471
529
  const l = document.createElement("img");
472
- l.alt = "Moment", l.src = j, Object.assign(l.style, {
530
+ l.alt = "Moment", l.src = q, Object.assign(l.style, {
473
531
  display: "block",
474
532
  // Both dimensions are explicit so the tray has no reflow to do, even if
475
533
  // the image is ever swapped for one that has to decode.
476
- width: `${k}px`,
477
- height: `${(k / z).toFixed(2)}px`
478
- }), c.appendChild(p), c.appendChild(l), this.wrapper = r, this.container = o, this.applyFrameLayout();
479
- const g = document.createElement("div");
480
- g.setAttribute("aria-hidden", "true"), Object.assign(g.style, {
534
+ width: `${B}px`,
535
+ height: `${(B / Z).toFixed(2)}px`
536
+ }), d.appendChild(p), d.appendChild(l), this.wrapper = o, this.container = n, this.applyFrameLayout();
537
+ const m = document.createElement("div");
538
+ this.hairline = m, m.setAttribute("aria-hidden", "true"), Object.assign(m.style, {
481
539
  position: "absolute",
482
540
  inset: "0",
483
541
  borderRadius: "inherit",
484
- boxShadow: `inset 0 0 0 1px ${pe}`,
542
+ boxShadow: `inset 0 0 0 1px ${xe}`,
485
543
  pointerEvents: "none",
486
544
  zIndex: "2"
487
- }), r.appendChild(o), r.appendChild(c), r.appendChild(g), this.overlay.appendChild(r), document.body.appendChild(this.overlay), this.viewportResizeHandler = () => this.applyFrameLayout(), window.addEventListener("resize", this.viewportResizeHandler);
488
- const v = () => o.querySelectorAll(se), h = (d) => {
489
- if (d.key !== "Tab") return;
490
- const m = v(), C = m[0], A = m[m.length - 1], b = document.activeElement;
491
- d.shiftKey && (b === C || b === o) ? (d.preventDefault(), A.focus()) : !d.shiftKey && b === A && (d.preventDefault(), C.focus());
545
+ }), o.appendChild(n), o.appendChild(d), o.appendChild(m), this.overlay.appendChild(o), document.body.appendChild(this.overlay), this.viewportResizeHandler = () => this.applyFrameLayout(), window.addEventListener("resize", this.viewportResizeHandler);
546
+ const g = () => n.querySelectorAll(he), f = (c) => {
547
+ if (c.key !== "Tab") return;
548
+ const h = g(), b = h[0], S = h[h.length - 1], y = document.activeElement;
549
+ c.shiftKey && (y === b || y === n) ? (c.preventDefault(), S.focus()) : !c.shiftKey && y === S && (c.preventDefault(), b.focus());
492
550
  };
493
- o.addEventListener("keydown", h);
494
- const f = (d) => {
495
- const m = document.createElement("span");
496
- return m.tabIndex = 0, Object.assign(m.style, { position: "fixed", opacity: "0" }), m.addEventListener("focus", () => {
497
- const C = v();
498
- C[d === "first" ? 0 : C.length - 1].focus();
499
- }), m;
551
+ n.addEventListener("keydown", f);
552
+ const C = (c) => {
553
+ const h = document.createElement("span");
554
+ return h.tabIndex = 0, Object.assign(h.style, { position: "fixed", opacity: "0" }), h.addEventListener("focus", () => {
555
+ const b = g();
556
+ b[c === "first" ? 0 : b.length - 1].focus();
557
+ }), h;
500
558
  };
501
- o.before(f("last")), o.after(f("first")), o.focus(), this.previousBodyOverflow = document.body.style.overflow, document.body.style.overflow = "hidden", this.didManageBodyOverflow = !0, this.setupMessageListener(), this.overlay._escHandler = s, this.overlay._focusTrapHandler = h;
559
+ n.before(C("last")), n.after(C("first")), n.focus(), this.previousBodyOverflow = document.body.style.overflow, document.body.style.overflow = "hidden", this.didManageBodyOverflow = !0, this.setupMessageListener(), this.overlay._escHandler = r, this.overlay._focusTrapHandler = f;
502
560
  }
503
561
  /**
504
562
  * Size the frame for the current viewport: the one routine for open, window resize and a theme
@@ -506,13 +564,29 @@ class fe {
506
564
  */
507
565
  applyFrameLayout() {
508
566
  if (!this.overlay || !this.wrapper || !this.container || !this.iframe) return;
509
- const e = R(window.innerWidth, window.innerHeight, this.cardRadius);
510
- Object.assign(this.overlay.style, e.overlay), Object.assign(this.wrapper.style, e.wrapper), Object.assign(this.container.style, e.container), this.wrapper.classList.toggle(P, e.isTray);
511
- const t = Number.parseFloat(this.iframe.style.height), n = Number.isNaN(t) ? e.iframeOpeningHeight : Math.min(t, e.iframeMaxHeight);
512
- this.iframe.style.height = `${n}px`;
567
+ Object.assign(this.wrapper.style, this.currentLayout().wrapper);
568
+ const e = this.currentLayout();
569
+ Object.assign(this.overlay.style, e.overlay), Object.assign(this.wrapper.style, e.wrapperMaterial), Object.assign(this.container.style, e.container), Object.assign(this.container.style, e.card), Object.assign(this.iframe.style, e.iframe), this.footer && (this.footer.style.display = e.showFooter ? "flex" : "none"), this.hairline && (this.hairline.style.display = e.material === "glass" ? "none" : ""), this.wrapper.classList.toggle(U, e.isTray);
570
+ const t = Number.parseFloat(this.iframe.style.height), s = this.lastRequestedHeight !== null ? H(this.lastRequestedHeight, e.iframeMaxHeight) : Number.isNaN(t) ? e.iframeOpeningHeight : Math.min(t, e.iframeMaxHeight);
571
+ this.iframe.style.height = `${s}px`;
572
+ }
573
+ /**
574
+ * The frame for the current viewport, design, radius and card colour. The bottom inset is the
575
+ * tray's `env(safe-area-inset-bottom)` padding as the browser resolved it, 0 without one.
576
+ */
577
+ currentLayout() {
578
+ const e = this.wrapper && Number.parseFloat(getComputedStyle(this.wrapper).paddingBottom) || 0;
579
+ return Ce(
580
+ window.innerWidth,
581
+ window.innerHeight,
582
+ this.cardRadius,
583
+ this.design,
584
+ e,
585
+ this.surface
586
+ );
513
587
  }
514
588
  buildIframeUrl(e, t) {
515
- return G(this.liveBaseUrl, e, void 0, t);
589
+ return X(this.liveBaseUrl, e, void 0, t);
516
590
  }
517
591
  // ── Private: message handling ─────────────────────────────────────
518
592
  setupMessageListener() {
@@ -521,33 +595,34 @@ class fe {
521
595
  const t = e.data;
522
596
  if (!(!t || typeof t != "object")) {
523
597
  if (t.source === "moment-live-embed" && t.type === "moment.embed.oauth.start") {
524
- const n = t;
598
+ const s = t;
525
599
  this.emitAnalytics("oauth.start", {
526
- provider: n.provider,
527
- teamSlug: n.teamSlug
528
- }), this.handleOAuthStart(n);
600
+ provider: s.provider,
601
+ teamSlug: s.teamSlug
602
+ }), this.handleOAuthStart(s);
529
603
  return;
530
604
  }
531
605
  if (t.source === "moment-live-embed" && t.type === "moment.embed.resize") {
532
- const n = typeof t.height == "number" ? t.height : 0;
533
- if (n > 0 && this.iframe) {
534
- const { iframeMaxHeight: s } = R(window.innerWidth, window.innerHeight);
535
- this.iframe.style.height = `${Math.min(n, s)}px`;
606
+ const s = typeof t.height == "number" ? t.height : 0;
607
+ if (s > 0 && this.iframe) {
608
+ this.lastRequestedHeight = s;
609
+ const { iframeMaxHeight: r } = this.currentLayout();
610
+ this.iframe.style.height = `${H(s, r)}px`;
536
611
  }
537
612
  return;
538
613
  }
539
614
  if (t.source === "moment-live-embed" && t.type === "moment.embed.theme") {
540
- const n = de(t);
541
- n.cardRadius !== void 0 && (this.cardRadius = n.cardRadius, this.applyFrameLayout()), n.hideCloseButton && this.closeButton && (document.activeElement === this.closeButton && this.container?.focus(), this.closeButton.remove()), n.surface !== void 0 && this.container && (this.container.style.backgroundColor = n.surface);
615
+ const s = ye(t);
616
+ 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());
542
617
  return;
543
618
  }
544
619
  if (t.source === "moment-live-embed" && t.type === "moment.embed.open.url") {
545
- const { url: n } = t;
546
- if (X(n)) {
547
- const s = q(window.open(n, "_blank"));
548
- s === "blocked" && this.emitAnalytics("open.url.blocked", {}), this.sendOpenUrlStatus(s, n);
620
+ const { url: s } = t;
621
+ if (se(s)) {
622
+ const r = ne(window.open(s, "_blank"));
623
+ r === "blocked" && this.emitAnalytics("open.url.blocked", {}), this.sendOpenUrlStatus(r, s);
549
624
  } else
550
- this.sendOpenUrlStatus("blocked", typeof n == "string" ? n : "");
625
+ this.sendOpenUrlStatus("blocked", typeof s == "string" ? s : "");
551
626
  return;
552
627
  }
553
628
  if (t.source === "moment-live-embed" && t.type === "moment.embed.close") {
@@ -555,14 +630,14 @@ class fe {
555
630
  return;
556
631
  }
557
632
  if (t.source === "moment-live-embed" && t.type === "moment.embed.result") {
558
- const n = t;
559
- this.handleResult(n);
633
+ const s = t;
634
+ this.handleResult(s);
560
635
  }
561
636
  }
562
637
  }, window.addEventListener("message", this.messageHandler);
563
638
  }
564
639
  handleOAuthStart(e) {
565
- this.popupBridge && (this.popupBridge.cleanup(), this.popupBridge = null), this.popupBridge = new Y({
640
+ this.popupBridge && (this.popupBridge.cleanup(), this.popupBridge = null), this.popupBridge = new Q({
566
641
  liveBaseUrl: this.liveBaseUrl,
567
642
  liveOrigin: this.liveOrigin,
568
643
  iframeWindow: this.iframe?.contentWindow ?? null,
@@ -587,15 +662,15 @@ class fe {
587
662
  * real open from a blocked one instead of assuming success.
588
663
  */
589
664
  sendOpenUrlStatus(e, t) {
590
- const n = this.iframe?.contentWindow;
591
- if (!n) return;
592
- const s = {
665
+ const s = this.iframe?.contentWindow;
666
+ if (!s) return;
667
+ const r = {
593
668
  source: "moment-sdk",
594
669
  type: "moment.embed.open.url.status",
595
670
  status: e,
596
671
  url: t
597
672
  };
598
- n.postMessage(s, this.liveOrigin);
673
+ s.postMessage(r, this.liveOrigin);
599
674
  }
600
675
  handleResult(e) {
601
676
  if (e.result === "success" || e.result === "partial")
@@ -612,7 +687,7 @@ class fe {
612
687
  }), this.opts.onError?.(e);
613
688
  else if (e.result === "cancelled")
614
689
  return;
615
- this.opts.onClose?.(e), this.emitAnalytics("embed.close"), ae(e) && (this.closeTimer = setTimeout(() => this.cleanup(), 1500));
690
+ this.opts.onClose?.(e), this.emitAnalytics("embed.close"), be(e) && (this.closeTimer = setTimeout(() => this.cleanup(), 1500));
616
691
  }
617
692
  handleCancel() {
618
693
  this.emitAnalytics("embed.close");
@@ -627,13 +702,13 @@ class fe {
627
702
  }
628
703
  // ── Private: cleanup ──────────────────────────────────────────────
629
704
  cleanup() {
630
- if (this.closeTimer && (clearTimeout(this.closeTimer), this.closeTimer = null), this.popupBridge && (this.popupBridge.cleanup(), this.popupBridge = null), this.messageHandler && (window.removeEventListener("message", this.messageHandler), this.messageHandler = null), this.viewportResizeHandler && (window.removeEventListener("resize", this.viewportResizeHandler), this.viewportResizeHandler = null), this.overlay) {
705
+ if (this.closeTimer && (clearTimeout(this.closeTimer), this.closeTimer = null), this.popupBridge && (this.popupBridge.cleanup(), this.popupBridge = null), this.messageHandler && (window.removeEventListener("message", this.messageHandler), this.messageHandler = null), this.design = "v1", this.surface = v, this.lastRequestedHeight = null, this.footer = null, this.hairline = null, this.viewportResizeHandler && (window.removeEventListener("resize", this.viewportResizeHandler), this.viewportResizeHandler = null), this.overlay) {
631
706
  const { _escHandler: e, _focusTrapHandler: t } = this.overlay;
632
707
  e && document.removeEventListener("keydown", e);
633
- const n = this.overlay.firstElementChild;
634
- n && t && n.removeEventListener("keydown", t), this.overlay.remove(), this.overlay = null;
708
+ const s = this.overlay.firstElementChild;
709
+ s && t && s.removeEventListener("keydown", t), this.overlay.remove(), this.overlay = null;
635
710
  }
636
- 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.previousFocusedElement && typeof this.previousFocusedElement.focus == "function" && this.previousFocusedElement.focus(), this.previousFocusedElement = null;
711
+ this.iframe = null, this.wrapper = null, this.container = null, this.closeButton = null, this.activePayload = null, this.activeCampaignId = void 0, this.cardRadius = x, this.didManageBodyOverflow && (document.body.style.overflow = this.previousBodyOverflow, this.didManageBodyOverflow = !1), this.previousFocusedElement && typeof this.previousFocusedElement.focus == "function" && this.previousFocusedElement.focus(), this.previousFocusedElement = null;
637
712
  }
638
713
  // ── Private: analytics ────────────────────────────────────────────
639
714
  emitAnalytics(e, t) {
@@ -644,7 +719,7 @@ class fe {
644
719
  });
645
720
  }
646
721
  }
647
- function Ce(i) {
722
+ function Le(i) {
648
723
  const e = document.createElement("button");
649
724
  return e.type = "button", e.classList.add("moment-sync-trigger"), i.className && i.className.split(" ").forEach((t) => {
650
725
  t && e.classList.add(t);
@@ -652,9 +727,9 @@ function Ce(i) {
652
727
  }
653
728
  if (typeof window < "u") {
654
729
  const i = window;
655
- i.MomentSdk = fe, i.createMomentButton = Ce;
730
+ i.MomentSdk = Ae, i.createMomentButton = Le;
656
731
  }
657
732
  export {
658
- fe as MomentSdk,
659
- Ce as createMomentButton
733
+ Ae as MomentSdk,
734
+ Le as createMomentButton
660
735
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -3,6 +3,33 @@
3
3
  * environment; `moment-sdk.ts` applies them.
4
4
  */
5
5
  import type { MomentResultPayload } from './types';
6
+ /**
7
+ * Which frame the embed asked for. `v2` is Roman's November design: Live sends `design: 'v2'` in
8
+ * its theme message, and a frame without that hint keeps the 0.8.0 look exactly.
9
+ */
10
+ export type FrameDesign = 'v1' | 'v2';
11
+ /**
12
+ * v2's frame: Roman's thick glass in dark (Foundation "Glass Material", Live's `glass-thick`). The
13
+ * frame owns the blur because an iframe can't blur the host page behind it.
14
+ */
15
+ /** The 0.8.0 frame's fill: near-black, with the soft drop shadow. */
16
+ export declare const MODAL_FRAME_COLOR = "#0d0d0d";
17
+ /**
18
+ * The card colour until the embed's theme names one: the sheet colour of Live's embeds. The ✕'s
19
+ * fill (`CLOSE_BUTTON_BACKGROUND`) is worked out over it, so change the two together.
20
+ */
21
+ export declare const MODAL_CARD_SURFACE = "#121316";
22
+ /**
23
+ * The solid frame, written out so a sheet that leaves v2 (Live sends `design: 'v1'` for its
24
+ * legacy steps) loses the glass: the blur is reset, not just painted over.
25
+ */
26
+ export declare const SOLID_FRAME_MATERIAL: Readonly<Record<string, string>>;
27
+ export declare const GLASS_THICK_DARK: Readonly<Record<string, string>>;
28
+ /**
29
+ * The tray's glass. The tray sits on the bottom edge of the screen, so it leaves out the bottom
30
+ * highlight, which drew a light line along the browser's toolbar.
31
+ */
32
+ export declare const GLASS_THICK_DARK_TRAY: Readonly<Record<string, string>>;
6
33
  /**
7
34
  * Height in px of the "Powered by Moment" strip under the card. Fixed: it is chrome, so it never
8
35
  * grows or shrinks with the wordmark, the font, or the flex layout around it.
@@ -43,7 +70,7 @@ export interface FrameLayout {
43
70
  /** True below 1024px: a sheet docked to the bottom edge, full width or 600px with 40px+ sides. */
44
71
  isTray: boolean;
45
72
  /** The dimmed backdrop that places the frame, blurred only behind the desktop modal. */
46
- overlay: Pick<CSSStyleDeclaration, 'alignItems' | 'padding' | 'backdropFilter'>;
73
+ overlay: Pick<CSSStyleDeclaration, 'alignItems' | 'padding' | 'backdropFilter' | 'backgroundColor'>;
47
74
  /** The dark frame around the card and the footer. */
48
75
  wrapper: Pick<CSSStyleDeclaration, 'maxWidth' | 'minWidth' | 'borderRadius' | 'paddingBottom'>;
49
76
  /** The card that holds the iframe. */
@@ -52,13 +79,38 @@ export interface FrameLayout {
52
79
  iframeMaxHeight: number;
53
80
  /** The iframe's height in px until the embed reports its content height. */
54
81
  iframeOpeningHeight: number;
82
+ /** Whether the SDK draws its "Powered by" strip. v2 sheets draw their own footer. */
83
+ showFooter: boolean;
84
+ /** `glass` for v2: the frame is translucent and blurs the host page. */
85
+ material: 'solid' | 'glass';
86
+ /** Inline styles for the frame: glass for v2, the solid 0.8.0 frame otherwise. */
87
+ wrapperMaterial: Readonly<Record<string, string>>;
88
+ /** The card's colour: transparent in v2, so the glass shows; the embed's surface otherwise. */
89
+ card: {
90
+ backgroundColor: string;
91
+ };
92
+ /** The iframe's background and its own `color-scheme`, so a transparent iframe stays transparent on any host. */
93
+ iframe: {
94
+ background: string;
95
+ colorScheme: string;
96
+ };
55
97
  }
56
98
  /**
57
99
  * Lay the frame out for a host viewport: the centred modal at 1024px and wider, a bottom tray
58
100
  * below. The frame and the card share one radius, and the card rounds only its top corners, since
59
101
  * the "Powered by" tray continues below it. The tray's frame rounds only its top corners too.
102
+ *
103
+ * `bottomInset` is the host's bottom safe area in px, which the tray's frame pads by: the v2 cap
104
+ * leaves room for it so the sheet still stops 48px below the top. `surface` is the card colour the
105
+ * embed last sent.
106
+ */
107
+ export declare function frameLayout(viewportWidth: number, viewportHeight: number, cardRadius?: number, design?: FrameDesign, bottomInset?: number, surface?: string): FrameLayout;
108
+ /**
109
+ * The iframe's height after the viewport changes: what the embed last asked for, capped to the new
110
+ * frame. Starting from the request (not the current height) lets a full-height sheet grow back
111
+ * when the viewport gets taller again, e.g. after a rotation.
60
112
  */
61
- export declare function frameLayout(viewportWidth: number, viewportHeight: number, cardRadius?: number): FrameLayout;
113
+ export declare function resizedIframeHeight(requested: number, cap: number): number;
62
114
  /**
63
115
  * Whether the modal closes itself 1500 ms after a finished result. `schedule` never does, and
64
116
  * neither does a result whose embed sent `keepOpen: true`: both show their own terminal screen
@@ -76,6 +128,8 @@ export interface ThemeHints {
76
128
  hideCloseButton: boolean;
77
129
  /** CSS colour for the card. Absent unless the message sends a non-empty string. */
78
130
  surface?: string;
131
+ /** `'v2'` for Roman's glass sheet, `'v1'` to go back to the 0.8.0 look; absent otherwise. */
132
+ design?: FrameDesign;
79
133
  }
80
134
  /**
81
135
  * Read a `moment.embed.theme` message. A radius counts only if it is a finite number, and is
@@ -85,4 +139,5 @@ export declare function readThemeHints(data: {
85
139
  borderRadius?: unknown;
86
140
  closeControl?: unknown;
87
141
  surface?: unknown;
142
+ design?: unknown;
88
143
  }): ThemeHints;
@@ -24,6 +24,14 @@ export declare class MomentSdk {
24
24
  private didManageBodyOverflow;
25
25
  private closeTimer;
26
26
  private cardRadius;
27
+ /** The frame the embed last asked for: `v2` (glass) or `v1` (the 0.8.0 look). */
28
+ private design;
29
+ /** The card colour the embed last sent, kept through a v2 sheet so v1 gets it back. */
30
+ private surface;
31
+ /** The height the embed last asked for, so a re-cap after a resize can grow back to it. */
32
+ private lastRequestedHeight;
33
+ private footer;
34
+ private hairline;
27
35
  private viewportResizeHandler;
28
36
  constructor(options: MomentSdkInitOptions);
29
37
  /**
@@ -60,6 +68,11 @@ export declare class MomentSdk {
60
68
  * radius.
61
69
  */
62
70
  private applyFrameLayout;
71
+ /**
72
+ * The frame for the current viewport, design, radius and card colour. The bottom inset is the
73
+ * tray's `env(safe-area-inset-bottom)` padding as the browser resolved it, 0 without one.
74
+ */
75
+ private currentLayout;
63
76
  private buildIframeUrl;
64
77
  private setupMessageListener;
65
78
  private handleOAuthStart;
@@ -35,4 +35,11 @@ export declare class PopupBridge {
35
35
  private startPolling;
36
36
  private sendStatusToIframe;
37
37
  }
38
+ /**
39
+ * The sign-in popup's query: who is syncing what, and the host page's origin to report back to
40
+ * (never the iframe-supplied one). Schedule selections travel comma-joined in the URL rather than
41
+ * through storage, which browser partitioning would break. `scheduleListIds` carries collections
42
+ * (0.9.0+).
43
+ */
44
+ export declare function popupSearchParams(payload: MomentOAuthStartPayload, returnOrigin: string): URLSearchParams;
38
45
  export {};
@@ -127,6 +127,8 @@ export interface MomentOAuthStartPayload {
127
127
  scheduleMomentIds?: string[];
128
128
  /** Present for the `schedule` trigger only: the mixed selection's playlist ids. */
129
129
  schedulePlaylistIds?: string[];
130
+ /** Present for the `schedule` trigger only: the mixed selection's collection (list) ids (0.9.0+). */
131
+ scheduleListIds?: string[];
130
132
  returnOrigin: string;
131
133
  }
132
134
  /** Parent → Iframe: relay OAuth popup status */
@@ -157,6 +159,8 @@ export interface MomentResultPayload {
157
159
  failed: number;
158
160
  moments?: number;
159
161
  playlists?: number;
162
+ /** Collections synced (0.9.0+). */
163
+ lists?: number;
160
164
  };
161
165
  message?: string;
162
166
  /**
@@ -218,6 +222,11 @@ export interface MomentThemePayload {
218
222
  * (0.8.0+).
219
223
  */
220
224
  surface?: string;
225
+ /**
226
+ * `'v2'` asks for Roman's glass sheet (0.9.0+): the tray stops 48px below the top, the frame
227
+ * blurs the page behind it, and the embed draws its own footer.
228
+ */
229
+ design?: 'v1' | 'v2';
221
230
  }
222
231
  export type MomentAnalyticsEventName = 'embed.init' | 'embed.trigger.click' | 'embed.open' | 'oauth.start' | 'oauth.popup.blocked' | 'oauth.popup.closed' | 'open.url.blocked' | 'subscribe.success' | 'subscribe.error' | 'embed.close';
223
232
  export interface MomentAnalyticsEvent {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momentco-ai/moment-sdk",
3
- "version": "0.9.0-dev.45",
3
+ "version": "0.9.0-dev.46",
4
4
  "type": "module",
5
5
  "description": "Embeddable calendar sync widget for external team websites",
6
6
  "author": "Moment Co. <support@momentco.ai> (https://momentco.ai)",