@appmetrica/react-native-analytics 3.0.0 → 3.1.0

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 (42) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/io/appmetrica/analytics/reactnative/AppMetricaModule.java +10 -0
  3. package/android/src/main/java/io/appmetrica/analytics/reactnative/UserProfileSerializer.java +257 -0
  4. package/android/src/main/java/io/appmetrica/analytics/reactnative/Utils.java +9 -0
  5. package/appmetrica-react-native-analytics.podspec +1 -1
  6. package/ios/AMARNAppMetrica.m +6 -0
  7. package/ios/AMARNAppMetricaUtils.h +2 -0
  8. package/ios/AMARNAppMetricaUtils.m +8 -0
  9. package/ios/AMARNUserProfileSerializer.h +6 -0
  10. package/ios/AMARNUserProfileSerializer.m +182 -0
  11. package/lib/commonjs/ecommerce.js +10 -9
  12. package/lib/commonjs/ecommerce.js.map +1 -1
  13. package/lib/commonjs/index.js +17 -1
  14. package/lib/commonjs/index.js.map +1 -1
  15. package/lib/commonjs/userProfile.js +283 -0
  16. package/lib/commonjs/userProfile.js.map +1 -0
  17. package/lib/commonjs/utils.js +72 -0
  18. package/lib/commonjs/utils.js.map +1 -0
  19. package/lib/module/ecommerce.js +10 -9
  20. package/lib/module/ecommerce.js.map +1 -1
  21. package/lib/module/index.js +6 -1
  22. package/lib/module/index.js.map +1 -1
  23. package/lib/module/userProfile.js +267 -0
  24. package/lib/module/userProfile.js.map +1 -0
  25. package/lib/module/utils.js +61 -0
  26. package/lib/module/utils.js.map +1 -0
  27. package/lib/typescript/src/ecommerce.d.ts +3 -3
  28. package/lib/typescript/src/ecommerce.d.ts.map +1 -1
  29. package/lib/typescript/src/index.d.ts +5 -1
  30. package/lib/typescript/src/index.d.ts.map +1 -1
  31. package/lib/typescript/src/revenue.d.ts +1 -1
  32. package/lib/typescript/src/revenue.d.ts.map +1 -1
  33. package/lib/typescript/src/userProfile.d.ts +84 -0
  34. package/lib/typescript/src/userProfile.d.ts.map +1 -0
  35. package/lib/typescript/src/utils.d.ts +9 -0
  36. package/lib/typescript/src/utils.d.ts.map +1 -0
  37. package/package.json +1 -1
  38. package/src/ecommerce.ts +20 -12
  39. package/src/index.ts +10 -2
  40. package/src/revenue.ts +1 -1
  41. package/src/userProfile.ts +362 -0
  42. package/src/utils.ts +71 -0
