@ionic/portals-react-native 0.8.3 → 0.8.4

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.
@@ -1,11 +1,17 @@
1
1
  package io.ionic.portals.reactnative
2
2
 
3
+ import android.os.Handler
4
+ import android.os.Looper
3
5
  import android.util.Log
4
6
  import android.view.Choreographer
5
7
  import android.view.View
6
8
  import android.view.ViewGroup
9
+ import android.webkit.WebView
7
10
  import android.widget.FrameLayout
8
11
  import androidx.fragment.app.FragmentActivity
12
+ import androidx.lifecycle.Lifecycle
13
+ import androidx.lifecycle.LifecycleEventObserver
14
+ import androidx.lifecycle.LifecycleOwner
9
15
  import com.facebook.react.bridge.ReactApplicationContext
10
16
  import com.facebook.react.bridge.ReadableArray
11
17
  import com.facebook.react.bridge.ReadableMap
@@ -19,7 +25,8 @@ import io.ionic.portals.WebVitals
19
25
  private data class PortalViewState(
20
26
  var fragment: PortalFragment?,
21
27
  var portal: RNPortal?,
22
- var initialContext: HashMap<String, Any?>?
28
+ var initialContext: HashMap<String, Any?>?,
29
+ var webContentsDebuggingEnabled: Boolean?
23
30
  )
24
31
 
25
32
  internal class PortalViewManager(private val context: ReactApplicationContext) :
@@ -35,13 +42,19 @@ internal class PortalViewManager(private val context: ReactApplicationContext) :
35
42
  // Casting is safe and keeps old versions compatible
36
43
  val initialContext = portal.getMap("initialContext")?.toHashMap() as HashMap<String, Any?>?
37
44
 
38
- when (fragmentMap[viewGroup.id]) {
39
- null -> fragmentMap[viewGroup.id] = PortalViewState(
40
- fragment = null,
41
- portal = RNPortalManager.createPortal(portal),
42
- initialContext
43
- )
45
+ val state = fragmentMap.getOrPut(viewGroup.id) {
46
+ PortalViewState(null, null, null, null)
44
47
  }
48
+ state.portal = RNPortalManager.createPortal(portal)
49
+ state.initialContext = initialContext
50
+ }
51
+
52
+ @ReactProp(name = "webContentsDebuggingEnabled")
53
+ fun setWebContentsDebuggingEnabled(viewGroup: ViewGroup, webContentsDebuggingEnabled: Boolean) {
54
+ val state = fragmentMap.getOrPut(viewGroup.id) {
55
+ PortalViewState(null, null, null, null)
56
+ }
57
+ state.webContentsDebuggingEnabled = webContentsDebuggingEnabled
45
58
  }
46
59
 
47
60
  override fun getName() = "AndroidPortalView"
@@ -99,12 +112,26 @@ internal class PortalViewManager(private val context: ReactApplicationContext) :
99
112
  }
100
113
 
101
114
  val portalFragment = PortalFragment(portal)
102
-
103
115
  viewState.initialContext?.let(portalFragment::setInitialContext)
104
116
  viewState.fragment = portalFragment
105
117
 
106
- val fragmentActivity = context.currentActivity as? FragmentActivity ?: return
107
- fragmentActivity.supportFragmentManager
118
+ portalFragment.lifecycle.addObserver(object : LifecycleEventObserver {
119
+ override fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event) {
120
+ if (event == Lifecycle.Event.ON_RESUME) {
121
+ source.lifecycle.removeObserver(this)
122
+
123
+ viewState.webContentsDebuggingEnabled?.let { enabled ->
124
+ // Post to the next main loop iteration to avoid racing with WebView initialization
125
+ Handler(Looper.getMainLooper()).post {
126
+ WebView.setWebContentsDebuggingEnabled(enabled)
127
+ }
128
+ }
129
+ }
130
+ }
131
+ })
132
+
133
+ val activity = context.currentActivity as? FragmentActivity ?: return
134
+ activity.supportFragmentManager
108
135
  .beginTransaction()
109
136
  .replace(viewId, portalFragment, "$viewId")
110
137
  .commit()
package/ios/PortalView.mm CHANGED
@@ -10,4 +10,5 @@
10
10
 
11
11
  @interface RCT_EXTERN_MODULE(IONPortalViewManager, RCTViewManager)
12
12
  RCT_EXPORT_VIEW_PROPERTY(portal, NSDictionary)
13
+ RCT_EXPORT_VIEW_PROPERTY(webContentsDebuggingEnabled, BOOL)
13
14
  @end
