affise-attribution-lib 1.6.30 → 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.
Files changed (67) hide show
  1. package/README.md +36 -8
  2. package/affise-attribution-native.podspec +1 -1
  3. package/android/build.gradle +1 -1
  4. package/lib/commonjs/AffiseInitProperties.js +7 -1
  5. package/lib/commonjs/AffiseInitProperties.js.map +1 -1
  6. package/lib/commonjs/Export.js +22 -0
  7. package/lib/commonjs/Export.js.map +1 -1
  8. package/lib/commonjs/index.js +19 -0
  9. package/lib/commonjs/index.js.map +1 -1
  10. package/lib/commonjs/native/AffiseApiMethod.js +3 -0
  11. package/lib/commonjs/native/AffiseApiMethod.js.map +1 -1
  12. package/lib/commonjs/native/AffiseNative.js +31 -14
  13. package/lib/commonjs/native/AffiseNative.js.map +1 -1
  14. package/lib/commonjs/native/NativeBase.js +4 -0
  15. package/lib/commonjs/native/NativeBase.js.map +1 -1
  16. package/lib/commonjs/settings/AffiseSettings.js +20 -1
  17. package/lib/commonjs/settings/AffiseSettings.js.map +1 -1
  18. package/lib/commonjs/settings/OnInitErrorHandler.js +2 -0
  19. package/lib/commonjs/settings/OnInitErrorHandler.js.map +1 -0
  20. package/lib/commonjs/settings/OnInitSuccessHandler.js +2 -0
  21. package/lib/commonjs/settings/OnInitSuccessHandler.js.map +1 -0
  22. package/lib/module/AffiseInitProperties.js +7 -1
  23. package/lib/module/AffiseInitProperties.js.map +1 -1
  24. package/lib/module/Export.js +2 -0
  25. package/lib/module/Export.js.map +1 -1
  26. package/lib/module/index.js +19 -0
  27. package/lib/module/index.js.map +1 -1
  28. package/lib/module/native/AffiseApiMethod.js +3 -0
  29. package/lib/module/native/AffiseApiMethod.js.map +1 -1
  30. package/lib/module/native/AffiseNative.js +31 -14
  31. package/lib/module/native/AffiseNative.js.map +1 -1
  32. package/lib/module/native/NativeBase.js +4 -0
  33. package/lib/module/native/NativeBase.js.map +1 -1
  34. package/lib/module/settings/AffiseSettings.js +20 -1
  35. package/lib/module/settings/AffiseSettings.js.map +1 -1
  36. package/lib/module/settings/OnInitErrorHandler.js +2 -0
  37. package/lib/module/settings/OnInitErrorHandler.js.map +1 -0
  38. package/lib/module/settings/OnInitSuccessHandler.js +2 -0
  39. package/lib/module/settings/OnInitSuccessHandler.js.map +1 -0
  40. package/lib/typescript/AffiseInitProperties.d.ts +7 -1
  41. package/lib/typescript/AffiseInitProperties.d.ts.map +1 -1
  42. package/lib/typescript/Export.d.ts +2 -0
  43. package/lib/typescript/Export.d.ts.map +1 -1
  44. package/lib/typescript/index.d.ts +12 -0
  45. package/lib/typescript/index.d.ts.map +1 -1
  46. package/lib/typescript/native/AffiseApiMethod.d.ts +3 -0
  47. package/lib/typescript/native/AffiseApiMethod.d.ts.map +1 -1
  48. package/lib/typescript/native/AffiseNative.d.ts +1 -0
  49. package/lib/typescript/native/AffiseNative.d.ts.map +1 -1
  50. package/lib/typescript/native/NativeBase.d.ts +1 -0
  51. package/lib/typescript/native/NativeBase.d.ts.map +1 -1
  52. package/lib/typescript/settings/AffiseSettings.d.ts +12 -0
  53. package/lib/typescript/settings/AffiseSettings.d.ts.map +1 -1
  54. package/lib/typescript/settings/OnInitErrorHandler.d.ts +2 -0
  55. package/lib/typescript/settings/OnInitErrorHandler.d.ts.map +1 -0
  56. package/lib/typescript/settings/OnInitSuccessHandler.d.ts +2 -0
  57. package/lib/typescript/settings/OnInitSuccessHandler.d.ts.map +1 -0
  58. package/package.json +1 -1
  59. package/src/AffiseInitProperties.ts +11 -1
  60. package/src/Export.ts +2 -0
  61. package/src/index.ts +18 -0
  62. package/src/native/AffiseApiMethod.ts +3 -0
  63. package/src/native/AffiseNative.ts +28 -0
  64. package/src/native/NativeBase.ts +5 -0
  65. package/src/settings/AffiseSettings.ts +23 -0
  66. package/src/settings/OnInitErrorHandler.ts +1 -0
  67. package/src/settings/OnInitSuccessHandler.ts +1 -0
