@react-native-firebase/analytics 21.5.0 → 21.6.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +6 -0
- package/lib/index.js +1 -1
- package/lib/struct.js +46 -0
- package/lib/structs.js +163 -157
- package/lib/version.js +1 -1
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,12 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [21.6.0](https://github.com/invertase/react-native-firebase/compare/v21.5.0...v21.6.0) (2024-11-20)
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
- **analytics:** update superstruct dependency / forward-port to new API ([#8153](https://github.com/invertase/react-native-firebase/issues/8153)) ([6db1fb4](https://github.com/invertase/react-native-firebase/commit/6db1fb471e62e2c7e434719f2616c76349f345be))
|
11
|
+
|
6
12
|
## [21.5.0](https://github.com/invertase/react-native-firebase/compare/v21.4.1...v21.5.0) (2024-11-16)
|
7
13
|
|
8
14
|
**Note:** Version bump only for package @react-native-firebase/analytics
|
package/lib/index.js
CHANGED
@@ -26,7 +26,6 @@ import {
|
|
26
26
|
isString,
|
27
27
|
isUndefined,
|
28
28
|
} from '@react-native-firebase/app/lib/common';
|
29
|
-
import { validateStruct, validateCompound } from '@react-native-firebase/app/lib/common/struct';
|
30
29
|
|
31
30
|
import {
|
32
31
|
createModuleNamespace,
|
@@ -36,6 +35,7 @@ import {
|
|
36
35
|
import { setReactNativeModule } from '@react-native-firebase/app/lib/internal/nativeModule';
|
37
36
|
import { isBoolean } from '@react-native-firebase/app/lib/common';
|
38
37
|
|
38
|
+
import { validateStruct, validateCompound } from './struct';
|
39
39
|
import fallBackModule from './web/RNFBAnalyticsModule';
|
40
40
|
import version from './version';
|
41
41
|
import * as structs from './structs';
|
package/lib/struct.js
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this library except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
import { isUndefined } from '@react-native-firebase/app/lib/common/validate';
|
18
|
+
import { create } from 'superstruct';
|
19
|
+
|
20
|
+
export const validateStruct = (value = {}, struct, prefix = '') => {
|
21
|
+
try {
|
22
|
+
return create(value, struct);
|
23
|
+
} catch (e) {
|
24
|
+
const { path, message } = e;
|
25
|
+
|
26
|
+
const key = path[0];
|
27
|
+
|
28
|
+
if (message === undefined) {
|
29
|
+
throw new Error(`${prefix} unknown property '${key}'.`);
|
30
|
+
}
|
31
|
+
e.message = `${prefix} ${e.message}`;
|
32
|
+
|
33
|
+
throw e;
|
34
|
+
}
|
35
|
+
};
|
36
|
+
|
37
|
+
export const validateCompound = (source = {}, a, b, prefix = '') => {
|
38
|
+
if (
|
39
|
+
(isUndefined(source[a]) && !isUndefined(source[b])) ||
|
40
|
+
(!isUndefined(source[a]) && isUndefined(source[b]))
|
41
|
+
) {
|
42
|
+
throw new Error(
|
43
|
+
`${prefix} if you supply the '${a}' parameter, you must also supply the '${b}' parameter.`,
|
44
|
+
);
|
45
|
+
}
|
46
|
+
};
|
package/lib/structs.js
CHANGED
@@ -13,226 +13,232 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import struct from '@react-native-firebase/app/lib/common/struct';
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
17
|
+
import { object, string, number, array, optional, define, type } from 'superstruct';
|
18
|
+
|
19
|
+
const ShortDate = define(
|
20
|
+
'ShortDate',
|
21
|
+
value => typeof value === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(value),
|
22
|
+
);
|
23
|
+
|
24
|
+
const Item = type({
|
25
|
+
item_brand: optional(string()),
|
26
|
+
item_id: optional(string()),
|
27
|
+
item_name: optional(string()),
|
28
|
+
item_category: optional(string()),
|
29
|
+
item_category2: optional(string()),
|
30
|
+
item_category3: optional(string()),
|
31
|
+
item_category4: optional(string()),
|
32
|
+
item_category5: optional(string()),
|
33
|
+
item_list_id: optional(string()),
|
34
|
+
item_list_name: optional(string()),
|
35
|
+
item_location_id: optional(string()),
|
36
|
+
item_variant: optional(string()),
|
37
|
+
quantity: optional(number()),
|
38
|
+
price: optional(number()),
|
33
39
|
});
|
34
40
|
|
35
|
-
export const ScreenView =
|
36
|
-
screen_class:
|
37
|
-
screen_name:
|
41
|
+
export const ScreenView = type({
|
42
|
+
screen_class: optional(string()),
|
43
|
+
screen_name: optional(string()),
|
38
44
|
});
|
39
45
|
|
40
|
-
export const AddPaymentInfo =
|
41
|
-
items:
|
42
|
-
value:
|
43
|
-
currency:
|
44
|
-
coupon:
|
45
|
-
payment_type:
|
46
|
+
export const AddPaymentInfo = object({
|
47
|
+
items: optional(array(Item)),
|
48
|
+
value: optional(number()),
|
49
|
+
currency: optional(string()),
|
50
|
+
coupon: optional(string()),
|
51
|
+
payment_type: optional(string()),
|
46
52
|
});
|
47
53
|
|
48
|
-
export const AddShippingInfo =
|
49
|
-
items:
|
50
|
-
value:
|
51
|
-
currency:
|
52
|
-
coupon:
|
53
|
-
shipping_tier:
|
54
|
+
export const AddShippingInfo = object({
|
55
|
+
items: optional(array(Item)),
|
56
|
+
value: optional(number()),
|
57
|
+
currency: optional(string()),
|
58
|
+
coupon: optional(string()),
|
59
|
+
shipping_tier: optional(string()),
|
54
60
|
});
|
55
61
|
|
56
|
-
export const AddToCart =
|
57
|
-
items:
|
58
|
-
value:
|
59
|
-
currency:
|
62
|
+
export const AddToCart = object({
|
63
|
+
items: optional(array(Item)),
|
64
|
+
value: optional(number()),
|
65
|
+
currency: optional(string()),
|
60
66
|
});
|
61
67
|
|
62
|
-
export const AddToWishlist =
|
63
|
-
items:
|
64
|
-
value:
|
65
|
-
currency:
|
68
|
+
export const AddToWishlist = object({
|
69
|
+
items: optional(array(Item)),
|
70
|
+
value: optional(number()),
|
71
|
+
currency: optional(string()),
|
66
72
|
});
|
67
73
|
|
68
|
-
export const BeginCheckout =
|
69
|
-
items:
|
70
|
-
value:
|
71
|
-
currency:
|
72
|
-
coupon:
|
74
|
+
export const BeginCheckout = type({
|
75
|
+
items: optional(array(Item)),
|
76
|
+
value: optional(number()),
|
77
|
+
currency: optional(string()),
|
78
|
+
coupon: optional(string()),
|
73
79
|
});
|
74
80
|
|
75
|
-
export const CampaignDetails =
|
76
|
-
source:
|
77
|
-
medium:
|
78
|
-
campaign:
|
79
|
-
term:
|
80
|
-
content:
|
81
|
-
aclid:
|
82
|
-
cp1:
|
81
|
+
export const CampaignDetails = object({
|
82
|
+
source: string(),
|
83
|
+
medium: string(),
|
84
|
+
campaign: string(),
|
85
|
+
term: optional(string()),
|
86
|
+
content: optional(string()),
|
87
|
+
aclid: optional(string()),
|
88
|
+
cp1: optional(string()),
|
83
89
|
});
|
84
90
|
|
85
|
-
export const EarnVirtualCurrency =
|
86
|
-
virtual_currency_name:
|
87
|
-
value:
|
91
|
+
export const EarnVirtualCurrency = object({
|
92
|
+
virtual_currency_name: string(),
|
93
|
+
value: number(),
|
88
94
|
});
|
89
95
|
|
90
|
-
export const GenerateLead =
|
91
|
-
currency:
|
92
|
-
value:
|
96
|
+
export const GenerateLead = object({
|
97
|
+
currency: optional(string()),
|
98
|
+
value: optional(number()),
|
93
99
|
});
|
94
100
|
|
95
|
-
export const JoinGroup =
|
96
|
-
group_id:
|
101
|
+
export const JoinGroup = object({
|
102
|
+
group_id: string(),
|
97
103
|
});
|
98
104
|
|
99
|
-
export const LevelEnd =
|
100
|
-
level:
|
101
|
-
success:
|
105
|
+
export const LevelEnd = object({
|
106
|
+
level: number(),
|
107
|
+
success: optional(string()),
|
102
108
|
});
|
103
109
|
|
104
|
-
export const LevelStart =
|
105
|
-
level:
|
110
|
+
export const LevelStart = object({
|
111
|
+
level: number(),
|
106
112
|
});
|
107
113
|
|
108
|
-
export const LevelUp =
|
109
|
-
level:
|
110
|
-
character:
|
114
|
+
export const LevelUp = object({
|
115
|
+
level: number(),
|
116
|
+
character: optional(string()),
|
111
117
|
});
|
112
118
|
|
113
|
-
export const Login =
|
114
|
-
method:
|
119
|
+
export const Login = object({
|
120
|
+
method: string(),
|
115
121
|
});
|
116
122
|
|
117
|
-
export const PostScore =
|
118
|
-
score:
|
119
|
-
level:
|
120
|
-
character:
|
123
|
+
export const PostScore = object({
|
124
|
+
score: number(),
|
125
|
+
level: optional(number()),
|
126
|
+
character: optional(string()),
|
121
127
|
});
|
122
128
|
|
123
|
-
export const Refund =
|
124
|
-
affiliation:
|
125
|
-
coupon:
|
126
|
-
currency:
|
127
|
-
items:
|
128
|
-
shipping:
|
129
|
-
tax:
|
130
|
-
value:
|
131
|
-
transaction_id:
|
129
|
+
export const Refund = object({
|
130
|
+
affiliation: optional(string()),
|
131
|
+
coupon: optional(string()),
|
132
|
+
currency: optional(string()),
|
133
|
+
items: optional(array(Item)),
|
134
|
+
shipping: optional(number()),
|
135
|
+
tax: optional(number()),
|
136
|
+
value: optional(number()),
|
137
|
+
transaction_id: optional(string()),
|
132
138
|
});
|
133
139
|
|
134
|
-
export const Purchase =
|
135
|
-
affiliation:
|
136
|
-
coupon:
|
137
|
-
currency:
|
138
|
-
items:
|
139
|
-
shipping:
|
140
|
-
tax:
|
141
|
-
value:
|
142
|
-
transaction_id:
|
140
|
+
export const Purchase = type({
|
141
|
+
affiliation: optional(string()),
|
142
|
+
coupon: optional(string()),
|
143
|
+
currency: optional(string()),
|
144
|
+
items: optional(array(Item)),
|
145
|
+
shipping: optional(number()),
|
146
|
+
tax: optional(number()),
|
147
|
+
value: optional(number()),
|
148
|
+
transaction_id: optional(string()),
|
143
149
|
});
|
144
150
|
|
145
|
-
export const RemoveFromCart =
|
146
|
-
currency:
|
147
|
-
items:
|
148
|
-
value:
|
151
|
+
export const RemoveFromCart = object({
|
152
|
+
currency: optional(string()),
|
153
|
+
items: optional(array(Item)),
|
154
|
+
value: optional(number()),
|
149
155
|
});
|
150
156
|
|
151
|
-
export const Search =
|
152
|
-
search_term:
|
153
|
-
number_of_nights:
|
154
|
-
number_of_rooms:
|
155
|
-
number_of_passengers:
|
156
|
-
origin:
|
157
|
-
destination:
|
158
|
-
start_date:
|
159
|
-
end_date:
|
160
|
-
travel_class:
|
157
|
+
export const Search = object({
|
158
|
+
search_term: string(),
|
159
|
+
number_of_nights: optional(number()),
|
160
|
+
number_of_rooms: optional(number()),
|
161
|
+
number_of_passengers: optional(number()),
|
162
|
+
origin: optional(string()),
|
163
|
+
destination: optional(string()),
|
164
|
+
start_date: optional(ShortDate),
|
165
|
+
end_date: optional(ShortDate),
|
166
|
+
travel_class: optional(string()),
|
161
167
|
});
|
162
168
|
|
163
|
-
export const SelectContent =
|
164
|
-
content_type:
|
165
|
-
item_id:
|
169
|
+
export const SelectContent = object({
|
170
|
+
content_type: string(),
|
171
|
+
item_id: string(),
|
166
172
|
});
|
167
173
|
|
168
|
-
export const SelectItem =
|
169
|
-
items:
|
170
|
-
item_list_id:
|
171
|
-
item_list_name:
|
172
|
-
content_type:
|
174
|
+
export const SelectItem = object({
|
175
|
+
items: optional(array(Item)),
|
176
|
+
item_list_id: optional(string()),
|
177
|
+
item_list_name: optional(string()),
|
178
|
+
content_type: optional(string()),
|
173
179
|
});
|
174
180
|
|
175
|
-
export const SelectPromotion =
|
176
|
-
creative_name:
|
177
|
-
creative_slot:
|
178
|
-
items:
|
179
|
-
location_id:
|
180
|
-
promotion_id:
|
181
|
-
promotion_name:
|
181
|
+
export const SelectPromotion = object({
|
182
|
+
creative_name: string(),
|
183
|
+
creative_slot: string(),
|
184
|
+
items: optional(array(Item)),
|
185
|
+
location_id: string(),
|
186
|
+
promotion_id: string(),
|
187
|
+
promotion_name: string(),
|
182
188
|
});
|
183
189
|
|
184
|
-
export const SetCheckoutOption =
|
185
|
-
checkout_step:
|
186
|
-
checkout_option:
|
190
|
+
export const SetCheckoutOption = object({
|
191
|
+
checkout_step: number(),
|
192
|
+
checkout_option: string(),
|
187
193
|
});
|
188
194
|
|
189
|
-
export const Share =
|
190
|
-
content_type:
|
191
|
-
item_id:
|
192
|
-
method:
|
195
|
+
export const Share = object({
|
196
|
+
content_type: string(),
|
197
|
+
item_id: string(),
|
198
|
+
method: string(),
|
193
199
|
});
|
194
200
|
|
195
|
-
export const SignUp =
|
196
|
-
method:
|
201
|
+
export const SignUp = object({
|
202
|
+
method: string(),
|
197
203
|
});
|
198
204
|
|
199
|
-
export const SpendVirtualCurrency =
|
200
|
-
item_name:
|
201
|
-
virtual_currency_name:
|
202
|
-
value:
|
205
|
+
export const SpendVirtualCurrency = object({
|
206
|
+
item_name: string(),
|
207
|
+
virtual_currency_name: string(),
|
208
|
+
value: number(),
|
203
209
|
});
|
204
210
|
|
205
|
-
export const UnlockAchievement =
|
206
|
-
achievement_id:
|
211
|
+
export const UnlockAchievement = object({
|
212
|
+
achievement_id: string(),
|
207
213
|
});
|
208
214
|
|
209
|
-
export const ViewCart =
|
210
|
-
currency:
|
211
|
-
items:
|
212
|
-
value:
|
215
|
+
export const ViewCart = object({
|
216
|
+
currency: optional(string()),
|
217
|
+
items: optional(array(Item)),
|
218
|
+
value: optional(number()),
|
213
219
|
});
|
214
220
|
|
215
|
-
export const ViewItem =
|
216
|
-
currency:
|
217
|
-
items:
|
218
|
-
value:
|
221
|
+
export const ViewItem = object({
|
222
|
+
currency: optional(string()),
|
223
|
+
items: optional(array(Item)),
|
224
|
+
value: optional(number()),
|
219
225
|
});
|
220
226
|
|
221
|
-
export const ViewItemList =
|
222
|
-
items:
|
223
|
-
item_list_id:
|
224
|
-
item_list_name:
|
227
|
+
export const ViewItemList = object({
|
228
|
+
items: optional(array(Item)),
|
229
|
+
item_list_id: optional(string()),
|
230
|
+
item_list_name: optional(string()),
|
225
231
|
});
|
226
232
|
|
227
|
-
export const ViewPromotion =
|
228
|
-
items:
|
229
|
-
location_id:
|
230
|
-
creative_name:
|
231
|
-
creative_slot:
|
232
|
-
promotion_id:
|
233
|
-
promotion_name:
|
233
|
+
export const ViewPromotion = object({
|
234
|
+
items: optional(array(Item)),
|
235
|
+
location_id: optional(string()),
|
236
|
+
creative_name: optional(string()),
|
237
|
+
creative_slot: optional(string()),
|
238
|
+
promotion_id: optional(string()),
|
239
|
+
promotion_name: optional(string()),
|
234
240
|
});
|
235
241
|
|
236
|
-
export const ViewSearchResults =
|
237
|
-
search_term:
|
242
|
+
export const ViewSearchResults = object({
|
243
|
+
search_term: string(),
|
238
244
|
});
|
package/lib/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
// Generated by genversion.
|
2
|
-
module.exports = '21.
|
2
|
+
module.exports = '21.6.0';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-native-firebase/analytics",
|
3
|
-
"version": "21.
|
3
|
+
"version": "21.6.0",
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
5
5
|
"description": "React Native Firebase - The analytics module provides out of the box support with Google Analytics for Firebase. Integration with the Android & iOS allows for in-depth analytical insight reporting, such as device information, location, user actions and more.",
|
6
6
|
"main": "lib/index.js",
|
@@ -22,10 +22,13 @@
|
|
22
22
|
"analytics"
|
23
23
|
],
|
24
24
|
"peerDependencies": {
|
25
|
-
"@react-native-firebase/app": "21.
|
25
|
+
"@react-native-firebase/app": "21.6.0"
|
26
26
|
},
|
27
27
|
"publishConfig": {
|
28
28
|
"access": "public"
|
29
29
|
},
|
30
|
-
"
|
30
|
+
"dependencies": {
|
31
|
+
"superstruct": "^2.0.2"
|
32
|
+
},
|
33
|
+
"gitHead": "0103e12714de3c106128859eeadaf0fe07f9674c"
|
31
34
|
}
|