@authorizeearth/react 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,689 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+
5
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
+
7
+ var React__default = /*#__PURE__*/_interopDefault(React);
8
+
9
+ // src/constants.ts
10
+ var IFRAME_ID = "authorize-earth-iframe";
11
+ var SHADOW_HOST_ID = "authorize-earth-shadow-host";
12
+ var MOBILE_BREAKPOINT = 640;
13
+ var ORIGINS = {
14
+ live: "https://id.authorizeearth.com",
15
+ test: "https://dashboard.authorizeearth.com"
16
+ };
17
+ var ALLOWED_ORIGINS = [
18
+ ORIGINS.live,
19
+ ORIGINS.test,
20
+ "https://id.authorize.earth",
21
+ "https://dashboard.authorize.earth"
22
+ ];
23
+
24
+ // src/utils.ts
25
+ function isValidOrigin(origin) {
26
+ return ALLOWED_ORIGINS.includes(origin);
27
+ }
28
+ function getTargetOrigin(testMode) {
29
+ return testMode ? ORIGINS.test : ORIGINS.live;
30
+ }
31
+ function isMobileViewport() {
32
+ return window.innerWidth <= MOBILE_BREAKPOINT;
33
+ }
34
+ function buildIframeUrl(params) {
35
+ const {
36
+ sessionToken,
37
+ displayMode,
38
+ testMode,
39
+ theme,
40
+ externalHash,
41
+ integrationId,
42
+ templateId,
43
+ simulateError
44
+ } = params;
45
+ const origin = window.location.origin;
46
+ const parentUrl = window.location.href;
47
+ const targetOrigin = getTargetOrigin(testMode);
48
+ const urlParams = new URLSearchParams();
49
+ urlParams.set("mode", displayMode);
50
+ urlParams.set("origin", origin);
51
+ urlParams.set("parent_url", parentUrl);
52
+ if (theme) {
53
+ urlParams.set("theme", theme);
54
+ }
55
+ if (testMode) {
56
+ if (templateId) urlParams.set("template", templateId);
57
+ if (sessionToken) urlParams.set("integration_session_id", sessionToken);
58
+ if (integrationId) urlParams.set("integration_id", integrationId);
59
+ if (externalHash) urlParams.set("external_hash", externalHash);
60
+ if (simulateError) urlParams.set("simulate_error", simulateError);
61
+ return `${targetOrigin}/idv-test?${urlParams.toString()}`;
62
+ }
63
+ urlParams.set("integration_session_id", sessionToken);
64
+ if (integrationId) urlParams.set("integration_id", integrationId);
65
+ if (externalHash) urlParams.set("external_hash", externalHash);
66
+ return `${targetOrigin}/?${urlParams.toString()}`;
67
+ }
68
+
69
+ // src/styles.ts
70
+ function getStyles(theme) {
71
+ const isDark = theme === "dark";
72
+ return `
73
+ @keyframes authorize-earth-fade-in {
74
+ from { opacity: 0; }
75
+ to { opacity: 1; }
76
+ }
77
+
78
+ @keyframes authorize-earth-spin {
79
+ from { transform: rotate(0deg); }
80
+ to { transform: rotate(360deg); }
81
+ }
82
+
83
+ * {
84
+ box-sizing: border-box;
85
+ }
86
+
87
+ .authorize-earth-container {
88
+ position: fixed;
89
+ top: 0;
90
+ left: 0;
91
+ width: 100vw;
92
+ height: 100vh;
93
+ z-index: 2147483647;
94
+ animation: authorize-earth-fade-in 0.2s ease-out forwards;
95
+ font-family: system-ui, -apple-system, sans-serif;
96
+ }
97
+
98
+ .authorize-earth-container.authorize-earth-fullscreen .authorize-earth-backdrop {
99
+ display: none;
100
+ }
101
+
102
+ .authorize-earth-container.authorize-earth-fullscreen .authorize-earth-iframe-wrapper {
103
+ position: absolute;
104
+ top: 0;
105
+ left: 0;
106
+ width: 100%;
107
+ height: 100%;
108
+ background: ${isDark ? "#0a0a0a" : "white"};
109
+ }
110
+
111
+ .authorize-earth-container.authorize-earth-fullscreen .authorize-earth-iframe {
112
+ position: absolute;
113
+ top: 0;
114
+ left: 0;
115
+ width: 100%;
116
+ height: 100%;
117
+ border: none;
118
+ background: ${isDark ? "#0a0a0a" : "transparent"};
119
+ }
120
+
121
+ .authorize-earth-container.authorize-earth-modal {
122
+ display: flex;
123
+ align-items: flex-start;
124
+ justify-content: center;
125
+ overflow-y: auto;
126
+ }
127
+
128
+ .authorize-earth-container.authorize-earth-modal .authorize-earth-backdrop {
129
+ position: fixed;
130
+ top: 0;
131
+ left: 0;
132
+ width: 100%;
133
+ height: 100%;
134
+ background: ${isDark ? "rgba(0, 0, 0, 0.9)" : "rgba(0, 0, 0, 0.5)"};
135
+ cursor: pointer;
136
+ }
137
+
138
+ .authorize-earth-container.authorize-earth-modal .authorize-earth-modal-content {
139
+ position: relative;
140
+ z-index: 1;
141
+ width: 100%;
142
+ max-width: 480px;
143
+ margin: auto 0;
144
+ min-height: 200px;
145
+ }
146
+
147
+ .authorize-earth-container.authorize-earth-modal .authorize-earth-iframe-wrapper {
148
+ width: 100%;
149
+ min-height: 300px;
150
+ height: auto;
151
+ border: none;
152
+ border-radius: 16px;
153
+ box-shadow: ${isDark ? "0 25px 50px -12px rgba(0, 0, 0, 0.8)" : "0 25px 50px -12px rgba(0, 0, 0, 0.25)"};
154
+ background: ${isDark ? "#0a0a0a" : "white"};
155
+ display: block;
156
+ position: relative;
157
+ overflow: hidden;
158
+ transition: height 0.15s ease-out;
159
+ }
160
+
161
+ .authorize-earth-container.authorize-earth-modal .authorize-earth-iframe {
162
+ width: 100%;
163
+ height: 100%;
164
+ min-height: 300px;
165
+ border: none;
166
+ border-radius: 16px;
167
+ background: transparent;
168
+ display: block;
169
+ position: relative;
170
+ z-index: 1;
171
+ opacity: 0;
172
+ pointer-events: none;
173
+ }
174
+
175
+ .authorize-earth-container.authorize-earth-modal .authorize-earth-iframe.authorize-earth-ready {
176
+ opacity: 1;
177
+ pointer-events: auto;
178
+ }
179
+
180
+ .authorize-earth-loading-placeholder {
181
+ position: absolute;
182
+ top: 0;
183
+ left: 0;
184
+ right: 0;
185
+ bottom: 0;
186
+ display: flex;
187
+ align-items: center;
188
+ justify-content: center;
189
+ padding: 32px;
190
+ min-height: 300px;
191
+ background: ${isDark ? "#0a0a0a" : "#ffffff"};
192
+ border-radius: 16px;
193
+ z-index: 0;
194
+ }
195
+
196
+ .authorize-earth-loading-placeholder.authorize-earth-hidden {
197
+ display: none;
198
+ }
199
+
200
+ .authorize-earth-loading-content {
201
+ text-align: center;
202
+ }
203
+
204
+ .authorize-earth-spinner {
205
+ width: 32px;
206
+ height: 32px;
207
+ margin: 0 auto 16px auto;
208
+ animation: authorize-earth-spin 1s linear infinite;
209
+ display: flex;
210
+ align-items: center;
211
+ justify-content: center;
212
+ }
213
+
214
+ .authorize-earth-spinner svg {
215
+ width: 32px;
216
+ height: 32px;
217
+ display: block;
218
+ }
219
+
220
+ .authorize-earth-loading-text {
221
+ font-size: 16px;
222
+ line-height: 1.5;
223
+ color: ${isDark ? "#a3a3a3" : "#4b5563"};
224
+ margin: 0;
225
+ font-weight: 400;
226
+ }
227
+ `;
228
+ }
229
+ function createLoadingPlaceholder(theme) {
230
+ const isDark = theme === "dark";
231
+ const spinnerColor = isDark ? "#737373" : "#9ca3af";
232
+ const placeholder = document.createElement("div");
233
+ placeholder.className = "authorize-earth-loading-placeholder";
234
+ placeholder.innerHTML = `
235
+ <div class="authorize-earth-loading-content">
236
+ <div class="authorize-earth-spinner">
237
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="color: ${spinnerColor}">
238
+ <path d="M21 12a9 9 0 1 1-6.219-8.56"/>
239
+ </svg>
240
+ </div>
241
+ <p class="authorize-earth-loading-text">Loading verification session...</p>
242
+ </div>
243
+ `;
244
+ return placeholder;
245
+ }
246
+ function createShadowContainer(mode, theme) {
247
+ const shadowHost = document.createElement("div");
248
+ shadowHost.id = "authorize-earth-shadow-host";
249
+ const shadowRoot = shadowHost.attachShadow({ mode: "closed" });
250
+ const styleSheet = document.createElement("style");
251
+ styleSheet.textContent = getStyles(theme);
252
+ shadowRoot.appendChild(styleSheet);
253
+ const container = document.createElement("div");
254
+ container.className = `authorize-earth-container ${mode === "modal" ? "authorize-earth-modal" : "authorize-earth-fullscreen"}`;
255
+ const backdrop = document.createElement("div");
256
+ backdrop.className = "authorize-earth-backdrop";
257
+ container.appendChild(backdrop);
258
+ let modalContent = null;
259
+ const iframeWrapper = document.createElement("div");
260
+ iframeWrapper.className = "authorize-earth-iframe-wrapper";
261
+ const loadingPlaceholder = createLoadingPlaceholder(theme);
262
+ iframeWrapper.appendChild(loadingPlaceholder);
263
+ if (mode === "modal") {
264
+ modalContent = document.createElement("div");
265
+ modalContent.className = "authorize-earth-modal-content";
266
+ modalContent.appendChild(iframeWrapper);
267
+ container.appendChild(modalContent);
268
+ } else {
269
+ container.appendChild(iframeWrapper);
270
+ }
271
+ shadowRoot.appendChild(container);
272
+ return {
273
+ shadowHost,
274
+ shadowRoot,
275
+ container,
276
+ backdrop,
277
+ modalContent,
278
+ iframeWrapper,
279
+ loadingPlaceholder
280
+ };
281
+ }
282
+
283
+ // src/core.ts
284
+ function create(config) {
285
+ const {
286
+ sessionToken,
287
+ displayMode = "modal",
288
+ testMode = false,
289
+ theme = "light",
290
+ externalHash,
291
+ integrationId,
292
+ templateId,
293
+ simulateError,
294
+ onSuccess,
295
+ onError,
296
+ onClose,
297
+ onEvent
298
+ } = config;
299
+ const targetOrigin = getTargetOrigin(testMode);
300
+ let shadowHost = null;
301
+ let shadowRoot = null;
302
+ let container = null;
303
+ let backdrop = null;
304
+ let modalContent = null;
305
+ let iframeWrapper = null;
306
+ let loadingPlaceholder = null;
307
+ let iframe = null;
308
+ let messageHandler = null;
309
+ let resizeHandler = null;
310
+ let isDestroyed = false;
311
+ let isTemporarilyFullscreen = false;
312
+ let currentEffectiveMode = displayMode;
313
+ let currentTheme = theme;
314
+ function updateStyles() {
315
+ if (!shadowRoot) return;
316
+ const styleSheet = shadowRoot.querySelector("style");
317
+ if (styleSheet) {
318
+ styleSheet.textContent = getStyles(currentTheme);
319
+ }
320
+ }
321
+ function showIframe() {
322
+ if (iframe && !iframe.classList.contains("authorize-earth-ready")) {
323
+ iframe.classList.add("authorize-earth-ready");
324
+ }
325
+ if (loadingPlaceholder) {
326
+ loadingPlaceholder.classList.add("authorize-earth-hidden");
327
+ }
328
+ }
329
+ function switchToFullscreen() {
330
+ var _a;
331
+ if (!container || !iframe || !iframeWrapper) return;
332
+ currentEffectiveMode = "fullscreen";
333
+ container.className = "authorize-earth-container authorize-earth-fullscreen";
334
+ iframeWrapper.style.cssText = "";
335
+ iframe.style.cssText = "";
336
+ iframe.classList.add("authorize-earth-ready");
337
+ (_a = iframe.contentWindow) == null ? void 0 : _a.postMessage({ type: "authorize_earth_switch_fullscreen" }, "*");
338
+ }
339
+ function switchToModal() {
340
+ var _a;
341
+ if (!container || !iframe || !iframeWrapper) return;
342
+ currentEffectiveMode = "modal";
343
+ container.className = "authorize-earth-container authorize-earth-modal";
344
+ if (!modalContent) {
345
+ modalContent = document.createElement("div");
346
+ modalContent.className = "authorize-earth-modal-content";
347
+ container.appendChild(modalContent);
348
+ }
349
+ if (iframeWrapper.parentElement !== modalContent) {
350
+ modalContent.appendChild(iframeWrapper);
351
+ }
352
+ iframeWrapper.style.cssText = "";
353
+ iframe.style.cssText = "";
354
+ iframe.classList.add("authorize-earth-ready");
355
+ (_a = iframe.contentWindow) == null ? void 0 : _a.postMessage(
356
+ { type: "authorize_earth_switch_modal" },
357
+ "*"
358
+ );
359
+ }
360
+ function handleWindowResize() {
361
+ if (!container || !iframe || isTemporarilyFullscreen) return;
362
+ const isMobile = isMobileViewport();
363
+ const isCurrentlyModal = container.classList.contains("authorize-earth-modal");
364
+ const isCurrentlyFullscreen = container.classList.contains("authorize-earth-fullscreen");
365
+ if (isMobile && isCurrentlyModal) {
366
+ switchToFullscreen();
367
+ } else if (!isMobile && isCurrentlyFullscreen && displayMode === "modal") {
368
+ switchToModal();
369
+ }
370
+ }
371
+ function handleMessage(event) {
372
+ if (!isValidOrigin(event.origin)) return;
373
+ const message = event.data;
374
+ switch (message.type) {
375
+ case "authorize_earth_ready":
376
+ showIframe();
377
+ onEvent == null ? void 0 : onEvent({ type: "ready", timestamp: Date.now() });
378
+ break;
379
+ case "authorize_earth_theme_validated": {
380
+ const payload = message.payload;
381
+ if (!payload.has_custom_branding && currentTheme === "dark") {
382
+ currentTheme = "light";
383
+ updateStyles();
384
+ console.warn(
385
+ "[AuthorizeEarth] Dark mode requires custom branding. Falling back to light mode."
386
+ );
387
+ }
388
+ onEvent == null ? void 0 : onEvent({
389
+ type: "theme_validated",
390
+ timestamp: Date.now(),
391
+ metadata: {
392
+ theme: currentTheme,
393
+ has_custom_branding: payload.has_custom_branding
394
+ }
395
+ });
396
+ break;
397
+ }
398
+ case "authorize_earth_success":
399
+ onSuccess == null ? void 0 : onSuccess(message.payload);
400
+ break;
401
+ case "authorize_earth_error":
402
+ showIframe();
403
+ onError == null ? void 0 : onError(message.payload);
404
+ break;
405
+ case "authorize_earth_close":
406
+ onClose == null ? void 0 : onClose();
407
+ destroy();
408
+ break;
409
+ case "authorize_earth_event":
410
+ handleVerificationEvent(message.payload);
411
+ break;
412
+ case "authorize_earth_resize":
413
+ handleResize(message.payload);
414
+ break;
415
+ case "authorize_earth_redirect": {
416
+ const redirectPayload = message.payload;
417
+ if (redirectPayload == null ? void 0 : redirectPayload.url) {
418
+ window.location.href = redirectPayload.url;
419
+ }
420
+ break;
421
+ }
422
+ case "authorize_earth_passkey_complete": {
423
+ onSuccess == null ? void 0 : onSuccess(message.payload);
424
+ destroy();
425
+ break;
426
+ }
427
+ case "authorize_earth_passkey_skip": {
428
+ onClose == null ? void 0 : onClose();
429
+ destroy();
430
+ break;
431
+ }
432
+ }
433
+ }
434
+ function handleResize(payload) {
435
+ if (currentEffectiveMode === "fullscreen" || !iframe || !iframeWrapper || !(payload == null ? void 0 : payload.height)) {
436
+ return;
437
+ }
438
+ const height = Math.max(payload.height, 200);
439
+ iframe.style.height = `${height}px`;
440
+ iframeWrapper.style.height = `${height}px`;
441
+ }
442
+ function handleBackdropClick(event) {
443
+ const target = event.target;
444
+ if (target.classList.contains("authorize-earth-backdrop")) {
445
+ close();
446
+ }
447
+ }
448
+ function handleVerificationEvent(evt) {
449
+ if (evt.type === "camera_fullscreen_request" && displayMode === "modal" && !isMobileViewport()) {
450
+ isTemporarilyFullscreen = true;
451
+ switchToFullscreen();
452
+ }
453
+ if (evt.type === "camera_fullscreen_exit" && displayMode === "modal" && isTemporarilyFullscreen) {
454
+ isTemporarilyFullscreen = false;
455
+ if (!isMobileViewport()) {
456
+ switchToModal();
457
+ }
458
+ }
459
+ onEvent == null ? void 0 : onEvent(evt);
460
+ }
461
+ function open() {
462
+ if (isDestroyed) {
463
+ console.warn("[AuthorizeEarth] Cannot open a destroyed instance. Create a new one.");
464
+ return;
465
+ }
466
+ if (shadowHost) {
467
+ console.warn("[AuthorizeEarth] Already open.");
468
+ return;
469
+ }
470
+ if (testMode && !templateId) {
471
+ console.error("[AuthorizeEarth] templateId is required for test mode.");
472
+ onError == null ? void 0 : onError({
473
+ code: "MISSING_TEMPLATE_ID",
474
+ message: "templateId is required for test mode sessions"
475
+ });
476
+ return;
477
+ }
478
+ const existingHost = document.getElementById(SHADOW_HOST_ID);
479
+ if (existingHost) {
480
+ existingHost.remove();
481
+ }
482
+ const isMobile = isMobileViewport();
483
+ const effectiveDisplayMode = isMobile ? "fullscreen" : displayMode;
484
+ currentEffectiveMode = effectiveDisplayMode;
485
+ const shadowElements = createShadowContainer(
486
+ effectiveDisplayMode,
487
+ currentTheme
488
+ );
489
+ shadowHost = shadowElements.shadowHost;
490
+ shadowRoot = shadowElements.shadowRoot;
491
+ container = shadowElements.container;
492
+ backdrop = shadowElements.backdrop;
493
+ modalContent = shadowElements.modalContent;
494
+ iframeWrapper = shadowElements.iframeWrapper;
495
+ loadingPlaceholder = shadowElements.loadingPlaceholder;
496
+ iframe = document.createElement("iframe");
497
+ iframe.id = IFRAME_ID;
498
+ iframe.className = "authorize-earth-iframe";
499
+ iframe.src = buildIframeUrl({
500
+ sessionToken,
501
+ displayMode: effectiveDisplayMode,
502
+ testMode,
503
+ theme: currentTheme,
504
+ externalHash,
505
+ integrationId,
506
+ templateId,
507
+ simulateError
508
+ });
509
+ iframe.allow = "camera; microphone; publickey-credentials-get *; publickey-credentials-create *";
510
+ iframe.setAttribute("allowfullscreen", "true");
511
+ iframeWrapper.appendChild(iframe);
512
+ backdrop.addEventListener("click", handleBackdropClick);
513
+ messageHandler = handleMessage;
514
+ window.addEventListener("message", messageHandler);
515
+ resizeHandler = handleWindowResize;
516
+ window.addEventListener("resize", resizeHandler);
517
+ document.body.appendChild(shadowHost);
518
+ onEvent == null ? void 0 : onEvent({ type: "open", timestamp: Date.now() });
519
+ }
520
+ function close() {
521
+ var _a;
522
+ (_a = iframe == null ? void 0 : iframe.contentWindow) == null ? void 0 : _a.postMessage(
523
+ { type: "authorize_earth_close_request" },
524
+ targetOrigin
525
+ );
526
+ }
527
+ function destroy() {
528
+ if (isDestroyed) return;
529
+ if (messageHandler) {
530
+ window.removeEventListener("message", messageHandler);
531
+ messageHandler = null;
532
+ }
533
+ if (resizeHandler) {
534
+ window.removeEventListener("resize", resizeHandler);
535
+ resizeHandler = null;
536
+ }
537
+ if (backdrop) {
538
+ backdrop.removeEventListener("click", handleBackdropClick);
539
+ }
540
+ if (shadowHost) {
541
+ shadowHost.remove();
542
+ shadowHost = null;
543
+ shadowRoot = null;
544
+ container = null;
545
+ backdrop = null;
546
+ modalContent = null;
547
+ iframeWrapper = null;
548
+ loadingPlaceholder = null;
549
+ iframe = null;
550
+ }
551
+ isDestroyed = true;
552
+ }
553
+ return { open, close, destroy };
554
+ }
555
+ function start(config) {
556
+ const instance = create(config);
557
+ instance.open();
558
+ }
559
+ function useAuthorizeEarth(config) {
560
+ const {
561
+ sessionToken,
562
+ displayMode,
563
+ theme,
564
+ testMode,
565
+ templateId,
566
+ integrationId,
567
+ simulateError,
568
+ onSuccess,
569
+ onError,
570
+ onClose,
571
+ onEvent
572
+ } = config;
573
+ const [ready, setReady] = React.useState(false);
574
+ const [error, setError] = React.useState(null);
575
+ const instanceRef = React.useRef(null);
576
+ const callbackRefs = React.useRef({ onSuccess, onError, onClose, onEvent });
577
+ React.useEffect(() => {
578
+ callbackRefs.current = { onSuccess, onError, onClose, onEvent };
579
+ }, [onSuccess, onError, onClose, onEvent]);
580
+ React.useEffect(() => {
581
+ if (!sessionToken) {
582
+ setReady(false);
583
+ return;
584
+ }
585
+ try {
586
+ instanceRef.current = create({
587
+ sessionToken,
588
+ displayMode,
589
+ theme,
590
+ testMode,
591
+ templateId,
592
+ integrationId,
593
+ simulateError,
594
+ onSuccess: (result) => {
595
+ var _a, _b;
596
+ return (_b = (_a = callbackRefs.current).onSuccess) == null ? void 0 : _b.call(_a, result);
597
+ },
598
+ onError: (err) => {
599
+ var _a, _b;
600
+ return (_b = (_a = callbackRefs.current).onError) == null ? void 0 : _b.call(_a, err);
601
+ },
602
+ onClose: () => {
603
+ var _a, _b;
604
+ return (_b = (_a = callbackRefs.current).onClose) == null ? void 0 : _b.call(_a);
605
+ },
606
+ onEvent: (event) => {
607
+ var _a, _b;
608
+ (_b = (_a = callbackRefs.current).onEvent) == null ? void 0 : _b.call(_a, event);
609
+ if (event.type === "ready") {
610
+ setReady(true);
611
+ }
612
+ }
613
+ });
614
+ setReady(true);
615
+ setError(null);
616
+ } catch (e) {
617
+ const initError = e instanceof Error ? e : new Error("Failed to initialize AuthorizeEarth");
618
+ setError(initError);
619
+ setReady(false);
620
+ }
621
+ return () => {
622
+ var _a;
623
+ (_a = instanceRef.current) == null ? void 0 : _a.destroy();
624
+ instanceRef.current = null;
625
+ setReady(false);
626
+ };
627
+ }, [sessionToken, displayMode, theme, testMode, templateId, integrationId, simulateError]);
628
+ const open = React.useCallback(() => {
629
+ if (!instanceRef.current) {
630
+ console.warn("[AuthorizeEarth] Cannot open: no session token provided.");
631
+ return;
632
+ }
633
+ instanceRef.current.open();
634
+ }, []);
635
+ const close = React.useCallback(() => {
636
+ var _a;
637
+ (_a = instanceRef.current) == null ? void 0 : _a.close();
638
+ }, []);
639
+ return { open, close, ready, error };
640
+ }
641
+ function AuthorizeEarthButton({
642
+ sessionToken,
643
+ displayMode,
644
+ theme,
645
+ testMode,
646
+ templateId,
647
+ integrationId,
648
+ simulateError,
649
+ onSuccess,
650
+ onError,
651
+ onClose,
652
+ onEvent,
653
+ children = "Verify Identity",
654
+ className,
655
+ style,
656
+ disabled
657
+ }) {
658
+ const { open, ready } = useAuthorizeEarth({
659
+ sessionToken,
660
+ displayMode,
661
+ theme,
662
+ testMode,
663
+ templateId,
664
+ integrationId,
665
+ simulateError,
666
+ onSuccess,
667
+ onError,
668
+ onClose,
669
+ onEvent
670
+ });
671
+ return /* @__PURE__ */ React__default.default.createElement(
672
+ "button",
673
+ {
674
+ type: "button",
675
+ onClick: open,
676
+ disabled: disabled || !ready,
677
+ className,
678
+ style
679
+ },
680
+ children
681
+ );
682
+ }
683
+
684
+ exports.AuthorizeEarthButton = AuthorizeEarthButton;
685
+ exports.create = create;
686
+ exports.start = start;
687
+ exports.useAuthorizeEarth = useAuthorizeEarth;
688
+ //# sourceMappingURL=index.js.map
689
+ //# sourceMappingURL=index.js.map