@layers/react-native 3.1.3 → 3.2.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.
Files changed (38) hide show
  1. package/README.md +22 -0
  2. package/dist/debug-overlay.d.mts +2 -2
  3. package/dist/debug-overlay.d.ts +2 -2
  4. package/dist/{index-CVKv9D9g.d.ts → index-BHp0kMOu.d.ts} +3 -3
  5. package/dist/{index-CVKv9D9g.d.ts.map → index-BHp0kMOu.d.ts.map} +1 -1
  6. package/dist/{index-CV1b1Unu.d.mts → index-DWTdnuyU.d.mts} +3 -3
  7. package/dist/{index-CV1b1Unu.d.mts.map → index-DWTdnuyU.d.mts.map} +1 -1
  8. package/dist/index.d.mts +2 -2
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.js +2 -2
  11. package/dist/index.mjs +2 -2
  12. package/dist/react.d.mts +2 -2
  13. package/dist/react.d.ts +2 -2
  14. package/dist/react.js +2 -2
  15. package/dist/react.mjs +2 -2
  16. package/dist/skan-BljOFaeU.d.mts +109 -0
  17. package/dist/skan-BljOFaeU.d.mts.map +1 -0
  18. package/dist/skan-CYTZtEAI.mjs +131 -0
  19. package/dist/skan-CYTZtEAI.mjs.map +1 -0
  20. package/dist/skan-D0DUw-6o.js +146 -0
  21. package/dist/skan-DnKHcXAj.d.ts +109 -0
  22. package/dist/skan-DnKHcXAj.d.ts.map +1 -0
  23. package/dist/skan.d.mts +2 -2
  24. package/dist/skan.d.ts +2 -2
  25. package/dist/skan.js +4 -2
  26. package/dist/skan.mjs +2 -2
  27. package/dist/{src-q7SXK2Zt.mjs → src-BB_o-Y3r.mjs} +19 -20
  28. package/dist/src-BB_o-Y3r.mjs.map +1 -0
  29. package/dist/{src-BpWI0u2E.js → src-CGBW26Si.js} +18 -19
  30. package/package.json +2 -2
  31. package/dist/skan-CAN-v1eU.d.mts +0 -50
  32. package/dist/skan-CAN-v1eU.d.mts.map +0 -1
  33. package/dist/skan-CoG9kfO3.mjs +0 -253
  34. package/dist/skan-CoG9kfO3.mjs.map +0 -1
  35. package/dist/skan-DqDVGZkX.js +0 -256
  36. package/dist/skan-DupmPyTn.d.ts +0 -50
  37. package/dist/skan-DupmPyTn.d.ts.map +0 -1
  38. package/dist/src-q7SXK2Zt.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skan-CYTZtEAI.mjs","names":["sharedCore: SkanCore | null"],"sources":["../src/skan.ts"],"sourcesContent":["// SKAN Module — iOS-only SKAdNetwork conversion value management.\n//\n// Thin facade over the Rust core's SKAN engine, which is the single source of\n// truth for rule evaluation, presets, the monotonic floor, and persistence. This\n// wrapper only bridges to the native iOS SKAdNetwork APIs (which the core cannot\n// call) and reports the native apply outcome back to the core via\n// `skanRecordConversionResult`. There is no parallel JS rule engine.\n\nexport interface SKANConversionRule {\n eventName: string;\n conditions?: Record<string, unknown>;\n conversionValue: number; // 0-63 for SKAN 3.0, 0-7 fine values in SKAN 4.0\n coarseValue?: 'low' | 'medium' | 'high'; // SKAN 4.0 only\n lockWindow?: boolean; // SKAN 4.0 only\n priority?: number;\n description?: string;\n}\n\nexport interface SKANPresetConfig {\n name: 'subscriptions' | 'engagement' | 'iap';\n rules: SKANConversionRule[];\n description: string;\n maxValue: number;\n}\n\nexport interface SKANMetrics {\n isSupported: boolean;\n version: string;\n currentValue: number | null;\n currentPreset: string | null;\n ruleCount: number;\n evaluationCount: number;\n}\n\n/**\n * The subset of the Rust core (`LayersCore`) the SKAN facade delegates to. The\n * core owns all rule evaluation, presets, and the monotonic floor.\n */\nexport interface SkanCore {\n skanSetPreset(preset: string): void;\n skanSetRules(rulesJson: string): void;\n skanProcessEvent(\n eventName: string,\n properties: Record<string, unknown> | null\n ): { fineValue: number; coarseValue: string | null; lockWindow: boolean } | null;\n skanRecordConversionResult(value: number, success: boolean): void;\n skanCurrentValue(): number;\n skanCurrentPreset(): string | null;\n skanIsEnabled(): boolean;\n}\n\ninterface NativeSKANModule {\n isAvailable(): Promise<boolean>;\n getVersion(): Promise<string>;\n registerAppForAdNetworkAttribution(): Promise<void>;\n updateConversionValue(value: number): Promise<void>;\n updatePostbackConversionValue(\n value: number,\n coarseValue?: string,\n lockWindow?: boolean\n ): Promise<void>;\n getCurrentConversionValue(): Promise<number | null>;\n}\n\nfunction getNativeModule(): NativeSKANModule | null {\n try {\n const { NativeModules, Platform } = require('react-native');\n if (Platform.OS === 'ios' && NativeModules.LayersSKAN) {\n return NativeModules.LayersSKAN as NativeSKANModule;\n }\n } catch {\n // Not available\n }\n return null;\n}\n\nlet sharedCore: SkanCore | null = null;\n\n/**\n * Wire the SKAN facade to the SDK's Rust core. Called by the SDK on init so that\n * a directly-constructed `new SKANManager()` and the SDK's own auto-config both\n * delegate to the same core engine.\n */\nexport function setSkanCore(core: SkanCore | null): void {\n sharedCore = core;\n}\n\n/**\n * Apply a native SKAN conversion update returned by the core, then report the\n * outcome so the core commits its monotonic floor only on success. Shared by the\n * facade and the SDK's track/screen forwarding.\n */\nexport async function applySkanDecision(\n core: SkanCore,\n native: NativeSKANModule | null,\n decision: { fineValue: number; coarseValue: string | null; lockWindow: boolean }\n): Promise<boolean> {\n if (!native) {\n // No native module (non-iOS / test): there is no postback to fail, so commit\n // the floor so the core's monotonic state stays consistent.\n core.skanRecordConversionResult(decision.fineValue, true);\n return true;\n }\n try {\n if (decision.coarseValue) {\n await native.updatePostbackConversionValue(\n decision.fineValue,\n decision.coarseValue,\n decision.lockWindow\n );\n } else {\n await native.updateConversionValue(decision.fineValue);\n }\n core.skanRecordConversionResult(decision.fineValue, true);\n return true;\n } catch {\n // Native update failed — the core leaves the floor unchanged so the next\n // matching event re-issues it (no silently-lost value).\n core.skanRecordConversionResult(decision.fineValue, false);\n return false;\n }\n}\n\nexport class SKANManager {\n private nativeModule: NativeSKANModule | null;\n private core: SkanCore | null;\n private evaluationCount = 0;\n private onConversionUpdate?: (data: {\n event: string;\n previousValue: number;\n newValue: number;\n rule: SKANConversionRule;\n }) => void;\n\n constructor(\n onConversionUpdate?: (data: {\n event: string;\n previousValue: number;\n newValue: number;\n rule: SKANConversionRule;\n }) => void,\n core?: SkanCore | null\n ) {\n this.nativeModule = getNativeModule();\n this.core = core ?? sharedCore;\n if (onConversionUpdate) {\n this.onConversionUpdate = onConversionUpdate;\n }\n }\n\n /**\n * Initialize the manager. `arm` controls whether Apple's postback window is\n * registered — pass `false` on re-config so we don't re-arm mid-session\n * (re-registering would reset the OS conversion value). Returns `true` only if\n * the native register was attempted and succeeded (a rejection throws; an\n * unavailable/no-module case returns false).\n */\n async initialize(arm = true): Promise<boolean> {\n if (!this.nativeModule) return false;\n const available = await this.nativeModule.isAvailable();\n if (!available) return false;\n if (arm) {\n await this.nativeModule.registerAppForAdNetworkAttribution();\n return true;\n }\n return false;\n }\n\n isSupported(): boolean {\n return this.nativeModule !== null;\n }\n\n /** Load a built-in preset in the core (subscriptions/engagement/iap). */\n setPreset(preset: string): void {\n this.core?.skanSetPreset(preset);\n }\n\n /** Replace the core's active rules with a custom set. */\n setCustomRules(rules: SKANConversionRule[]): void {\n this.core?.skanSetRules(JSON.stringify(rules));\n }\n\n /**\n * Evaluate an event via the core. If the core returns an update, apply it to\n * native SKAdNetwork and report the result back so the core commits its floor\n * only on success.\n */\n async processEvent(eventName: string, properties: Record<string, unknown>): Promise<void> {\n this.evaluationCount += 1;\n const core = this.core;\n if (!core) return;\n const previousValue = core.skanCurrentValue();\n const decision = core.skanProcessEvent(eventName, properties ?? {});\n if (!decision) return;\n const applied = await applySkanDecision(core, this.nativeModule, decision);\n // Only notify on a confirmed apply — a failed native postback leaves the\n // core's floor un-advanced, so the consumer must not see it as posted.\n if (!applied) return;\n this.onConversionUpdate?.({\n event: eventName,\n previousValue,\n newValue: decision.fineValue,\n rule: {\n eventName,\n conversionValue: decision.fineValue,\n lockWindow: decision.lockWindow,\n ...(decision.coarseValue\n ? { coarseValue: decision.coarseValue as 'low' | 'medium' | 'high' }\n : {})\n }\n });\n }\n\n /** The highest SKAN conversion value posted so far (from the core). */\n getCurrentValue(): number {\n return this.core?.skanCurrentValue() ?? 0;\n }\n\n /** The active preset name (from the core), or null. */\n getCurrentPreset(): string | null {\n return this.core?.skanCurrentPreset() ?? null;\n }\n\n /**\n * The active rules. The core owns the rule set and does not expose it, so this\n * returns an empty array; use the core's metrics for introspection.\n */\n getCurrentRules(): SKANConversionRule[] {\n return [];\n }\n\n getMetrics(): SKANMetrics {\n return {\n isSupported: this.isSupported(),\n version: '4.0',\n currentValue: this.core?.skanCurrentValue() ?? 0,\n currentPreset: this.core?.skanCurrentPreset() ?? null,\n ruleCount: 0,\n evaluationCount: this.evaluationCount\n };\n }\n}\n"],"mappings":";;;AAgEA,SAAS,kBAA2C;AAClD,KAAI;EACF,MAAM,EAAE,eAAe,uBAAqB,eAAe;AAC3D,MAAI,SAAS,OAAO,SAAS,cAAc,WACzC,QAAO,cAAc;SAEjB;AAGR,QAAO;;AAGT,IAAIA,aAA8B;;;;;;AAOlC,SAAgB,YAAY,MAA6B;AACvD,cAAa;;;;;;;AAQf,eAAsB,kBACpB,MACA,QACA,UACkB;AAClB,KAAI,CAAC,QAAQ;AAGX,OAAK,2BAA2B,SAAS,WAAW,KAAK;AACzD,SAAO;;AAET,KAAI;AACF,MAAI,SAAS,YACX,OAAM,OAAO,8BACX,SAAS,WACT,SAAS,aACT,SAAS,WACV;MAED,OAAM,OAAO,sBAAsB,SAAS,UAAU;AAExD,OAAK,2BAA2B,SAAS,WAAW,KAAK;AACzD,SAAO;SACD;AAGN,OAAK,2BAA2B,SAAS,WAAW,MAAM;AAC1D,SAAO;;;AAIX,IAAa,cAAb,MAAyB;CACvB,AAAQ;CACR,AAAQ;CACR,AAAQ,kBAAkB;CAC1B,AAAQ;CAOR,YACE,oBAMA,MACA;AACA,OAAK,eAAe,iBAAiB;AACrC,OAAK,OAAO,QAAQ;AACpB,MAAI,mBACF,MAAK,qBAAqB;;;;;;;;;CAW9B,MAAM,WAAW,MAAM,MAAwB;AAC7C,MAAI,CAAC,KAAK,aAAc,QAAO;AAE/B,MAAI,CADc,MAAM,KAAK,aAAa,aAAa,CACvC,QAAO;AACvB,MAAI,KAAK;AACP,SAAM,KAAK,aAAa,oCAAoC;AAC5D,UAAO;;AAET,SAAO;;CAGT,cAAuB;AACrB,SAAO,KAAK,iBAAiB;;;CAI/B,UAAU,QAAsB;AAC9B,OAAK,MAAM,cAAc,OAAO;;;CAIlC,eAAe,OAAmC;AAChD,OAAK,MAAM,aAAa,KAAK,UAAU,MAAM,CAAC;;;;;;;CAQhD,MAAM,aAAa,WAAmB,YAAoD;AACxF,OAAK,mBAAmB;EACxB,MAAM,OAAO,KAAK;AAClB,MAAI,CAAC,KAAM;EACX,MAAM,gBAAgB,KAAK,kBAAkB;EAC7C,MAAM,WAAW,KAAK,iBAAiB,WAAW,cAAc,EAAE,CAAC;AACnE,MAAI,CAAC,SAAU;AAIf,MAAI,CAHY,MAAM,kBAAkB,MAAM,KAAK,cAAc,SAAS,CAG5D;AACd,OAAK,qBAAqB;GACxB,OAAO;GACP;GACA,UAAU,SAAS;GACnB,MAAM;IACJ;IACA,iBAAiB,SAAS;IAC1B,YAAY,SAAS;IACrB,GAAI,SAAS,cACT,EAAE,aAAa,SAAS,aAA0C,GAClE,EAAE;IACP;GACF,CAAC;;;CAIJ,kBAA0B;AACxB,SAAO,KAAK,MAAM,kBAAkB,IAAI;;;CAI1C,mBAAkC;AAChC,SAAO,KAAK,MAAM,mBAAmB,IAAI;;;;;;CAO3C,kBAAwC;AACtC,SAAO,EAAE;;CAGX,aAA0B;AACxB,SAAO;GACL,aAAa,KAAK,aAAa;GAC/B,SAAS;GACT,cAAc,KAAK,MAAM,kBAAkB,IAAI;GAC/C,eAAe,KAAK,MAAM,mBAAmB,IAAI;GACjD,WAAW;GACX,iBAAiB,KAAK;GACvB"}
