@mparticle/web-sdk 2.32.1 → 2.32.3
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/dist/mparticle.common.js +62 -93
- package/dist/mparticle.esm.js +62 -93
- package/dist/mparticle.js +627 -665
- package/package.json +1 -1
- package/src/apiClient.ts +4 -1
- package/src/audienceManager.ts +2 -2
- package/src/batchUploader.ts +28 -22
- package/src/configAPIClient.ts +2 -2
- package/src/constants.ts +8 -0
- package/src/ecommerce.interfaces.ts +201 -0
- package/src/ecommerce.js +9 -0
- package/src/events.interfaces.ts +83 -0
- package/src/events.js +3 -0
- package/src/forwarders.interfaces.ts +0 -3
- package/src/identity-user-interfaces.ts +9 -9
- package/src/identity.js +2 -3
- package/src/identityApiClient.ts +351 -0
- package/src/integrationCapture.ts +7 -5
- package/src/kitFilterHelper.ts +6 -7
- package/src/mp-instance.js +3 -3
- package/src/sdkRuntimeModels.ts +34 -17
- package/src/sdkToEventsApiConverter.ts +1 -1
- package/src/serverModel.ts +1 -1
- package/src/sideloadedKit.ts +12 -11
- package/src/types.ts +404 -0
- package/src/uploaders.ts +4 -4
- package/src/utils.ts +1 -1
- package/src/aliasRequestApiClient.ts +0 -90
- package/src/identityApiClient.interfaces.ts +0 -44
- package/src/identityApiClient.js +0 -131
- package/src/type-utils.ts +0 -66
- package/src/types.interfaces.ts +0 -56
- package/src/types.js +0 -338
package/src/identityApiClient.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import Constants from './constants';
|
|
2
|
-
import { sendAliasRequest } from './aliasRequestApiClient';
|
|
3
|
-
import { FetchUploader, XHRUploader } from './uploaders';
|
|
4
|
-
import { CACHE_HEADER } from './identity-utils';
|
|
5
|
-
import { parseNumber } from './utils';
|
|
6
|
-
|
|
7
|
-
var HTTPCodes = Constants.HTTPCodes,
|
|
8
|
-
Messages = Constants.Messages;
|
|
9
|
-
|
|
10
|
-
const { Modify } = Constants.IdentityMethods;
|
|
11
|
-
|
|
12
|
-
export default function IdentityAPIClient(mpInstance) {
|
|
13
|
-
this.sendAliasRequest = async function(aliasRequest, callback) {
|
|
14
|
-
await sendAliasRequest(mpInstance, aliasRequest, callback);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
this.sendIdentityRequest = async function(
|
|
18
|
-
identityApiRequest,
|
|
19
|
-
method,
|
|
20
|
-
callback,
|
|
21
|
-
originalIdentityApiData,
|
|
22
|
-
parseIdentityResponse,
|
|
23
|
-
mpid,
|
|
24
|
-
knownIdentities
|
|
25
|
-
) {
|
|
26
|
-
const { verbose, error } = mpInstance.Logger;
|
|
27
|
-
const { invokeCallback } = mpInstance._Helpers;
|
|
28
|
-
|
|
29
|
-
verbose(Messages.InformationMessages.SendIdentityBegin);
|
|
30
|
-
if (!identityApiRequest) {
|
|
31
|
-
error(Messages.ErrorMessages.APIRequestEmpty);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
verbose(Messages.InformationMessages.SendIdentityHttp);
|
|
35
|
-
|
|
36
|
-
if (mpInstance._Store.identityCallInFlight) {
|
|
37
|
-
invokeCallback(
|
|
38
|
-
callback,
|
|
39
|
-
HTTPCodes.activeIdentityRequest,
|
|
40
|
-
'There is currently an Identity request processing. Please wait for this to return before requesting again'
|
|
41
|
-
);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const previousMPID = mpid || null;
|
|
46
|
-
const uploadUrl = this.getUploadUrl(method, mpid);
|
|
47
|
-
|
|
48
|
-
const uploader = window.fetch
|
|
49
|
-
? new FetchUploader(uploadUrl)
|
|
50
|
-
: new XHRUploader(uploadUrl);
|
|
51
|
-
|
|
52
|
-
const fetchPayload = {
|
|
53
|
-
method: 'post',
|
|
54
|
-
headers: {
|
|
55
|
-
Accept: 'text/plain;charset=UTF-8',
|
|
56
|
-
'Content-Type': 'application/json',
|
|
57
|
-
'x-mp-key': mpInstance._Store.devToken,
|
|
58
|
-
},
|
|
59
|
-
body: JSON.stringify(identityApiRequest),
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
try {
|
|
63
|
-
mpInstance._Store.identityCallInFlight = true;
|
|
64
|
-
const response = await uploader.upload(fetchPayload);
|
|
65
|
-
|
|
66
|
-
let identityResponse;
|
|
67
|
-
|
|
68
|
-
if (response.json) {
|
|
69
|
-
// https://go.mparticle.com/work/SQDSDKS-6568
|
|
70
|
-
// FetchUploader returns the response as a JSON object that we have to await
|
|
71
|
-
const responseBody = await response.json();
|
|
72
|
-
identityResponse = this.getIdentityResponseFromFetch(
|
|
73
|
-
response,
|
|
74
|
-
responseBody
|
|
75
|
-
);
|
|
76
|
-
} else {
|
|
77
|
-
identityResponse = this.getIdentityResponseFromXHR(response);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
verbose(
|
|
81
|
-
'Received Identity Response from server: ' +
|
|
82
|
-
JSON.stringify(identityResponse.responseText)
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
parseIdentityResponse(
|
|
86
|
-
identityResponse,
|
|
87
|
-
previousMPID,
|
|
88
|
-
callback,
|
|
89
|
-
originalIdentityApiData,
|
|
90
|
-
method,
|
|
91
|
-
knownIdentities,
|
|
92
|
-
false
|
|
93
|
-
);
|
|
94
|
-
} catch (err) {
|
|
95
|
-
mpInstance._Store.identityCallInFlight = false;
|
|
96
|
-
invokeCallback(callback, HTTPCodes.noHttpCoverage, err);
|
|
97
|
-
error('Error sending identity request to servers' + ' - ' + err);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
this.getUploadUrl = (method, mpid) => {
|
|
102
|
-
const uploadServiceUrl = mpInstance._Helpers.createServiceUrl(
|
|
103
|
-
mpInstance._Store.SDKConfig.identityUrl
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
const uploadUrl =
|
|
107
|
-
method === Modify
|
|
108
|
-
? uploadServiceUrl + mpid + '/' + method
|
|
109
|
-
: uploadServiceUrl + method;
|
|
110
|
-
|
|
111
|
-
return uploadUrl;
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
this.getIdentityResponseFromFetch = (response, responseBody) => ({
|
|
115
|
-
status: response.status,
|
|
116
|
-
responseText: responseBody,
|
|
117
|
-
cacheMaxAge: parseInt(response.headers.get(CACHE_HEADER)) || 0,
|
|
118
|
-
expireTimestamp: 0,
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
this.getIdentityResponseFromXHR = response => ({
|
|
122
|
-
status: response.status,
|
|
123
|
-
responseText: response.responseText
|
|
124
|
-
? JSON.parse(response.responseText)
|
|
125
|
-
: {},
|
|
126
|
-
cacheMaxAge: parseNumber(
|
|
127
|
-
response.getResponseHeader(CACHE_HEADER) || ''
|
|
128
|
-
),
|
|
129
|
-
expireTimestamp: 0,
|
|
130
|
-
});
|
|
131
|
-
}
|
package/src/type-utils.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { IdentityType } from './types.interfaces';
|
|
2
|
-
import { parseNumber } from './utils';
|
|
3
|
-
|
|
4
|
-
export interface IIdentitiesByType {
|
|
5
|
-
[key: number]: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function getNewIdentitiesByName(newIdentitiesByType: IIdentitiesByType) {
|
|
9
|
-
const newIdentitiesByName = {};
|
|
10
|
-
|
|
11
|
-
for (var key in newIdentitiesByType) {
|
|
12
|
-
const identityNameKey = getIdentityName(parseNumber(key));
|
|
13
|
-
newIdentitiesByName[identityNameKey] = newIdentitiesByType[key];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return newIdentitiesByName;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function getIdentityName(identityType: IdentityType): string | null {
|
|
20
|
-
switch (identityType) {
|
|
21
|
-
case IdentityType.Other:
|
|
22
|
-
return 'other';
|
|
23
|
-
case IdentityType.CustomerId:
|
|
24
|
-
return 'customerid';
|
|
25
|
-
case IdentityType.Facebook:
|
|
26
|
-
return 'facebook';
|
|
27
|
-
case IdentityType.Twitter:
|
|
28
|
-
return 'twitter';
|
|
29
|
-
case IdentityType.Google:
|
|
30
|
-
return 'google';
|
|
31
|
-
case IdentityType.Microsoft:
|
|
32
|
-
return 'microsoft';
|
|
33
|
-
case IdentityType.Yahoo:
|
|
34
|
-
return 'yahoo';
|
|
35
|
-
case IdentityType.Email:
|
|
36
|
-
return 'email';
|
|
37
|
-
case IdentityType.FacebookCustomAudienceId:
|
|
38
|
-
return 'facebookcustomaudienceid';
|
|
39
|
-
case IdentityType.Other2:
|
|
40
|
-
return 'other2';
|
|
41
|
-
case IdentityType.Other3:
|
|
42
|
-
return 'other3';
|
|
43
|
-
case IdentityType.Other4:
|
|
44
|
-
return 'other4';
|
|
45
|
-
case IdentityType.Other5:
|
|
46
|
-
return 'other5';
|
|
47
|
-
case IdentityType.Other6:
|
|
48
|
-
return 'other6';
|
|
49
|
-
case IdentityType.Other7:
|
|
50
|
-
return 'other7';
|
|
51
|
-
case IdentityType.Other8:
|
|
52
|
-
return 'other8';
|
|
53
|
-
case IdentityType.Other9:
|
|
54
|
-
return 'other9';
|
|
55
|
-
case IdentityType.Other10:
|
|
56
|
-
return 'other10';
|
|
57
|
-
case IdentityType.MobileNumber:
|
|
58
|
-
return 'mobile_number';
|
|
59
|
-
case IdentityType.PhoneNumber2:
|
|
60
|
-
return 'phone_number_2';
|
|
61
|
-
case IdentityType.PhoneNumber3:
|
|
62
|
-
return 'phone_number_3';
|
|
63
|
-
default:
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
}
|
package/src/types.interfaces.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
export enum EventTypeEnum {
|
|
2
|
-
Unknown,
|
|
3
|
-
Navigation,
|
|
4
|
-
Location,
|
|
5
|
-
Search,
|
|
6
|
-
Transaction,
|
|
7
|
-
UserContent,
|
|
8
|
-
UserPreference,
|
|
9
|
-
Social,
|
|
10
|
-
Other,
|
|
11
|
-
Media,
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// TODO: https://mparticle-eng.atlassian.net/browse/SQDSDKS-5403
|
|
15
|
-
export enum MessageType {
|
|
16
|
-
SessionStart = 1,
|
|
17
|
-
SessionEnd = 2,
|
|
18
|
-
PageView = 3,
|
|
19
|
-
PageEvent = 4,
|
|
20
|
-
CrashReport = 5,
|
|
21
|
-
OptOut = 6,
|
|
22
|
-
AppStateTransition = 10,
|
|
23
|
-
Profile = 14,
|
|
24
|
-
Commerce = 16,
|
|
25
|
-
UserAttributeChange = 17,
|
|
26
|
-
UserIdentityChange = 18,
|
|
27
|
-
Media = 20,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export enum IdentityType {
|
|
31
|
-
Other = 0,
|
|
32
|
-
CustomerId = 1,
|
|
33
|
-
Facebook = 2,
|
|
34
|
-
Twitter = 3,
|
|
35
|
-
Google = 4,
|
|
36
|
-
Microsoft = 5,
|
|
37
|
-
Yahoo = 6,
|
|
38
|
-
Email = 7,
|
|
39
|
-
FacebookCustomAudienceId = 9,
|
|
40
|
-
Other2 = 10,
|
|
41
|
-
Other3 = 11,
|
|
42
|
-
Other4 = 12,
|
|
43
|
-
Other5 = 13,
|
|
44
|
-
Other6 = 14,
|
|
45
|
-
Other7 = 15,
|
|
46
|
-
Other8 = 16,
|
|
47
|
-
Other9 = 17,
|
|
48
|
-
Other10 = 18,
|
|
49
|
-
MobileNumber = 19,
|
|
50
|
-
PhoneNumber2 = 20,
|
|
51
|
-
PhoneNumber3 = 21,
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface IIdentityType {
|
|
55
|
-
getIdentityType(identityType: string): IdentityType | null;
|
|
56
|
-
}
|
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
|
-
};
|