Skip to content

Commit 3fa1b70

Browse files
authored
fix: Correct variable declarations, add ESM module (#46)
1 parent a7e2fb2 commit 3fa1b70

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
"author": "mParticle Developers <developers@mparticle.com> (https://www.mparticle.com)",
55
"description": "mParticle integration sdk for facebook",
66
"main": "dist/FacebookEventForwarder.common.js",
7+
"module": "dist/FacebookEventForwarder.esm.js",
78
"browser": "dist/FacebookEventForwarder.common.js",
89
"files": [
9-
"dist/FacebookEventForwarder.common.js"
10+
"dist/FacebookEventForwarder.common.js",
11+
"dist/FacebookEventForwarder.esm.js"
1012
],
1113
"repository": "https://github.com/mparticle-integrations/mparticle-javascript-integration-facebook",
1214
"scripts": {

rollup.config.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,21 @@ export default [
3333
}),
3434
commonjs()
3535
]
36+
},
37+
{
38+
input: 'src/FacebookEventForwarder.js',
39+
output: {
40+
file: 'dist/FacebookEventForwarder.esm.js',
41+
format: 'esm',
42+
exports: 'named',
43+
name: 'mpFacebookKit',
44+
strict: false
45+
},
46+
plugins: [
47+
resolve({
48+
browser: true
49+
}),
50+
commonjs()
51+
]
3652
}
37-
]
53+
]

src/FacebookEventForwarder.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@
5050
},
5151
SupportedCommerceTypes = [],
5252
// Standard FB Event Names from https://developers.facebook.com/docs/facebook-pixel/reference#standard-events
53-
ADD_TO_CART_EVENT_NAME = 'AddToCart';
54-
ADD_TO_WISHLIST_EVENT_NAME = 'AddToWishlist';
55-
CHECKOUT_EVENT_NAME = 'InitiateCheckout';
56-
PAGE_VIEW_EVENT_NAME = 'PageView';
57-
PURCHASE_EVENT_NAME = 'Purchase';
58-
REMOVE_FROM_CART_EVENT_NAME = 'RemoveFromCart';
59-
VIEW_CONTENT_EVENT_NAME = 'ViewContent';
53+
ADD_TO_CART_EVENT_NAME = 'AddToCart',
54+
ADD_TO_WISHLIST_EVENT_NAME = 'AddToWishlist',
55+
CHECKOUT_EVENT_NAME = 'InitiateCheckout',
56+
PAGE_VIEW_EVENT_NAME = 'PageView',
57+
PURCHASE_EVENT_NAME = 'Purchase',
58+
REMOVE_FROM_CART_EVENT_NAME = 'RemoveFromCart',
59+
VIEW_CONTENT_EVENT_NAME = 'ViewContent',
6060
constructor = function () {
6161
var self = this,
6262
isInitialized = false,

0 commit comments

Comments
 (0)