test
1 month ago
events.js
1 month ago
events.js.map
1 month ago
facebook.js
1 month ago
facebook.js.map
1 month ago
functions.js
3 years ago
functions.js.map
1 year ago
getters.js
2 months ago
getters.js.map
2 months ago
google.js
1 year ago
google.js.map
1 year ago
index.js
2 years ago
index.js.map
2 years ago
mutations.js
1 year ago
mutations.js.map
1 year ago
store.js
1 month ago
store.js.map
1 month ago
watchers.js
1 month ago
watchers.js.map
1 month ago
facebook.js
1 lines
| 1 | import{maybeConvertAmount}from"../../functions/currency";const isTrackingDisabled=()=>{var n;return!(null===window||void 0===window?void 0:window.fbq)||!1===(null===(n=null===window||void 0===window?void 0:window.scData)||void 0===n?void 0:n.facebook_tracking_enabled)},getProductId=n=>{var i,o,t;return"string"==typeof(null===(i=null==n?void 0:n.price)||void 0===i?void 0:i.product)?n.price.product:null===(t=null===(o=null==n?void 0:n.price)||void 0===o?void 0:o.product)||void 0===t?void 0:t.id};window.addEventListener("scAddedToCart",(function(n){var i,o,t,d,e,l,r;if(isTrackingDisabled())return;const u=n.detail;if(!(null===(i=null==u?void 0:u.price)||void 0===i?void 0:i.product))return;const c=null===(o=null==u?void 0:u.price)||void 0===o?void 0:o.product,a=(null===(d=null===(t=null==c?void 0:c.product_collections)||void 0===t?void 0:t.data)||void 0===d?void 0:d.map((n=>n.name)))||[];window.fbq("track","AddToCart",{...a.length?{content_category:a.join(", ")}:{},content_ids:[getProductId(u)],content_name:(null==c?void 0:c.name)+((null===(e=null==u?void 0:u.variant_options)||void 0===e?void 0:e.length)?` - ${null==u?void 0:u.variant_options.join(" / ")}`:""),content_type:"product",contents:[{id:getProductId(u),quantity:u.quantity}],currency:null===(l=null==u?void 0:u.price)||void 0===l?void 0:l.currency,value:maybeConvertAmount((null==u?void 0:u.total_amount)||0,(null===(r=null==u?void 0:u.price)||void 0===r?void 0:r.currency)||"USD")})})),window.addEventListener("scCheckoutInitiated",(function(n){var i,o,t,d;if(isTrackingDisabled())return;const e=n.detail;window.fbq("track","InitiateCheckout",{content_ids:((null===(i=null==e?void 0:e.line_items)||void 0===i?void 0:i.data)||[]).map(getProductId),contents:((null===(o=null==e?void 0:e.line_items)||void 0===o?void 0:o.data)||[]).map((n=>({id:getProductId(n),quantity:n.quantity}))),currency:null==e?void 0:e.currency,num_items:(null===(d=null===(t=null==e?void 0:e.line_items)||void 0===t?void 0:t.data)||void 0===d?void 0:d.length)||0,value:maybeConvertAmount(null==e?void 0:e.total_amount,(null==e?void 0:e.currency)||"USD")},{eventID:null==e?void 0:e.id})})),window.addEventListener("scCheckoutCompleted",(function(n){var i;if(isTrackingDisabled())return;const o=n.detail,t=(null===(i=null==o?void 0:o.line_items)||void 0===i?void 0:i.data)||[];window.fbq("track","Purchase",{content_ids:t.map(getProductId),content_name:"Purchase",content_type:"product",contents:t.map((n=>({id:getProductId(n),quantity:n.quantity}))),currency:null==o?void 0:o.currency,num_items:t.length,value:maybeConvertAmount(null==o?void 0:o.total_amount,(null==o?void 0:o.currency)||"USD")},{eventID:null==o?void 0:o.id})})),window.addEventListener("scTrialStarted",(function(n){isTrackingDisabled()||n.detail.forEach((n=>{var i,o,t;window.fbq("track","StartTrial",{currency:null===(i=n.price)||void 0===i?void 0:i.currency,value:maybeConvertAmount((null===(o=n.price)||void 0===o?void 0:o.amount)||0,(null===(t=n.price)||void 0===t?void 0:t.currency)||"USD")},{eventID:null==n?void 0:n.id})}))})),window.addEventListener("scSubscriptionStarted",(function(n){isTrackingDisabled()||n.detail.forEach((n=>{var i,o,t;window.fbq("track","Subscribe",{currency:null===(i=n.price)||void 0===i?void 0:i.currency,value:maybeConvertAmount((null===(o=n.price)||void 0===o?void 0:o.amount)||0,(null===(t=n.price)||void 0===t?void 0:t.currency)||"USD")},{eventID:null==n?void 0:n.id})}))})),window.addEventListener("scPaymentInfoAdded",(function(n){if(isTrackingDisabled())return;const i=n.detail;window.fbq("track","AddPaymentInfo",{content_category:"Payment Info Added",currency:null==i?void 0:i.currency})})); |