@ionic/portals-react-native 0.5.1 → 0.6.0

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.
Files changed (48) hide show
  1. package/ReactNativePortals.podspec +39 -14
  2. package/android/build.gradle +78 -108
  3. package/android/gradle.properties +5 -3
  4. package/android/src/main/java/io/ionic/portals/reactnative/PortalView.kt +11 -8
  5. package/android/src/main/java/io/ionic/portals/reactnative/ReactNativePortalManager.kt +37 -16
  6. package/android/src/main/java/io/ionic/portals/reactnative/ReactNativePortalsModule.kt +2 -3
  7. package/android/src/main/java/io/ionic/portals/reactnative/ReactNativeWebVitalsModule.kt +11 -19
  8. package/ios/IonicPortals+Codable.swift +77 -0
  9. package/ios/LiveUpdateManager+Async.swift +16 -46
  10. package/ios/Podfile +29 -4
  11. package/ios/Podfile.lock +478 -241
  12. package/ios/Portal.swift +50 -54
  13. package/ios/PortalView.swift +26 -8
  14. package/ios/PortalsConfig.swift +1 -88
  15. package/ios/PortalsReactNative-Bridging-Header.h +2 -0
  16. package/ios/PortalsReactNative.swift +41 -36
  17. package/ios/SyncResult+SyncError+Encodable.swift +55 -0
  18. package/ios/WebVitals.swift +19 -26
  19. package/package.json +62 -43
  20. package/src/{PortalView.android.tsx → BasePortalView.android.tsx} +2 -3
  21. package/src/{PortalView.tsx → BasePortalView.tsx} +2 -3
  22. package/src/{index.ts → index.tsx} +77 -39
  23. package/ios/LiveUpdate+Dict.swift +0 -30
  24. package/ios/LiveUpdateManagerError+Dict.swift +0 -19
  25. package/ios/ReactNativePortals.xcodeproj/project.pbxproj +0 -465
  26. package/ios/ReactNativePortals.xcodeproj/xcshareddata/xcschemes/ReactNativePortals.xcscheme +0 -67
  27. package/ios/ReactNativePortals.xcworkspace/contents.xcworkspacedata +0 -10
  28. package/ios/ReactNativePortals.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  29. package/ios/SyncResult+Dict.swift +0 -35
  30. package/lib/commonjs/PortalView.android.js +0 -28
  31. package/lib/commonjs/PortalView.android.js.map +0 -1
  32. package/lib/commonjs/PortalView.js +0 -15
  33. package/lib/commonjs/PortalView.js.map +0 -1
  34. package/lib/commonjs/index.js +0 -200
  35. package/lib/commonjs/index.js.map +0 -1
  36. package/lib/module/PortalView.android.js +0 -20
  37. package/lib/module/PortalView.android.js.map +0 -1
  38. package/lib/module/PortalView.js +0 -8
  39. package/lib/module/PortalView.js.map +0 -1
  40. package/lib/module/index.js +0 -176
  41. package/lib/module/index.js.map +0 -1
  42. package/lib/typescript/PortalView.android.d.ts +0 -4
  43. package/lib/typescript/PortalView.d.ts +0 -4
  44. package/lib/typescript/index.d.ts +0 -181
  45. /package/ios/{PortalManager.m → PortalManager.mm} +0 -0
  46. /package/ios/{PortalView.m → PortalView.mm} +0 -0
  47. /package/ios/{PortalWebVitals.m → PortalWebVitals.mm} +0 -0
  48. /package/ios/{PortalsPubSub.m → PortalsPubSub.mm} +0 -0