@@ -0,0 +1,146 @@
1
+
2
+ //#region src/skan.ts
3
+ function getNativeModule() {
4
+ try {
5
+ const { NativeModules, Platform } = require("react-native");
6
+ if (Platform.OS === "ios" && NativeModules.LayersSKAN) return NativeModules.LayersSKAN;
7
+ } catch {}
8
+ return null;
9
+ }
10
+ let sharedCore = null;
11
+ /**
12
+ * Wire the SKAN facade to the SDK's Rust core. Called by the SDK on init so that
13
+ * a directly-constructed `new SKANManager()` and the SDK's own auto-config both
14
+ * delegate to the same core engine.
15
+ */
16
+ function setSkanCore(core) {
17
+ sharedCore = core;
18
+ }
19
+ /**
20
+ * Apply a native SKAN conversion update returned by the core, then report the
21
+ * outcome so the core commits its monotonic floor only on success. Shared by the
22
+ * facade and the SDK's track/screen forwarding.
23
+ */
24
+ async function applySkanDecision(core, native, decision) {
25
+ if (!native) {
26
+ core.skanRecordConversionResult(decision.fineValue, true);
27
+ return true;
28
+ }
29
+ try {
30
+ if (decision.coarseValue) await native.updatePostbackConversionValue(decision.fineValue, decision.coarseValue, decision.lockWindow);
31
+ else await native.updateConversionValue(decision.fineValue);
32
+ core.skanRecordConversionResult(decision.fineValue, true);
33
+ return true;
34
+ } catch {
35
+ core.skanRecordConversionResult(decision.fineValue, false);
36
+ return false;
37
+ }
38
+ }
39
+ var SKANManager = class {
40
+ nativeModule;
41
+ core;
42
+ evaluationCount = 0;
43
+ onConversionUpdate;
44
+ constructor(onConversionUpdate, core) {
45
+ this.nativeModule = getNativeModule();
46
+ this.core = core ?? sharedCore;
47
+ if (onConversionUpdate) this.onConversionUpdate = onConversionUpdate;
48
+ }
49
+ /**
50
+ * Initialize the manager. `arm` controls whether Apple's postback window is
51
+ * registered — pass `false` on re-config so we don't re-arm mid-session
52
+ * (re-registering would reset the OS conversion value). Returns `true` only if
53
+ * the native register was attempted and succeeded (a rejection throws; an
54
+ * unavailable/no-module case returns false).
55
+ */
56
+ async initialize(arm = true) {
57
+ if (!this.nativeModule) return false;
58
+ if (!await this.nativeModule.isAvailable()) return false;
59
+ if (arm) {
60
+ await this.nativeModule.registerAppForAdNetworkAttribution();
61
+ return true;
62
+ }
63
+ return false;
64
+ }
65
+ isSupported() {
66
+ return this.nativeModule !== null;
67
+ }
68
+ /** Load a built-in preset in the core (subscriptions/engagement/iap). */
69
+ setPreset(preset) {
70
+ this.core?.skanSetPreset(preset);
71
+ }
72
+ /** Replace the core's active rules with a custom set. */
73
+ setCustomRules(rules) {
74
+ this.core?.skanSetRules(JSON.stringify(rules));
75
+ }
76
+ /**
77
+ * Evaluate an event via the core. If the core returns an update, apply it to
78
+ * native SKAdNetwork and report the result back so the core commits its floor
79
+ * only on success.
80
+ */
81
+ async processEvent(eventName, properties) {
82
+ this.evaluationCount += 1;
83
+ const core = this.core;
84
+ if (!core) return;
85
+ const previousValue = core.skanCurrentValue();
86
+ const decision = core.skanProcessEvent(eventName, properties ?? {});
87
+ if (!decision) return;
88
+ if (!await applySkanDecision(core, this.nativeModule, decision)) return;
89
+ this.onConversionUpdate?.({
90
+ event: eventName,
91
+ previousValue,
92
+ newValue: decision.fineValue,
93
+ rule: {
94
+ eventName,
95
+ conversionValue: decision.fineValue,
96
+ lockWindow: decision.lockWindow,
97
+ ...decision.coarseValue ? { coarseValue: decision.coarseValue } : {}
98
+ }
99
+ });
100
+ }
101
+ /** The highest SKAN conversion value posted so far (from the core). */
102
+ getCurrentValue() {
103
+ return this.core?.skanCurrentValue() ?? 0;
104
+ }
105
+ /** The active preset name (from the core), or null. */
106
+ getCurrentPreset() {
107
+ return this.core?.skanCurrentPreset() ?? null;
108
+ }
109
+ /**
110
+ * The active rules. The core owns the rule set and does not expose it, so this
111
+ * returns an empty array; use the core's metrics for introspection.
112
+ */
113
+ getCurrentRules() {
114
+ return [];
115
+ }
116
+ getMetrics() {
117
+ return {
118
+ isSupported: this.isSupported(),
119
+ version: "4.0",
120
+ currentValue: this.core?.skanCurrentValue() ?? 0,
121
+ currentPreset: this.core?.skanCurrentPreset() ?? null,
122
+ ruleCount: 0,
123
+ evaluationCount: this.evaluationCount
124
+ };
125
+ }
126
+ };
127
+
128
+ //#endregion
129
+ Object.defineProperty(exports, 'SKANManager', {
130
+ enumerable: true,
131
+ get: function () {
132
+ return SKANManager;
133
+ }
134
+ });
135
+ Object.defineProperty(exports, 'applySkanDecision', {
136
+ enumerable: true,
137
+ get: function () {
138
+ return applySkanDecision;
139
+ }
140
+ });
141
+ Object.defineProperty(exports, 'setSkanCore', {
142
+ enumerable: true,
143
+ get: function () {
144
+ return setSkanCore;
145
+ }
146
+ });
@@ -0,0 +1,109 @@
1
+ //#region src/skan.d.ts
2
+ interface SKANConversionRule {
3
+ eventName: string;
4
+ conditions?: Record<string, unknown>;
5
+ conversionValue: number;
6
+ coarseValue?: 'low' | 'medium' | 'high';
7
+ lockWindow?: boolean;
8
+ priority?: number;
9
+ description?: string;
10
+ }
11
+ interface SKANPresetConfig {
12
+ name: 'subscriptions' | 'engagement' | 'iap';
13
+ rules: SKANConversionRule[];
14
+ description: string;
15
+ maxValue: number;
16
+ }
17
+ interface SKANMetrics {
18
+ isSupported: boolean;
19
+ version: string;
20
+ currentValue: number | null;
21
+ currentPreset: string | null;
22
+ ruleCount: number;
23
+ evaluationCount: number;
24
+ }
25
+ /**
26
+ * The subset of the Rust core (`LayersCore`) the SKAN facade delegates to. The
27
+ * core owns all rule evaluation, presets, and the monotonic floor.
28
+ */
29
+ interface SkanCore {
30
+ skanSetPreset(preset: string): void;
31
+ skanSetRules(rulesJson: string): void;
32
+ skanProcessEvent(eventName: string, properties: Record<string, unknown> | null): {
33
+ fineValue: number;
34
+ coarseValue: string | null;
35
+ lockWindow: boolean;
36
+ } | null;
37
+ skanRecordConversionResult(value: number, success: boolean): void;
38
+ skanCurrentValue(): number;
39
+ skanCurrentPreset(): string | null;
40
+ skanIsEnabled(): boolean;
41
+ }
42
+ interface NativeSKANModule {
43
+ isAvailable(): Promise<boolean>;
44
+ getVersion(): Promise<string>;
45
+ registerAppForAdNetworkAttribution(): Promise<void>;
46
+ updateConversionValue(value: number): Promise<void>;
47
+ updatePostbackConversionValue(value: number, coarseValue?: string, lockWindow?: boolean): Promise<void>;
48
+ getCurrentConversionValue(): Promise<number | null>;
49
+ }
50
+ /**
51
+ * Wire the SKAN facade to the SDK's Rust core. Called by the SDK on init so that
52
+ * a directly-constructed `new SKANManager()` and the SDK's own auto-config both
53
+ * delegate to the same core engine.
54
+ */
55
+ declare function setSkanCore(core: SkanCore | null): void;
56
+ /**
57
+ * Apply a native SKAN conversion update returned by the core, then report the
58
+ * outcome so the core commits its monotonic floor only on success. Shared by the
59
+ * facade and the SDK's track/screen forwarding.
60
+ */
61
+ declare function applySkanDecision(core: SkanCore, native: NativeSKANModule | null, decision: {
62
+ fineValue: number;
63
+ coarseValue: string | null;
64
+ lockWindow: boolean;
65
+ }): Promise<boolean>;
66
+ declare class SKANManager {
67
+ private nativeModule;
68
+ private core;
69
+ private evaluationCount;
70
+ private onConversionUpdate?;
71
+ constructor(onConversionUpdate?: (data: {
72
+ event: string;
73
+ previousValue: number;
74
+ newValue: number;
75
+ rule: SKANConversionRule;
76
+ }) => void, core?: SkanCore | null);
77
+ /**
78
+ * Initialize the manager. `arm` controls whether Apple's postback window is
79
+ * registered — pass `false` on re-config so we don't re-arm mid-session
80
+ * (re-registering would reset the OS conversion value). Returns `true` only if
81
+ * the native register was attempted and succeeded (a rejection throws; an
82
+ * unavailable/no-module case returns false).
83
+ */
84
+ initialize(arm?: boolean): Promise<boolean>;
85
+ isSupported(): boolean;
86
+ /** Load a built-in preset in the core (subscriptions/engagement/iap). */
87
+ setPreset(preset: string): void;
88
+ /** Replace the core's active rules with a custom set. */
89
+ setCustomRules(rules: SKANConversionRule[]): void;
90
+ /**
91
+ * Evaluate an event via the core. If the core returns an update, apply it to
92
+ * native SKAdNetwork and report the result back so the core commits its floor
93
+ * only on success.
94
+ */
95
+ processEvent(eventName: string, properties: Record<string, unknown>): Promise<void>;
96
+ /** The highest SKAN conversion value posted so far (from the core). */
97
+ getCurrentValue(): number;
98
+ /** The active preset name (from the core), or null. */
99
+ getCurrentPreset(): string | null;
100
+ /**
101
+ * The active rules. The core owns the rule set and does not expose it, so this
102
+ * returns an empty array; use the core's metrics for introspection.
103
+ */
104
+ getCurrentRules(): SKANConversionRule[];
105
+ getMetrics(): SKANMetrics;
106
+ }
107
+ //#endregion
108
+ export { SkanCore as a, SKANPresetConfig as i, SKANManager as n, applySkanDecision as o, SKANMetrics as r, setSkanCore as s, SKANConversionRule as t };
109
+ //# sourceMappingURL=skan-DnKHcXAj.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skan-DnKHcXAj.d.ts","names":[],"sources":["../src/skan.ts"],"sourcesContent":[],"mappings":";UAQiB,kBAAA;EAAA,SAAA,EAAA,MAAA;EAUA,UAAA,CAAA,EARF,MAQkB,CAAA,MAAA,EAAA,OAExB,CAAA;EAKQ,eAAW,EAAA,MAAA;EAaX,WAAQ,CAAA,EAAA,KAAA,GAAA,QAKH,GAAA,MAAA;EAQZ,UAAA,CAAA,EAAA,OAAgB;EACT,QAAA,CAAA,EAAA,MAAA;EACD,WAAA,CAAA,EAAA,MAAA;;AAEwB,UArCvB,gBAAA,CAqCuB;EAKnC,IAAA,EAAA,eAAA,GAAA,YAAA,GAAA,KAAA;EAC0B,KAAA,EAzCtB,kBAyCsB,EAAA;EAAO,WAAA,EAAA,MAAA;EAsBtB,QAAA,EAAA,MAAW;AAS3B;AACQ,UApES,WAAA,CAoET;EACE,WAAA,EAAA,OAAA;EAEP,OAAA,EAAA,MAAA;EAAO,YAAA,EAAA,MAAA,GAAA,IAAA;EA2BG,aAAA,EAAW,MAAA,GAAA,IAAA;EAgBZ,SAAA,EAAA,MAAA;EAED,eAAA,EAAA,MAAA;;;;;;AA0FK,UAjMC,QAAA,CAiMD;EAAW,aAAA,CAAA,MAAA,EAAA,MAAA,CAAA,EAAA,IAAA;;kDA5LX;;;;;;;;;;UAQN,gBAAA;iBACO;gBACD;wCACwB;wCACA;4FAKnC;+BAC0B;;;;;;;iBAsBf,WAAA,OAAkB;;;;;;iBASZ,iBAAA,OACd,kBACE;;;;IAEP;cA2BU,WAAA;;;;;;;;;UAgBD;qBAED;;;;;;;;6BAgBqB;;;;;wBAqBR;;;;;;8CAS4B,0BAA0B;;;;;;;;;qBAwCzD;gBAIL"}
package/dist/skan.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { i as SKANPresetConfig, n as SKANManager, r as SKANMetrics, t as SKANConversionRule } from "./skan-CAN-v1eU.mjs";
2
- export { SKANConversionRule, SKANManager, SKANMetrics, SKANPresetConfig };
1
+ import { a as SkanCore, i as SKANPresetConfig, n as SKANManager, o as applySkanDecision, r as SKANMetrics, s as setSkanCore, t as SKANConversionRule } from "./skan-BljOFaeU.mjs";
2
+ export { SKANConversionRule, SKANManager, SKANMetrics, SKANPresetConfig, SkanCore, applySkanDecision, setSkanCore };
package/dist/skan.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { i as SKANPresetConfig, n as SKANManager, r as SKANMetrics, t as SKANConversionRule } from "./skan-DupmPyTn.js";
2
- export { SKANConversionRule, SKANManager, SKANMetrics, SKANPresetConfig };
1
+ import { a as SkanCore, i as SKANPresetConfig, n as SKANManager, o as applySkanDecision, r as SKANMetrics, s as setSkanCore, t as SKANConversionRule } from "./skan-DnKHcXAj.js";
2
+ export { SKANConversionRule, SKANManager, SKANMetrics, SKANPresetConfig, SkanCore, applySkanDecision, setSkanCore };
package/dist/skan.js CHANGED
@@ -1,3 +1,5 @@
1
- const require_skan = require('./skan-DqDVGZkX.js');
1
+ const require_skan = require('./skan-D0DUw-6o.js');
2
2
 
