UNPKG

@whop/checkout

Version:

Embed Whop checkout on any website

1 lines 1.1 kB
"use strict";function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}(function(){var n=document.currentScript,i=n===null||n===void 0?void 0:n.src;var t;(typeof window==="undefined"?"undefined":e(window))<"u"&&i&&((t=window.wco)!==null&&t!==void 0?t: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 t=(i=window.wco)===null||i===void 0?void 0:i.identifiedFrames.get(e);if(!t)throw new Error("Failed to submit Whop embedded checkout. No embed with identifier ".concat(e," found."));t.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")}}}())})();