@whop/checkout
Version:
Embed Whop checkout on any website
1 lines • 1.07 kB
JavaScript
function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var n=document.currentScript,i=n===null||n===void 0?void 0:n.src;var o;(typeof window==="undefined"?"undefined":e(window))<"u"&&i&&((o=window.wco)!==null&&o!==void 0?o:window.wco=function(){var e=document.createElement("script");return e.src=i.replace(/loader\.js$/,"index.js"),e.async=!0,e.defer=!0,document.head.appendChild(e),{injected:!0,listening:!1,frames:new Map,identifiedFrames:new Map,submit:function(e,n){var i;var o=(i=window.wco)===null||i===void 0?void 0:i.identifiedFrames.get(e);if(!o)throw new Error("Failed to submit Whop embedded checkout. No embed with identifier ".concat(e," found."));o.dispatchEvent(new CustomEvent("checkout:submit",{detail:n,cancelable:!0,bubbles:!1,composed:!0}))},getEmail:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2e3;throw new Error("Whop Embedded checkout script not initialized")},setEmail:function(e,n){throw new Error("Whop Embedded checkout script not initialized")}}}());