@ionic/portals-react-native 0.5.2 → 0.7.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 (49) 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 +24 -24
  6. package/android/src/main/java/io/ionic/portals/reactnative/ReactNativePortalsModule.kt +0 -34
  7. package/android/src/main/java/io/ionic/portals/reactnative/ReactNativeWebVitalsModule.kt +0 -34
  8. package/ios/AssetMap+Codable.swift +33 -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/{PortalManager.m → PortalManager.mm} +0 -3
  14. package/ios/PortalView.swift +22 -12
  15. package/ios/{PortalWebVitals.m → PortalWebVitals.mm} +0 -1
  16. package/ios/PortalsConfig.swift +1 -88
  17. package/ios/PortalsReactNative-Bridging-Header.h +2 -0
  18. package/ios/PortalsReactNative.swift +17 -51
  19. package/ios/SyncResult+SyncError+Encodable.swift +55 -0
  20. package/ios/WebVitals.swift +17 -34
  21. package/package.json +62 -43
  22. package/src/{PortalView.android.tsx → BasePortalView.android.tsx} +2 -3
  23. package/src/{PortalView.tsx → BasePortalView.tsx} +2 -3
  24. package/src/{index.ts → index.tsx} +43 -96
  25. package/ios/AssetMap+Dict.swift +0 -28
  26. package/ios/LiveUpdate+Dict.swift +0 -30
  27. package/ios/LiveUpdateManagerError+Dict.swift +0 -19
  28. package/ios/ReactNativePortals.xcodeproj/project.pbxproj +0 -465
  29. package/ios/ReactNativePortals.xcodeproj/xcshareddata/xcschemes/ReactNativePortals.xcscheme +0 -67
  30. package/ios/ReactNativePortals.xcworkspace/contents.xcworkspacedata +0 -10
  31. package/ios/ReactNativePortals.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  32. package/ios/SyncResult+Dict.swift +0 -35
  33. package/lib/commonjs/PortalView.android.js +0 -28
  34. package/lib/commonjs/PortalView.android.js.map +0 -1
  35. package/lib/commonjs/PortalView.js +0 -15
  36. package/lib/commonjs/PortalView.js.map +0 -1
  37. package/lib/commonjs/index.js +0 -200
  38. package/lib/commonjs/index.js.map +0 -1
  39. package/lib/module/PortalView.android.js +0 -20
  40. package/lib/module/PortalView.android.js.map +0 -1
  41. package/lib/module/PortalView.js +0 -8
  42. package/lib/module/PortalView.js.map +0 -1
  43. package/lib/module/index.js +0 -176
  44. package/lib/module/index.js.map +0 -1
  45. package/lib/typescript/PortalView.android.d.ts +0 -4
  46. package/lib/typescript/PortalView.d.ts +0 -4
  47. package/lib/typescript/index.d.ts +0 -181
  48. /package/ios/{PortalView.m → PortalView.mm} +0 -0
  49. /package/ios/{PortalsPubSub.m → PortalsPubSub.mm} +0 -0