3
- exports.SKANManager = require_skan.SKANManager;
3
+ exports.SKANManager = require_skan.SKANManager;
4
+ exports.applySkanDecision = require_skan.applySkanDecision;
5
+ exports.setSkanCore = require_skan.setSkanCore;
package/dist/skan.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { t as SKANManager } from "./skan-CoG9kfO3.mjs";
1
+ import { n as applySkanDecision, r as setSkanCore, t as SKANManager } from "./skan-CYTZtEAI.mjs";
2
2
 
3
- export { SKANManager };
3
+ export { SKANManager, applySkanDecision, setSkanCore };
@@ -1,6 +1,6 @@
1
1
  import { t as __require } from "./chunk-COTuXS2J.mjs";
2
2
  import { a as requestTrackingAuthorization, n as getAdvertisingId, r as getVendorId } from "./att-CnlG_CuV.mjs";
3
- import { t as SKANManager } from "./skan-CoG9kfO3.mjs";
3
+ import { r as setSkanCore, t as SKANManager } from "./skan-CYTZtEAI.mjs";
4
4
  import { FetchHttpClient, LayersCore, LayersError as LayersError$1, LayersEvent, MemoryPersistence, addToCartEvent as buildAddToCartEvent, beginCheckoutEvent as buildBeginCheckoutEvent, initWasm, purchaseEvent as buildPurchaseEvent, refundEvent as buildRefundEvent, startTrialEvent as buildStartTrialEvent, subscribeEvent as buildSubscribeEvent, viewItemEvent as buildViewItemEvent } from "@layers/core-wasm";
