react-native-persona 2.43.0 → 2.43.1-beta.1

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.
@@ -2,7 +2,7 @@ require 'json'
2
2
 
3
3
  package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
4
 
5
- persona_sdk_version = '2.48.1'
5
+ persona_sdk_version = '3.0.0'
6
6
 
7
7
  Pod::Spec.new do |s|
8
8
  s.name = 'RNPersonaInquiry2'
@@ -72,7 +72,7 @@ dependencies {
72
72
  implementation("com.facebook.react:react-android:+")
73
73
 
74
74
  // NB: be sure to bump `nfc-impl` in example/android/app/build.gradle as well
75
- implementation 'com.withpersona.sdk2:inquiry:2.43.0'
75
+ implementation 'com.withpersona.sdk2:inquiry:2.43.1-beta.1-SNAPSHOT'
76
76
  implementation("androidx.fragment:fragment:1.8.6")
77
77
 
78
78
  // Kotlin
@@ -8,11 +8,9 @@ import android.widget.FrameLayout
8
8
  import androidx.fragment.app.Fragment
9
9
  import androidx.lifecycle.lifecycleScope
10
10
  import com.withpersona.sdk2.inquiry.ExperimentalInlineApi
11
- import com.withpersona.sdk2.inquiry.InquiryResponse
12
11
  import com.withpersona.sdk2.inquiry.inline_inquiry.InlineInquiryController
13
12
  import com.withpersona.sdk2.inquiry.inline_inquiry.InlineInquiryScreen
14
13
  import com.withpersona.sdk2.inquiry.internal.InquiryIntentKeys
15
- import com.withpersona.sdk2.inquiry.types.DEFAULT_REQUEST_KEY
16
14
  import com.withpersona.sdk2.inquiry.types.InquiryErrorMessages
17
15
  import com.withpersona.sdk2.inquiry.types.collected_data.ErrorCode
18
16
  import kotlinx.coroutines.launch
@@ -28,6 +26,7 @@ class InlineInquiryWrapperFragment : Fragment(), InlineInquiryController {
28
26
  private const val ARG_REQUEST_KEY = "pi2_rn_request_key"
29
27
 
30
28
  const val ARG_EVENT = "pi2_rn_event"
29
+ const val ARG_RESULT = "pi2_rn_result"
31
30
 
32
31
  fun newInstance(
33
32
  requestKey: String,
@@ -66,10 +65,17 @@ class InlineInquiryWrapperFragment : Fragment(), InlineInquiryController {
66
65
  override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
67
66
  super.onViewCreated(view, savedInstanceState)
68
67
 
69
- requestKey = arguments?.getString(ARG_REQUEST_KEY)
68
+ val requestKey = requireNotNull(arguments?.getString(ARG_REQUEST_KEY)).also {
69
+ requestKey = it
70
+ }
70
71
 
71
- childFragmentManager.setFragmentResultListener(DEFAULT_REQUEST_KEY, viewLifecycleOwner) { _, result ->
72
- parentFragmentManager.setFragmentResult(DEFAULT_REQUEST_KEY, result)
72
+ childFragmentManager.setFragmentResultListener(requestKey, viewLifecycleOwner) { _, result ->
73
+ parentFragmentManager.setFragmentResult(
74
+ requestKey,
75
+ Bundle().apply {
76
+ putBundle(ARG_RESULT, result)
77
+ }
78
+ )
73
79
  }
74
80
 
75
81
  // Only add the fragment on first launch. On save/restore, the fragment manager should
@@ -83,7 +89,7 @@ class InlineInquiryWrapperFragment : Fragment(), InlineInquiryController {
83
89
  .commit()
84
90
  } else {
85
91
  parentFragmentManager.setFragmentResult(
86
- DEFAULT_REQUEST_KEY,
92
+ requestKey,
87
93
  Bundle().apply {
88
94
  putString(
89
95
  InquiryIntentKeys.PERSONA_ACTIVITY_RESULT,
@@ -1,9 +1,10 @@
1
1
  package com.withpersona.sdk2.reactnative;
2
2
 
3
3
  import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
4
- import static com.withpersona.sdk2.inquiry.types.ConstsKt.DEFAULT_REQUEST_KEY;
5
4
  import static com.withpersona.sdk2.reactnative.InlineInquiryWrapperFragment.ARG_EVENT;
5
+ import static com.withpersona.sdk2.reactnative.InlineInquiryWrapperFragment.ARG_RESULT;
6
6
 
7
+ import android.os.Bundle;
7
8
  import android.view.Choreographer;
8
9
  import android.view.View;
9
10
  import android.view.ViewGroup;
@@ -11,6 +12,7 @@ import android.widget.FrameLayout;
11
12
 
12
13
  import androidx.annotation.NonNull;
13
14
  import androidx.annotation.Nullable;
15
+ import androidx.annotation.OptIn;
14
16
  import androidx.fragment.app.Fragment;
15
17
  import androidx.fragment.app.FragmentActivity;
16
18
 
@@ -22,6 +24,7 @@ import com.facebook.react.common.MapBuilder;
22
24
  import com.facebook.react.uimanager.ThemedReactContext;
23
25
  import com.facebook.react.uimanager.ViewGroupManager;
24
26
  import com.facebook.react.uimanager.annotations.ReactProp;
27
+ import com.withpersona.sdk2.inquiry.ExperimentalInlineApi;
25
28
  import com.withpersona.sdk2.inquiry.Inquiry;
26
29
  import com.withpersona.sdk2.inquiry.InquiryResponse;
27
30
  import com.withpersona.sdk2.inquiry.inline_inquiry.InquiryEvent;
@@ -271,6 +274,7 @@ class PersonaInquiryViewManager extends ViewGroupManager<FrameLayout> {
271
274
  /**
272
275
  * Replace React Native view with an Inquiry fragment
273
276
  */
277
+ @OptIn(markerClass = ExperimentalInlineApi.class)
274
278
  public void createFragment(FrameLayout root, int reactNativeViewId) {
275
279
  // The create path has been reached, so the init watchdog (if armed) is no
276
280
  // longer needed.
@@ -298,8 +302,10 @@ class PersonaInquiryViewManager extends ViewGroupManager<FrameLayout> {
298
302
  return;
299
303
  }
300
304
 
305
+ final String requestKey = "pi2_rn_inquiry_" + reactNativeViewId;
301
306
  Fragment inquiryFragment = inquiry
302
307
  .buildInlineInquiry()
308
+ .requestKey(requestKey)
303
309
  .build()
304
310
  .createFragment();
305
311
 
@@ -331,21 +337,20 @@ class PersonaInquiryViewManager extends ViewGroupManager<FrameLayout> {
331
337
  return;
332
338
  }
333
339
 
334
- final String requestKey = "pi2_rn_inquiry_" + reactNativeViewId;
335
340
  InquiryEventEmitter inquiryEventEmitter = new InquiryEventEmitter(reactContext, root.getId());
336
341
 
337
- activity.getSupportFragmentManager()
338
- .setFragmentResultListener(DEFAULT_REQUEST_KEY, activity, (reqKey, result) -> {
339
- InquiryResponse response = Inquiry.extractInquiryResponseFromBundle(result, reactContext);
340
- new InquiryResultEmitter(reactContext).emitResponse(response, root);
341
- });
342
342
  activity.getSupportFragmentManager()
343
343
  .setFragmentResultListener(requestKey, activity, (reqKey, result) -> {
344
344
  InquiryEvent event = result.getParcelable(ARG_EVENT);
345
+ Bundle resultBundle = result.getBundle(ARG_RESULT);
345
346
 
346
347
  if (event != null) {
347
348
  inquiryEventEmitter.emitEvent(event);
348
349
  }
350
+ if (resultBundle != null) {
351
+ InquiryResponse response = Inquiry.extractInquiryResponseFromBundle(resultBundle, reactContext);
352
+ new InquiryResultEmitter(reactContext).emitResponse(response, root);
353
+ }
349
354
  });
350
355
 
351
356
  Fragment wrapperFragment = InlineInquiryWrapperFragment.Companion.newInstance(
@@ -67,14 +67,7 @@ function PersonaInquiryView(props) {
67
67
  }, props.onError);
68
68
  return;
69
69
  }
70
- // Defer the dispatch to the next frame. Dispatching during React's
71
- // commit phase can leave the command stranded on RN's UIManager queue
72
- // for ~30s if no other JS work follows. requestAnimationFrame ties into
73
- // the native frame loop and lands the command in a batch that flushes
74
- // on the next tick.
75
- requestAnimationFrame(() => {
76
- _reactNative.UIManager.dispatchViewManagerCommand(viewId, viewManagerConfig.Commands.create, [viewId]);
77
- });
70
+ _reactNative.UIManager.dispatchViewManagerCommand(viewId, viewManagerConfig.Commands.create, [viewId]);
78
71
  } catch (error) {
79
72
  (0, _util.callOnErrorCallback)({
80
73
  debugMessage: 'Error dispatching create command.',
@@ -83,13 +76,21 @@ function PersonaInquiryView(props) {
83
76
  }
84
77
  };
85
78
  (0, _react.useEffect)(() => {
86
- const viewId = (0, _reactNative.findNodeHandle)(ref.current);
87
79
  const listener = {
88
80
  onReadyCalled: onReadyCalledRef,
89
81
  onReadyCallback: onReadyCallbackRef
90
82
  };
91
83
  activeListeners.add(listener);
92
- create(viewId);
84
+
85
+ // Defer the dispatch to the next frame. Dispatching during React's
86
+ // commit phase can leave the command stranded on RN's UIManager queue
87
+ // for ~30s if no other JS work follows. requestAnimationFrame ties into
88
+ // the native frame loop and lands the command in a batch that flushes
89
+ // on the next tick.
90
+ requestAnimationFrame(() => {
91
+ const viewId = (0, _reactNative.findNodeHandle)(ref.current);
92
+ create(viewId);
93
+ });
93
94
  return () => {
94
95
  activeListeners.delete(listener);
95
96
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_PersonaInquiryViewManager","_util","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","activeListeners","Set","onPersonaInquiryViewEvent","event","type","forEach","l","onReadyCalled","current","setTimeout","onReadyCallback","exports","PersonaInquiryView","props","ref","useRef","onReadyCalledRef","onReadyCallbackRef","useEffect","onReady","create","viewId","callOnErrorCallback","debugMessage","errorCode","onError","viewManagerConfig","UIManager","getViewManagerConfig","Commands","requestAnimationFrame","dispatchViewManagerCommand","error","findNodeHandle","listener","add","delete","_onComplete","useCallback","callOnCompleteCallback","nativeEvent","onComplete","_onCanceled","callOnCanceledCallback","onCanceled","_onError","_onEvent","callOnEventCallback","onEvent","_onReady","callOnReadyCallback","createElement","PersonaInquiryViewManager","style","inquiry","toOptionsJson","enableInitWatchdog","initWatchdogTimeoutMs"],"sources":["PersonaInquiryView.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from 'react';\nimport { findNodeHandle, UIManager } from 'react-native';\nimport { PersonaInquiryViewManager } from './PersonaInquiryViewManager';\nimport {\n callOnCanceledCallback,\n callOnCompleteCallback,\n callOnErrorCallback,\n callOnEventCallback,\n callOnReadyCallback,\n} from './util';\nimport type {\n OnReadyCallback,\n OnCanceledCallback,\n OnCompleteCallback,\n OnErrorCallback,\n OnEventCallback,\n} from './callbacks';\nimport type { InquiryEvent } from './InquiryEvent';\n\n// Each mounted PersonaInquiryView registers a listener here so the module-level\n// onEvent dispatcher (called from src/index.ts) can route events to the\n// currently-mounted instances. Holding the state per-instance avoids\n// cross-mount poisoning when late events arrive from a torn-down SDK after a\n// previous PersonaInquiryView has unmounted but before the next one mounts.\ntype Listener = {\n onReadyCalled: React.MutableRefObject<boolean>;\n onReadyCallback: React.MutableRefObject<() => void>;\n};\n\nconst activeListeners = new Set<Listener>();\n\nexport const onPersonaInquiryViewEvent: OnEventCallback = (\n event: InquiryEvent\n) => {\n if (event.type == 'start') {\n activeListeners.forEach((l) => {\n l.onReadyCalled.current = false;\n });\n } else if (event.type == 'page_change') {\n activeListeners.forEach((l) => {\n if (!l.onReadyCalled.current) {\n l.onReadyCalled.current = true;\n\n setTimeout(function () {\n // The instance may have unmounted between scheduling and firing;\n // skip the callback if so.\n if (activeListeners.has(l)) {\n l.onReadyCallback.current();\n }\n }, 400);\n }\n });\n }\n};\n\nexport default function PersonaInquiryView(props: {\n style: any;\n inquiry: any;\n onComplete: OnCompleteCallback;\n onCanceled: OnCanceledCallback;\n onError: OnErrorCallback;\n onEvent?: OnEventCallback;\n onReady: OnReadyCallback;\n // Opt-in. Fires onError if the inquiry doesn't start within\n // `initWatchdogTimeoutMs` of mount, as a safety net for when the create\n // command stalls before reaching native. Off by default.\n enableInitWatchdog?: boolean;\n // Timeout for the init watchdog, in ms. Only applies when\n // `enableInitWatchdog` is true. Defaults to 10000. Tune higher on slow\n // devices to avoid firing on a legitimately slow cold start.\n initWatchdogTimeoutMs?: number;\n}) {\n const ref = useRef(null);\n const onReadyCalledRef = useRef(false);\n const onReadyCallbackRef = useRef<() => void>(() => {});\n\n // Keep the per-instance callback ref pointing at the latest onReady prop.\n useEffect(() => {\n onReadyCallbackRef.current = () => {\n props.onReady();\n };\n }, [props.onReady]);\n\n const create = (viewId: number | null) => {\n try {\n if (viewId == null) {\n callOnErrorCallback({ \n debugMessage: 'PersonaInquiryView not found', \n errorCode: 'UnexpectedError' \n }, props.onError);\n return;\n }\n\n const viewManagerConfig =\n UIManager.getViewManagerConfig('PersonaInquiryView');\n if (!viewManagerConfig || !viewManagerConfig.Commands) {\n callOnErrorCallback({ \n debugMessage: 'PersonaInquiryView config not found', \n errorCode: 'UnexpectedError' \n }, props.onError);\n return;\n }\n // Defer the dispatch to the next frame. Dispatching during React's\n // commit phase can leave the command stranded on RN's UIManager queue\n // for ~30s if no other JS work follows. requestAnimationFrame ties into\n // the native frame loop and lands the command in a batch that flushes\n // on the next tick.\n requestAnimationFrame(() => {\n UIManager.dispatchViewManagerCommand(\n viewId,\n viewManagerConfig.Commands.create,\n [viewId]\n );\n });\n } catch (error) {\n callOnErrorCallback({ \n debugMessage: 'Error dispatching create command.', \n errorCode: 'UnexpectedError' \n }, props.onError);\n }\n };\n\n useEffect(() => {\n const viewId = findNodeHandle(ref.current);\n\n const listener: Listener = {\n onReadyCalled: onReadyCalledRef,\n onReadyCallback: onReadyCallbackRef,\n };\n activeListeners.add(listener);\n\n create(viewId);\n\n return () => {\n activeListeners.delete(listener);\n };\n }, []);\n\n const _onComplete = useCallback(\n (event: any) => {\n callOnCompleteCallback(event.nativeEvent, props.onComplete);\n },\n [props.onComplete]\n );\n\n const _onCanceled = useCallback(\n (event: any) => {\n callOnCanceledCallback(event.nativeEvent, props.onCanceled);\n },\n [props.onCanceled]\n );\n\n const _onError = useCallback(\n (event: any) => {\n callOnErrorCallback(event.nativeEvent, props.onError);\n },\n [props.onError]\n );\n\n const _onEvent = useCallback(\n (event: any) => {\n callOnEventCallback(event.nativeEvent, props.onEvent);\n },\n [props.onEvent]\n );\n\n const _onReady = useCallback(() => {\n callOnReadyCallback(props.onReady);\n }, [props.onReady]);\n\n return (\n <PersonaInquiryViewManager\n style={props.style}\n inquiry={props.inquiry.toOptionsJson()}\n onComplete={_onComplete}\n onCanceled={_onCanceled}\n onError={_onError}\n onEvent={_onEvent}\n onReady={_onReady}\n {...(props.enableInitWatchdog\n ? {\n enableInitWatchdog: true,\n initWatchdogTimeoutMs: props.initWatchdogTimeoutMs ?? 10000,\n }\n : {})}\n ref={ref}\n />\n );\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OA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ACyC,OAAO,CAACC,aAAa,CAAC,CAAE;IACvCd,UAAU,EAAEJ,WAAY;IACxBO,UAAU,EAAEF,WAAY;IACxBjB,OAAO,EAAEoB,QAAS;IAClBG,OAAO,EAAEF,QAAS;IAClB3B,OAAO,EAAE8B;EAAS,GACbpC,KAAK,CAAC2C,kBAAkB,GACzB;IACEA,kBAAkB,EAAE,IAAI;IACxBC,qBAAqB,EAAE5C,KAAK,CAAC4C,qBAAqB,IAAI;EACxD,CAAC,GACD,CAAC,CAAC;IACN3C,GAAG,EAAEA;EAAI,EACV,CAAC;AAEN","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_PersonaInquiryViewManager","_util","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","activeListeners","Set","onPersonaInquiryViewEvent","event","type","forEach","l","onReadyCalled","current","setTimeout","onReadyCallback","exports","PersonaInquiryView","props","ref","useRef","onReadyCalledRef","onReadyCallbackRef","useEffect","onReady","create","viewId","callOnErrorCallback","debugMessage","errorCode","onError","viewManagerConfig","UIManager","getViewManagerConfig","Commands","dispatchViewManagerCommand","error","listener","add","requestAnimationFrame","findNodeHandle","delete","_onComplete","useCallback","callOnCompleteCallback","nativeEvent","onComplete","_onCanceled","callOnCanceledCallback","onCanceled","_onError","_onEvent","callOnEventCallback","onEvent","_onReady","callOnReadyCallback","createElement","PersonaInquiryViewManager","style","inquiry","toOptionsJson","enableInitWatchdog","initWatchdogTimeoutMs"],"sources":["PersonaInquiryView.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from 'react';\nimport { findNodeHandle, UIManager } from 'react-native';\nimport { PersonaInquiryViewManager } from './PersonaInquiryViewManager';\nimport {\n callOnCanceledCallback,\n callOnCompleteCallback,\n callOnErrorCallback,\n callOnEventCallback,\n callOnReadyCallback,\n} from './util';\nimport type {\n OnReadyCallback,\n OnCanceledCallback,\n OnCompleteCallback,\n OnErrorCallback,\n OnEventCallback,\n} from './callbacks';\nimport type { InquiryEvent } from './InquiryEvent';\n\n// Each mounted PersonaInquiryView registers a listener here so the module-level\n// onEvent dispatcher (called from src/index.ts) can route events to the\n// currently-mounted instances. Holding the state per-instance avoids\n// cross-mount poisoning when late events arrive from a torn-down SDK after a\n// previous PersonaInquiryView has unmounted but before the next one mounts.\ntype Listener = {\n onReadyCalled: React.MutableRefObject<boolean>;\n onReadyCallback: React.MutableRefObject<() => void>;\n};\n\nconst activeListeners = new Set<Listener>();\n\nexport const onPersonaInquiryViewEvent: OnEventCallback = (\n event: InquiryEvent\n) => {\n if (event.type == 'start') {\n activeListeners.forEach((l) => {\n l.onReadyCalled.current = false;\n });\n } else if (event.type == 'page_change') {\n activeListeners.forEach((l) => {\n if (!l.onReadyCalled.current) {\n l.onReadyCalled.current = true;\n\n setTimeout(function () {\n // The instance may have unmounted between scheduling and firing;\n // skip the callback if so.\n if (activeListeners.has(l)) {\n l.onReadyCallback.current();\n }\n }, 400);\n }\n });\n }\n};\n\nexport default function PersonaInquiryView(props: {\n style: any;\n inquiry: any;\n onComplete: OnCompleteCallback;\n onCanceled: OnCanceledCallback;\n onError: OnErrorCallback;\n onEvent?: OnEventCallback;\n onReady: OnReadyCallback;\n // Opt-in. Fires onError if the inquiry doesn't start within\n // `initWatchdogTimeoutMs` of mount, as a safety net for when the create\n // command stalls before reaching native. Off by default.\n enableInitWatchdog?: boolean;\n // Timeout for the init watchdog, in ms. Only applies when\n // `enableInitWatchdog` is true. Defaults to 10000. Tune higher on slow\n // devices to avoid firing on a legitimately slow cold start.\n initWatchdogTimeoutMs?: number;\n}) {\n const ref = useRef(null);\n const onReadyCalledRef = useRef(false);\n const onReadyCallbackRef = useRef<() => void>(() => {});\n\n // Keep the per-instance callback ref pointing at the latest onReady prop.\n useEffect(() => {\n onReadyCallbackRef.current = () => {\n props.onReady();\n };\n }, [props.onReady]);\n\n const create = (viewId: number | null) => {\n try {\n if (viewId == null) {\n callOnErrorCallback({ \n debugMessage: 'PersonaInquiryView not found', \n errorCode: 'UnexpectedError' \n }, props.onError);\n return;\n }\n\n const viewManagerConfig =\n UIManager.getViewManagerConfig('PersonaInquiryView');\n if (!viewManagerConfig || !viewManagerConfig.Commands) {\n callOnErrorCallback({ \n debugMessage: 'PersonaInquiryView config not found', \n errorCode: 'UnexpectedError' \n }, props.onError);\n return;\n }\n\n UIManager.dispatchViewManagerCommand(\n viewId,\n viewManagerConfig.Commands.create,\n [viewId]\n );\n } catch (error) {\n callOnErrorCallback({ \n debugMessage: 'Error dispatching create command.', \n errorCode: 'UnexpectedError' \n }, props.onError);\n }\n };\n\n useEffect(() => {\n const listener: Listener = {\n onReadyCalled: onReadyCalledRef,\n onReadyCallback: onReadyCallbackRef,\n };\n activeListeners.add(listener);\n\n // Defer the dispatch to the next frame. Dispatching during React's\n // commit phase can leave the command stranded on RN's UIManager queue\n // for ~30s if no other JS work follows. requestAnimationFrame ties into\n // the native frame loop and lands the command in a batch that flushes\n // on the next tick.\n requestAnimationFrame(() => {\n const viewId = findNodeHandle(ref.current);\n create(viewId);\n })\n\n return () => {\n activeListeners.delete(listener);\n };\n }, []);\n\n const _onComplete = useCallback(\n (event: any) => {\n callOnCompleteCallback(event.nativeEvent, props.onComplete);\n },\n [props.onComplete]\n );\n\n const _onCanceled = useCallback(\n (event: any) => {\n callOnCanceledCallback(event.nativeEvent, props.onCanceled);\n },\n [props.onCanceled]\n );\n\n const _onError = useCallback(\n (event: any) => {\n callOnErrorCallback(event.nativeEvent, props.onError);\n },\n [props.onError]\n );\n\n const _onEvent = useCallback(\n (event: any) => {\n callOnEventCallback(event.nativeEvent, props.onEvent);\n },\n [props.onEvent]\n );\n\n const _onReady = useCallback(() => {\n callOnReadyCallback(props.onReady);\n }, [props.onReady]);\n\n return (\n <PersonaInquiryViewManager\n style={props.style}\n inquiry={props.inquiry.toOptionsJson()}\n onComplete={_onComplete}\n onCanceled={_onCanceled}\n onError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rC,KAAK,CAACM,OAAO,CAAC;EACpC,CAAC,EAAE,CAACN,KAAK,CAACM,OAAO,CAAC,CAAC;EAEnB,oBACElD,MAAA,CAAAgB,OAAA,CAAAkE,aAAA,CAAC9E,0BAAA,CAAA+E,yBAAyB,EAAA1D,QAAA;IACxB2D,KAAK,EAAExC,KAAK,CAACwC,KAAM;IACnBC,OAAO,EAAEzC,KAAK,CAACyC,OAAO,CAACC,aAAa,CAAC,CAAE;IACvCd,UAAU,EAAEJ,WAAY;IACxBO,UAAU,EAAEF,WAAY;IACxBjB,OAAO,EAAEoB,QAAS;IAClBG,OAAO,EAAEF,QAAS;IAClB3B,OAAO,EAAE8B;EAAS,GACbpC,KAAK,CAAC2C,kBAAkB,GACzB;IACEA,kBAAkB,EAAE,IAAI;IACxBC,qBAAqB,EAAE5C,KAAK,CAAC4C,qBAAqB,IAAI;EACxD,CAAC,GACD,CAAC,CAAC;IACN3C,GAAG,EAAEA;EAAI,EACV,CAAC;AAEN","ignoreList":[]}
@@ -59,14 +59,7 @@ export default function PersonaInquiryView(props) {
59
59
  }, props.onError);
60
60
  return;
61
61
  }
62
- // Defer the dispatch to the next frame. Dispatching during React's
63
- // commit phase can leave the command stranded on RN's UIManager queue
64
- // for ~30s if no other JS work follows. requestAnimationFrame ties into
65
- // the native frame loop and lands the command in a batch that flushes
66
- // on the next tick.
67
- requestAnimationFrame(() => {
68
- UIManager.dispatchViewManagerCommand(viewId, viewManagerConfig.Commands.create, [viewId]);
69
- });
62
+ UIManager.dispatchViewManagerCommand(viewId, viewManagerConfig.Commands.create, [viewId]);
70
63
  } catch (error) {
71
64
  callOnErrorCallback({
72
65
  debugMessage: 'Error dispatching create command.',
@@ -75,13 +68,21 @@ export default function PersonaInquiryView(props) {
75
68
  }
76
69
  };
77
70
  useEffect(() => {
78
- const viewId = findNodeHandle(ref.current);
79
71
  const listener = {
80
72
  onReadyCalled: onReadyCalledRef,
81
73
  onReadyCallback: onReadyCallbackRef
82
74
  };
83
75
  activeListeners.add(listener);
84
- create(viewId);
76
+
77
+ // Defer the dispatch to the next frame. Dispatching during React's
78
+ // commit phase can leave the command stranded on RN's UIManager queue
79
+ // for ~30s if no other JS work follows. requestAnimationFrame ties into
80
+ // the native frame loop and lands the command in a batch that flushes
81
+ // on the next tick.
82
+ requestAnimationFrame(() => {
83
+ const viewId = findNodeHandle(ref.current);
84
+ create(viewId);
85
+ });
85
86
  return () => {
86
87
  activeListeners.delete(listener);
87
88
  };
@@ -1 +1 @@
1
- {"version":3,"names":["React","useCallback","useEffect","useRef","findNodeHandle","UIManager","PersonaInquiryViewManager","callOnCanceledCallback","callOnCompleteCallback","callOnErrorCallback","callOnEventCallback","callOnReadyCallback","activeListeners","Set","onPersonaInquiryViewEvent","event","type","forEach","l","onReadyCalled","current","setTimeout","has","onReadyCallback","PersonaInquiryView","props","ref","onReadyCalledRef","onReadyCallbackRef","onReady","create","viewId","debugMessage","errorCode","onError","viewManagerConfig","getViewManagerConfig","Commands","requestAnimationFrame","dispatchViewManagerCommand","error","listener","add","delete","_onComplete","nativeEvent","onComplete","_onCanceled","onCanceled","_onError","_onEvent","onEvent","_onReady","createElement","_extends","style","inquiry","toOptionsJson","enableInitWatchdog","initWatchdogTimeoutMs"],"sources":["PersonaInquiryView.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from 'react';\nimport { findNodeHandle, UIManager } from 'react-native';\nimport { PersonaInquiryViewManager } from './PersonaInquiryViewManager';\nimport {\n callOnCanceledCallback,\n callOnCompleteCallback,\n callOnErrorCallback,\n callOnEventCallback,\n callOnReadyCallback,\n} from './util';\nimport type {\n OnReadyCallback,\n OnCanceledCallback,\n OnCompleteCallback,\n OnErrorCallback,\n OnEventCallback,\n} from './callbacks';\nimport type { InquiryEvent } from './InquiryEvent';\n\n// Each mounted PersonaInquiryView registers a listener here so the module-level\n// onEvent dispatcher (called from src/index.ts) can route events to the\n// currently-mounted instances. Holding the state per-instance avoids\n// cross-mount poisoning when late events arrive from a torn-down SDK after a\n// previous PersonaInquiryView has unmounted but before the next one mounts.\ntype Listener = {\n onReadyCalled: React.MutableRefObject<boolean>;\n onReadyCallback: React.MutableRefObject<() => void>;\n};\n\nconst activeListeners = new Set<Listener>();\n\nexport const onPersonaInquiryViewEvent: OnEventCallback = (\n event: InquiryEvent\n) => {\n if (event.type == 'start') {\n activeListeners.forEach((l) => {\n l.onReadyCalled.current = false;\n });\n } else if (event.type == 'page_change') {\n activeListeners.forEach((l) => {\n if (!l.onReadyCalled.current) {\n l.onReadyCalled.current = true;\n\n setTimeout(function () {\n // The instance may have unmounted between scheduling and firing;\n // skip the callback if so.\n if (activeListeners.has(l)) {\n l.onReadyCallback.current();\n }\n }, 400);\n }\n });\n }\n};\n\nexport default function PersonaInquiryView(props: {\n style: any;\n inquiry: any;\n onComplete: OnCompleteCallback;\n onCanceled: OnCanceledCallback;\n onError: OnErrorCallback;\n onEvent?: OnEventCallback;\n onReady: OnReadyCallback;\n // Opt-in. Fires onError if the inquiry doesn't start within\n // `initWatchdogTimeoutMs` of mount, as a safety net for when the create\n // command stalls before reaching native. Off by default.\n enableInitWatchdog?: boolean;\n // Timeout for the init watchdog, in ms. Only applies when\n // `enableInitWatchdog` is true. Defaults to 10000. Tune higher on slow\n // devices to avoid firing on a legitimately slow cold start.\n initWatchdogTimeoutMs?: number;\n}) {\n const ref = useRef(null);\n const onReadyCalledRef = useRef(false);\n const onReadyCallbackRef = useRef<() => void>(() => {});\n\n // Keep the per-instance callback ref pointing at the latest onReady prop.\n useEffect(() => {\n onReadyCallbackRef.current = () => {\n props.onReady();\n };\n }, [props.onReady]);\n\n const create = (viewId: number | null) => {\n try {\n if (viewId == null) {\n callOnErrorCallback({ \n debugMessage: 'PersonaInquiryView not found', \n errorCode: 'UnexpectedError' \n }, props.onError);\n return;\n }\n\n const viewManagerConfig =\n UIManager.getViewManagerConfig('PersonaInquiryView');\n if (!viewManagerConfig || !viewManagerConfig.Commands) {\n callOnErrorCallback({ \n debugMessage: 'PersonaInquiryView config not found', \n errorCode: 'UnexpectedError' \n }, props.onError);\n return;\n }\n // Defer the dispatch to the next frame. Dispatching during React's\n // commit phase can leave the command stranded on RN's UIManager queue\n // for ~30s if no other JS work follows. requestAnimationFrame ties into\n // the native frame loop and lands the command in a batch that flushes\n // on the next tick.\n requestAnimationFrame(() => {\n UIManager.dispatchViewManagerCommand(\n viewId,\n viewManagerConfig.Commands.create,\n [viewId]\n );\n });\n } catch (error) {\n callOnErrorCallback({ \n debugMessage: 'Error dispatching create command.', \n errorCode: 'UnexpectedError' \n }, props.onError);\n }\n };\n\n useEffect(() => {\n const viewId = findNodeHandle(ref.current);\n\n const listener: Listener = {\n onReadyCalled: onReadyCalledRef,\n onReadyCallback: onReadyCallbackRef,\n };\n activeListeners.add(listener);\n\n create(viewId);\n\n return () => {\n activeListeners.delete(listener);\n };\n }, []);\n\n const _onComplete = useCallback(\n (event: any) => {\n callOnCompleteCallback(event.nativeEvent, props.onComplete);\n },\n [props.onComplete]\n );\n\n const _onCanceled = useCallback(\n (event: any) => {\n callOnCanceledCallback(event.nativeEvent, props.onCanceled);\n },\n [props.onCanceled]\n );\n\n const _onError = useCallback(\n (event: any) => {\n callOnErrorCallback(event.nativeEvent, props.onError);\n },\n [props.onError]\n );\n\n const _onEvent = useCallback(\n (event: any) => {\n callOnEventCallback(event.nativeEvent, props.onEvent);\n },\n [props.onEvent]\n );\n\n const _onReady = useCallback(() => {\n callOnReadyCallback(props.onReady);\n }, [props.onReady]);\n\n return (\n <PersonaInquiryViewManager\n style={props.style}\n inquiry={props.inquiry.toOptionsJson()}\n onComplete={_onComplete}\n onCanceled={_onCanceled}\n onError={_onError}\n onEvent={_onEvent}\n onReady={_onReady}\n {...(props.enableInitWatchdog\n ? {\n enableInitWatchdog: true,\n initWatchdogTimeoutMs: props.initWatchdogTimeoutMs ?? 10000,\n }\n : {})}\n ref={ref}\n />\n );\n}\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,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AS,GACb3B,KAAK,CAACiC,kBAAkB,GACzB;IACEA,kBAAkB,EAAE,IAAI;IACxBC,qBAAqB,EAAElC,KAAK,CAACkC,qBAAqB,IAAI;EACxD,CAAC,GACD,CAAC,CAAC;IACNjC,GAAG,EAAEA;EAAI,EACV,CAAC;AAEN","ignoreList":[]}
1
+ {"version":3,"names":["React","useCallback","useEffect","useRef","findNodeHandle","UIManager","PersonaInquiryViewManager","callOnCanceledCallback","callOnCompleteCallback","callOnErrorCallback","callOnEventCallback","callOnReadyCallback","activeListeners","Set","onPersonaInquiryViewEvent","event","type","forEach","l","onReadyCalled","current","setTimeout","has","onReadyCallback","PersonaInquiryView","props","ref","onReadyCalledRef","onReadyCallbackRef","onReady","create","viewId","debugMessage","errorCode","onError","viewManagerConfig","getViewManagerConfig","Commands","dispatchViewManagerCommand","error","listener","add","requestAnimationFrame","delete","_onComplete","nativeEvent","onComplete","_onCanceled","onCanceled","_onError","_onEvent","onEvent","_onReady","createElement","_extends","style","inquiry","toOptionsJson","enableInitWatchdog","initWatchdogTimeoutMs"],"sources":["PersonaInquiryView.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from 'react';\nimport { findNodeHandle, UIManager } from 'react-native';\nimport { PersonaInquiryViewManager } from './PersonaInquiryViewManager';\nimport {\n callOnCanceledCallback,\n callOnCompleteCallback,\n callOnErrorCallback,\n callOnEventCallback,\n callOnReadyCallback,\n} from './util';\nimport type {\n OnReadyCallback,\n OnCanceledCallback,\n OnCompleteCallback,\n OnErrorCallback,\n OnEventCallback,\n} from './callbacks';\nimport type { InquiryEvent } from './InquiryEvent';\n\n// Each mounted PersonaInquiryView registers a listener here so the module-level\n// onEvent dispatcher (called from src/index.ts) can route events to the\n// currently-mounted instances. Holding the state per-instance avoids\n// cross-mount poisoning when late events arrive from a torn-down SDK after a\n// previous PersonaInquiryView has unmounted but before the next one mounts.\ntype Listener = {\n onReadyCalled: React.MutableRefObject<boolean>;\n onReadyCallback: React.MutableRefObject<() => void>;\n};\n\nconst activeListeners = new Set<Listener>();\n\nexport const onPersonaInquiryViewEvent: OnEventCallback = (\n event: InquiryEvent\n) => {\n if (event.type == 'start') {\n activeListeners.forEach((l) => {\n l.onReadyCalled.current = false;\n });\n } else if (event.type == 'page_change') {\n activeListeners.forEach((l) => {\n if (!l.onReadyCalled.current) {\n l.onReadyCalled.current = true;\n\n setTimeout(function () {\n // The instance may have unmounted between scheduling and firing;\n // skip the callback if so.\n if (activeListeners.has(l)) {\n l.onReadyCallback.current();\n }\n }, 400);\n }\n });\n }\n};\n\nexport default function PersonaInquiryView(props: {\n style: any;\n inquiry: any;\n onComplete: OnCompleteCallback;\n onCanceled: OnCanceledCallback;\n onError: OnErrorCallback;\n onEvent?: OnEventCallback;\n onReady: OnReadyCallback;\n // Opt-in. Fires onError if the inquiry doesn't start within\n // `initWatchdogTimeoutMs` of mount, as a safety net for when the create\n // command stalls before reaching native. Off by default.\n enableInitWatchdog?: boolean;\n // Timeout for the init watchdog, in ms. Only applies when\n // `enableInitWatchdog` is true. Defaults to 10000. Tune higher on slow\n // devices to avoid firing on a legitimately slow cold start.\n initWatchdogTimeoutMs?: number;\n}) {\n const ref = useRef(null);\n const onReadyCalledRef = useRef(false);\n const onReadyCallbackRef = useRef<() => void>(() => {});\n\n // Keep the per-instance callback ref pointing at the latest onReady prop.\n useEffect(() => {\n onReadyCallbackRef.current = () => {\n props.onReady();\n };\n }, [props.onReady]);\n\n const create = (viewId: number | null) => {\n try {\n if (viewId == null) {\n callOnErrorCallback({ \n debugMessage: 'PersonaInquiryView not found', \n errorCode: 'UnexpectedError' \n }, props.onError);\n return;\n }\n\n const viewManagerConfig =\n UIManager.getViewManagerConfig('PersonaInquiryView');\n if (!viewManagerConfig || !viewManagerConfig.Commands) {\n callOnErrorCallback({ \n debugMessage: 'PersonaInquiryView config not found', \n errorCode: 'UnexpectedError' \n }, props.onError);\n return;\n }\n\n UIManager.dispatchViewManagerCommand(\n viewId,\n viewManagerConfig.Commands.create,\n [viewId]\n );\n } catch (error) {\n callOnErrorCallback({ \n debugMessage: 'Error dispatching create command.', \n errorCode: 'UnexpectedError' \n }, props.onError);\n }\n };\n\n useEffect(() => {\n const listener: Listener = {\n onReadyCalled: onReadyCalledRef,\n onReadyCallback: onReadyCallbackRef,\n };\n activeListeners.add(listener);\n\n // Defer the dispatch to the next frame. Dispatching during React's\n // commit phase can leave the command stranded on RN's UIManager queue\n // for ~30s if no other JS work follows. requestAnimationFrame ties into\n // the native frame loop and lands the command in a batch that flushes\n // on the next tick.\n requestAnimationFrame(() => {\n const viewId = findNodeHandle(ref.current);\n create(viewId);\n })\n\n return () => {\n activeListeners.delete(listener);\n };\n }, []);\n\n const _onComplete = useCallback(\n (event: any) => {\n callOnCompleteCallback(event.nativeEvent, props.onComplete);\n },\n [props.onComplete]\n );\n\n const _onCanceled = useCallback(\n (event: any) => {\n callOnCanceledCallback(event.nativeEvent, props.onCanceled);\n },\n [props.onCanceled]\n );\n\n const _onError = useCallback(\n (event: any) => {\n callOnErrorCallback(event.nativeEvent, props.onError);\n },\n [props.onError]\n );\n\n const _onEvent = useCallback(\n (event: any) => {\n callOnEventCallback(event.nativeEvent, props.onEvent);\n },\n [props.onEvent]\n );\n\n const _onReady = useCallback(() => {\n callOnReadyCallback(props.onReady);\n }, [props.onReady]);\n\n return (\n <PersonaInquiryViewManager\n style={props.style}\n inquiry={props.inquiry.toOptionsJson()}\n onComplete={_onComplete}\n onCanceled={_onCanceled}\n onError={_onError}\n onEvent={_onEvent}\n onReady={_onReady}\n {...(props.enableInitWatchdog\n ? {\n enableInitWatchdog: true,\n initWatchdogTimeoutMs: props.initWatchdogTimeoutMs ?? 10000,\n }\n : {})}\n ref={ref}\n />\n );\n}\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAC7D,SAASC,cAAc,EAAEC,SAAS,QAAQ,cAAc;AACxD,SAASC,yBAAyB,QAAQ,6BAA6B;AACv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BAAqB,IAAI;EACxD,CAAC,GACD,CAAC,CAAC;IACNjC,GAAG,EAAEA;EAAI,EACV,CAAC;AAEN","ignoreList":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-persona",
3
3
  "title": "React Native Persona",
4
- "version": "2.43.0",
4
+ "version": "2.43.1-beta.1",
5
5
  "description": "Launch a mobile native implementation of the Persona inquiry flow from React Native.",
6
6
  "homepage": "https://docs.withpersona.com/docs/react-native-sdk-integration",
7
7
  "bugs": "https://github.com/persona-id/persona-inquiry-sdk-public",
@@ -69,6 +69,10 @@
69
69
  "typescript": "^4.3.5"
70
70
  },
71
71
  "dependencies": {},
72
+ "resolutions": {
73
+ "fast-xml-parser": "^4.5.4",
74
+ "flatted": "^3.4.2"
75
+ },
72
76
  "eslintConfig": {
73
77
  "root": true,
74
78
  "extends": [
@@ -100,18 +100,12 @@ export default function PersonaInquiryView(props: {
100
100
  }, props.onError);
101
101
  return;
102
102
  }
103
- // Defer the dispatch to the next frame. Dispatching during React's
104
- // commit phase can leave the command stranded on RN's UIManager queue
105
- // for ~30s if no other JS work follows. requestAnimationFrame ties into
106
- // the native frame loop and lands the command in a batch that flushes
107
- // on the next tick.
108
- requestAnimationFrame(() => {
109
- UIManager.dispatchViewManagerCommand(
110
- viewId,
111
- viewManagerConfig.Commands.create,
112
- [viewId]
113
- );
114
- });
103
+
104
+ UIManager.dispatchViewManagerCommand(
105
+ viewId,
106
+ viewManagerConfig.Commands.create,
107
+ [viewId]
108
+ );
115
109
  } catch (error) {
116
110
  callOnErrorCallback({
117
111
  debugMessage: 'Error dispatching create command.',
@@ -121,15 +115,21 @@ export default function PersonaInquiryView(props: {
121
115
  };
122
116
 
123
117
  useEffect(() => {
124
- const viewId = findNodeHandle(ref.current);
125
-
126
118
  const listener: Listener = {
127
119
  onReadyCalled: onReadyCalledRef,
128
120
  onReadyCallback: onReadyCallbackRef,
129
121
  };
130
122
  activeListeners.add(listener);
131
123
 
132
- create(viewId);
124
+ // Defer the dispatch to the next frame. Dispatching during React's
125
+ // commit phase can leave the command stranded on RN's UIManager queue
126
+ // for ~30s if no other JS work follows. requestAnimationFrame ties into
127
+ // the native frame loop and lands the command in a batch that flushes
128
+ // on the next tick.
129
+ requestAnimationFrame(() => {
130
+ const viewId = findNodeHandle(ref.current);
131
+ create(viewId);
132
+ })
133
133
 
134
134
  return () => {
135
135
  activeListeners.delete(listener);