@@ -1,3 +1,5 @@
1
+ import type { OnInitErrorHandler } from "./OnInitErrorHandler";
2
+ import type { OnInitSuccessHandler } from "./OnInitSuccessHandler";
1
3
  export declare class AffiseSettings {
2
4
  private readonly affiseAppId;
3
5
  private readonly secretKey;
@@ -6,6 +8,8 @@ export declare class AffiseSettings {
6
8
  private partParamNameToken?;
7
9
  private appToken?;
8
10
  private domain?;
11
+ private onInitSuccessHandler?;
12
+ private onInitErrorHandler?;
9
13
  /**
10
14
  * Affise SDK settings
11
15
  *
@@ -54,6 +58,14 @@ export declare class AffiseSettings {
54
58
  *
55
59
  * @param enable
56
60
  */
61
+ /**
62
+ * Set OnInitSuccessHandler
63
+ */
64
+ setOnInitSuccess(onInitSuccessHandler: OnInitSuccessHandler): AffiseSettings;
65
+ /**
66
+ * Set OnInitErrorHandler
67
+ */
68
+ setOnInitError(onInitErrorHandler: OnInitErrorHandler): AffiseSettings;
57
69
  private getInitProperties;
58
70
  /**
59
71
  * Starts Affise SDK
@@ -1 +1 @@
1
- {"version":3,"file":"AffiseSettings.d.ts","sourceRoot":"","sources":["../../../src/settings/AffiseSettings.ts"],"names":[],"mappings":"AAMA,qBAAa,cAAc;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,YAAY,CAAiB;IACrC,OAAO,CAAC,aAAa,CAAC,CAAuB;IAC7C,OAAO,CAAC,kBAAkB,CAAC,CAAuB;IAClD,OAAO,CAAC,QAAQ,CAAC,CAAuB;IAGxC,OAAO,CAAC,MAAM,CAAC,CAAuB;IAEtC;;;;;OAKG;gBACS,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAKlD;;;;OAIG;IACH,aAAa,CAAC,UAAU,EAAE,OAAO,GAAG,cAAc;IAKlD;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc;IAKzC;;;;OAIG;IACH,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,cAAc;IAKvD;;;;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IACH,gBAAgB,CAAC,oBAAoB,EAAE,oBAAoB,GAAG,cAAc;IAK5E;;OAEG;IACH,cAAc,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,cAAc;IAKtE,OAAO,CAAC,iBAAiB;IAgBzB;;OAEG;IACH,KAAK;CAGR"}
@@ -0,0 +1,2 @@
1
+ export type OnInitErrorHandler = (e: string) => void;
2
+ //# sourceMappingURL=OnInitErrorHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OnInitErrorHandler.d.ts","sourceRoot":"","sources":["../../../src/settings/OnInitErrorHandler.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC"}
@@ -0,0 +1,2 @@
1
+ export type OnInitSuccessHandler = () => void;
2
+ //# sourceMappingURL=OnInitSuccessHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OnInitSuccessHandler.d.ts","sourceRoot":"","sources":["../../../src/settings/OnInitSuccessHandler.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG,MAAM,IAAI,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "affise-attribution-lib",
3
- "version": "1.6.30",
3
+ "version": "1.6.31",
4
4
  "description": "Affise Attribution Library",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -1,4 +1,6 @@
1
1
  import type {AutoCatchingType} from "./events/AutoCatchingType";
2
+ import type { OnInitErrorHandler } from "./settings/OnInitErrorHandler";
3
+ import type { OnInitSuccessHandler } from "./settings/OnInitSuccessHandler";
2
4
 
3
5
  export type AffiseInitPropertiesType = {
4
6
  /// AffiseAppId
@@ -19,6 +21,8 @@ export type AffiseInitPropertiesType = {
19
21
  autoCatchingClickEvents?: AutoCatchingType[],
20
22
  /// SDK server domain
21
23
  domain?: string | null,
24
+ onInitSuccessHandler?: OnInitSuccessHandler | null,
25
+ onInitErrorHandler?: OnInitErrorHandler | null,
22
26
  };
23
27
 
24
28
  export class AffiseInitProperties {
@@ -31,6 +35,8 @@ export class AffiseInitProperties {
31
35
  enabledMetrics: boolean = false;
32
36
  autoCatchingClickEvents?: AutoCatchingType[] = [];
33
37
  domain?: string | null = null;
38
+ onInitSuccessHandler?: OnInitSuccessHandler | null = null;
39
+ onInitErrorHandler?: OnInitErrorHandler | null = null;
34
40
 
35
41
  constructor(
36
42
  {
@@ -42,7 +48,9 @@ export class AffiseInitProperties {
42
48
  appToken,
43
49
  // enabledMetrics,
44
50
  // autoCatchingClickEvents,
45
- domain
51
+ domain,
52
+ onInitSuccessHandler,
53
+ onInitErrorHandler
46
54
  }: AffiseInitPropertiesType
47
55
  ) {
48
56
  this.affiseAppId = affiseAppId;
@@ -53,6 +61,8 @@ export class AffiseInitProperties {
53
61
  this.appToken = appToken || null;
54
62
  // this.autoCatchingClickEvents = autoCatchingClickEvents || [];
55
63
  this.domain = domain || null;
64
+ this.onInitSuccessHandler = onInitSuccessHandler || null;
65
+ this.onInitErrorHandler = onInitErrorHandler || null;
56
66
 
57
67
  if (isProduction != null) {
58
68
  this.isProduction = isProduction;
package/src/Export.ts CHANGED
@@ -19,6 +19,8 @@ export * from './referrer/ReferrerKey';
19
19
  export * from './referrer/ReferrerCallback';
20
20
 
21
21
  export * from './settings/AffiseSettings';
22
+ export * from './settings/OnInitErrorHandler';
23
+ export * from './settings/OnInitSuccessHandler';
22
24
 
23
25
  export * from './skad/SKAdNetwork';
24
26
  export * from './skad/CoarseValue';
package/src/index.ts CHANGED
@@ -51,6 +51,10 @@ export class Affise {
51
51
  this.native.init(initProperties);
52
52
  }
53
53
 
54
+ /**
55
+ * @deprecated use `Affise.settings.setOnInitSuccess` instead
56
+ * @returns
57
+ */
54
58
  static isInitialized(): Promise<boolean> {
55
59
  return this.native.isInitialized();
56
60
  }
@@ -392,5 +396,19 @@ export class Affise {
392
396
  static network(callback: DebugOnNetworkCallback) {
393
397
  Affise.native.network(callback);
394
398
  }
399
+
400
+ /**
401
+ * Debug get version of flutter library
402
+ */
403
+ static version(): string {
404
+ return "1.6.31";
405
+ }
406
+
407
+ /**
408
+ * Debug get version of native library Android/iOS
409
+ */
410
+ static versionNative(): Promise<string> {
411
+ return Affise.native.versionNative();
412
+ }
395
413
  };
396
414
  }
@@ -25,6 +25,8 @@ export enum AffiseApiMethod {
25
25
  IS_FIRST_RUN = "is_first_run",
26
26
 
27
27
  // callback methods
28
+ ON_INIT_SUCCESS_HANDLER = "on_init_success_handler",
29
+ ON_INIT_ERROR_HANDLER = "on_init_error_handler",
28
30
  GET_REFERRER_URL_CALLBACK = "get_referrer_url_callback",
29
31
  GET_REFERRER_URL_VALUE_CALLBACK = "get_referrer_url_value_callback",
30
32
  GET_DEFERRED_DEEPLINK_CALLBACK = "get_deferred_deeplink_callback",
@@ -36,6 +38,7 @@ export enum AffiseApiMethod {
36
38
  // debug
37
39
  DEBUG_VALIDATE_CALLBACK = "debug_validate_callback",
38
40
  DEBUG_NETWORK_CALLBACK = "debug_network_callback",
41
+ DEBUG_VERSION_NATIVE = "debug_version_native",
39
42
 
40
43
  ////////////////////////////////////////
41
44
  // modules
@@ -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
 
@@ -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,6 +245,14 @@ 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;
@@ -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;