@digia-engage/core 1.1.1 → 2.0.0-rc.2
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/README.md +134 -51
- package/android/build.gradle +3 -3
- package/android/src/main/java/com/digia/engage/rn/DigiaModule.kt +52 -8
- package/android/src/main/java/com/digia/engage/rn/DigiaSlotViewManager.kt +6 -2
- package/android/src/main/java/com/digia/engage/rn/DigiaViewManager.kt +1 -0
- package/ios/DigiaEngageModule.m +7 -1
- package/ios/DigiaHostViewManager.swift +20 -20
- package/ios/DigiaModule.swift +8 -4
- package/lib/commonjs/Digia.js +390 -4
- package/lib/commonjs/Digia.js.map +1 -1
- package/lib/commonjs/DigiaAnchorView.js +35 -3
- package/lib/commonjs/DigiaAnchorView.js.map +1 -1
- package/lib/commonjs/DigiaGuideController.js +59 -0
- package/lib/commonjs/DigiaGuideController.js.map +1 -0
- package/lib/commonjs/DigiaHealthReporter.js +45 -0
- package/lib/commonjs/DigiaHealthReporter.js.map +1 -0
- package/lib/commonjs/DigiaProvider.js +1081 -0
- package/lib/commonjs/DigiaProvider.js.map +1 -0
- package/lib/commonjs/DigiaSlotView.js +18 -3
- package/lib/commonjs/DigiaSlotView.js.map +1 -1
- package/lib/commonjs/NativeDigiaEngage.js +14 -8
- package/lib/commonjs/NativeDigiaEngage.js.map +1 -1
- package/lib/commonjs/actionHandler.js +316 -0
- package/lib/commonjs/actionHandler.js.map +1 -0
- package/lib/commonjs/defaultInAppBrowser.js +31 -0
- package/lib/commonjs/defaultInAppBrowser.js.map +1 -0
- package/lib/commonjs/digiaAnchorRegistry.js +32 -0
- package/lib/commonjs/digiaAnchorRegistry.js.map +1 -0
- package/lib/commonjs/frequencyEvaluator.js +70 -0
- package/lib/commonjs/frequencyEvaluator.js.map +1 -0
- package/lib/commonjs/frequencyStore.js +70 -0
- package/lib/commonjs/frequencyStore.js.map +1 -0
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/templateTypes.js +2 -0
- package/lib/commonjs/templateTypes.js.map +1 -0
- package/lib/module/Digia.js +389 -4
- package/lib/module/Digia.js.map +1 -1
- package/lib/module/DigiaAnchorView.js +33 -1
- package/lib/module/DigiaAnchorView.js.map +1 -1
- package/lib/module/DigiaGuideController.js +53 -0
- package/lib/module/DigiaGuideController.js.map +1 -0
- package/lib/module/DigiaHealthReporter.js +38 -0
- package/lib/module/DigiaHealthReporter.js.map +1 -0
- package/lib/module/DigiaProvider.js +1074 -0
- package/lib/module/DigiaProvider.js.map +1 -0
- package/lib/module/DigiaSlotView.js +20 -5
- package/lib/module/DigiaSlotView.js.map +1 -1
- package/lib/module/NativeDigiaEngage.js +14 -8
- package/lib/module/NativeDigiaEngage.js.map +1 -1
- package/lib/module/actionHandler.js +311 -0
- package/lib/module/actionHandler.js.map +1 -0
- package/lib/module/defaultInAppBrowser.js +25 -0
- package/lib/module/defaultInAppBrowser.js.map +1 -0
- package/lib/module/digiaAnchorRegistry.js +26 -0
- package/lib/module/digiaAnchorRegistry.js.map +1 -0
- package/lib/module/frequencyEvaluator.js +61 -0
- package/lib/module/frequencyEvaluator.js.map +1 -0
- package/lib/module/frequencyStore.js +64 -0
- package/lib/module/frequencyStore.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/templateTypes.js +2 -0
- package/lib/module/templateTypes.js.map +1 -0
- package/lib/typescript/Digia.d.ts +35 -3
- package/lib/typescript/Digia.d.ts.map +1 -1
- package/lib/typescript/DigiaAnchorView.d.ts +5 -1
- package/lib/typescript/DigiaAnchorView.d.ts.map +1 -1
- package/lib/typescript/DigiaGuideController.d.ts +30 -0
- package/lib/typescript/DigiaGuideController.d.ts.map +1 -0
- package/lib/typescript/DigiaHealthReporter.d.ts +24 -0
- package/lib/typescript/DigiaHealthReporter.d.ts.map +1 -0
- package/lib/typescript/DigiaProvider.d.ts +3 -0
- package/lib/typescript/DigiaProvider.d.ts.map +1 -0
- package/lib/typescript/DigiaSlotView.d.ts.map +1 -1
- package/lib/typescript/NativeDigiaEngage.d.ts +10 -6
- package/lib/typescript/NativeDigiaEngage.d.ts.map +1 -1
- package/lib/typescript/actionHandler.d.ts +20 -0
- package/lib/typescript/actionHandler.d.ts.map +1 -0
- package/lib/typescript/defaultInAppBrowser.d.ts +3 -0
- package/lib/typescript/defaultInAppBrowser.d.ts.map +1 -0
- package/lib/typescript/digiaAnchorRegistry.d.ts +15 -0
- package/lib/typescript/digiaAnchorRegistry.d.ts.map +1 -0
- package/lib/typescript/frequencyEvaluator.d.ts +14 -0
- package/lib/typescript/frequencyEvaluator.d.ts.map +1 -0
- package/lib/typescript/frequencyStore.d.ts +7 -0
- package/lib/typescript/frequencyStore.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/templateTypes.d.ts +140 -0
- package/lib/typescript/templateTypes.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +163 -4
- package/lib/typescript/types.d.ts.map +1 -1
- package/package.json +15 -3
- package/src/Digia.ts +439 -4
- package/src/DigiaAnchorView.tsx +30 -2
- package/src/DigiaGuideController.ts +61 -0
- package/src/DigiaHealthReporter.ts +43 -0
- package/src/DigiaProvider.tsx +778 -0
- package/src/DigiaSlotView.tsx +26 -6
- package/src/NativeDigiaEngage.ts +28 -13
- package/src/actionHandler.ts +311 -0
- package/src/defaultInAppBrowser.ts +31 -0
- package/src/digiaAnchorRegistry.ts +27 -0
- package/src/frequencyEvaluator.ts +57 -0
- package/src/frequencyStore.ts +79 -0
- package/src/index.ts +1 -0
- package/src/templateTypes.ts +121 -0
- package/src/types.ts +132 -6
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const WINDOW_MS = {
|
|
2
|
+
day: 86_400_000,
|
|
3
|
+
week: 7 * 86_400_000,
|
|
4
|
+
month: 30 * 86_400_000
|
|
5
|
+
};
|
|
6
|
+
export const isSessionPolicy = policy => policy.max_per_window?.window === 'session';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Pure eligibility function. No side effects.
|
|
10
|
+
*
|
|
11
|
+
* Semantics for max_per_window { count, window }:
|
|
12
|
+
* - "count" shows are allowed, measured from first_shown_at.
|
|
13
|
+
* - Once the window duration has elapsed since first_shown_at, permanently blocked (reason: 'window').
|
|
14
|
+
* - Once shown_count >= count, permanently blocked (reason: 'max_total').
|
|
15
|
+
* - 'session' window is checked by the caller via in-memory state — same logic applies.
|
|
16
|
+
*/
|
|
17
|
+
export const evaluate = (policy, state, now) => {
|
|
18
|
+
if (!state) return {
|
|
19
|
+
allow: true,
|
|
20
|
+
reason: null
|
|
21
|
+
};
|
|
22
|
+
if (state.stopped_at !== null) {
|
|
23
|
+
return {
|
|
24
|
+
allow: false,
|
|
25
|
+
reason: 'stopped'
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (policy.max_total !== null && state.shown_count >= policy.max_total) {
|
|
29
|
+
return {
|
|
30
|
+
allow: false,
|
|
31
|
+
reason: 'max_total'
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (policy.max_per_window !== null) {
|
|
35
|
+
const {
|
|
36
|
+
count,
|
|
37
|
+
window: win
|
|
38
|
+
} = policy.max_per_window;
|
|
39
|
+
const windowMs = WINDOW_MS[win];
|
|
40
|
+
if (windowMs !== undefined && state.first_shown_at !== null) {
|
|
41
|
+
if (now - state.first_shown_at > windowMs) {
|
|
42
|
+
return {
|
|
43
|
+
allow: false,
|
|
44
|
+
reason: 'window'
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (state.shown_count >= count) {
|
|
49
|
+
return {
|
|
50
|
+
allow: false,
|
|
51
|
+
reason: 'max_total'
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
allow: true,
|
|
57
|
+
reason: null
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export const hasPolicy = policy => policy !== null && policy !== undefined && (policy.max_total !== null || policy.max_per_window !== null || policy.stop_on !== null);
|
|
61
|
+
//# sourceMappingURL=frequencyEvaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["WINDOW_MS","day","week","month","isSessionPolicy","policy","max_per_window","window","evaluate","state","now","allow","reason","stopped_at","max_total","shown_count","count","win","windowMs","undefined","first_shown_at","hasPolicy","stop_on"],"sourceRoot":"../../src","sources":["frequencyEvaluator.ts"],"mappings":"AAEA,MAAMA,SAAiC,GAAG;EACtCC,GAAG,EAAI,UAAU;EACjBC,IAAI,EAAG,CAAC,GAAG,UAAU;EACrBC,KAAK,EAAE,EAAE,GAAG;AAChB,CAAC;AAED,OAAO,MAAMC,eAAe,GAAIC,MAAuB,IACnDA,MAAM,CAACC,cAAc,EAAEC,MAAM,KAAK,SAAS;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,GAAGA,CACpBH,MAAuB,EACvBI,KAA4B,EAC5BC,GAAW,KACW;EACtB,IAAI,CAACD,KAAK,EAAE,OAAO;IAAEE,KAAK,EAAE,IAAI;IAAEC,MAAM,EAAE;EAAK,CAAC;EAEhD,IAAIH,KAAK,CAACI,UAAU,KAAK,IAAI,EAAE;IAC3B,OAAO;MAAEF,KAAK,EAAE,KAAK;MAAEC,MAAM,EAAE;IAAU,CAAC;EAC9C;EAEA,IAAIP,MAAM,CAACS,SAAS,KAAK,IAAI,IAAIL,KAAK,CAACM,WAAW,IAAIV,MAAM,CAACS,SAAS,EAAE;IACpE,OAAO;MAAEH,KAAK,EAAE,KAAK;MAAEC,MAAM,EAAE;IAAY,CAAC;EAChD;EAEA,IAAIP,MAAM,CAACC,cAAc,KAAK,IAAI,EAAE;IAChC,MAAM;MAAEU,KAAK;MAAET,MAAM,EAAEU;IAAI,CAAC,GAAGZ,MAAM,CAACC,cAAc;IACpD,MAAMY,QAAQ,GAAGlB,SAAS,CAACiB,GAAG,CAAC;IAE/B,IAAIC,QAAQ,KAAKC,SAAS,IAAIV,KAAK,CAACW,cAAc,KAAK,IAAI,EAAE;MACzD,IAAIV,GAAG,GAAGD,KAAK,CAACW,cAAc,GAAGF,QAAQ,EAAE;QACvC,OAAO;UAAEP,KAAK,EAAE,KAAK;UAAEC,MAAM,EAAE;QAAS,CAAC;MAC7C;IACJ;IAEA,IAAIH,KAAK,CAACM,WAAW,IAAIC,KAAK,EAAE;MAC5B,OAAO;QAAEL,KAAK,EAAE,KAAK;QAAEC,MAAM,EAAE;MAAY,CAAC;IAChD;EACJ;EAEA,OAAO;IAAED,KAAK,EAAE,IAAI;IAAEC,MAAM,EAAE;EAAK,CAAC;AACxC,CAAC;AAED,OAAO,MAAMS,SAAS,GAAIhB,MAA0C,IAChEA,MAAM,KAAK,IAAI,IACfA,MAAM,KAAKc,SAAS,KACnBd,MAAM,CAACS,SAAS,KAAK,IAAI,IAAIT,MAAM,CAACC,cAAc,KAAK,IAAI,IAAID,MAAM,CAACiB,OAAO,KAAK,IAAI,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2
|
+
const STORE_META_KEY = 'digia:freq:__meta__';
|
|
3
|
+
let _storage = null;
|
|
4
|
+
const _loadStorage = () => {
|
|
5
|
+
try {
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
7
|
+
const mod = require('@react-native-async-storage/async-storage');
|
|
8
|
+
return mod.default ?? mod;
|
|
9
|
+
} catch {
|
|
10
|
+
console.warn('[Digia] AsyncStorage unavailable — frequency state is in-memory only (resets on app restart)');
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const getStorage = () => {
|
|
15
|
+
if (_storage === undefined) {
|
|
16
|
+
_storage = _loadStorage();
|
|
17
|
+
}
|
|
18
|
+
return _storage;
|
|
19
|
+
};
|
|
20
|
+
const _sessionStore = new Map();
|
|
21
|
+
const storeKey = campaignKey => `digia:freq:${campaignKey}`;
|
|
22
|
+
export const frequencyStore = {
|
|
23
|
+
async checkProjectId(projectId) {
|
|
24
|
+
const storage = getStorage();
|
|
25
|
+
if (!storage) return;
|
|
26
|
+
try {
|
|
27
|
+
const stored = await storage.getItem(STORE_META_KEY);
|
|
28
|
+
const meta = stored ? JSON.parse(stored) : null;
|
|
29
|
+
if (meta && meta.projectId !== projectId) {
|
|
30
|
+
const keys = await storage.getAllKeys();
|
|
31
|
+
const digiaKeys = keys.filter(k => k.startsWith('digia:freq:'));
|
|
32
|
+
if (digiaKeys.length > 0) await storage.multiRemove([...digiaKeys]);
|
|
33
|
+
}
|
|
34
|
+
await storage.setItem(STORE_META_KEY, JSON.stringify({
|
|
35
|
+
projectId
|
|
36
|
+
}));
|
|
37
|
+
} catch {
|
|
38
|
+
// non-fatal
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
async get(campaignKey, isSession) {
|
|
42
|
+
if (isSession) return _sessionStore.get(campaignKey) ?? null;
|
|
43
|
+
const storage = getStorage();
|
|
44
|
+
if (!storage) return _sessionStore.get(campaignKey) ?? null;
|
|
45
|
+
try {
|
|
46
|
+
const raw = await storage.getItem(storeKey(campaignKey));
|
|
47
|
+
return raw ? JSON.parse(raw) : null;
|
|
48
|
+
} catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
async set(campaignKey, state, isSession) {
|
|
53
|
+
_sessionStore.set(campaignKey, state);
|
|
54
|
+
if (isSession) return;
|
|
55
|
+
const storage = getStorage();
|
|
56
|
+
if (!storage) return;
|
|
57
|
+
try {
|
|
58
|
+
await storage.setItem(storeKey(campaignKey), JSON.stringify(state));
|
|
59
|
+
} catch {
|
|
60
|
+
// non-fatal: state already updated in-memory above
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=frequencyStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["STORE_META_KEY","_storage","_loadStorage","mod","require","default","console","warn","getStorage","undefined","_sessionStore","Map","storeKey","campaignKey","frequencyStore","checkProjectId","projectId","storage","stored","getItem","meta","JSON","parse","keys","getAllKeys","digiaKeys","filter","k","startsWith","length","multiRemove","setItem","stringify","get","isSession","raw","set","state"],"sourceRoot":"../../src","sources":["frequencyStore.ts"],"mappings":"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","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
export { Digia } from './Digia';
|
|
13
13
|
export { DigiaHostView } from './DigiaHostView';
|
|
14
|
+
export { DigiaHost } from './DigiaProvider';
|
|
14
15
|
export { DigiaSlotView } from './DigiaSlotView';
|
|
15
16
|
export { DigiaAnchorView } from './DigiaAnchorView';
|
|
16
17
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Digia","DigiaHostView","DigiaSlotView","DigiaAnchorView"],"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;AAC/C,SAASC,eAAe,QAAQ,mBAAmB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Digia","DigiaHostView","DigiaHost","DigiaSlotView","DigiaAnchorView"],"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,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,eAAe,QAAQ,mBAAmB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["templateTypes.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* import { Digia } from '@digia/engage-react-native';
|
|
8
8
|
*
|
|
9
9
|
* // In your App entry point (e.g. App.tsx):
|
|
10
|
-
* await Digia.initialize({
|
|
10
|
+
* await Digia.initialize({ projectId: 'YOUR_PROJECT_ID' });
|
|
11
11
|
*
|
|
12
12
|
* // Whenever your navigation screen changes:
|
|
13
13
|
* Digia.setCurrentScreen('Home');
|
|
@@ -20,6 +20,14 @@ declare class DigiaClass implements DigiaDelegate {
|
|
|
20
20
|
private _nativeBridgeWired;
|
|
21
21
|
private readonly _activePayloads;
|
|
22
22
|
private _engageSubscription;
|
|
23
|
+
private _projectId;
|
|
24
|
+
private _deviceId;
|
|
25
|
+
private _apiBaseUrl;
|
|
26
|
+
private _logLevel;
|
|
27
|
+
private _fontFamily;
|
|
28
|
+
private _currentScreen;
|
|
29
|
+
private readonly _campaignsByKey;
|
|
30
|
+
private readonly _registeredAnchorKeys;
|
|
23
31
|
/**
|
|
24
32
|
* Initialise the Digia Engage SDK.
|
|
25
33
|
*
|
|
@@ -38,7 +46,7 @@ declare class DigiaClass implements DigiaDelegate {
|
|
|
38
46
|
* ```ts
|
|
39
47
|
* import { DigiaMoEngagePlugin } from '@digia/moengage-plugin';
|
|
40
48
|
*
|
|
41
|
-
* await Digia.initialize({
|
|
49
|
+
* await Digia.initialize({ projectId: 'YOUR_PROJECT_ID' });
|
|
42
50
|
* Digia.register(new DigiaMoEngagePlugin({ moEngage: MoEngage }));
|
|
43
51
|
* ```
|
|
44
52
|
*/
|
|
@@ -56,7 +64,15 @@ declare class DigiaClass implements DigiaDelegate {
|
|
|
56
64
|
* All registered plugins will have forwardScreen() called automatically.
|
|
57
65
|
*/
|
|
58
66
|
setCurrentScreen(name: string): void;
|
|
59
|
-
|
|
67
|
+
registerAnchor(anchorKey: string, _screenName?: string | null): void;
|
|
68
|
+
unregisterAnchor(anchorKey: string): void;
|
|
69
|
+
/**
|
|
70
|
+
* Global font family configured via {@link initialize}, or `undefined` when
|
|
71
|
+
* none was set. Used by the JS-rendered guide overlays (tooltip/spotlight)
|
|
72
|
+
* so their text matches native-rendered campaigns.
|
|
73
|
+
*/
|
|
74
|
+
get fontFamily(): string | undefined;
|
|
75
|
+
onCampaignTriggered(payload: InAppPayload): Promise<void>;
|
|
60
76
|
onCampaignInvalidated(campaignId: string): void;
|
|
61
77
|
/**
|
|
62
78
|
* Subscribes to `digiaOverlayEvent` emitted by the native
|
|
@@ -68,6 +84,22 @@ declare class DigiaClass implements DigiaDelegate {
|
|
|
68
84
|
*/
|
|
69
85
|
private _startEngageListener;
|
|
70
86
|
private _forwardExperienceEvent;
|
|
87
|
+
private _onGuideLifecycleEvent;
|
|
88
|
+
private _guideEventName;
|
|
89
|
+
private _buildGuideProperties;
|
|
90
|
+
private _resolveApiBaseUrl;
|
|
91
|
+
private _refreshCampaignStore;
|
|
92
|
+
private _sdkPost;
|
|
93
|
+
private _extractApiResponse;
|
|
94
|
+
private _emitSlotWidth;
|
|
95
|
+
private _extractCampaignKey;
|
|
96
|
+
private _extractString;
|
|
97
|
+
private _parseTemplateConfig;
|
|
98
|
+
private _loadOrCreateDeviceId;
|
|
99
|
+
private _getFrequencyState;
|
|
100
|
+
_bumpFrequencyImpression(campaignKey: string): Promise<void>;
|
|
101
|
+
_applyStopOn(campaignKey: string, interactionType: 'click' | 'dismiss'): Promise<void>;
|
|
102
|
+
private _log;
|
|
71
103
|
}
|
|
72
104
|
export declare const Digia: DigiaClass;
|
|
73
105
|
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;AAUH,OAAO,KAAK,EAER,WAAW,EACX,aAAa,EAEb,WAAW,EAIX,YAAY,EACf,MAAM,SAAS,CAAC;AAgBjB,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;IAC9D,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,SAAS,CAAoC;IACrD,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAkC;IAClE,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAqB;IAE3D;;;;;OAKG;IACG,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA4BpD;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAgBnC;;;OAGG;IACH,UAAU,CAAC,UAAU,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI;IAMlD;;;;;;OAMG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAMpC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAMpE,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAIzC;;;;OAIG;IACH,IAAI,UAAU,IAAI,MAAM,GAAG,SAAS,CAEnC;IAOK,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAiF/D,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAQ/C;;;;;;;OAOG;IACH,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,uBAAuB;IA8B/B,OAAO,CAAC,sBAAsB;IA8B9B,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,qBAAqB;IAqC7B,OAAO,CAAC,kBAAkB;YAOZ,qBAAqB;YAgCrB,QAAQ;IAmBtB,OAAO,CAAC,mBAAmB;IAmB3B,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,mBAAmB;IAc3B,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,oBAAoB;YAkBd,qBAAqB;YAiBrB,kBAAkB;IAI1B,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB5D,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAsB5F,OAAO,CAAC,IAAI;CAMf;AAED,eAAO,MAAM,KAAK,YAAmB,CAAC"}
|
|
@@ -5,17 +5,21 @@
|
|
|
5
5
|
* When a SHOW_TOOLTIP or SHOW_SPOTLIGHT campaign fires, the native SDK looks up this view
|
|
6
6
|
* via AnchorRegistry and uses getLocationOnScreen() for accurate pixel-perfect coordinates.
|
|
7
7
|
*
|
|
8
|
+
* Also reports layout into the JS digiaAnchorRegistry so JS-rendered guides (tooltip/spotlight)
|
|
9
|
+
* can position themselves relative to this anchor.
|
|
10
|
+
*
|
|
8
11
|
* Usage:
|
|
9
12
|
* <DigiaAnchorView anchorKey="pdp_add_to_cart" style={{ alignSelf: 'flex-start' }}>
|
|
10
13
|
* <TouchableOpacity ...>Add to Cart</TouchableOpacity>
|
|
11
14
|
* </DigiaAnchorView>
|
|
12
15
|
*/
|
|
16
|
+
import React from 'react';
|
|
13
17
|
import { type ViewProps } from 'react-native';
|
|
14
18
|
interface DigiaAnchorViewProps extends ViewProps {
|
|
15
19
|
anchorKey: string;
|
|
16
20
|
/** Corner radius in dp — used to round the spotlight cutout to match the wrapped button. */
|
|
17
21
|
cornerRadius?: number;
|
|
18
22
|
}
|
|
19
|
-
export declare const DigiaAnchorView:
|
|
23
|
+
export declare const DigiaAnchorView: ({ anchorKey, onLayout, ...rest }: DigiaAnchorViewProps) => React.JSX.Element;
|
|
20
24
|
export {};
|
|
21
25
|
//# sourceMappingURL=DigiaAnchorView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DigiaAnchorView.d.ts","sourceRoot":"","sources":["../../src/DigiaAnchorView.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"DigiaAnchorView.d.ts","sourceRoot":"","sources":["../../src/DigiaAnchorView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,EAAgC,KAAK,SAAS,EAA0B,MAAM,cAAc,CAAC;AAGpG,UAAU,oBAAqB,SAAQ,SAAS;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,4FAA4F;IAC5F,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAID,eAAO,MAAM,eAAe,GAAI,kCAAkC,oBAAoB,sBAqBrF,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { GuideLifecycleEvent } from './types';
|
|
2
|
+
import type { TemplateConfig } from './templateTypes';
|
|
3
|
+
export interface DigiaGuideRequest {
|
|
4
|
+
payloadId: string;
|
|
5
|
+
campaignKey: string;
|
|
6
|
+
/** Digia backend UUID for this campaign (from the campaign store _id field). */
|
|
7
|
+
campaignId: string;
|
|
8
|
+
config: TemplateConfig;
|
|
9
|
+
onExperienceEvent: (event: GuideLifecycleEvent) => void;
|
|
10
|
+
}
|
|
11
|
+
type DigiaGuideControllerEvent = {
|
|
12
|
+
type: 'start';
|
|
13
|
+
request: DigiaGuideRequest;
|
|
14
|
+
} | {
|
|
15
|
+
type: 'cancel';
|
|
16
|
+
payloadId: string;
|
|
17
|
+
};
|
|
18
|
+
type DigiaGuideListener = (event: DigiaGuideControllerEvent) => void;
|
|
19
|
+
declare class DigiaGuideController {
|
|
20
|
+
private _listener;
|
|
21
|
+
private _queue;
|
|
22
|
+
private _activeRequest;
|
|
23
|
+
subscribe(listener: DigiaGuideListener): () => void;
|
|
24
|
+
start(request: DigiaGuideRequest): boolean;
|
|
25
|
+
cancel(payloadId: string): void;
|
|
26
|
+
private _dispatchNext;
|
|
27
|
+
}
|
|
28
|
+
export declare const digiaGuideController: DigiaGuideController;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=DigiaGuideController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DigiaGuideController.d.ts","sourceRoot":"","sources":["../../src/DigiaGuideController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,WAAW,iBAAiB;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,cAAc,CAAC;IACvB,iBAAiB,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;CAC3D;AAED,KAAK,yBAAyB,GACxB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,iBAAiB,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5C,KAAK,kBAAkB,GAAG,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;AAErE,cAAM,oBAAoB;IACtB,OAAO,CAAC,SAAS,CAAmC;IACpD,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,cAAc,CAAkC;IAExD,SAAS,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,IAAI;IAUnD,KAAK,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO;IAU1C,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAS/B,OAAO,CAAC,aAAa;CAMxB;AAED,eAAO,MAAM,oBAAoB,sBAA6B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const HealthEventType: {
|
|
2
|
+
readonly campaign_key_mismatch: "campaign_key_mismatch";
|
|
3
|
+
readonly component_orphaned: "component_orphaned";
|
|
4
|
+
readonly anchor_not_on_screen: "anchor_not_on_screen";
|
|
5
|
+
readonly host_not_mounted: "host_not_mounted";
|
|
6
|
+
readonly plugin_not_registered: "plugin_not_registered";
|
|
7
|
+
readonly fetch_failed: "fetch_failed";
|
|
8
|
+
readonly action_handler_threw: "action_handler_threw";
|
|
9
|
+
readonly action_handler_timeout: "action_handler_timeout";
|
|
10
|
+
readonly deep_link_no_handler: "deep_link_no_handler";
|
|
11
|
+
readonly invalid_action_url: "invalid_action_url";
|
|
12
|
+
readonly inapp_browser_unavailable: "inapp_browser_unavailable";
|
|
13
|
+
readonly invalid_action_context: "invalid_action_context";
|
|
14
|
+
readonly cold_start_queue_overflow: "cold_start_queue_overflow";
|
|
15
|
+
};
|
|
16
|
+
export type HealthEventType = (typeof HealthEventType)[keyof typeof HealthEventType];
|
|
17
|
+
export declare class DigiaHealthReporter {
|
|
18
|
+
private _projectId;
|
|
19
|
+
private _baseUrl;
|
|
20
|
+
init(projectId: string, baseUrl: string): void;
|
|
21
|
+
report(eventType: HealthEventType, detail: Record<string, unknown>): void;
|
|
22
|
+
}
|
|
23
|
+
export declare const digiaHealthReporter: DigiaHealthReporter;
|
|
24
|
+
//# sourceMappingURL=DigiaHealthReporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DigiaHealthReporter.d.ts","sourceRoot":"","sources":["../../src/DigiaHealthReporter.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;CAclB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAErF,qBAAa,mBAAmB;IAC5B,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,QAAQ,CAAM;IAEtB,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAK9C,MAAM,CAAC,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAa5E;AAED,eAAO,MAAM,mBAAmB,qBAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DigiaProvider.d.ts","sourceRoot":"","sources":["../../src/DigiaProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AA0uBxE,wBAAgB,SAAS,sBAExB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DigiaSlotView.d.ts","sourceRoot":"","sources":["../../src/DigiaSlotView.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"DigiaSlotView.d.ts","sourceRoot":"","sources":["../../src/DigiaSlotView.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAA2C,MAAM,OAAO,CAAC;AAChE,OAAO,EAKH,KAAK,SAAS,EACd,KAAK,SAAS,EACjB,MAAM,cAAc,CAAC;AAEtB,UAAU,kBAAkB;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAChC;AAYD,wBAAgB,aAAa,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,kBAAkB,4BA0DxE"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* NativeDigiaModule
|
|
3
3
|
*
|
|
4
|
-
* Low-level
|
|
4
|
+
* Low-level native binding to the Digia Engage module.
|
|
5
5
|
*
|
|
6
6
|
* The module is resolved lazily on first use (not at import time) so that
|
|
7
7
|
* module evaluation before native initialisation doesn't throw.
|
|
8
8
|
* Resolution order:
|
|
9
|
-
* 1.
|
|
10
|
-
* 2.
|
|
11
|
-
* with isTurboModule: false in ReactModuleInfo)
|
|
12
|
-
* 3. null — non-Android environments; methods no-op
|
|
9
|
+
* 1. NativeModules — iOS bridge module
|
|
10
|
+
* 2. null — non-Android environments; methods no-op
|
|
13
11
|
*
|
|
14
12
|
* Prefer using the high-level `Digia` singleton from `index.ts`.
|
|
15
13
|
*/
|
|
@@ -24,7 +22,7 @@ import type { TurboModule } from 'react-native';
|
|
|
24
22
|
*/
|
|
25
23
|
export interface Spec extends TurboModule {
|
|
26
24
|
/** Initialise the SDK. Call once before anything else. */
|
|
27
|
-
initialize(
|
|
25
|
+
initialize(projectId: string, environment: string, logLevel: string, baseUrl?: string, fontFamily?: string): Promise<void>;
|
|
28
26
|
/**
|
|
29
27
|
* Wire the internal RNEventBridgePlugin with the native SDK.
|
|
30
28
|
* Called automatically by Digia.register() on first plugin registration.
|
|
@@ -40,6 +38,12 @@ export interface Spec extends TurboModule {
|
|
|
40
38
|
triggerCampaign(id: string, content: Object, cepContext: Object): void;
|
|
41
39
|
/** Invalidate / dismiss a campaign by its ID. */
|
|
42
40
|
invalidateCampaign(campaignId: string): void;
|
|
41
|
+
/** Register an anchor element position for tooltip/spotlight targeting. */
|
|
42
|
+
registerAnchor(key: string, x: number, y: number, width: number, height: number): void;
|
|
43
|
+
/** Remove a previously registered anchor. */
|
|
44
|
+
unregisterAnchor(key: string): void;
|
|
45
|
+
/** Return all component keys registered with the native SDK. */
|
|
46
|
+
getRegisteredComponents(): Promise<string[]>;
|
|
43
47
|
}
|
|
44
48
|
export declare const nativeDigiaModule: Spec;
|
|
45
49
|
//# sourceMappingURL=NativeDigiaEngage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeDigiaEngage.d.ts","sourceRoot":"","sources":["../../src/NativeDigiaEngage.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"NativeDigiaEngage.d.ts","sourceRoot":"","sources":["../../src/NativeDigiaEngage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD;;;;;;;GAOG;AACH,MAAM,WAAW,IAAK,SAAQ,WAAW;IACrC,0DAA0D;IAC1D,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3H;;;;OAIG;IACH,cAAc,IAAI,IAAI,CAAC;IAEvB,sDAAsD;IACtD,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAErC;;;OAGG;IACH,eAAe,CACX,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACnB,IAAI,CAAC;IAER,iDAAiD;IACjD,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7C,2EAA2E;IAC3E,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvF,6CAA6C;IAC7C,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC,gEAAgE;IAChE,uBAAuB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAEhD;AA8BD,eAAO,MAAM,iBAAiB,EAAE,IAY/B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DigiaAction, ActionContext, OnAction, InAppBrowserAdapter } from './types';
|
|
2
|
+
import type { Action } from './templateTypes';
|
|
3
|
+
export type ActionCallbacks = {
|
|
4
|
+
onNext: () => void;
|
|
5
|
+
onBack: () => void;
|
|
6
|
+
onDismissSelf: () => void;
|
|
7
|
+
onDismissAll: () => void;
|
|
8
|
+
};
|
|
9
|
+
type ActionHandlerConfig = {
|
|
10
|
+
onAction?: OnAction;
|
|
11
|
+
routeViaSystemLinking: boolean;
|
|
12
|
+
inAppBrowser?: InAppBrowserAdapter;
|
|
13
|
+
};
|
|
14
|
+
export declare const toDigiaAction: (action: Action) => DigiaAction;
|
|
15
|
+
export declare const digiaActionHandler: {
|
|
16
|
+
configure: (config: Partial<ActionHandlerConfig>) => void;
|
|
17
|
+
execute: (widgetAction: Action, context: ActionContext, callbacks: ActionCallbacks) => Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=actionHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actionHandler.d.ts","sourceRoot":"","sources":["../../src/actionHandler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAK9C,MAAM,MAAM,eAAe,GAAG;IAC1B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,YAAY,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACvB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACtC,CAAC;AAyCF,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,KAAG,WAS9C,CAAC;AA6LF,eAAO,MAAM,kBAAkB;wBAjCJ,OAAO,CAAC,mBAAmB,CAAC,KAAG,IAAI;4BAK5C,MAAM,WACX,aAAa,aACX,eAAe,KAC3B,OAAO,CAAC,IAAI,CAAC;CAyBwC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultInAppBrowser.d.ts","sourceRoot":"","sources":["../../src/defaultInAppBrowser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAyBnD,eAAO,MAAM,mBAAmB,EAAE,mBAKjC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type AnchorLayout = {
|
|
2
|
+
pageX: number;
|
|
3
|
+
pageY: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
};
|
|
7
|
+
type Listener = (layout: AnchorLayout) => void;
|
|
8
|
+
export type { AnchorLayout };
|
|
9
|
+
export declare const digiaAnchorRegistry: {
|
|
10
|
+
setLayout: (key: string, layout: AnchorLayout) => void;
|
|
11
|
+
getLayout: (key: string) => AnchorLayout | undefined;
|
|
12
|
+
subscribe: (key: string, listener: Listener) => () => void;
|
|
13
|
+
remove: (key: string) => void;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=digiaAnchorRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digiaAnchorRegistry.d.ts","sourceRoot":"","sources":["../../src/digiaAnchorRegistry.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AACnF,KAAK,QAAQ,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAA;AAwB9C,YAAY,EAAE,YAAY,EAAE,CAAA;AAC5B,eAAO,MAAM,mBAAmB;qBApBR,MAAM,UAAU,YAAY;qBAK5B,MAAM,KAAG,YAAY,GAAG,SAAS;qBAEjC,MAAM,YAAY,QAAQ,KAAG,MAAM,IAAI;kBAO1C,MAAM;CAMmD,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FrequencyPolicy, FrequencyState, FrequencyEvalResult } from './types';
|
|
2
|
+
export declare const isSessionPolicy: (policy: FrequencyPolicy) => boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Pure eligibility function. No side effects.
|
|
5
|
+
*
|
|
6
|
+
* Semantics for max_per_window { count, window }:
|
|
7
|
+
* - "count" shows are allowed, measured from first_shown_at.
|
|
8
|
+
* - Once the window duration has elapsed since first_shown_at, permanently blocked (reason: 'window').
|
|
9
|
+
* - Once shown_count >= count, permanently blocked (reason: 'max_total').
|
|
10
|
+
* - 'session' window is checked by the caller via in-memory state — same logic applies.
|
|
11
|
+
*/
|
|
12
|
+
export declare const evaluate: (policy: FrequencyPolicy, state: FrequencyState | null, now: number) => FrequencyEvalResult;
|
|
13
|
+
export declare const hasPolicy: (policy: FrequencyPolicy | null | undefined) => policy is FrequencyPolicy;
|
|
14
|
+
//# sourceMappingURL=frequencyEvaluator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frequencyEvaluator.d.ts","sourceRoot":"","sources":["../../src/frequencyEvaluator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAQpF,eAAO,MAAM,eAAe,GAAI,QAAQ,eAAe,KAAG,OACX,CAAC;AAEhD;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,GACjB,QAAQ,eAAe,EACvB,OAAO,cAAc,GAAG,IAAI,EAC5B,KAAK,MAAM,KACZ,mBA2BF,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,QAAQ,eAAe,GAAG,IAAI,GAAG,SAAS,KAAG,MAAM,IAAI,eAGW,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FrequencyState } from './types';
|
|
2
|
+
export declare const frequencyStore: {
|
|
3
|
+
checkProjectId(projectId: string): Promise<void>;
|
|
4
|
+
get(campaignKey: string, isSession: boolean): Promise<FrequencyState | null>;
|
|
5
|
+
set(campaignKey: string, state: FrequencyState, isSession: boolean): Promise<void>;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=frequencyStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frequencyStore.d.ts","sourceRoot":"","sources":["../../src/frequencyStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAqC9C,eAAO,MAAM,cAAc;8BACS,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;qBAiB/B,MAAM,aAAa,OAAO,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;qBAY3D,MAAM,SAAS,cAAc,aAAa,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAW3F,CAAC"}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export { Digia } from './Digia';
|
|
12
12
|
export { DigiaHostView } from './DigiaHostView';
|
|
13
|
+
export { DigiaHost } from './DigiaProvider';
|
|
13
14
|
export { DigiaSlotView } from './DigiaSlotView';
|
|
14
15
|
export { DigiaAnchorView } from './DigiaAnchorView';
|
|
15
16
|
export type { DigiaConfig, DigiaDelegate, DigiaExperienceEvent, DigiaPlugin, InAppPayload } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,oBAAoB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,oBAAoB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
export type Action = {
|
|
2
|
+
type: 'dismiss';
|
|
3
|
+
label: string;
|
|
4
|
+
style: 'primary' | 'secondary' | 'ghost';
|
|
5
|
+
scope?: 'self' | 'all';
|
|
6
|
+
} | {
|
|
7
|
+
type: 'next';
|
|
8
|
+
label: string;
|
|
9
|
+
style: 'primary' | 'secondary' | 'ghost';
|
|
10
|
+
} | {
|
|
11
|
+
type: 'back';
|
|
12
|
+
label: string;
|
|
13
|
+
style: 'primary' | 'secondary' | 'ghost';
|
|
14
|
+
} | {
|
|
15
|
+
type: 'prev';
|
|
16
|
+
label: string;
|
|
17
|
+
style: 'primary' | 'secondary' | 'ghost';
|
|
18
|
+
} | {
|
|
19
|
+
type: 'deep_link';
|
|
20
|
+
label: string;
|
|
21
|
+
style: 'primary' | 'secondary' | 'ghost';
|
|
22
|
+
url: string;
|
|
23
|
+
fallback_url?: string;
|
|
24
|
+
} | {
|
|
25
|
+
type: 'open_url';
|
|
26
|
+
label: string;
|
|
27
|
+
style: 'primary' | 'secondary' | 'ghost';
|
|
28
|
+
url: string;
|
|
29
|
+
presentation: 'external' | 'in_app';
|
|
30
|
+
};
|
|
31
|
+
export type TooltipStep = {
|
|
32
|
+
anchorKey: string;
|
|
33
|
+
title: string;
|
|
34
|
+
body: string;
|
|
35
|
+
placement: 'top' | 'bottom' | 'left' | 'right' | 'auto';
|
|
36
|
+
backgroundColor: string;
|
|
37
|
+
borderColor: string;
|
|
38
|
+
borderWidth: number;
|
|
39
|
+
cornerRadius: number;
|
|
40
|
+
shadow: boolean;
|
|
41
|
+
maxWidth: number;
|
|
42
|
+
padding: number;
|
|
43
|
+
showArrow: boolean;
|
|
44
|
+
arrowColor?: string;
|
|
45
|
+
arrowBorderColor?: string;
|
|
46
|
+
arrowSize?: number;
|
|
47
|
+
titleColor: string;
|
|
48
|
+
titleSize: number;
|
|
49
|
+
titleWeight: '400' | '600' | '700';
|
|
50
|
+
bodyColor: string;
|
|
51
|
+
bodySize: number;
|
|
52
|
+
buttonPrimaryBackgroundColor: string;
|
|
53
|
+
buttonPrimaryTextColor: string;
|
|
54
|
+
buttonGhostTextColor: string;
|
|
55
|
+
actions: Action[];
|
|
56
|
+
};
|
|
57
|
+
export type SpotlightStep = {
|
|
58
|
+
anchorKey: string;
|
|
59
|
+
title: string;
|
|
60
|
+
body: string;
|
|
61
|
+
calloutPosition: 'above' | 'below' | 'left' | 'right' | 'auto';
|
|
62
|
+
calloutGap?: number;
|
|
63
|
+
overlayColor: string;
|
|
64
|
+
overlayOpacity: number;
|
|
65
|
+
highlightShape: 'rect' | 'circle' | 'pill';
|
|
66
|
+
highlightCornerRadius: number;
|
|
67
|
+
highlightPadding: number;
|
|
68
|
+
highlightGlowColor: string;
|
|
69
|
+
highlightGlowWidth: number;
|
|
70
|
+
calloutBackgroundColor: string;
|
|
71
|
+
calloutCornerRadius: number;
|
|
72
|
+
calloutMaxWidth: number;
|
|
73
|
+
calloutPadding: number;
|
|
74
|
+
calloutShadow: boolean;
|
|
75
|
+
calloutBorderColor: string;
|
|
76
|
+
calloutBorderWidth: number;
|
|
77
|
+
showArrow?: boolean;
|
|
78
|
+
arrowColor?: string;
|
|
79
|
+
arrowBorderColor?: string;
|
|
80
|
+
arrowSize?: number;
|
|
81
|
+
titleColor: string;
|
|
82
|
+
titleSize: number;
|
|
83
|
+
titleWeight: '400' | '600' | '700';
|
|
84
|
+
bodyColor: string;
|
|
85
|
+
bodySize: number;
|
|
86
|
+
buttonPrimaryBackgroundColor: string;
|
|
87
|
+
buttonPrimaryTextColor: string;
|
|
88
|
+
buttonGhostTextColor: string;
|
|
89
|
+
actions: Action[];
|
|
90
|
+
};
|
|
91
|
+
export type TooltipConfig = {
|
|
92
|
+
templateType: 'tooltip';
|
|
93
|
+
templateId: string | null;
|
|
94
|
+
steps: TooltipStep[];
|
|
95
|
+
outsideTapBehavior?: 'dismiss' | 'next' | 'nothing';
|
|
96
|
+
};
|
|
97
|
+
export type SpotlightConfig = {
|
|
98
|
+
templateType: 'spotlight';
|
|
99
|
+
templateId: string | null;
|
|
100
|
+
steps: SpotlightStep[];
|
|
101
|
+
outsideTapBehavior?: 'dismiss' | 'next' | 'nothing';
|
|
102
|
+
};
|
|
103
|
+
export type CarouselItem = {
|
|
104
|
+
imageUrl: string;
|
|
105
|
+
deepLink?: string;
|
|
106
|
+
};
|
|
107
|
+
export type CarouselIndicatorConfig = {
|
|
108
|
+
showIndicator: boolean;
|
|
109
|
+
dotHeight: number;
|
|
110
|
+
dotWidth: number;
|
|
111
|
+
spacing: number;
|
|
112
|
+
dotColor: string;
|
|
113
|
+
activeDotColor: string;
|
|
114
|
+
indicatorEffectType: 'slide' | 'expanding' | 'worm' | 'scale' | 'jumping' | 'scrolling';
|
|
115
|
+
};
|
|
116
|
+
export type CarouselConfig = {
|
|
117
|
+
templateType: 'carousel';
|
|
118
|
+
slotKey: string;
|
|
119
|
+
items: CarouselItem[];
|
|
120
|
+
height: number;
|
|
121
|
+
width?: number;
|
|
122
|
+
autoPlay: boolean;
|
|
123
|
+
autoPlayInterval: number;
|
|
124
|
+
animationDuration: number;
|
|
125
|
+
infiniteScroll: boolean;
|
|
126
|
+
viewportFraction: number;
|
|
127
|
+
indicator: CarouselIndicatorConfig;
|
|
128
|
+
};
|
|
129
|
+
export type SurveyTemplateConfig = {
|
|
130
|
+
templateType: 'survey';
|
|
131
|
+
templateId: string;
|
|
132
|
+
surveyName: string;
|
|
133
|
+
uiTemplateId: string | null;
|
|
134
|
+
settings: Record<string, unknown>;
|
|
135
|
+
blocks: Record<string, unknown>[];
|
|
136
|
+
nodes: Record<string, unknown>[];
|
|
137
|
+
rootNodeId: string;
|
|
138
|
+
};
|
|
139
|
+
export type TemplateConfig = TooltipConfig | SpotlightConfig | CarouselConfig | SurveyTemplateConfig;
|
|
140
|
+
//# sourceMappingURL=templateTypes.d.ts.map
|