@digia-engage/core 1.0.0-beta.4 → 1.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DigiaEngageReactNative.podspec +24 -8
- package/README.md +8 -17
- package/android/.project +28 -0
- package/android/build.gradle +1 -1
- package/android/settings.gradle +1 -3
- package/android/src/main/java/com/digia/engage/rn/DigiaModule.kt +1 -1
- package/android/src/main/java/com/digia/engage/rn/DigiaSlotViewManager.kt +146 -31
- package/ios/DigiaEngageModule.m +25 -44
- package/ios/DigiaHostViewManager.swift +128 -0
- package/ios/DigiaModule.swift +241 -0
- package/ios/DigiaSlotViewManager.swift +275 -0
- package/ios/RNEventBridgePlugin.swift +71 -0
- package/lib/commonjs/Digia.js +50 -0
- package/lib/commonjs/Digia.js.map +1 -1
- package/lib/commonjs/DigiaHostView.js +6 -50
- package/lib/commonjs/DigiaHostView.js.map +1 -1
- package/lib/commonjs/DigiaSlotView.js +37 -54
- package/lib/commonjs/DigiaSlotView.js.map +1 -1
- package/lib/commonjs/NativeDigiaEngage.js.map +1 -1
- package/lib/module/Digia.js +50 -0
- package/lib/module/Digia.js.map +1 -1
- package/lib/module/DigiaHostView.js +6 -51
- package/lib/module/DigiaHostView.js.map +1 -1
- package/lib/module/DigiaSlotView.js +37 -52
- package/lib/module/DigiaSlotView.js.map +1 -1
- package/lib/module/NativeDigiaEngage.js.map +1 -1
- package/lib/typescript/Digia.d.ts +12 -0
- package/lib/typescript/Digia.d.ts.map +1 -1
- package/lib/typescript/DigiaHostView.d.ts +2 -28
- package/lib/typescript/DigiaHostView.d.ts.map +1 -1
- package/lib/typescript/DigiaSlotView.d.ts +3 -39
- package/lib/typescript/DigiaSlotView.d.ts.map +1 -1
- package/lib/typescript/NativeDigiaEngage.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +21 -0
- package/lib/typescript/types.d.ts.map +1 -1
- package/package.json +8 -18
- package/src/Digia.ts +60 -1
- package/src/DigiaHostView.tsx +7 -48
- package/src/DigiaSlotView.tsx +42 -49
- package/src/NativeDigiaEngage.ts +1 -0
- package/src/index.ts +1 -1
- package/src/types.ts +30 -0
|
@@ -10,64 +10,20 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
10
10
|
/**
|
|
11
11
|
* DigiaHostView
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* ─── Usage ───────────────────────────────────────────────────────────────────
|
|
17
|
-
* Place `<DigiaHostView>` at the **root** of your component tree so that
|
|
18
|
-
* Digia dialogs and bottom sheets can stack on top of all your content.
|
|
19
|
-
*
|
|
20
|
-
* ```tsx
|
|
21
|
-
* import React from 'react';
|
|
22
|
-
* import { StyleSheet, View } from 'react-native';
|
|
23
|
-
* import { DigiaHostView } from '@digia/engage-react-native';
|
|
24
|
-
*
|
|
25
|
-
* export default function App() {
|
|
26
|
-
* return (
|
|
27
|
-
* <View style={styles.root}>
|
|
28
|
-
* <DigiaHostView style={StyleSheet.absoluteFill} />
|
|
29
|
-
* {/ * your navigation / app content here * /}
|
|
30
|
-
* </View>
|
|
31
|
-
* );
|
|
32
|
-
* }
|
|
33
|
-
*
|
|
34
|
-
* const styles = StyleSheet.create({ root: { flex: 1 } });
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* On Android this mounts a Jetpack Compose `DigiaHost` composable that
|
|
38
|
-
* manages dialog + bottom-sheet presentation triggered by CEP plugins.
|
|
39
|
-
* On iOS the view is a transparent no-op until iOS support is implemented.
|
|
40
|
-
* ─────────────────────────────────────────────────────────────────────────────
|
|
13
|
+
* Transparent full-screen overlay that hosts Digia dialogs and bottom sheets.
|
|
14
|
+
* Place at the root of your component tree so overlays stack above all content.
|
|
41
15
|
*/
|
|
42
16
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
// Fabric (New Architecture) resolves view configs lazily — no UIManager
|
|
46
|
-
// guard needed. requireNativeComponent is called unconditionally on Android.
|
|
47
|
-
const NativeDigiaHostView = _reactNative.Platform.OS === 'android' ? (0, _reactNative.requireNativeComponent)('DigiaHostView') : null;
|
|
48
|
-
|
|
49
|
-
// ── DigiaHostView ─────────────────────────────────────────────────────────────
|
|
50
|
-
|
|
17
|
+
const NativeDigiaHostView = _reactNative.Platform.OS === 'android' || _reactNative.Platform.OS === 'ios' ? (0, _reactNative.requireNativeComponent)('DigiaHostView') : null;
|
|
51
18
|
function DigiaHostView({
|
|
52
19
|
style
|
|
53
20
|
}) {
|
|
54
|
-
if (_reactNative.Platform.OS === 'android' && NativeDigiaHostView) {
|
|
55
|
-
// The native Compose DigiaHost renders dialogs / bottom sheets that
|
|
56
|
-
// float above the view hierarchy on their own — the host view only
|
|
57
|
-
// needs to be mounted in the tree, not take up any screen space.
|
|
21
|
+
if ((_reactNative.Platform.OS === 'android' || _reactNative.Platform.OS === 'ios') && NativeDigiaHostView) {
|
|
58
22
|
return /*#__PURE__*/_react.default.createElement(NativeDigiaHostView, {
|
|
59
|
-
|
|
23
|
+
pointerEvents: "none",
|
|
24
|
+
style: _reactNative.StyleSheet.flatten([_reactNative.StyleSheet.absoluteFillObject, style])
|
|
60
25
|
});
|
|
61
26
|
}
|
|
62
|
-
|
|
63
|
-
// iOS / other platforms: no-op, nothing to mount.
|
|
64
27
|
return null;
|
|
65
28
|
}
|
|
66
|
-
const styles = _reactNative.StyleSheet.create({
|
|
67
|
-
host: {
|
|
68
|
-
width: 0,
|
|
69
|
-
height: 0,
|
|
70
|
-
overflow: 'hidden'
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
29
|
//# sourceMappingURL=DigiaHostView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","e","__esModule","default","NativeDigiaHostView","Platform","OS","requireNativeComponent","DigiaHostView","style","createElement","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","e","__esModule","default","NativeDigiaHostView","Platform","OS","requireNativeComponent","DigiaHostView","style","createElement","pointerEvents","StyleSheet","flatten","absoluteFillObject"],"sourceRoot":"../../src","sources":["DigiaHostView.tsx"],"mappings":";;;;;;AAOA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAMsB,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAdtB;AACA;AACA;AACA;AACA;AACA;;AAoBA,MAAMG,mBAAmB,GACrBC,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAID,qBAAQ,CAACC,EAAE,KAAK,KAAK,GAC5C,IAAAC,mCAAsB,EAA2B,eAAe,CAAC,GACjE,IAAI;AAEP,SAASC,aAAaA,CAAC;EAAEC;AAA0B,CAAC,EAAE;EACzD,IAAI,CAACJ,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAID,qBAAQ,CAACC,EAAE,KAAK,KAAK,KAAKF,mBAAmB,EAAE;IAC7E,oBACIP,MAAA,CAAAM,OAAA,CAAAO,aAAA,CAACN,mBAAmB;MAChBO,aAAa,EAAC,MAAM;MACpBF,KAAK,EAAEG,uBAAU,CAACC,OAAO,CAAC,CAACD,uBAAU,CAACE,kBAAkB,EAAEL,KAAK,CAAC;IAAE,CACrE,CAAC;EAEV;EAEA,OAAO,IAAI;AACf","ignoreList":[]}
|
|
@@ -4,70 +4,53 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DigiaSlotView = DigiaSlotView;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
-
function
|
|
10
|
-
/**
|
|
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
11
|
* DigiaSlotView
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* On Android this mounts a Jetpack Compose `DigiaSlot` composable that
|
|
17
|
-
* observes the slot payload for the given placement key and renders the
|
|
18
|
-
* matching campaign component. On iOS it is a transparent no-op.
|
|
19
|
-
*
|
|
20
|
-
* ─── Usage ───────────────────────────────────────────────────────────────────
|
|
21
|
-
* ```tsx
|
|
22
|
-
* import { DigiaSlotView } from '@digia/engage-react-native';
|
|
23
|
-
*
|
|
24
|
-
* // Fixed height (you control the space)
|
|
25
|
-
* <DigiaSlotView
|
|
26
|
-
* placementKey="hero_banner"
|
|
27
|
-
* style={{ width: '100%', height: 200 }}
|
|
28
|
-
* />
|
|
29
|
-
*
|
|
30
|
-
* // Inside a scroll view
|
|
31
|
-
* <ScrollView>
|
|
32
|
-
* <ProductList />
|
|
33
|
-
* <DigiaSlotView
|
|
34
|
-
* placementKey="pdp_mid_banner"
|
|
35
|
-
* style={{ width: '100%', height: 120 }}
|
|
36
|
-
* />
|
|
37
|
-
* <RelatedProducts />
|
|
38
|
-
* </ScrollView>
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* The `placementKey` must match the key the marketer selects when creating
|
|
42
|
-
* inline content on the Digia dashboard. The view collapses to nothing when
|
|
43
|
-
* no campaign is active for that key.
|
|
44
|
-
*
|
|
45
|
-
* ─── Sizing ──────────────────────────────────────────────────────────────────
|
|
46
|
-
* React Native's layout system controls the dimensions of this view.
|
|
47
|
-
* Provide an explicit `height` (or flex) via the `style` prop so that the
|
|
48
|
-
* native Compose layer has space to render. When no campaign is active the
|
|
49
|
-
* Compose `DigiaSlot` renders nothing inside that space.
|
|
50
|
-
* ─────────────────────────────────────────────────────────────────────────────
|
|
13
|
+
* Renders inline campaign content at a placement position.
|
|
14
|
+
* Auto-sizes to match native content height via `onContentSizeChange`;
|
|
15
|
+
* pass an explicit `height` in `style` to fix the size instead.
|
|
51
16
|
*/
|
|
52
|
-
|
|
53
|
-
// Fabric (New Architecture) resolves view configs lazily — no UIManager
|
|
54
|
-
// guard needed. requireNativeComponent is called unconditionally on Android.
|
|
55
|
-
const NativeDigiaSlotView = _reactNative.Platform.OS === 'android' ? (0, _reactNative.requireNativeComponent)('DigiaSlotView') : null;
|
|
56
|
-
|
|
57
|
-
// ── DigiaSlotView ─────────────────────────────────────────────────────────────
|
|
58
|
-
|
|
17
|
+
const NativeDigiaSlotView = _reactNative.Platform.OS === 'android' || _reactNative.Platform.OS === 'ios' ? (0, _reactNative.requireNativeComponent)('DigiaSlotView') : null;
|
|
59
18
|
function DigiaSlotView({
|
|
60
19
|
placementKey,
|
|
61
20
|
style
|
|
62
21
|
}) {
|
|
63
|
-
|
|
64
|
-
|
|
22
|
+
const [contentHeight, setContentHeight] = (0, _react.useState)(0);
|
|
23
|
+
const onContentSizeChange = (0, _react.useCallback)(event => {
|
|
24
|
+
const h = event.nativeEvent.height ?? 0;
|
|
25
|
+
setContentHeight(Math.max(0, h));
|
|
26
|
+
}, []);
|
|
27
|
+
if ((_reactNative.Platform.OS === 'android' || _reactNative.Platform.OS === 'ios') && NativeDigiaSlotView) {
|
|
28
|
+
const flatStyle = _reactNative.StyleSheet.flatten(style) || {};
|
|
29
|
+
const hasExplicitHeight = flatStyle.height !== undefined;
|
|
30
|
+
if (hasExplicitHeight) {
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement(NativeDigiaSlotView, _extends({
|
|
32
|
+
placementKey: placementKey,
|
|
33
|
+
style: [{
|
|
34
|
+
width: '100%'
|
|
35
|
+
}, style]
|
|
36
|
+
}, _reactNative.Platform.OS === 'android' ? {
|
|
37
|
+
collapsable: false
|
|
38
|
+
} : {}));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 1dp bootstrap ensures a real layout pass before any campaign arrives.
|
|
42
|
+
const bootstrapHeight = Math.max(contentHeight, 1);
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement(NativeDigiaSlotView, _extends({
|
|
65
44
|
placementKey: placementKey,
|
|
66
|
-
style:
|
|
67
|
-
|
|
45
|
+
style: [{
|
|
46
|
+
width: '100%',
|
|
47
|
+
height: bootstrapHeight
|
|
48
|
+
}, style],
|
|
49
|
+
onContentSizeChange: onContentSizeChange
|
|
50
|
+
}, _reactNative.Platform.OS === 'android' ? {
|
|
51
|
+
collapsable: false
|
|
52
|
+
} : {}));
|
|
68
53
|
}
|
|
69
|
-
|
|
70
|
-
// iOS / other platforms: not yet implemented — render nothing.
|
|
71
54
|
return null;
|
|
72
55
|
}
|
|
73
56
|
//# sourceMappingURL=DigiaSlotView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","
|
|
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","NativeDigiaSlotView","Platform","OS","requireNativeComponent","DigiaSlotView","placementKey","style","contentHeight","setContentHeight","useState","onContentSizeChange","useCallback","event","h","nativeEvent","height","Math","max","flatStyle","StyleSheet","flatten","hasExplicitHeight","undefined","createElement","width","collap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A,YAAa;QAC3BC,KAAK,EAAE,CAAC;UAAEkB,KAAK,EAAE;QAAO,CAAC,EAAElB,KAAK;MAAE,GAC7BL,qBAAQ,CAACC,EAAE,KAAK,SAAS,GAAG;QAAEuB,WAAW,EAAE;MAAM,CAAC,GAAG,CAAC,CAAC,CAC/D,CAAC;IAEV;;IAEA;IACA,MAAMC,eAAe,GAAGV,IAAI,CAACC,GAAG,CAACV,aAAa,EAAE,CAAC,CAAC;IAElD,oBACIpC,MAAA,CAAAc,OAAA,CAAAsC,aAAA,CAACvB,mBAAmB,EAAAN,QAAA;MAChBW,YAAY,EAAEA,YAAa;MAC3BC,KAAK,EAAE,CAAC;QAAEkB,KAAK,EAAE,MAAM;QAAET,MAAM,EAAEW;MAAgB,CAAC,EAAEpB,KAAK,CAAE;MAC3DI,mBAAmB,EAAEA;IAAoB,GACpCT,qBAAQ,CAACC,EAAE,KAAK,SAAS,GAAG;MAAEuB,WAAW,EAAE;IAAM,CAAC,GAAG,CAAC,CAAC,CAC/D,CAAC;EAEV;EAEA,OAAO,IAAI;AACf","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_resolved","getModule","TurboModuleRegistry","get","NativeModules","DigiaEngageModule","__DEV__","console","warn","nativeDigiaModule","exports","initialize","apiKey","environment","logLevel","Promise","resolve","registerBridge","setCurrentScreen","name","triggerCampaign","id","content","cepContext","invalidateCampaign","campaignId","getConstants"],"sourceRoot":"../../src","sources":["NativeDigiaEngage.ts"],"mappings":";;;;;;AAgBA,IAAAA,YAAA,GAAAC,OAAA;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_resolved","getModule","TurboModuleRegistry","get","NativeModules","DigiaEngageModule","__DEV__","console","warn","nativeDigiaModule","exports","initialize","apiKey","environment","logLevel","Promise","resolve","registerBridge","setCurrentScreen","name","triggerCampaign","id","content","cepContext","invalidateCampaign","campaignId","getConstants"],"sourceRoot":"../../src","sources":["NativeDigiaEngage.ts"],"mappings":";;;;;;AAgBA,IAAAA,YAAA,GAAAC,OAAA;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA8BA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,SAAsB,GAAG,IAAI;AACjC,SAASC,SAASA,CAAA,EAAgB;EAC9B,IAAID,SAAS,KAAK,IAAI,EAAE,OAAOA,SAAS;EACxCA,SAAS,GACLE,gCAAmB,CAACC,GAAG,CAAO,mBAAmB,CAAC,IACjDC,0BAAa,CAACC,iBAAsC,IACrD,IAAI;EACR,IAAIC,OAAO,IAAI,CAACN,SAAS,EAAE;IACvBO,OAAO,CAACC,IAAI,CACR,wCAAwC,GACxC,iEACJ,CAAC;EACL;EACA,OAAOR,SAAS;AACpB;AAEO,MAAMS,iBAAuB,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EACnCE,UAAU,EAAEA,CAACC,MAAM,EAAEC,WAAW,EAAEC,QAAQ,KACtCb,SAAS,CAAC,CAAC,EAAEU,UAAU,CAACC,MAAM,EAAEC,WAAW,EAAEC,QAAQ,CAAC,IAAIC,OAAO,CAACC,OAAO,CAAC,CAAC;EAC/EC,cAAc,EAAEA,CAAA,KAAMhB,SAAS,CAAC,CAAC,EAAEgB,cAAc,CAAC,CAAC;EACnDC,gBAAgB,EAAGC,IAAI,IAAKlB,SAAS,CAAC,CAAC,EAAEiB,gBAAgB,CAACC,IAAI,CAAC;EAC/DC,eAAe,EAAEA,CAACC,EAAE,EAAEC,OAAO,EAAEC,UAAU,KACrCtB,SAAS,CAAC,CAAC,EAAEmB,eAAe,CAACC,EAAE,EAAEC,OAAO,EAAEC,UAAU,CAAC;EACzDC,kBAAkB,EAAGC,UAAU,IAAKxB,SAAS,CAAC,CAAC,EAAEuB,kBAAkB,CAACC,UAAU,CAAC;EAC/EC,YAAY,EAAEA,CAAA,KAAMzB,SAAS,CAAC,CAAC,EAAEyB,YAAY,GAAG,CAAC,IAAI,CAAC;AAC1D,CAAC","ignoreList":[]}
|
package/lib/module/Digia.js
CHANGED
|
@@ -15,12 +15,17 @@
|
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
import { DeviceEventEmitter } from 'react-native';
|
|
18
19
|
import { nativeDigiaModule } from './NativeDigiaEngage';
|
|
19
20
|
class DigiaClass {
|
|
20
21
|
_plugins = new Map();
|
|
21
22
|
// Tracks whether the native bridge plugin (RNEventBridgePlugin) has been
|
|
22
23
|
// wired to the native SDK. Done once on the first Digia.register() call.
|
|
23
24
|
_nativeBridgeWired = false;
|
|
25
|
+
// Cache of triggered payloads keyed by campaign ID, used to reconstruct
|
|
26
|
+
// the full InAppPayload when overlay lifecycle events arrive from native.
|
|
27
|
+
_activePayloads = new Map();
|
|
28
|
+
_engageSubscription = null;
|
|
24
29
|
|
|
25
30
|
/**
|
|
26
31
|
* Initialise the Digia Engage SDK.
|
|
@@ -57,6 +62,7 @@ class DigiaClass {
|
|
|
57
62
|
// so the delegate is ready when JS campaigns start flowing.
|
|
58
63
|
if (!this._nativeBridgeWired) {
|
|
59
64
|
nativeDigiaModule.registerBridge();
|
|
65
|
+
this._startEngageListener();
|
|
60
66
|
this._nativeBridgeWired = true;
|
|
61
67
|
}
|
|
62
68
|
plugin.setup(this);
|
|
@@ -90,11 +96,55 @@ class DigiaClass {
|
|
|
90
96
|
// Forwards to the native DigiaCEPDelegate via the bridge.
|
|
91
97
|
|
|
92
98
|
onCampaignTriggered(payload) {
|
|
99
|
+
this._activePayloads.set(payload.id, payload);
|
|
93
100
|
nativeDigiaModule.triggerCampaign(payload.id, payload.content, payload.cepContext);
|
|
94
101
|
}
|
|
95
102
|
onCampaignInvalidated(campaignId) {
|
|
103
|
+
this._activePayloads.delete(campaignId);
|
|
96
104
|
nativeDigiaModule.invalidateCampaign(campaignId);
|
|
97
105
|
}
|
|
106
|
+
|
|
107
|
+
// ── Overlay event forwarding ─────────────────────────────────────────────
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Subscribes to `digiaOverlayEvent` emitted by the native
|
|
111
|
+
* RNEventBridgePlugin when the Compose overlay fires a lifecycle event
|
|
112
|
+
* (impressed / clicked / dismissed).
|
|
113
|
+
*
|
|
114
|
+
* Each event is forwarded to every registered plugin's notifyEvent() so
|
|
115
|
+
* that CEP plugins (e.g. WebEngagePlugin) can report analytics.
|
|
116
|
+
*/
|
|
117
|
+
_startEngageListener() {
|
|
118
|
+
if (this._engageSubscription) return;
|
|
119
|
+
this._engageSubscription = DeviceEventEmitter.addListener('digiaEngageEvent', data => this._forwardExperienceEvent(data));
|
|
120
|
+
}
|
|
121
|
+
_forwardExperienceEvent(data) {
|
|
122
|
+
const payload = this._activePayloads.get(data.campaignId);
|
|
123
|
+
if (!payload) return;
|
|
124
|
+
let event;
|
|
125
|
+
switch (data.type) {
|
|
126
|
+
case 'impressed':
|
|
127
|
+
event = {
|
|
128
|
+
type: 'impressed'
|
|
129
|
+
};
|
|
130
|
+
break;
|
|
131
|
+
case 'clicked':
|
|
132
|
+
event = {
|
|
133
|
+
type: 'clicked',
|
|
134
|
+
elementId: data.elementId
|
|
135
|
+
};
|
|
136
|
+
break;
|
|
137
|
+
case 'dismissed':
|
|
138
|
+
event = {
|
|
139
|
+
type: 'dismissed'
|
|
140
|
+
};
|
|
141
|
+
this._activePayloads.delete(data.campaignId);
|
|
142
|
+
break;
|
|
143
|
+
default:
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
this._plugins.forEach(plugin => plugin.notifyEvent(event, payload));
|
|
147
|
+
}
|
|
98
148
|
}
|
|
99
149
|
export const Digia = new DigiaClass();
|
|
100
150
|
//# sourceMappingURL=Digia.js.map
|
package/lib/module/Digia.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["nativeDigiaModule","DigiaClass","_plugins","Map","_nativeBridgeWired","initialize","config","environment","logLevel","apiKey","register","plugin","has","identifier","get","teardown","registerBridge","setup","set","unregister","pluginOrId","id","delete","setCurrentScreen","name","forEach","forwardScreen","onCampaignTriggered","payload","triggerCampaign","content","cepContext","onCampaignInvalidated","campaignId","invalidateCampaign","Digia"],"sourceRoot":"../../src","sources":["Digia.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,iBAAiB,QAAQ,qBAAqB;
|
|
1
|
+
{"version":3,"names":["DeviceEventEmitter","nativeDigiaModule","DigiaClass","_plugins","Map","_nativeBridgeWired","_activePayloads","_engageSubscription","initialize","config","environment","logLevel","apiKey","register","plugin","has","identifier","get","teardown","registerBridge","_startEngageListener","setup","set","unregister","pluginOrId","id","delete","setCurrentScreen","name","forEach","forwardScreen","onCampaignTriggered","payload","triggerCampaign","content","cepContext","onCampaignInvalidated","campaignId","invalidateCampaign","addListener","data","_forwardExperienceEvent","event","type","elementId","notifyEvent","Digia"],"sourceRoot":"../../src","sources":["Digia.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,kBAAkB,QAAQ,cAAc;AACjD,SAASC,iBAAiB,QAAQ,qBAAqB;AASvD,MAAMC,UAAU,CAA0B;EACrBC,QAAQ,GAAG,IAAIC,GAAG,CAAsB,CAAC;EAC1D;EACA;EACQC,kBAAkB,GAAG,KAAK;EAClC;EACA;EACiBC,eAAe,GAAG,IAAIF,GAAG,CAAuB,CAAC;EAC1DG,mBAAmB,GAA8B,IAAI;;EAE7D;AACJ;AACA;AACA;AACA;AACA;EACI,MAAMC,UAAUA,CAACC,MAAmB,EAAiB;IACjD,MAAMC,WAAW,GAAGD,MAAM,CAACC,W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Ae,CAACoB,MAAM,CAACc,IAAI,CAACH,UAAU,CAAC;QAC5C;MACJ;QACI;IACR;IAEA,IAAI,CAAClC,QAAQ,CAAC0B,OAAO,CAAEf,MAAM,IAAKA,MAAM,CAAC+B,WAAW,CAACH,KAAK,EAAEV,OAAO,CAAC,CAAC;EACzE;AAEJ;AAEA,OAAO,MAAMc,KAAK,GAAG,IAAI5C,UAAU,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,67 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* DigiaHostView
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* ─── Usage ───────────────────────────────────────────────────────────────────
|
|
8
|
-
* Place `<DigiaHostView>` at the **root** of your component tree so that
|
|
9
|
-
* Digia dialogs and bottom sheets can stack on top of all your content.
|
|
10
|
-
*
|
|
11
|
-
* ```tsx
|
|
12
|
-
* import React from 'react';
|
|
13
|
-
* import { StyleSheet, View } from 'react-native';
|
|
14
|
-
* import { DigiaHostView } from '@digia/engage-react-native';
|
|
15
|
-
*
|
|
16
|
-
* export default function App() {
|
|
17
|
-
* return (
|
|
18
|
-
* <View style={styles.root}>
|
|
19
|
-
* <DigiaHostView style={StyleSheet.absoluteFill} />
|
|
20
|
-
* {/ * your navigation / app content here * /}
|
|
21
|
-
* </View>
|
|
22
|
-
* );
|
|
23
|
-
* }
|
|
24
|
-
*
|
|
25
|
-
* const styles = StyleSheet.create({ root: { flex: 1 } });
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* On Android this mounts a Jetpack Compose `DigiaHost` composable that
|
|
29
|
-
* manages dialog + bottom-sheet presentation triggered by CEP plugins.
|
|
30
|
-
* On iOS the view is a transparent no-op until iOS support is implemented.
|
|
31
|
-
* ─────────────────────────────────────────────────────────────────────────────
|
|
4
|
+
* Transparent full-screen overlay that hosts Digia dialogs and bottom sheets.
|
|
5
|
+
* Place at the root of your component tree so overlays stack above all content.
|
|
32
6
|
*/
|
|
33
7
|
|
|
34
8
|
import React from 'react';
|
|
35
9
|
import { Platform, StyleSheet, requireNativeComponent } from 'react-native';
|
|
36
|
-
|
|
37
|
-
// requireNativeComponent expects a plain ViewStyle, not StyleProp.
|
|
38
|
-
|
|
39
|
-
// Fabric (New Architecture) resolves view configs lazily — no UIManager
|
|
40
|
-
// guard needed. requireNativeComponent is called unconditionally on Android.
|
|
41
|
-
const NativeDigiaHostView = Platform.OS === 'android' ? requireNativeComponent('DigiaHostView') : null;
|
|
42
|
-
|
|
43
|
-
// ── DigiaHostView ─────────────────────────────────────────────────────────────
|
|
44
|
-
|
|
10
|
+
const NativeDigiaHostView = Platform.OS === 'android' || Platform.OS === 'ios' ? requireNativeComponent('DigiaHostView') : null;
|
|
45
11
|
export function DigiaHostView({
|
|
46
12
|
style
|
|
47
13
|
}) {
|
|
48
|
-
if (Platform.OS === 'android' && NativeDigiaHostView) {
|
|
49
|
-
// The native Compose DigiaHost renders dialogs / bottom sheets that
|
|
50
|
-
// float above the view hierarchy on their own — the host view only
|
|
51
|
-
// needs to be mounted in the tree, not take up any screen space.
|
|
14
|
+
if ((Platform.OS === 'android' || Platform.OS === 'ios') && NativeDigiaHostView) {
|
|
52
15
|
return /*#__PURE__*/React.createElement(NativeDigiaHostView, {
|
|
53
|
-
|
|
16
|
+
pointerEvents: "none",
|
|
17
|
+
style: StyleSheet.flatten([StyleSheet.absoluteFillObject, style])
|
|
54
18
|
});
|
|
55
19
|
}
|
|
56
|
-
|
|
57
|
-
// iOS / other platforms: no-op, nothing to mount.
|
|
58
20
|
return null;
|
|
59
21
|
}
|
|
60
|
-
const styles = StyleSheet.create({
|
|
61
|
-
host: {
|
|
62
|
-
width: 0,
|
|
63
|
-
height: 0,
|
|
64
|
-
overflow: 'hidden'
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
22
|
//# sourceMappingURL=DigiaHostView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Platform","StyleSheet","requireNativeComponent","NativeDigiaHostView","OS","DigiaHostView","style","createElement","
|
|
1
|
+
{"version":3,"names":["React","Platform","StyleSheet","requireNativeComponent","NativeDigiaHostView","OS","DigiaHostView","style","createElement","pointerEvents","flatten","absoluteFillObject"],"sourceRoot":"../../src","sources":["DigiaHostView.tsx"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACIC,QAAQ,EACRC,UAAU,EACVC,sBAAsB,QAGnB,cAAc;AAWrB,MAAMC,mBAAmB,GACrBH,QAAQ,CAACI,EAAE,KAAK,SAAS,IAAIJ,QAAQ,CAACI,EAAE,KAAK,KAAK,GAC5CF,sBAAsB,CAA2B,eAAe,CAAC,GACjE,IAAI;AAEd,OAAO,SAASG,aAAaA,CAAC;EAAEC;AAA0B,CAAC,EAAE;EACzD,IAAI,CAACN,QAAQ,CAACI,EAAE,KAAK,SAAS,IAAIJ,QAAQ,CAACI,EAAE,KAAK,KAAK,KAAKD,mBAAmB,EAAE;IAC7E,oBACIJ,KAAA,CAAAQ,aAAA,CAACJ,mBAAmB;MAChBK,aAAa,EAAC,MAAM;MACpBF,KAAK,EAAEL,UAAU,CAACQ,OAAO,CAAC,CAACR,UAAU,CAACS,kBAAkB,EAAEJ,KAAK,CAAC;IAAE,CACrE,CAAC;EAEV;EAEA,OAAO,IAAI;AACf","ignoreList":[]}
|
|
@@ -1,66 +1,51 @@
|
|
|
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); }
|
|
1
2
|
/**
|
|
2
3
|
* DigiaSlotView
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* On Android this mounts a Jetpack Compose `DigiaSlot` composable that
|
|
8
|
-
* observes the slot payload for the given placement key and renders the
|
|
9
|
-
* matching campaign component. On iOS it is a transparent no-op.
|
|
10
|
-
*
|
|
11
|
-
* ─── Usage ───────────────────────────────────────────────────────────────────
|
|
12
|
-
* ```tsx
|
|
13
|
-
* import { DigiaSlotView } from '@digia/engage-react-native';
|
|
14
|
-
*
|
|
15
|
-
* // Fixed height (you control the space)
|
|
16
|
-
* <DigiaSlotView
|
|
17
|
-
* placementKey="hero_banner"
|
|
18
|
-
* style={{ width: '100%', height: 200 }}
|
|
19
|
-
* />
|
|
20
|
-
*
|
|
21
|
-
* // Inside a scroll view
|
|
22
|
-
* <ScrollView>
|
|
23
|
-
* <ProductList />
|
|
24
|
-
* <DigiaSlotView
|
|
25
|
-
* placementKey="pdp_mid_banner"
|
|
26
|
-
* style={{ width: '100%', height: 120 }}
|
|
27
|
-
* />
|
|
28
|
-
* <RelatedProducts />
|
|
29
|
-
* </ScrollView>
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* The `placementKey` must match the key the marketer selects when creating
|
|
33
|
-
* inline content on the Digia dashboard. The view collapses to nothing when
|
|
34
|
-
* no campaign is active for that key.
|
|
35
|
-
*
|
|
36
|
-
* ─── Sizing ──────────────────────────────────────────────────────────────────
|
|
37
|
-
* React Native's layout system controls the dimensions of this view.
|
|
38
|
-
* Provide an explicit `height` (or flex) via the `style` prop so that the
|
|
39
|
-
* native Compose layer has space to render. When no campaign is active the
|
|
40
|
-
* Compose `DigiaSlot` renders nothing inside that space.
|
|
41
|
-
* ─────────────────────────────────────────────────────────────────────────────
|
|
5
|
+
* Renders inline campaign content at a placement position.
|
|
6
|
+
* Auto-sizes to match native content height via `onContentSizeChange`;
|
|
7
|
+
* pass an explicit `height` in `style` to fix the size instead.
|
|
42
8
|
*/
|
|
43
9
|
|
|
44
|
-
import React from 'react';
|
|
45
|
-
import { Platform, requireNativeComponent } from 'react-native';
|
|
46
|
-
|
|
47
|
-
// guard needed. requireNativeComponent is called unconditionally on Android.
|
|
48
|
-
const NativeDigiaSlotView = Platform.OS === 'android' ? requireNativeComponent('DigiaSlotView') : null;
|
|
49
|
-
|
|
50
|
-
// ── DigiaSlotView ─────────────────────────────────────────────────────────────
|
|
51
|
-
|
|
10
|
+
import React, { useCallback, useState } from 'react';
|
|
11
|
+
import { Platform, StyleSheet, requireNativeComponent } from 'react-native';
|
|
12
|
+
const NativeDigiaSlotView = Platform.OS === 'android' || Platform.OS === 'ios' ? requireNativeComponent('DigiaSlotView') : null;
|
|
52
13
|
export function DigiaSlotView({
|
|
53
14
|
placementKey,
|
|
54
15
|
style
|
|
55
16
|
}) {
|
|
56
|
-
|
|
57
|
-
|
|
17
|
+
const [contentHeight, setContentHeight] = useState(0);
|
|
18
|
+
const onContentSizeChange = useCallback(event => {
|
|
19
|
+
const h = event.nativeEvent.height ?? 0;
|
|
20
|
+
setContentHeight(Math.max(0, h));
|
|
21
|
+
}, []);
|
|
22
|
+
if ((Platform.OS === 'android' || Platform.OS === 'ios') && NativeDigiaSlotView) {
|
|
23
|
+
const flatStyle = StyleSheet.flatten(style) || {};
|
|
24
|
+
const hasExplicitHeight = flatStyle.height !== undefined;
|
|
25
|
+
if (hasExplicitHeight) {
|
|
26
|
+
return /*#__PURE__*/React.createElement(NativeDigiaSlotView, _extends({
|
|
27
|
+
placementKey: placementKey,
|
|
28
|
+
style: [{
|
|
29
|
+
width: '100%'
|
|
30
|
+
}, style]
|
|
31
|
+
}, Platform.OS === 'android' ? {
|
|
32
|
+
collapsable: false
|
|
33
|
+
} : {}));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// 1dp bootstrap ensures a real layout pass before any campaign arrives.
|
|
37
|
+
const bootstrapHeight = Math.max(contentHeight, 1);
|
|
38
|
+
return /*#__PURE__*/React.createElement(NativeDigiaSlotView, _extends({
|
|
58
39
|
placementKey: placementKey,
|
|
59
|
-
style:
|
|
60
|
-
|
|
40
|
+
style: [{
|
|
41
|
+
width: '100%',
|
|
42
|
+
height: bootstrapHeight
|
|
43
|
+
}, style],
|
|
44
|
+
onContentSizeChange: onContentSizeChange
|
|
45
|
+
}, Platform.OS === 'android' ? {
|
|
46
|
+
collapsable: false
|
|
47
|
+
} : {}));
|
|
61
48
|
}
|
|
62
|
-
|
|
63
|
-
// iOS / other platforms: not yet implemented — render nothing.
|
|
64
49
|
return null;
|
|
65
50
|
}
|
|
66
51
|
//# sourceMappingURL=DigiaSlotView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Platform","requireNativeComponent","NativeDigiaSlotView","OS","DigiaSlotView","placementKey","style","createElement"],"sourceRoot":"../../src","sources":["DigiaSlotView.tsx"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA
|
|
1
|
+
{"version":3,"names":["React","useCallback","useState","Platform","StyleSheet","requireNativeComponent","NativeDigiaSlotView","OS","DigiaSlotView","placementKey","style","contentHeight","setContentHeight","onContentSizeChange","event","h","nativeEvent","height","Math","max","flatStyle","flatten","hasExplicitHeight","undefined","createElement","_extends","width","collapsable","bootstrapHeight"],"sourceRoot":"../../src","sources":["DigiaSlotView.tsx"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AACpD,SACIC,QAAQ,EACRC,UAAU,EACVC,sBAAsB,QAGnB,cAAc;AAYrB,MAAMC,mBAAmB,GACrBH,QAAQ,CAACI,EAAE,KAAK,SAAS,IAAIJ,QAAQ,CAACI,EAAE,KAAK,KAAK,GAC5CF,sBAAsB,CAA2B,eAAe,CAAC,GACjE,IAAI;AAEd,OAAO,SAASG,aAAaA,CAAC;EAAEC,YAAY;EAAEC;AAA0B,CAAC,EAAE;EACvE,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGV,QAAQ,CAAC,CAAC,CAAC;EAErD,MAAMW,mBAAmB,GAAGZ,WAAW,CAClCa,KAA0C,IAAK;IAC5C,MAAMC,CAAC,GAAGD,KAAK,CAACE,WAAW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ule","get","DigiaEngageModule","__DEV__","console","warn","nativeDigiaModule","initialize","apiKey","environment","logLevel","Promise","resolve","registerBridge","setCurrentScreen","name","triggerCampaign","id","content","cepContext","invalidateCampaign","campaignId","getConstants"],"sourceRoot":"../../src","sources":["NativeDigiaEngage.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,EAAEC,mBAAmB,QAAQ,cAAc;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["NativeModules","TurboModuleRegistry","_resolved","getModule","get","DigiaEngageModule","__DEV__","console","warn","nativeDigiaModule","initialize","apiKey","environment","logLevel","Promise","resolve","registerBridge","setCurrentScreen","name","triggerCampaign","id","content","cepContext","invalidateCampaign","campaignId","getConstants"],"sourceRoot":"../../src","sources":["NativeDigiaEngage.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,EAAEC,mBAAmB,QAAQ,cAAc;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA8BA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,SAAsB,GAAG,IAAI;AACjC,SAASC,SAASA,CAAA,EAAgB;EAC9B,IAAID,SAAS,KAAK,IAAI,EAAE,OAAOA,SAAS;EACxCA,SAAS,GACLD,mBAAmB,CAACG,GAAG,CAAO,mBAAmB,CAAC,IACjDJ,aAAa,CAACK,iBAAsC,IACrD,IAAI;EACR,IAAIC,OAAO,IAAI,CAACJ,SAAS,EAAE;IACvBK,OAAO,CAACC,IAAI,CACR,wCAAwC,GACxC,iEACJ,CAAC;EACL;EACA,OAAON,SAAS;AACpB;AAEA,OAAO,MAAMO,iBAAuB,GAAG;EACnCC,UAAU,EAAEA,CAACC,MAAM,EAAEC,WAAW,EAAEC,QAAQ,KACtCV,SAAS,CAAC,CAAC,EAAEO,UAAU,CAACC,MAAM,EAAEC,WAAW,EAAEC,QAAQ,CAAC,IAAIC,OAAO,CAACC,OAAO,CAAC,CAAC;EAC/EC,cAAc,EAAEA,CAAA,KAAMb,SAAS,CAAC,CAAC,EAAEa,cAAc,CAAC,CAAC;EACnDC,gBAAgB,EAAGC,IAAI,IAAKf,SAAS,CAAC,CAAC,EAAEc,gBAAgB,CAACC,IAAI,CAAC;EAC/DC,eAAe,EAAEA,CAACC,EAAE,EAAEC,OAAO,EAAEC,UAAU,KACrCnB,SAAS,CAAC,CAAC,EAAEgB,eAAe,CAACC,EAAE,EAAEC,OAAO,EAAEC,UAAU,CAAC;EACzDC,kBAAkB,EAAGC,UAAU,IAAKrB,SAAS,CAAC,CAAC,EAAEoB,kBAAkB,CAACC,UAAU,CAAC;EAC/EC,YAAY,EAAEA,CAAA,KAAMtB,SAAS,CAAC,CAAC,EAAEsB,YAAY,GAAG,CAAC,IAAI,CAAC;AAC1D,CAAC","ignoreList":[]}
|
|
@@ -18,6 +18,8 @@ import type { DigiaConfig, DigiaDelegate, DigiaPlugin, InAppPayload } from './ty
|
|
|
18
18
|
declare class DigiaClass implements DigiaDelegate {
|
|
19
19
|
private readonly _plugins;
|
|
20
20
|
private _nativeBridgeWired;
|
|
21
|
+
private readonly _activePayloads;
|
|
22
|
+
private _engageSubscription;
|
|
21
23
|
/**
|
|
22
24
|
* Initialise the Digia Engage SDK.
|
|
23
25
|
*
|
|
@@ -56,6 +58,16 @@ declare class DigiaClass implements DigiaDelegate {
|
|
|
56
58
|
setCurrentScreen(name: string): void;
|
|
57
59
|
onCampaignTriggered(payload: InAppPayload): void;
|
|
58
60
|
onCampaignInvalidated(campaignId: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* Subscribes to `digiaOverlayEvent` emitted by the native
|
|
63
|
+
* RNEventBridgePlugin when the Compose overlay fires a lifecycle event
|
|
64
|
+
* (impressed / clicked / dismissed).
|
|
65
|
+
*
|
|
66
|
+
* Each event is forwarded to every registered plugin's notifyEvent() so
|
|
67
|
+
* that CEP plugins (e.g. WebEngagePlugin) can report analytics.
|
|
68
|
+
*/
|
|
69
|
+
private _startEngageListener;
|
|
70
|
+
private _forwardExperienceEvent;
|
|
59
71
|
}
|
|
60
72
|
export declare const Digia: DigiaClass;
|
|
61
73
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Digia.d.ts","sourceRoot":"","sources":["../../src/Digia.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"Digia.d.ts","sourceRoot":"","sources":["../../src/Digia.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,KAAK,EACR,WAAW,EACX,aAAa,EAEb,WAAW,EACX,YAAY,EACf,MAAM,SAAS,CAAC;AAEjB,cAAM,UAAW,YAAW,aAAa;IACrC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;IAG3D,OAAO,CAAC,kBAAkB,CAAS;IAGnC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAmC;IACnE,OAAO,CAAC,mBAAmB,CAAmC;IAE9D;;;;;OAKG;IACG,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAMpD;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAenC;;;OAGG;IACH,UAAU,CAAC,UAAU,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI;IAMlD;;;;;;OAMG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAUpC,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAKhD,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAO/C;;;;;;;OAOG;IACH,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,uBAAuB;CAyBlC;AAED,eAAO,MAAM,KAAK,YAAmB,CAAC"}
|
|
@@ -1,34 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* DigiaHostView
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* ─── Usage ───────────────────────────────────────────────────────────────────
|
|
8
|
-
* Place `<DigiaHostView>` at the **root** of your component tree so that
|
|
9
|
-
* Digia dialogs and bottom sheets can stack on top of all your content.
|
|
10
|
-
*
|
|
11
|
-
* ```tsx
|
|
12
|
-
* import React from 'react';
|
|
13
|
-
* import { StyleSheet, View } from 'react-native';
|
|
14
|
-
* import { DigiaHostView } from '@digia/engage-react-native';
|
|
15
|
-
*
|
|
16
|
-
* export default function App() {
|
|
17
|
-
* return (
|
|
18
|
-
* <View style={styles.root}>
|
|
19
|
-
* <DigiaHostView style={StyleSheet.absoluteFill} />
|
|
20
|
-
* {/ * your navigation / app content here * /}
|
|
21
|
-
* </View>
|
|
22
|
-
* );
|
|
23
|
-
* }
|
|
24
|
-
*
|
|
25
|
-
* const styles = StyleSheet.create({ root: { flex: 1 } });
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* On Android this mounts a Jetpack Compose `DigiaHost` composable that
|
|
29
|
-
* manages dialog + bottom-sheet presentation triggered by CEP plugins.
|
|
30
|
-
* On iOS the view is a transparent no-op until iOS support is implemented.
|
|
31
|
-
* ─────────────────────────────────────────────────────────────────────────────
|
|
4
|
+
* Transparent full-screen overlay that hosts Digia dialogs and bottom sheets.
|
|
5
|
+
* Place at the root of your component tree so overlays stack above all content.
|
|
32
6
|
*/
|
|
33
7
|
import React from 'react';
|
|
34
8
|
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DigiaHostView.d.ts","sourceRoot":"","sources":["../../src/DigiaHostView.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"DigiaHostView.d.ts","sourceRoot":"","sources":["../../src/DigiaHostView.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIH,KAAK,SAAS,EACd,KAAK,SAAS,EACjB,MAAM,cAAc,CAAC;AAEtB,UAAU,kBAAkB;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAChC;AAYD,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,EAAE,kBAAkB,4BAW1D"}
|