@@ -1,181 +0,0 @@
1
- import { EmitterSubscription, ViewProps } from 'react-native';
2
- export { default as PortalView } from './PortalView';
3
- /**
4
- * The data that is received from a subscription event.
5
- */
6
- export interface Message {
7
- /** The unique subscription reference received from {@link subscribe}*/
8
- subscriptionRef: number;
9
- data: any;
10
- /** The topic the message was sent from */
11
- topic: string;
12
- }
13
- /**
14
- * Subscribes to messages for a topic
15
- *
16
- * @param topic The topic to subscribe to
17
- * @param onMessageReceived The callback to invoke when a message is received
18
- * @returns A Promise<number> containing the unique subscription reference. This will need to be stored for calling {@link unsubscribe}.
19
- */
20
- export declare const subscribe: (topic: string, onMessageReceived: (message: Message) => void) => EmitterSubscription;
21
- /**
22
- * Publishes a message to the provided topic
23
- *
24
- * @param topic The topic to publish the message to
25
- * @param data The data to publish to subscribers
26
- */
27
- export declare const publish: (topic: string, data: any) => void;
28
- export declare const onFirstContentfulPaint: (portalName: string, callback: (duration: number) => void) => Promise<void>;
29
- export declare const onFirstInputDelay: (portalName: string, callback: (duration: number) => void) => Promise<void>;
30
- export declare const onTimeToFirstByte: (portalName: string, callback: (duration: number) => void) => Promise<void>;
31
- export declare const registerWebVitals: (portalName: string, firstContentfulPaint: (duration: number) => void, firstInputDelay: (duration: number) => void, timeToFirstByte: (duration: number) => void) => Promise<void>;
32
- /**
33
- * Validates that a valid registration key has been procured from http://ionic.io/register-portals
34
- * @param key The registration key
35
- * @returns Promise<void>
36
- */
37
- export declare const register: (key: string) => Promise<void>;
38
- /**
39
- * The configuration of a web application to be embedded in a React Native application.
40
- */
41
- export interface Portal {
42
- /** The name of the Portal to be referenced. Must be **unique** */
43
- name: string;
44
- /** Any Capacitor plugins to be made available to the Portal */
45
- plugins?: CapacitorPlugin[];
46
- /**
47
- * The root directory of the web application relative to Bundle.main on iOS
48
- * and src/main/assets on Android. If omitted, `name` is used.
49
- */
50
- startDir?: string;
51
- /** The name of the initial file to load. If omitted, 'index.html' is used. */
52
- index?: string;
53
- /** Any data needed at initial render when a portal is loaded. */
54
- initialContext?: {
55
- [key: string]: any;
56
- };
57
- assetMaps?: AssetMap[];
58
- liveUpdate?: LiveUpdateConfig;
59
- }
60
- export interface CapacitorPlugin {
61
- /** The classpath of the plugin to be used in Android. (e.g. com.capacitorjs.plugins.camera.CameraPlugin) */
62
- androidClassPath: string;
63
- /** The class name of the plugin to be used in iOS.
64
- * This must be the name as it is exposed to the Objective-C runtime.
65
- * For example, The CameraPlugin swift class is exposed to Objective-C as CAPCameraPlugin.
66
- */
67
- iosClassName: string;
68
- }
69
- export interface AssetMap {
70
- /** The name to index the asset map by */
71
- name: string;
72
- /** Any path to match via the web. If omitted, {@link AssetMap#name} will be used. */
73
- virtualPath?: string;
74
- /** The root directory of the assets relative to Bundle.main on iOS
75
- * and src/main/assets on Android. If omitted, the root of Bundle.main
76
- * and src/main/assets will be used.
77
- */
78
- startDir?: string;
79
- }
80
- /**
81
- * A subset of {@link Portal} properties needed for rendering a Portal. `initialContext` can be used to override
82
- * any initialContext defined in the original {@link Portal} definition.
83
- */
84
- export type PortalProp = {
85
- portal: Pick<Portal, 'name' | 'initialContext'>;
86
- };
87
- /**
88
- * Props needed for rendering a {@link Portal}
89
- */
90
- export type PortalProps = PortalProp & ViewProps;
91
- /**
92
- * Adds a Portal to an internal registry. Must be called before attempting to render a {@link PortalView}.
93
- *
94
- * @param portal The portal to add to the internal registry.
95
- * @returns Promise containing the Portal that was added to the registry.
96
- */
97
- export declare const addPortal: (portal: Portal) => Promise<Portal>;
98
- /**
99
- * Adds all portals to an internal registry. This or {@link addPortal} must be called before attempting to render a {@link PortalView}
100
- *
101
- * @param portals The portals to add to the internal registry.
102
- * @returns Promise containing the Portals that were added to the registry.
103
- */
104
- export declare const addPortals: (portals: Portal[]) => Promise<Portal[]>;
105
- /**
106
- * Gets a {@link Portal} previously registered via {@link addPortal} or {@link addPortals}.
107
- *
108
- * @param name The portal name to retrieve from the internal registry.
109
- * @returns Promise containing the registered {@link Portal}. If the {@link Portal} was not registered, the Promise will fail.
110
- */
111
- export declare const getPortal: (name: string) => Promise<Portal>;
112
- export interface LiveUpdate {
113
- /** The AppFlow application ID */
114
- appId: string;
115
- /** The AppFlow distribution channel */
116
- channel: string;
117
- }
118
- /** Data needed to register a live update to be managed */
119
- export type LiveUpdateConfig = LiveUpdate & {
120
- syncOnAdd: boolean;
121
- };
122
- export interface LiveUpdateError {
123
- /** The AppFlow application ID relating to the failure */
124
- appId: string;
125
- /** The step in the sync process the LiveUpdate failed on. (e.g. CHECK, UNPACK)*/
126
- failStep: string;
127
- /** A human readable error message */
128
- message: string;
129
- }
130
- export interface Snapshot {
131
- /** The snapshot id as found in AppFlow */
132
- id: string;
133
- /** The AppFlow build id that produced the snapshot */
134
- buildId: string;
135
- }
136
- export interface SyncResult {
137
- /** The {@link LiveUpdate} associated with the result */
138
- liveUpdate: LiveUpdate;
139
- /** The {@link Snapshot} that was sync'd */
140
- snapshot: Snapshot | null;
141
- /** Whether the snapshot was downloaded or already on disk */
142
- source: 'download' | 'cache';
143
- /** If the active application path was changed. A `false` value would indicate
144
- * the application already has the latest code for the associated {@link LiveUpdate}
145
- * configuration.
146
- */
147
- activeApplicationPathChanged: boolean;
148
- }
149
- /** Used for communicating sync results of multiple live updates */
150
- export interface SyncResults {
151
- results: SyncResult[];
152
- errors: LiveUpdateError[];
153
- }
154
- /**
155
- * Configures LiveUpdates to cyrptographically verify the contents of the downloaded bundles.
156
- * This method must be called before any LiveUpdates are registered otherwise they will no longer be tracked.
157
- *
158
- * @param pathToKey The *relative* path to the public key for verification.
159
- * This path should be the same relatibe to the main application bundle on iOS and the assets directory on Android.
160
- * @returns Promise<void>
161
- */
162
- export declare const enableSecureLiveUpdates: (pathToKey: string) => Promise<void>;
163
- /**
164
- * Syncs a single live update.
165
- *
166
- * @param appId The AppFlow application ID to sync.
167
- * @returns A Promise<LiveUpdate>. A failure should result in a {@link LiveUpdateError}.
168
- */
169
- export declare const syncOne: (appId: string) => Promise<SyncResult>;
170
- /**
171
- * Syncs many live updates.
172
- *
173
- * @param appIds The AppFlow application IDs to sync.
174
- * @returns Promise<SyncResults>
175
- */
176
- export declare const syncSome: (appIds: string[]) => Promise<SyncResults>;
177
- /**
178
- * Syncs all registered LiveUpdates
179
- * @returns Promise<SyncResults>
180
- */
181
- export declare const syncAll: () => Promise<SyncResults>;
File without changes
File without changes
File without changes
File without changes