Commit 7b4cf842 authored by Ilya Vysotski's avatar Ilya Vysotski
Browse files

Build project

parent d44f8c06
node_modules
.DS_STORE
dist
coverage/
declare const itpHelper = "(function() {\n function ITPHelper(opts) {\n this.itpContent = document.getElementById('TopLevelInteractionContent');\n this.itpAction = document.getElementById('TopLevelInteractionButton');\n this.redirectUrl = opts.redirectUrl;\n }\n\n ITPHelper.prototype.redirect = function() {\n sessionStorage.setItem('shopify.top_level_interaction', true);\n window.location.href = this.redirectUrl;\n }\n\n ITPHelper.prototype.userAgentIsAffected = function() {\n return Boolean(document.hasStorageAccess);\n }\n\n ITPHelper.prototype.canPartitionCookies = function() {\n var versionRegEx = /Version\\/12\\.0\\.?\\d? Safari/;\n return versionRegEx.test(navigator.userAgent);\n }\n\n ITPHelper.prototype.setUpContent = function(onClick) {\n this.itpContent.style.display = 'block';\n this.itpAction.addEventListener('click', this.redirect.bind(this));\n }\n\n ITPHelper.prototype.execute = function() {\n if (!this.itpContent) {\n return;\n }\n\n if (this.userAgentIsAffected()) {\n this.setUpContent();\n } else {\n this.redirect();\n }\n }\n\n this.ITPHelper = ITPHelper;\n })(window);";
export default itpHelper;
//# sourceMappingURL=itp-helper.d.ts.map
\ No newline at end of file
{"version":3,"file":"itp-helper.d.ts","sourceRoot":"","sources":["../../../../src/auth/client/itp-helper.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,SAAS,kwCAuCC,CAAC;AAEjB,eAAe,SAAS,CAAC"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Copied from https://github.com/Shopify/shopify_app
var itpHelper = "(function() {\n function ITPHelper(opts) {\n this.itpContent = document.getElementById('TopLevelInteractionContent');\n this.itpAction = document.getElementById('TopLevelInteractionButton');\n this.redirectUrl = opts.redirectUrl;\n }\n\n ITPHelper.prototype.redirect = function() {\n sessionStorage.setItem('shopify.top_level_interaction', true);\n window.location.href = this.redirectUrl;\n }\n\n ITPHelper.prototype.userAgentIsAffected = function() {\n return Boolean(document.hasStorageAccess);\n }\n\n ITPHelper.prototype.canPartitionCookies = function() {\n var versionRegEx = /Version\\/12\\.0\\.?\\d? Safari/;\n return versionRegEx.test(navigator.userAgent);\n }\n\n ITPHelper.prototype.setUpContent = function(onClick) {\n this.itpContent.style.display = 'block';\n this.itpAction.addEventListener('click', this.redirect.bind(this));\n }\n\n ITPHelper.prototype.execute = function() {\n if (!this.itpContent) {\n return;\n }\n\n if (this.userAgentIsAffected()) {\n this.setUpContent();\n } else {\n this.redirect();\n }\n }\n\n this.ITPHelper = ITPHelper;\n })(window);";
exports.default = itpHelper;
declare const polarisCss = "html,\nbody {\n min-height: 100%;\n height: 100%;\n font-size: 1.5rem;\n font-weight: 400;\n line-height: 2rem;\n text-transform: initial;\n letter-spacing: initial;\n font-weight: 400;\n color: #212b36;\n font-family: -apple-system, BlinkMacSystemFont, San Francisco, Roboto,\n Segoe UI, Helvetica Neue, sans-serif;\n}\n\n@media (min-width: 40em) {\n html,\n body {\n font-size: 1.4rem;\n }\n}\n\nhtml {\n position: relative;\n font-size: 62.5%;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n -webkit-text-size-adjust: 100%;\n -ms-text-size-adjust: 100%;\n text-size-adjust: 100%;\n text-rendering: optimizeLegibility;\n}\n\nbody {\n min-height: 100%;\n margin: 0;\n padding: 0;\n background-color: #f4f6f8;\n}\n\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\np {\n margin: 0;\n font-size: 1em;\n font-weight: 400;\n}\n\n#CookiePartitionPrompt, #RequestStorageAccess {\n display: none;\n}\n\n.Polaris-Page {\n margin: 0 auto;\n padding: 0;\n max-width: 99.8rem;\n}\n\n@media (min-width: 30.625em) {\n .Polaris-Page {\n padding: 0 2rem;\n }\n}\n@media (min-width: 46.5em) {\n .Polaris-Page {\n padding: 0 3.2rem;\n }\n}\n\n.Polaris-Page__Content {\n margin: 2rem 0;\n}\n\n@media (min-width: 46.5em) {\n .Polaris-Page__Content {\n margin-top: 2rem;\n }\n}\n\n@media (min-width: 46.5em) {\n .Polaris-Page {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100vh;\n }\n}\n\n.Polaris-Layout {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n margin-top: -2rem;\n margin-left: -2rem;\n}\n\n.Polaris-Layout__Section {\n -webkit-box-flex: 2;\n -ms-flex: 2 2 48rem;\n flex: 2 2 48rem;\n min-width: 51%;\n}\n\n.Polaris-Layout__Section--fullWidth {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 100%;\n flex: 1 1 100%;\n}\n\n.Polaris-Layout__Section {\n max-width: calc(100% - 2rem);\n margin-top: 2rem;\n margin-left: 2rem;\n}\n\n.Polaris-Stack {\n margin-top: -1.6rem;\n margin-left: -1.6rem;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n -webkit-box-align: stretch;\n -ms-flex-align: stretch;\n align-items: stretch;\n}\n\n.Polaris-Stack > .Polaris-Stack__Item {\n margin-top: 1.6rem;\n margin-left: 1.6rem;\n max-width: calc(100% - 1.6rem);\n}\n\n.Polaris-Stack__Item {\n -webkit-box-flex: 0;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n min-width: 0;\n}\n\n.Polaris-Heading {\n font-size: 1.7rem;\n font-weight: 600;\n line-height: 2.4rem;\n margin: 0;\n}\n\n@media (min-width: 40em) {\n .Polaris-Heading {\n font-size: 1.6rem;\n }\n}\n\n.Polaris-Card {\n overflow: hidden;\n background-color: white;\n box-shadow: 0 0 0 1px rgba(63, 63, 68, 0.05),\n 0 1px 3px 0 rgba(63, 63, 68, 0.15);\n}\n\n.Polaris-Card + .Polaris-Card {\n margin-top: 2rem;\n}\n\n@media (min-width: 30.625em) {\n .Polaris-Card {\n border-radius: 3px;\n }\n}\n\n.Polaris-Card__Header {\n padding: 2rem 2rem 0;\n}\n\n.Polaris-Card__Section {\n padding: 2rem;\n}\n\n.Polaris-Card__Section + .Polaris-Card__Section {\n border-top: 1px solid #dfe3e8;\n}\n\n.Polaris-Card__Section--subdued {\n background-color: #f9fafb;\n}\n\n.Polaris-Stack--distributionTrailing {\n -webkit-box-pack: end;\n -ms-flex-pack: end;\n justify-content: flex-end;\n}\n\n.Polaris-Stack--vertical {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n\n.Polaris-Button {\n fill: #637381;\n position: relative;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n min-height: 3.6rem;\n min-width: 3.6rem;\n margin: 0;\n padding: 0.7rem 1.6rem;\n background: linear-gradient(to bottom, white, #f9fafb);\n border: 1px solid #c4cdd5;\n box-shadow: 0 1px 0 0 rgba(22, 29, 37, 0.05);\n border-radius: 3px;\n line-height: 1;\n color: #212b36;\n text-align: center;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n text-decoration: none;\n transition-property: background, border, box-shadow;\n transition-duration: 200ms;\n transition-timing-function: cubic-bezier(0.64, 0, 0.35, 1);\n}\n\n.Polaris-Button:hover {\n background: linear-gradient(to bottom, #f9fafb, #f4f6f8);\n border-color: #c4cdd5;\n}\n\n.Polaris-Button:focus {\n border-color: #5c6ac4;\n outline: 0;\n box-shadow: 0 0 0 1px #5c6ac4;\n}\n\n.Polaris-Button:active {\n background: linear-gradient(to bottom, #f4f6f8, #f4f6f8);\n border-color: #c4cdd5;\n box-shadow: 0 0 0 0 transparent, inset 0 1px 1px 0 rgba(99, 115, 129, 0.1),\n inset 0 1px 4px 0 rgba(99, 115, 129, 0.2);\n}\n\n.Polaris-Button.Polaris-Button--disabled {\n fill: #919eab;\n transition: none;\n background: linear-gradient(to bottom, #f4f6f8, #f4f6f8);\n color: #919eab;\n}\n\n.Polaris-Button__Content {\n font-size: 1.5rem;\n font-weight: 400;\n line-height: 1.6rem;\n text-transform: initial;\n letter-spacing: initial;\n position: relative;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n min-width: 1px;\n min-height: 1px;\n}\n\n@media (min-width: 40em) {\n .Polaris-Button__Content {\n font-size: 1.4rem;\n }\n}\n\n.Polaris-Button--primary {\n background: linear-gradient(to bottom, #6371c7, #5563c1);\n border-color: #3f4eae;\n box-shadow: inset 0 1px 0 0 #6774c8, 0 1px 0 0 rgba(22, 29, 37, 0.05),\n 0 0 0 0 transparent;\n color: white;\n fill: white;\n}\n\n.Polaris-Button--primary:hover {\n background: linear-gradient(to bottom, #5c6ac4, #4959bd);\n border-color: #3f4eae;\n color: white;\n text-decoration: none;\n}\n\n.Polaris-Button--primary:focus {\n border-color: #202e78;\n box-shadow: inset 0 1px 0 0 #6f7bcb, 0 1px 0 0 rgba(22, 29, 37, 0.05),\n 0 0 0 1px #202e78;\n}\n\n.Polaris-Button--primary:active {\n background: linear-gradient(to bottom, #3f4eae, #3f4eae);\n border-color: #38469b;\n box-shadow: inset 0 0 0 0 transparent, 0 1px 0 0 rgba(22, 29, 37, 0.05),\n 0 0 1px 0 #38469b;\n}\n\n.Polaris-Button--primary.Polaris-Button--disabled {\n fill: white;\n background: linear-gradient(to bottom, #bac0e6, #bac0e6);\n border-color: #a7aedf;\n box-shadow: none;\n color: white;\n}";
export default polarisCss;
//# sourceMappingURL=polaris-css.d.ts.map
\ No newline at end of file
{"version":3,"file":"polaris-css.d.ts","sourceRoot":"","sources":["../../../../src/auth/client/polaris-css.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,UAAU,+uNAkVd,CAAC;AAEH,eAAe,UAAU,CAAC"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var polarisCss = "html,\nbody {\n min-height: 100%;\n height: 100%;\n font-size: 1.5rem;\n font-weight: 400;\n line-height: 2rem;\n text-transform: initial;\n letter-spacing: initial;\n font-weight: 400;\n color: #212b36;\n font-family: -apple-system, BlinkMacSystemFont, San Francisco, Roboto,\n Segoe UI, Helvetica Neue, sans-serif;\n}\n\n@media (min-width: 40em) {\n html,\n body {\n font-size: 1.4rem;\n }\n}\n\nhtml {\n position: relative;\n font-size: 62.5%;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n -webkit-text-size-adjust: 100%;\n -ms-text-size-adjust: 100%;\n text-size-adjust: 100%;\n text-rendering: optimizeLegibility;\n}\n\nbody {\n min-height: 100%;\n margin: 0;\n padding: 0;\n background-color: #f4f6f8;\n}\n\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\np {\n margin: 0;\n font-size: 1em;\n font-weight: 400;\n}\n\n#CookiePartitionPrompt, #RequestStorageAccess {\n display: none;\n}\n\n.Polaris-Page {\n margin: 0 auto;\n padding: 0;\n max-width: 99.8rem;\n}\n\n@media (min-width: 30.625em) {\n .Polaris-Page {\n padding: 0 2rem;\n }\n}\n@media (min-width: 46.5em) {\n .Polaris-Page {\n padding: 0 3.2rem;\n }\n}\n\n.Polaris-Page__Content {\n margin: 2rem 0;\n}\n\n@media (min-width: 46.5em) {\n .Polaris-Page__Content {\n margin-top: 2rem;\n }\n}\n\n@media (min-width: 46.5em) {\n .Polaris-Page {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100vh;\n }\n}\n\n.Polaris-Layout {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n margin-top: -2rem;\n margin-left: -2rem;\n}\n\n.Polaris-Layout__Section {\n -webkit-box-flex: 2;\n -ms-flex: 2 2 48rem;\n flex: 2 2 48rem;\n min-width: 51%;\n}\n\n.Polaris-Layout__Section--fullWidth {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 100%;\n flex: 1 1 100%;\n}\n\n.Polaris-Layout__Section {\n max-width: calc(100% - 2rem);\n margin-top: 2rem;\n margin-left: 2rem;\n}\n\n.Polaris-Stack {\n margin-top: -1.6rem;\n margin-left: -1.6rem;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n -webkit-box-align: stretch;\n -ms-flex-align: stretch;\n align-items: stretch;\n}\n\n.Polaris-Stack > .Polaris-Stack__Item {\n margin-top: 1.6rem;\n margin-left: 1.6rem;\n max-width: calc(100% - 1.6rem);\n}\n\n.Polaris-Stack__Item {\n -webkit-box-flex: 0;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n min-width: 0;\n}\n\n.Polaris-Heading {\n font-size: 1.7rem;\n font-weight: 600;\n line-height: 2.4rem;\n margin: 0;\n}\n\n@media (min-width: 40em) {\n .Polaris-Heading {\n font-size: 1.6rem;\n }\n}\n\n.Polaris-Card {\n overflow: hidden;\n background-color: white;\n box-shadow: 0 0 0 1px rgba(63, 63, 68, 0.05),\n 0 1px 3px 0 rgba(63, 63, 68, 0.15);\n}\n\n.Polaris-Card + .Polaris-Card {\n margin-top: 2rem;\n}\n\n@media (min-width: 30.625em) {\n .Polaris-Card {\n border-radius: 3px;\n }\n}\n\n.Polaris-Card__Header {\n padding: 2rem 2rem 0;\n}\n\n.Polaris-Card__Section {\n padding: 2rem;\n}\n\n.Polaris-Card__Section + .Polaris-Card__Section {\n border-top: 1px solid #dfe3e8;\n}\n\n.Polaris-Card__Section--subdued {\n background-color: #f9fafb;\n}\n\n.Polaris-Stack--distributionTrailing {\n -webkit-box-pack: end;\n -ms-flex-pack: end;\n justify-content: flex-end;\n}\n\n.Polaris-Stack--vertical {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n\n.Polaris-Button {\n fill: #637381;\n position: relative;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n min-height: 3.6rem;\n min-width: 3.6rem;\n margin: 0;\n padding: 0.7rem 1.6rem;\n background: linear-gradient(to bottom, white, #f9fafb);\n border: 1px solid #c4cdd5;\n box-shadow: 0 1px 0 0 rgba(22, 29, 37, 0.05);\n border-radius: 3px;\n line-height: 1;\n color: #212b36;\n text-align: center;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n text-decoration: none;\n transition-property: background, border, box-shadow;\n transition-duration: 200ms;\n transition-timing-function: cubic-bezier(0.64, 0, 0.35, 1);\n}\n\n.Polaris-Button:hover {\n background: linear-gradient(to bottom, #f9fafb, #f4f6f8);\n border-color: #c4cdd5;\n}\n\n.Polaris-Button:focus {\n border-color: #5c6ac4;\n outline: 0;\n box-shadow: 0 0 0 1px #5c6ac4;\n}\n\n.Polaris-Button:active {\n background: linear-gradient(to bottom, #f4f6f8, #f4f6f8);\n border-color: #c4cdd5;\n box-shadow: 0 0 0 0 transparent, inset 0 1px 1px 0 rgba(99, 115, 129, 0.1),\n inset 0 1px 4px 0 rgba(99, 115, 129, 0.2);\n}\n\n.Polaris-Button.Polaris-Button--disabled {\n fill: #919eab;\n transition: none;\n background: linear-gradient(to bottom, #f4f6f8, #f4f6f8);\n color: #919eab;\n}\n\n.Polaris-Button__Content {\n font-size: 1.5rem;\n font-weight: 400;\n line-height: 1.6rem;\n text-transform: initial;\n letter-spacing: initial;\n position: relative;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n min-width: 1px;\n min-height: 1px;\n}\n\n@media (min-width: 40em) {\n .Polaris-Button__Content {\n font-size: 1.4rem;\n }\n}\n\n.Polaris-Button--primary {\n background: linear-gradient(to bottom, #6371c7, #5563c1);\n border-color: #3f4eae;\n box-shadow: inset 0 1px 0 0 #6774c8, 0 1px 0 0 rgba(22, 29, 37, 0.05),\n 0 0 0 0 transparent;\n color: white;\n fill: white;\n}\n\n.Polaris-Button--primary:hover {\n background: linear-gradient(to bottom, #5c6ac4, #4959bd);\n border-color: #3f4eae;\n color: white;\n text-decoration: none;\n}\n\n.Polaris-Button--primary:focus {\n border-color: #202e78;\n box-shadow: inset 0 1px 0 0 #6f7bcb, 0 1px 0 0 rgba(22, 29, 37, 0.05),\n 0 0 0 1px #202e78;\n}\n\n.Polaris-Button--primary:active {\n background: linear-gradient(to bottom, #3f4eae, #3f4eae);\n border-color: #38469b;\n box-shadow: inset 0 0 0 0 transparent, 0 1px 0 0 rgba(22, 29, 37, 0.05),\n 0 0 1px 0 #38469b;\n}\n\n.Polaris-Button--primary.Polaris-Button--disabled {\n fill: white;\n background: linear-gradient(to bottom, #bac0e6, #bac0e6);\n border-color: #a7aedf;\n box-shadow: none;\n color: white;\n}";
exports.default = polarisCss;
declare const requestStorageAccess: (shop: string, prefix?: string) => string;
export default requestStorageAccess;
//# sourceMappingURL=request-storage-access.d.ts.map
\ No newline at end of file
{"version":3,"file":"request-storage-access.d.ts","sourceRoot":"","sources":["../../../../src/auth/client/request-storage-access.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,oBAAoB,SAAU,MAAM,4BAyBzC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Copied from https://github.com/Shopify/shopify_app
var requestStorageAccess = function (shop, prefix) {
if (prefix === void 0) { prefix = '/'; }
return "(function() {\n function redirect() {\n var targetInfo = {\n myshopifyUrl: \"https://" + encodeURIComponent(shop) + "\",\n hasStorageAccessUrl: \"" + prefix + "auth/inline?shop=" + encodeURIComponent(shop) + "\",\n doesNotHaveStorageAccessUrl: \"" + prefix + "auth/enable_cookies?shop=" + encodeURIComponent(shop) + "\",\n appTargetUrl: \"" + prefix + "?shop=" + encodeURIComponent(shop) + "\"\n }\n\n if (window.top == window.self) {\n // If the current window is the 'parent', change the URL by setting location.href\n window.top.location.href = targetInfo.hasStorageAccessUrl;\n } else {\n var storageAccessHelper = new StorageAccessHelper(targetInfo);\n storageAccessHelper.execute();\n }\n }\n\n document.addEventListener(\"DOMContentLoaded\", redirect);\n })();";
};
exports.default = requestStorageAccess;
declare const storageAccessHelper = "(function() {\n var ACCESS_GRANTED_STATUS = 'storage_access_granted';\n var ACCESS_DENIED_STATUS = 'storage_access_denied';\n\n function StorageAccessHelper(redirectData) {\n this.redirectData = redirectData;\n }\n\n StorageAccessHelper.prototype.setNormalizedLink = function(storageAccessStatus) {\n return storageAccessStatus === ACCESS_GRANTED_STATUS ? this.redirectData.hasStorageAccessUrl : this.redirectData.doesNotHaveStorageAccessUrl;\n }\n\n StorageAccessHelper.prototype.redirectToAppTLD = function(storageAccessStatus) {\n var normalizedLink = document.createElement('a');\n\n normalizedLink.href = this.setNormalizedLink(storageAccessStatus);\n\n data = JSON.stringify({\n message: 'Shopify.API.remoteRedirect',\n data: {\n location: normalizedLink.href,\n }\n });\n window.parent.postMessage(data, this.redirectData.myshopifyUrl);\n }\n\n StorageAccessHelper.prototype.redirectToAppsIndex = function() {\n window.parent.location.href = this.redirectData.myshopifyUrl + '/admin/apps';\n }\n\n StorageAccessHelper.prototype.redirectToAppTargetUrl = function() {\n window.location.href = this.redirectData.appTargetUrl;\n }\n\n StorageAccessHelper.prototype.sameSiteNoneIncompatible = function(ua) {\n return ua.includes(\"iPhone OS 12_\") || ua.includes(\"iPad; CPU OS 12_\") || //iOS 12\n (ua.includes(\"UCBrowser/\")\n ? this.isOlderUcBrowser(ua) //UC Browser < 12.13.2\n : (ua.includes(\"Chrome/5\") || ua.includes(\"Chrome/6\"))) ||\n ua.includes(\"Chromium/5\") || ua.includes(\"Chromium/6\") ||\n (ua.includes(\" OS X 10_14_\") &&\n ((ua.includes(\"Version/\") && ua.includes(\"Safari\")) || //Safari on MacOS 10.14\n ua.endsWith(\"(KHTML, like Gecko)\"))); //Web view on MacOS 10.14\n }\n\n StorageAccessHelper.prototype.isOlderUcBrowser = function(ua) {\n var match = ua.match(/UCBrowser\\/(\\d+)\\.(\\d+)\\.(\\d+)\\./);\n if (!match) return false;\n var major = parseInt(match[1]);\n var minor = parseInt(match[2]);\n var build = parseInt(match[3]);\n if (major != 12) return major < 12;\n if (minor != 13) return minor < 13;\n return build < 2;\n }\n\n StorageAccessHelper.prototype.setCookie = function(value) {\n if(!this.sameSiteNoneIncompatible(navigator.userAgent)) {\n value += '; secure; SameSite=None'\n }\n document.cookie = value;\n }\n\n StorageAccessHelper.prototype.grantedStorageAccess = function() {\n try {\n sessionStorage.setItem('shopify.granted_storage_access', true);\n this.setCookie('shopify.granted_storage_access=true');\n if (!document.cookie) {\n throw 'Cannot set third-party cookie.'\n }\n this.redirectToAppTargetUrl();\n } catch (error) {\n console.warn('Third party cookies may be blocked.', error);\n this.redirectToAppTLD(ACCESS_DENIED_STATUS);\n }\n }\n\n StorageAccessHelper.prototype.handleRequestStorageAccess = function() {\n return document.requestStorageAccess().then(this.grantedStorageAccess.bind(this), this.redirectToAppsIndex.bind(this, ACCESS_DENIED_STATUS));\n }\n\n StorageAccessHelper.prototype.setupRequestStorageAccess = function() {\n var requestContent = document.getElementById('RequestStorageAccess');\n var requestButton = document.getElementById('TriggerAllowCookiesPrompt');\n\n requestButton.addEventListener('click', this.handleRequestStorageAccess.bind(this));\n requestContent.style.display = 'block';\n }\n\n StorageAccessHelper.prototype.handleHasStorageAccess = function() {\n if (sessionStorage.getItem('shopify.granted_storage_access')) {\n // If app was classified by ITP and used Storage Access API to acquire access\n this.redirectToAppTargetUrl();\n } else {\n // If app has not been classified by ITP and still has storage access\n this.redirectToAppTLD(ACCESS_GRANTED_STATUS);\n }\n }\n\n StorageAccessHelper.prototype.handleGetStorageAccess = function() {\n if (sessionStorage.getItem('shopify.top_level_interaction')) {\n // If merchant has been redirected to interact with TLD (requirement for prompting request to gain storage access)\n this.setupRequestStorageAccess();\n } else {\n // If merchant has not been redirected to interact with TLD (requirement for prompting request to gain storage access)\n this.redirectToAppTLD(ACCESS_DENIED_STATUS);\n }\n }\n\n StorageAccessHelper.prototype.manageStorageAccess = function() {\n return document.hasStorageAccess().then(function(hasAccess) {\n if (hasAccess) {\n this.handleHasStorageAccess();\n } else {\n this.handleGetStorageAccess();\n }\n }.bind(this));\n }\n\n StorageAccessHelper.prototype.execute = function() {\n if (ITPHelper.prototype.userAgentIsAffected()) {\n this.manageStorageAccess();\n } else {\n this.grantedStorageAccess();\n }\n }\n\n /* ITP 2.0 solution: handles cookie partitioning */\n StorageAccessHelper.prototype.setUpHelper = function() {\n return new ITPHelper({redirectUrl: window.shopOrigin + \"/admin/apps/\" + window.apiKey + window.returnTo});\n }\n\n StorageAccessHelper.prototype.setCookieAndRedirect = function() {\n this.setCookie('shopify.cookies_persist=true');\n var helper = this.setUpHelper();\n helper.redirect();\n }\n\n StorageAccessHelper.prototype.setUpCookiePartitioning = function() {\n var itpContent = document.getElementById('CookiePartitionPrompt');\n itpContent.style.display = 'block';\n\n // var button = document.getElementById('AcceptCookies');\n // button.addEventListener('click', this.setCookieAndRedirect.bind(this));\n }\n\n this.StorageAccessHelper = StorageAccessHelper;\n })(window);";
export default storageAccessHelper;
//# sourceMappingURL=storage-access-helper.d.ts.map
\ No newline at end of file
{"version":3,"file":"storage-access-helper.d.ts","sourceRoot":"","sources":["../../../../src/auth/client/storage-access-helper.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,mBAAmB,0nMAmJT,CAAC;AAEjB,eAAe,mBAAmB,CAAC"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Copied from https://github.com/Shopify/shopify_app
var storageAccessHelper = "(function() {\n var ACCESS_GRANTED_STATUS = 'storage_access_granted';\n var ACCESS_DENIED_STATUS = 'storage_access_denied';\n\n function StorageAccessHelper(redirectData) {\n this.redirectData = redirectData;\n }\n\n StorageAccessHelper.prototype.setNormalizedLink = function(storageAccessStatus) {\n return storageAccessStatus === ACCESS_GRANTED_STATUS ? this.redirectData.hasStorageAccessUrl : this.redirectData.doesNotHaveStorageAccessUrl;\n }\n\n StorageAccessHelper.prototype.redirectToAppTLD = function(storageAccessStatus) {\n var normalizedLink = document.createElement('a');\n\n normalizedLink.href = this.setNormalizedLink(storageAccessStatus);\n\n data = JSON.stringify({\n message: 'Shopify.API.remoteRedirect',\n data: {\n location: normalizedLink.href,\n }\n });\n window.parent.postMessage(data, this.redirectData.myshopifyUrl);\n }\n\n StorageAccessHelper.prototype.redirectToAppsIndex = function() {\n window.parent.location.href = this.redirectData.myshopifyUrl + '/admin/apps';\n }\n\n StorageAccessHelper.prototype.redirectToAppTargetUrl = function() {\n window.location.href = this.redirectData.appTargetUrl;\n }\n\n StorageAccessHelper.prototype.sameSiteNoneIncompatible = function(ua) {\n return ua.includes(\"iPhone OS 12_\") || ua.includes(\"iPad; CPU OS 12_\") || //iOS 12\n (ua.includes(\"UCBrowser/\")\n ? this.isOlderUcBrowser(ua) //UC Browser < 12.13.2\n : (ua.includes(\"Chrome/5\") || ua.includes(\"Chrome/6\"))) ||\n ua.includes(\"Chromium/5\") || ua.includes(\"Chromium/6\") ||\n (ua.includes(\" OS X 10_14_\") &&\n ((ua.includes(\"Version/\") && ua.includes(\"Safari\")) || //Safari on MacOS 10.14\n ua.endsWith(\"(KHTML, like Gecko)\"))); //Web view on MacOS 10.14\n }\n\n StorageAccessHelper.prototype.isOlderUcBrowser = function(ua) {\n var match = ua.match(/UCBrowser\\/(\\d+)\\.(\\d+)\\.(\\d+)\\./);\n if (!match) return false;\n var major = parseInt(match[1]);\n var minor = parseInt(match[2]);\n var build = parseInt(match[3]);\n if (major != 12) return major < 12;\n if (minor != 13) return minor < 13;\n return build < 2;\n }\n\n StorageAccessHelper.prototype.setCookie = function(value) {\n if(!this.sameSiteNoneIncompatible(navigator.userAgent)) {\n value += '; secure; SameSite=None'\n }\n document.cookie = value;\n }\n\n StorageAccessHelper.prototype.grantedStorageAccess = function() {\n try {\n sessionStorage.setItem('shopify.granted_storage_access', true);\n this.setCookie('shopify.granted_storage_access=true');\n if (!document.cookie) {\n throw 'Cannot set third-party cookie.'\n }\n this.redirectToAppTargetUrl();\n } catch (error) {\n console.warn('Third party cookies may be blocked.', error);\n this.redirectToAppTLD(ACCESS_DENIED_STATUS);\n }\n }\n\n StorageAccessHelper.prototype.handleRequestStorageAccess = function() {\n return document.requestStorageAccess().then(this.grantedStorageAccess.bind(this), this.redirectToAppsIndex.bind(this, ACCESS_DENIED_STATUS));\n }\n\n StorageAccessHelper.prototype.setupRequestStorageAccess = function() {\n var requestContent = document.getElementById('RequestStorageAccess');\n var requestButton = document.getElementById('TriggerAllowCookiesPrompt');\n\n requestButton.addEventListener('click', this.handleRequestStorageAccess.bind(this));\n requestContent.style.display = 'block';\n }\n\n StorageAccessHelper.prototype.handleHasStorageAccess = function() {\n if (sessionStorage.getItem('shopify.granted_storage_access')) {\n // If app was classified by ITP and used Storage Access API to acquire access\n this.redirectToAppTargetUrl();\n } else {\n // If app has not been classified by ITP and still has storage access\n this.redirectToAppTLD(ACCESS_GRANTED_STATUS);\n }\n }\n\n StorageAccessHelper.prototype.handleGetStorageAccess = function() {\n if (sessionStorage.getItem('shopify.top_level_interaction')) {\n // If merchant has been redirected to interact with TLD (requirement for prompting request to gain storage access)\n this.setupRequestStorageAccess();\n } else {\n // If merchant has not been redirected to interact with TLD (requirement for prompting request to gain storage access)\n this.redirectToAppTLD(ACCESS_DENIED_STATUS);\n }\n }\n\n StorageAccessHelper.prototype.manageStorageAccess = function() {\n return document.hasStorageAccess().then(function(hasAccess) {\n if (hasAccess) {\n this.handleHasStorageAccess();\n } else {\n this.handleGetStorageAccess();\n }\n }.bind(this));\n }\n\n StorageAccessHelper.prototype.execute = function() {\n if (ITPHelper.prototype.userAgentIsAffected()) {\n this.manageStorageAccess();\n } else {\n this.grantedStorageAccess();\n }\n }\n\n /* ITP 2.0 solution: handles cookie partitioning */\n StorageAccessHelper.prototype.setUpHelper = function() {\n return new ITPHelper({redirectUrl: window.shopOrigin + \"/admin/apps/\" + window.apiKey + window.returnTo});\n }\n\n StorageAccessHelper.prototype.setCookieAndRedirect = function() {\n this.setCookie('shopify.cookies_persist=true');\n var helper = this.setUpHelper();\n helper.redirect();\n }\n\n StorageAccessHelper.prototype.setUpCookiePartitioning = function() {\n var itpContent = document.getElementById('CookiePartitionPrompt');\n itpContent.style.display = 'block';\n\n // var button = document.getElementById('AcceptCookies');\n // button.addEventListener('click', this.setCookieAndRedirect.bind(this));\n }\n\n this.StorageAccessHelper = StorageAccessHelper;\n })(window);";
exports.default = storageAccessHelper;
declare const topLevelInteraction: (shop: string, prefix?: string) => string;
export default topLevelInteraction;
//# sourceMappingURL=top-level-interaction.d.ts.map
\ No newline at end of file
{"version":3,"file":"top-level-interaction.d.ts","sourceRoot":"","sources":["../../../../src/auth/client/top-level-interaction.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,mBAAmB,SAAU,MAAM,4BAYxC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Copied from https://github.com/Shopify/shopify_app
var topLevelInteraction = function (shop, prefix) {
if (prefix === void 0) { prefix = ''; }
return "(function() {\n function setUpTopLevelInteraction() {\n var TopLevelInteraction = new ITPHelper({\n redirectUrl: \"" + prefix + "/auth?shop=" + encodeURIComponent(shop) + "\",\n });\n\n TopLevelInteraction.execute();\n }\n\n document.addEventListener(\"DOMContentLoaded\", setUpTopLevelInteraction);\n })();";
};
exports.default = topLevelInteraction;
import { Context } from 'koa';
export default function getCookieOptions(ctx: Context): {};
//# sourceMappingURL=cookie-options.d.ts.map
\ No newline at end of file
{"version":3,"file":"cookie-options.d.ts","sourceRoot":"","sources":["../../../src/auth/cookie-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,KAAK,CAAC;AAE5B,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,GAAG,EAAE,OAAO,MAYpD"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function getCookieOptions(ctx) {
var header = ctx.header;
var userAgent = header['user-agent'];
var isChrome = userAgent && userAgent.match(/chrome|crios/i);
var cookieOptions = {};
if (isChrome) {
cookieOptions = {
sameSite: 'none',
secure: true,
};
}
return cookieOptions;
}
exports.default = getCookieOptions;
import { Context } from 'koa';
import { OAuthStartOptions } from '../types';
export default function createEnableCookies({ apiKey, prefix, }: OAuthStartOptions): (ctx: Context) => void;
//# sourceMappingURL=create-enable-cookies.d.ts.map
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment