{"version":3,"file":"client.login-button_e05d2f22.en.esm.js","sources":["../../src/common/shop-swirl.ts","../../src/common/shop-sheet-modal/shop-sheet-modal-builder.ts","../../src/components/loginButton/components/modal-content.ts","../../src/components/loginButton/components/follow-on-shop-button.ts","../../src/components/loginButton/components/store-logo.ts","../../src/components/loginButton/shop-follow-button.ts","../../src/components/loginButton/init.ts"],"sourcesContent":["import {pickLogoColor} from './colors';\nimport {defineCustomElement} from './init';\n\nexport class ShopSwirl extends HTMLElement {\n constructor() {\n super();\n\n const template = document.createElement('template');\n const size = this.getAttribute('size');\n // If not specified, will assume a white background and render the purple logo.\n const backgroundColor = this.getAttribute('background-color') || '#FFF';\n\n template.innerHTML = getTemplateContents(\n size ? Number.parseInt(size, 10) : undefined,\n backgroundColor,\n );\n\n this.attachShadow({mode: 'open'}).appendChild(\n template.content.cloneNode(true),\n );\n }\n}\n\n/**\n * @param {number} size size of the logo.\n * @param {string} backgroundColor hex or rgb string for background color.\n * @returns {string} HTML content for the logo.\n */\nfunction getTemplateContents(size = 36, backgroundColor: string) {\n const [red, green, blue] = pickLogoColor(backgroundColor);\n const color = `rgb(${red}, ${green}, ${blue})`;\n const sizeRatio = 23 / 20;\n const height = size;\n const width = Math.round(height / sizeRatio);\n\n return `\n \n \n \n \n `;\n}\n\n/**\n * Define the shop-swirl custom element.\n */\nexport function defineElement() {\n defineCustomElement('shop-swirl', ShopSwirl);\n}\n","import {ShopSheetModal, createShopSheetModal} from './shop-sheet-modal';\n\nexport interface SheetModalManager {\n sheetModal: ShopSheetModal;\n destroy(): void;\n}\n\n/**\n * This builder is used to create a sheet modal on the page in a consistent way.\n * - withInnerHTML: allows a hook to add additional content to a wrapper div's shadow root, useful for CSS.\n * - build: creates the sheet modal, appends it to the shadow root, and appends the wrapper div to the body.\n *\n * The build method will return a SheetModalManager which can be used to reference the underlying sheetModal element\n * and a cleanup method called `destroy` that will remove the modal from the DOM.\n *\n * @returns {object} - The sheet modal builder\n */\nexport function sheetModalBuilder() {\n const wrapper = document.createElement('div');\n const shadow = wrapper.attachShadow({mode: 'open'});\n\n // reset generic styles on `div` element\n wrapper.style.setProperty('all', 'initial');\n\n return {\n withInnerHTML(innerHTML: string) {\n shadow.innerHTML = innerHTML;\n\n return this;\n },\n build(): SheetModalManager {\n const sheetModal = createShopSheetModal();\n shadow.appendChild(sheetModal);\n document.body.appendChild(wrapper);\n\n return {\n get sheetModal() {\n return sheetModal;\n },\n destroy() {\n wrapper.remove();\n },\n };\n },\n };\n}\n","import {colors} from '../../../common/colors';\nimport {\n createStatusIndicator,\n ShopStatusIndicator,\n StatusIndicatorLoader,\n} from '../../../common/shop-status-indicator';\nimport {\n AuthorizeState,\n LoginButtonProcessingStatus as ProcessingStatus,\n} from '../../../types';\n\nexport const ELEMENT_CLASS_NAME = 'shop-modal-content';\n\ninterface Content {\n title?: string;\n description?: string;\n disclaimer?: string;\n authorizeState?: AuthorizeState;\n email?: string;\n status?: ProcessingStatus;\n}\n\nexport class ModalContent extends HTMLElement {\n #rootElement: ShadowRoot;\n\n // Header Elements\n #headerWrapper!: HTMLDivElement;\n #headerTitle!: HTMLHeadingElement;\n #headerDescription!: HTMLDivElement;\n\n // Main Content Elements\n #contentWrapper!: HTMLDivElement;\n #contentProcessingWrapper!: HTMLDivElement;\n #contentProcessingUser!: HTMLDivElement;\n #contentStatusIndicator?: ShopStatusIndicator;\n #contentChildrenWrapper!: HTMLDivElement;\n\n // Disclaimer Elements\n #disclaimerText!: HTMLDivElement;\n\n // Storage for content\n #contentStore: Content = {};\n\n constructor() {\n super();\n\n const template = document.createElement('template');\n template.innerHTML = getContent();\n this.#rootElement = this.attachShadow({mode: 'open'});\n this.#rootElement.appendChild(template.content.cloneNode(true));\n\n this.#headerWrapper = this.#rootElement.querySelector(\n `.${ELEMENT_CLASS_NAME}`,\n )!;\n this.#headerTitle = this.#rootElement.querySelector(\n `.${ELEMENT_CLASS_NAME}-title`,\n )!;\n this.#headerDescription = this.#rootElement.querySelector(\n `.${ELEMENT_CLASS_NAME}-description`,\n )!;\n this.#contentWrapper = this.#rootElement.querySelector(\n `.${ELEMENT_CLASS_NAME}-content`,\n )!;\n this.#contentProcessingWrapper = this.#rootElement.querySelector(\n `.${ELEMENT_CLASS_NAME}-processing`,\n )!;\n this.#contentProcessingUser = this.#rootElement.querySelector(\n `.${ELEMENT_CLASS_NAME}-processing-user`,\n )!;\n this.#contentChildrenWrapper = this.#rootElement.querySelector(\n `.${ELEMENT_CLASS_NAME}-children`,\n )!;\n this.#disclaimerText = this.#rootElement.querySelector(\n `.${ELEMENT_CLASS_NAME}-disclaimer`,\n )!;\n }\n\n hideDivider() {\n this.#headerWrapper.classList.add('hide-divider');\n }\n\n showDivider() {\n this.#headerWrapper.classList.remove('hide-divider');\n }\n\n update(content: Content) {\n this.#contentStore = {\n ...this.#contentStore,\n ...content,\n };\n\n this.#updateHeader();\n this.#updateMainContent();\n this.#updateDisclaimer();\n }\n\n #updateHeader() {\n const {title, description, authorizeState} = this.#contentStore;\n const visible = title || description;\n\n this.#headerWrapper.classList.toggle('hidden', !visible);\n this.#headerTitle.classList.toggle('hidden', !title);\n this.#headerDescription.classList.toggle('hidden', !description);\n\n this.#headerTitle.textContent = title || '';\n this.#headerDescription.textContent = description || '';\n\n if (authorizeState) {\n this.#headerWrapper.classList.toggle(\n 'hide-divider',\n authorizeState === AuthorizeState.Start,\n );\n\n this.#headerWrapper.classList.toggle(\n `${ELEMENT_CLASS_NAME}--small`,\n authorizeState === AuthorizeState.Start,\n );\n }\n }\n\n #updateMainContent() {\n const {authorizeState, status, email} = this.#contentStore;\n const contentWrapperVisible = Boolean(authorizeState || status);\n const processingWrapperVisible = Boolean(status && email);\n const childrenWrapperVisible = Boolean(\n contentWrapperVisible && !processingWrapperVisible,\n );\n\n this.#contentWrapper.classList.toggle('hidden', !contentWrapperVisible);\n this.#contentProcessingWrapper.classList.toggle(\n 'hidden',\n !processingWrapperVisible,\n );\n this.#contentChildrenWrapper.classList.toggle(\n 'hidden',\n !childrenWrapperVisible,\n );\n\n if (!this.#contentStatusIndicator && processingWrapperVisible) {\n const loaderType =\n authorizeState === AuthorizeState.OneClick\n ? StatusIndicatorLoader.Branded\n : StatusIndicatorLoader.Regular;\n this.#contentStatusIndicator = createStatusIndicator(loaderType);\n this.#contentProcessingWrapper.appendChild(this.#contentStatusIndicator);\n this.#contentStatusIndicator?.setStatus({\n status: 'loading',\n message: '',\n });\n }\n\n this.#contentProcessingUser.textContent = email || '';\n }\n\n #updateDisclaimer() {\n const {disclaimer} = this.#contentStore;\n const visible = Boolean(disclaimer);\n\n this.#disclaimerText.classList.toggle('hidden', !visible);\n this.#disclaimerText.innerHTML = disclaimer || '';\n }\n}\n\n/**\n * @returns {string} element styles and content\n */\nfunction getContent() {\n return `\n \n
\n

\n
\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n `;\n}\n\nif (!customElements.get('shop-modal-content')) {\n customElements.define('shop-modal-content', ModalContent);\n}\n\n/**\n * helper function which creates a new modal content element\n *\n * @param {object} content modal content\n * @param {boolean} hideDivider whether the bottom divider should be hidden\n * @returns {ModalContent} a new ModalContent element\n */\nexport function createModalContent(\n content: Content,\n hideDivider = false,\n): ModalContent {\n const modalContent = document.createElement(\n 'shop-modal-content',\n ) as ModalContent;\n if (hideDivider) {\n modalContent.hideDivider();\n }\n modalContent.update(content);\n\n return modalContent;\n}\n","import {I18n} from '../../../common/translator/i18n';\nimport {\n ShopLogo,\n createShopHeartIcon,\n ShopHeartIcon,\n} from '../../../common/svg';\nimport Bugsnag from '../../../common/bugsnag';\nimport {calculateContrast, inferBackgroundColor} from '../../../common/colors';\n\nconst ATTRIBUTE_FOLLOWING = 'following';\n\nexport class FollowOnShopButton extends HTMLElement {\n private _rootElement: ShadowRoot | null = null;\n private _button: HTMLButtonElement | null = null;\n private _wrapper: HTMLSpanElement | null = null;\n private _heartIcon: ShopHeartIcon | null = null;\n private _followSpan: HTMLSpanElement | null = null;\n private _followingSpan: HTMLSpanElement | null = null;\n private _i18n: I18n | null = null;\n private _followTextWidth = 0;\n private _followingTextWidth = 0;\n\n constructor() {\n super();\n\n if (!customElements.get('shop-logo')) {\n customElements.define('shop-logo', ShopLogo);\n }\n }\n\n async connectedCallback(): Promise {\n await this._initTranslations();\n this._initElements();\n }\n\n setFollowing({\n following = true,\n skipAnimation = false,\n }: {\n following?: boolean;\n skipAnimation?: boolean;\n }) {\n this._button?.classList.toggle(`button--animating`, !skipAnimation);\n this._button?.classList.toggle(`button--following`, following);\n\n if (this._followSpan !== null && this._followingSpan !== null) {\n this._followSpan.ariaHidden = following ? 'true' : 'false';\n this._followingSpan.ariaHidden = following ? 'false' : 'true';\n }\n\n this.style.setProperty(\n '--button-width',\n `${following ? this._followingTextWidth : this._followTextWidth}px`,\n );\n\n if (\n window.matchMedia(`(prefers-reduced-motion: reduce)`).matches ||\n skipAnimation\n ) {\n this._heartIcon?.setFilled(following);\n } else {\n this._button\n ?.querySelector('.follow-text')\n ?.addEventListener('transitionend', () => {\n this._heartIcon?.setFilled(following);\n });\n }\n }\n\n setFocused() {\n this._button?.focus();\n }\n\n private async _initTranslations() {\n try {\n // BUILD_LOCALE is used for generating localized bundles.\n // See ./scripts/i18n-dynamic-import-replacer-rollup.mjs for more info.\n // eslint-disable-next-line no-process-env\n const locale = process.env.BUILD_LOCALE || I18n.getDefaultLanguage();\n const dictionary = await import(`../translations/${locale}.json`);\n this._i18n = new I18n({[locale]: dictionary});\n } catch (error) {\n if (error instanceof Error) {\n Bugsnag.notify(error);\n }\n }\n return null;\n }\n\n private _initElements() {\n const template = document.createElement('template');\n template.innerHTML = getTemplateContents();\n\n this._rootElement = this.attachShadow({mode: 'open'});\n this._rootElement.appendChild(template.content.cloneNode(true));\n\n if (this._i18n) {\n const followText = this._i18n.translate('follow_on_shop.follow', {\n shop: getShopLogoHtml('white'),\n });\n const followingText = this._i18n.translate('follow_on_shop.following', {\n shop: getShopLogoHtml('black'),\n });\n this._rootElement.querySelector('slot[name=\"follow-text\"]')!.innerHTML =\n followText;\n this._rootElement.querySelector(\n 'slot[name=\"following-text\"]',\n )!.innerHTML = followingText;\n }\n\n this._button = this._rootElement.querySelector(`.button`)!;\n this._wrapper = this._button.querySelector(`.follow-icon-wrapper`)!;\n this._followSpan = this._rootElement?.querySelector('span.follow-text');\n this._followingSpan = this._rootElement?.querySelector(\n 'span.following-text',\n );\n\n this._heartIcon = createShopHeartIcon();\n this._wrapper.prepend(this._heartIcon);\n\n this._followTextWidth =\n this._rootElement.querySelector('.follow-text')?.scrollWidth || 0;\n this._followingTextWidth =\n this._rootElement.querySelector('.following-text')?.scrollWidth || 0;\n this.style.setProperty(\n '--reserved-width',\n `${Math.max(this._followTextWidth, this._followingTextWidth)}px`,\n );\n\n this.setFollowing({\n following: this.hasAttribute(ATTRIBUTE_FOLLOWING),\n skipAnimation: true,\n });\n\n this._setButtonStyle();\n }\n\n /**\n * Adds extra classes to the parent button component depending on the following calculations\n * 1. If the currently detected background color has a higher contrast ratio with white than black, the \"button--dark\" class will be added\n * 2. If the currently detected background color has a contrast ratio <= 3.06 ,the \"button--bordered\" class will be added\n *\n * When the \"button--dark\" class is added, the \"following\" text and shop logo should be changed to white.\n * When the \"button--bordered\" class is added, the button should have a border.\n */\n private _setButtonStyle() {\n const background = inferBackgroundColor(this);\n const isDark =\n calculateContrast(background, '#ffffff') >\n calculateContrast(background, '#000000');\n const isBordered = calculateContrast(background, '#5433EB') <= 3.06;\n\n this._button?.classList.toggle('button--dark', isDark);\n this._button?.classList.toggle('button--bordered', isBordered);\n\n if (isDark && this._i18n) {\n const followingText = this._i18n.translate('follow_on_shop.following', {\n shop: getShopLogoHtml('white'),\n });\n this._rootElement!.querySelector(\n 'slot[name=\"following-text\"]',\n )!.innerHTML = followingText;\n }\n }\n}\n\nif (!customElements.get('follow-on-shop-button')) {\n customElements.define('follow-on-shop-button', FollowOnShopButton);\n}\n\n/**\n * Get the template contents for the follow on shop trigger button.\n *\n * @returns {string} string The template for the follow on shop trigger button\n */\nfunction getTemplateContents() {\n return `\n \n \n `;\n}\n\n/**\n * helper function to create a follow on shop trigger button\n *\n * @param {string} color The color of the Shop logo.\n * @returns {string} The HTML for the Shop logo in the Follow on Shop button.\n */\nexport function getShopLogoHtml(color: string): string {\n return ``;\n}\n\n/**\n * helper function for building a Follow on Shop Button\n *\n * @param {boolean} following Whether the user is following the shop.\n * @returns {FollowOnShopButton} - a Follow on Shop Button\n */\nexport function createFollowButton(following: boolean): FollowOnShopButton {\n const element = document.createElement('follow-on-shop-button');\n\n if (following) {\n element.setAttribute(ATTRIBUTE_FOLLOWING, '');\n }\n\n return element as FollowOnShopButton;\n}\n","import {createShopHeartIcon, ShopHeartIcon} from '../../../common/svg';\nimport {colors} from '../../../common/colors';\n\nexport const ELEMENT_NAME = 'store-logo';\n\nexport class StoreLogo extends HTMLElement {\n #rootElement: ShadowRoot;\n #wrapper: HTMLDivElement;\n #logoWrapper: HTMLDivElement;\n #logoImg: HTMLImageElement;\n #logoText: HTMLSpanElement;\n #heartIcon: ShopHeartIcon;\n\n #storeName = '';\n #logoSrc = '';\n\n constructor() {\n super();\n\n const template = document.createElement('template');\n template.innerHTML = getContent();\n this.#rootElement = this.attachShadow({mode: 'open'});\n this.#rootElement.appendChild(template.content.cloneNode(true));\n\n this.#wrapper = this.#rootElement.querySelector(`.${ELEMENT_NAME}`)!;\n this.#logoWrapper = this.#rootElement.querySelector(\n `.${ELEMENT_NAME}-logo-wrapper`,\n )!;\n this.#logoImg = this.#logoWrapper.querySelector('img')!;\n this.#logoText = this.#logoWrapper.querySelector('span')!;\n\n this.#heartIcon = createShopHeartIcon();\n this.#rootElement\n .querySelector(`.${ELEMENT_NAME}-icon-wrapper`)!\n .append(this.#heartIcon);\n }\n\n update({name, logoSrc}: {name?: string; logoSrc?: string}) {\n this.#storeName = name || this.#storeName;\n this.#logoSrc = logoSrc || this.#logoSrc;\n\n this.#updateDom();\n }\n\n connectedCallback() {\n this.#logoImg.addEventListener('error', () => {\n this.#logoSrc = '';\n this.#updateDom();\n });\n }\n\n setFavorited() {\n this.#wrapper.classList.add(`${ELEMENT_NAME}--favorited`);\n\n if (window.matchMedia(`(prefers-reduced-motion: reduce)`).matches) {\n this.#heartIcon.setFilled();\n return Promise.resolve();\n } else {\n return new Promise((resolve) => {\n this.#heartIcon.addEventListener('animationstart', () => {\n this.#heartIcon.setFilled();\n });\n\n this.#heartIcon.addEventListener('animationend', () => {\n setTimeout(resolve, 1000);\n });\n });\n }\n }\n\n #updateDom() {\n const name = this.#storeName;\n const currentLogoSrc = this.#logoImg.src;\n\n this.#logoText.textContent = name.charAt(0);\n this.#logoText.ariaLabel = name;\n\n if (this.#logoSrc && this.#logoSrc !== currentLogoSrc) {\n this.#logoImg.src = this.#logoSrc;\n this.#logoImg.alt = name;\n this.#logoWrapper.classList.remove(`${ELEMENT_NAME}-logo-wrapper--text`);\n this.#logoWrapper.classList.add(`${ELEMENT_NAME}-logo-wrapper--image`);\n } else if (!this.#logoSrc) {\n this.#logoWrapper.classList.remove(`${ELEMENT_NAME}-logo-wrapper--image`);\n this.#logoWrapper.classList.add(`${ELEMENT_NAME}-logo-wrapper--text`);\n }\n }\n}\n\n/**\n * @returns {string} the HTML content for the StoreLogo\n */\nfunction getContent() {\n return `\n \n
\n
\n \"\"\n \n
\n
\n
\n `;\n}\n\nif (!customElements.get(ELEMENT_NAME)) {\n customElements.define(ELEMENT_NAME, StoreLogo);\n}\n\n/**\n * helper function to create a new store logo component\n *\n * @returns {StoreLogo} a new StoreLogo element\n */\nexport function createStoreLogo() {\n const storeLogo = document.createElement(ELEMENT_NAME) as StoreLogo;\n\n return storeLogo;\n}\n","import {defineCustomElement} from '../../common/init';\nimport {StoreMetadata} from '../../common/utils/types';\nimport Bugsnag from '../../common/bugsnag';\nimport {IFrameEventSource} from '../../common/MessageEventSource';\nimport MessageListener from '../../common/MessageListener';\nimport {ShopSheetModal} from '../../common/shop-sheet-modal/shop-sheet-modal';\nimport {\n PAY_AUTH_DOMAIN,\n PAY_AUTH_DOMAIN_ALT,\n SHOP_WEBSITE_DOMAIN,\n validateStorefrontOrigin,\n} from '../../common/utils/urls';\nimport {I18n} from '../../common/translator/i18n';\nimport {\n exchangeLoginCookie,\n getAnalyticsTraceId,\n getCookie,\n getStoreMeta,\n isMobileBrowser,\n updateAttribute,\n ShopHubTopic,\n} from '../../common/utils';\nimport ConnectedWebComponent from '../../common/ConnectedWebComponent';\nimport {\n sheetModalBuilder,\n SheetModalManager,\n} from '../../common/shop-sheet-modal/shop-sheet-modal-builder';\nimport {\n AuthorizeState,\n LoginButtonCompletedEvent as CompletedEvent,\n LoginButtonMessageEventData as MessageEventData,\n OAuthParams,\n ShopActionType,\n LoginButtonVersion as Version,\n} from '../../types';\nimport {\n ATTRIBUTE_CLIENT_ID,\n ATTRIBUTE_STOREFRONT_ORIGIN,\n ATTRIBUTE_VERSION,\n ERRORS,\n LOAD_TIMEOUT_MS,\n ATTRIBUTE_DEV_MODE,\n ATTRIBUTE_ANALYTICS_TRACE_ID,\n} from '../../constants/loginButton';\nimport {\n createGetAppButtonHtml,\n createScanCodeTooltipHtml,\n SHOP_FOLLOW_BUTTON_HTML,\n} from '../../constants/followButton';\n\nimport {FollowOnShopMonorailTracker} from './analytics';\nimport {createModalContent, ModalContent} from './components/modal-content';\nimport {buildAuthorizeUrl} from './authorize';\nimport {\n createFollowButton,\n FollowOnShopButton,\n} from './components/follow-on-shop-button';\nimport {createStoreLogo, StoreLogo} from './components/store-logo';\n\nenum ModalOpenStatus {\n Closed = 'closed',\n Mounting = 'mounting',\n Open = 'open',\n}\n\nexport const COOKIE_NAME = 'shop_followed';\n\nexport default class ShopFollowButton extends ConnectedWebComponent {\n #rootElement: ShadowRoot;\n #analyticsTraceId = getAnalyticsTraceId();\n #clientId = '';\n #version: Version = '2';\n #storefrontOrigin = window.location.origin;\n #devMode = false;\n #monorailTracker = new FollowOnShopMonorailTracker({\n elementName: 'shop-follow-button',\n analyticsTraceId: this.#analyticsTraceId,\n });\n\n #buttonInViewportObserver: IntersectionObserver | undefined;\n\n #followShopButton: FollowOnShopButton | undefined;\n #isFollowing = false;\n #storefrontMeta: StoreMetadata | null = null;\n\n #iframe: HTMLIFrameElement | undefined;\n #iframeListener: MessageListener | undefined;\n #iframeLoadTimeout: ReturnType | undefined;\n\n #authorizeModalManager: SheetModalManager | undefined;\n #followModalManager: SheetModalManager | undefined;\n\n #authorizeModal: ShopSheetModal | undefined;\n #authorizeLogo: StoreLogo | undefined;\n #authorizeModalContent: ModalContent | undefined;\n #authorizeModalOpenedStatus: ModalOpenStatus = ModalOpenStatus.Closed;\n #followedModal: ShopSheetModal | undefined;\n #followedModalContent: ModalContent | undefined;\n #followedTooltip: HTMLDivElement | undefined;\n\n #i18n: I18n | null = null;\n\n static get observedAttributes(): string[] {\n return [\n ATTRIBUTE_CLIENT_ID,\n ATTRIBUTE_VERSION,\n ATTRIBUTE_STOREFRONT_ORIGIN,\n ATTRIBUTE_DEV_MODE,\n ];\n }\n\n constructor() {\n super();\n\n this.#rootElement = this.attachShadow({mode: 'open'});\n this.#isFollowing = getCookie(COOKIE_NAME) === 'true';\n }\n\n #handleUserIdentityChange = () => {\n this.#updateSrc(true);\n };\n\n attributeChangedCallback(\n name: string,\n _oldValue: string,\n newValue: string,\n ): void {\n switch (name) {\n case ATTRIBUTE_VERSION:\n this.#version = newValue as Version;\n this.#updateSrc();\n break;\n case ATTRIBUTE_CLIENT_ID:\n this.#clientId = newValue;\n this.#updateSrc();\n break;\n case ATTRIBUTE_STOREFRONT_ORIGIN:\n this.#storefrontOrigin = newValue;\n validateStorefrontOrigin(this.#storefrontOrigin);\n break;\n case ATTRIBUTE_DEV_MODE:\n this.#devMode = newValue === 'true';\n this.#updateSrc();\n break;\n }\n }\n\n async connectedCallback(): Promise {\n this.subscribeToHub(\n ShopHubTopic.UserStatusIdentity,\n this.#handleUserIdentityChange,\n );\n\n await this.#initTranslations();\n this.#initElements();\n this.#initEvents();\n }\n\n async #initTranslations() {\n try {\n // BUILD_LOCALE is used for generating localized bundles.\n // See ./scripts/i18n-dynamic-import-replacer-rollup.mjs for more info.\n // eslint-disable-next-line no-process-env\n const locale = process.env.BUILD_LOCALE || I18n.getDefaultLanguage();\n const dictionary = await import(`./translations/${locale}.json`);\n this.#i18n = new I18n({[locale]: dictionary});\n } catch (error) {\n if (error instanceof Error) {\n Bugsnag.notify(error);\n }\n }\n return null;\n }\n\n #initElements() {\n this.#followShopButton = createFollowButton(this.#isFollowing);\n this.#rootElement.innerHTML = SHOP_FOLLOW_BUTTON_HTML;\n this.#rootElement.appendChild(this.#followShopButton);\n }\n\n #initEvents() {\n this.#trackComponentLoadedEvent(this.#isFollowing);\n this.#trackComponentInViewportEvent();\n\n validateStorefrontOrigin(this.#storefrontOrigin);\n this.#followShopButton?.addEventListener('click', () => {\n // dev mode\n if (this.#devMode) {\n this.#isFollowing = !this.#isFollowing;\n this.#followShopButton?.setFollowing({\n following: this.#isFollowing,\n });\n return;\n }\n\n if (this.#isFollowing) {\n this.#monorailTracker.trackFollowingGetAppButtonPageImpression();\n\n if (isMobileBrowser()) {\n this.#createAndOpenAlreadyFollowingModal();\n } else {\n this.#createAlreadyFollowingTooltip();\n }\n } else {\n this.#monorailTracker.trackFollowButtonClicked();\n this.#createAndOpenFollowOnShopModal();\n }\n });\n }\n\n disconnectedCallback(): void {\n this.unsubscribeAllFromHub();\n this.#iframeListener?.destroy();\n this.#buttonInViewportObserver?.disconnect();\n this.#authorizeModalManager?.destroy();\n this.#followModalManager?.destroy();\n }\n\n #createAndOpenFollowOnShopModal() {\n if (this.#authorizeModal) {\n this.#authorizeModal.open();\n return;\n }\n\n this.#authorizeLogo = this.#createStoreLogo();\n this.#authorizeModalContent = createModalContent({});\n this.#authorizeModalContent.append(this.#createIframe());\n\n this.#authorizeModalManager = sheetModalBuilder()\n .withInnerHTML(SHOP_FOLLOW_BUTTON_HTML)\n .build();\n this.#authorizeModal = this.#authorizeModalManager.sheetModal;\n this.#authorizeModal.setAttribute(\n ATTRIBUTE_ANALYTICS_TRACE_ID,\n this.#analyticsTraceId,\n );\n this.#authorizeModal.appendChild(this.#authorizeLogo);\n this.#authorizeModal.appendChild(this.#authorizeModalContent);\n\n this.#authorizeModal.addEventListener(\n 'modalcloserequest',\n this.#closeAuthorizeModal.bind(this),\n );\n\n this.#authorizeModalOpenedStatus = ModalOpenStatus.Mounting;\n }\n\n async #createAndOpenAlreadyFollowingModal() {\n if (!this.#followedModal) {\n this.#followModalManager = sheetModalBuilder()\n .withInnerHTML(SHOP_FOLLOW_BUTTON_HTML)\n .build();\n this.#followedModal = this.#followModalManager.sheetModal;\n this.#followedModal.setAttribute('disable-popup', 'true');\n const storeMeta = await this.#fetchStorefrontMetadata();\n const storeName = storeMeta?.name ?? 'the store';\n const title = this.#i18n?.translate(\n 'follow_on_shop.following_modal.title',\n {store: storeName},\n );\n const description = this.#i18n?.translate(\n 'follow_on_shop.following_modal.subtitle',\n );\n this.#followedModalContent = createModalContent(\n {\n title,\n description,\n },\n true,\n );\n this.#followedModal.appendChild(this.#followedModalContent);\n this.#followedModal.appendChild(\n await this.#createAlreadyFollowingModalButton(),\n );\n this.#followedModal.addEventListener('modalcloserequest', async () => {\n if (this.#followedModal) {\n await this.#followedModal.close();\n }\n this.#followShopButton?.setFocused();\n });\n\n if (title) {\n this.#followedModal.setAttribute('title', title);\n }\n }\n\n this.#followedModal.open();\n this.#monorailTracker.trackFollowingGetAppButtonPageImpression();\n }\n\n #createStoreLogo(): StoreLogo {\n const storeLogo = createStoreLogo();\n\n this.#fetchStorefrontMetadata()\n .then((storefrontMeta) => {\n storeLogo.update({\n name: storefrontMeta?.name || '',\n logoSrc: storefrontMeta?.id\n ? `${SHOP_WEBSITE_DOMAIN}/shops/${storefrontMeta.id}/logo?width=58`\n : '',\n });\n })\n .catch(() => {\n /** no-op */\n });\n\n return storeLogo;\n }\n\n #createIframe(): HTMLIFrameElement {\n this.#iframe = document.createElement('iframe');\n this.#iframe.tabIndex = 0;\n this.#updateSrc();\n\n const eventDestination: Window | undefined =\n this.ownerDocument?.defaultView || undefined;\n\n this.#iframeListener = new MessageListener(\n new IFrameEventSource(this.#iframe),\n [PAY_AUTH_DOMAIN, PAY_AUTH_DOMAIN_ALT, this.#storefrontOrigin],\n this.#handlePostMessage.bind(this),\n eventDestination,\n );\n\n updateAttribute(this.#iframe, 'allow', 'publickey-credentials-get *');\n\n return this.#iframe;\n }\n\n async #createAlreadyFollowingModalButton(): Promise {\n const buttonWrapper = document.createElement('div');\n const storeMeta = await this.#fetchStorefrontMetadata();\n const storeId = storeMeta?.id;\n\n const buttonText =\n this.#i18n?.translate('follow_on_shop.following_modal.continue', {\n defaultValue: 'Continue',\n }) ?? '';\n const buttonLink = storeId ? `https://shop.app/sid/${storeId}` : '#';\n buttonWrapper.innerHTML = createGetAppButtonHtml(buttonLink, buttonText);\n buttonWrapper.addEventListener('click', async () => {\n this.#monorailTracker.trackFollowingGetAppButtonClicked();\n this.#followedModal?.close();\n });\n return buttonWrapper;\n }\n\n async #createAlreadyFollowingTooltip() {\n if (!this.#followedTooltip) {\n this.#followedTooltip = document.createElement('div');\n this.#followedTooltip.classList.add('fos-tooltip', 'fos-tooltip-hidden');\n\n const storeMeta = await this.#fetchStorefrontMetadata();\n const storeName = storeMeta?.name ?? 'the store';\n const description =\n this.#i18n?.translate('follow_on_shop.following_modal.qr_header', {\n store: storeName,\n }) ?? '';\n const qrCodeAltText =\n this.#i18n?.translate('follow_on_shop.following_modal.qr_alt_text') ??\n '';\n const storeId = storeMeta?.id;\n const qrCodeUrl = storeId\n ? `${SHOP_WEBSITE_DOMAIN}/qr/sid/${storeId}`\n : `#`;\n this.#followedTooltip.innerHTML = createScanCodeTooltipHtml(\n description,\n qrCodeUrl,\n qrCodeAltText,\n );\n\n this.#followedTooltip\n .querySelector('.fos-tooltip-overlay')\n ?.addEventListener('click', () => {\n this.#followedTooltip?.classList.toggle('fos-tooltip-hidden', true);\n });\n this.#followedTooltip?.addEventListener('click', () => {\n this.#followedTooltip?.classList.toggle('fos-tooltip-hidden', true);\n });\n\n this.#rootElement.appendChild(this.#followedTooltip);\n }\n\n this.#followedTooltip.classList.toggle('fos-tooltip-hidden', false);\n }\n\n #updateSrc(forced?: boolean) {\n if (this.#iframe) {\n const oauthParams: OAuthParams = {\n clientId: this.#clientId,\n };\n const authorizeUrl = buildAuthorizeUrl({\n version: this.#version,\n analyticsTraceId: this.#analyticsTraceId,\n flow: ShopActionType.Follow,\n oauthParams,\n });\n\n this.#initLoadTimeout();\n updateAttribute(this.#iframe, 'src', authorizeUrl, forced);\n Bugsnag.leaveBreadcrumb('Iframe url updated', {authorizeUrl}, 'state');\n }\n }\n\n #initLoadTimeout() {\n this.#clearLoadTimeout();\n this.#iframeLoadTimeout = setTimeout(() => {\n const error = ERRORS.temporarilyUnavailable;\n this.dispatchCustomEvent('error', {\n message: error.message,\n code: error.code,\n });\n // eslint-disable-next-line no-warning-comments\n // TODO: replace this bugsnag notify with a Observe-able event\n // Bugsnag.notify(\n // new PayTimeoutError(`Pay failed to load within ${LOAD_TIMEOUT_MS}ms.`),\n // {component: this.#component, src: this.iframe?.getAttribute('src')},\n // );\n this.#clearLoadTimeout();\n }, LOAD_TIMEOUT_MS);\n }\n\n #clearLoadTimeout() {\n if (!this.#iframeLoadTimeout) return;\n clearTimeout(this.#iframeLoadTimeout);\n this.#iframeLoadTimeout = undefined;\n }\n\n #trackComponentLoadedEvent(isFollowing: boolean) {\n this.#monorailTracker.trackFollowButtonPageImpression(isFollowing);\n }\n\n #trackComponentInViewportEvent() {\n this.#buttonInViewportObserver = new IntersectionObserver((entries) => {\n for (const {isIntersecting} of entries) {\n if (isIntersecting) {\n this.#buttonInViewportObserver?.disconnect();\n this.#monorailTracker.trackFollowButtonInViewport();\n }\n }\n });\n\n this.#buttonInViewportObserver.observe(this.#followShopButton!);\n }\n\n async #fetchStorefrontMetadata() {\n if (!this.#storefrontMeta) {\n this.#storefrontMeta = await getStoreMeta(this.#storefrontOrigin);\n }\n\n return this.#storefrontMeta;\n }\n\n async #handleCompleted({\n loggedIn,\n shouldFinalizeLogin,\n }: Partial) {\n const now = new Date();\n now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);\n document.cookie = `${COOKIE_NAME}=true;expires=${now.toUTCString()};path=/`;\n\n if (loggedIn) {\n if (shouldFinalizeLogin) {\n exchangeLoginCookie(this.#storefrontOrigin, (error) => {\n Bugsnag.notify(new Error(error));\n });\n }\n\n this.publishToHub(ShopHubTopic.UserStatusIdentity);\n }\n\n await this.#authorizeLogo?.setFavorited();\n await this.#authorizeModal?.close();\n this.#iframeListener?.destroy();\n this.#followShopButton?.setFollowing({following: true});\n this.#isFollowing = true;\n this.#trackComponentLoadedEvent(true);\n }\n\n #handleError(code: string, message: string, email?: string): void {\n this.#clearLoadTimeout();\n\n this.dispatchCustomEvent('error', {\n code,\n message,\n email,\n });\n }\n\n async #handleLoaded({\n clientName,\n logoSrc,\n }: {\n clientName?: string;\n logoSrc?: string;\n }) {\n if (clientName || logoSrc) {\n this.#authorizeLogo!.update({\n name: clientName,\n logoSrc,\n });\n }\n\n if (this.#authorizeModalOpenedStatus === ModalOpenStatus.Mounting) {\n this.#authorizeModal!.open();\n this.#authorizeModalOpenedStatus = ModalOpenStatus.Open;\n this.#clearLoadTimeout();\n }\n }\n\n async #closeAuthorizeModal() {\n if (this.#authorizeModal) {\n await this.#authorizeModal.close();\n }\n this.#followShopButton?.setFocused();\n }\n\n #handlePostMessage(data: MessageEventData) {\n switch (data.type) {\n case 'loaded':\n this.#handleLoaded(data);\n break;\n case 'resize_iframe':\n this.#iframe!.style.height = `${data.height}px`;\n this.#iframe!.style.width = `${data.width}px`;\n break;\n case 'completed':\n this.#handleCompleted(data as CompletedEvent);\n break;\n case 'error':\n this.#handleError(data.code, data.message, data.email);\n break;\n case 'content':\n this.#authorizeModal?.setAttribute('title', data.title);\n this.#authorizeModalContent?.update(data);\n this.#authorizeLogo?.classList.toggle(\n 'hidden',\n data.authorizeState === AuthorizeState.Captcha,\n );\n break;\n case 'processing_status_updated':\n this.#authorizeModalContent?.update(data);\n break;\n case 'close_requested':\n this.#closeAuthorizeModal();\n break;\n }\n }\n}\n\n/**\n * Define the shop-follow-button custom element.\n */\nexport function defineElement() {\n defineCustomElement('shop-follow-button', ShopFollowButton);\n}\n","import {startBugsnag, isBrowserSupported} from '../../common/init';\nimport {defineElement as defineShopSwirl} from '../../common/shop-swirl';\n\nimport {defineElement as defineShopFollowButton} from './shop-follow-button';\nimport {defineElement as defineShopLoginButton} from './shop-login-button';\nimport {defineElement as defineShopLoginDefault} from './shop-login-default';\n\n/**\n * Initialize the login button web components.\n * This is the entry point that will be used for code-splitting.\n */\nfunction init() {\n if (!isBrowserSupported()) return;\n // eslint-disable-next-line no-process-env\n startBugsnag({bundle: 'loginButton', bundleLocale: process.env.BUILD_LOCALE});\n\n // The order of these calls is not significant. However, it is worth noting that\n // ShopFollowButton and ShopLoginDefault all rely on the ShopLoginButton.\n // To ensure that the ShopLoginButton is available when the other components are\n // defined, we prioritize defining the ShopLoginButton first.\n defineShopLoginButton();\n defineShopFollowButton();\n defineShopLoginDefault();\n defineShopSwirl();\n}\n\ninit();\n"],"names":["ShopSwirl","HTMLElement","constructor","super","template","document","createElement","size","this","getAttribute","backgroundColor","innerHTML","red","green","blue","pickLogoColor","color","sizeRatio","height","width","Math","round","getTemplateContents","Number","parseInt","undefined","attachShadow","mode","appendChild","content","cloneNode","sheetModalBuilder","wrapper","shadow","style","setProperty","withInnerHTML","build","sheetModal","createShopSheetModal","body","destroy","remove","ELEMENT_CLASS_NAME","ModalContent","_ModalContent_rootElement","set","_ModalContent_headerWrapper","_ModalContent_headerTitle","_ModalContent_headerDescription","_ModalContent_contentWrapper","_ModalContent_contentProcessingWrapper","_ModalContent_contentProcessingUser","_ModalContent_contentStatusIndicator","_ModalContent_contentChildrenWrapper","_ModalContent_disclaimerText","_ModalContent_contentStore","colors","brand","__classPrivateFieldSet","__classPrivateFieldGet","querySelector","hideDivider","classList","add","showDivider","update","_ModalContent_instances","_ModalContent_updateHeader","call","_ModalContent_updateMainContent","_ModalContent_updateDisclaimer","createModalContent","modalContent","title","description","authorizeState","visible","toggle","textContent","AuthorizeState","Start","status","email","contentWrapperVisible","Boolean","processingWrapperVisible","childrenWrapperVisible","loaderType","OneClick","StatusIndicatorLoader","Branded","Regular","createStatusIndicator","_a","setStatus","message","disclaimer","customElements","get","define","ATTRIBUTE_FOLLOWING","FollowOnShopButton","_rootElement","_button","_wrapper","_heartIcon","_followSpan","_followingSpan","_i18n","_followTextWidth","_followingTextWidth","ShopLogo","connectedCallback","_initTranslations","_initElements","setFollowing","following","skipAnimation","_b","ariaHidden","window","matchMedia","matches","_c","setFilled","_e","_d","addEventListener","setFocused","focus","locale","dictionary","follow_on_shop","follow","auth_modal","following_modal","subtitle","qr_header","qr_alt_text","continue","completed","personalization_consent","login_with_shop","login","login_title","login_title_with_store","login_description","signup_title","signup_description","login_sms_title","login_sms_description","login_email_title","login_email_description","login_email_footer","login_webauthn_title","login_webauthn_description","login_webauthn_footer","verified_email_auth","legal","terms_of_service","privacy_policy","terms","client","shop","authorized_scopes","email_name","customer_accounts","remember_me","sign_up_page","payment_request","I18n","error","Error","Bugsnag","notify","getShopLogoHtml","followText","translate","followingText","createShopHeartIcon","prepend","scrollWidth","max","hasAttribute","_setButtonStyle","background","inferBackgroundColor","isDark","calculateContrast","isBordered","ELEMENT_NAME","StoreLogo","_StoreLogo_rootElement","_StoreLogo_wrapper","_StoreLogo_logoWrapper","_StoreLogo_logoImg","_StoreLogo_logoText","_StoreLogo_heartIcon","_StoreLogo_storeName","_StoreLogo_logoSrc","foregroundSecondary","white","append","name","logoSrc","_StoreLogo_instances","_StoreLogo_updateDom","setFavorited","Promise","resolve","setTimeout","ModalOpenStatus","currentLogoSrc","src","charAt","ariaLabel","alt","COOKIE_NAME","ShopFollowButton","ConnectedWebComponent","_ShopFollowButton_rootElement","_ShopFollowButton_analyticsTraceId","getAnalyticsTraceId","_ShopFollowButton_clientId","_ShopFollowButton_version","_ShopFollowButton_storefrontOrigin","location","origin","_ShopFollowButton_devMode","_ShopFollowButton_monorailTracker","FollowOnShopMonorailTracker","elementName","analyticsTraceId","_ShopFollowButton_buttonInViewportObserver","_ShopFollowButton_followShopButton","_ShopFollowButton_isFollowing","_ShopFollowButton_storefrontMeta","_ShopFollowButton_iframe","_ShopFollowButton_iframeListener","_ShopFollowButton_iframeLoadTimeout","_ShopFollowButton_authorizeModalManager","_ShopFollowButton_followModalManager","_ShopFollowButton_authorizeModal","_ShopFollowButton_authorizeLogo","_ShopFollowButton_authorizeModalContent","_ShopFollowButton_authorizeModalOpenedStatus","Closed","_ShopFollowButton_followedModal","_ShopFollowButton_followedModalContent","_ShopFollowButton_followedTooltip","_ShopFollowButton_i18n","_ShopFollowButton_handleUserIdentityChange","_ShopFollowButton_instances","_ShopFollowButton_updateSrc","getCookie","observedAttributes","ATTRIBUTE_CLIENT_ID","ATTRIBUTE_VERSION","ATTRIBUTE_STOREFRONT_ORIGIN","ATTRIBUTE_DEV_MODE","attributeChangedCallback","_oldValue","newValue","validateStorefrontOrigin","subscribeToHub","ShopHubTopic","UserStatusIdentity","_ShopFollowButton_initTranslations","_ShopFollowButton_initElements","_ShopFollowButton_initEvents","disconnectedCallback","unsubscribeAllFromHub","disconnect","element","setAttribute","createFollowButton","SHOP_FOLLOW_BUTTON_HTML","_ShopFollowButton_trackComponentInViewportEvent","trackFollowingGetAppButtonPageImpression","isMobileBrowser","_ShopFollowButton_createAndOpenAlreadyFollowingModal","_ShopFollowButton_createAlreadyFollowingTooltip","trackFollowButtonClicked","_ShopFollowButton_createAndOpenFollowOnShopModal","open","_ShopFollowButton_createIframe","ATTRIBUTE_ANALYTICS_TRACE_ID","_ShopFollowButton_closeAuthorizeModal","bind","Mounting","storeMeta","_ShopFollowButton_fetchStorefrontMetadata","storeName","store","_ShopFollowButton_createAlreadyFollowingModalButton","__awaiter","close","storeLogo","then","storefrontMeta","id","SHOP_WEBSITE_DOMAIN","catch","tabIndex","eventDestination","ownerDocument","defaultView","MessageListener","IFrameEventSource","PAY_AUTH_DOMAIN","PAY_AUTH_DOMAIN_ALT","_ShopFollowButton_handlePostMessage","updateAttribute","buttonWrapper","storeId","buttonText","defaultValue","buttonLink","createGetAppButtonHtml","trackFollowingGetAppButtonClicked","qrCodeAltText","qrCodeUrl","createScanCodeTooltipHtml","_f","_g","forced","oauthParams","clientId","authorizeUrl","buildAuthorizeUrl","version","flow","ShopActionType","Follow","_ShopFollowButton_initLoadTimeout","leaveBreadcrumb","_ShopFollowButton_clearLoadTimeout","ERRORS","temporarilyUnavailable","dispatchCustomEvent","code","LOAD_TIMEOUT_MS","clearTimeout","isFollowing","trackFollowButtonPageImpression","IntersectionObserver","entries","isIntersecting","trackFollowButtonInViewport","observe","getStoreMeta","loggedIn","shouldFinalizeLogin","now","Date","setTime","getTime","cookie","toUTCString","exchangeLoginCookie","publishToHub","_ShopFollowButton_trackComponentLoadedEvent","_ShopFollowButton_handleLoaded","clientName","Open","data","type","_ShopFollowButton_handleCompleted","_ShopFollowButton_handleError","Captcha","isBrowserSupported","startBugsnag","bundle","bundleLocale","defineShopLoginButton","defineCustomElement","defineShopLoginDefault"],"mappings":"kYAGM,MAAOA,UAAkBC,YAC7B,WAAAC,GACEC,QAEA,MAAMC,EAAWC,SAASC,cAAc,YAClCC,EAAOC,KAAKC,aAAa,QAEzBC,EAAkBF,KAAKC,aAAa,qBAAuB,OAEjEL,EAASO,UAgBb,SAA6BJ,EAAO,GAAIG,GACtC,MAAOE,EAAKC,EAAOC,GAAQC,EAAcL,GACnCM,EAAQ,OAAOJ,MAAQC,MAAUC,KACjCG,EAAY,KACZC,EAASX,EACTY,EAAQC,KAAKC,MAAMH,EAASD,GAElC,MAAO,uDAGSC,wBACDC,0rBAKygBH,uBAG1hB,CAnCyBM,CACnBf,EAAOgB,OAAOC,SAASjB,EAAM,SAAMkB,EACnCf,GAGFF,KAAKkB,aAAa,CAACC,KAAM,SAASC,YAChCxB,EAASyB,QAA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