@@ -0,0 +1,267 @@
1
+ export class UserProfile {
2
+ constructor() {
3
+ this.attributes = [];
4
+ }
5
+ apply(attribute) {
6
+ this.attributes.push(attribute);
7
+ return this;
8
+ }
9
+ }
10
+ export class Attributes {
11
+ static birthDate() {
12
+ return new BirthDateAttribute();
13
+ }
14
+ static customBoolean(key) {
15
+ return new BooleanAttribute(key);
16
+ }
17
+ static customCounter(key) {
18
+ return new CounterAttribute(key);
19
+ }
20
+ static customNumber(key) {
21
+ return new NumberAttribute(key);
22
+ }
23
+ static customString(key) {
24
+ return new StringAttribute(key);
25
+ }
26
+ static gender() {
27
+ return new GenderAttribute();
28
+ }
29
+ static userName() {
30
+ return new NameAttribute();
31
+ }
32
+ static notificationsEnabled() {
33
+ return new NotificationsEnabledAttribute();
34
+ }
35
+ }
36
+ export class BirthDateAttribute {
37
+ withAge(age) {
38
+ return {
39
+ type: 'BirthDateWithAge',
40
+ age: age,
41
+ ifUndefined: false
42
+ };
43
+ }
44
+ withAgeIfUndefined(age) {
45
+ return {
46
+ type: 'BirthDateWithAge',
47
+ age: age,
48
+ ifUndefined: true
49
+ };
50
+ }
51
+ withYear(year) {
52
+ return {
53
+ type: 'BirthDateWithYear',
54
+ year: year,
55
+ ifUndefined: false
56
+ };
57
+ }
58
+ withYearIfUndefined(year) {
59
+ return {
60
+ type: 'BirthDateWithYear',
61
+ year: year,
62
+ ifUndefined: true
63
+ };
64
+ }
65
+ withMonth(year, month) {
66
+ return {
67
+ type: 'BirthDateWithMonth',
68
+ year: year,
69
+ month: month,
70
+ ifUndefined: false
71
+ };
72
+ }
73
+ withMonthIfUndefined(year, month) {
74
+ return {
75
+ type: 'BirthDateWithMonth',
76
+ year: year,
77
+ month: month,
78
+ ifUndefined: true
79
+ };
80
+ }
81
+ withDay(year, month, day) {
82
+ return {
83
+ type: 'BirthDateWithDay',
84
+ year: year,
85
+ month: month,
86
+ day: day,
87
+ ifUndefined: false
88
+ };
89
+ }
90
+ withDayIfUndefined(year, month, day) {
91
+ return {
92
+ type: 'BirthDateWithDay',
93
+ year: year,
94
+ month: month,
95
+ day: day,
96
+ ifUndefined: true
97
+ };
98
+ }
99
+ withDate(date) {
100
+ return this.withDay(date.getFullYear(), date.getMonth(), date.getDate());
101
+ }
102
+ withDateIfUndefined(date) {
103
+ return this.withDayIfUndefined(date.getFullYear(), date.getMonth(), date.getDate());
104
+ }
105
+ withValueReset() {
106
+ return {
107
+ type: 'BirthDateValueReset'
108
+ };
109
+ }
110
+ }
111
+ export class BooleanAttribute {
112
+ constructor(key) {
113
+ this.key = key;
114
+ }
115
+ withValue(value) {
116
+ return {
117
+ type: 'BooleanValue',
118
+ key: this.key,
119
+ value: value,
120
+ ifUndefined: false
121
+ };
122
+ }
123
+ withValueIfUndefined(value) {
124
+ return {
125
+ type: 'BooleanValue',
126
+ key: this.key,
127
+ value: value,
128
+ ifUndefined: true
129
+ };
130
+ }
131
+ withValueReset() {
132
+ return {
133
+ type: 'BooleanValueReset',
134
+ key: this.key
135
+ };
136
+ }
137
+ }
138
+ export class CounterAttribute {
139
+ constructor(key) {
140
+ this.key = key;
141
+ }
142
+ withDelta(delta) {
143
+ return {
144
+ type: 'Counter',
145
+ key: this.key,
146
+ delta: delta
147
+ };
148
+ }
149
+ }
150
+ export class GenderAttribute {
151
+ withValue(gender) {
152
+ return {
153
+ type: 'GenderValue',
154
+ value: gender,
155
+ ifUndefined: false
156
+ };
157
+ }
158
+ withValueIfUndefined(gender) {
159
+ return {
160
+ type: 'GenderValue',
161
+ value: gender,
162
+ ifUndefined: true
163
+ };
164
+ }
165
+ withValueReset() {
166
+ return {
167
+ type: 'GenderValueReset'
168
+ };
169
+ }
170
+ }
171
+ export class NameAttribute {
172
+ withValue(value) {
173
+ return {
174
+ type: 'NameValue',
175
+ value: value,
176
+ ifUndefined: false
177
+ };
178
+ }
179
+ withValueIfUndefined(value) {
180
+ return {
181
+ type: 'NameValue',
182
+ value: value,
183
+ ifUndefined: true
184
+ };
185
+ }
186
+ withValueReset() {
187
+ return {
188
+ type: 'NameValueReset'
189
+ };
190
+ }
191
+ }
192
+ export class NotificationsEnabledAttribute {
193
+ withValue(value) {
194
+ return {
195
+ type: 'NotificationsEnabledValue',
196
+ value: value,
197
+ ifUndefined: false
198
+ };
199
+ }
200
+ withValueIfUndefined(value) {
201
+ return {
202
+ type: 'NotificationsEnabledValue',
203
+ value: value,
204
+ ifUndefined: true
205
+ };
206
+ }
207
+ withValueReset() {
208
+ return {
209
+ type: 'NotificationsEnabledValueReset'
210
+ };
211
+ }
212
+ }
213
+ export class NumberAttribute {
214
+ constructor(key) {
215
+ this.key = key;
216
+ }
217
+ withValue(value) {
218
+ return {
219
+ type: 'NumberValue',
220
+ key: this.key,
221
+ value: value,
222
+ ifUndefined: false
223
+ };
224
+ }
225
+ withValueIfUndefined(value) {
226
+ return {
227
+ type: 'NumberValue',
228
+ key: this.key,
229
+ value: value,
230
+ ifUndefined: true
231
+ };
232
+ }
233
+ withValueReset() {
234
+ return {
235
+ type: 'NumberValueReset',
236
+ key: this.key
237
+ };
238
+ }
239
+ }
240
+ export class StringAttribute {
241
+ constructor(key) {
242
+ this.key = key;
243
+ }
244
+ withValue(value) {
245
+ return {
246
+ type: 'StringValue',
247
+ key: this.key,
248
+ value: value,
249
+ ifUndefined: false
250
+ };
251
+ }
252
+ withValueIfUndefined(value) {
253
+ return {
254
+ type: 'StringValue',
255
+ key: this.key,
256
+ value: value,
257
+ ifUndefined: true
258
+ };
259
+ }
260
+ withValueReset() {
261
+ return {
262
+ type: 'StringValueReset',
263
+ key: this.key
264
+ };
265
+ }
266
+ }
267
+ //# sourceMappingURL=userProfile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["UserProfile","constructor","attributes","apply","attribute","push","Attributes","birthDate","BirthDateAttribute","customBoolean","key","BooleanAttribute","customCounter","CounterAttribute","customNumber","NumberAttribute","customString","StringAttribute","gender","GenderAttribute","userName","NameAttribute","notificationsEnabled","NotificationsEnabledAttribute","withAge","age","type","ifUndefined","withAgeIfUndefined","withYear","year","withYearIfUndefined","withMonth","month","withMonthIfUndefined","withDay","day","withDayIfUndefined","withDate","date","getFullYear","getMonth","getDate","withDateIfUndefined","withValueReset","withValue","value","withValueIfUndefined","withDelta","delta"],"sourceRoot":"../../src","sources":["userProfile.ts"],"mappings":"AAAA,OAAO,MAAMA,WAAW,CAAC;EAGvBC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,UAAU,GAAG,EAAE;EACtB;EAEAC,KAAKA,CAACC,SAA4B,EAAe;IAC/C,IAAI,CAACF,UAAU,CAACG,IAAI,CAACD,SAAS,CAAC;IAE/B,OAAO,IAAI;EACb;AACF;AAoCA,OAAO,MAAME,UAAU,CAAC;EACtB,OAAOC,SAASA,CAAA,EAAG;IACjB,OAAO,IAAIC,kBAAkB,CAAC,CAAC;EACjC;EAEA,OAAOC,aAAaA,CAACC,GAAW,EAAE;IAChC,OAAO,IAAIC,gBAAgB,CAACD,GAAG,CAAC;EAClC;EAEA,OAAOE,aAAaA,CAACF,GAAW,EAAE;IAChC,OAAO,IAAIG,gBAAgB,CAACH,GAAG,CAAC;EAClC;EAEA,OAAOI,YAAYA,CAACJ,GAAW,EAAE;IAC/B,OAAO,IAAIK,eAAe,CAACL,GAAG,CAAC;EACjC;EAEA,OAAOM,YAAYA,CAACN,GAAW,EAAE;IAC/B,OAAO,IAAIO,eAAe,CAACP,GAAG,CAAC;EACjC;EAEA,OAAOQ,MAAMA,CAAA,EAAG;IACd,OAAO,IAAIC,eAAe,CAAC,CAAC;EAC9B;EAEA,OAAOC,QAAQA,CAAA,EAAG;IAChB,OAAO,IAAIC,aAAa,CAAC,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AC;EACH;EAEAiB,cAAcA,CAAA,EAAsB;IAClC,OAAO;MACLlB,IAAI,EAAE,kBAAkB;MACxBhB,GAAG,EAAE,IAAI,CAACA;IACZ,CAAC;EACH;AACF","ignoreList":[]}
@@ -0,0 +1,61 @@
1
+ function convertMap(map) {
2
+ return map !== undefined ? Object.fromEntries(map) : undefined;
3
+ }
4
+ export function normalizeECommerceOrder(order) {
5
+ const newOrder = {
6
+ ...order
7
+ };
8
+ if (order.payload instanceof Map) {
9
+ newOrder.payload = convertMap(order.payload);
10
+ }
11
+ newOrder.products = order.products.map(normalizeECommerceCartItem);
12
+ return newOrder;
13
+ }
14
+ export function normalizeECommerceCartItem(item) {
15
+ const newItem = {
16
+ ...item
17
+ };
18
+ newItem.product = normalizeECommerceProduct(item.product);
19
+ newItem.referrer = normalizeECommerceReferrer(item.referrer);
20
+ return newItem;
21
+ }
22
+ export function normalizeECommerceProduct(product) {
23
+ const newProduct = {
24
+ ...product
25
+ };
26
+ if (product.payload instanceof Map) {
27
+ newProduct.payload = convertMap(product.payload);
28
+ }
29
+ return newProduct;
30
+ }
31
+ export function normalizeECommerceReferrer(referrer) {
32
+ if (referrer === undefined) {
33
+ return undefined;
34
+ }
35
+ const newReferrer = {
36
+ ...referrer
37
+ };
38
+ if (referrer.screen != undefined) {
39
+ newReferrer.screen = normalizeECommerceScreen(referrer.screen);
40
+ }
41
+ return newReferrer;
42
+ }
43
+ export function normalizeECommerceScreen(screen) {
44
+ const newScreen = {
45
+ ...screen
46
+ };
47
+ if (screen.payload instanceof Map) {
48
+ newScreen.payload = convertMap(screen.payload);
49
+ }
50
+ return newScreen;
51
+ }
52
+ export function normalizeAdRevenue(adRevenue) {
53
+ const newAdRevenue = {
54
+ ...adRevenue
55
+ };
56
+ if (adRevenue.payload instanceof Map) {
57
+ newAdRevenue.payload = convertMap(adRevenue.payload);
58
+ }
59
+ return newAdRevenue;
60
+ }
61
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["convertMap","map","undefined","Object","fromEntries","normalizeECommerceOrder","order","newOrder","payload","Map","products","normalizeECommerceCartItem","item","newItem","product","normalizeECommerceProduct","referrer","normalizeECommerceReferrer","newProduct","newReferrer","screen","normalizeECommerceScreen","newScreen","normalizeAdRevenue","adRevenue","newAdRevenue"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":"AASA,SAASA,UAAUA,CACjBC,GAAyB,EACW;EACpC,OAAOA,GAAG,KAAKC,SAAS,GAAGC,MAAM,CAACC,WAAW,CAACH,GAAG,CAAC,GAAGC,SAAS;AAChE;AAEA,OAAO,SAASG,uBAAuBA,CAACC,KAAqB,EAAkB;EAC7E,MAAMC,QAAQ,GAAG;IAAE,GAAGD;EAAM,CAAmB;EAC/C,IAAIA,KAAK,CAACE,OAAO,YAAYC,GAAG,EAAE;IAChCF,QAAQ,CAACC,OAAO,GAAGR,UAAU,CAACM,KAAK,CAACE,OAAO,CAAC;EAC9C;EACAD,QAAQ,CAACG,QAAQ,GAAGJ,KAAK,CAACI,QAAQ,CAACT,GAAG,CAACU,0BAA0B,CAAC;EAClE,OAAOJ,QAAQ;AACjB;AAEA,OAAO,SAASI,0BAA0BA,CACxCC,IAAuB,EACJ;EACnB,MAAMC,OAAO,GAAG;IAAE,GAAGD;EAAK,CAAsB;EAChDC,OAAO,CAACC,OAAO,GAAGC,yBAAyB,CAACH,IAAI,CAACE,OAAO,CAAC;EACzDD,OAAO,CAACG,QAAQ,GAAGC,0BAA0B,CAACL,IAAI,CAACI,QAAQ,CAAC;EAC5D,OAAOH,OAAO;AAChB;AAEA,OAAO,SAASE,yBAAyBA,CACvCD,OAAyB,EACP;EAClB,MAAMI,UAAU,GAAG;IAAE,GAAGJ;EAAQ,CAAqB;EACrD,IAAIA,OAAO,CAACN,OAAO,YAAYC,GAAG,EAAE;IAClCS,UAAU,CAACV,OAAO,GAAGR,UAAU,CAACc,OAAO,CAACN,OAAO,CAAC;EAClD;EACA,OAAOU,UAAU;AACnB;AAEA,OAAO,SAASD,0BAA0BA,CACxCD,QAA4B,EACG;EAC/B,IAAIA,QAAQ,KAAKd,SAAS,EAAE;IAC1B,OAAOA,SAAS;EAClB;EACA,MAAMiB,WAAW,GAAG;IAAE,GAAGH;EAAS,CAAsB;EACxD,IAAIA,QAAQ,CAACI,MAAM,IAAIlB,SAAS,EAAE;IAChCiB,WAAW,CAACC,MAAM,GAAGC,wBAAwB,CAACL,QAAQ,CAACI,MAAM,CAAC;EAChE;EACA,OAAOD,WAAW;AACpB;AAEA,OAAO,SAASE,wBAAwBA,CAACD,MAAuB,EAAmB;EACjF,MAAME,SAAS,GAAG;IAAE,GAAGF;EAAO,CAAoB;EAClD,IAAIA,MAAM,CAACZ,OAAO,YAAYC,GAAG,EAAE;IACjCa,SAAS,CAACd,OAAO,GAAGR,UAAU,CAACoB,MAAM,CAACZ,OAAO,CAAC;EAChD;EACA,OAAOc,SAAS;AAClB;AAEA,OAAO,SAASC,kBAAkBA,CAACC,SAAoB,EAAa;EAClE,MAAMC,YAAY,GAAG;IAAE,GAAGD;EAAU,CAAc;EAClD,IAAIA,SAAS,CAAChB,OAAO,YAAYC,GAAG,EAAE;IACpCgB,YAAY,CAACjB,OAAO,GAAGR,UAAU,CAACwB,SAAS,CAAChB,OAAO,CAAC;EACtD;EACA,OAAOiB,YAAY;AACrB","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  export type ECommerceScreen = {
2
2
  name: string;
3
3
  searchQuery?: string;
4
- payload?: Map<string, string>;
4
+ payload?: Map<string, string> | Record<string, string>;
5
5
  categoriesPath?: Array<string>;
6
6
  };
7
7
  export type ECommerceAmount = {
@@ -19,7 +19,7 @@ export type ECommerceProduct = {
19
19
  originalPrice?: ECommercePrice;
20
20
  promocodes?: Array<string>;
21
21
  categoriesPath?: Array<string>;
22
- payload?: Map<string, string>;
22
+ payload?: Map<string, string> | Record<string, string>;
23
23
  };
24
24
  export type ECommerceReferrer = {
25
25
  type?: string;
@@ -35,7 +35,7 @@ export type ECommerceCartItem = {
35
35
  export type ECommerceOrder = {
36
36
  orderId: string;
37
37
  products: Array<ECommerceCartItem>;
38
- payload?: Map<string, string>;
38
+ payload?: Map<string, string> | Record<string, string>;
39
39
  };
40
40
  export type ECommerceEventType = 'showSceenEvent' | 'showProductCardEvent' | 'showProductDetailsEvent' | 'addCartItemEvent' | 'removeCartItemEvent' | 'beginCheckoutEvent' | 'purchaseEvent';
41
41
  export interface ECommerceEvent {
@@ -1 +1 @@
1
- {"version":3,"file":"ecommerce.d.ts","sourceRoot":"","sources":["../../../src/ecommerce.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,cAAc,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,eAAe,CAAC;IACxB,kBAAkB,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,cAAc,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,iBAA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MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,cAAc;IAOhE,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,cAAc;IAOnE,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAAE,cAAc,GAAG,cAAc;IAOhE,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,cAAc,GAAG,cAAc;CAM5D"}
@@ -1,5 +1,6 @@
1
1
  import type { ECommerceEvent } from './ecommerce';
2
2
  import type { AdRevenue, Revenue } from './revenue';
3
+ import type { UserProfile } from './userProfile';
3
4
  export type AppMetricaConfig = {
4
5
  apiKey: string;
5
6
  appVersion?: string;
@@ -16,6 +17,7 @@ export type AppMetricaConfig = {
16
17
  activationAsSessionStart?: boolean;
17
18
  sessionsAutoTracking?: boolean;
18
19
  appOpenTrackingEnabled?: boolean;
20
+ userProfileID?: string;
19
21
  };
20
22
  export type PreloadInfo = {
21
23
  trackingId: string;
@@ -42,13 +44,14 @@ export declare const DEVICE_ID_KEY = "appmetrica_device_id";
42
44
  export declare const UUID_KEY = "appmetrica_uuid";
43
45
  export * from './ecommerce';
44
46
  export * from './revenue';
47
+ export * from './userProfile';
45
48
  export default class AppMetrica {
46
49
  static activate(config: AppMetricaConfig): void;
47
50
  static getLibraryApiLevel(): Promise<number>;
48
51
  static getLibraryVersion(): Promise<string>;
49
52
  static pauseSession(): void;
50
53
  static reportAppOpen(deeplink?: string): void;
51
- static reportError(identifier: string, message: string, _reason: Object): void;
54
+ static reportError(identifier: string, message: string, _reason?: Object): void;
52
55
  static reportEvent(eventName: string, attributes?: Record<string, any>): void;
53
56
  static requestStartupParams(listener: StartupParamsCallback, identifiers: Array<string>): void;
54
57
  static resumeSession(): void;
@@ -60,5 +63,6 @@ export default class AppMetrica {
60
63
  static reportECommerce(event: ECommerceEvent): void;
61
64
  static reportRevenue(revenue: Revenue): void;
62
65
  static reportAdRevenue(adRevenue: AdRevenue): void;
66
+ static reportUserProfile(userProfile: UserProfile): void;
63
67
  }
64
68
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmCpD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,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EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;IAIxE,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAItE,MAAM,CAAC,oBAAoB,CACzB,QAAQ,EAAE,qBAAqB,EAC/B,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC;IAK5B,MAAM,CAAC,aAAa;IAIpB,MAAM,CAAC,gBAAgB;IAIvB,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,QAAQ;IAItC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO;IAI3C,MAAM,CAAC,qBAAqB,CAAC,OAAO,EAAE,OAAO;IAI7C,MAAM,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,MAAM;IAI9C,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,cAAc;IAI5C,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO;IAIrC,MAAM,CAAC,eAAe,CAAC,SAAS,EAAE,SAAS;IAI3C,MAAM,CAAC,iBAAiB,CAAC,WAAW,EAAE,WAAW;CAGlD"}
@@ -14,7 +14,7 @@ export type Receipt = {
14
14
  export type AdRevenue = {
15
15
  price: number | string;
16
16
  currency: string;
17
- payload?: Map<string, string>;
17
+ payload?: Map<string, string> | Record<string, string>;
18
18
  adNetwork?: string;
19
19
  adPlacementID?: string;
20
20
  adPlacementName?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"revenue.d.ts","sourceRoot":"","sources":["../../../src/revenue.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO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C;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,oBAAY,MAAM;IAChB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,YAAY,iBAAiB;IAC7B,QAAQ,aAAa;IACrB,KAAK,UAAU;CAChB"}
@@ -0,0 +1,84 @@
1
+ export declare class UserProfile {
2
+ private attributes;
3
+ constructor();
4
+ apply(attribute: UserProfileUpdate): UserProfile;
5
+ }
6
+ type UserProfileUpdateType = 'BirthDateWithAge' | 'BirthDateWithYear' | 'BirthDateWithMonth' | 'BirthDateWithDay' | 'BirthDateValueReset' | 'BooleanValue' | 'BooleanValueReset' | 'Counter' | 'GenderValue' | 'GenderValueReset' | 'NameValue' | 'NameValueReset' | 'NotificationsEnabledValue' | 'NotificationsEnabledValueReset' | 'NumberValue' | 'NumberValueReset' | 'StringValue' | 'StringValueReset';
7
+ export interface UserProfileUpdate {
8
+ type: UserProfileUpdateType;
9
+ key?: string;
10
+ value?: any;
11
+ ifUndefined?: boolean;
12
+ age?: number;
13
+ year?: number;
14
+ month?: number;
15
+ day?: number;
16
+ delta?: number;
17
+ }
18
+ export type UserProfileGender = 'male' | 'female' | 'other';
19
+ export declare class Attributes {
20
+ static birthDate(): BirthDateAttribute;
21
+ static customBoolean(key: string): BooleanAttribute;
22
+ static customCounter(key: string): CounterAttribute;
23
+ static customNumber(key: string): NumberAttribute;
24
+ static customString(key: string): StringAttribute;
25
+ static gender(): GenderAttribute;
26
+ static userName(): NameAttribute;
27
+ static notificationsEnabled(): NotificationsEnabledAttribute;
28
+ }
29
+ export declare class BirthDateAttribute {
30
+ withAge(age: number): UserProfileUpdate;
31
+ withAgeIfUndefined(age: number): UserProfileUpdate;
32
+ withYear(year: number): UserProfileUpdate;
33
+ withYearIfUndefined(year: number): UserProfileUpdate;
34
+ withMonth(year: number, month: number): UserProfileUpdate;
35
+ withMonthIfUndefined(year: number, month: number): UserProfileUpdate;
36
+ withDay(year: number, month: number, day: number): UserProfileUpdate;
37
+ withDayIfUndefined(year: number, month: number, day: number): UserProfileUpdate;
38
+ withDate(date: Date): UserProfileUpdate;
39
+ withDateIfUndefined(date: Date): UserProfileUpdate;
40
+ withValueReset(): UserProfileUpdate;
41
+ }
42
+ export declare class BooleanAttribute {
43
+ private readonly key;
44
+ constructor(key: string);
45
+ withValue(value: boolean): UserProfileUpdate;
46
+ withValueIfUndefined(value: boolean): UserProfileUpdate;
47
+ withValueReset(): UserProfileUpdate;
48
+ }
49
+ export declare class CounterAttribute {
50
+ private readonly key;
51
+ constructor(key: string);
52
+ withDelta(delta: number): UserProfileUpdate;
53
+ }
54
+ export declare class GenderAttribute {
55
+ withValue(gender: UserProfileGender): UserProfileUpdate;
56
+ withValueIfUndefined(gender: UserProfileGender): UserProfileUpdate;
57
+ withValueReset(): UserProfileUpdate;
58
+ }
59
+ export declare class NameAttribute {
60
+ withValue(value: string): UserProfileUpdate;
61
+ withValueIfUndefined(value: string): UserProfileUpdate;
62
+ withValueReset(): UserProfileUpdate;
63
+ }
64
+ export declare class NotificationsEnabledAttribute {
65
+ withValue(value: boolean): UserProfileUpdate;
66
+ withValueIfUndefined(value: boolean): UserProfileUpdate;
67
+ withValueReset(): UserProfileUpdate;
68
+ }
69
+ export declare class NumberAttribute {
70
+ private readonly key;
71
+ constructor(key: string);
72
+ withValue(value: number): UserProfileUpdate;
73
+ withValueIfUndefined(value: number): UserProfileUpdate;
74
+ withValueReset(): UserProfileUpdate;
75
+ }
76
+ export declare class StringAttribute {
77
+ private readonly key;
78
+ constructor(key: string);
79
+ withValue(value: string): UserProfileUpdate;
80
+ withValueIfUndefined(value: string): UserProfileUpdate;
81
+ withValueReset(): UserProfileUpdate;
82
+ }
83
+ export {};
84
+ //# sourceMappingURL=userProfile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userProfile.d.ts","sourceRoot":"","sources":["../../../src/userProfile.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAW;IACtB,OAAO,CAAC,UAAU,CAA2B;;IAM7C,KAAK,CAAC,SAAS,EAAE,iBAAiB,GAAG,WAAW;CAKjD;AAED,KAAK,qBAAqB,GACtB,kBAAkB,GAClB,mBAAmB,GACnB,oBAAoB,GACpB,kBAAkB,GAClB,qBAAqB,GACrB,cAAc,GACd,mBAAmB,GACnB,SAAS,GACT,aAAa,GACb,kBAAkB,GAClB,WAAW,GACX,gBAAgB,GAChB,2BAA2B,GAC3B,gCAAgC,GAChC,aAAa,GACb,kBAAkB,GAClB,aAAa,GACb,kBAAkB,CAAC;AAEvB,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE5D,qBAAa,UAAU;IACrB,MAAM,CAAC,SAAS;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CAMpC;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;gBAEjB,GAAG,EAAE,MAAM;IAIvB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB;CAO5C;AAED,qBAAa,eAAe;IAC1B,SAAS,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB;IAQvD,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB;IAQlE,cAAc,IAAI,iBAAiB;CAKpC;AAED,qBAAa,aAAa;IACxB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB;IAQ3C,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB;IAQtD,cAAc,IAAI,iBAAiB;CAKpC;AAED,qBAAa,6BAA6B;IACxC,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB;IAQ5C,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB;IAQvD,cAAc,IAAI,iBAAiB;CAKpC;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;gBAEjB,GAAG,EAAE,MAAM;IAIvB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB;IAS3C,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB;IAStD,cAAc,IAAI,iBAAiB;CAMpC;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;gBAEjB,GAAG,EAAE,MAAM;IAIvB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB;IAS3C,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB;IAStD,cAAc,IAAI,iBAAiB;CAMpC"}
@@ -0,0 +1,9 @@
1
+ import type { ECommerceCartItem, ECommerceOrder, ECommerceProduct, ECommerceReferrer, ECommerceScreen } from './ecommerce';
2
+ import type { AdRevenue } from './revenue';
3
+ export declare function normalizeECommerceOrder(order: ECommerceOrder): ECommerceOrder;
4
+ export declare function normalizeECommerceCartItem(item: ECommerceCartItem): ECommerceCartItem;
5
+ export declare function normalizeECommerceProduct(product: ECommerceProduct): ECommerceProduct;
6
+ export declare function normalizeECommerceReferrer(referrer?: ECommerceReferrer): ECommerceReferrer | undefined;
7
+ export declare function normalizeECommerceScreen(screen: ECommerceScreen): ECommerceScreen;
8
+ export declare function normalizeAdRevenue(adRevenue: AdRevenue): AdRevenue;
9
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAQ3C,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,cAAc,GAAG,cAAc,CAO7E;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,iBAAiB,GACtB,iBAAiB,CAKnB;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,gBAAgB,GACxB,gBAAgB,CAMlB;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,iBAAiB,GAAG,SAAS,CAS/B;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe,CAMjF;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAMlE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appmetrica/react-native-analytics",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "React Native plugin for AppMetrica analytics tool",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
package/src/ecommerce.ts CHANGED
@@ -1,7 +1,15 @@
1
+ import {
2
+ normalizeECommerceCartItem,
3
+ normalizeECommerceOrder,
4
+ normalizeECommerceProduct,
5
+ normalizeECommerceReferrer,
6
+ normalizeECommerceScreen,
7
+ } from './utils';
8
+
1
9
  export type ECommerceScreen = {
2
10
  name: string;
3
11
  searchQuery?: string;
4
- payload?: Map<string, string>;
12
+ payload?: Map<string, string> | Record<string, string>;
5
13
  categoriesPath?: Array<string>;
6
14
  };
7
15
 
@@ -22,7 +30,7 @@ export type ECommerceProduct = {
22
30
  originalPrice?: ECommercePrice;
23
31
  promocodes?: Array<string>;
24
32
  categoriesPath?: Array<string>;
25
- payload?: Map<string, string>;
33
+ payload?: Map<string, string> | Record<string, string>;
26
34
  };
27
35
 
28
36
  export type ECommerceReferrer = {
@@ -41,7 +49,7 @@ export type ECommerceCartItem = {
41
49
  export type ECommerceOrder = {
42
50
  orderId: string;
43
51
  products: Array<ECommerceCartItem>;
44
- payload?: Map<string, string>;
52
+ payload?: Map<string, string> | Record<string, string>;
45
53
  };
46
54
 
47
55
  export type ECommerceEventType =
@@ -66,7 +74,7 @@ export class ECommerce {
66
74
  static showScreenEvent(screen: ECommerceScreen): ECommerceEvent {
67
75
  return {
68
76
  ecommerceEvent: 'showSceenEvent',
69
- ecommerceScreen: screen,
77
+ ecommerceScreen: normalizeECommerceScreen(screen),
70
78
  };
71
79
  }
72
80
 
@@ -76,8 +84,8 @@ export class ECommerce {
76
84
  ): ECommerceEvent {
77
85
  return {
78
86
  ecommerceEvent: 'showProductCardEvent',
79
- ecommerceScreen: screen,
80
- product: product,
87
+ ecommerceScreen: normalizeECommerceScreen(screen),
88
+ product: normalizeECommerceProduct(product),
81
89
  };
82
90
  }
83
91
 
@@ -87,36 +95,36 @@ export class ECommerce {
87
95
  ): ECommerceEvent {
88
96
  return {
89
97
  ecommerceEvent: 'showProductDetailsEvent',
90
- product: product,
91
- referrer: referrer,
98
+ product: normalizeECommerceProduct(product),
99
+ referrer: normalizeECommerceReferrer(referrer),
92
100
  };
93
101
  }
94
102
 
95
103
  static addCartItemEvent(item: ECommerceCartItem): ECommerceEvent {
96
104
  return {
97
105
  ecommerceEvent: 'addCartItemEvent',
98
- cartItem: item,
106
+ cartItem: normalizeECommerceCartItem(item),
99
107
  };
100
108
  }
101
109
 
102
110
  static removeCartItemEvent(item: ECommerceCartItem): ECommerceEvent {
103
111
  return {
104
112
  ecommerceEvent: 'removeCartItemEvent',
105
- cartItem: item,
113
+ cartItem: normalizeECommerceCartItem(item),
106
114
  };
107
115
  }
108
116
 
109
117
  static beginCheckoutEvent(order: ECommerceOrder): ECommerceEvent {
110
118
  return {
111
119
  ecommerceEvent: 'beginCheckoutEvent',
112
- order: order,
120
+ order: normalizeECommerceOrder(order),
113
121
  };
114
122
  }
115
123
 
116
124
  static purchaseEvent(order: ECommerceOrder): ECommerceEvent {
117
125
  return {
118
126
  ecommerceEvent: 'purchaseEvent',
119
- order: order,
127
+ order: normalizeECommerceOrder(order),
120
128
  };
121
129
  }
122
130
  }