{"version":3,"file":"client.login-button_6273c0b3.es.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","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","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","v","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_description","signup_title","signup_description","login_sms_title","login_sms_description","login_email_title","login_email_description","login_email_footer","login_title_with_store","login_webauthn_title","login_webauthn_description","login_webauthn_footer","customer_accounts","remember_me","sign_up_page","verified_email_auth","legal","terms_of_service","privacy_policy","terms","client","shop","authorized_scopes","email_name","payment_request","I18n","error","Error","Bugsnag","notify","_","getShopLogoHtml","followText","translate","followingText","createShopHeartIcon","prepend","scrollWidth","max","hasAttribute","_setButtonStyle","k","background","inferBackgroundColor","isDark","calculateContrast","isBordered","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","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":"sYAGM,MAAOA,UAAkBC,YAC7BC,cACEC,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,wBAhCjgBM,CACnBf,EAAOgB,OAAOC,SAASjB,EAAM,SAAMkB,EACnCf,GAGFF,KAAKkB,aAAa,CAACC,KAAM,SAASC,YAChCxB,EAASyB,QAAQC,WAAU,cCDjBC,IACd,MAAMC,EAAU3B,SAASC,cAAc,OACjC2B,EAASD,EAAQN,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