@mparticle/web-sdk 2.81.0 → 3.0.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.
- package/dist/mparticle.common.js +15 -84
- package/dist/mparticle.esm.js +15 -84
- package/dist/mparticle.js +6 -268
- package/dist/types/src/consent.d.ts +0 -3
- package/dist/types/src/constants.d.ts +0 -6
- package/dist/types/src/ecommerce.interfaces.d.ts +3 -9
- package/dist/types/src/events.interfaces.d.ts +0 -2
- package/dist/types/src/identity-user-interfaces.d.ts +2 -27
- package/dist/types/src/identity.interfaces.d.ts +1 -5
- package/dist/types/src/internal-types.d.ts +1 -1
- package/dist/types/src/kitBlocking.d.ts +0 -2
- package/dist/types/src/public-types.d.ts +1 -1
- package/dist/types/src/sdkRuntimeModels.d.ts +0 -5
- package/dist/types/src/sdkToEventsApiConverter.d.ts +0 -1
- package/dist/types/src/store.d.ts +0 -1
- package/dist/types/src/stub/mparticle.stub.d.ts +0 -23
- package/package.json +2 -3
- package/src/consent.ts +2 -24
- package/src/constants.ts +0 -6
- package/src/ecommerce.interfaces.ts +2 -33
- package/src/ecommerce.ts +0 -16
- package/src/events.interfaces.ts +0 -17
- package/src/events.ts +1 -74
- package/src/identity-user-interfaces.ts +2 -33
- package/src/identity.interfaces.ts +0 -6
- package/src/identity.ts +0 -115
- package/src/internal-types.ts +0 -1
- package/src/mp-instance.ts +2 -156
- package/src/mparticle-instance-manager.ts +0 -37
- package/src/public-types.ts +0 -1
- package/src/sdkRuntimeModels.ts +0 -6
- package/src/sdkToEventsApiConverter.ts +0 -17
- package/src/serverModel.ts +0 -9
- package/src/store.ts +0 -7
- package/src/stub/mparticle.stub.js +0 -15
package/src/mp-instance.ts
CHANGED
|
@@ -780,78 +780,6 @@ export default function mParticleInstance(this: IMParticleWebSDKInstance, instan
|
|
|
780
780
|
* @class mParticle.eCommerce
|
|
781
781
|
*/
|
|
782
782
|
this.eCommerce = {
|
|
783
|
-
/**
|
|
784
|
-
* Invoke these methods on the mParticle.eCommerce.Cart object.
|
|
785
|
-
* Example: mParticle.eCommerce.Cart.add(...)
|
|
786
|
-
* @class mParticle.eCommerce.Cart
|
|
787
|
-
* @deprecated
|
|
788
|
-
*/
|
|
789
|
-
Cart: {
|
|
790
|
-
/**
|
|
791
|
-
* Adds a product to the cart
|
|
792
|
-
* @method add
|
|
793
|
-
* @param {Object} product The product you want to add to the cart
|
|
794
|
-
* @param {Boolean} [logEventBoolean] Option to log the event to mParticle's servers. If blank, no logging occurs.
|
|
795
|
-
* @deprecated
|
|
796
|
-
*/
|
|
797
|
-
add: function(product, logEventBoolean) {
|
|
798
|
-
logDeprecatedMethodUsage(
|
|
799
|
-
{
|
|
800
|
-
methodName: 'mPInstance.eCommerce.Cart.add()',
|
|
801
|
-
warningMessage: generateDeprecationMessage(
|
|
802
|
-
'eCommerce.Cart.add()',
|
|
803
|
-
true,
|
|
804
|
-
'eCommerce.logProductAction()',
|
|
805
|
-
'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'
|
|
806
|
-
),
|
|
807
|
-
},
|
|
808
|
-
self.Logger,
|
|
809
|
-
self._ErrorReportingDispatcher
|
|
810
|
-
);
|
|
811
|
-
},
|
|
812
|
-
/**
|
|
813
|
-
* Removes a product from the cart
|
|
814
|
-
* @method remove
|
|
815
|
-
* @param {Object} product The product you want to add to the cart
|
|
816
|
-
* @param {Boolean} [logEventBoolean] Option to log the event to mParticle's servers. If blank, no logging occurs.
|
|
817
|
-
* @deprecated
|
|
818
|
-
*/
|
|
819
|
-
remove: function(product, logEventBoolean) {
|
|
820
|
-
logDeprecatedMethodUsage(
|
|
821
|
-
{
|
|
822
|
-
methodName: 'mPInstance.eCommerce.Cart.remove()',
|
|
823
|
-
warningMessage: generateDeprecationMessage(
|
|
824
|
-
'eCommerce.Cart.remove()',
|
|
825
|
-
true,
|
|
826
|
-
'eCommerce.logProductAction()',
|
|
827
|
-
'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'
|
|
828
|
-
),
|
|
829
|
-
},
|
|
830
|
-
self.Logger,
|
|
831
|
-
self._ErrorReportingDispatcher
|
|
832
|
-
);
|
|
833
|
-
},
|
|
834
|
-
/**
|
|
835
|
-
* Clears the cart
|
|
836
|
-
* @method clear
|
|
837
|
-
* @deprecated
|
|
838
|
-
*/
|
|
839
|
-
clear: function() {
|
|
840
|
-
logDeprecatedMethodUsage(
|
|
841
|
-
{
|
|
842
|
-
methodName: 'mPInstance.eCommerce.Cart.clear()',
|
|
843
|
-
warningMessage: generateDeprecationMessage(
|
|
844
|
-
'eCommerce.Cart.clear()',
|
|
845
|
-
true,
|
|
846
|
-
'',
|
|
847
|
-
'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'
|
|
848
|
-
),
|
|
849
|
-
},
|
|
850
|
-
self.Logger,
|
|
851
|
-
self._ErrorReportingDispatcher
|
|
852
|
-
);
|
|
853
|
-
},
|
|
854
|
-
},
|
|
855
783
|
/**
|
|
856
784
|
* Sets the currency code
|
|
857
785
|
* @for mParticle.eCommerce
|
|
@@ -967,42 +895,6 @@ export default function mParticleInstance(this: IMParticleWebSDKInstance, instan
|
|
|
967
895
|
tax
|
|
968
896
|
);
|
|
969
897
|
},
|
|
970
|
-
/**
|
|
971
|
-
* Logs a checkout action
|
|
972
|
-
* @for mParticle.eCommerce
|
|
973
|
-
* @method logCheckout
|
|
974
|
-
* @param {Number} step checkout step number
|
|
975
|
-
* @param {String} checkout option string
|
|
976
|
-
* @param {Object} attrs
|
|
977
|
-
* @param {Object} [customFlags] Custom flags for the event
|
|
978
|
-
* @deprecated
|
|
979
|
-
*/
|
|
980
|
-
logCheckout: function(step, option, attrs, customFlags) {
|
|
981
|
-
logDeprecatedMethodUsage(
|
|
982
|
-
{
|
|
983
|
-
methodName: 'mParticle.logCheckout',
|
|
984
|
-
warningMessage: 'mParticle.logCheckout is deprecated, please use mParticle.logProductAction instead',
|
|
985
|
-
},
|
|
986
|
-
self.Logger,
|
|
987
|
-
self._ErrorReportingDispatcher
|
|
988
|
-
);
|
|
989
|
-
|
|
990
|
-
if (!self._Store.isInitialized) {
|
|
991
|
-
self.ready(function() {
|
|
992
|
-
self.eCommerce.logCheckout(
|
|
993
|
-
step,
|
|
994
|
-
option,
|
|
995
|
-
attrs,
|
|
996
|
-
customFlags
|
|
997
|
-
);
|
|
998
|
-
});
|
|
999
|
-
|
|
1000
|
-
return;
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
self._SessionManager.resetSessionTimer();
|
|
1004
|
-
self._Events.logCheckoutEvent(step, option, attrs, customFlags);
|
|
1005
|
-
},
|
|
1006
898
|
/**
|
|
1007
899
|
* Logs a product action
|
|
1008
900
|
* @for mParticle.eCommerce
|
|
@@ -1054,7 +946,7 @@ export default function mParticleInstance(this: IMParticleWebSDKInstance, instan
|
|
|
1054
946
|
* @param {Boolean} [clearCart] boolean to clear the cart after logging or not. Defaults to false
|
|
1055
947
|
* @param {Object} [attrs] other attributes related to the product purchase
|
|
1056
948
|
* @param {Object} [customFlags] Custom flags for the event
|
|
1057
|
-
* @deprecated
|
|
949
|
+
* @deprecated Use `logProductAction` with `ProductActionType.Purchase` instead.
|
|
1058
950
|
*/
|
|
1059
951
|
logPurchase: function(
|
|
1060
952
|
transactionAttributes,
|
|
@@ -1066,7 +958,7 @@ export default function mParticleInstance(this: IMParticleWebSDKInstance, instan
|
|
|
1066
958
|
logDeprecatedMethodUsage(
|
|
1067
959
|
{
|
|
1068
960
|
methodName: 'mParticle.logPurchase',
|
|
1069
|
-
warningMessage: 'mParticle.logPurchase is deprecated, please use mParticle.logProductAction instead',
|
|
961
|
+
warningMessage: 'mParticle.logPurchase is deprecated, please use mParticle.logProductAction with ProductActionType.Purchase instead',
|
|
1070
962
|
},
|
|
1071
963
|
self.Logger,
|
|
1072
964
|
self._ErrorReportingDispatcher
|
|
@@ -1162,52 +1054,6 @@ export default function mParticleInstance(this: IMParticleWebSDKInstance, instan
|
|
|
1162
1054
|
eventOptions
|
|
1163
1055
|
);
|
|
1164
1056
|
},
|
|
1165
|
-
/**
|
|
1166
|
-
* Logs a refund
|
|
1167
|
-
* @for mParticle.eCommerce
|
|
1168
|
-
* @method logRefund
|
|
1169
|
-
* @param {Object} transactionAttributes transaction attributes related to the refund
|
|
1170
|
-
* @param {Object} product product being refunded
|
|
1171
|
-
* @param {Boolean} [clearCart] boolean to clear the cart after refund is logged. Defaults to false.
|
|
1172
|
-
* @param {Object} [attrs] attributes related to the refund
|
|
1173
|
-
* @param {Object} [customFlags] Custom flags for the event
|
|
1174
|
-
* @deprecated
|
|
1175
|
-
*/
|
|
1176
|
-
logRefund: function(
|
|
1177
|
-
transactionAttributes,
|
|
1178
|
-
product,
|
|
1179
|
-
clearCart,
|
|
1180
|
-
attrs,
|
|
1181
|
-
customFlags
|
|
1182
|
-
) {
|
|
1183
|
-
logDeprecatedMethodUsage(
|
|
1184
|
-
{
|
|
1185
|
-
methodName: 'mParticle.logRefund',
|
|
1186
|
-
warningMessage: 'mParticle.logRefund is deprecated, please use mParticle.logProductAction instead',
|
|
1187
|
-
},
|
|
1188
|
-
self.Logger,
|
|
1189
|
-
self._ErrorReportingDispatcher
|
|
1190
|
-
);
|
|
1191
|
-
if (!self._Store.isInitialized) {
|
|
1192
|
-
self.ready(function() {
|
|
1193
|
-
self.eCommerce.logRefund(
|
|
1194
|
-
transactionAttributes,
|
|
1195
|
-
product,
|
|
1196
|
-
clearCart,
|
|
1197
|
-
attrs,
|
|
1198
|
-
customFlags
|
|
1199
|
-
);
|
|
1200
|
-
});
|
|
1201
|
-
return;
|
|
1202
|
-
}
|
|
1203
|
-
self._SessionManager.resetSessionTimer();
|
|
1204
|
-
self._Events.logRefundEvent(
|
|
1205
|
-
transactionAttributes,
|
|
1206
|
-
product,
|
|
1207
|
-
attrs,
|
|
1208
|
-
customFlags
|
|
1209
|
-
);
|
|
1210
|
-
},
|
|
1211
1057
|
expandCommerceEvent: function(event) {
|
|
1212
1058
|
return self._Ecommerce.expandCommerceEvent(event);
|
|
1213
1059
|
},
|
|
@@ -198,20 +198,6 @@ function mParticleInstanceManager(this: IMParticleInstanceManager) {
|
|
|
198
198
|
self.getInstance().upload();
|
|
199
199
|
};
|
|
200
200
|
this.eCommerce = {
|
|
201
|
-
Cart: {
|
|
202
|
-
add: function(product, logEventBoolean) {
|
|
203
|
-
self.getInstance().eCommerce.Cart.add(product, logEventBoolean);
|
|
204
|
-
},
|
|
205
|
-
remove: function(product, logEventBoolean) {
|
|
206
|
-
self.getInstance().eCommerce.Cart.remove(
|
|
207
|
-
product,
|
|
208
|
-
logEventBoolean
|
|
209
|
-
);
|
|
210
|
-
},
|
|
211
|
-
clear: function() {
|
|
212
|
-
self.getInstance().eCommerce.Cart.clear();
|
|
213
|
-
},
|
|
214
|
-
},
|
|
215
201
|
setCurrencyCode: function(code) {
|
|
216
202
|
self.getInstance().eCommerce.setCurrencyCode(code);
|
|
217
203
|
},
|
|
@@ -269,14 +255,6 @@ function mParticleInstanceManager(this: IMParticleInstanceManager) {
|
|
|
269
255
|
tax
|
|
270
256
|
);
|
|
271
257
|
},
|
|
272
|
-
logCheckout: function(step, options, attrs, customFlags) {
|
|
273
|
-
self.getInstance().eCommerce.logCheckout(
|
|
274
|
-
step,
|
|
275
|
-
options,
|
|
276
|
-
attrs,
|
|
277
|
-
customFlags
|
|
278
|
-
);
|
|
279
|
-
},
|
|
280
258
|
logProductAction: function(
|
|
281
259
|
productActionType,
|
|
282
260
|
product,
|
|
@@ -332,21 +310,6 @@ function mParticleInstanceManager(this: IMParticleInstanceManager) {
|
|
|
332
310
|
eventOptions
|
|
333
311
|
);
|
|
334
312
|
},
|
|
335
|
-
logRefund: function(
|
|
336
|
-
transactionAttributes,
|
|
337
|
-
product,
|
|
338
|
-
clearCart,
|
|
339
|
-
attrs,
|
|
340
|
-
customFlags
|
|
341
|
-
) {
|
|
342
|
-
self.getInstance().eCommerce.logRefund(
|
|
343
|
-
transactionAttributes,
|
|
344
|
-
product,
|
|
345
|
-
clearCart,
|
|
346
|
-
attrs,
|
|
347
|
-
customFlags
|
|
348
|
-
);
|
|
349
|
-
},
|
|
350
313
|
expandCommerceEvent: function(event) {
|
|
351
314
|
return self.getInstance().eCommerce.expandCommerceEvent(event);
|
|
352
315
|
},
|
package/src/public-types.ts
CHANGED
package/src/sdkRuntimeModels.ts
CHANGED
|
@@ -87,7 +87,6 @@ export interface SDKEvent {
|
|
|
87
87
|
ProductAction?: SDKProductAction;
|
|
88
88
|
PromotionAction?: SDKPromotionAction;
|
|
89
89
|
ProductImpressions?: SDKProductImpression[];
|
|
90
|
-
ShoppingCart?: SDKShoppingCart;
|
|
91
90
|
UserIdentityChanges?: ISDKUserIdentityChanges;
|
|
92
91
|
UserAttributeChanges?: ISDKUserAttributeChangeData;
|
|
93
92
|
CurrencyCode: string;
|
|
@@ -111,10 +110,6 @@ export interface SDKDataPlan {
|
|
|
111
110
|
PlanId?: string | null;
|
|
112
111
|
}
|
|
113
112
|
|
|
114
|
-
export interface SDKShoppingCart {
|
|
115
|
-
ProductList?: SDKProduct[];
|
|
116
|
-
}
|
|
117
|
-
|
|
118
113
|
export interface SDKPromotionAction {
|
|
119
114
|
PromotionActionType: string;
|
|
120
115
|
PromotionList?: SDKPromotion[];
|
|
@@ -340,7 +335,6 @@ export interface SDKInitConfig
|
|
|
340
335
|
identityUrl?: string;
|
|
341
336
|
integrationDelayTimeout?: number;
|
|
342
337
|
isIOS?: boolean;
|
|
343
|
-
maxProducts?: number;
|
|
344
338
|
requestConfig?: boolean;
|
|
345
339
|
sessionTimeout?: number;
|
|
346
340
|
useNativeSdk?: boolean;
|
|
@@ -433,22 +433,6 @@ export function convertImpressions(
|
|
|
433
433
|
return impressions;
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
-
export function convertShoppingCart(
|
|
437
|
-
sdkEvent: SDKEvent
|
|
438
|
-
): EventsApi.ShoppingCart | null {
|
|
439
|
-
if (
|
|
440
|
-
!sdkEvent.ShoppingCart ||
|
|
441
|
-
!sdkEvent.ShoppingCart.ProductList ||
|
|
442
|
-
!sdkEvent.ShoppingCart.ProductList.length
|
|
443
|
-
) {
|
|
444
|
-
return null;
|
|
445
|
-
}
|
|
446
|
-
const shoppingCart: EventsApi.ShoppingCart = {
|
|
447
|
-
products: convertProducts(sdkEvent.ShoppingCart.ProductList),
|
|
448
|
-
};
|
|
449
|
-
return shoppingCart;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
436
|
export function convertCommerceEvent(
|
|
453
437
|
sdkEvent: SDKEvent
|
|
454
438
|
): EventsApi.CommerceEvent {
|
|
@@ -460,7 +444,6 @@ export function convertCommerceEvent(
|
|
|
460
444
|
product_action: convertProductAction(sdkEvent),
|
|
461
445
|
promotion_action: convertPromotionAction(sdkEvent),
|
|
462
446
|
product_impressions: convertImpressions(sdkEvent),
|
|
463
|
-
shopping_cart: convertShoppingCart(sdkEvent),
|
|
464
447
|
currency_code: sdkEvent.CurrencyCode,
|
|
465
448
|
};
|
|
466
449
|
|
package/src/serverModel.ts
CHANGED
|
@@ -445,15 +445,6 @@ export default function ServerModel(
|
|
|
445
445
|
if (event.EventDataType === MessageType.Commerce) {
|
|
446
446
|
dto.cu = event.CurrencyCode;
|
|
447
447
|
|
|
448
|
-
// TODO: If Cart is deprecated, we should deprecate this too
|
|
449
|
-
if (event.ShoppingCart) {
|
|
450
|
-
dto.sc = {
|
|
451
|
-
pl: convertProductListToV2DTO(
|
|
452
|
-
event.ShoppingCart.ProductList
|
|
453
|
-
),
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
|
|
457
448
|
if (event.ProductAction) {
|
|
458
449
|
dto.pd = {
|
|
459
450
|
an: event.ProductAction.ProductActionType,
|
package/src/store.ts
CHANGED
|
@@ -85,7 +85,6 @@ export interface SDKConfig {
|
|
|
85
85
|
userAudienceUrl?: string;
|
|
86
86
|
isIOS?: boolean;
|
|
87
87
|
maxAliasWindow: number;
|
|
88
|
-
maxProducts: number;
|
|
89
88
|
requestConfig?: boolean;
|
|
90
89
|
sessionTimeout?: number;
|
|
91
90
|
timeout?: number;
|
|
@@ -375,12 +374,6 @@ export default function Store(
|
|
|
375
374
|
this.SDKConfig.useCookieStorage = false;
|
|
376
375
|
}
|
|
377
376
|
|
|
378
|
-
if (config.hasOwnProperty('maxProducts')) {
|
|
379
|
-
this.SDKConfig.maxProducts = config.maxProducts;
|
|
380
|
-
} else {
|
|
381
|
-
this.SDKConfig.maxProducts = Constants.DefaultConfig.maxProducts;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
377
|
if (config.hasOwnProperty('maxCookieSize')) {
|
|
385
378
|
this.SDKConfig.maxCookieSize = config.maxCookieSize;
|
|
386
379
|
} else {
|
|
@@ -34,14 +34,11 @@ let mParticle = {
|
|
|
34
34
|
createProduct: returnProduct,
|
|
35
35
|
createPromotion: returnPromotion,
|
|
36
36
|
createTransactionAttributes: returnTransactionAttributes,
|
|
37
|
-
logCheckout: voidFunction,
|
|
38
37
|
logImpression: voidFunction,
|
|
39
38
|
logProductAction: voidFunction,
|
|
40
39
|
logPromotion: voidFunction,
|
|
41
40
|
logPurchase: voidFunction,
|
|
42
|
-
logRefund: voidFunction,
|
|
43
41
|
setCurrencyCode: voidFunction,
|
|
44
|
-
Cart: new Cart(),
|
|
45
42
|
},
|
|
46
43
|
Consent: {
|
|
47
44
|
createConsentState: createConsentState,
|
|
@@ -88,7 +85,6 @@ function returnUser() {
|
|
|
88
85
|
removeAllUserAttributes: voidFunction,
|
|
89
86
|
getUserAttributesLists: returnObject,
|
|
90
87
|
getAllUserAttributes: returnObject,
|
|
91
|
-
getCart: Cart,
|
|
92
88
|
getConsentState: createConsentState,
|
|
93
89
|
setConsentState: voidFunction,
|
|
94
90
|
};
|
|
@@ -98,17 +94,6 @@ function returnUsers() {
|
|
|
98
94
|
return [returnUser()];
|
|
99
95
|
}
|
|
100
96
|
|
|
101
|
-
function Cart() {
|
|
102
|
-
return {
|
|
103
|
-
add: voidFunction,
|
|
104
|
-
clear: voidFunction,
|
|
105
|
-
remove: voidFunction,
|
|
106
|
-
getCartProducts: function() {
|
|
107
|
-
return [returnProduct()];
|
|
108
|
-
},
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
97
|
function returnImpression() {
|
|
113
98
|
return {
|
|
114
99
|
Name: 'name',
|