5
5
 
6
6
  //#region src/standard-events.ts
@@ -922,7 +922,7 @@ var LayersReactNative = class LayersReactNative {
922
922
  userIdLocked = false;
923
923
  errorListeners = /* @__PURE__ */ new Set();
924
924
  _skanManager = null;
925
- _lastSkanConfigStr = null;
925
+ _skanArmed = false;
926
926
  deepLinkUnsubscribe = null;
927
927
  static MAX_RECENT_EVENTS = 20;
928
928
  _recentEvents = [];
@@ -967,6 +967,7 @@ var LayersReactNative = class LayersReactNative {
967
967
  httpClient,
968
968
  persistence: this.eagerPersistence
969
969
  });
970
+ setSkanCore(this.core);
970
971
  if (this.appUserId) {
971
972
  this.core.identify(this.appUserId);
972
973
  this.userIdLocked = true;
@@ -1008,6 +1009,7 @@ var LayersReactNative = class LayersReactNative {
1008
1009
  persistence
1009
1010
  });
1010
1011
  this.core.applyMigrationState(migrationState);
1012
+ setSkanCore(this.core);
1011
1013
  if (this.appUserId) this.core.identify(this.appUserId);
1012
1014
  } catch {}
1013
1015
  if (typeof WebAssembly !== "undefined" && !this.core.isWasmActive()) console.warn("[Layers] WebAssembly is available but the Rust core failed to load — running on the JS fallback engine. Check Metro asset handling for layers_core_bg.wasm.");