@@ -61,7 +61,7 @@ class PortalView: UIView {
61
61
  DispatchQueue.main.async { [weak self] in
62
62
  guard let self = self else { return }
63
63
  self.webView?.removeFromSuperview()
64
- let webView = PortalUIView(portal: portal._portal)
64
+ let webView = PortalUIView(portal: portal._portal.configuring(\.isWebDebuggable, webContentsDebuggingEnabled))
65
65
  webView.translatesAutoresizingMaskIntoConstraints = false
66
66
  self.addSubview(webView)
67
67
  NSLayoutConstraint.activate([
@@ -74,4 +74,18 @@ class PortalView: UIView {
74
74
  }
75
75
  }
76
76
  }
77
+
78
+ @objc var webContentsDebuggingEnabled: Bool = {
79
+ #if DEBUG
80
+ true
81
+ #else
82
+ false
83
+ #endif
84
+ }() {
85
+ didSet {
86
+ if #available(iOS 16.4, *) {
87
+ self.webView?.bridge.webView?.isInspectable = webContentsDebuggingEnabled
88
+ }
89
+ }
90
+ }
77
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ionic/portals-react-native",
3
- "version": "0.8.3",
3
+ "version": "0.8.4",
4
4
  "description": "Portals for React Native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -161,4 +161,4 @@
161
161
  ]
162
162
  ]
163
163
  }
