@digia-engage/core 1.0.0-beta.1
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 +21 -0
- package/README.md +277 -0
- package/android/build.gradle +82 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradlew +185 -0
- package/android/gradlew.bat +89 -0
- package/android/settings.gradle +33 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/digia/engage/rn/DigiaModule.kt +234 -0
- package/android/src/main/java/com/digia/engage/rn/DigiaPackage.kt +69 -0
- package/android/src/main/java/com/digia/engage/rn/DigiaSlotViewManager.kt +64 -0
- package/android/src/main/java/com/digia/engage/rn/DigiaViewManager.kt +63 -0
- package/ios/DigiaEngageModule.m +71 -0
- package/lib/commonjs/Digia.js +106 -0
- package/lib/commonjs/Digia.js.map +1 -0
- package/lib/commonjs/DigiaHostView.js +73 -0
- package/lib/commonjs/DigiaHostView.js.map +1 -0
- package/lib/commonjs/DigiaSlotView.js +73 -0
- package/lib/commonjs/DigiaSlotView.js.map +1 -0
- package/lib/commonjs/NativeDigiaModule.js +56 -0
- package/lib/commonjs/NativeDigiaModule.js.map +1 -0
- package/lib/commonjs/index.js +27 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/Digia.js +100 -0
- package/lib/module/Digia.js.map +1 -0
- package/lib/module/DigiaHostView.js +67 -0
- package/lib/module/DigiaHostView.js.map +1 -0
- package/lib/module/DigiaSlotView.js +66 -0
- package/lib/module/DigiaSlotView.js.map +1 -0
- package/lib/module/NativeDigiaModule.js +51 -0
- package/lib/module/NativeDigiaModule.js.map +1 -0
- package/lib/module/index.js +15 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/Digia.d.ts +62 -0
- package/lib/typescript/Digia.d.ts.map +1 -0
- package/lib/typescript/DigiaHostView.d.ts +40 -0
- package/lib/typescript/DigiaHostView.d.ts.map +1 -0
- package/lib/typescript/DigiaSlotView.d.ts +52 -0
- package/lib/typescript/DigiaSlotView.d.ts.map +1 -0
- package/lib/typescript/NativeDigiaModule.d.ts +45 -0
- package/lib/typescript/NativeDigiaModule.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +15 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +58 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/package.json +89 -0
- package/src/Digia.ts +104 -0
- package/src/DigiaHostView.tsx +83 -0
- package/src/DigiaSlotView.tsx +79 -0
- package/src/NativeDigiaModule.ts +86 -0
- package/src/index.ts +15 -0
- package/src/types.ts +61 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DigiaHostView = DigiaHostView;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
/**
|
|
11
|
+
* DigiaHostView
|
|
12
|
+
*
|
|
13
|
+
* A transparent React Native view that attaches the Digia Android Compose
|
|
14
|
+
* overlay layer (dialogs, bottom sheets) on top of your app's content.
|
|
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
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
// requireNativeComponent expects a plain ViewStyle, not StyleProp.
|
|
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
|
+
|
|
51
|
+
function DigiaHostView({
|
|
52
|
+
style
|
|
53
|
+
}) {
|
|
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.
|
|
58
|
+
return /*#__PURE__*/_react.default.createElement(NativeDigiaHostView, {
|
|
59
|
+
style: _reactNative.StyleSheet.flatten([styles.host, style])
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// iOS / other platforms: no-op, nothing to mount.
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const styles = _reactNative.StyleSheet.create({
|
|
67
|
+
host: {
|
|
68
|
+
width: 0,
|
|
69
|
+
height: 0,
|
|
70
|
+
overflow: 'hidden'
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=DigiaHostView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","e","__esModule","default","NativeDigiaHostView","Platform","OS","requireNativeComponent","DigiaHostView","style","createElement","StyleSheet","flatten","styles","host","create","width","height","overflow"],"sourceRoot":"../../src","sources":["DigiaHostView.tsx"],"mappings":";;;;;;AAiCA,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;AAxCtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA;;AAKA;AACA;AACA,MAAMG,mBAAmB,GACrBC,qBAAQ,CAACC,EAAE,KAAK,SAAS,GACnB,IAAAC,mCAAsB,EAA2B,eAAe,CAAC,GACjE,IAAI;;AAEd;;AAEO,SAASC,aAAaA,CAAC;EAAEC;AAA0B,CAAC,EAAE;EACzD,IAAIJ,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAIF,mBAAmB,EAAE;IAClD;IACA;IACA;IACA,oBACIP,MAAA,CAAAM,OAAA,CAAAO,aAAA,CAACN,mBAAmB;MAChBK,KAAK,EAAEE,uBAAU,CAACC,OAAO,CAAC,CAACC,MAAM,CAACC,IAAI,EAAEL,KAAK,CAAC;IAAE,CACnD,CAAC;EAEV;;EAEA;EACA,OAAO,IAAI;AACf;AAEA,MAAMI,MAAM,GAAGF,uBAAU,CAACI,MAAM,CAAC;EAC7BD,IAAI,EAAE;IACFE,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,QAAQ,EAAE;EACd;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DigiaSlotView = DigiaSlotView;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
/**
|
|
11
|
+
* DigiaSlotView
|
|
12
|
+
*
|
|
13
|
+
* A React Native view that renders inline campaign content (banners, cards,
|
|
14
|
+
* widgets) at a specific placement position inside your screen layout.
|
|
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
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
51
|
+
*/
|
|
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
|
+
|
|
59
|
+
function DigiaSlotView({
|
|
60
|
+
placementKey,
|
|
61
|
+
style
|
|
62
|
+
}) {
|
|
63
|
+
if (_reactNative.Platform.OS === 'android' && NativeDigiaSlotView) {
|
|
64
|
+
return /*#__PURE__*/_react.default.createElement(NativeDigiaSlotView, {
|
|
65
|
+
placementKey: placementKey,
|
|
66
|
+
style: style
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// iOS / other platforms: not yet implemented — render nothing.
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=DigiaSlotView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","e","__esModule","default","NativeDigiaSlotView","Platform","OS","requireNativeComponent","DigiaSlotView","placementKey","style","createElement"],"sourceRoot":"../../src","sources":["DigiaSlotView.tsx"],"mappings":";;;;;;AA2CA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAKsB,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAjDtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA,MAAMG,mBAAmB,GACrBC,qBAAQ,CAACC,EAAE,KAAK,SAAS,GACnB,IAAAC,mCAAsB,EAAqB,eAAe,CAAC,GAC3D,IAAI;;AAEd;;AAEO,SAASC,aAAaA,CAAC;EAAEC,YAAY;EAAEC;AAA0B,CAAC,EAAE;EACvE,IAAIL,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAIF,mBAAmB,EAAE;IAClD,oBACIP,MAAA,CAAAM,OAAA,CAAAQ,aAAA,CAACP,mBAAmB;MAChBK,YAAY,EAAEA,YAAa;MAC3BC,KAAK,EAAEA;IAAM,CAChB,CAAC;EAEV;;EAEA;EACA,OAAO,IAAI;AACf","ignoreList":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.nativeDigiaModule = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
/**
|
|
9
|
+
* NativeDigiaModule
|
|
10
|
+
*
|
|
11
|
+
* Low-level TurboModule binding to the native Digia Engage module.
|
|
12
|
+
*
|
|
13
|
+
* The module is resolved lazily on first use (not at import time) so that
|
|
14
|
+
* module evaluation before native initialisation doesn't throw.
|
|
15
|
+
* Resolution order:
|
|
16
|
+
* 1. TurboModuleRegistry.get() — New Architecture / JSI path
|
|
17
|
+
* 2. NativeModules — bridge interop layer (RN 0.73+ New Arch
|
|
18
|
+
* with isTurboModule: false in ReactModuleInfo)
|
|
19
|
+
* 3. null — non-Android environments; methods no-op
|
|
20
|
+
*
|
|
21
|
+
* Prefer using the high-level `Digia` singleton from `index.ts`.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Codegen spec — drives Android/iOS TurboModule generation.
|
|
26
|
+
*
|
|
27
|
+
* Rules for codegen compatibility:
|
|
28
|
+
* • File must be named `Native*.ts` (already satisfied).
|
|
29
|
+
* • All method parameter types must be scalar, Promise, Object, or Array.
|
|
30
|
+
* • `Object` maps to ReadableMap on Android, NSDictionary on iOS.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
// Try TurboModuleRegistry first (New Architecture / JSI).
|
|
34
|
+
// Fall back to NativeModules (bridge interop layer — enabled by default in
|
|
35
|
+
// RN 0.73+ New Architecture when the module is registered with
|
|
36
|
+
// isTurboModule: false in ReactModuleInfo).
|
|
37
|
+
// If neither resolves, warn in DEV and use no-op stubs so non-Android
|
|
38
|
+
// environments (web, Storybook) don't crash.
|
|
39
|
+
let _resolved = null;
|
|
40
|
+
function getModule() {
|
|
41
|
+
if (_resolved !== null) return _resolved;
|
|
42
|
+
_resolved = _reactNative.TurboModuleRegistry.get('DigiaEngageModule') ?? _reactNative.NativeModules.DigiaEngageModule ?? null;
|
|
43
|
+
if (__DEV__ && !_resolved) {
|
|
44
|
+
console.warn('[Digia] DigiaEngageModule not found.\n' + 'Make sure @digia/engage is linked and the app has been rebuilt.');
|
|
45
|
+
}
|
|
46
|
+
return _resolved;
|
|
47
|
+
}
|
|
48
|
+
const nativeDigiaModule = exports.nativeDigiaModule = {
|
|
49
|
+
initialize: (apiKey, environment, logLevel) => getModule()?.initialize(apiKey, environment, logLevel) ?? Promise.resolve(),
|
|
50
|
+
registerBridge: () => getModule()?.registerBridge(),
|
|
51
|
+
setCurrentScreen: name => getModule()?.setCurrentScreen(name),
|
|
52
|
+
triggerCampaign: (id, content, cepContext) => getModule()?.triggerCampaign(id, content, cepContext),
|
|
53
|
+
invalidateCampaign: campaignId => getModule()?.invalidateCampaign(campaignId),
|
|
54
|
+
getConstants: () => getModule()?.getConstants?.() ?? {}
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=NativeDigiaModule.js.map
|
|
@@ -0,0 +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":["NativeDigiaModule.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;;AA6BA;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":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Digia", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Digia.Digia;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "DigiaHostView", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _DigiaHostView.DigiaHostView;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "DigiaSlotView", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _DigiaSlotView.DigiaSlotView;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _Digia = require("./Digia");
|
|
25
|
+
var _DigiaHostView = require("./DigiaHostView");
|
|
26
|
+
var _DigiaSlotView = require("./DigiaSlotView");
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_Digia","require","_DigiaHostView","_DigiaSlotView"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAWA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* High-level Digia Engage SDK wrapper.
|
|
3
|
+
*
|
|
4
|
+
* Usage
|
|
5
|
+
* ──────
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { Digia } from '@digia/engage-react-native';
|
|
8
|
+
*
|
|
9
|
+
* // In your App entry point (e.g. App.tsx):
|
|
10
|
+
* await Digia.initialize({ apiKey: 'YOUR_API_KEY' });
|
|
11
|
+
*
|
|
12
|
+
* // Whenever your navigation screen changes:
|
|
13
|
+
* Digia.setCurrentScreen('Home');
|
|
14
|
+
*
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { nativeDigiaModule } from './NativeDigiaModule';
|
|
19
|
+
class DigiaClass {
|
|
20
|
+
_plugins = new Map();
|
|
21
|
+
// Tracks whether the native bridge plugin (RNEventBridgePlugin) has been
|
|
22
|
+
// wired to the native SDK. Done once on the first Digia.register() call.
|
|
23
|
+
_nativeBridgeWired = false;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Initialise the Digia Engage SDK.
|
|
27
|
+
*
|
|
28
|
+
* Must be called once before anything else – ideally as early as possible
|
|
29
|
+
* in your application lifecycle (start of `App.tsx`).
|
|
30
|
+
*/
|
|
31
|
+
async initialize(config) {
|
|
32
|
+
const environment = config.environment ?? 'production';
|
|
33
|
+
const logLevel = config.logLevel ?? 'error';
|
|
34
|
+
await nativeDigiaModule.initialize(config.apiKey, environment, logLevel);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Register a CEP plugin with the Digia SDK.
|
|
39
|
+
*
|
|
40
|
+
* On the first call this also wires the internal RNEventBridgePlugin with
|
|
41
|
+
* the native Android SDK so it holds the DigiaCEPDelegate reference needed
|
|
42
|
+
* to show overlays and emit lifecycle events back to JS. This is transparent
|
|
43
|
+
* bridge plumbing — you never interact with RNEventBridgePlugin directly.
|
|
44
|
+
*
|
|
45
|
+
* ```ts
|
|
46
|
+
* import { DigiaMoEngagePlugin } from '@digia/moengage-plugin';
|
|
47
|
+
*
|
|
48
|
+
* await Digia.initialize({ apiKey: 'YOUR_KEY' });
|
|
49
|
+
* Digia.register(new DigiaMoEngagePlugin({ moEngage: MoEngage }));
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
register(plugin) {
|
|
53
|
+
if (this._plugins.has(plugin.identifier)) {
|
|
54
|
+
this._plugins.get(plugin.identifier).teardown();
|
|
55
|
+
}
|
|
56
|
+
// Wire the native bridge plugin once, before the first plugin's setup()
|
|
57
|
+
// so the delegate is ready when JS campaigns start flowing.
|
|
58
|
+
if (!this._nativeBridgeWired) {
|
|
59
|
+
nativeDigiaModule.registerBridge();
|
|
60
|
+
this._nativeBridgeWired = true;
|
|
61
|
+
}
|
|
62
|
+
plugin.setup(this);
|
|
63
|
+
this._plugins.set(plugin.identifier, plugin);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Unregister a previously registered plugin.
|
|
68
|
+
* Calls plugin.teardown() internally.
|
|
69
|
+
*/
|
|
70
|
+
unregister(pluginOrId) {
|
|
71
|
+
const id = typeof pluginOrId === 'string' ? pluginOrId : pluginOrId.identifier;
|
|
72
|
+
this._plugins.get(id)?.teardown();
|
|
73
|
+
this._plugins.delete(id);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Notify the SDK of the currently active screen name.
|
|
78
|
+
*
|
|
79
|
+
* Wire this up to your navigation library's screen-change listener
|
|
80
|
+
* (e.g. React Navigation focus events or `useNavigationContainerRef`).
|
|
81
|
+
* All registered plugins will have forwardScreen() called automatically.
|
|
82
|
+
*/
|
|
83
|
+
setCurrentScreen(name) {
|
|
84
|
+
nativeDigiaModule.setCurrentScreen(name);
|
|
85
|
+
this._plugins.forEach(plugin => plugin.forwardScreen(name));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ── DigiaDelegate ────────────────────────────────────────────────────────
|
|
89
|
+
// Mirrors DigiaCEPDelegate on Android.
|
|
90
|
+
// Forwards to the native DigiaCEPDelegate via the bridge.
|
|
91
|
+
|
|
92
|
+
onCampaignTriggered(payload) {
|
|
93
|
+
nativeDigiaModule.triggerCampaign(payload.id, payload.content, payload.cepContext);
|
|
94
|
+
}
|
|
95
|
+
onCampaignInvalidated(campaignId) {
|
|
96
|
+
nativeDigiaModule.invalidateCampaign(campaignId);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
export const Digia = new DigiaClass();
|
|
100
|
+
//# sourceMappingURL=Digia.js.map
|
|
@@ -0,0 +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;AAGvD,MAAMC,UAAU,CAA0B;EACrBC,QAAQ,GAAG,IAAIC,GAAG,CAAsB,CAAC;EAC1D;EACA;EACQC,kBAAkB,GAAG,KAAK;;EAElC;AACJ;AACA;AACA;AACA;AACA;EACI,MAAMC,UAAUA,CAACC,MAAmB,EAAiB;IACjD,MAAMC,WAAW,GAAGD,MAAM,CAACC,WAAW,IAAI,YAAY;IACtD,MAAMC,QAAQ,GAAGF,MAAM,CAACE,QAAQ,IAAI,OAAO;IAC3C,MAAMR,iBAAiB,CAACK,UAAU,CAACC,MAAM,CAACG,MAAM,EAAEF,WAAW,EAAEC,QAAQ,CAAC;EAC5E;;EAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACIE,QAAQA,CAACC,MAAmB,EAAQ;IAChC,IAAI,IAAI,CAACT,QAAQ,CAACU,GAAG,CAACD,MAAM,CAACE,UAAU,CAAC,EAAE;MACtC,IAAI,CAACX,QAAQ,CAACY,GAAG,CAACH,MAAM,CAACE,UAAU,CAAC,CAAEE,QAAQ,CAAC,CAAC;IACpD;IACA;IACA;IACA,IAAI,CAAC,IAAI,CAACX,kBAAkB,EAAE;MAC1BJ,iBAAiB,CAACgB,cAAc,CAAC,CAAC;MAClC,IAAI,CAACZ,kBAAkB,GAAG,IAAI;IAClC;IACAO,MAAM,CAACM,KAAK,CAAC,IAAI,CAAC;IAClB,IAAI,CAACf,QAAQ,CAACgB,GAAG,CAACP,MAAM,CAACE,UAAU,EAAEF,MAAM,CAAC;EAChD;;EAEA;AACJ;AACA;AACA;EACIQ,UAAUA,CAACC,UAAgC,EAAQ;IAC/C,MAAMC,EAAE,GAAG,OAAOD,UAAU,KAAK,QAAQ,GAAGA,UAAU,GAAGA,UAAU,CAACP,UAAU;IAC9E,IAAI,CAACX,QAAQ,CAACY,GAAG,CAACO,EAAE,CAAC,EAAEN,QAAQ,CAAC,CAAC;IACjC,IAAI,CAACb,QAAQ,CAACoB,MAAM,CAACD,EAAE,CAAC;EAC5B;;EAEA;AACJ;AACA;AACA;AACA;AACA;AACA;EACIE,gBAAgBA,CAACC,IAAY,EAAQ;IACjCxB,iBAAiB,CAACuB,gBAAgB,CAACC,IAAI,CAAC;IACxC,IAAI,CAACtB,QAAQ,CAACuB,OAAO,CAAEd,MAAM,IAAKA,MAAM,CAACe,aAAa,CAACF,IAAI,CAAC,CAAC;EACjE;;EAEA;EACA;EACA;;EAEAG,mBAAmBA,CAACC,OAAqB,EAAQ;IAC7C5B,iBAAiB,CAAC6B,eAAe,CAACD,OAAO,CAACP,EAAE,EAAEO,OAAO,CAACE,OAAO,EAAEF,OAAO,CAACG,UAAU,CAAC;EACtF;EAEAC,qBAAqBA,CAACC,UAAkB,EAAQ;IAC5CjC,iBAAiB,CAACkC,kBAAkB,CAACD,UAAU,CAAC;EACpD;AAEJ;AAEA,OAAO,MAAME,KAAK,GAAG,IAAIlC,UAAU,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DigiaHostView
|
|
3
|
+
*
|
|
4
|
+
* A transparent React Native view that attaches the Digia Android Compose
|
|
5
|
+
* overlay layer (dialogs, bottom sheets) on top of your app's content.
|
|
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
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
import React from 'react';
|
|
35
|
+
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
|
+
|
|
45
|
+
export function DigiaHostView({
|
|
46
|
+
style
|
|
47
|
+
}) {
|
|
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.
|
|
52
|
+
return /*#__PURE__*/React.createElement(NativeDigiaHostView, {
|
|
53
|
+
style: StyleSheet.flatten([styles.host, style])
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// iOS / other platforms: no-op, nothing to mount.
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const styles = StyleSheet.create({
|
|
61
|
+
host: {
|
|
62
|
+
width: 0,
|
|
63
|
+
height: 0,
|
|
64
|
+
overflow: 'hidden'
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=DigiaHostView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Platform","StyleSheet","requireNativeComponent","NativeDigiaHostView","OS","DigiaHostView","style","createElement","flatten","styles","host","create","width","height","overflow"],"sourceRoot":"../../src","sources":["DigiaHostView.tsx"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACIC,QAAQ,EACRC,UAAU,EACVC,sBAAsB,QAGnB,cAAc;;AAMrB;;AAKA;AACA;AACA,MAAMC,mBAAmB,GACrBH,QAAQ,CAACI,EAAE,KAAK,SAAS,GACnBF,sBAAsB,CAA2B,eAAe,CAAC,GACjE,IAAI;;AAEd;;AAEA,OAAO,SAASG,aAAaA,CAAC;EAAEC;AAA0B,CAAC,EAAE;EACzD,IAAIN,QAAQ,CAACI,EAAE,KAAK,SAAS,IAAID,mBAAmB,EAAE;IAClD;IACA;IACA;IACA,oBACIJ,KAAA,CAAAQ,aAAA,CAACJ,mBAAmB;MAChBG,KAAK,EAAEL,UAAU,CAACO,OAAO,CAAC,CAACC,MAAM,CAACC,IAAI,EAAEJ,KAAK,CAAC;IAAE,CACnD,CAAC;EAEV;;EAEA;EACA,OAAO,IAAI;AACf;AAEA,MAAMG,MAAM,GAAGR,UAAU,CAACU,MAAM,CAAC;EAC7BD,IAAI,EAAE;IACFE,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,QAAQ,EAAE;EACd;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DigiaSlotView
|
|
3
|
+
*
|
|
4
|
+
* A React Native view that renders inline campaign content (banners, cards,
|
|
5
|
+
* widgets) at a specific placement position inside your screen layout.
|
|
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
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
import React from 'react';
|
|
45
|
+
import { Platform, requireNativeComponent } from 'react-native';
|
|
46
|
+
// Fabric (New Architecture) resolves view configs lazily — no UIManager
|
|
47
|
+
// guard needed. requireNativeComponent is called unconditionally on Android.
|
|
48
|
+
const NativeDigiaSlotView = Platform.OS === 'android' ? requireNativeComponent('DigiaSlotView') : null;
|
|
49
|
+
|
|
50
|
+
// ── DigiaSlotView ─────────────────────────────────────────────────────────────
|
|
51
|
+
|
|
52
|
+
export function DigiaSlotView({
|
|
53
|
+
placementKey,
|
|
54
|
+
style
|
|
55
|
+
}) {
|
|
56
|
+
if (Platform.OS === 'android' && NativeDigiaSlotView) {
|
|
57
|
+
return /*#__PURE__*/React.createElement(NativeDigiaSlotView, {
|
|
58
|
+
placementKey: placementKey,
|
|
59
|
+
style: style
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// iOS / other platforms: not yet implemented — render nothing.
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=DigiaSlotView.js.map
|
|
@@ -0,0 +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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACIC,QAAQ,EACRC,sBAAsB,QAGnB,cAAc;AAQrB;AACA;AACA,MAAMC,mBAAmB,GACrBF,QAAQ,CAACG,EAAE,KAAK,SAAS,GACnBF,sBAAsB,CAAqB,eAAe,CAAC,GAC3D,IAAI;;AAEd;;AAEA,OAAO,SAASG,aAAaA,CAAC;EAAEC,YAAY;EAAEC;AAA0B,CAAC,EAAE;EACvE,IAAIN,QAAQ,CAACG,EAAE,KAAK,SAAS,IAAID,mBAAmB,EAAE;IAClD,oBACIH,KAAA,CAAAQ,aAAA,CAACL,mBAAmB;MAChBG,YAAY,EAAEA,YAAa;MAC3BC,KAAK,EAAEA;IAAM,CAChB,CAAC;EAEV;;EAEA;EACA,OAAO,IAAI;AACf","ignoreList":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NativeDigiaModule
|
|
3
|
+
*
|
|
4
|
+
* Low-level TurboModule binding to the native Digia Engage module.
|
|
5
|
+
*
|
|
6
|
+
* The module is resolved lazily on first use (not at import time) so that
|
|
7
|
+
* module evaluation before native initialisation doesn't throw.
|
|
8
|
+
* Resolution order:
|
|
9
|
+
* 1. TurboModuleRegistry.get() — New Architecture / JSI path
|
|
10
|
+
* 2. NativeModules — bridge interop layer (RN 0.73+ New Arch
|
|
11
|
+
* with isTurboModule: false in ReactModuleInfo)
|
|
12
|
+
* 3. null — non-Android environments; methods no-op
|
|
13
|
+
*
|
|
14
|
+
* Prefer using the high-level `Digia` singleton from `index.ts`.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { NativeModules, TurboModuleRegistry } from 'react-native';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Codegen spec — drives Android/iOS TurboModule generation.
|
|
21
|
+
*
|
|
22
|
+
* Rules for codegen compatibility:
|
|
23
|
+
* • File must be named `Native*.ts` (already satisfied).
|
|
24
|
+
* • All method parameter types must be scalar, Promise, Object, or Array.
|
|
25
|
+
* • `Object` maps to ReadableMap on Android, NSDictionary on iOS.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
// Try TurboModuleRegistry first (New Architecture / JSI).
|
|
29
|
+
// Fall back to NativeModules (bridge interop layer — enabled by default in
|
|
30
|
+
// RN 0.73+ New Architecture when the module is registered with
|
|
31
|
+
// isTurboModule: false in ReactModuleInfo).
|
|
32
|
+
// If neither resolves, warn in DEV and use no-op stubs so non-Android
|
|
33
|
+
// environments (web, Storybook) don't crash.
|
|
34
|
+
let _resolved = null;
|
|
35
|
+
function getModule() {
|
|
36
|
+
if (_resolved !== null) return _resolved;
|
|
37
|
+
_resolved = TurboModuleRegistry.get('DigiaEngageModule') ?? NativeModules.DigiaEngageModule ?? null;
|
|
38
|
+
if (__DEV__ && !_resolved) {
|
|
39
|
+
console.warn('[Digia] DigiaEngageModule not found.\n' + 'Make sure @digia/engage is linked and the app has been rebuilt.');
|
|
40
|
+
}
|
|
41
|
+
return _resolved;
|
|
42
|
+
}
|
|
43
|
+
export const nativeDigiaModule = {
|
|
44
|
+
initialize: (apiKey, environment, logLevel) => getModule()?.initialize(apiKey, environment, logLevel) ?? Promise.resolve(),
|
|
45
|
+
registerBridge: () => getModule()?.registerBridge(),
|
|
46
|
+
setCurrentScreen: name => getModule()?.setCurrentScreen(name),
|
|
47
|
+
triggerCampaign: (id, content, cepContext) => getModule()?.triggerCampaign(id, content, cepContext),
|
|
48
|
+
invalidateCampaign: campaignId => getModule()?.invalidateCampaign(campaignId),
|
|
49
|
+
getConstants: () => getModule()?.getConstants?.() ?? {}
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=NativeDigiaModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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":["NativeDigiaModule.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;;AA6BA;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":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @digia/engage-react-native
|
|
3
|
+
*
|
|
4
|
+
* React Native bridge for the Digia Engage SDK.
|
|
5
|
+
*
|
|
6
|
+
* The SDK surfaces Digia Compose UI inside React Native via:
|
|
7
|
+
* • `Digia` – SDK lifecycle (initialize, setCurrentScreen)
|
|
8
|
+
* • `DigiaHostView` – Transparent native overlay view that hosts Compose dialogs/
|
|
9
|
+
* bottom-sheets managed by the Digia CEP engine.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export { Digia } from './Digia';
|
|
13
|
+
export { DigiaHostView } from './DigiaHostView';
|
|
14
|
+
export { DigiaSlotView } from './DigiaSlotView';
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Digia","DigiaHostView","DigiaSlotView"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,KAAK,QAAQ,SAAS;AAC/B,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,aAAa,QAAQ,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|