affise-attribution-lib 1.6.29 → 1.6.31
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 +81 -50
- package/affise-attribution-native.podspec +1 -1
- package/android/build.gradle +1 -1
- package/lib/commonjs/AffiseInitProperties.js +7 -1
- package/lib/commonjs/AffiseInitProperties.js.map +1 -1
- package/lib/commonjs/Export.js +22 -0
- package/lib/commonjs/Export.js.map +1 -1
- package/lib/commonjs/index.js +41 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/native/AffiseApiMethod.js +5 -2
- package/lib/commonjs/native/AffiseApiMethod.js.map +1 -1
- package/lib/commonjs/native/AffiseNative.js +36 -19
- package/lib/commonjs/native/AffiseNative.js.map +1 -1
- package/lib/commonjs/native/NativeBase.js +4 -0
- package/lib/commonjs/native/NativeBase.js.map +1 -1
- package/lib/commonjs/settings/AffiseSettings.js +20 -1
- package/lib/commonjs/settings/AffiseSettings.js.map +1 -1
- package/lib/commonjs/settings/OnInitErrorHandler.js +2 -0
- package/lib/commonjs/settings/OnInitErrorHandler.js.map +1 -0
- package/lib/commonjs/settings/OnInitSuccessHandler.js +2 -0
- package/lib/commonjs/settings/OnInitSuccessHandler.js.map +1 -0
- package/lib/module/AffiseInitProperties.js +7 -1
- package/lib/module/AffiseInitProperties.js.map +1 -1
- package/lib/module/Export.js +2 -0
- package/lib/module/Export.js.map +1 -1
- package/lib/module/index.js +41 -6
- package/lib/module/index.js.map +1 -1
- package/lib/module/native/AffiseApiMethod.js +5 -2
- package/lib/module/native/AffiseApiMethod.js.map +1 -1
- package/lib/module/native/AffiseNative.js +36 -19
- package/lib/module/native/AffiseNative.js.map +1 -1
- package/lib/module/native/NativeBase.js +4 -0
- package/lib/module/native/NativeBase.js.map +1 -1
- package/lib/module/settings/AffiseSettings.js +20 -1
- package/lib/module/settings/AffiseSettings.js.map +1 -1
- package/lib/module/settings/OnInitErrorHandler.js +2 -0
- package/lib/module/settings/OnInitErrorHandler.js.map +1 -0
- package/lib/module/settings/OnInitSuccessHandler.js +2 -0
- package/lib/module/settings/OnInitSuccessHandler.js.map +1 -0
- package/lib/typescript/AffiseInitProperties.d.ts +7 -1
- package/lib/typescript/AffiseInitProperties.d.ts.map +1 -1
- package/lib/typescript/Export.d.ts +2 -0
- package/lib/typescript/Export.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +24 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/native/AffiseApiMethod.d.ts +5 -2
- package/lib/typescript/native/AffiseApiMethod.d.ts.map +1 -1
- package/lib/typescript/native/AffiseNative.d.ts +3 -2
- package/lib/typescript/native/AffiseNative.d.ts.map +1 -1
- package/lib/typescript/native/NativeBase.d.ts +1 -0
- package/lib/typescript/native/NativeBase.d.ts.map +1 -1
- package/lib/typescript/settings/AffiseSettings.d.ts +12 -0
- package/lib/typescript/settings/AffiseSettings.d.ts.map +1 -1
- package/lib/typescript/settings/OnInitErrorHandler.d.ts +2 -0
- package/lib/typescript/settings/OnInitErrorHandler.d.ts.map +1 -0
- package/lib/typescript/settings/OnInitSuccessHandler.d.ts +2 -0
- package/lib/typescript/settings/OnInitSuccessHandler.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/AffiseInitProperties.ts +11 -1
- package/src/Export.ts +2 -0
- package/src/index.ts +40 -6
- package/src/native/AffiseApiMethod.ts +5 -2
- package/src/native/AffiseNative.ts +34 -6
- package/src/native/NativeBase.ts +5 -0
- package/src/settings/AffiseSettings.ts +23 -0
- package/src/settings/OnInitErrorHandler.ts +1 -0
- package/src/settings/OnInitSuccessHandler.ts +1 -0
|
@@ -25,6 +25,9 @@ import type {AffiseProduct} from "../module/subscription/AffiseProduct";
|
|
|
25
25
|
import type {AffiseProductType} from "../module/subscription/AffiseProductType";
|
|
26
26
|
import type {AffisePurchasedInfo} from "../module/subscription/AffisePurchasedInfo";
|
|
27
27
|
import {DataName} from "./data/DataName";
|
|
28
|
+
import type { OnInitSuccessHandler } from "../settings/OnInitSuccessHandler";
|
|
29
|
+
import type { OnInitErrorHandler } from "../settings/OnInitErrorHandler";
|
|
30
|
+
|
|
28
31
|
|
|
29
32
|
export class AffiseNative extends NativeBase {
|
|
30
33
|
|
|
@@ -36,6 +39,16 @@ export class AffiseNative extends NativeBase {
|
|
|
36
39
|
option = initProperties;
|
|
37
40
|
}
|
|
38
41
|
|
|
42
|
+
this.nativeCallback(
|
|
43
|
+
AffiseApiMethod.ON_INIT_SUCCESS_HANDLER,
|
|
44
|
+
initProperties.onInitSuccessHandler
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
this.nativeCallback(
|
|
48
|
+
AffiseApiMethod.ON_INIT_ERROR_HANDLER,
|
|
49
|
+
initProperties.onInitErrorHandler
|
|
50
|
+
);
|
|
51
|
+
|
|
39
52
|
this.native(AffiseApiMethod.INIT, option);
|
|
40
53
|
}
|
|
41
54
|
|
|
@@ -119,12 +132,12 @@ export class AffiseNative extends NativeBase {
|
|
|
119
132
|
this.nativeCallbackOnce(AffiseApiMethod.GET_REFERRER_URL_VALUE_CALLBACK, callback, key);
|
|
120
133
|
}
|
|
121
134
|
|
|
122
|
-
|
|
123
|
-
this.nativeCallbackOnce(AffiseApiMethod.
|
|
135
|
+
getDeferredDeeplink(callback: ReferrerCallback) {
|
|
136
|
+
this.nativeCallbackOnce(AffiseApiMethod.GET_DEFERRED_DEEPLINK_CALLBACK, callback);
|
|
124
137
|
}
|
|
125
138
|
|
|
126
|
-
|
|
127
|
-
this.nativeCallbackOnce(AffiseApiMethod.
|
|
139
|
+
getDeferredDeeplinkValue(key: ReferrerKey, callback: ReferrerCallback) {
|
|
140
|
+
this.nativeCallbackOnce(AffiseApiMethod.GET_DEFERRED_DEEPLINK_VALUE_CALLBACK, callback, key);
|
|
128
141
|
}
|
|
129
142
|
|
|
130
143
|
isFirstRun(): Promise<boolean> {
|
|
@@ -154,6 +167,9 @@ export class AffiseNative extends NativeBase {
|
|
|
154
167
|
this.nativeCallbackOnce(AffiseApiMethod.SKAD_POSTBACK_ERROR_CALLBACK, completionHandler, value);
|
|
155
168
|
}
|
|
156
169
|
|
|
170
|
+
////////////////////////////////////////
|
|
171
|
+
// debug
|
|
172
|
+
////////////////////////////////////////
|
|
157
173
|
validate(callback: DebugOnValidateCallback) {
|
|
158
174
|
this.nativeCallbackOnce(AffiseApiMethod.DEBUG_VALIDATE_CALLBACK, callback);
|
|
159
175
|
}
|
|
@@ -162,6 +178,10 @@ export class AffiseNative extends NativeBase {
|
|
|
162
178
|
this.nativeCallback(AffiseApiMethod.DEBUG_NETWORK_CALLBACK, callback);
|
|
163
179
|
}
|
|
164
180
|
|
|
181
|
+
versionNative(): Promise<string> {
|
|
182
|
+
return this.nativeResult(AffiseApiMethod.DEBUG_VERSION_NATIVE);
|
|
183
|
+
}
|
|
184
|
+
|
|
165
185
|
////////////////////////////////////////
|
|
166
186
|
// modules
|
|
167
187
|
////////////////////////////////////////
|
|
@@ -225,16 +245,24 @@ export class AffiseNative extends NativeBase {
|
|
|
225
245
|
break;
|
|
226
246
|
}
|
|
227
247
|
break;
|
|
248
|
+
case AffiseApiMethod.ON_INIT_SUCCESS_HANDLER:
|
|
249
|
+
tryCast<OnInitSuccessHandler>(callback)?.();
|
|
250
|
+
this.removeApiCallback(api);
|
|
251
|
+
break;
|
|
252
|
+
case AffiseApiMethod.ON_INIT_ERROR_HANDLER:
|
|
253
|
+
tryCast<OnInitErrorHandler>(callback)?.(DataMapper.toNonNullString(data));
|
|
254
|
+
this.removeApiCallback(api);
|
|
255
|
+
break;
|
|
228
256
|
case AffiseApiMethod.GET_REFERRER_URL_CALLBACK:
|
|
229
257
|
tryCast<ReferrerCallback>(callback)?.(DataMapper.toNonNullString(data));
|
|
230
258
|
break;
|
|
231
259
|
case AffiseApiMethod.GET_REFERRER_URL_VALUE_CALLBACK:
|
|
232
260
|
tryCast<ReferrerCallback>(callback)?.(DataMapper.toNonNullString(data));
|
|
233
261
|
break;
|
|
234
|
-
case AffiseApiMethod.
|
|
262
|
+
case AffiseApiMethod.GET_DEFERRED_DEEPLINK_CALLBACK:
|
|
235
263
|
tryCast<ReferrerCallback>(callback)?.(DataMapper.toNonNullString(data));
|
|
236
264
|
break;
|
|
237
|
-
case AffiseApiMethod.
|
|
265
|
+
case AffiseApiMethod.GET_DEFERRED_DEEPLINK_VALUE_CALLBACK:
|
|
238
266
|
tryCast<ReferrerCallback>(callback)?.(DataMapper.toNonNullString(data));
|
|
239
267
|
break;
|
|
240
268
|
case AffiseApiMethod.REGISTER_DEEPLINK_CALLBACK:
|
package/src/native/NativeBase.ts
CHANGED
|
@@ -85,6 +85,11 @@ export class NativeBase extends NativeBasePlatform {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
protected removeApiCallback(api: AffiseApiMethod) {
|
|
89
|
+
if(!this.callbacksOnce.has(api)) return;
|
|
90
|
+
this.callbacksOnce.delete(api);
|
|
91
|
+
}
|
|
92
|
+
|
|
88
93
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
89
94
|
protected handleCallback(_api: AffiseApiMethod, _callback: unknown, _data: any, _tag: string | null) {
|
|
90
95
|
|
|
@@ -4,6 +4,9 @@ import {
|
|
|
4
4
|
// AutoCatchingType
|
|
5
5
|
} from "../index";
|
|
6
6
|
|
|
7
|
+
import type { OnInitErrorHandler } from "./OnInitErrorHandler";
|
|
8
|
+
import type { OnInitSuccessHandler } from "./OnInitSuccessHandler";
|
|
9
|
+
|
|
7
10
|
export class AffiseSettings {
|
|
8
11
|
private readonly affiseAppId: string;
|
|
9
12
|
private readonly secretKey: string;
|
|
@@ -14,6 +17,8 @@ export class AffiseSettings {
|
|
|
14
17
|
// private enabledMetrics: boolean = false;
|
|
15
18
|
// private autoCatchingClickEvents?: AutoCatchingType[] = [];
|
|
16
19
|
private domain?: string | null = null;
|
|
20
|
+
private onInitSuccessHandler?: OnInitSuccessHandler | null = null;
|
|
21
|
+
private onInitErrorHandler?: OnInitErrorHandler | null = null;
|
|
17
22
|
|
|
18
23
|
/**
|
|
19
24
|
* Affise SDK settings
|
|
@@ -97,6 +102,22 @@ export class AffiseSettings {
|
|
|
97
102
|
// return this;
|
|
98
103
|
// }
|
|
99
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Set OnInitSuccessHandler
|
|
107
|
+
*/
|
|
108
|
+
setOnInitSuccess(onInitSuccessHandler: OnInitSuccessHandler): AffiseSettings {
|
|
109
|
+
this.onInitSuccessHandler = onInitSuccessHandler;
|
|
110
|
+
return this;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Set OnInitErrorHandler
|
|
115
|
+
*/
|
|
116
|
+
setOnInitError(onInitErrorHandler: OnInitErrorHandler): AffiseSettings {
|
|
117
|
+
this.onInitErrorHandler = onInitErrorHandler;
|
|
118
|
+
return this;
|
|
119
|
+
}
|
|
120
|
+
|
|
100
121
|
private getInitProperties(): AffiseInitProperties {
|
|
101
122
|
return new AffiseInitProperties({
|
|
102
123
|
affiseAppId: this.affiseAppId,
|
|
@@ -108,6 +129,8 @@ export class AffiseSettings {
|
|
|
108
129
|
// enabledMetrics: this.enabledMetrics,
|
|
109
130
|
// autoCatchingClickEvents: this.autoCatchingClickEvents,
|
|
110
131
|
domain: this.domain,
|
|
132
|
+
onInitSuccessHandler: this.onInitSuccessHandler,
|
|
133
|
+
onInitErrorHandler: this.onInitErrorHandler,
|
|
111
134
|
});
|
|
112
135
|
}
|
|
113
136
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type OnInitErrorHandler = (e: string) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type OnInitSuccessHandler = () => void;
|