{"version":3,"file":"client.login-button_eaf8af49.pt-PT.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 * @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 * @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 * @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 * @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 * @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 * @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 {PayMessageSender} from 'common/MessageSender';\n\nimport {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 removeOnePasswordPrompt,\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 OAuthParamsV1,\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 #iframeMessenger: PayMessageSender | 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.#openAuthorizeModal();\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 this.#iframeMessenger = new PayMessageSender(this.#iframe);\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 | OAuthParamsV1 = {\n clientId: this.#clientId,\n responseType: 'code',\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.#openAuthorizeModal();\n this.#authorizeModalOpenedStatus = ModalOpenStatus.Open;\n this.#clearLoadTimeout();\n }\n }\n\n async #openAuthorizeModal() {\n const result = await this.#authorizeModal!.open();\n if (result) {\n this.#iframeMessenger?.postMessage({\n type: 'sheetmodalopened',\n });\n }\n }\n\n async #closeAuthorizeModal() {\n if (this.#authorizeModal) {\n const result = await this.#authorizeModal.close();\n if (result) {\n this.#iframeMessenger?.postMessage({type: 'sheetmodalclosed'});\n // Remove the 1password custom element from the DOM after the sheet modal is closed.\n removeOnePasswordPrompt();\n }\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_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","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_iframeMessenger","_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","_ShopFollowButton_openAuthorizeModal","_ShopFollowButton_createIframe","ATTRIBUTE_ANALYTICS_TRACE_ID","_ShopFollowButton_closeAuthorizeModal","bind","Mounting","storeMeta","_ShopFollowButton_fetchStorefrontMetadata","storeName","store","_ShopFollowButton_createAlreadyFollowingModalButton","__awaiter","close","open","storeLogo","then","storefrontMeta","id","SHOP_WEBSITE_DOMAIN","catch","tabIndex","eventDestination","ownerDocument","defaultView","MessageListener","IFrameEventSource","PAY_AUTH_DOMAIN","PAY_AUTH_DOMAIN_ALT","_ShopFollowButton_handlePostMessage","PayMessageSender","updateAttribute","buttonWrapper","storeId","buttonText","defaultValue","buttonLink","createGetAppButtonHtml","trackFollowingGetAppButtonClicked","qrCodeAltText","qrCodeUrl","createScanCodeTooltipHtml","_f","_g","forced","oauthParams","clientId","responseType","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","postMessage","type","removeOnePasswordPrompt","data","_ShopFollowButton_handleCompleted","_ShopFollowButton_handleError","Captcha","isBrowserSupported","startBugsnag","bundle","bundleLocale","defineShopLoginButton","defineCustomElement","defineShopLoginDefault"],"mappings":"yZAGM,MAAOA,UAAkBC,YAC7B,WAAAC,GACEC,QAEA,MAAMC,EAAWC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