@mparticle/web-sdk 2.32.2 → 2.32.4

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/src/types.js DELETED
@@ -1,338 +0,0 @@
1
- import { getIdentityName } from './type-utils';
2
-
3
- var MessageType = {
4
- SessionStart: 1,
5
- SessionEnd: 2,
6
- PageView: 3,
7
- PageEvent: 4,
8
- CrashReport: 5,
9
- OptOut: 6,
10
- AppStateTransition: 10,
11
- Profile: 14,
12
- Commerce: 16,
13
- Media: 20,
14
- UserAttributeChange: 17,
15
- UserIdentityChange: 18,
16
- };
17
-
18
- // Dictionary that contains MessageTypes that will
19
- // trigger an immediate upload.
20
- var TriggerUploadType = {
21
- [MessageType.Commerce]: 1,
22
- [MessageType.UserIdentityChange]: 1,
23
- };
24
-
25
- var EventType = {
26
- Unknown: 0,
27
- Navigation: 1,
28
- Location: 2,
29
- Search: 3,
30
- Transaction: 4,
31
- UserContent: 5,
32
- UserPreference: 6,
33
- Social: 7,
34
- Other: 8,
35
- Media: 9,
36
- getName: function(id) {
37
- switch (id) {
38
- case EventType.Unknown:
39
- return 'Unknown';
40
- case EventType.Navigation:
41
- return 'Navigation';
42
- case EventType.Location:
43
- return 'Location';
44
- case EventType.Search:
45
- return 'Search';
46
- case EventType.Transaction:
47
- return 'Transaction';
48
- case EventType.UserContent:
49
- return 'User Content';
50
- case EventType.UserPreference:
51
- return 'User Preference';
52
- case EventType.Social:
53
- return 'Social';
54
- case CommerceEventType.ProductAddToCart:
55
- return 'Product Added to Cart';
56
- case CommerceEventType.ProductAddToWishlist:
57
- return 'Product Added to Wishlist';
58
- case CommerceEventType.ProductCheckout:
59
- return 'Product Checkout';
60
- case CommerceEventType.ProductCheckoutOption:
61
- return 'Product Checkout Options';
62
- case CommerceEventType.ProductClick:
63
- return 'Product Click';
64
- case CommerceEventType.ProductImpression:
65
- return 'Product Impression';
66
- case CommerceEventType.ProductPurchase:
67
- return 'Product Purchased';
68
- case CommerceEventType.ProductRefund:
69
- return 'Product Refunded';
70
- case CommerceEventType.ProductRemoveFromCart:
71
- return 'Product Removed From Cart';
72
- case CommerceEventType.ProductRemoveFromWishlist:
73
- return 'Product Removed from Wishlist';
74
- case CommerceEventType.ProductViewDetail:
75
- return 'Product View Details';
76
- case CommerceEventType.PromotionClick:
77
- return 'Promotion Click';
78
- case CommerceEventType.PromotionView:
79
- return 'Promotion View';
80
- default:
81
- return 'Other';
82
- }
83
- },
84
- };
85
-
86
- // Continuation of enum above, but in seperate object since we don't expose these to end user
87
- var CommerceEventType = {
88
- ProductAddToCart: 10,
89
- ProductRemoveFromCart: 11,
90
- ProductCheckout: 12,
91
- ProductCheckoutOption: 13,
92
- ProductClick: 14,
93
- ProductViewDetail: 15,
94
- ProductPurchase: 16,
95
- ProductRefund: 17,
96
- PromotionView: 18,
97
- PromotionClick: 19,
98
- ProductAddToWishlist: 20,
99
- ProductRemoveFromWishlist: 21,
100
- ProductImpression: 22,
101
- };
102
-
103
- var IdentityType = {
104
- Other: 0,
105
- CustomerId: 1,
106
- Facebook: 2,
107
- Twitter: 3,
108
- Google: 4,
109
- Microsoft: 5,
110
- Yahoo: 6,
111
- Email: 7,
112
- FacebookCustomAudienceId: 9,
113
- Other2: 10,
114
- Other3: 11,
115
- Other4: 12,
116
- Other5: 13,
117
- Other6: 14,
118
- Other7: 15,
119
- Other8: 16,
120
- Other9: 17,
121
- Other10: 18,
122
- MobileNumber: 19,
123
- PhoneNumber2: 20,
124
- PhoneNumber3: 21,
125
- };
126
-
127
- IdentityType.isValid = function(identityType) {
128
- if (typeof identityType === 'number') {
129
- for (var prop in IdentityType) {
130
- if (IdentityType.hasOwnProperty(prop)) {
131
- if (IdentityType[prop] === identityType) {
132
- return true;
133
- }
134
- }
135
- }
136
- }
137
-
138
- return false;
139
- };
140
-
141
- IdentityType.getName = function(identityType) {
142
- switch (identityType) {
143
- case window.mParticle.IdentityType.CustomerId:
144
- return 'Customer ID';
145
- case window.mParticle.IdentityType.Facebook:
146
- return 'Facebook ID';
147
- case window.mParticle.IdentityType.Twitter:
148
- return 'Twitter ID';
149
- case window.mParticle.IdentityType.Google:
150
- return 'Google ID';
151
- case window.mParticle.IdentityType.Microsoft:
152
- return 'Microsoft ID';
153
- case window.mParticle.IdentityType.Yahoo:
154
- return 'Yahoo ID';
155
- case window.mParticle.IdentityType.Email:
156
- return 'Email';
157
- case window.mParticle.IdentityType.FacebookCustomAudienceId:
158
- return 'Facebook App User ID';
159
- default:
160
- return 'Other ID';
161
- }
162
- };
163
-
164
- IdentityType.getIdentityType = function(identityName) {
165
- switch (identityName) {
166
- case 'other':
167
- return IdentityType.Other;
168
- case 'customerid':
169
- return IdentityType.CustomerId;
170
- case 'facebook':
171
- return IdentityType.Facebook;
172
- case 'twitter':
173
- return IdentityType.Twitter;
174
- case 'google':
175
- return IdentityType.Google;
176
- case 'microsoft':
177
- return IdentityType.Microsoft;
178
- case 'yahoo':
179
- return IdentityType.Yahoo;
180
- case 'email':
181
- return IdentityType.Email;
182
- case 'facebookcustomaudienceid':
183
- return IdentityType.FacebookCustomAudienceId;
184
- case 'other2':
185
- return IdentityType.Other2;
186
- case 'other3':
187
- return IdentityType.Other3;
188
- case 'other4':
189
- return IdentityType.Other4;
190
- case 'other5':
191
- return IdentityType.Other5;
192
- case 'other6':
193
- return IdentityType.Other6;
194
- case 'other7':
195
- return IdentityType.Other7;
196
- case 'other8':
197
- return IdentityType.Other8;
198
- case 'other9':
199
- return IdentityType.Other9;
200
- case 'other10':
201
- return IdentityType.Other10;
202
- case 'mobile_number':
203
- return IdentityType.MobileNumber;
204
- case 'phone_number_2':
205
- return IdentityType.PhoneNumber2;
206
- case 'phone_number_3':
207
- return IdentityType.PhoneNumber3;
208
- default:
209
- return false;
210
- }
211
- };
212
-
213
- IdentityType.getIdentityName = function(identityType) {
214
- return getIdentityName(identityType);
215
- };
216
-
217
- var ProductActionType = {
218
- Unknown: 0,
219
- AddToCart: 1,
220
- RemoveFromCart: 2,
221
- Checkout: 3,
222
- CheckoutOption: 4,
223
- Click: 5,
224
- ViewDetail: 6,
225
- Purchase: 7,
226
- Refund: 8,
227
- AddToWishlist: 9,
228
- RemoveFromWishlist: 10,
229
- };
230
-
231
- ProductActionType.getName = function(id) {
232
- switch (id) {
233
- case ProductActionType.AddToCart:
234
- return 'Add to Cart';
235
- case ProductActionType.RemoveFromCart:
236
- return 'Remove from Cart';
237
- case ProductActionType.Checkout:
238
- return 'Checkout';
239
- case ProductActionType.CheckoutOption:
240
- return 'Checkout Option';
241
- case ProductActionType.Click:
242
- return 'Click';
243
- case ProductActionType.ViewDetail:
244
- return 'View Detail';
245
- case ProductActionType.Purchase:
246
- return 'Purchase';
247
- case ProductActionType.Refund:
248
- return 'Refund';
249
- case ProductActionType.AddToWishlist:
250
- return 'Add to Wishlist';
251
- case ProductActionType.RemoveFromWishlist:
252
- return 'Remove from Wishlist';
253
- default:
254
- return 'Unknown';
255
- }
256
- };
257
-
258
- // these are the action names used by server and mobile SDKs when expanding a CommerceEvent
259
- ProductActionType.getExpansionName = function(id) {
260
- switch (id) {
261
- case ProductActionType.AddToCart:
262
- return 'add_to_cart';
263
- case ProductActionType.RemoveFromCart:
264
- return 'remove_from_cart';
265
- case ProductActionType.Checkout:
266
- return 'checkout';
267
- case ProductActionType.CheckoutOption:
268
- return 'checkout_option';
269
- case ProductActionType.Click:
270
- return 'click';
271
- case ProductActionType.ViewDetail:
272
- return 'view_detail';
273
- case ProductActionType.Purchase:
274
- return 'purchase';
275
- case ProductActionType.Refund:
276
- return 'refund';
277
- case ProductActionType.AddToWishlist:
278
- return 'add_to_wishlist';
279
- case ProductActionType.RemoveFromWishlist:
280
- return 'remove_from_wishlist';
281
- default:
282
- return 'unknown';
283
- }
284
- };
285
-
286
- var PromotionActionType = {
287
- Unknown: 0,
288
- PromotionView: 1,
289
- PromotionClick: 2,
290
- };
291
-
292
- PromotionActionType.getName = function(id) {
293
- switch (id) {
294
- case PromotionActionType.PromotionView:
295
- return 'view';
296
- case PromotionActionType.PromotionClick:
297
- return 'click';
298
- default:
299
- return 'unknown';
300
- }
301
- };
302
-
303
- // these are the names that the server and mobile SDKs use while expanding CommerceEvent
304
- PromotionActionType.getExpansionName = function(id) {
305
- switch (id) {
306
- case PromotionActionType.PromotionView:
307
- return 'view';
308
- case PromotionActionType.PromotionClick:
309
- return 'click';
310
- default:
311
- return 'unknown';
312
- }
313
- };
314
-
315
- var ProfileMessageType = {
316
- Logout: 3,
317
- };
318
- var ApplicationTransitionType = {
319
- AppInit: 1,
320
- };
321
-
322
- const Environment = {
323
- Production: 'production',
324
- Development: 'development',
325
- };
326
-
327
- export default {
328
- MessageType: MessageType,
329
- EventType: EventType,
330
- CommerceEventType: CommerceEventType,
331
- IdentityType: IdentityType,
332
- ProfileMessageType: ProfileMessageType,
333
- ApplicationTransitionType: ApplicationTransitionType,
334
- ProductActionType: ProductActionType,
335
- PromotionActionType: PromotionActionType,
336
- TriggerUploadType: TriggerUploadType,
337
- Environment,
338
- };