@stripe/ui-extension-sdk
Version:
The suite of functionality available to UI extensions in Stripe apps
20 lines (19 loc) • 823 B
JavaScript
;
/**
* Private! This allows the shared endpoint to be intialized
* so that the SDK can communicate with the Dashboard.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getHostEndpoint = void 0;
const invariant_1 = __importDefault(require("invariant"));
const getHostEndpoint = () => {
// This is endpoint is created from the MessagePort transferred from the host env
// as a part of the `init_extension` message.
const hostEndpoint = globalThis.__StripeExtExports?.endpoint;
(0, invariant_1.default)(hostEndpoint, 'hostEndpoint has not been initialized');
return hostEndpoint;
};
exports.getHostEndpoint = getHostEndpoint;