164
- }
164
+ }
package/src/index.tsx CHANGED
@@ -172,7 +172,11 @@ export interface AssetMap {
172
172
  /**
173
173
  * Props needed for rendering a {@link Portal}
174
174
  */
175
- export type PortalProps = { portal: Portal; webVitals?: WebVitals } & ViewProps;
175
+ export type PortalProps = {
176
+ portal: Portal;
177
+ webVitals?: WebVitals;
178
+ webContentsDebuggingEnabled?: boolean;
179
+ } & ViewProps;
176
180
 
177
181
  export interface LiveUpdate {
178
182
  /** The AppFlow application ID */
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _reactNative = require("react-native");
9
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
10
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
11
- const PortalViewManager = (0, _reactNative.requireNativeComponent)('AndroidPortalView');
12
- const createFragment = viewId => _reactNative.UIManager.dispatchViewManagerCommand(viewId,
13
- // we are calling the 'create' command
14
- // @ts-expect-error
15
- _reactNative.UIManager.AndroidPortalView.Commands.create.toString(), [viewId]);
16
- const BasePortalView = props => {
17
- const ref = (0, _react.useRef)(null);
18
- (0, _react.useEffect)(() => {
19
- const viewId = (0, _reactNative.findNodeHandle)(ref.current);
20
- createFragment(viewId);
21
- }, []);
22
- return /*#__PURE__*/_react.default.createElement(PortalViewManager, _extends({}, props, {
23
- ref: ref
24
- }));
25
- };
26
- var _default = exports.default = BasePortalView;
27
- //# sourceMappingURL=BasePortalView.android.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","PortalViewManager","requireNativeComponent","createFragment","viewId","UIManager","dispatchViewManagerCommand","AndroidPortalView","Commands","create","toString","BasePortalView","props","ref","useRef","useEffect","findNodeHandle","current","createElement","_default","exports"],"sourceRoot":"../../src","sources":["BasePortalView.android.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAIsB,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,O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aAAAC,CAAA,KAAAe,QAAA,CAAAK,KAAA,OAAAF,SAAA;AAEtB,MAAMG,iBAAiB,GAAG,IAAAC,mCAAsB,EAAC,mBAAmB,CAAC;AAErE,MAAMC,cAAc,GAAIC,MAAqB,IAC3CC,sBAAS,CAACC,0BAA0B,CAClCF,MAAM;AACN;AACA;AACAC,sBAAS,CAACE,iBAAiB,CAACC,QAAQ,CAACC,MAAM,CAACC,QAAQ,CAAC,CAAC,EACtD,CAACN,MAAM,CACT,CAAC;AAEH,MAAMO,cAAc,GAAIC,KAAU,IAAK;EACrC,MAAMC,GAAG,GAAG,IAAAC,aAAM,EAAC,IAAI,CAAC;EAExB,IAAAC,gBAAS,EAAC,MAAM;IACd,MAAMX,MAAM,GAAG,IAAAY,2BAAc,EAACH,GAAG,CAACI,OAAO,CAAC;IAC1Cd,cAAc,CAACC,MAAM,CAAC;EACxB,CAAC,EAAE,EAAE,CAAC;EAEN,oBAAOhC,MAAA,CAAAc,OAAA,CAAAgC,aAAA,CAACjB,iBAAiB,EAAAN,QAAA,KAAKiB,KAAK;IAAEC,GAAG,EAAEA;EAAI,EAAE,CAAC;AACnD,CAAC;AAAC,IAAAM,QAAA,GAAAC,OAAA,CAAAlC,OAAA,GAEayB,cAAc","ignoreList":[]}
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _reactNative = require("react-native");
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- const HostComponentPortal = (0, _reactNative.requireNativeComponent)('IONPortalView');
11
- const BasePortalView = props => {
12
- return /*#__PURE__*/_react.default.createElement(HostComponentPortal, props);
13
- };
14
- var _default = exports.default = BasePortalView;
15
- //# sourceMappingURL=BasePortalView.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","e","__esModule","default","HostComponentPortal","requireNativeComponent","BasePortalView","props","createElement","_default","exports"],"sourceRoot":"../../src","sources":["BasePortalView.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAAsD,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtD,MAAMG,mBAAmB,GAAG,IAAAC,mCAAsB,EAAC,eAAe,CAAC;AAEnE,MAAMC,cAAc,GAAIC,KAAU,IAAK;EACrC,oBAAOV,MAAA,CAAAM,OAAA,CAAAK,aAAA,CAACJ,mBAAmB,EAAKG,KAAQ,CAAC;AAC3C,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAP,OAAA,GAEaG,cAAc","ignoreList":[]}
@@ -1,150 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.syncSome = exports.syncOne = exports.syncAll = exports.subscribe = exports.register = exports.publish = exports.enableSecureLiveUpdates = exports.PortalView = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _reactNative = require("react-native");
9
- var _BasePortalView = _interopRequireDefault(require("./BasePortalView"));
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- const {
12
- IONPortalPubSub,
13
- IONPortalsReactNative,
14
- IONPortalsWebVitals
15
- } = _reactNative.NativeModules;
16
- const PortalView = props => {
17
- let webVitals;
18
- if (props.webVitals) {
19
- webVitals = [];
20
- if (props.webVitals.firstContentfulPaint) {
21
- webVitals.push('fcp');
22
- registerVital(props.portal.name, 'fcp', props.webVitals.firstContentfulPaint);
23
- }
24
- if (props.webVitals.firstInputDelay) {
25
- webVitals.push('fid');
26
- registerVital(props.portal.name, 'fid', props.webVitals.firstInputDelay);
27
- }
28
- if (props.webVitals.timeToFirstByte) {
29
- webVitals.push('ttfb');
30
- registerVital(props.portal.name, 'ttfb', props.webVitals.timeToFirstByte);
31
- }
32
- }
33
- const newProps = {
34
- ...props,
35
- webVitals: undefined
36
- };
37
- // @ts-ignore
38
- newProps.portal.webVitals = webVitals;
39
- return /*#__PURE__*/_react.default.createElement(_BasePortalView.default, newProps);
40
- };
41
-
42
- /**
43
- * The data that is received from a subscription event.
44
- */
45
- exports.PortalView = PortalView;
46
- const PortalsPubSub = new _reactNative.NativeEventEmitter(IONPortalPubSub);
47
-
48
- /**
49
- * Subscribes to messages for a topic
50
- *
51
- * @param topic The topic to subscribe to
52
- * @param onMessageReceived The callback to invoke when a message is received
53
- * @returns A Promise<number> containing the unique subscription reference. This will need to be stored for calling {@link unsubscribe}.
54
- */
55
- const subscribe = (topic, onMessageReceived) => {
56
- return PortalsPubSub.addListener(`PortalsSubscription:${topic}`, message => {
57
- onMessageReceived(message);
58
- });
59
- };
60
-
61
- /**
62
- * Publishes a message to the provided topic
63
- *
64
- * @param topic The topic to publish the message to
65
- * @param data The data to publish to subscribers
66
- */
67
- exports.subscribe = subscribe;
68
- const publish = (topic, data) => {
69
- const msg = {
70
- message: data
71
- };
72
- IONPortalPubSub.publish(topic, msg);
73
- };
74
- exports.publish = publish;
75
- const webVitalsMap = new Map();
76
- const WebVitals = new _reactNative.NativeEventEmitter(IONPortalsWebVitals);
77
- const registerVital = (portalName, vital, callback) => {
78
- if (_reactNative.Platform.OS === 'ios' && vital !== 'fcp') return;
79
- const listener = WebVitals.addListener(`vitals:${vital}`, event => {
80
- if (event.portalName === portalName) {
81
- callback(event.duration);
82
- }
83
- });
84
- webVitalsMap.set(`${portalName}-vitals:${vital}`, listener);
85
- };
86
- /**
87
- * Validates that a valid registration key has been procured from http://ionic.io/register-portals
88
- * @param key The registration key
89
- * @returns Promise<void>
90
- */
91
- const register = async key => {
92
- return IONPortalsReactNative.register(key);
93
- };
94
-
95
- /**
96
- * The configuration of a web application to be embedded in a React Native application.
97
- */
98
-
99
- /**
100
- * Props needed for rendering a {@link Portal}
101
- */
102
-
103
- /** Data needed to register a live update to be managed */
104
-
105
- /** Used for communicating sync results of multiple live updates */
106
- exports.register = register;
107
- /**
108
- * Configures LiveUpdates to cyrptographically verify the contents of the downloaded bundles.
109
- * This method must be called before any LiveUpdates are registered otherwise they will no longer be tracked.
110
- *
111
- * @param pathToKey The *relative* path to the public key for verification.
112
- * This path should be the same relatibe to the main application bundle on iOS and the assets directory on Android.
113
- * @returns Promise<void>
114
- */
115
- const enableSecureLiveUpdates = async pathToKey => {
116
- return IONPortalsReactNative.enableSecureLiveUpdates(pathToKey);
117
- };
118
-
119
- /**
120
- * Syncs a single live update.
121
- *
122
- * @param appId The AppFlow application ID to sync.
123
- * @returns A Promise<LiveUpdate>. A failure should result in a {@link LiveUpdateError}.
124
- */
125
- exports.enableSecureLiveUpdates = enableSecureLiveUpdates;
126
- const syncOne = async appId => {
127
- return IONPortalsReactNative.syncOne(appId);
128
- };
129
-
130
- /**
131
- * Syncs many live updates.
132
- *
133
- * @param appIds The AppFlow application IDs to sync.
134
- * @returns Promise<SyncResults>
135
- */
136
- exports.syncOne = syncOne;
137
- const syncSome = async appIds => {
138
- return IONPortalsReactNative.syncSome(appIds);
139
- };
140
-
141
- /**
142
- * Syncs all registered LiveUpdates
143
- * @returns Promise<SyncResults>
144
- */
145
- exports.syncSome = syncSome;
146
- const syncAll = async () => {
147
- return IONPortalsReactNative.syncAll();
148
- };
149
- exports.syncAll = syncAll;
150
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_BasePortalView","e","__esModule","default","IONPortalPubSub","IONPortalsReactNative","IONPortalsWebVitals","NativeModules","PortalView","props","webVitals","firstContentfulPaint","push","registerVital","portal","name","firstInputDelay","timeToFirstByte","newProps","undefined","createElement","exports","PortalsPubSub","NativeEventEmitter","subscribe","topic","onMessageReceived","addListener","message","publish","data","msg","webVitalsMap","Map","WebVitals","portalName","vital","callback","Platform","OS","listener","event","duration","set","register","key","enableSecureLiveUpdates","pathToKey","syncOne","appId","syncSome","appIds","syncAll"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C,MAAM;EAAEG,eAAe;EAAEC,qBAAqB;EAAEC;AAAoB,CAAC,GACnEC,0BAAa;AAER,MAAMC,UAAU,GAAIC,KAAkB,IAAK;EAChD,IAAIC,SAA+B;EACnC,IAAID,KAAK,CAACC,SAAS,EAAE;IACnBA,SAAS,GAAG,EAAE;IACd,IAAID,KAAK,CAACC,SAAS,CAACC,oBAAoB,EAAE;MACxCD,SAAS,CAACE,IAAI,CAAC,KAAK,CAAC;MACrBC,aAAa,CACXJ,KAAK,CAACK,MAAM,CAACC,IAAI,EACjB,KAAK,EACLN,KAAK,CAACC,SAAS,CAACC,oBAClB,CAAC;IACH;IACA,IAAIF,KAAK,CAACC,SAAS,CAACM,eAAe,EAAE;MACnCN,SAAS,CAACE,IAAI,CAAC,KAAK,CAAC;MACrBC,aAAa,CAACJ,KAAK,CAACK,MAAM,CAACC,IAAI,EAAE,KAAK,EAAEN,KAAK,CAACC,SAAS,CAACM,eAAe,CAAC;IAC1E;IACA,IAAIP,KAAK,CAACC,SAAS,CAACO,eAAe,EAAE;MACnCP,SAAS,CAACE,IAAI,CAAC,MAAM,CAAC;MACtBC,aAAa,CAACJ,KAAK,CAACK,MAAM,CAACC,IAAI,EAAE,MAAM,EAAEN,KAAK,CAACC,SAAS,CAACO,eAAe,CAAC;IAC3E;EACF;EAEA,MAAMC,QAAQ,GAAG;IAAE,GAAGT,KAAK;IAAEC,SAAS,EAAES;EAAU,CAAC;EACnD;EACAD,QAAQ,CAACJ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KAAK,CAACC,QAAQ,CAAC;IAC1B;EACF,CACF,CAAC;EAEDV,YAAY,CAACW,GAAG,CAAC,GAAGR,UAAU,WAAWC,KAAK,EAAE,EAAEI,QAAQ,CAAC;AAC7D,CAAC;AAQD;AACA;AACA;AACA;AACA;AACO,MAAMI,QAAQ,GAAG,MAAOC,GAAW,IAAoB;EAC5D,OAAOxC,qBAAqB,CAACuC,QAAQ,CAACC,GAAG,CAAC;AAC5C,CAAC;;AAED;AACA;AACA;;AA2CA;AACA;AACA;;AAUA;;AAiCA;AAAAxB,OAAA,CAAAuB,QAAA,GAAAA,QAAA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,uBAAuB,GAAG,MACrCC,SAAiB,IACC;EAClB,OAAO1C,qBAAqB,CAACyC,uBAAuB,CAACC,SAAS,CAAC;AACjE,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALA1B,OAAA,CAAAyB,uBAAA,GAAAA,uBAAA;AAMO,MAAME,OAAO,GAAG,MAAOC,KAAa,IAA0B;EACnE,OAAO5C,qBAAqB,CAAC2C,OAAO,CAACC,KAAK,CAAC;AAC7C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALA5B,OAAA,CAAA2B,OAAA,GAAAA,OAAA;AAMO,MAAME,QAAQ,GAAG,MAAOC,MAAgB,IAA2B;EACxE,OAAO9C,qBAAqB,CAAC6C,QAAQ,CAACC,MAAM,CAAC;AAC/C,CAAC;;AAED;AACA;AACA;AACA;AAHA9B,OAAA,CAAA6B,QAAA,GAAAA,QAAA;AAIO,MAAME,OAAO,GAAG,MAAAA,CAAA,KAAkC;EACvD,OAAO/C,qBAAqB,CAAC+C,OAAO,CAAC,CAAC;AACxC,CAAC;AAAC/B,OAAA,CAAA+B,OAAA,GAAAA,OAAA","ignoreList":[]}
@@ -1,20 +0,0 @@
1
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, 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 BasePortalView = 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 BasePortalView;
20
- //# sourceMappingURL=BasePortalView.android.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","useEffect","useRef","findNodeHandle","requireNativeComponent","UIManager","PortalViewManager","createFragment","viewId","dispatchViewManagerCommand","AndroidPortalView","Commands","create","toString","BasePortalView","props","ref","current","createElement","_extends"],"sourceRoot":"../../src","sources":["BasePortalView.android.tsx"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAChD,SACEC,cAAc,EACdC,sBAAsB,EACtBC,SAAS,QACJ,cAAc;AAErB,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,cAAc,GAAIC,KAAU,IAAK;EACrC,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,cAAc","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import { requireNativeComponent } from 'react-native';
3
- const HostComponentPortal = requireNativeComponent('IONPortalView');
4
- const BasePortalView = props => {
5
- return /*#__PURE__*/React.createElement(HostComponentPortal, props);
6
- };
7
- export default BasePortalView;
8
- //# sourceMappingURL=BasePortalView.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","requireNativeComponent","HostComponentPortal","BasePortalView","props","createElement"],"sourceRoot":"../../src","sources":["BasePortalView.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,sBAAsB,QAAQ,cAAc;AAErD,MAAMC,mBAAmB,GAAGD,sBAAsB,CAAC,eAAe,CAAC;AAEnE,MAAME,cAAc,GAAIC,KAAU,IAAK;EACrC,oBAAOJ,KAAA,CAAAK,aAAA,CAACH,mBAAmB,EAAKE,KAAQ,CAAC;AAC3C,CAAC;AAED,eAAeD,cAAc","ignoreList":[]}
@@ -1,137 +0,0 @@
1
- import React from 'react';
2
- import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
3
- import BasePortalView from './BasePortalView';
4
- const {
5
- IONPortalPubSub,
6
- IONPortalsReactNative,
7
- IONPortalsWebVitals
8
- } = NativeModules;
9
- export const PortalView = props => {
10
- let webVitals;
11
- if (props.webVitals) {
12
- webVitals = [];
13
- if (props.webVitals.firstContentfulPaint) {
14
- webVitals.push('fcp');
15
- registerVital(props.portal.name, 'fcp', props.webVitals.firstContentfulPaint);
16
- }
17
- if (props.webVitals.firstInputDelay) {
18
- webVitals.push('fid');
19
- registerVital(props.portal.name, 'fid', props.webVitals.firstInputDelay);
20
- }
21
- if (props.webVitals.timeToFirstByte) {
22
- webVitals.push('ttfb');
23
- registerVital(props.portal.name, 'ttfb', props.webVitals.timeToFirstByte);
24
- }
25
- }
26
- const newProps = {
27
- ...props,
28
- webVitals: undefined
29
- };
30
- // @ts-ignore
31
- newProps.portal.webVitals = webVitals;
32
- return /*#__PURE__*/React.createElement(BasePortalView, newProps);
33
- };
34
-
35
- /**
36
- * The data that is received from a subscription event.
37
- */
38
-
39
- const PortalsPubSub = new NativeEventEmitter(IONPortalPubSub);
40
-
41
- /**
42
- * Subscribes to messages for a topic
43
- *
44
- * @param topic The topic to subscribe to
45
- * @param onMessageReceived The callback to invoke when a message is received
46
- * @returns A Promise<number> containing the unique subscription reference. This will need to be stored for calling {@link unsubscribe}.
47
- */
48
- export const subscribe = (topic, onMessageReceived) => {
49
- return PortalsPubSub.addListener(`PortalsSubscription:${topic}`, message => {
50
- onMessageReceived(message);
51
- });
52
- };
53
-
54
- /**
55
- * Publishes a message to the provided topic
56
- *
57
- * @param topic The topic to publish the message to
58
- * @param data The data to publish to subscribers
59
- */
60
- export const publish = (topic, data) => {
61
- const msg = {
62
- message: data
63
- };
64
- IONPortalPubSub.publish(topic, msg);
65
- };
66
- const webVitalsMap = new Map();
67
- const WebVitals = new NativeEventEmitter(IONPortalsWebVitals);
68
- const registerVital = (portalName, vital, callback) => {
69
- if (Platform.OS === 'ios' && vital !== 'fcp') return;
70
- const listener = WebVitals.addListener(`vitals:${vital}`, event => {
71
- if (event.portalName === portalName) {
72
- callback(event.duration);
73
- }
74
- });
75
- webVitalsMap.set(`${portalName}-vitals:${vital}`, listener);
76
- };
77
- /**
78
- * Validates that a valid registration key has been procured from http://ionic.io/register-portals
79
- * @param key The registration key
80
- * @returns Promise<void>
81
- */
82
- export const register = async key => {
83
- return IONPortalsReactNative.register(key);
84
- };
85
-
86
- /**
87
- * The configuration of a web application to be embedded in a React Native application.
88
- */
89
-
90
- /**
91
- * Props needed for rendering a {@link Portal}
92
- */
93
-
94
- /** Data needed to register a live update to be managed */
95
-
96
- /** Used for communicating sync results of multiple live updates */
97
-
98
- /**
99
- * Configures LiveUpdates to cyrptographically verify the contents of the downloaded bundles.
100
- * This method must be called before any LiveUpdates are registered otherwise they will no longer be tracked.
101
- *
102
- * @param pathToKey The *relative* path to the public key for verification.
103
- * This path should be the same relatibe to the main application bundle on iOS and the assets directory on Android.
104
- * @returns Promise<void>
105
- */
106
- export const enableSecureLiveUpdates = async pathToKey => {
107
- return IONPortalsReactNative.enableSecureLiveUpdates(pathToKey);
108
- };
109
-
110
- /**
111
- * Syncs a single live update.
112
- *
113
- * @param appId The AppFlow application ID to sync.
114
- * @returns A Promise<LiveUpdate>. A failure should result in a {@link LiveUpdateError}.
115
- */
116
- export const syncOne = async appId => {
117
- return IONPortalsReactNative.syncOne(appId);
118
- };
119
-
120
- /**
121
- * Syncs many live updates.
122
- *
123
- * @param appIds The AppFlow application IDs to sync.
124
- * @returns Promise<SyncResults>
125
- */
126
- export const syncSome = async appIds => {
127
- return IONPortalsReactNative.syncSome(appIds);
128
- };
129
-
130
- /**
131
- * Syncs all registered LiveUpdates
132
- * @returns Promise<SyncResults>
133
- */
134
- export const syncAll = async () => {
135
- return IONPortalsReactNative.syncAll();
136
- };
137
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","NativeEventEmitter","NativeModules","Platform","BasePortalView","IONPortalPubSub","IONPortalsReactNative","IONPortalsWebVitals","PortalView","props","webVitals","firstContentfulPaint","push","registerVital","portal","name","firstInputDelay","timeToFirstByte","newProps","undefined","createElement","PortalsPubSub","subscribe","topic","onMessageReceived","addListener","message","publish","data","msg","webVitalsMap","Map","WebVitals","portalName","vital","callback","OS","listener","event","duration","set","register","key","enableSecureLiveUpdates","pathToKey","syncOne","appId","syncSome","appIds","syncAll"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAEEC,kBAAkB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;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAG,MACrCC,SAAiB,IACC;EAClB,OAAOtC,qBAAqB,CAACqC,uBAAuB,CAACC,SAAS,CAAC;AACjE,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,OAAO,GAAG,MAAOC,KAAa,IAA0B;EACnE,OAAOxC,qBAAqB,CAACuC,OAAO,CAACC,KAAK,CAAC;AAC7C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,GAAG,MAAOC,MAAgB,IAA2B;EACxE,OAAO1C,qBAAqB,CAACyC,QAAQ,CAACC,MAAM,CAAC;AAC/C,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMC,OAAO,GAAG,MAAAA,CAAA,KAAkC;EACvD,OAAO3C,qBAAqB,CAAC2C,OAAO,CAAC,CAAC;AACxC,CAAC","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- declare const BasePortalView: (props: any) => React.JSX.Element;
3
- export default BasePortalView;
4
- //# sourceMappingURL=BasePortalView.android.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BasePortalView.android.d.ts","sourceRoot":"","sources":["../../../src/BasePortalView.android.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAkBjD,QAAA,MAAM,cAAc,UAAW,GAAG,sBASjC,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- declare const BasePortalView: (props: any) => React.JSX.Element;
3
- export default BasePortalView;
4
- //# sourceMappingURL=BasePortalView.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BasePortalView.d.ts","sourceRoot":"","sources":["../../../src/BasePortalView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,QAAA,MAAM,cAAc,UAAW,GAAG,sBAEjC,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1,159 +0,0 @@
1
- import React from 'react';
2
- import { type EmitterSubscription, type ViewProps } from 'react-native';
3
- export declare const PortalView: (props: PortalProps) => React.JSX.Element;
4
- /**
5
- * The data that is received from a subscription event.
6
- */
7
- export interface Message {
8
- /** The unique subscription reference received from {@link subscribe}*/
9
- subscriptionRef: number;
10
- data: any;
11
- /** The topic the message was sent from */
12
- topic: string;
13
- }
14
- /**
15
- * Subscribes to messages for a topic
16
- *
17
- * @param topic The topic to subscribe to
18
- * @param onMessageReceived The callback to invoke when a message is received
19
- * @returns A Promise<number> containing the unique subscription reference. This will need to be stored for calling {@link unsubscribe}.
20
- */
21
- export declare const subscribe: (topic: string, onMessageReceived: (message: Message) => void) => EmitterSubscription;
22
- /**
23
- * Publishes a message to the provided topic
24
- *
25
- * @param topic The topic to publish the message to
26
- * @param data The data to publish to subscribers
27
- */
28
- export declare const publish: (topic: string, data: any) => void;
29
- export type WebVitals = {
30
- firstContentfulPaint?: (duration: number) => void;
31
- firstInputDelay?: (duration: number) => void;
32
- timeToFirstByte?: (duration: number) => void;
33
- };
34
- /**
35
- * Validates that a valid registration key has been procured from http://ionic.io/register-portals
36
- * @param key The registration key
37
- * @returns Promise<void>
38
- */
39
- export declare const register: (key: string) => Promise<void>;
40
- /**
41
- * The configuration of a web application to be embedded in a React Native application.
42
- */
43
- export interface Portal {
44
- /** The name of the Portal to be referenced. Must be **unique** */
45
- name: string;
46
- /** Any Capacitor plugins to be made available to the Portal */
47
- plugins?: CapacitorPlugin[];
48
- /**
49
- * The root directory of the web application relative to Bundle.main on iOS
50
- * and src/main/assets on Android. If omitted, `name` is used.
51
- */
52
- startDir?: string;
53
- /** The name of the initial file to load. If omitted, 'index.html' is used. */
54
- index?: string;
55
- /** Any data needed at initial render when a portal is loaded. */
56
- initialContext?: {
57
- [key: string]: any;
58
- };
59
- assetMaps?: AssetMap[];
60
- liveUpdate?: LiveUpdateConfig;
61
- }
62
- export interface CapacitorPlugin {
63
- /** The classpath of the plugin to be used in Android. (e.g. com.capacitorjs.plugins.camera.CameraPlugin) */
64
- androidClassPath: string;
65
- /** The class name of the plugin to be used in iOS.
66
- * This must be the name as it is exposed to the Objective-C runtime.
67
- * For example, The CameraPlugin swift class is exposed to Objective-C as CAPCameraPlugin.
68
- */
69
- iosClassName: string;
70
- }
71
- export interface AssetMap {
72
- /** The name to index the asset map by */
73
- name: string;
74
- /** Any path to match via the web. If omitted, {@link AssetMap#name} will be used. */
75
- virtualPath?: string;
76
- /** The root directory of the assets relative to Bundle.main on iOS
77
- * and src/main/assets on Android. If omitted, the root of Bundle.main
78
- * and src/main/assets will be used.
79
- */
80
- startDir?: string;
81
- }
82
- /**
83
- * Props needed for rendering a {@link Portal}
84
- */
85
- export type PortalProps = {
86
- portal: Portal;
87
- webVitals?: WebVitals;
88
- } & ViewProps;
89
- export interface LiveUpdate {
90
- /** The AppFlow application ID */
91
- appId: string;
92
- /** The AppFlow distribution channel */
93
- channel: string;
94
- }
95
- /** Data needed to register a live update to be managed */
96
- export type LiveUpdateConfig = LiveUpdate & {
97
- syncOnAdd: boolean;
98
- };
99
- export interface LiveUpdateError {
100
- /** The AppFlow application ID relating to the failure */
101
- appId: string;
102
- /** The step in the sync process the LiveUpdate failed on. (e.g. CHECK, UNPACK)*/
103
- failStep: string;
104
- /** A human readable error message */
105
- message: string;
106
- }
107
- export interface Snapshot {
108
- /** The snapshot id as found in AppFlow */
109
- id: string;
110
- /** The AppFlow build id that produced the snapshot */
111
- buildId: string;
112
- }
113
- export interface SyncResult {
114
- /** The {@link LiveUpdate} associated with the result */
115
- liveUpdate: LiveUpdate;
116
- /** The {@link Snapshot} that was sync'd */
117
- snapshot: Snapshot | null;
118
- /** Whether the snapshot was downloaded or already on disk */
119
- source: 'download' | 'cache';
120
- /** If the active application path was changed. A `false` value would indicate
121
- * the application already has the latest code for the associated {@link LiveUpdate}
122
- * configuration.
123
- */
124
- activeApplicationPathChanged: boolean;
125
- }
126
- /** Used for communicating sync results of multiple live updates */
127
- export interface SyncResults {
128
- results: SyncResult[];
129
- errors: LiveUpdateError[];
130
- }
131
- /**
132
- * Configures LiveUpdates to cyrptographically verify the contents of the downloaded bundles.
133
- * This method must be called before any LiveUpdates are registered otherwise they will no longer be tracked.
134
- *
135
- * @param pathToKey The *relative* path to the public key for verification.
136
- * This path should be the same relatibe to the main application bundle on iOS and the assets directory on Android.
137
- * @returns Promise<void>
138
- */
139
- export declare const enableSecureLiveUpdates: (pathToKey: string) => Promise<void>;
140
- /**
141
- * Syncs a single live update.
142
- *
143
- * @param appId The AppFlow application ID to sync.
144
- * @returns A Promise<LiveUpdate>. A failure should result in a {@link LiveUpdateError}.
145
- */
146
- export declare const syncOne: (appId: string) => Promise<SyncResult>;
147
- /**
148
- * Syncs many live updates.
149
- *
150
- * @param appIds The AppFlow application IDs to sync.
151
- * @returns Promise<SyncResults>
152
- */
153
- export declare const syncSome: (appIds: string[]) => Promise<SyncResults>;
154
- /**
155
- * Syncs all registered LiveUpdates
156
- * @returns Promise<SyncResults>
157
- */
158
- export declare const syncAll: () => Promise<SyncResults>;
159
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,KAAK,mBAAmB,EAIxB,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAMtB,eAAO,MAAM,UAAU,UAAW,WAAW,sBA2B5C,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,uEAAuE;IACvE,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,GAAG,CAAC;IACV,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;CACf;AAID;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,UACb,MAAM,+BACgB,OAAO,KAAK,IAAI,KAC5C,mBAOF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAA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