{{terminalErrorHeading}}

An error has occurred

{{terminalError}}

// Get Angular injector from the checkout app var injector = angular.element(document.querySelector('.checkout-component')).injector() var ngEventService = injector.get('ngEventService') var eventService = injector.get('eventService') // Listen for when a payment method is selected ngEventService.subscribe('EVENT_CHECKOUT_PAYMENT_METHODS_CHANGED', function () { eventService.customEvent('customEvent', { eventName: 'payment-methods-ready', params: {}, }) })
if (!document.getElementById('addTemplateScript')) { const BRANCH_KEY = 'qaBranch' const DEFAULT_FOLDER_NAME = 'staging' function getDevelopmentTemplateFolderName(branch) { if (branch === 'clear') { deleteBranchFromStorage() return DEFAULT_FOLDER_NAME } function validateAndSaveBranchToStorage(targetBranch) { if (targetBranch.startsWith('SCMPWEB-')) sessionStorage.setItem(BRANCH_KEY, targetBranch) return targetBranch } function getBranchFromStorage() { return sessionStorage.getItem(BRANCH_KEY) } function deleteBranchFromStorage() { return sessionStorage.removeItem(BRANCH_KEY) } if (!branch) { const branch = getBranchFromStorage() if (branch) return branch else return 'staging' } else { return validateAndSaveBranchToStorage(branch) } } const currentUrl = new URL(window.location.href) const isInsidePianoIframe = ['tinypass.com', 'piano.io'].some(pianoDomain => currentUrl.host.includes(pianoDomain), ) const rootUrl = isInsidePianoIframe ? new URL(currentUrl.searchParams.get('url')) : currentUrl const isProduction = rootUrl.host.includes('scmp.com') var script = document.createElement('script') const src = (() => { if (isProduction) { const timestamp = Math.round(Date.now().valueOf() / 1000 / 60 / 60) //invalidate cache every hour a value return `https://assets.i-scmp.com/subscription-template/shoppingcart.js?v=${timestamp}` } else { const targetBranch = rootUrl.searchParams.get('branch') if (targetBranch === 'localhost') { return `https://rosetta-template.local.product-web.dev-2.scmp.tech/dev/shoppingcart.js` } else { const folderName = getDevelopmentTemplateFolderName(targetBranch) console.info('TEMPLATE FOLDER NAME:', folderName) return `https://product-web-scmp-pwa-dev.oss-cn-hongkong.aliyuncs.com/subscription-template/${folderName}/shoppingcart.js` } } })() script.id = 'addTemplateScript' script.async = true script.defer = true script.src = src document.head.appendChild(script) }