@nascentdigital/funnel-apps 4.4.18
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/react/app/domain/AppService.d.ts +19 -0
- package/dist/react/app/domain/AppService.js +19 -0
- package/dist/react/app/domain/AppServiceClient.d.ts +7 -0
- package/dist/react/app/domain/AppServiceClient.js +57 -0
- package/dist/react/app/domain/AppState.d.ts +1 -0
- package/dist/react/app/domain/AppState.js +2 -0
- package/dist/react/app/domain/index.d.ts +3 -0
- package/dist/react/app/domain/index.js +19 -0
- package/dist/react/app/server/AbstractAppService.d.ts +17 -0
- package/dist/react/app/server/AbstractAppService.js +24 -0
- package/dist/react/app/server/AppServices.d.ts +11 -0
- package/dist/react/app/server/AppServices.js +92 -0
- package/dist/react/app/server/index.d.ts +4 -0
- package/dist/react/app/server/index.js +20 -0
- package/dist/react/app/web/App.d.ts +38 -0
- package/dist/react/app/web/App.js +116 -0
- package/dist/react/app/web/AppContainer.d.ts +16 -0
- package/dist/react/app/web/AppContainer.js +109 -0
- package/dist/react/app/web/AppContext.d.ts +7 -0
- package/dist/react/app/web/AppContext.js +6 -0
- package/dist/react/app/web/AppLayout.d.ts +7 -0
- package/dist/react/app/web/AppLayout.js +34 -0
- package/dist/react/app/web/AppPage.d.ts +13 -0
- package/dist/react/app/web/AppPage.js +30 -0
- package/dist/react/app/web/AppRoot.d.ts +7 -0
- package/dist/react/app/web/AppRoot.js +43 -0
- package/dist/react/app/web/index.d.ts +5 -0
- package/dist/react/app/web/index.js +21 -0
- package/dist/react/app/web/useApp.d.ts +2 -0
- package/dist/react/app/web/useApp.js +33 -0
- package/dist/react/auth0/server/Auth0IdentityService.d.ts +25 -0
- package/dist/react/auth0/server/Auth0IdentityService.js +84 -0
- package/dist/react/auth0/server/Auth0Profile.d.ts +19 -0
- package/dist/react/auth0/server/Auth0Profile.js +108 -0
- package/dist/react/auth0/server/Auth0ProfileFactory.d.ts +15 -0
- package/dist/react/auth0/server/Auth0ProfileFactory.js +51 -0
- package/dist/react/auth0/server/Auth0ProfileManagementService.d.ts +17 -0
- package/dist/react/auth0/server/Auth0ProfileManagementService.js +127 -0
- package/dist/react/auth0/server/Auth0ProfileServices.d.ts +13 -0
- package/dist/react/auth0/server/Auth0ProfileServices.js +19 -0
- package/dist/react/auth0/server/Auth0ProfileStore.d.ts +17 -0
- package/dist/react/auth0/server/Auth0ProfileStore.js +83 -0
- package/dist/react/auth0/server/Auth0ProfileUserService.d.ts +16 -0
- package/dist/react/auth0/server/Auth0ProfileUserService.js +48 -0
- package/dist/react/auth0/server/index.d.ts +4 -0
- package/dist/react/auth0/server/index.js +20 -0
- package/dist/react/auth0/web/Auth0IdentityClient.d.ts +34 -0
- package/dist/react/auth0/web/Auth0IdentityClient.js +200 -0
- package/dist/react/auth0/web/Auth0IdentityClientProvider.d.ts +35 -0
- package/dist/react/auth0/web/Auth0IdentityClientProvider.js +67 -0
- package/dist/react/auth0/web/index.d.ts +1 -0
- package/dist/react/auth0/web/index.js +17 -0
- package/dist/react/bridge/core/BridgeConnection.d.ts +6 -0
- package/dist/react/bridge/core/BridgeConnection.js +2 -0
- package/dist/react/bridge/core/BridgeConstants.d.ts +7 -0
- package/dist/react/bridge/core/BridgeConstants.js +15 -0
- package/dist/react/bridge/core/BridgeEvent.d.ts +52 -0
- package/dist/react/bridge/core/BridgeEvent.js +28 -0
- package/dist/react/bridge/core/BridgeMethod.d.ts +12 -0
- package/dist/react/bridge/core/BridgeMethod.js +2 -0
- package/dist/react/bridge/core/BridgeMethodCall.d.ts +23 -0
- package/dist/react/bridge/core/BridgeMethodCall.js +37 -0
- package/dist/react/bridge/core/BridgeMethods.d.ts +35 -0
- package/dist/react/bridge/core/BridgeMethods.js +2 -0
- package/dist/react/bridge/core/BridgeState.d.ts +24 -0
- package/dist/react/bridge/core/BridgeState.js +2 -0
- package/dist/react/bridge/core/index.d.ts +7 -0
- package/dist/react/bridge/core/index.js +23 -0
- package/dist/react/bridge/web/Bridge.d.ts +32 -0
- package/dist/react/bridge/web/Bridge.js +183 -0
- package/dist/react/bridge/web/BridgeContext.d.ts +8 -0
- package/dist/react/bridge/web/BridgeContext.js +6 -0
- package/dist/react/bridge/web/BridgeGlobals.d.ts +12 -0
- package/dist/react/bridge/web/BridgeGlobals.js +2 -0
- package/dist/react/bridge/web/BridgeProvider.d.ts +7 -0
- package/dist/react/bridge/web/BridgeProvider.js +36 -0
- package/dist/react/bridge/web/index.d.ts +6 -0
- package/dist/react/bridge/web/index.js +22 -0
- package/dist/react/bridge/web/useBridge.d.ts +3 -0
- package/dist/react/bridge/web/useBridge.js +39 -0
- package/dist/react/bridge/web/useBridgeState.d.ts +2 -0
- package/dist/react/bridge/web/useBridgeState.js +43 -0
- package/dist/react/bridge/web/useSafeArea.d.ts +1 -0
- package/dist/react/bridge/web/useSafeArea.js +11 -0
- package/dist/react/content/core/AppContentClient.d.ts +14 -0
- package/dist/react/content/core/AppContentClient.js +51 -0
- package/dist/react/content/core/ContentClientContext.d.ts +7 -0
- package/dist/react/content/core/ContentClientContext.js +6 -0
- package/dist/react/content/core/index.d.ts +1 -0
- package/dist/react/content/core/index.js +17 -0
- package/dist/react/content/domain/ContentAppRequest.d.ts +20 -0
- package/dist/react/content/domain/ContentAppRequest.js +11 -0
- package/dist/react/content/domain/index.d.ts +1 -0
- package/dist/react/content/domain/index.js +17 -0
- package/dist/react/content/server/ContentAppService.d.ts +11 -0
- package/dist/react/content/server/ContentAppService.js +34 -0
- package/dist/react/content/server/index.d.ts +1 -0
- package/dist/react/content/server/index.js +17 -0
- package/dist/react/content/web/ContentProvider.d.ts +5 -0
- package/dist/react/content/web/ContentProvider.js +17 -0
- package/dist/react/content/web/index.d.ts +6 -0
- package/dist/react/content/web/index.js +22 -0
- package/dist/react/content/web/useCollection.d.ts +10 -0
- package/dist/react/content/web/useCollection.js +22 -0
- package/dist/react/content/web/useCollections.d.ts +10 -0
- package/dist/react/content/web/useCollections.js +32 -0
- package/dist/react/content/web/useContentClient.d.ts +1 -0
- package/dist/react/content/web/useContentClient.js +9 -0
- package/dist/react/cookies/web/CookieService.d.ts +25 -0
- package/dist/react/cookies/web/CookieService.js +45 -0
- package/dist/react/cookies/web/CookieServiceContext.d.ts +7 -0
- package/dist/react/cookies/web/CookieServiceContext.js +6 -0
- package/dist/react/cookies/web/CookieServiceProvider.d.ts +6 -0
- package/dist/react/cookies/web/CookieServiceProvider.js +16 -0
- package/dist/react/cookies/web/index.d.ts +3 -0
- package/dist/react/cookies/web/index.js +19 -0
- package/dist/react/cookies/web/useCookieService.d.ts +2 -0
- package/dist/react/cookies/web/useCookieService.js +29 -0
- package/dist/react/identity/core/AbstractIdentityClient.d.ts +22 -0
- package/dist/react/identity/core/AbstractIdentityClient.js +31 -0
- package/dist/react/identity/core/IdentityClient.d.ts +22 -0
- package/dist/react/identity/core/IdentityClient.js +13 -0
- package/dist/react/identity/core/IdentityClientContext.d.ts +7 -0
- package/dist/react/identity/core/IdentityClientContext.js +6 -0
- package/dist/react/identity/core/index.d.ts +6 -0
- package/dist/react/identity/core/index.js +22 -0
- package/dist/react/identity/core/useIdentity.d.ts +10 -0
- package/dist/react/identity/core/useIdentity.js +39 -0
- package/dist/react/identity/core/useIdentityClient.d.ts +2 -0
- package/dist/react/identity/core/useIdentityClient.js +17 -0
- package/dist/react/identity/domain/AnonymousIdentity.d.ts +15 -0
- package/dist/react/identity/domain/AnonymousIdentity.js +27 -0
- package/dist/react/identity/domain/AuthenticatedIdentity.d.ts +25 -0
- package/dist/react/identity/domain/AuthenticatedIdentity.js +32 -0
- package/dist/react/identity/domain/Identity.d.ts +6 -0
- package/dist/react/identity/domain/Identity.js +2 -0
- package/dist/react/identity/domain/IdentityAppRequest.d.ts +8 -0
- package/dist/react/identity/domain/IdentityAppRequest.js +10 -0
- package/dist/react/identity/domain/index.d.ts +4 -0
- package/dist/react/identity/domain/index.js +20 -0
- package/dist/react/identity/server/IdentityAppService.d.ts +9 -0
- package/dist/react/identity/server/IdentityAppService.js +32 -0
- package/dist/react/identity/server/IdentityService.d.ts +17 -0
- package/dist/react/identity/server/IdentityService.js +25 -0
- package/dist/react/identity/server/index.d.ts +4 -0
- package/dist/react/identity/server/index.js +20 -0
- package/dist/react/identity/web/WebIdentityClientProvider.d.ts +8 -0
- package/dist/react/identity/web/WebIdentityClientProvider.js +27 -0
- package/dist/react/identity/web/WebIdentityProvider.d.ts +5 -0
- package/dist/react/identity/web/WebIdentityProvider.js +21 -0
- package/dist/react/identity/web/bridge/AppBridgeIdentityClient.d.ts +14 -0
- package/dist/react/identity/web/bridge/AppBridgeIdentityClient.js +47 -0
- package/dist/react/identity/web/bridge/AppBridgeIdentityClientProvider.d.ts +2 -0
- package/dist/react/identity/web/bridge/AppBridgeIdentityClientProvider.js +28 -0
- package/dist/react/identity/web/bridge/index.d.ts +1 -0
- package/dist/react/identity/web/bridge/index.js +17 -0
- package/dist/react/identity/web/index.d.ts +3 -0
- package/dist/react/identity/web/index.js +19 -0
- package/dist/react/nav/core/SpecSourceContext.d.ts +7 -0
- package/dist/react/nav/core/SpecSourceContext.js +6 -0
- package/dist/react/nav/core/index.d.ts +2 -0
- package/dist/react/nav/core/index.js +18 -0
- package/dist/react/nav/core/useSpec.d.ts +3 -0
- package/dist/react/nav/core/useSpec.js +30 -0
- package/dist/react/nav/domain/Icon.d.ts +2 -0
- package/dist/react/nav/domain/Icon.js +2 -0
- package/dist/react/nav/domain/Modal.d.ts +25 -0
- package/dist/react/nav/domain/Modal.js +28 -0
- package/dist/react/nav/domain/Navigation.d.ts +13 -0
- package/dist/react/nav/domain/Navigation.js +2 -0
- package/dist/react/nav/domain/NavigationCommand.d.ts +14 -0
- package/dist/react/nav/domain/NavigationCommand.js +2 -0
- package/dist/react/nav/domain/Route.d.ts +12 -0
- package/dist/react/nav/domain/Route.js +2 -0
- package/dist/react/nav/domain/Routes.d.ts +6 -0
- package/dist/react/nav/domain/Routes.js +74 -0
- package/dist/react/nav/domain/Screen.d.ts +24 -0
- package/dist/react/nav/domain/Screen.js +28 -0
- package/dist/react/nav/domain/Skeleton.d.ts +26 -0
- package/dist/react/nav/domain/Skeleton.js +2 -0
- package/dist/react/nav/domain/Spec.d.ts +33 -0
- package/dist/react/nav/domain/Spec.js +124 -0
- package/dist/react/nav/domain/SpecSource.d.ts +21 -0
- package/dist/react/nav/domain/SpecSource.js +28 -0
- package/dist/react/nav/domain/Stack.d.ts +35 -0
- package/dist/react/nav/domain/Stack.js +44 -0
- package/dist/react/nav/domain/Tabs.d.ts +37 -0
- package/dist/react/nav/domain/Tabs.js +45 -0
- package/dist/react/nav/domain/icons/ImageIcon.d.ts +2 -0
- package/dist/react/nav/domain/icons/ImageIcon.js +7 -0
- package/dist/react/nav/domain/icons/LucideIcon.d.ts +2 -0
- package/dist/react/nav/domain/icons/LucideIcon.js +7 -0
- package/dist/react/nav/domain/icons/index.d.ts +2 -0
- package/dist/react/nav/domain/icons/index.js +18 -0
- package/dist/react/nav/domain/index.d.ts +14 -0
- package/dist/react/nav/domain/index.js +30 -0
- package/dist/react/nav/domain/sources/AbstractSpecSource.d.ts +23 -0
- package/dist/react/nav/domain/sources/AbstractSpecSource.js +64 -0
- package/dist/react/nav/domain/sources/StaticSpecSource.d.ts +9 -0
- package/dist/react/nav/domain/sources/StaticSpecSource.js +16 -0
- package/dist/react/nav/domain/sources/index.d.ts +2 -0
- package/dist/react/nav/domain/sources/index.js +18 -0
- package/dist/react/nav/server/SpecService.d.ts +9 -0
- package/dist/react/nav/server/SpecService.js +31 -0
- package/dist/react/nav/server/exports.d.ts +1 -0
- package/dist/react/nav/server/exports.js +17 -0
- package/dist/react/nav/server/index.d.ts +2 -0
- package/dist/react/nav/server/index.js +38 -0
- package/dist/react/nav/web/WebSpecProvider.d.ts +2 -0
- package/dist/react/nav/web/WebSpecProvider.js +41 -0
- package/dist/react/nav/web/index.d.ts +3 -0
- package/dist/react/nav/web/index.js +19 -0
- package/dist/react/nav/web/navigator/NativeNavigator.d.ts +13 -0
- package/dist/react/nav/web/navigator/NativeNavigator.js +47 -0
- package/dist/react/nav/web/navigator/Navigator.d.ts +7 -0
- package/dist/react/nav/web/navigator/Navigator.js +2 -0
- package/dist/react/nav/web/navigator/NavigatorContext.d.ts +7 -0
- package/dist/react/nav/web/navigator/NavigatorContext.js +6 -0
- package/dist/react/nav/web/navigator/WebNavigator.d.ts +13 -0
- package/dist/react/nav/web/navigator/WebNavigator.js +38 -0
- package/dist/react/nav/web/navigator/index.d.ts +5 -0
- package/dist/react/nav/web/navigator/index.js +21 -0
- package/dist/react/nav/web/navigator/useNavigator.d.ts +1 -0
- package/dist/react/nav/web/navigator/useNavigator.js +17 -0
- package/dist/react/nav.d.ts +1 -0
- package/dist/react/nav.js +37 -0
- package/dist/react/profile/core/AbstractProfileClient.d.ts +18 -0
- package/dist/react/profile/core/AbstractProfileClient.js +31 -0
- package/dist/react/profile/core/ProfileClient.d.ts +21 -0
- package/dist/react/profile/core/ProfileClient.js +2 -0
- package/dist/react/profile/core/ProfileClientContext.d.ts +7 -0
- package/dist/react/profile/core/ProfileClientContext.js +6 -0
- package/dist/react/profile/core/index.d.ts +6 -0
- package/dist/react/profile/core/index.js +22 -0
- package/dist/react/profile/core/useProfile.d.ts +9 -0
- package/dist/react/profile/core/useProfile.js +47 -0
- package/dist/react/profile/core/useProfileClient.d.ts +2 -0
- package/dist/react/profile/core/useProfileClient.js +17 -0
- package/dist/react/profile/core/useProfileStore.d.ts +2 -0
- package/dist/react/profile/core/useProfileStore.js +28 -0
- package/dist/react/profile/domain/Profile.d.ts +80 -0
- package/dist/react/profile/domain/Profile.js +209 -0
- package/dist/react/profile/domain/ProfileAppRequest.d.ts +15 -0
- package/dist/react/profile/domain/ProfileAppRequest.js +12 -0
- package/dist/react/profile/domain/ProfileStore.d.ts +65 -0
- package/dist/react/profile/domain/ProfileStore.js +180 -0
- package/dist/react/profile/domain/index.d.ts +3 -0
- package/dist/react/profile/domain/index.js +19 -0
- package/dist/react/profile/server/ProfileAppService.d.ts +11 -0
- package/dist/react/profile/server/ProfileAppService.js +49 -0
- package/dist/react/profile/server/ProfileManagementService.d.ts +28 -0
- package/dist/react/profile/server/ProfileManagementService.js +3 -0
- package/dist/react/profile/server/ProfileServices.d.ts +22 -0
- package/dist/react/profile/server/ProfileServices.js +24 -0
- package/dist/react/profile/server/ProfileUserService.d.ts +5 -0
- package/dist/react/profile/server/ProfileUserService.js +2 -0
- package/dist/react/profile/server/index.d.ts +5 -0
- package/dist/react/profile/server/index.js +21 -0
- package/dist/react/profile/web/WebProfile.d.ts +11 -0
- package/dist/react/profile/web/WebProfile.js +37 -0
- package/dist/react/profile/web/WebProfileClient.d.ts +9 -0
- package/dist/react/profile/web/WebProfileClient.js +76 -0
- package/dist/react/profile/web/WebProfileProvider.d.ts +5 -0
- package/dist/react/profile/web/WebProfileProvider.js +62 -0
- package/dist/react/profile/web/WebProfileStore.d.ts +8 -0
- package/dist/react/profile/web/WebProfileStore.js +32 -0
- package/dist/react/profile/web/index.d.ts +3 -0
- package/dist/react/profile/web/index.js +19 -0
- package/dist/react/push/domain/PushAppRequest.d.ts +13 -0
- package/dist/react/push/domain/PushAppRequest.js +12 -0
- package/dist/react/push/domain/PushStore.d.ts +7 -0
- package/dist/react/push/domain/PushStore.js +9 -0
- package/dist/react/push/domain/index.d.ts +2 -0
- package/dist/react/push/domain/index.js +18 -0
- package/dist/react/push/server/PushService.d.ts +22 -0
- package/dist/react/push/server/PushService.js +57 -0
- package/dist/react/push/server/index.d.ts +3 -0
- package/dist/react/push/server/index.js +19 -0
- package/dist/react/push/server/keygen.d.ts +1 -0
- package/dist/react/push/server/keygen.js +8 -0
- package/dist/react/push/web/PushClient.d.ts +35 -0
- package/dist/react/push/web/PushClient.js +204 -0
- package/dist/react/push/web/PushContext.d.ts +7 -0
- package/dist/react/push/web/PushContext.js +6 -0
- package/dist/react/push/web/PushProvider.d.ts +6 -0
- package/dist/react/push/web/PushProvider.js +42 -0
- package/dist/react/push/web/index.d.ts +4 -0
- package/dist/react/push/web/index.js +20 -0
- package/dist/react/push/web/usePushClient.d.ts +3 -0
- package/dist/react/push/web/usePushClient.js +40 -0
- package/dist/react/server.d.ts +7 -0
- package/dist/react/server.js +23 -0
- package/dist/react/ui/web/HideSplash.d.ts +1 -0
- package/dist/react/ui/web/HideSplash.js +28 -0
- package/dist/react/ui/web/Link.d.ts +6 -0
- package/dist/react/ui/web/Link.js +12 -0
- package/dist/react/ui/web/SafeArea.d.ts +9 -0
- package/dist/react/ui/web/SafeArea.js +26 -0
- package/dist/react/ui/web/index.d.ts +3 -0
- package/dist/react/ui/web/index.js +19 -0
- package/dist/react/web.d.ts +10 -0
- package/dist/react/web.js +26 -0
- package/dist/reactnative/app/domain/AppService.d.ts +19 -0
- package/dist/reactnative/app/domain/AppService.js +19 -0
- package/dist/reactnative/app/domain/AppServiceClient.d.ts +7 -0
- package/dist/reactnative/app/domain/AppServiceClient.js +57 -0
- package/dist/reactnative/app/domain/AppState.d.ts +1 -0
- package/dist/reactnative/app/domain/AppState.js +2 -0
- package/dist/reactnative/app/domain/index.d.ts +3 -0
- package/dist/reactnative/app/domain/index.js +19 -0
- package/dist/reactnative/app/rn/AppContainer.d.ts +10 -0
- package/dist/reactnative/app/rn/AppContainer.js +77 -0
- package/dist/reactnative/app/rn/AppRoot.d.ts +5 -0
- package/dist/reactnative/app/rn/AppRoot.js +22 -0
- package/dist/reactnative/app/rn/AppServiceClient.d.ts +4 -0
- package/dist/reactnative/app/rn/AppServiceClient.js +44 -0
- package/dist/reactnative/app/rn/index.d.ts +5 -0
- package/dist/reactnative/app/rn/index.js +22 -0
- package/dist/reactnative/auth0/rn/Auth0IdentityClient.d.ts +33 -0
- package/dist/reactnative/auth0/rn/Auth0IdentityClient.js +234 -0
- package/dist/reactnative/auth0/rn/Auth0IdentityClientProvider.d.ts +27 -0
- package/dist/reactnative/auth0/rn/Auth0IdentityClientProvider.js +60 -0
- package/dist/reactnative/auth0/rn/index.d.ts +2 -0
- package/dist/reactnative/auth0/rn/index.js +18 -0
- package/dist/reactnative/bridge/core/BridgeConnection.d.ts +6 -0
- package/dist/reactnative/bridge/core/BridgeConnection.js +2 -0
- package/dist/reactnative/bridge/core/BridgeConstants.d.ts +7 -0
- package/dist/reactnative/bridge/core/BridgeConstants.js +15 -0
- package/dist/reactnative/bridge/core/BridgeEvent.d.ts +52 -0
- package/dist/reactnative/bridge/core/BridgeEvent.js +28 -0
- package/dist/reactnative/bridge/core/BridgeMethod.d.ts +12 -0
- package/dist/reactnative/bridge/core/BridgeMethod.js +2 -0
- package/dist/reactnative/bridge/core/BridgeMethodCall.d.ts +23 -0
- package/dist/reactnative/bridge/core/BridgeMethodCall.js +37 -0
- package/dist/reactnative/bridge/core/BridgeMethods.d.ts +35 -0
- package/dist/reactnative/bridge/core/BridgeMethods.js +2 -0
- package/dist/reactnative/bridge/core/BridgeState.d.ts +24 -0
- package/dist/reactnative/bridge/core/BridgeState.js +2 -0
- package/dist/reactnative/bridge/core/index.d.ts +7 -0
- package/dist/reactnative/bridge/core/index.js +23 -0
- package/dist/reactnative/bridge/rn/BridgeProxy.d.ts +35 -0
- package/dist/reactnative/bridge/rn/BridgeProxy.js +331 -0
- package/dist/reactnative/bridge/rn/BridgeProxyContext.d.ts +8 -0
- package/dist/reactnative/bridge/rn/BridgeProxyContext.js +6 -0
- package/dist/reactnative/bridge/rn/BridgeProxyProvider.d.ts +8 -0
- package/dist/reactnative/bridge/rn/BridgeProxyProvider.js +39 -0
- package/dist/reactnative/bridge/rn/BridgeWebview.d.ts +7 -0
- package/dist/reactnative/bridge/rn/BridgeWebview.js +51 -0
- package/dist/reactnative/bridge/rn/index.d.ts +7 -0
- package/dist/reactnative/bridge/rn/index.js +23 -0
- package/dist/reactnative/bridge/rn/useBridgeProxy.d.ts +3 -0
- package/dist/reactnative/bridge/rn/useBridgeProxy.js +38 -0
- package/dist/reactnative/bridge/rn/useBridgeProxyCalls.d.ts +3 -0
- package/dist/reactnative/bridge/rn/useBridgeProxyCalls.js +32 -0
- package/dist/reactnative/bridge/rn/useBridgeProxyState.d.ts +2 -0
- package/dist/reactnative/bridge/rn/useBridgeProxyState.js +46 -0
- package/dist/reactnative/identity/core/AbstractIdentityClient.d.ts +22 -0
- package/dist/reactnative/identity/core/AbstractIdentityClient.js +31 -0
- package/dist/reactnative/identity/core/IdentityClient.d.ts +22 -0
- package/dist/reactnative/identity/core/IdentityClient.js +13 -0
- package/dist/reactnative/identity/core/IdentityClientContext.d.ts +7 -0
- package/dist/reactnative/identity/core/IdentityClientContext.js +6 -0
- package/dist/reactnative/identity/core/index.d.ts +6 -0
- package/dist/reactnative/identity/core/index.js +22 -0
- package/dist/reactnative/identity/core/useIdentity.d.ts +10 -0
- package/dist/reactnative/identity/core/useIdentity.js +39 -0
- package/dist/reactnative/identity/core/useIdentityClient.d.ts +2 -0
- package/dist/reactnative/identity/core/useIdentityClient.js +17 -0
- package/dist/reactnative/identity/domain/AnonymousIdentity.d.ts +15 -0
- package/dist/reactnative/identity/domain/AnonymousIdentity.js +27 -0
- package/dist/reactnative/identity/domain/AuthenticatedIdentity.d.ts +25 -0
- package/dist/reactnative/identity/domain/AuthenticatedIdentity.js +32 -0
- package/dist/reactnative/identity/domain/Identity.d.ts +6 -0
- package/dist/reactnative/identity/domain/Identity.js +2 -0
- package/dist/reactnative/identity/domain/IdentityAppRequest.d.ts +8 -0
- package/dist/reactnative/identity/domain/IdentityAppRequest.js +10 -0
- package/dist/reactnative/identity/domain/index.d.ts +4 -0
- package/dist/reactnative/identity/domain/index.js +20 -0
- package/dist/reactnative/identity/rn/RNIdentityClientProvider.d.ts +8 -0
- package/dist/reactnative/identity/rn/RNIdentityClientProvider.js +22 -0
- package/dist/reactnative/identity/rn/RNIdentityProvider.d.ts +5 -0
- package/dist/reactnative/identity/rn/RNIdentityProvider.js +14 -0
- package/dist/reactnative/identity/rn/index.d.ts +3 -0
- package/dist/reactnative/identity/rn/index.js +19 -0
- package/dist/reactnative/nav/core/SpecSourceContext.d.ts +7 -0
- package/dist/reactnative/nav/core/SpecSourceContext.js +6 -0
- package/dist/reactnative/nav/core/index.d.ts +2 -0
- package/dist/reactnative/nav/core/index.js +18 -0
- package/dist/reactnative/nav/core/useSpec.d.ts +3 -0
- package/dist/reactnative/nav/core/useSpec.js +30 -0
- package/dist/reactnative/nav/domain/Icon.d.ts +2 -0
- package/dist/reactnative/nav/domain/Icon.js +2 -0
- package/dist/reactnative/nav/domain/Modal.d.ts +25 -0
- package/dist/reactnative/nav/domain/Modal.js +28 -0
- package/dist/reactnative/nav/domain/Navigation.d.ts +13 -0
- package/dist/reactnative/nav/domain/Navigation.js +2 -0
- package/dist/reactnative/nav/domain/NavigationCommand.d.ts +14 -0
- package/dist/reactnative/nav/domain/NavigationCommand.js +2 -0
- package/dist/reactnative/nav/domain/Route.d.ts +12 -0
- package/dist/reactnative/nav/domain/Route.js +2 -0
- package/dist/reactnative/nav/domain/Routes.d.ts +6 -0
- package/dist/reactnative/nav/domain/Routes.js +74 -0
- package/dist/reactnative/nav/domain/Screen.d.ts +24 -0
- package/dist/reactnative/nav/domain/Screen.js +28 -0
- package/dist/reactnative/nav/domain/Skeleton.d.ts +26 -0
- package/dist/reactnative/nav/domain/Skeleton.js +2 -0
- package/dist/reactnative/nav/domain/Spec.d.ts +33 -0
- package/dist/reactnative/nav/domain/Spec.js +124 -0
- package/dist/reactnative/nav/domain/SpecSource.d.ts +21 -0
- package/dist/reactnative/nav/domain/SpecSource.js +28 -0
- package/dist/reactnative/nav/domain/Stack.d.ts +35 -0
- package/dist/reactnative/nav/domain/Stack.js +44 -0
- package/dist/reactnative/nav/domain/Tabs.d.ts +37 -0
- package/dist/reactnative/nav/domain/Tabs.js +45 -0
- package/dist/reactnative/nav/domain/icons/ImageIcon.d.ts +2 -0
- package/dist/reactnative/nav/domain/icons/ImageIcon.js +7 -0
- package/dist/reactnative/nav/domain/icons/LucideIcon.d.ts +2 -0
- package/dist/reactnative/nav/domain/icons/LucideIcon.js +7 -0
- package/dist/reactnative/nav/domain/icons/index.d.ts +2 -0
- package/dist/reactnative/nav/domain/icons/index.js +18 -0
- package/dist/reactnative/nav/domain/index.d.ts +14 -0
- package/dist/reactnative/nav/domain/index.js +30 -0
- package/dist/reactnative/nav/domain/sources/AbstractSpecSource.d.ts +23 -0
- package/dist/reactnative/nav/domain/sources/AbstractSpecSource.js +64 -0
- package/dist/reactnative/nav/domain/sources/StaticSpecSource.d.ts +9 -0
- package/dist/reactnative/nav/domain/sources/StaticSpecSource.js +16 -0
- package/dist/reactnative/nav/domain/sources/index.d.ts +2 -0
- package/dist/reactnative/nav/domain/sources/index.js +18 -0
- package/dist/reactnative/nav/rn/NavigationEngine.d.ts +1 -0
- package/dist/reactnative/nav/rn/NavigationEngine.js +155 -0
- package/dist/reactnative/nav/rn/NavigationScreen.d.ts +9 -0
- package/dist/reactnative/nav/rn/NavigationScreen.js +215 -0
- package/dist/reactnative/nav/rn/RNSpecProvider.d.ts +2 -0
- package/dist/reactnative/nav/rn/RNSpecProvider.js +30 -0
- package/dist/reactnative/nav/rn/RNSpecSource.d.ts +5 -0
- package/dist/reactnative/nav/rn/RNSpecSource.js +30 -0
- package/dist/reactnative/nav/rn/index.d.ts +4 -0
- package/dist/reactnative/nav/rn/index.js +20 -0
- package/dist/reactnative/profile/domain/Profile.d.ts +80 -0
- package/dist/reactnative/profile/domain/Profile.js +209 -0
- package/dist/reactnative/profile/domain/ProfileAppRequest.d.ts +15 -0
- package/dist/reactnative/profile/domain/ProfileAppRequest.js +12 -0
- package/dist/reactnative/profile/domain/ProfileStore.d.ts +65 -0
- package/dist/reactnative/profile/domain/ProfileStore.js +180 -0
- package/dist/reactnative/profile/domain/index.d.ts +3 -0
- package/dist/reactnative/profile/domain/index.js +19 -0
- package/dist/reactnative/push/domain/PushAppRequest.d.ts +13 -0
- package/dist/reactnative/push/domain/PushAppRequest.js +12 -0
- package/dist/reactnative/push/domain/PushStore.d.ts +7 -0
- package/dist/reactnative/push/domain/PushStore.js +9 -0
- package/dist/reactnative/push/domain/index.d.ts +2 -0
- package/dist/reactnative/push/domain/index.js +18 -0
- package/dist/reactnative/push/rn/PushClient.d.ts +32 -0
- package/dist/reactnative/push/rn/PushClient.js +247 -0
- package/dist/reactnative/push/rn/PushContext.d.ts +7 -0
- package/dist/reactnative/push/rn/PushContext.js +6 -0
- package/dist/reactnative/push/rn/PushProvider.d.ts +2 -0
- package/dist/reactnative/push/rn/PushProvider.js +45 -0
- package/dist/reactnative/push/rn/index.d.ts +3 -0
- package/dist/reactnative/push/rn/index.js +19 -0
- package/dist/reactnative/push/rn/usePushClient.d.ts +3 -0
- package/dist/reactnative/push/rn/usePushClient.js +40 -0
- package/dist/reactnative/rn.d.ts +7 -0
- package/dist/reactnative/rn.js +23 -0
- package/dist/reactnative/ui/rn/Tailwind.d.ts +175 -0
- package/dist/reactnative/ui/rn/Tailwind.js +211 -0
- package/dist/reactnative/ui/rn/atomic/Button.d.ts +97 -0
- package/dist/reactnative/ui/rn/atomic/Button.js +75 -0
- package/dist/reactnative/ui/rn/atomic/TextField.d.ts +112 -0
- package/dist/reactnative/ui/rn/atomic/TextField.js +135 -0
- package/dist/reactnative/ui/rn/atomic/index.d.ts +2 -0
- package/dist/reactnative/ui/rn/atomic/index.js +18 -0
- package/dist/reactnative/ui/rn/index.d.ts +1 -0
- package/dist/reactnative/ui/rn/index.js +17 -0
- package/dist/styles/rn/_index.css +2 -0
- package/dist/styles/rn/atomic/Button.css +54 -0
- package/dist/styles/rn/atomic/TextField.css +77 -0
- package/dist/styles/rn/atomic/_index.css +2 -0
- package/dist/styles/rn/base/_index.css +1 -0
- package/dist/styles/rn/base/tailwind.css +3 -0
- package/dist/styles/rn.css +1 -0
- package/dist/styles/web/_index.css +1 -0
- package/dist/styles/web/layout/SafeArea.css +17 -0
- package/dist/styles/web/layout/_index.css +1 -0
- package/dist/styles/web.css +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { WebView } from 'react-native-webview';
|
|
2
|
+
import { BridgeEvent, BridgeMethodCall, BridgeMethods, BridgeState } from '../core';
|
|
3
|
+
export declare class BridgeProxy<TState extends BridgeState.Custom = BridgeState.Custom, TNativeMethods extends BridgeMethods.Native = BridgeMethods.Native> {
|
|
4
|
+
private readonly _webViews$;
|
|
5
|
+
private readonly _webViews;
|
|
6
|
+
private readonly _stateChange$;
|
|
7
|
+
private _state;
|
|
8
|
+
private readonly _nativeCalls$;
|
|
9
|
+
constructor(args: BridgeProxy.ConstructorArgs<TState>);
|
|
10
|
+
get webViews$(): import("rxjs").Observable<readonly BridgeProxy.WebViewContext[]>;
|
|
11
|
+
get webViews(): ReadonlyArray<BridgeProxy.WebViewContext>;
|
|
12
|
+
private set webViews(value);
|
|
13
|
+
get stateChange$(): import("rxjs").Observable<BridgeState.Change<TState, BridgeState.Key<TState>>>;
|
|
14
|
+
get state(): BridgeState<TState>;
|
|
15
|
+
get nativeCalls$(): import("rxjs").Observable<readonly BridgeMethodCall<import("../core").BridgeMethod>[]>;
|
|
16
|
+
get nativeCalls(): readonly BridgeMethodCall<import("../core").BridgeMethod>[];
|
|
17
|
+
getWebViewPreLoadScript(id: string, customScript?: string): string;
|
|
18
|
+
getWebViewPostLoadScript(customScript?: string): string;
|
|
19
|
+
connect(id: string, webView: WebView): void;
|
|
20
|
+
disconnect(webView: WebView): void;
|
|
21
|
+
setState<TKey extends BridgeState.Key<TState>>(key: TKey, value: BridgeState.Value<TState, TKey>): boolean;
|
|
22
|
+
updateState<TKey extends BridgeState.Key<TState>>(key: TKey, value: BridgeState.Value<TState, TKey>): boolean;
|
|
23
|
+
propagate(event: BridgeEvent, webViewId?: string): void;
|
|
24
|
+
onEvent(event: BridgeEvent): void;
|
|
25
|
+
}
|
|
26
|
+
export declare namespace BridgeProxy {
|
|
27
|
+
type WebViewContext = {
|
|
28
|
+
webView: WebView;
|
|
29
|
+
id: string;
|
|
30
|
+
connected: boolean;
|
|
31
|
+
};
|
|
32
|
+
type ConstructorArgs<TState extends BridgeState.Custom = BridgeState.Custom> = {
|
|
33
|
+
initialState: TState & Partial<BridgeState.Core>;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BridgeProxy = void 0;
|
|
4
|
+
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
5
|
+
const rxjs_1 = require("rxjs");
|
|
6
|
+
const core_1 = require("../core");
|
|
7
|
+
// class
|
|
8
|
+
class BridgeProxy {
|
|
9
|
+
constructor(args) {
|
|
10
|
+
// initialize instances
|
|
11
|
+
this._webViews$ = new rxjs_1.BehaviorSubject([]);
|
|
12
|
+
this._webViews = new Map();
|
|
13
|
+
this._stateChange$ = new rxjs_1.Subject();
|
|
14
|
+
this._state = Object.assign({ identityData: null, profileData: null, safeArea: funnel_core_1.Insets.none }, args.initialState);
|
|
15
|
+
this._nativeCalls$ = new rxjs_1.BehaviorSubject([]);
|
|
16
|
+
}
|
|
17
|
+
get webViews$() {
|
|
18
|
+
return this._webViews$.asObservable();
|
|
19
|
+
}
|
|
20
|
+
get webViews() {
|
|
21
|
+
return this._webViews$.getValue();
|
|
22
|
+
}
|
|
23
|
+
set webViews(webViews) {
|
|
24
|
+
this._webViews$.next(webViews);
|
|
25
|
+
}
|
|
26
|
+
get stateChange$() {
|
|
27
|
+
return this._stateChange$.asObservable();
|
|
28
|
+
}
|
|
29
|
+
get state() {
|
|
30
|
+
return this._state;
|
|
31
|
+
}
|
|
32
|
+
get nativeCalls$() {
|
|
33
|
+
return this._nativeCalls$.asObservable();
|
|
34
|
+
}
|
|
35
|
+
get nativeCalls() {
|
|
36
|
+
return this._nativeCalls$.getValue();
|
|
37
|
+
}
|
|
38
|
+
getWebViewPreLoadScript(id, customScript) {
|
|
39
|
+
return `
|
|
40
|
+
// bind logging
|
|
41
|
+
(function() {
|
|
42
|
+
|
|
43
|
+
// helper
|
|
44
|
+
function __nd_log(stdout, level, args) {
|
|
45
|
+
|
|
46
|
+
// log in webview
|
|
47
|
+
stdout.apply(console, args);
|
|
48
|
+
|
|
49
|
+
// log across bridge (if mounted)
|
|
50
|
+
var postMessage = window.ReactNativeWebView?.postMessage;
|
|
51
|
+
if (postMessage) {
|
|
52
|
+
|
|
53
|
+
// try to post
|
|
54
|
+
try {
|
|
55
|
+
postMessage(JSON.stringify({
|
|
56
|
+
__type: "log",
|
|
57
|
+
level,
|
|
58
|
+
args: Array.from(args)
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// handle errors
|
|
63
|
+
catch (e) {
|
|
64
|
+
postMessage(JSON.stringify({
|
|
65
|
+
__type: "log",
|
|
66
|
+
level,
|
|
67
|
+
args: [
|
|
68
|
+
"Failed to post cyclical message payload:",
|
|
69
|
+
new Error().stack
|
|
70
|
+
]
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// error
|
|
77
|
+
const consoleError = console.error;
|
|
78
|
+
console.error = function() {
|
|
79
|
+
__nd_log(consoleError, "error", arguments);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// warn
|
|
83
|
+
const consoleWarn = console.warn;
|
|
84
|
+
console.warn = function() {
|
|
85
|
+
__nd_log(consoleWarn, "warn", arguments);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// log
|
|
89
|
+
const consoleLog = console.log;
|
|
90
|
+
console.log = function() {
|
|
91
|
+
__nd_log(consoleLog, "info", arguments);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// info
|
|
95
|
+
const consoleInfo = console.info;
|
|
96
|
+
console.info = function() {
|
|
97
|
+
__nd_log(consoleInfo, "info", arguments);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// debug
|
|
101
|
+
const consoleDebug = console.debug;
|
|
102
|
+
console.debug = function() {
|
|
103
|
+
__nd_log(consoleDebug, "debug", arguments);
|
|
104
|
+
};
|
|
105
|
+
})();
|
|
106
|
+
|
|
107
|
+
// setup globals
|
|
108
|
+
(function() {
|
|
109
|
+
window.${core_1.BridgeConstants.Window.initialState} = ${JSON.stringify(this.state)};
|
|
110
|
+
window.${core_1.BridgeConstants.Window.bridgeId} = "${id}";
|
|
111
|
+
})();
|
|
112
|
+
|
|
113
|
+
// run custom script
|
|
114
|
+
(function() {
|
|
115
|
+
${customScript}
|
|
116
|
+
})();
|
|
117
|
+
true;
|
|
118
|
+
`;
|
|
119
|
+
}
|
|
120
|
+
getWebViewPostLoadScript(customScript) {
|
|
121
|
+
return `
|
|
122
|
+
(function() {
|
|
123
|
+
${customScript}
|
|
124
|
+
})();
|
|
125
|
+
true;
|
|
126
|
+
`;
|
|
127
|
+
}
|
|
128
|
+
connect(id, webView) {
|
|
129
|
+
// fail if already connected
|
|
130
|
+
const { _webViews } = this;
|
|
131
|
+
if (_webViews.has(webView)) {
|
|
132
|
+
console.warn('[BridgeProxy] ignoring redundant call to bind webView');
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
// create context
|
|
136
|
+
const context = {
|
|
137
|
+
id,
|
|
138
|
+
webView,
|
|
139
|
+
connected: false
|
|
140
|
+
};
|
|
141
|
+
console.debug('[BridgeProxy] connecting webview: ', context.id);
|
|
142
|
+
// track context
|
|
143
|
+
_webViews.set(webView, context);
|
|
144
|
+
// TODO: set any additional connections
|
|
145
|
+
}
|
|
146
|
+
disconnect(webView) {
|
|
147
|
+
// get context
|
|
148
|
+
const { _webViews } = this;
|
|
149
|
+
const context = _webViews.get(webView);
|
|
150
|
+
if (!context) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
console.log('[BridgeProxy] disconnecting webview: ', context.id);
|
|
154
|
+
// remove webview
|
|
155
|
+
_webViews.delete(webView);
|
|
156
|
+
// mark as disconnected
|
|
157
|
+
context.connected = false;
|
|
158
|
+
// update webview set
|
|
159
|
+
this.webViews = this.webViews.filter(({ id }) => id !== context.id);
|
|
160
|
+
}
|
|
161
|
+
setState(key, value) {
|
|
162
|
+
// skip if there's no local change
|
|
163
|
+
if (!this.updateState(key, value)) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
// update remote state (native and other browsers)
|
|
167
|
+
this.propagate({
|
|
168
|
+
__type: 'state.set',
|
|
169
|
+
key,
|
|
170
|
+
value
|
|
171
|
+
});
|
|
172
|
+
// indicate change
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
updateState(key, value) {
|
|
176
|
+
// skip if already set
|
|
177
|
+
const { _state, _stateChange$ } = this;
|
|
178
|
+
if (funnel_core_1.Value.equals(_state[key], value)) {
|
|
179
|
+
console.log('[BridgeProxy] ignoring redundant state change', { key, value });
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
console.log('[BridgeProxy] updating state', { key, value });
|
|
183
|
+
// update local state
|
|
184
|
+
this._state = Object.assign(Object.assign({}, _state), { [key]: value });
|
|
185
|
+
_stateChange$.next({ key, value });
|
|
186
|
+
// indicate change
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
propagate(event, webViewId) {
|
|
190
|
+
// create callback
|
|
191
|
+
const script = `
|
|
192
|
+
(function() {
|
|
193
|
+
|
|
194
|
+
// send message if bridge is bound
|
|
195
|
+
if (window["${core_1.BridgeConstants.Window.bridge}"]) {
|
|
196
|
+
console.warn("...event coming through");
|
|
197
|
+
window["${core_1.BridgeConstants.Window.bridge}"].onEvent(${JSON.stringify(event)});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// or defer it
|
|
201
|
+
else {
|
|
202
|
+
console.warn("...event deferring");
|
|
203
|
+
}
|
|
204
|
+
})();
|
|
205
|
+
true;
|
|
206
|
+
`;
|
|
207
|
+
// propagate to all targets
|
|
208
|
+
this._webViews.forEach(({ id, webView }) => {
|
|
209
|
+
if (!webViewId || webViewId === id) {
|
|
210
|
+
console.debug('[BridgeProxy] propagating script', { id, event });
|
|
211
|
+
webView.injectJavaScript(script);
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
console.debug('[BridgeProxy] skipping propagating for', id);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
onEvent(event) {
|
|
219
|
+
// handle event
|
|
220
|
+
switch (event.__type) {
|
|
221
|
+
// logging
|
|
222
|
+
case 'log': {
|
|
223
|
+
// resolve args
|
|
224
|
+
const { level, args } = event;
|
|
225
|
+
const [format, ...formatArgs] = args !== null && args !== void 0 ? args : ['undefined'];
|
|
226
|
+
const consoleArgs = typeof format === 'string'
|
|
227
|
+
? [`(BridgeWebview) ${format}`, ...formatArgs]
|
|
228
|
+
: ['(BridgeWebView)', format, formatArgs];
|
|
229
|
+
// log based on level
|
|
230
|
+
switch (level) {
|
|
231
|
+
case 'debug':
|
|
232
|
+
console.debug(...consoleArgs);
|
|
233
|
+
break;
|
|
234
|
+
case 'info':
|
|
235
|
+
console.log(...consoleArgs);
|
|
236
|
+
break;
|
|
237
|
+
case 'warn':
|
|
238
|
+
console.warn(...consoleArgs);
|
|
239
|
+
break;
|
|
240
|
+
case 'error':
|
|
241
|
+
console.error(...consoleArgs);
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
// state
|
|
247
|
+
case 'state.set':
|
|
248
|
+
this.updateState(event.key, event.value);
|
|
249
|
+
break;
|
|
250
|
+
// native call
|
|
251
|
+
case 'call.invocation': {
|
|
252
|
+
// intercept webview connections
|
|
253
|
+
const { webViewId } = event;
|
|
254
|
+
if (event.method === 'app.connect') {
|
|
255
|
+
// find view (or fail)
|
|
256
|
+
const context = Array.from(this._webViews.values())
|
|
257
|
+
.find(context => context.id === webViewId);
|
|
258
|
+
if (!context) {
|
|
259
|
+
console.error(`[BridgeProxy] unable to resolve webview context for "${webViewId}"`);
|
|
260
|
+
// response with error
|
|
261
|
+
this.propagate({
|
|
262
|
+
__type: 'call.error',
|
|
263
|
+
webViewId,
|
|
264
|
+
id: event.id,
|
|
265
|
+
method: event.method,
|
|
266
|
+
error: new funnel_core_1.NotFoundError('Unable to resolve webView').serialize()
|
|
267
|
+
}, webViewId);
|
|
268
|
+
// stop processing
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
// or bind
|
|
272
|
+
else {
|
|
273
|
+
// respond with success
|
|
274
|
+
this.propagate({
|
|
275
|
+
__type: 'call.result',
|
|
276
|
+
webViewId,
|
|
277
|
+
id: event.id,
|
|
278
|
+
method: event.method,
|
|
279
|
+
result: true
|
|
280
|
+
}, webViewId);
|
|
281
|
+
// track webview (add it)
|
|
282
|
+
this.webViews = [...this.webViews, context];
|
|
283
|
+
// stop processing
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
// create new call
|
|
288
|
+
const { _nativeCalls$ } = this;
|
|
289
|
+
const nativeCall = new core_1.BridgeMethodCall({
|
|
290
|
+
call: event,
|
|
291
|
+
onResolve: async (result) => {
|
|
292
|
+
// update calls by removing callback
|
|
293
|
+
_nativeCalls$.next(_nativeCalls$.getValue().filter(({ id }) => id !== event.id));
|
|
294
|
+
// propagate response
|
|
295
|
+
this.propagate({
|
|
296
|
+
__type: 'call.result',
|
|
297
|
+
webViewId,
|
|
298
|
+
id: event.id,
|
|
299
|
+
method: event.method,
|
|
300
|
+
result
|
|
301
|
+
}, webViewId);
|
|
302
|
+
},
|
|
303
|
+
onReject: async (error) => {
|
|
304
|
+
// update calls by removing callback
|
|
305
|
+
_nativeCalls$.next(_nativeCalls$.getValue().filter(({ id }) => id !== event.id));
|
|
306
|
+
// propagate response
|
|
307
|
+
this.propagate({
|
|
308
|
+
__type: 'call.error',
|
|
309
|
+
webViewId,
|
|
310
|
+
id: event.id,
|
|
311
|
+
method: event.method,
|
|
312
|
+
error: error.serialize()
|
|
313
|
+
}, webViewId);
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
// add call
|
|
317
|
+
this._nativeCalls$.next([
|
|
318
|
+
..._nativeCalls$.getValue(),
|
|
319
|
+
nativeCall
|
|
320
|
+
]);
|
|
321
|
+
// stop processing
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
// fallback
|
|
325
|
+
default:
|
|
326
|
+
console.warn('[BridgeProxy] unhandled event:', event);
|
|
327
|
+
break;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
exports.BridgeProxy = BridgeProxy;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BridgeMethods, BridgeState } from '../core';
|
|
2
|
+
import { BridgeProxy } from './BridgeProxy';
|
|
3
|
+
export declare const BridgeProxyContext: import("react").Context<BridgeProxyContext.Data<any, any>>;
|
|
4
|
+
export declare namespace BridgeProxyContext {
|
|
5
|
+
type Data<TState extends BridgeState.Custom = BridgeState.Custom, TNativeMethods extends BridgeMethods.Native = BridgeMethods.Native> = {
|
|
6
|
+
bridgeProxy?: BridgeProxy<TState, TNativeMethods>;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { BridgeMethods, BridgeState } from '../core';
|
|
3
|
+
export declare function BridgeProxyProvider<TState extends BridgeState.Custom = BridgeState, TNativeMethods extends BridgeMethods.Native = BridgeMethods.Native>({ initialState: initialStateRaw, children }: BridgeProxyProvider.Props<TState, TNativeMethods>): import("react").JSX.Element;
|
|
4
|
+
export declare namespace BridgeProxyProvider {
|
|
5
|
+
type Props<TState extends BridgeState.Custom = BridgeState.Custom, TNativeMethods extends BridgeMethods.Native = BridgeMethods.Native> = PropsWithChildren & {
|
|
6
|
+
initialState: TState & Partial<BridgeState.Core>;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BridgeProxyProvider = BridgeProxyProvider;
|
|
4
|
+
const hooks_1 = require("@nascentdigital/funnel-ui/hooks");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
7
|
+
const rn_1 = require("../../identity/rn");
|
|
8
|
+
const BridgeProxy_1 = require("./BridgeProxy");
|
|
9
|
+
const BridgeProxyContext_1 = require("./BridgeProxyContext");
|
|
10
|
+
// component
|
|
11
|
+
function BridgeProxyProvider({ initialState: initialStateRaw, children }) {
|
|
12
|
+
var _a;
|
|
13
|
+
// bind hooks + context
|
|
14
|
+
const safeArea = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
|
|
15
|
+
const { identity } = (0, rn_1.useIdentity)();
|
|
16
|
+
const coreStateRef = (0, react_1.useRef)({});
|
|
17
|
+
coreStateRef.current = {
|
|
18
|
+
identityData: (_a = identity === null || identity === void 0 ? void 0 : identity.toData()) !== null && _a !== void 0 ? _a : null,
|
|
19
|
+
safeArea
|
|
20
|
+
};
|
|
21
|
+
const initialState = (0, hooks_1.useLatestValue)(initialStateRaw);
|
|
22
|
+
const bridgeProxy = (0, react_1.useMemo)(() => new BridgeProxy_1.BridgeProxy({
|
|
23
|
+
initialState: Object.assign(Object.assign({}, initialState), coreStateRef.current)
|
|
24
|
+
}), [initialState]);
|
|
25
|
+
const context = (0, react_1.useMemo)(() => ({ bridgeProxy }), [bridgeProxy]);
|
|
26
|
+
// sync safe area
|
|
27
|
+
(0, react_1.useEffect)(() => {
|
|
28
|
+
bridgeProxy.setState('safeArea', safeArea);
|
|
29
|
+
}, [bridgeProxy, safeArea]);
|
|
30
|
+
// sync identity
|
|
31
|
+
(0, react_1.useEffect)(() => {
|
|
32
|
+
var _a;
|
|
33
|
+
bridgeProxy.setState('identityData', (_a = identity === null || identity === void 0 ? void 0 : identity.toData()) !== null && _a !== void 0 ? _a : null);
|
|
34
|
+
}, [bridgeProxy, identity]);
|
|
35
|
+
// render
|
|
36
|
+
return (<BridgeProxyContext_1.BridgeProxyContext.Provider value={context}>
|
|
37
|
+
{children}
|
|
38
|
+
</BridgeProxyContext_1.BridgeProxyContext.Provider>);
|
|
39
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BridgeWebview = BridgeWebview;
|
|
7
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const react_native_uuid_1 = __importDefault(require("react-native-uuid"));
|
|
10
|
+
const react_native_webview_1 = require("react-native-webview");
|
|
11
|
+
const core_1 = require("../core");
|
|
12
|
+
const useBridgeProxy_1 = require("./useBridgeProxy");
|
|
13
|
+
// component
|
|
14
|
+
function BridgeWebview({ className, url }) {
|
|
15
|
+
// bind hooks
|
|
16
|
+
const [webView, setWebView] = (0, react_1.useState)(null);
|
|
17
|
+
const setWebViewRef = (0, react_1.useCallback)((webView) => {
|
|
18
|
+
setWebView(webView);
|
|
19
|
+
}, []);
|
|
20
|
+
const webViewId = (0, react_1.useMemo)(() => react_native_uuid_1.default.v4(), []);
|
|
21
|
+
const bridgeProxy = (0, useBridgeProxy_1.useBridgeProxy)();
|
|
22
|
+
// connect/disconnect webview from/to adapter
|
|
23
|
+
(0, react_1.useEffect)(() => {
|
|
24
|
+
// skip if adapter/webview are not ready
|
|
25
|
+
if (!webView) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
// connect
|
|
29
|
+
bridgeProxy.connect(webViewId, webView);
|
|
30
|
+
// disconnect on unmount
|
|
31
|
+
return () => bridgeProxy.disconnect(webView);
|
|
32
|
+
}, [webViewId, webView, bridgeProxy]);
|
|
33
|
+
// helpers
|
|
34
|
+
const onMessage = ({ nativeEvent: { data } }) => {
|
|
35
|
+
// skip if message isn't an event
|
|
36
|
+
const event = core_1.BridgeEvent.parse(data);
|
|
37
|
+
if (!event) {
|
|
38
|
+
console.warn('[BridgeWebview] invalid browser message:', data);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
// forward to proxy
|
|
42
|
+
bridgeProxy.onEvent(event);
|
|
43
|
+
};
|
|
44
|
+
// render
|
|
45
|
+
return (<react_native_webview_1.WebView ref={setWebViewRef} className={(0, classnames_1.default)('flex-1', className)} injectedJavaScriptBeforeContentLoaded={bridgeProxy.getWebViewPreLoadScript(webViewId, `
|
|
46
|
+
|
|
47
|
+
// disable webview-isms
|
|
48
|
+
document.body.style.minWidth = 'calc(100dvw)';
|
|
49
|
+
document.body.style.touchAction = 'none';
|
|
50
|
+
`)} injectedJavaScript={bridgeProxy.getWebViewPostLoadScript()} onMessage={onMessage} source={{ uri: url }} showsVerticalScrollIndicator={false} showsHorizontalScrollIndicator={false} bounces={false}/>);
|
|
51
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("../core"), exports);
|
|
18
|
+
__exportStar(require("./BridgeProxy"), exports);
|
|
19
|
+
__exportStar(require("./BridgeProxyProvider"), exports);
|
|
20
|
+
__exportStar(require("./BridgeWebview"), exports);
|
|
21
|
+
__exportStar(require("./useBridgeProxy"), exports);
|
|
22
|
+
__exportStar(require("./useBridgeProxyCalls"), exports);
|
|
23
|
+
__exportStar(require("./useBridgeProxyState"), exports);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePossibleBridgeProxy = usePossibleBridgeProxy;
|
|
4
|
+
exports.useBridgeProxy = useBridgeProxy;
|
|
5
|
+
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
6
|
+
const hooks_1 = require("@nascentdigital/funnel-ui/hooks");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const BridgeProxyContext_1 = require("./BridgeProxyContext");
|
|
9
|
+
// hook
|
|
10
|
+
function usePossibleBridgeProxy() {
|
|
11
|
+
// bind context
|
|
12
|
+
const { bridgeProxy } = (0, react_1.useContext)(BridgeProxyContext_1.BridgeProxyContext);
|
|
13
|
+
const touch = (0, hooks_1.useTouch)();
|
|
14
|
+
// sync changes
|
|
15
|
+
(0, react_1.useEffect)(() => {
|
|
16
|
+
// skip if there's no proxy
|
|
17
|
+
if (!bridgeProxy) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
// refresh when state changes
|
|
21
|
+
const subscriptions = [
|
|
22
|
+
bridgeProxy.stateChange$.subscribe(touch)
|
|
23
|
+
];
|
|
24
|
+
// unsubscribe on unmount
|
|
25
|
+
return () => subscriptions.forEach(subscription => subscription.unsubscribe());
|
|
26
|
+
}, [bridgeProxy, touch]);
|
|
27
|
+
// return proxy (might be undefined)
|
|
28
|
+
return bridgeProxy;
|
|
29
|
+
}
|
|
30
|
+
function useBridgeProxy() {
|
|
31
|
+
// resolve proxy (or throw)
|
|
32
|
+
const bridgeProxy = usePossibleBridgeProxy();
|
|
33
|
+
if (!bridgeProxy) {
|
|
34
|
+
throw new funnel_core_1.InvalidOperationError('Cannot access BridgeProxy outside of BridgeProxyProvider');
|
|
35
|
+
}
|
|
36
|
+
// forward result
|
|
37
|
+
return bridgeProxy;
|
|
38
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { StringKeyOf } from 'type-fest';
|
|
2
|
+
import { BridgeMethodCall, BridgeMethods } from '../core';
|
|
3
|
+
export declare function useBridgeProxyCalls<TMethodName extends StringKeyOf<TNativeMethods>, TNativeMethods extends BridgeMethods.Native = BridgeMethods.Native>(...methodNamesRaw: ReadonlyArray<TMethodName>): ReadonlyArray<BridgeMethodCall<TNativeMethods[TMethodName]>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBridgeProxyCalls = useBridgeProxyCalls;
|
|
4
|
+
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
5
|
+
const hooks_1 = require("@nascentdigital/funnel-ui/hooks");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const BridgeProxyContext_1 = require("./BridgeProxyContext");
|
|
8
|
+
// hook
|
|
9
|
+
function useBridgeProxyCalls(...methodNamesRaw) {
|
|
10
|
+
// bind context
|
|
11
|
+
const methodNames = (0, hooks_1.useLatestValue)(methodNamesRaw);
|
|
12
|
+
const { bridgeProxy } = (0, react_1.useContext)(BridgeProxyContext_1.BridgeProxyContext);
|
|
13
|
+
const [calls, setCalls] = (0, react_1.useState)([]);
|
|
14
|
+
// monitor calls
|
|
15
|
+
(0, react_1.useEffect)(() => {
|
|
16
|
+
// skip if there's no bridge
|
|
17
|
+
if (!bridgeProxy) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
// update if value of key changes
|
|
21
|
+
const subscription = bridgeProxy.nativeCalls$
|
|
22
|
+
.subscribe(calls => setCalls(calls.filter(call => methodNames.length === 0 || methodNames.includes(call.call.method))));
|
|
23
|
+
// unsubscribe on unmount
|
|
24
|
+
return () => subscription.unsubscribe();
|
|
25
|
+
}, [bridgeProxy, methodNames]);
|
|
26
|
+
// throw if bridge isn't set
|
|
27
|
+
if (!bridgeProxy) {
|
|
28
|
+
throw new funnel_core_1.InvalidOperationError('Cannot access bridge outside of BridgeProxyProvider');
|
|
29
|
+
}
|
|
30
|
+
// return state
|
|
31
|
+
return calls;
|
|
32
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBridgeProxyState = useBridgeProxyState;
|
|
4
|
+
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
5
|
+
const hooks_1 = require("@nascentdigital/funnel-ui/hooks");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const rxjs_1 = require("rxjs");
|
|
8
|
+
const BridgeProxyContext_1 = require("./BridgeProxyContext");
|
|
9
|
+
// hook
|
|
10
|
+
function useBridgeProxyState(...keysRaw) {
|
|
11
|
+
// bind context
|
|
12
|
+
const keys = (0, hooks_1.useLatestValue)(keysRaw);
|
|
13
|
+
const { bridgeProxy } = (0, react_1.useContext)(BridgeProxyContext_1.BridgeProxyContext);
|
|
14
|
+
const [state, setState] = (0, react_1.useState)(() => {
|
|
15
|
+
var _a;
|
|
16
|
+
return Object.entries((_a = bridgeProxy === null || bridgeProxy === void 0 ? void 0 : bridgeProxy.state) !== null && _a !== void 0 ? _a : {})
|
|
17
|
+
.reduce((state, [keyRaw, value]) => {
|
|
18
|
+
// bind value (if mapped)
|
|
19
|
+
const key = keyRaw;
|
|
20
|
+
if (keys.includes(key)) {
|
|
21
|
+
state[key] = value;
|
|
22
|
+
}
|
|
23
|
+
// keep reducing
|
|
24
|
+
return state;
|
|
25
|
+
}, {});
|
|
26
|
+
});
|
|
27
|
+
// monitor keys
|
|
28
|
+
(0, react_1.useEffect)(() => {
|
|
29
|
+
// skip if there's no bridge
|
|
30
|
+
if (!bridgeProxy) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
// update if value of key changes
|
|
34
|
+
const subscription = bridgeProxy.stateChange$
|
|
35
|
+
.pipe((0, rxjs_1.filter)(change => keys.length === 0 || keys.includes(change.key)))
|
|
36
|
+
.subscribe(change => setState(state => (Object.assign(Object.assign({}, state), { [change.key]: change.value }))));
|
|
37
|
+
// unsubscribe on unmount
|
|
38
|
+
return () => subscription.unsubscribe();
|
|
39
|
+
}, [bridgeProxy, keys]);
|
|
40
|
+
// throw if bridge isn't set
|
|
41
|
+
if (!bridgeProxy) {
|
|
42
|
+
throw new funnel_core_1.InvalidOperationError('Cannot access bridge outside of BridgeProxyProvider');
|
|
43
|
+
}
|
|
44
|
+
// return state
|
|
45
|
+
return state;
|
|
46
|
+
}
|