@@ -1,200 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "PortalView", {
7
- enumerable: true,
8
- get: function () {
9
- return _PortalView.default;
10
- }
11
- });
12
- exports.syncSome = exports.syncOne = exports.syncAll = exports.subscribe = exports.registerWebVitals = exports.register = exports.publish = exports.onTimeToFirstByte = exports.onFirstInputDelay = exports.onFirstContentfulPaint = exports.getPortal = exports.enableSecureLiveUpdates = exports.addPortals = exports.addPortal = void 0;
13
- var _reactNative = require("react-native");
14
- var _PortalView = _interopRequireDefault(require("./PortalView"));
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
- const {
17
- IONPortalPubSub,
18
- IONPortalsReactNative,
19
- IONPortalsWebVitals
20
- } = _reactNative.NativeModules;
21
- /**
22
- * The data that is received from a subscription event.
23
- */
24
-
25
- const PortalsPubSub = new _reactNative.NativeEventEmitter(IONPortalPubSub);
26
-
27
- // const subscriptionMap = new Map<number, EmitterSubscription>();
28
-
29
- /**
30
- * Subscribes to messages for a topic
31
- *
32
- * @param topic The topic to subscribe to
33
- * @param onMessageReceived The callback to invoke when a message is received
34
- * @returns A Promise<number> containing the unique subscription reference. This will need to be stored for calling {@link unsubscribe}.
35
- */
36
- const subscribe = (topic, onMessageReceived) => {
37
- return PortalsPubSub.addListener(`PortalsSubscription:${topic}`, message => {
38
- onMessageReceived(message);
39
- });
40
- };
41
-
42
- /**
43
- * Publishes a message to the provided topic
44
- *
45
- * @param topic The topic to publish the message to
46
- * @param data The data to publish to subscribers
47
- */
48
- exports.subscribe = subscribe;
49
- const publish = (topic, data) => {
50
- const msg = {
51
- message: data
52
- };
53
- IONPortalPubSub.publish(topic, msg);
54
- };
55
- exports.publish = publish;
56
- const webVitalsMap = new Map();
57
- const WebVitals = new _reactNative.NativeEventEmitter(IONPortalsWebVitals);
58
- const onFirstContentfulPaint = async (portalName, callback) => {
59
- const listener = WebVitals.addListener('vitals:fcp', event => {
60
- if (event.portalName === portalName) {
61
- callback(event.duration);
62
- }
63
- });
64
- await IONPortalsWebVitals.registerOnFirstContentfulPaint(portalName);
65
- webVitalsMap.set(`${portalName}-vitals:fcp`, listener);
66
- };
67
- exports.onFirstContentfulPaint = onFirstContentfulPaint;
68
- const onFirstInputDelay = async (portalName, callback) => {
69
- if (_reactNative.Platform.OS === 'android') {
70
- const listener = WebVitals.addListener('vitals:fid', event => {
71
- if (event.portalName === portalName) {
72
- callback(event.duration);
73
- }
74
- });
75
- await IONPortalsWebVitals.registerOnFirstInputDelay(portalName);
76
- webVitalsMap.set(`${portalName}-vitals:fid`, listener);
77
- }
78
- };
79
- exports.onFirstInputDelay = onFirstInputDelay;
80
- const onTimeToFirstByte = async (portalName, callback) => {
81
- if (_reactNative.Platform.OS === 'android') {
82
- const listener = WebVitals.addListener('vitals:ttfb', event => {
83
- if (event.portalName === portalName) {
84
- callback(event.duration);
85
- }
86
- });
87
- await IONPortalsWebVitals.registerOnTimeToFirstByte(portalName);
88
- webVitalsMap.set(`${portalName}-vitals:ttfb`, listener);
89
- }
90
- };
91
- exports.onTimeToFirstByte = onTimeToFirstByte;
92
- const registerWebVitals = async (portalName, firstContentfulPaint, firstInputDelay, timeToFirstByte) => {
93
- onFirstContentfulPaint(portalName, firstContentfulPaint);
94
- onFirstInputDelay(portalName, firstInputDelay);
95
- onTimeToFirstByte(portalName, timeToFirstByte);
96
- };
97
-
98
- /**
99
- * Validates that a valid registration key has been procured from http://ionic.io/register-portals
100
- * @param key The registration key
101
- * @returns Promise<void>
102
- */
103
- exports.registerWebVitals = registerWebVitals;
104
- const register = async key => {
105
- return IONPortalsReactNative.register(key);
106
- };
107
-
108
- /**
109
- * The configuration of a web application to be embedded in a React Native application.
110
- */
111
-
112
- /**
113
- * A subset of {@link Portal} properties needed for rendering a Portal. `initialContext` can be used to override
114
- * any initialContext defined in the original {@link Portal} definition.
115
- */
116
-
117
- /**
118
- * Props needed for rendering a {@link Portal}
119
- */
120
- exports.register = register;
121
- /**
122
- * Adds a Portal to an internal registry. Must be called before attempting to render a {@link PortalView}.
123
- *
124
- * @param portal The portal to add to the internal registry.
125
- * @returns Promise containing the Portal that was added to the registry.
126
- */
127
- const addPortal = async portal => {
128
- return IONPortalsReactNative.addPortal(portal);
129
- };
130
-
131
- /**
132
- * Adds all portals to an internal registry. This or {@link addPortal} must be called before attempting to render a {@link PortalView}
133
- *
134
- * @param portals The portals to add to the internal registry.
135
- * @returns Promise containing the Portals that were added to the registry.
136
- */
137
- exports.addPortal = addPortal;
138
- const addPortals = async portals => {
139
- return IONPortalsReactNative.addPortals(portals);
140
- };
141
-
142
- /**
143
- * Gets a {@link Portal} previously registered via {@link addPortal} or {@link addPortals}.
144
- *
145
- * @param name The portal name to retrieve from the internal registry.
146
- * @returns Promise containing the registered {@link Portal}. If the {@link Portal} was not registered, the Promise will fail.
147
- */
148
- exports.addPortals = addPortals;
149
- const getPortal = async name => {
150
- return IONPortalsReactNative.getPortal(name);
151
- };
152
-
153
- /** Data needed to register a live update to be managed */
154
-
155
- /** Used for communicating sync results of multiple live updates */
156
- exports.getPortal = getPortal;
157
- /**
158
- * Configures LiveUpdates to cyrptographically verify the contents of the downloaded bundles.
159
- * This method must be called before any LiveUpdates are registered otherwise they will no longer be tracked.
160
- *
161
- * @param pathToKey The *relative* path to the public key for verification.
162
- * This path should be the same relatibe to the main application bundle on iOS and the assets directory on Android.
163
- * @returns Promise<void>
164
- */
165
- const enableSecureLiveUpdates = async pathToKey => {
166
- return IONPortalsReactNative.enableSecureLiveUpdates(pathToKey);
167
- };
168
-
169
- /**
170
- * Syncs a single live update.
171
- *
172
- * @param appId The AppFlow application ID to sync.
173
- * @returns A Promise<LiveUpdate>. A failure should result in a {@link LiveUpdateError}.
174
- */
175
- exports.enableSecureLiveUpdates = enableSecureLiveUpdates;
176
- const syncOne = async appId => {
177
- return IONPortalsReactNative.syncOne(appId);
178
- };
179
-
180
- /**
181
- * Syncs many live updates.
182
- *
183
- * @param appIds The AppFlow application IDs to sync.
184
- * @returns Promise<SyncResults>
185
- */
186
- exports.syncOne = syncOne;
187
- const syncSome = async appIds => {
188
- return IONPortalsReactNative.syncSome(appIds);
189
- };
190
-
191
- /**
192
- * Syncs all registered LiveUpdates
193
- * @returns Promise<SyncResults>
194
- */
195
- exports.syncSome = syncSome;
196
- const syncAll = async () => {
197
- return IONPortalsReactNative.syncAll();
198
- };
199
- exports.syncAll = syncAll;
200
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_reactNative","require","_PortalView","_interopRequireDefault","obj","__esModule","default","IONPortalPubSub","IONPortalsReactNative","IONPortalsWebVitals","NativeModules","PortalsPubSub","NativeEventEmitter","subscribe","topic","onMessageReceived","addListener","message","exports","publish","data","msg","webVitalsMap","Map","WebVitals","onFirstContentfulPaint","portalName","callback","listener","event","duration","registerOnFirstContentfulPaint","set","onFirstInputDelay","Platform","OS","registerOnFirstInputDelay","onTimeToFirstByte","registerOnTimeToFirstByte","registerWebVitals","firstContentfulPaint","firstInputDelay","timeToFirstByte","register","key","addPortal","portal","addPortals","portals","getPortal","name","enableSecureLiveUpdates","pathToKey","syncOne","appId","syncSome","appIds","syncAll"],"sources":["index.ts"],"sourcesContent":["import {\n EmitterSubscription,\n NativeEventEmitter,\n NativeModules,\n Platform,\n ViewProps,\n} from 'react-native';\n\nconst { IONPortalPubSub, IONPortalsReactNative, IONPortalsWebVitals } =\n NativeModules;\n\nexport { default as PortalView } from './PortalView';\n\n/**\n * The data that is received from a subscription event.\n */\nexport interface Message {\n /** The unique subscription reference received from {@link subscribe}*/\n subscriptionRef: number;\n data: any;\n /** The topic the message was sent from */\n topic: string;\n}\n\nconst PortalsPubSub = new NativeEventEmitter(IONPortalPubSub);\n\n// const subscriptionMap = new Map<number, EmitterSubscription>();\n\n/**\n * Subscribes to messages for a topic\n *\n * @param topic The topic to subscribe to\n * @param onMessageReceived The callback to invoke when a message is received\n * @returns A Promise<number> containing the unique subscription reference. This will need to be stored for calling {@link unsubscribe}.\n */\nexport const subscribe = (\n topic: string,\n onMessageReceived: (message: Message) => void\n): EmitterSubscription => {\n return PortalsPubSub.addListener(\n `PortalsSubscription:${topic}`,\n (message: Message) => {\n onMessageReceived(message);\n }\n );\n};\n\n/**\n * Publishes a message to the provided topic\n *\n * @param topic The topic to publish the message to\n * @param data The data to publish to subscribers\n */\nexport const publish = (topic: string, data: any) => {\n const msg = { message: data };\n IONPortalPubSub.publish(topic, msg);\n};\n\nconst webVitalsMap = new Map<string, EmitterSubscription>();\nconst WebVitals = new NativeEventEmitter(IONPortalsWebVitals);\n\ninterface WebVitalsEvent {\n portalName: string;\n duration: number;\n}\n\nexport const onFirstContentfulPaint = async (\n portalName: string,\n callback: (duration: number) => void\n): Promise<void> => {\n const listener = WebVitals.addListener(\n 'vitals:fcp',\n (event: WebVitalsEvent) => {\n if (event.portalName === portalName) {\n callback(event.duration);\n }\n }\n );\n\n await IONPortalsWebVitals.registerOnFirstContentfulPaint(portalName);\n webVitalsMap.set(`${portalName}-vitals:fcp`, listener);\n};\n\nexport const onFirstInputDelay = async (\n portalName: string,\n callback: (duration: number) => void\n) => {\n if (Platform.OS === 'android') {\n const listener = WebVitals.addListener(\n 'vitals:fid',\n (event: WebVitalsEvent) => {\n if (event.portalName === portalName) {\n callback(event.duration);\n }\n }\n );\n\n await IONPortalsWebVitals.registerOnFirstInputDelay(portalName);\n webVitalsMap.set(`${portalName}-vitals:fid`, listener);\n }\n};\n\nexport const onTimeToFirstByte = async (\n portalName: string,\n callback: (duration: number) => void\n) => {\n if (Platform.OS === 'android') {\n const listener = WebVitals.addListener(\n 'vitals:ttfb',\n (event: WebVitalsEvent) => {\n if (event.portalName === portalName) {\n callback(event.duration);\n }\n }\n );\n\n await IONPortalsWebVitals.registerOnTimeToFirstByte(portalName);\n webVitalsMap.set(`${portalName}-vitals:ttfb`, listener);\n }\n};\n\nexport const registerWebVitals = async (\n portalName: string,\n firstContentfulPaint: (duration: number) => void,\n firstInputDelay: (duration: number) => void,\n timeToFirstByte: (duration: number) => void\n) => {\n onFirstContentfulPaint(portalName, firstContentfulPaint);\n onFirstInputDelay(portalName, firstInputDelay);\n onTimeToFirstByte(portalName, timeToFirstByte);\n};\n\n/**\n * Validates that a valid registration key has been procured from http://ionic.io/register-portals\n * @param key The registration key\n * @returns Promise<void>\n */\nexport const register = async (key: string): Promise<void> => {\n return IONPortalsReactNative.register(key);\n};\n\n/**\n * The configuration of a web application to be embedded in a React Native application.\n */\nexport interface Portal {\n /** The name of the Portal to be referenced. Must be **unique** */\n name: string;\n /** Any Capacitor plugins to be made available to the Portal */\n plugins?: CapacitorPlugin[];\n /**\n * The root directory of the web application relative to Bundle.main on iOS\n * and src/main/assets on Android. If omitted, `name` is used.\n */\n startDir?: string;\n /** The name of the initial file to load. If omitted, 'index.html' is used. */\n index?: string;\n /** Any data needed at initial render when a portal is loaded. */\n initialContext?: {\n [key: string]: any;\n };\n assetMaps?: AssetMap[];\n liveUpdate?: LiveUpdateConfig;\n}\n\nexport interface CapacitorPlugin {\n /** The classpath of the plugin to be used in Android. (e.g. com.capacitorjs.plugins.camera.CameraPlugin) */\n androidClassPath: string;\n /** The class name of the plugin to be used in iOS.\n * This must be the name as it is exposed to the Objective-C runtime.\n * For example, The CameraPlugin swift class is exposed to Objective-C as CAPCameraPlugin.\n */\n iosClassName: string;\n}\n\nexport interface AssetMap {\n /** The name to index the asset map by */\n name: string;\n /** Any path to match via the web. If omitted, {@link AssetMap#name} will be used. */\n virtualPath?: string;\n /** The root directory of the assets relative to Bundle.main on iOS\n * and src/main/assets on Android. If omitted, the root of Bundle.main\n * and src/main/assets will be used.\n */\n startDir?: string;\n}\n\n/**\n * A subset of {@link Portal} properties needed for rendering a Portal. `initialContext` can be used to override\n * any initialContext defined in the original {@link Portal} definition.\n */\nexport type PortalProp = {\n portal: Pick<Portal, 'name' | 'initialContext'>;\n};\n\n/**\n * Props needed for rendering a {@link Portal}\n */\nexport type PortalProps = PortalProp & ViewProps;\n\n/**\n * Adds a Portal to an internal registry. Must be called before attempting to render a {@link PortalView}.\n *\n * @param portal The portal to add to the internal registry.\n * @returns Promise containing the Portal that was added to the registry.\n */\nexport const addPortal = async (portal: Portal): Promise<Portal> => {\n return IONPortalsReactNative.addPortal(portal);\n};\n\n/**\n * Adds all portals to an internal registry. This or {@link addPortal} must be called before attempting to render a {@link PortalView}\n *\n * @param portals The portals to add to the internal registry.\n * @returns Promise containing the Portals that were added to the registry.\n */\nexport const addPortals = async (portals: Portal[]): Promise<Portal[]> => {\n return IONPortalsReactNative.addPortals(portals);\n};\n\n/**\n * Gets a {@link Portal} previously registered via {@link addPortal} or {@link addPortals}.\n *\n * @param name The portal name to retrieve from the internal registry.\n * @returns Promise containing the registered {@link Portal}. If the {@link Portal} was not registered, the Promise will fail.\n */\nexport const getPortal = async (name: string): Promise<Portal> => {\n return IONPortalsReactNative.getPortal(name);\n};\n\nexport interface LiveUpdate {\n /** The AppFlow application ID */\n appId: string;\n /** The AppFlow distribution channel */\n channel: string;\n}\n\n/** Data needed to register a live update to be managed */\nexport type LiveUpdateConfig = LiveUpdate & { syncOnAdd: boolean };\n\nexport interface LiveUpdateError {\n /** The AppFlow application ID relating to the failure */\n appId: string;\n /** The step in the sync process the LiveUpdate failed on. (e.g. CHECK, UNPACK)*/\n failStep: string;\n /** A human readable error message */\n message: string;\n}\n\nexport interface Snapshot {\n /** The snapshot id as found in AppFlow */\n id: string;\n /** The AppFlow build id that produced the snapshot */\n buildId: string;\n}\n\nexport interface SyncResult {\n /** The {@link LiveUpdate} associated with the result */\n liveUpdate: LiveUpdate;\n /** The {@link Snapshot} that was sync'd */\n snapshot: Snapshot | null;\n /** Whether the snapshot was downloaded or already on disk */\n source: 'download' | 'cache';\n /** If the active application path was changed. A `false` value would indicate\n * the application already has the latest code for the associated {@link LiveUpdate}\n * configuration.\n */\n activeApplicationPathChanged: boolean;\n}\n\n/** Used for communicating sync results of multiple live updates */\nexport interface SyncResults {\n results: SyncResult[];\n errors: LiveUpdateError[];\n}\n\n/**\n * Configures LiveUpdates to cyrptographically verify the contents of the downloaded bundles.\n * This method must be called before any LiveUpdates are registered otherwise they will no longer be tracked.\n *\n * @param pathToKey The *relative* path to the public key for verification.\n * This path should be the same relatibe to the main application bundle on iOS and the assets directory on Android.\n * @returns Promise<void>\n */\nexport const enableSecureLiveUpdates = async (\n pathToKey: string\n): Promise<void> => {\n return IONPortalsReactNative.enableSecureLiveUpdates(pathToKey);\n};\n\n/**\n * Syncs a single live update.\n *\n * @param appId The AppFlow application ID to sync.\n * @returns A Promise<LiveUpdate>. A failure should result in a {@link LiveUpdateError}.\n */\nexport const syncOne = async (appId: string): Promise<SyncResult> => {\n return IONPortalsReactNative.syncOne(appId);\n};\n\n/**\n * Syncs many live updates.\n *\n * @param appIds The AppFlow application IDs to sync.\n * @returns Promise<SyncResults>\n */\nexport const syncSome = async (appIds: string[]): Promise<SyncResults> => {\n return IONPortalsReactNative.syncSome(appIds);\n};\n\n/**\n * Syncs all registered LiveUpdates\n * @returns Promise<SyncResults>\n */\nexport const syncAll = async (): Promise<SyncResults> => {\n return IONPortalsReactNative.syncAll();\n};\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAWA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAqD,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAHrD,MAAM;EAAEG,eAAe;EAAEC,qBAAqB;EAAEC;AAAoB,CAAC,GACnEC,0BAAa;AAIf;AACA;AACA;;AASA,MAAMC,aAAa,GAAG,IAAIC,+BAAkB,CAACL,eAAe,CAAC;;AAE7D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMM,SAAS,GAAGA,CACvBC,KAAa,EACbC,iBAA6C,KACrB;EACxB,OAAOJ,aAAa,CAACK,WAAW,CAC7B,uBAAsBF,KAAM,EAAC,EAC7BG,OAAgB,IAAK;IACpBF,iBAAiB,CAACE,OAAO,CAAC;EAC5B,CACF,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALAC,OAAA,CAAAL,SAAA,GAAAA,SAAA;AAMO,MAAMM,OAAO,GAAGA,CAACL,KAAa,EAAEM,IAAS,KAAK;EACnD,MAAMC,GAAG,GAAG;IAAEJ,OAAO,EAAEG;EAAK,CAAC;EAC7Bb,eAAe,CAACY,OAAO,CAACL,KAAK,EAAEO,GAAG,CAAC;AACrC,CAAC;AAACH,OAAA,CAAAC,OAAA,GAAAA,OAAA;AAEF,MAAMG,YAAY,GAAG,IAAIC,GAAG,CAA8B,CAAC;AAC3D,MAAMC,SAAS,GAAG,IAAIZ,+BAAkB,CAACH,mBAAmB,CAAC;AAOtD,MAAMgB,sBAAsB,GAAG,MAAAA,CACpCC,UAAkB,EAClBC,QAAoC,KAClB;EAClB,MAAMC,QAAQ,GAAGJ,S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AA,SAAA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,uBAAuB,GAAG,MACrCC,SAAiB,IACC;EAClB,OAAO5C,qBAAqB,CAAC2C,uBAAuB,CAACC,SAAS,CAAC;AACjE,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALAlC,OAAA,CAAAiC,uBAAA,GAAAA,uBAAA;AAMO,MAAME,OAAO,GAAG,MAAOC,KAAa,IAA0B;EACnE,OAAO9C,qBAAqB,CAAC6C,OAAO,CAACC,KAAK,CAAC;AAC7C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALApC,OAAA,CAAAmC,OAAA,GAAAA,OAAA;AAMO,MAAME,QAAQ,GAAG,MAAOC,MAAgB,IAA2B;EACxE,OAAOhD,qBAAqB,CAAC+C,QAAQ,CAACC,MAAM,CAAC;AAC/C,CAAC;;AAED;AACA;AACA;AACA;AAHAtC,OAAA,CAAAqC,QAAA,GAAAA,QAAA;AAIO,MAAME,OAAO,GAAG,MAAAA,CAAA,KAAkC;EACvD,OAAOjD,qBAAqB,CAACiD,OAAO,CAAC,CAAC;AACxC,CAAC;AAACvC,OAAA,CAAAuC,OAAA,GAAAA,OAAA","ignoreList":[]}
@@ -1,20 +0,0 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- import React, { useEffect, useRef } from 'react';
3
- import { findNodeHandle, requireNativeComponent, UIManager } from 'react-native';
4
- const PortalViewManager = requireNativeComponent('AndroidPortalView');
5
- const createFragment = viewId => UIManager.dispatchViewManagerCommand(viewId,
6
- // we are calling the 'create' command
7
- // @ts-expect-error
8
- UIManager.AndroidPortalView.Commands.create.toString(), [viewId]);
9
- const PortalView = props => {
10
- const ref = useRef(null);
11
- useEffect(() => {
12
- const viewId = findNodeHandle(ref.current);
13
- createFragment(viewId);
14
- }, []);
15
- return /*#__PURE__*/React.createElement(PortalViewManager, _extends({}, props, {
16
- ref: ref
17
- }));
18
- };
19
- export default PortalView;
20
- //# sourceMappingURL=PortalView.android.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","useEffect","useRef","findNodeHandle","requireNativeComponent","UIManager","PortalViewManager","createFragment","viewId","dispatchViewManagerCommand","AndroidPortalView","Commands","create","toString","PortalView","props","ref","current","createElement","_extends"],"sources":["PortalView.android.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport {\n findNodeHandle,\n requireNativeComponent,\n UIManager,\n} from 'react-native';\nimport type { PortalProps } from '.';\n\nconst PortalViewManager = requireNativeComponent('AndroidPortalView');\n\nconst createFragment = (viewId: number | null) =>\n UIManager.dispatchViewManagerCommand(\n viewId,\n // we are calling the 'create' command\n // @ts-expect-error\n UIManager.AndroidPortalView.Commands.create.toString(),\n [viewId]\n );\n\nconst PortalView = (props: PortalProps) => {\n const ref = useRef(null);\n\n useEffect(() => {\n const viewId = findNodeHandle(ref.current);\n createFragment(viewId);\n }, []);\n\n return <PortalViewManager {...props} ref={ref} />;\n};\n\nexport default PortalView;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAChD,SACEC,cAAc,EACdC,sBAAsB,EACtBC,SAAS,QACJ,cAAc;AAGrB,MAAMC,iBAAiB,GAAGF,sBAAsB,CAAC,mBAAmB,CAAC;AAErE,MAAMG,cAAc,GAAIC,MAAqB,IAC3CH,SAAS,CAACI,0BAA0B,CAClCD,MAAM;AACN;AACA;AACAH,SAAS,CAACK,iBAAiB,CAACC,QAAQ,CAACC,MAAM,CAACC,QAAQ,CAAC,CAAC,EACtD,CAACL,MAAM,CACT,CAAC;AAEH,MAAMM,UAAU,GAAIC,KAAkB,IAAK;EACzC,MAAMC,GAAG,GAAGd,MAAM,CAAC,IAAI,CAAC;EAExBD,SAAS,CAAC,MAAM;IACd,MAAMO,MAAM,GAAGL,cAAc,CAACa,GAAG,CAACC,OAAO,CAAC;IAC1CV,cAAc,CAACC,MAAM,CAAC;EACxB,CAAC,EAAE,EAAE,CAAC;EAEN,oBAAOR,KAAA,CAAAkB,aAAA,CAACZ,iBAAiB,EAAAa,QAAA,KAAKJ,KAAK;IAAEC,GAAG,EAAEA;EAAI,EAAE,CAAC;AACnD,CAAC;AAED,eAAeF,UAAU","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import { requireNativeComponent } from 'react-native';
3
- const HostComponentPortal = requireNativeComponent('IONPortalView');
4
- const PortalView = props => {
5
- return /*#__PURE__*/React.createElement(HostComponentPortal, props);
6
- };
7
- export default PortalView;
8
- //# sourceMappingURL=PortalView.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","requireNativeComponent","HostComponentPortal","PortalView","props","createElement"],"sources":["PortalView.tsx"],"sourcesContent":["import React from 'react';\nimport { requireNativeComponent } from 'react-native';\nimport type { PortalProps } from '.';\n\nconst HostComponentPortal = requireNativeComponent('IONPortalView');\n\nconst PortalView = (props: PortalProps) => {\n return <HostComponentPortal {...props} />;\n};\n\nexport default PortalView;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,sBAAsB,QAAQ,cAAc;AAGrD,MAAMC,mBAAmB,GAAGD,sBAAsB,CAAC,eAAe,CAAC;AAEnE,MAAME,UAAU,GAAIC,KAAkB,IAAK;EACzC,oBAAOJ,KAAA,CAAAK,aAAA,CAACH,mBAAmB,EAAKE,KAAQ,CAAC;AAC3C,CAAC;AAED,eAAeD,UAAU","ignoreList":[]}
@@ -1,176 +0,0 @@
1
- import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
2
- const {
3
- IONPortalPubSub,
4
- IONPortalsReactNative,
5
- IONPortalsWebVitals
6
- } = NativeModules;
7
- export { default as PortalView } from './PortalView';
8
-
9
- /**
10
- * The data that is received from a subscription event.
11
- */
12
-
13
- const PortalsPubSub = new NativeEventEmitter(IONPortalPubSub);
14
-
15
- // const subscriptionMap = new Map<number, EmitterSubscription>();
16
-
17
- /**
18
- * Subscribes to messages for a topic
19
- *
20
- * @param topic The topic to subscribe to
21
- * @param onMessageReceived The callback to invoke when a message is received
22
- * @returns A Promise<number> containing the unique subscription reference. This will need to be stored for calling {@link unsubscribe}.
23
- */
24
- export const subscribe = (topic, onMessageReceived) => {
25
- return PortalsPubSub.addListener(`PortalsSubscription:${topic}`, message => {
26
- onMessageReceived(message);
27
- });
28
- };
29
-
30
- /**
31
- * Publishes a message to the provided topic
32
- *
33
- * @param topic The topic to publish the message to
34
- * @param data The data to publish to subscribers
35
- */
36
- export const publish = (topic, data) => {
37
- const msg = {
38
- message: data
39
- };
40
- IONPortalPubSub.publish(topic, msg);
41
- };
42
- const webVitalsMap = new Map();
43
- const WebVitals = new NativeEventEmitter(IONPortalsWebVitals);
44
- export const onFirstContentfulPaint = async (portalName, callback) => {
45
- const listener = WebVitals.addListener('vitals:fcp', event => {
46
- if (event.portalName === portalName) {
47
- callback(event.duration);
48
- }
49
- });
50
- await IONPortalsWebVitals.registerOnFirstContentfulPaint(portalName);
51
- webVitalsMap.set(`${portalName}-vitals:fcp`, listener);
52
- };
53
- export const onFirstInputDelay = async (portalName, callback) => {
54
- if (Platform.OS === 'android') {
55
- const listener = WebVitals.addListener('vitals:fid', event => {
56
- if (event.portalName === portalName) {
57
- callback(event.duration);
58
- }
59
- });
60
- await IONPortalsWebVitals.registerOnFirstInputDelay(portalName);
61
- webVitalsMap.set(`${portalName}-vitals:fid`, listener);
62
- }
63
- };
64
- export const onTimeToFirstByte = async (portalName, callback) => {
65
- if (Platform.OS === 'android') {
66
- const listener = WebVitals.addListener('vitals:ttfb', event => {
67
- if (event.portalName === portalName) {
68
- callback(event.duration);
69
- }
70
- });
71
- await IONPortalsWebVitals.registerOnTimeToFirstByte(portalName);
72
- webVitalsMap.set(`${portalName}-vitals:ttfb`, listener);
73
- }
74
- };
75
- export const registerWebVitals = async (portalName, firstContentfulPaint, firstInputDelay, timeToFirstByte) => {
76
- onFirstContentfulPaint(portalName, firstContentfulPaint);
77
- onFirstInputDelay(portalName, firstInputDelay);
78
- onTimeToFirstByte(portalName, timeToFirstByte);
79
- };
80
-
81
- /**
82
- * Validates that a valid registration key has been procured from http://ionic.io/register-portals
83
- * @param key The registration key
84
- * @returns Promise<void>
85
- */
86
- export const register = async key => {
87
- return IONPortalsReactNative.register(key);
88
- };
89
-
90
- /**
91
- * The configuration of a web application to be embedded in a React Native application.
92
- */
93
-
94
- /**
95
- * A subset of {@link Portal} properties needed for rendering a Portal. `initialContext` can be used to override
96
- * any initialContext defined in the original {@link Portal} definition.
97
- */
98
-
99
- /**
100
- * Props needed for rendering a {@link Portal}
101
- */
102
-
103
- /**
104
- * Adds a Portal to an internal registry. Must be called before attempting to render a {@link PortalView}.
105
- *
106
- * @param portal The portal to add to the internal registry.
107
- * @returns Promise containing the Portal that was added to the registry.
108
- */
109
- export const addPortal = async portal => {
110
- return IONPortalsReactNative.addPortal(portal);
111
- };
112
-
113
- /**
114
- * Adds all portals to an internal registry. This or {@link addPortal} must be called before attempting to render a {@link PortalView}
115
- *
116
- * @param portals The portals to add to the internal registry.
117
- * @returns Promise containing the Portals that were added to the registry.
118
- */
119
- export const addPortals = async portals => {
120
- return IONPortalsReactNative.addPortals(portals);
121
- };
122
-
123
- /**
124
- * Gets a {@link Portal} previously registered via {@link addPortal} or {@link addPortals}.
125
- *
126
- * @param name The portal name to retrieve from the internal registry.
127
- * @returns Promise containing the registered {@link Portal}. If the {@link Portal} was not registered, the Promise will fail.
128
- */
129
- export const getPortal = async name => {
130
- return IONPortalsReactNative.getPortal(name);
131
- };
132
-
133
- /** Data needed to register a live update to be managed */
134
-
135
- /** Used for communicating sync results of multiple live updates */
136
-
137
- /**
138
- * Configures LiveUpdates to cyrptographically verify the contents of the downloaded bundles.
139
- * This method must be called before any LiveUpdates are registered otherwise they will no longer be tracked.
140
- *
141
- * @param pathToKey The *relative* path to the public key for verification.
142
- * This path should be the same relatibe to the main application bundle on iOS and the assets directory on Android.
143
- * @returns Promise<void>
144
- */
145
- export const enableSecureLiveUpdates = async pathToKey => {
146
- return IONPortalsReactNative.enableSecureLiveUpdates(pathToKey);
147
- };
148
-
149
- /**
150
- * Syncs a single live update.
151
- *
152
- * @param appId The AppFlow application ID to sync.
153
- * @returns A Promise<LiveUpdate>. A failure should result in a {@link LiveUpdateError}.
154
- */
155
- export const syncOne = async appId => {
156
- return IONPortalsReactNative.syncOne(appId);
157
- };
158
-
159
- /**
160
- * Syncs many live updates.
161
- *
162
- * @param appIds The AppFlow application IDs to sync.
163
- * @returns Promise<SyncResults>
164
- */
165
- export const syncSome = async appIds => {
166
- return IONPortalsReactNative.syncSome(appIds);
167
- };
168
-
169
- /**
170
- * Syncs all registered LiveUpdates
171
- * @returns Promise<SyncResults>
172
- */
173
- export const syncAll = async () => {
174
- return IONPortalsReactNative.syncAll();
175
- };
176
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["NativeEventEmitter","NativeModules","Platform","IONPortalPubSub","IONPortalsReactNative","IONPortalsWebVitals","default","PortalView","PortalsPubSub","subscribe","topic","onMessageReceived","addListener","message","publish","data","msg","webVitalsMap","Map","WebVitals","onFirstContentfulPaint","portalName","callback","listener","event","duration","registerOnFirstContentfulPaint","set","onFirstInputDelay","OS","registerOnFirstInputDelay","onTimeToFirstByte","registerOnTimeToFirstByte","registerWebVitals","firstContentfulPaint","firstInputDelay","timeToFirstByte","register","key","addPortal","portal","addPortals","portals","getPortal","name","enableSecureLiveUpdates","pathToKey","syncOne","appId","syncSome","appIds","syncAll"],"sources":["index.ts"],"sourcesContent":["import {\n EmitterSubscription,\n NativeEventEmitter,\n NativeModules,\n Platform,\n ViewProps,\n} from 'react-native';\n\nconst { IONPortalPubSub, IONPortalsReactNative, IONPortalsWebVitals } =\n NativeModules;\n\nexport { default as PortalView } from './PortalView';\n\n/**\n * The data that is received from a subscription event.\n */\nexport interface Message {\n /** The unique subscription reference received from {@link subscribe}*/\n subscriptionRef: number;\n data: any;\n /** The topic the message was sent from */\n topic: string;\n}\n\nconst PortalsPubSub = new NativeEventEmitter(IONPortalPubSub);\n\n// const subscriptionMap = new Map<number, EmitterSubscription>();\n\n/**\n * Subscribes to messages for a topic\n *\n * @param topic The topic to subscribe to\n * @param onMessageReceived The callback to invoke when a message is received\n * @returns A Promise<number> containing the unique subscription reference. This will need to be stored for calling {@link unsubscribe}.\n */\nexport const subscribe = (\n topic: string,\n onMessageReceived: (message: Message) => void\n): EmitterSubscription => {\n return PortalsPubSub.addListener(\n `PortalsSubscription:${topic}`,\n (message: Message) => {\n onMessageReceived(message);\n }\n );\n};\n\n/**\n * Publishes a message to the provided topic\n *\n * @param topic The topic to publish the message to\n * @param data The data to publish to subscribers\n */\nexport const publish = (topic: string, data: any) => {\n const msg = { message: data };\n IONPortalPubSub.publish(topic, msg);\n};\n\nconst webVitalsMap = new Map<string, EmitterSubscription>();\nconst WebVitals = new NativeEventEmitter(IONPortalsWebVitals);\n\ninterface WebVitalsEvent {\n portalName: string;\n duration: number;\n}\n\nexport const onFirstContentfulPaint = async (\n portalName: string,\n callback: (duration: number) => void\n): Promise<void> => {\n const listener = WebVitals.addListener(\n 'vitals:fcp',\n (event: WebVitalsEvent) => {\n if (event.portalName === portalName) {\n callback(event.duration);\n }\n }\n );\n\n await IONPortalsWebVitals.registerOnFirstContentfulPaint(portalName);\n webVitalsMap.set(`${portalName}-vitals:fcp`, listener);\n};\n\nexport const onFirstInputDelay = async (\n portalName: string,\n callback: (duration: number) => void\n) => {\n if (Platform.OS === 'android') {\n const listener = WebVitals.addListener(\n 'vitals:fid',\n (event: WebVitalsEvent) => {\n if (event.portalName === portalName) {\n callback(event.duration);\n }\n }\n );\n\n await IONPortalsWebVitals.registerOnFirstInputDelay(portalName);\n webVitalsMap.set(`${portalName}-vitals:fid`, listener);\n }\n};\n\nexport const onTimeToFirstByte = async (\n portalName: string,\n callback: (duration: number) => void\n) => {\n if (Platform.OS === 'android') {\n const listener = WebVitals.addListener(\n 'vitals:ttfb',\n (event: WebVitalsEvent) => {\n if (event.portalName === portalName) {\n callback(event.duration);\n }\n }\n );\n\n await IONPortalsWebVitals.registerOnTimeToFirstByte(portalName);\n webVitalsMap.set(`${portalName}-vitals:ttfb`, listener);\n }\n};\n\nexport const registerWebVitals = async (\n portalName: string,\n firstContentfulPaint: (duration: number) => void,\n firstInputDelay: (duration: number) => void,\n timeToFirstByte: (duration: number) => void\n) => {\n onFirstContentfulPaint(portalName, firstContentfulPaint);\n onFirstInputDelay(portalName, firstInputDelay);\n onTimeToFirstByte(portalName, timeToFirstByte);\n};\n\n/**\n * Validates that a valid registration key has been procured from http://ionic.io/register-portals\n * @param key The registration key\n * @returns Promise<void>\n */\nexport const register = async (key: string): Promise<void> => {\n return IONPortalsReactNative.register(key);\n};\n\n/**\n * The configuration of a web application to be embedded in a React Native application.\n */\nexport interface Portal {\n /** The name of the Portal to be referenced. Must be **unique** */\n name: string;\n /** Any Capacitor plugins to be made available to the Portal */\n plugins?: CapacitorPlugin[];\n /**\n * The root directory of the web application relative to Bundle.main on iOS\n * and src/main/assets on Android. If omitted, `name` is used.\n */\n startDir?: string;\n /** The name of the initial file to load. If omitted, 'index.html' is used. */\n index?: string;\n /** Any data needed at initial render when a portal is loaded. */\n initialContext?: {\n [key: string]: any;\n };\n assetMaps?: AssetMap[];\n liveUpdate?: LiveUpdateConfig;\n}\n\nexport interface CapacitorPlugin {\n /** The classpath of the plugin to be used in Android. (e.g. com.capacitorjs.plugins.camera.CameraPlugin) */\n androidClassPath: string;\n /** The class name of the plugin to be used in iOS.\n * This must be the name as it is exposed to the Objective-C runtime.\n * For example, The CameraPlugin swift class is exposed to Objective-C as CAPCameraPlugin.\n */\n iosClassName: string;\n}\n\nexport interface AssetMap {\n /** The name to index the asset map by */\n name: string;\n /** Any path to match via the web. If omitted, {@link AssetMap#name} will be used. */\n virtualPath?: string;\n /** The root directory of the assets relative to Bundle.main on iOS\n * and src/main/assets on Android. If omitted, the root of Bundle.main\n * and src/main/assets will be used.\n */\n startDir?: string;\n}\n\n/**\n * A subset of {@link Portal} properties needed for rendering a Portal. `initialContext` can be used to override\n * any initialContext defined in the original {@link Portal} definition.\n */\nexport type PortalProp = {\n portal: Pick<Portal, 'name' | 'initialContext'>;\n};\n\n/**\n * Props needed for rendering a {@link Portal}\n */\nexport type PortalProps = PortalProp & ViewProps;\n\n/**\n * Adds a Portal to an internal registry. Must be called before attempting to render a {@link PortalView}.\n *\n * @param portal The portal to add to the internal registry.\n * @returns Promise containing the Portal that was added to the registry.\n */\nexport const addPortal = async (portal: Portal): Promise<Portal> => {\n return IONPortalsReactNative.addPortal(portal);\n};\n\n/**\n * Adds all portals to an internal registry. This or {@link addPortal} must be called before attempting to render a {@link PortalView}\n *\n * @param portals The portals to add to the internal registry.\n * @returns Promise containing the Portals that were added to the registry.\n */\nexport const addPortals = async (portals: Portal[]): Promise<Portal[]> => {\n return IONPortalsReactNative.addPortals(portals);\n};\n\n/**\n * Gets a {@link Portal} previously registered via {@link addPortal} or {@link addPortals}.\n *\n * @param name The portal name to retrieve from the internal registry.\n * @returns Promise containing the registered {@link Portal}. If the {@link Portal} was not registered, the Promise will fail.\n */\nexport const getPortal = async (name: string): Promise<Portal> => {\n return IONPortalsReactNative.getPortal(name);\n};\n\nexport interface LiveUpdate {\n /** The AppFlow application ID */\n appId: string;\n /** The AppFlow distribution channel */\n channel: string;\n}\n\n/** Data needed to register a live update to be managed */\nexport type LiveUpdateConfig = LiveUpdate & { syncOnAdd: boolean };\n\nexport interface LiveUpdateError {\n /** The AppFlow application ID relating to the failure */\n appId: string;\n /** The step in the sync process the LiveUpdate failed on. (e.g. CHECK, UNPACK)*/\n failStep: string;\n /** A human readable error message */\n message: string;\n}\n\nexport interface Snapshot {\n /** The snapshot id as found in AppFlow */\n id: string;\n /** The AppFlow build id that produced the snapshot */\n buildId: string;\n}\n\nexport interface SyncResult {\n /** The {@link LiveUpdate} associated with the result */\n liveUpdate: LiveUpdate;\n /** The {@link Snapshot} that was sync'd */\n snapshot: Snapshot | null;\n /** Whether the snapshot was downloaded or already on disk */\n source: 'download' | 'cache';\n /** If the active application path was changed. A `false` value would indicate\n * the application already has the latest code for the associated {@link LiveUpdate}\n * configuration.\n */\n activeApplicationPathChanged: boolean;\n}\n\n/** Used for communicating sync results of multiple live updates */\nexport interface SyncResults {\n results: SyncResult[];\n errors: LiveUpdateError[];\n}\n\n/**\n * Configures LiveUpdates to cyrptographically verify the contents of the downloaded bundles.\n * This method must be called before any LiveUpdates are registered otherwise they will no longer be tracked.\n *\n * @param pathToKey The *relative* path to the public key for verification.\n * This path should be the same relatibe to the main application bundle on iOS and the assets directory on Android.\n * @returns Promise<void>\n */\nexport const enableSecureLiveUpdates = async (\n pathToKey: string\n): Promise<void> => {\n return IONPortalsReactNative.enableSecureLiveUpdates(pathToKey);\n};\n\n/**\n * Syncs a single live update.\n *\n * @param appId The AppFlow application ID to sync.\n * @returns A Promise<LiveUpdate>. A failure should result in a {@link LiveUpdateError}.\n */\nexport const syncOne = async (appId: string): Promise<SyncResult> => {\n return IONPortalsReactNative.syncOne(appId);\n};\n\n/**\n * Syncs many live updates.\n *\n * @param appIds The AppFlow application IDs to sync.\n * @returns Promise<SyncResults>\n */\nexport const syncSome = async (appIds: string[]): Promise<SyncResults> => {\n return IONPortalsReactNative.syncSome(appIds);\n};\n\n/**\n * Syncs all registered LiveUpdates\n * @returns Promise<SyncResults>\n */\nexport const syncAll = async (): Promise<SyncResults> => {\n return IONPortalsReactNative.syncAll();\n};\n"],"mappings":"AAAA,SAEEA,kBAAkB,EAClBC,aAAa,EACbC,QAAQ,QAEH,cAAc;AAErB,MAAM;EAAEC,eAAe;EAAEC,qBAAqB;EAAEC;AAAoB,CAAC,GACnEJ,aAAa;AAEf,SAASK,OAAO,IAAIC,UAAU,QAAQ,cAAc;;AAEpD;AACA;AACA;;AASA,MAAMC,aAAa,GAAG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ACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAG,MAAOC,MAAc,IAAsB;EAClE,OAAOpC,qBAAqB,CAACmC,SAAS,CAACC,MAAM,CAAC;AAChD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAG,MAAOC,OAAiB,IAAwB;EACxE,OAAOtC,qBAAqB,CAACqC,UAAU,CAACC,OAAO,CAAC;AAClD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAG,MAAOC,IAAY,IAAsB;EAChE,OAAOxC,qBAAqB,CAACuC,SAAS,CAACC,IAAI,CAAC;AAC9C,CAAC;;AASD;;AAiCA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAG,MACrCC,SAAiB,IACC;EAClB,OAAO1C,qBAAqB,CAACyC,uBAAuB,CAACC,SAAS,CAAC;AACjE,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,OAAO,GAAG,MAAOC,KAAa,IAA0B;EACnE,OAAO5C,qBAAqB,CAAC2C,OAAO,CAACC,KAAK,CAAC;AAC7C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,GAAG,MAAOC,MAAgB,IAA2B;EACxE,OAAO9C,qBAAqB,CAAC6C,QAAQ,CAACC,MAAM,CAAC;AAC/C,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMC,OAAO,GAAG,MAAAA,CAAA,KAAkC;EACvD,OAAO/C,qBAAqB,CAAC+C,OAAO,CAAC,CAAC;AACxC,CAAC","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import type { PortalProps } from '.';
3
- declare const PortalView: (props: PortalProps) => React.JSX.Element;
4
- export default PortalView;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import type { PortalProps } from '.';
3
- declare const PortalView: (props: PortalProps) => React.JSX.Element;
4
- export default PortalView;