@@ -1113,6 +1115,11 @@ var LayersReactNative = class LayersReactNative {
1113
1115
  const depthAfter = this.core.queueDepth();
1114
1116
  if (depthAfter <= depthBefore && this.enableDebug) console.warn(`[Layers] screen("${screenName}") — event may not have been queued (depth before=${String(depthBefore)}, after=${String(depthAfter)})`);
1115
1117
  this.recordRecentEvent(`screen:${screenName}`, properties);
1118
+ if (this._skanManager) {
1119
+ const skanProps = { ...merged };
1120
+ if (skanProps.screen_name === void 0) skanProps.screen_name = screenName;
1121
+ this._skanManager.processEvent("screen_view", skanProps).catch(() => {});
1122
+ }
1116
1123
  } catch (e) {
1117
1124
  this.emitError(e);
1118
1125
  }
@@ -1669,6 +1676,9 @@ var LayersReactNative = class LayersReactNative {
1669
1676
  this._attributionTtclid = null;
1670
1677
  this._attributionMsclkid = null;
1671
1678
  this._initListener = null;
1679
+ this._skanManager = null;
1680
+ this._skanArmed = false;
1681
+ setSkanCore(null);
1672
1682
  this.core.shutdown();
1673
1683
  }
1674
1684
  /**
@@ -1942,27 +1952,16 @@ var LayersReactNative = class LayersReactNative {
1942
1952
  if (Platform.OS !== "ios") return;
1943
1953
  } catch {}
1944
1954
  try {
1945
- const configJson = this.core.getRemoteConfigJson?.();
1946
- if (!configJson) return;
1947
- const skanConfig = JSON.parse(configJson)?.skan;
1948
- if (!skanConfig || skanConfig.enabled === false) {
1955
+ this.core.skanConfigureFromRemoteConfig();
1956
+ if (!this.core.skanIsEnabled()) {
1949
1957
  this._skanManager = null;
1950
- this._lastSkanConfigStr = null;
1951
1958
  return;
1952
1959
  }
1953
- const skanConfigStr = JSON.stringify(skanConfig);
1954
- if (this._skanManager && this._lastSkanConfigStr === skanConfigStr) return;
1955
- const manager = new SKANManager();
1956
- if (skanConfig.preset) manager.setPreset(skanConfig.preset);
1957
- else if (skanConfig.customRules && Array.isArray(skanConfig.customRules)) manager.setCustomRules(skanConfig.customRules);
1958
- else return;
1959
- await manager.initialize();
1960
- this._skanManager = manager;
1961
- this._lastSkanConfigStr = skanConfigStr;
1962
- if (this.enableDebug) {
1963
- const metrics = manager.getMetrics();
1964
- console.log(`[Layers] SKAN auto-configured from remote config: preset=${metrics.currentPreset}, rules=${String(metrics.ruleCount)}`);
1960
+ if (!this._skanManager) this._skanManager = new SKANManager(void 0, this.core);
1961
+ if (!this._skanArmed) {
1962
+ if (await this._skanManager.initialize(true)) this._skanArmed = true;
1965
1963
  }
1964
+ if (this.enableDebug) console.log(`[Layers] SKAN auto-configured from remote config: preset=${String(this.core.skanCurrentPreset())}`);
1966
1965
  } catch {}
1967
1966
  }
1968
1967
  startConfigPolling() {
@@ -2443,4 +2442,4 @@ function useLayersExpoRouterTracking(sdkInstance, usePathname, useGlobalSearchPa
2443
2442
 
2444
2443
  //#endregion
2445
2444
  export { addToWishlistEvent as $, registerExpoBackgroundFlush as A, trackPurchaseFailed as B, SurveysModule as C, BACKGROUND_FLUSH_MIN_INTERVAL_MINUTES as D, useLayersNavigationTracking as E, trackRevenueCatPurchase as F, superwallOnEvent as G, trackRemoveFromCart as H, trackAddToCart as I, superwallTrackPurchase as J, superwallTrackDismiss as K, trackBeginCheckout as L, isRevenueCatConnected as M, resetRevenueCatForTesting as N, BACKGROUND_FLUSH_TASK_NAME as O, syncRevenueCatAttributes as P, addToCartEvent as Q, trackOrder as R, useLayersExpoRouterTracking as S, resolveActiveRoute as T, trackSubscription as U, trackRefund as V, trackViewProduct as W, superwallUserAttributes as X, superwallTrackSkip as Y, StandardEvents as Z, parseDeepLink as _, buildBeginCheckoutEvent as a, registerEvent as at, setupDeepLinkListener as b, buildStartTrialEvent as c, shareEvent as ct, formatFbc as d, subscribeEvent as dt, initiateCheckoutEvent as et, getAdServicesToken as f, tutorialCompleteEvent as ft, getOrSetInstallId as g, getInstallReferrer as h, buildAddToCartEvent as i, purchaseEvent as it, connectRevenueCat as j, createBackgroundFlushHandler as k, buildSubscribeEvent as l, signUpEvent as lt, getGoogleAdvertisingId as m, viewItemEvent as mt, LayersEvent as n, levelStartEvent as nt, buildPurchaseEvent as o, screenViewEvent as ot, getFirstInstallTime as p, viewContentEvent as pt, superwallTrackPresentation as q, LayersReactNative as r, loginEvent as rt, buildRefundEvent as s, searchEvent as st, LayersError$1 as t, levelCompleteEvent as tt, buildViewItemEvent as u, startTrialEvent as ut, parseInstallReferrerUrl as v, createNavigationListener as w, shouldTreatAsNewInstall as x, readClipboardAttribution as y, trackPurchase as z };
2446
- //# sourceMappingURL=src-q7SXK2Zt.mjs.map
2445
+ //# sourceMappingURL=src-BB_o-Y3r.mjs.map