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