@pelcro/react-pelcro-js 4.0.0-alpha.1 → 4.0.0-alpha.2
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/index.cjs.js +867 -61
- package/dist/index.esm.js +867 -61
- package/package.json +2 -1
package/dist/index.esm.js
CHANGED
|
@@ -6333,6 +6333,53 @@ function _defineProperty$3(obj, key, value) {
|
|
|
6333
6333
|
return obj;
|
|
6334
6334
|
}
|
|
6335
6335
|
|
|
6336
|
+
// Polyfill
|
|
6337
|
+
(() => {
|
|
6338
|
+
if (typeof window.CustomEvent === "function") return false;
|
|
6339
|
+
|
|
6340
|
+
function CustomEvent(event, params = {
|
|
6341
|
+
bubbles: false,
|
|
6342
|
+
cancelable: false,
|
|
6343
|
+
detail: undefined
|
|
6344
|
+
}) {
|
|
6345
|
+
const evt = document.createEvent("CustomEvent");
|
|
6346
|
+
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
|
|
6347
|
+
return evt;
|
|
6348
|
+
}
|
|
6349
|
+
|
|
6350
|
+
CustomEvent.prototype = window.Event.prototype;
|
|
6351
|
+
window.CustomEvent = CustomEvent;
|
|
6352
|
+
})();
|
|
6353
|
+
/**
|
|
6354
|
+
* Should fire when the cart is opened and expects the cartItems inside the card to be sent
|
|
6355
|
+
*/
|
|
6356
|
+
|
|
6357
|
+
|
|
6358
|
+
const cartOpened = detail => createCustomEvent("PelcroElementsCartOpened", detail);
|
|
6359
|
+
/**
|
|
6360
|
+
* Should fire when an item added to the cart and expects the added item to be sent
|
|
6361
|
+
*/
|
|
6362
|
+
|
|
6363
|
+
const cartItemAdded = detail => createCustomEvent("PelcroElementsCartItemAdded", detail);
|
|
6364
|
+
/**
|
|
6365
|
+
* Should fire when an item removed from the cart and expects the removed item to be sent
|
|
6366
|
+
*/
|
|
6367
|
+
|
|
6368
|
+
const cartItemRemoved = detail => createCustomEvent("PelcroElementsCartItemRemoved", detail);
|
|
6369
|
+
/**
|
|
6370
|
+
* Check if the browser support custom events
|
|
6371
|
+
*/
|
|
6372
|
+
|
|
6373
|
+
function createCustomEvent(name, detail) {
|
|
6374
|
+
try {
|
|
6375
|
+
return new CustomEvent(name, {
|
|
6376
|
+
detail
|
|
6377
|
+
});
|
|
6378
|
+
} catch (e) {
|
|
6379
|
+
console.warn("Pelcro - Events are not supported in the browser");
|
|
6380
|
+
}
|
|
6381
|
+
}
|
|
6382
|
+
|
|
6336
6383
|
function warn(s) {
|
|
6337
6384
|
console.warn('[react-ga]', s);
|
|
6338
6385
|
}
|
|
@@ -7184,57 +7231,789 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
7184
7231
|
OutboundLink$1.origTrackLink = OutboundLink$1.trackLink;
|
|
7185
7232
|
OutboundLink$1.trackLink = outboundLink;
|
|
7186
7233
|
var OutboundLink = OutboundLink$1;
|
|
7187
|
-
var
|
|
7234
|
+
var ReactGA1 = _objectSpread({}, Defaults, {
|
|
7188
7235
|
OutboundLink: OutboundLink
|
|
7189
7236
|
});
|
|
7190
7237
|
|
|
7191
|
-
|
|
7192
|
-
(() => {
|
|
7193
|
-
if (typeof window.CustomEvent === "function") return false;
|
|
7238
|
+
var gtag_1 = createCommonjsModule(function (module, exports) {
|
|
7194
7239
|
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7240
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7241
|
+
value: true
|
|
7242
|
+
});
|
|
7243
|
+
exports["default"] = void 0;
|
|
7244
|
+
|
|
7245
|
+
var gtag = function gtag() {
|
|
7246
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
7247
|
+
args[_key] = arguments[_key];
|
|
7203
7248
|
}
|
|
7204
7249
|
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
})();
|
|
7208
|
-
/**
|
|
7209
|
-
* Should fire when the cart is opened and expects the cartItems inside the card to be sent
|
|
7210
|
-
*/
|
|
7250
|
+
if (typeof window !== "undefined") {
|
|
7251
|
+
var _window;
|
|
7211
7252
|
|
|
7253
|
+
if (typeof window.gtag === "undefined") {
|
|
7254
|
+
window.dataLayer = window.dataLayer || [];
|
|
7255
|
+
|
|
7256
|
+
window.gtag = function gtag() {
|
|
7257
|
+
window.dataLayer.push(arguments);
|
|
7258
|
+
};
|
|
7259
|
+
}
|
|
7260
|
+
|
|
7261
|
+
(_window = window).gtag.apply(_window, args);
|
|
7262
|
+
}
|
|
7263
|
+
};
|
|
7264
|
+
|
|
7265
|
+
var _default = gtag;
|
|
7266
|
+
exports["default"] = _default;
|
|
7267
|
+
});
|
|
7268
|
+
|
|
7269
|
+
unwrapExports(gtag_1);
|
|
7270
|
+
|
|
7271
|
+
var format_1 = createCommonjsModule(function (module, exports) {
|
|
7272
|
+
|
|
7273
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7274
|
+
value: true
|
|
7275
|
+
});
|
|
7276
|
+
exports["default"] = format;
|
|
7277
|
+
var smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i;
|
|
7278
|
+
|
|
7279
|
+
function toTitleCase(string) {
|
|
7280
|
+
return string.toString().trim().replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, function (match, index, title) {
|
|
7281
|
+
if (index > 0 && index + match.length !== title.length && match.search(smallWords) > -1 && title.charAt(index - 2) !== ":" && (title.charAt(index + match.length) !== "-" || title.charAt(index - 1) === "-") && title.charAt(index - 1).search(/[^\s-]/) < 0) {
|
|
7282
|
+
return match.toLowerCase();
|
|
7283
|
+
}
|
|
7284
|
+
|
|
7285
|
+
if (match.substr(1).search(/[A-Z]|\../) > -1) {
|
|
7286
|
+
return match;
|
|
7287
|
+
}
|
|
7288
|
+
|
|
7289
|
+
return match.charAt(0).toUpperCase() + match.substr(1);
|
|
7290
|
+
});
|
|
7291
|
+
} // See if s could be an email address. We don't want to send personal data like email.
|
|
7292
|
+
// https://support.google.com/analytics/answer/2795983?hl=en
|
|
7293
|
+
|
|
7294
|
+
|
|
7295
|
+
function mightBeEmail(s) {
|
|
7296
|
+
// There's no point trying to validate rfc822 fully, just look for ...@...
|
|
7297
|
+
return typeof s === "string" && s.indexOf("@") !== -1;
|
|
7298
|
+
}
|
|
7299
|
+
|
|
7300
|
+
var redacted = "REDACTED (Potential Email Address)";
|
|
7301
|
+
|
|
7302
|
+
function redactEmail(string) {
|
|
7303
|
+
if (mightBeEmail(string)) {
|
|
7304
|
+
console.warn("This arg looks like an email address, redacting.");
|
|
7305
|
+
return redacted;
|
|
7306
|
+
}
|
|
7307
|
+
|
|
7308
|
+
return string;
|
|
7309
|
+
}
|
|
7310
|
+
|
|
7311
|
+
function format() {
|
|
7312
|
+
var s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
7313
|
+
var titleCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
7314
|
+
var redactingEmail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
7315
|
+
|
|
7316
|
+
var _str = s || "";
|
|
7317
|
+
|
|
7318
|
+
if (titleCase) {
|
|
7319
|
+
_str = toTitleCase(s);
|
|
7320
|
+
}
|
|
7321
|
+
|
|
7322
|
+
if (redactingEmail) {
|
|
7323
|
+
_str = redactEmail(_str);
|
|
7324
|
+
}
|
|
7325
|
+
|
|
7326
|
+
return _str;
|
|
7327
|
+
}
|
|
7328
|
+
});
|
|
7329
|
+
|
|
7330
|
+
unwrapExports(format_1);
|
|
7331
|
+
|
|
7332
|
+
var ga4 = createCommonjsModule(function (module, exports) {
|
|
7333
|
+
|
|
7334
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7335
|
+
value: true
|
|
7336
|
+
});
|
|
7337
|
+
exports["default"] = exports.GA4 = void 0;
|
|
7338
|
+
|
|
7339
|
+
var _gtag = _interopRequireDefault(gtag_1);
|
|
7340
|
+
|
|
7341
|
+
var _format = _interopRequireDefault(format_1);
|
|
7342
|
+
|
|
7343
|
+
var _excluded = ["eventCategory", "eventAction", "eventLabel", "eventValue", "hitType"],
|
|
7344
|
+
_excluded2 = ["title", "location"],
|
|
7345
|
+
_excluded3 = ["page", "hitType"],
|
|
7346
|
+
_excluded4 = ["action", "category", "label", "value", "nonInteraction", "transport"];
|
|
7347
|
+
|
|
7348
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
7349
|
+
|
|
7350
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
7351
|
+
|
|
7352
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
7353
|
+
|
|
7354
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
7355
|
+
|
|
7356
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
7357
|
+
|
|
7358
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7359
|
+
|
|
7360
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
7361
|
+
|
|
7362
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7363
|
+
|
|
7364
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
7365
|
+
|
|
7366
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7367
|
+
|
|
7368
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7369
|
+
|
|
7370
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7371
|
+
|
|
7372
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
7373
|
+
|
|
7374
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
7375
|
+
|
|
7376
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
7377
|
+
|
|
7378
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7379
|
+
|
|
7380
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
7381
|
+
|
|
7382
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
7383
|
+
|
|
7384
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
7385
|
+
|
|
7386
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7387
|
+
|
|
7388
|
+
/*
|
|
7389
|
+
Links
|
|
7390
|
+
https://developers.google.com/gtagjs/reference/api
|
|
7391
|
+
https://developers.google.com/tag-platform/gtagjs/reference
|
|
7392
|
+
*/
|
|
7212
7393
|
|
|
7213
|
-
const cartOpened = detail => createCustomEvent("PelcroElementsCartOpened", detail);
|
|
7214
7394
|
/**
|
|
7215
|
-
*
|
|
7395
|
+
* @typedef GaOptions
|
|
7396
|
+
* @type {Object}
|
|
7397
|
+
* @property {boolean} [cookieUpdate=true]
|
|
7398
|
+
* @property {number} [cookieExpires=63072000] Default two years
|
|
7399
|
+
* @property {string} [cookieDomain="auto"]
|
|
7400
|
+
* @property {string} [cookieFlags]
|
|
7401
|
+
* @property {string} [userId]
|
|
7402
|
+
* @property {string} [clientId]
|
|
7403
|
+
* @property {boolean} [anonymizeIp]
|
|
7404
|
+
* @property {string} [contentGroup1]
|
|
7405
|
+
* @property {string} [contentGroup2]
|
|
7406
|
+
* @property {string} [contentGroup3]
|
|
7407
|
+
* @property {string} [contentGroup4]
|
|
7408
|
+
* @property {string} [contentGroup5]
|
|
7409
|
+
* @property {boolean} [allowAdFeatures=true]
|
|
7410
|
+
* @property {boolean} [allowAdPersonalizationSignals]
|
|
7411
|
+
* @property {boolean} [nonInteraction]
|
|
7412
|
+
* @property {string} [page]
|
|
7216
7413
|
*/
|
|
7217
7414
|
|
|
7218
|
-
const cartItemAdded = detail => createCustomEvent("PelcroElementsCartItemAdded", detail);
|
|
7219
7415
|
/**
|
|
7220
|
-
*
|
|
7416
|
+
* @typedef UaEventOptions
|
|
7417
|
+
* @type {Object}
|
|
7418
|
+
* @property {string} action
|
|
7419
|
+
* @property {string} category
|
|
7420
|
+
* @property {string} [label]
|
|
7421
|
+
* @property {number} [value]
|
|
7422
|
+
* @property {boolean} [nonInteraction]
|
|
7423
|
+
* @property {('beacon'|'xhr'|'image')} [transport]
|
|
7221
7424
|
*/
|
|
7222
7425
|
|
|
7223
|
-
const cartItemRemoved = detail => createCustomEvent("PelcroElementsCartItemRemoved", detail);
|
|
7224
7426
|
/**
|
|
7225
|
-
*
|
|
7427
|
+
* @typedef InitOptions
|
|
7428
|
+
* @type {Object}
|
|
7429
|
+
* @property {string} trackingId
|
|
7430
|
+
* @property {GaOptions|any} [gaOptions]
|
|
7431
|
+
* @property {Object} [gtagOptions] New parameter
|
|
7226
7432
|
*/
|
|
7433
|
+
var GA4 = /*#__PURE__*/function () {
|
|
7434
|
+
function GA4() {
|
|
7435
|
+
var _this = this;
|
|
7227
7436
|
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7437
|
+
_classCallCheck(this, GA4);
|
|
7438
|
+
|
|
7439
|
+
_defineProperty(this, "reset", function () {
|
|
7440
|
+
_this.isInitialized = false;
|
|
7441
|
+
_this._testMode = false;
|
|
7442
|
+
_this._currentMeasurementId;
|
|
7443
|
+
_this._hasLoadedGA = false;
|
|
7444
|
+
_this._isQueuing = false;
|
|
7445
|
+
_this._queueGtag = [];
|
|
7232
7446
|
});
|
|
7233
|
-
|
|
7234
|
-
|
|
7447
|
+
|
|
7448
|
+
_defineProperty(this, "_gtag", function () {
|
|
7449
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
7450
|
+
args[_key] = arguments[_key];
|
|
7451
|
+
}
|
|
7452
|
+
|
|
7453
|
+
if (!_this._testMode) {
|
|
7454
|
+
if (_this._isQueuing) {
|
|
7455
|
+
_this._queueGtag.push(args);
|
|
7456
|
+
} else {
|
|
7457
|
+
_gtag["default"].apply(void 0, args);
|
|
7458
|
+
}
|
|
7459
|
+
} else {
|
|
7460
|
+
_this._queueGtag.push(args);
|
|
7461
|
+
}
|
|
7462
|
+
});
|
|
7463
|
+
|
|
7464
|
+
_defineProperty(this, "_loadGA", function (GA_MEASUREMENT_ID, nonce) {
|
|
7465
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
7466
|
+
return;
|
|
7467
|
+
}
|
|
7468
|
+
|
|
7469
|
+
if (!_this._hasLoadedGA) {
|
|
7470
|
+
// Global Site Tag (gtag.js) - Google Analytics
|
|
7471
|
+
var script = document.createElement("script");
|
|
7472
|
+
script.async = true;
|
|
7473
|
+
script.src = "https://www.googletagmanager.com/gtag/js?id=".concat(GA_MEASUREMENT_ID);
|
|
7474
|
+
|
|
7475
|
+
if (nonce) {
|
|
7476
|
+
script.setAttribute("nonce", nonce);
|
|
7477
|
+
}
|
|
7478
|
+
|
|
7479
|
+
document.body.appendChild(script);
|
|
7480
|
+
window.dataLayer = window.dataLayer || [];
|
|
7481
|
+
|
|
7482
|
+
window.gtag = function gtag() {
|
|
7483
|
+
window.dataLayer.push(arguments);
|
|
7484
|
+
};
|
|
7485
|
+
|
|
7486
|
+
_this._hasLoadedGA = true;
|
|
7487
|
+
}
|
|
7488
|
+
});
|
|
7489
|
+
|
|
7490
|
+
_defineProperty(this, "_toGtagOptions", function (gaOptions) {
|
|
7491
|
+
if (!gaOptions) {
|
|
7492
|
+
return;
|
|
7493
|
+
}
|
|
7494
|
+
|
|
7495
|
+
var mapFields = {
|
|
7496
|
+
// Old https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#cookieUpdate
|
|
7497
|
+
// New https://developers.google.com/analytics/devguides/collection/gtagjs/cookies-user-id#cookie_update
|
|
7498
|
+
cookieUpdate: "cookie_update",
|
|
7499
|
+
cookieExpires: "cookie_expires",
|
|
7500
|
+
cookieDomain: "cookie_domain",
|
|
7501
|
+
cookieFlags: "cookie_flags",
|
|
7502
|
+
// must be in set method?
|
|
7503
|
+
userId: "user_id",
|
|
7504
|
+
clientId: "client_id",
|
|
7505
|
+
anonymizeIp: "anonymize_ip",
|
|
7506
|
+
// https://support.google.com/analytics/answer/2853546?hl=en#zippy=%2Cin-this-article
|
|
7507
|
+
contentGroup1: "content_group1",
|
|
7508
|
+
contentGroup2: "content_group2",
|
|
7509
|
+
contentGroup3: "content_group3",
|
|
7510
|
+
contentGroup4: "content_group4",
|
|
7511
|
+
contentGroup5: "content_group5",
|
|
7512
|
+
// https://support.google.com/analytics/answer/9050852?hl=en
|
|
7513
|
+
allowAdFeatures: "allow_google_signals",
|
|
7514
|
+
allowAdPersonalizationSignals: "allow_ad_personalization_signals",
|
|
7515
|
+
nonInteraction: "non_interaction",
|
|
7516
|
+
page: "page_path",
|
|
7517
|
+
hitCallback: "event_callback"
|
|
7518
|
+
};
|
|
7519
|
+
var gtagOptions = Object.entries(gaOptions).reduce(function (prev, _ref) {
|
|
7520
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
7521
|
+
key = _ref2[0],
|
|
7522
|
+
value = _ref2[1];
|
|
7523
|
+
|
|
7524
|
+
if (mapFields[key]) {
|
|
7525
|
+
prev[mapFields[key]] = value;
|
|
7526
|
+
} else {
|
|
7527
|
+
prev[key] = value;
|
|
7528
|
+
}
|
|
7529
|
+
|
|
7530
|
+
return prev;
|
|
7531
|
+
}, {});
|
|
7532
|
+
return gtagOptions;
|
|
7533
|
+
});
|
|
7534
|
+
|
|
7535
|
+
_defineProperty(this, "initialize", function (GA_MEASUREMENT_ID) {
|
|
7536
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7537
|
+
|
|
7538
|
+
if (!GA_MEASUREMENT_ID) {
|
|
7539
|
+
throw new Error("Require GA_MEASUREMENT_ID");
|
|
7540
|
+
}
|
|
7541
|
+
|
|
7542
|
+
var initConfigs = typeof GA_MEASUREMENT_ID === "string" ? [{
|
|
7543
|
+
trackingId: GA_MEASUREMENT_ID
|
|
7544
|
+
}] : GA_MEASUREMENT_ID;
|
|
7545
|
+
_this._currentMeasurementId = initConfigs[0].trackingId;
|
|
7546
|
+
var gaOptions = options.gaOptions,
|
|
7547
|
+
gtagOptions = options.gtagOptions,
|
|
7548
|
+
_options$legacyDimens = options.legacyDimensionMetric,
|
|
7549
|
+
legacyDimensionMetric = _options$legacyDimens === void 0 ? true : _options$legacyDimens,
|
|
7550
|
+
nonce = options.nonce,
|
|
7551
|
+
_options$testMode = options.testMode,
|
|
7552
|
+
testMode = _options$testMode === void 0 ? false : _options$testMode;
|
|
7553
|
+
_this._testMode = testMode;
|
|
7554
|
+
|
|
7555
|
+
if (!testMode) {
|
|
7556
|
+
_this._loadGA(_this._currentMeasurementId, nonce);
|
|
7557
|
+
}
|
|
7558
|
+
|
|
7559
|
+
if (!_this.isInitialized) {
|
|
7560
|
+
_this._gtag("js", new Date());
|
|
7561
|
+
|
|
7562
|
+
initConfigs.forEach(function (config) {
|
|
7563
|
+
var mergedGtagOptions = _this._appendCustomMap(_objectSpread(_objectSpread(_objectSpread({
|
|
7564
|
+
// https://developers.google.com/analytics/devguides/collection/gtagjs/pages#disable_pageview_measurement
|
|
7565
|
+
send_page_view: false
|
|
7566
|
+
}, _this._toGtagOptions(_objectSpread(_objectSpread({}, gaOptions), config.gaOptions))), gtagOptions), config.gtagOptions), legacyDimensionMetric);
|
|
7567
|
+
|
|
7568
|
+
_this._gtag("config", config.trackingId, mergedGtagOptions);
|
|
7569
|
+
});
|
|
7570
|
+
}
|
|
7571
|
+
|
|
7572
|
+
_this.isInitialized = true;
|
|
7573
|
+
|
|
7574
|
+
if (!testMode) {
|
|
7575
|
+
var queues = _toConsumableArray(_this._queueGtag);
|
|
7576
|
+
|
|
7577
|
+
_this._queueGtag = [];
|
|
7578
|
+
_this._isQueuing = false;
|
|
7579
|
+
|
|
7580
|
+
while (queues.length) {
|
|
7581
|
+
var queue = queues.shift();
|
|
7582
|
+
|
|
7583
|
+
_this._gtag.apply(_this, _toConsumableArray(queue));
|
|
7584
|
+
|
|
7585
|
+
if (queue[0] === "get") {
|
|
7586
|
+
_this._isQueuing = true;
|
|
7587
|
+
}
|
|
7588
|
+
}
|
|
7589
|
+
}
|
|
7590
|
+
});
|
|
7591
|
+
|
|
7592
|
+
_defineProperty(this, "set", function (fieldsObject) {
|
|
7593
|
+
if (!fieldsObject) {
|
|
7594
|
+
console.warn("`fieldsObject` is required in .set()");
|
|
7595
|
+
return;
|
|
7596
|
+
}
|
|
7597
|
+
|
|
7598
|
+
if (_typeof(fieldsObject) !== "object") {
|
|
7599
|
+
console.warn("Expected `fieldsObject` arg to be an Object");
|
|
7600
|
+
return;
|
|
7601
|
+
}
|
|
7602
|
+
|
|
7603
|
+
if (Object.keys(fieldsObject).length === 0) {
|
|
7604
|
+
console.warn("empty `fieldsObject` given to .set()");
|
|
7605
|
+
}
|
|
7606
|
+
|
|
7607
|
+
_this._gaCommand("set", fieldsObject);
|
|
7608
|
+
});
|
|
7609
|
+
|
|
7610
|
+
_defineProperty(this, "_gaCommandSendEvent", function (eventCategory, eventAction, eventLabel, eventValue, fieldsObject) {
|
|
7611
|
+
_this._gtag("event", eventAction, _objectSpread(_objectSpread({
|
|
7612
|
+
event_category: eventCategory,
|
|
7613
|
+
event_label: eventLabel,
|
|
7614
|
+
value: eventValue
|
|
7615
|
+
}, fieldsObject && {
|
|
7616
|
+
non_interaction: fieldsObject.nonInteraction
|
|
7617
|
+
}), _this._toGtagOptions(fieldsObject)));
|
|
7618
|
+
});
|
|
7619
|
+
|
|
7620
|
+
_defineProperty(this, "_gaCommandSendEventParameters", function () {
|
|
7621
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
7622
|
+
args[_key2] = arguments[_key2];
|
|
7623
|
+
}
|
|
7624
|
+
|
|
7625
|
+
if (typeof args[0] === "string") {
|
|
7626
|
+
_this._gaCommandSendEvent.apply(_this, _toConsumableArray(args.slice(1)));
|
|
7627
|
+
} else {
|
|
7628
|
+
var _args$ = args[0],
|
|
7629
|
+
eventCategory = _args$.eventCategory,
|
|
7630
|
+
eventAction = _args$.eventAction,
|
|
7631
|
+
eventLabel = _args$.eventLabel,
|
|
7632
|
+
eventValue = _args$.eventValue;
|
|
7633
|
+
_args$.hitType;
|
|
7634
|
+
var rest = _objectWithoutProperties(_args$, _excluded);
|
|
7635
|
+
|
|
7636
|
+
_this._gaCommandSendEvent(eventCategory, eventAction, eventLabel, eventValue, rest);
|
|
7637
|
+
}
|
|
7638
|
+
});
|
|
7639
|
+
|
|
7640
|
+
_defineProperty(this, "_gaCommandSendTiming", function (timingCategory, timingVar, timingValue, timingLabel) {
|
|
7641
|
+
_this._gtag("event", "timing_complete", {
|
|
7642
|
+
name: timingVar,
|
|
7643
|
+
value: timingValue,
|
|
7644
|
+
event_category: timingCategory,
|
|
7645
|
+
event_label: timingLabel
|
|
7646
|
+
});
|
|
7647
|
+
});
|
|
7648
|
+
|
|
7649
|
+
_defineProperty(this, "_gaCommandSendPageview", function (page, fieldsObject) {
|
|
7650
|
+
if (fieldsObject && Object.keys(fieldsObject).length) {
|
|
7651
|
+
var _this$_toGtagOptions = _this._toGtagOptions(fieldsObject),
|
|
7652
|
+
title = _this$_toGtagOptions.title,
|
|
7653
|
+
location = _this$_toGtagOptions.location,
|
|
7654
|
+
rest = _objectWithoutProperties(_this$_toGtagOptions, _excluded2);
|
|
7655
|
+
|
|
7656
|
+
_this._gtag("event", "page_view", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, page && {
|
|
7657
|
+
page_path: page
|
|
7658
|
+
}), title && {
|
|
7659
|
+
page_title: title
|
|
7660
|
+
}), location && {
|
|
7661
|
+
page_location: location
|
|
7662
|
+
}), rest));
|
|
7663
|
+
} else if (page) {
|
|
7664
|
+
_this._gtag("event", "page_view", {
|
|
7665
|
+
page_path: page
|
|
7666
|
+
});
|
|
7667
|
+
} else {
|
|
7668
|
+
_this._gtag("event", "page_view");
|
|
7669
|
+
}
|
|
7670
|
+
});
|
|
7671
|
+
|
|
7672
|
+
_defineProperty(this, "_gaCommandSendPageviewParameters", function () {
|
|
7673
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
7674
|
+
args[_key3] = arguments[_key3];
|
|
7675
|
+
}
|
|
7676
|
+
|
|
7677
|
+
if (typeof args[0] === "string") {
|
|
7678
|
+
_this._gaCommandSendPageview.apply(_this, _toConsumableArray(args.slice(1)));
|
|
7679
|
+
} else {
|
|
7680
|
+
var _args$2 = args[0],
|
|
7681
|
+
page = _args$2.page;
|
|
7682
|
+
_args$2.hitType;
|
|
7683
|
+
var rest = _objectWithoutProperties(_args$2, _excluded3);
|
|
7684
|
+
|
|
7685
|
+
_this._gaCommandSendPageview(page, rest);
|
|
7686
|
+
}
|
|
7687
|
+
});
|
|
7688
|
+
|
|
7689
|
+
_defineProperty(this, "_gaCommandSend", function () {
|
|
7690
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
7691
|
+
args[_key4] = arguments[_key4];
|
|
7692
|
+
}
|
|
7693
|
+
|
|
7694
|
+
var hitType = typeof args[0] === "string" ? args[0] : args[0].hitType;
|
|
7695
|
+
|
|
7696
|
+
switch (hitType) {
|
|
7697
|
+
case "event":
|
|
7698
|
+
_this._gaCommandSendEventParameters.apply(_this, args);
|
|
7699
|
+
|
|
7700
|
+
break;
|
|
7701
|
+
|
|
7702
|
+
case "pageview":
|
|
7703
|
+
_this._gaCommandSendPageviewParameters.apply(_this, args);
|
|
7704
|
+
|
|
7705
|
+
break;
|
|
7706
|
+
|
|
7707
|
+
case "timing":
|
|
7708
|
+
_this._gaCommandSendTiming.apply(_this, _toConsumableArray(args.slice(1)));
|
|
7709
|
+
|
|
7710
|
+
break;
|
|
7711
|
+
|
|
7712
|
+
case "screenview":
|
|
7713
|
+
case "transaction":
|
|
7714
|
+
case "item":
|
|
7715
|
+
case "social":
|
|
7716
|
+
case "exception":
|
|
7717
|
+
console.warn("Unsupported send command: ".concat(hitType));
|
|
7718
|
+
break;
|
|
7719
|
+
|
|
7720
|
+
default:
|
|
7721
|
+
console.warn("Send command doesn't exist: ".concat(hitType));
|
|
7722
|
+
}
|
|
7723
|
+
});
|
|
7724
|
+
|
|
7725
|
+
_defineProperty(this, "_gaCommandSet", function () {
|
|
7726
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
7727
|
+
args[_key5] = arguments[_key5];
|
|
7728
|
+
}
|
|
7729
|
+
|
|
7730
|
+
if (typeof args[0] === "string") {
|
|
7731
|
+
args[0] = _defineProperty({}, args[0], args[1]);
|
|
7732
|
+
}
|
|
7733
|
+
|
|
7734
|
+
_this._gtag("set", _this._toGtagOptions(args[0]));
|
|
7735
|
+
});
|
|
7736
|
+
|
|
7737
|
+
_defineProperty(this, "_gaCommand", function (command) {
|
|
7738
|
+
for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
|
|
7739
|
+
args[_key6 - 1] = arguments[_key6];
|
|
7740
|
+
}
|
|
7741
|
+
|
|
7742
|
+
switch (command) {
|
|
7743
|
+
case "send":
|
|
7744
|
+
_this._gaCommandSend.apply(_this, args);
|
|
7745
|
+
|
|
7746
|
+
break;
|
|
7747
|
+
|
|
7748
|
+
case "set":
|
|
7749
|
+
_this._gaCommandSet.apply(_this, args);
|
|
7750
|
+
|
|
7751
|
+
break;
|
|
7752
|
+
|
|
7753
|
+
default:
|
|
7754
|
+
console.warn("Command doesn't exist: ".concat(command));
|
|
7755
|
+
}
|
|
7756
|
+
});
|
|
7757
|
+
|
|
7758
|
+
_defineProperty(this, "ga", function () {
|
|
7759
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
7760
|
+
args[_key7] = arguments[_key7];
|
|
7761
|
+
}
|
|
7762
|
+
|
|
7763
|
+
if (typeof args[0] === "string") {
|
|
7764
|
+
_this._gaCommand.apply(_this, args);
|
|
7765
|
+
} else {
|
|
7766
|
+
var readyCallback = args[0];
|
|
7767
|
+
|
|
7768
|
+
_this._gtag("get", _this._currentMeasurementId, "client_id", function (clientId) {
|
|
7769
|
+
_this._isQueuing = false;
|
|
7770
|
+
var queues = _this._queueGtag;
|
|
7771
|
+
readyCallback({
|
|
7772
|
+
get: function get(property) {
|
|
7773
|
+
return property === "clientId" ? clientId : property === "trackingId" ? _this._currentMeasurementId : property === "apiVersion" ? "1" : undefined;
|
|
7774
|
+
}
|
|
7775
|
+
});
|
|
7776
|
+
|
|
7777
|
+
while (queues.length) {
|
|
7778
|
+
var queue = queues.shift();
|
|
7779
|
+
|
|
7780
|
+
_this._gtag.apply(_this, _toConsumableArray(queue));
|
|
7781
|
+
}
|
|
7782
|
+
});
|
|
7783
|
+
|
|
7784
|
+
_this._isQueuing = true;
|
|
7785
|
+
}
|
|
7786
|
+
|
|
7787
|
+
return _this.ga;
|
|
7788
|
+
});
|
|
7789
|
+
|
|
7790
|
+
_defineProperty(this, "event", function (optionsOrName, params) {
|
|
7791
|
+
if (typeof optionsOrName === "string") {
|
|
7792
|
+
_this._gtag("event", optionsOrName, _this._toGtagOptions(params));
|
|
7793
|
+
} else {
|
|
7794
|
+
var action = optionsOrName.action,
|
|
7795
|
+
category = optionsOrName.category,
|
|
7796
|
+
label = optionsOrName.label,
|
|
7797
|
+
value = optionsOrName.value,
|
|
7798
|
+
nonInteraction = optionsOrName.nonInteraction,
|
|
7799
|
+
transport = optionsOrName.transport,
|
|
7800
|
+
rest = _objectWithoutProperties(optionsOrName, _excluded4);
|
|
7801
|
+
|
|
7802
|
+
if (!category || !action) {
|
|
7803
|
+
console.warn("args.category AND args.action are required in event()");
|
|
7804
|
+
return;
|
|
7805
|
+
} // Required Fields
|
|
7806
|
+
|
|
7807
|
+
|
|
7808
|
+
var fieldObject = {
|
|
7809
|
+
hitType: "event",
|
|
7810
|
+
eventCategory: (0, _format["default"])(category),
|
|
7811
|
+
eventAction: (0, _format["default"])(action)
|
|
7812
|
+
}; // Optional Fields
|
|
7813
|
+
|
|
7814
|
+
if (label) {
|
|
7815
|
+
fieldObject.eventLabel = (0, _format["default"])(label);
|
|
7816
|
+
}
|
|
7817
|
+
|
|
7818
|
+
if (typeof value !== "undefined") {
|
|
7819
|
+
if (typeof value !== "number") {
|
|
7820
|
+
console.warn("Expected `args.value` arg to be a Number.");
|
|
7821
|
+
} else {
|
|
7822
|
+
fieldObject.eventValue = value;
|
|
7823
|
+
}
|
|
7824
|
+
}
|
|
7825
|
+
|
|
7826
|
+
if (typeof nonInteraction !== "undefined") {
|
|
7827
|
+
if (typeof nonInteraction !== "boolean") {
|
|
7828
|
+
console.warn("`args.nonInteraction` must be a boolean.");
|
|
7829
|
+
} else {
|
|
7830
|
+
fieldObject.nonInteraction = nonInteraction;
|
|
7831
|
+
}
|
|
7832
|
+
}
|
|
7833
|
+
|
|
7834
|
+
if (typeof transport !== "undefined") {
|
|
7835
|
+
if (typeof transport !== "string") {
|
|
7836
|
+
console.warn("`args.transport` must be a string.");
|
|
7837
|
+
} else {
|
|
7838
|
+
if (["beacon", "xhr", "image"].indexOf(transport) === -1) {
|
|
7839
|
+
console.warn("`args.transport` must be either one of these values: `beacon`, `xhr` or `image`");
|
|
7840
|
+
}
|
|
7841
|
+
|
|
7842
|
+
fieldObject.transport = transport;
|
|
7843
|
+
}
|
|
7844
|
+
}
|
|
7845
|
+
|
|
7846
|
+
Object.keys(rest).filter(function (key) {
|
|
7847
|
+
return key.substr(0, "dimension".length) === "dimension";
|
|
7848
|
+
}).forEach(function (key) {
|
|
7849
|
+
fieldObject[key] = rest[key];
|
|
7850
|
+
});
|
|
7851
|
+
Object.keys(rest).filter(function (key) {
|
|
7852
|
+
return key.substr(0, "metric".length) === "metric";
|
|
7853
|
+
}).forEach(function (key) {
|
|
7854
|
+
fieldObject[key] = rest[key];
|
|
7855
|
+
});
|
|
7856
|
+
|
|
7857
|
+
_this._gaCommand("send", fieldObject);
|
|
7858
|
+
}
|
|
7859
|
+
});
|
|
7860
|
+
|
|
7861
|
+
_defineProperty(this, "send", function (fieldObject) {
|
|
7862
|
+
_this._gaCommand("send", fieldObject);
|
|
7863
|
+
});
|
|
7864
|
+
|
|
7865
|
+
_defineProperty(this, "pageview", function (path, _, title) {
|
|
7866
|
+
var pathTrim = path === null || path === void 0 ? void 0 : path.trim();
|
|
7867
|
+
|
|
7868
|
+
if (pathTrim === "") {
|
|
7869
|
+
console.warn("path cannot be an empty string in .pageview()");
|
|
7870
|
+
return;
|
|
7871
|
+
}
|
|
7872
|
+
|
|
7873
|
+
_this._gaCommand("send", "pageview", pathTrim, {
|
|
7874
|
+
title: title
|
|
7875
|
+
});
|
|
7876
|
+
});
|
|
7877
|
+
|
|
7878
|
+
this.reset();
|
|
7235
7879
|
}
|
|
7236
|
-
}
|
|
7237
7880
|
|
|
7881
|
+
_createClass(GA4, [{
|
|
7882
|
+
key: "gtag",
|
|
7883
|
+
value: function gtag() {
|
|
7884
|
+
this._gtag.apply(this, arguments);
|
|
7885
|
+
}
|
|
7886
|
+
}, {
|
|
7887
|
+
key: "_appendCustomMap",
|
|
7888
|
+
value: function _appendCustomMap(options) {
|
|
7889
|
+
var legacyDimensionMetric = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
7890
|
+
|
|
7891
|
+
if (!legacyDimensionMetric) {
|
|
7892
|
+
return options;
|
|
7893
|
+
}
|
|
7894
|
+
|
|
7895
|
+
if (!options.custom_map) {
|
|
7896
|
+
options.custom_map = {};
|
|
7897
|
+
}
|
|
7898
|
+
|
|
7899
|
+
for (var i = 1; i <= 200; i++) {
|
|
7900
|
+
if (!options.custom_map["dimension".concat(i)]) {
|
|
7901
|
+
options.custom_map["dimension".concat(i)] = "dimension".concat(i);
|
|
7902
|
+
}
|
|
7903
|
+
|
|
7904
|
+
if (!options.custom_map["metric".concat(i)]) {
|
|
7905
|
+
options.custom_map["metric".concat(i)] = "metric".concat(i);
|
|
7906
|
+
}
|
|
7907
|
+
}
|
|
7908
|
+
|
|
7909
|
+
return options;
|
|
7910
|
+
}
|
|
7911
|
+
/**
|
|
7912
|
+
* @since v1.0.2
|
|
7913
|
+
* @param {string} [path="location.href"]
|
|
7914
|
+
* @param {string[]} [_] unsupported
|
|
7915
|
+
* @param {string} [title="location.pathname"]
|
|
7916
|
+
* @deprecated Use `.send("pageview")` instead
|
|
7917
|
+
*/
|
|
7918
|
+
|
|
7919
|
+
}, {
|
|
7920
|
+
key: "outboundLink",
|
|
7921
|
+
value:
|
|
7922
|
+
/**
|
|
7923
|
+
* @since v1.0.6
|
|
7924
|
+
* @param {Object} options
|
|
7925
|
+
* @param {string} options.label
|
|
7926
|
+
* @param {function} hitCallback
|
|
7927
|
+
* @deprecated Use `enhanced measurement` feature in Google Analytics.
|
|
7928
|
+
*/
|
|
7929
|
+
function outboundLink(_ref3, hitCallback) {
|
|
7930
|
+
var label = _ref3.label;
|
|
7931
|
+
|
|
7932
|
+
if (typeof hitCallback !== "function") {
|
|
7933
|
+
console.warn("hitCallback function is required");
|
|
7934
|
+
return;
|
|
7935
|
+
}
|
|
7936
|
+
|
|
7937
|
+
if (!label) {
|
|
7938
|
+
console.warn("args.label is required in outboundLink()");
|
|
7939
|
+
return;
|
|
7940
|
+
} // Required Fields
|
|
7941
|
+
|
|
7942
|
+
|
|
7943
|
+
var fieldObject = {
|
|
7944
|
+
hitType: "event",
|
|
7945
|
+
eventCategory: "Outbound",
|
|
7946
|
+
eventAction: "Click",
|
|
7947
|
+
eventLabel: (0, _format["default"])(label)
|
|
7948
|
+
};
|
|
7949
|
+
var safetyCallbackCalled = false;
|
|
7950
|
+
|
|
7951
|
+
var safetyCallback = function safetyCallback() {
|
|
7952
|
+
// This prevents a delayed response from GA
|
|
7953
|
+
// causing hitCallback from being fired twice
|
|
7954
|
+
safetyCallbackCalled = true;
|
|
7955
|
+
hitCallback();
|
|
7956
|
+
}; // Using a timeout to ensure the execution of critical application code
|
|
7957
|
+
// in the case when the GA server might be down
|
|
7958
|
+
// or an ad blocker prevents sending the data
|
|
7959
|
+
// register safety net timeout:
|
|
7960
|
+
|
|
7961
|
+
|
|
7962
|
+
var t = setTimeout(safetyCallback, 250);
|
|
7963
|
+
|
|
7964
|
+
var clearableCallbackForGA = function clearableCallbackForGA() {
|
|
7965
|
+
clearTimeout(t);
|
|
7966
|
+
|
|
7967
|
+
if (!safetyCallbackCalled) {
|
|
7968
|
+
hitCallback();
|
|
7969
|
+
}
|
|
7970
|
+
};
|
|
7971
|
+
|
|
7972
|
+
fieldObject.hitCallback = clearableCallbackForGA;
|
|
7973
|
+
|
|
7974
|
+
this._gaCommand("send", fieldObject);
|
|
7975
|
+
}
|
|
7976
|
+
}]);
|
|
7977
|
+
|
|
7978
|
+
return GA4;
|
|
7979
|
+
}();
|
|
7980
|
+
|
|
7981
|
+
exports.GA4 = GA4;
|
|
7982
|
+
|
|
7983
|
+
var _default = new GA4();
|
|
7984
|
+
|
|
7985
|
+
exports["default"] = _default;
|
|
7986
|
+
});
|
|
7987
|
+
|
|
7988
|
+
unwrapExports(ga4);
|
|
7989
|
+
ga4.GA4;
|
|
7990
|
+
|
|
7991
|
+
var dist = createCommonjsModule(function (module, exports) {
|
|
7992
|
+
|
|
7993
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
7994
|
+
|
|
7995
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7996
|
+
value: true
|
|
7997
|
+
});
|
|
7998
|
+
exports["default"] = exports.ReactGAImplementation = void 0;
|
|
7999
|
+
|
|
8000
|
+
var _ga = _interopRequireWildcard(ga4);
|
|
8001
|
+
|
|
8002
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
8003
|
+
|
|
8004
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
8005
|
+
|
|
8006
|
+
var ReactGAImplementation = _ga.GA4;
|
|
8007
|
+
exports.ReactGAImplementation = ReactGAImplementation;
|
|
8008
|
+
var _default = _ga["default"];
|
|
8009
|
+
exports["default"] = _default;
|
|
8010
|
+
});
|
|
8011
|
+
|
|
8012
|
+
var ReactGA4 = unwrapExports(dist);
|
|
8013
|
+
dist.ReactGAImplementation;
|
|
8014
|
+
|
|
8015
|
+
var _window$d, _window$Pelcro$d, _window$Pelcro$uiSett$d;
|
|
8016
|
+
const ReactGA$d = (_window$d = window) !== null && _window$d !== void 0 && (_window$Pelcro$d = _window$d.Pelcro) !== null && _window$Pelcro$d !== void 0 && (_window$Pelcro$uiSett$d = _window$Pelcro$d.uiSettings) !== null && _window$Pelcro$uiSett$d !== void 0 && _window$Pelcro$uiSett$d.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
7238
8017
|
class PelcroActions {
|
|
7239
8018
|
constructor(storeSetter, storeGetter) {
|
|
7240
8019
|
_defineProperty$3(this, "resetState", () => {
|
|
@@ -7449,7 +8228,7 @@ class PelcroActions {
|
|
|
7449
8228
|
}
|
|
7450
8229
|
|
|
7451
8230
|
window.Pelcro.user.logout();
|
|
7452
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
8231
|
+
ReactGA$d === null || ReactGA$d === void 0 ? void 0 : (_ReactGA$event = ReactGA$d.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$d, {
|
|
7453
8232
|
category: "ACTIONS",
|
|
7454
8233
|
action: "Logged out",
|
|
7455
8234
|
nonInteraction: true
|
|
@@ -7698,6 +8477,8 @@ if (process.env.NODE_ENV === "development") {
|
|
|
7698
8477
|
c$1("Pelcro Store", usePelcro);
|
|
7699
8478
|
}
|
|
7700
8479
|
|
|
8480
|
+
var _window$c, _window$Pelcro$c, _window$Pelcro$uiSett$c;
|
|
8481
|
+
const ReactGA$c = (_window$c = window) !== null && _window$c !== void 0 && (_window$Pelcro$c = _window$c.Pelcro) !== null && _window$Pelcro$c !== void 0 && (_window$Pelcro$uiSett$c = _window$Pelcro$c.uiSettings) !== null && _window$Pelcro$uiSett$c !== void 0 && _window$Pelcro$uiSett$c.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
7701
8482
|
/**
|
|
7702
8483
|
* List of zero-decimal currencies.
|
|
7703
8484
|
* @see https://stripe.com/docs/currencies#zero-decimal
|
|
@@ -7779,9 +8560,9 @@ const getLanguageWithoutRegion = localeName => {
|
|
|
7779
8560
|
*/
|
|
7780
8561
|
|
|
7781
8562
|
const getPageOrDefaultLanguage = () => {
|
|
7782
|
-
var _window$Pelcro$helper, _window$
|
|
8563
|
+
var _window$Pelcro$helper, _window$Pelcro2, _window$Pelcro2$site, _window$Pelcro2$site$, _window$Pelcro2$site$2;
|
|
7783
8564
|
|
|
7784
|
-
return (_window$Pelcro$helper = window.Pelcro.helpers.getHtmlLanguageAttribute()) !== null && _window$Pelcro$helper !== void 0 ? _window$Pelcro$helper : getLanguageWithoutRegion((_window$
|
|
8565
|
+
return (_window$Pelcro$helper = window.Pelcro.helpers.getHtmlLanguageAttribute()) !== null && _window$Pelcro$helper !== void 0 ? _window$Pelcro$helper : getLanguageWithoutRegion((_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$site = _window$Pelcro2.site) === null || _window$Pelcro2$site === void 0 ? void 0 : (_window$Pelcro2$site$ = _window$Pelcro2$site.read) === null || _window$Pelcro2$site$ === void 0 ? void 0 : (_window$Pelcro2$site$2 = _window$Pelcro2$site$.call(_window$Pelcro2$site)) === null || _window$Pelcro2$site$2 === void 0 ? void 0 : _window$Pelcro2$site$2.default_locale);
|
|
7785
8566
|
};
|
|
7786
8567
|
/**
|
|
7787
8568
|
* Returns a formatted price string depending on locale
|
|
@@ -7836,10 +8617,10 @@ const isValidViewFromURL = viewID => {
|
|
|
7836
8617
|
*/
|
|
7837
8618
|
|
|
7838
8619
|
function hasValidNewsletterUpdateUrl() {
|
|
7839
|
-
var _window$
|
|
8620
|
+
var _window$Pelcro3, _window$Pelcro3$uiSet;
|
|
7840
8621
|
|
|
7841
8622
|
if (viewID !== "newsletter-update") return false;
|
|
7842
|
-
const newsletters = (_window$
|
|
8623
|
+
const newsletters = (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$uiSet = _window$Pelcro3.uiSettings) === null || _window$Pelcro3$uiSet === void 0 ? void 0 : _window$Pelcro3$uiSet.newsletters;
|
|
7843
8624
|
const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
|
|
7844
8625
|
|
|
7845
8626
|
if (!siteHasNewslettersDefined) {
|
|
@@ -7916,16 +8697,16 @@ const trackSubscriptionOnGA = () => {
|
|
|
7916
8697
|
}
|
|
7917
8698
|
|
|
7918
8699
|
const currencyCode = (_window$Pelcro$user$r5 = (_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.currency) !== null && _window$Pelcro$user$r5 !== void 0 ? _window$Pelcro$user$r5 : plan.currency;
|
|
7919
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$set = ReactGA.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA, {
|
|
8700
|
+
ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$set = ReactGA$c.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA$c, {
|
|
7920
8701
|
currencyCode: currencyCode
|
|
7921
8702
|
});
|
|
7922
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin = ReactGA.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$execu = _ReactGA$plugin.execute) === null || _ReactGA$plugin$execu === void 0 ? void 0 : _ReactGA$plugin$execu.call(_ReactGA$plugin, "ecommerce", "addTransaction", {
|
|
8703
|
+
ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$plugin = ReactGA$c.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$execu = _ReactGA$plugin.execute) === null || _ReactGA$plugin$execu === void 0 ? void 0 : _ReactGA$plugin$execu.call(_ReactGA$plugin, "ecommerce", "addTransaction", {
|
|
7923
8704
|
id: lastSubscriptionId,
|
|
7924
8705
|
affiliation: "Pelcro",
|
|
7925
8706
|
revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
|
|
7926
8707
|
coupon: couponCode
|
|
7927
8708
|
});
|
|
7928
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin2 = ReactGA.plugin) === null || _ReactGA$plugin2 === void 0 ? void 0 : (_ReactGA$plugin2$exec = _ReactGA$plugin2.execute) === null || _ReactGA$plugin2$exec === void 0 ? void 0 : _ReactGA$plugin2$exec.call(_ReactGA$plugin2, "ecommerce", "addItem", {
|
|
8709
|
+
ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$plugin2 = ReactGA$c.plugin) === null || _ReactGA$plugin2 === void 0 ? void 0 : (_ReactGA$plugin2$exec = _ReactGA$plugin2.execute) === null || _ReactGA$plugin2$exec === void 0 ? void 0 : _ReactGA$plugin2$exec.call(_ReactGA$plugin2, "ecommerce", "addItem", {
|
|
7929
8710
|
id: lastSubscriptionId,
|
|
7930
8711
|
name: product.name,
|
|
7931
8712
|
category: product.description,
|
|
@@ -7933,8 +8714,8 @@ const trackSubscriptionOnGA = () => {
|
|
|
7933
8714
|
price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
|
|
7934
8715
|
quantity: 1
|
|
7935
8716
|
});
|
|
7936
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin3 = ReactGA.plugin) === null || _ReactGA$plugin3 === void 0 ? void 0 : (_ReactGA$plugin3$exec = _ReactGA$plugin3.execute) === null || _ReactGA$plugin3$exec === void 0 ? void 0 : _ReactGA$plugin3$exec.call(_ReactGA$plugin3, "ecommerce", "send");
|
|
7937
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
8717
|
+
ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$plugin3 = ReactGA$c.plugin) === null || _ReactGA$plugin3 === void 0 ? void 0 : (_ReactGA$plugin3$exec = _ReactGA$plugin3.execute) === null || _ReactGA$plugin3$exec === void 0 ? void 0 : _ReactGA$plugin3$exec.call(_ReactGA$plugin3, "ecommerce", "send");
|
|
8718
|
+
ReactGA$c === null || ReactGA$c === void 0 ? void 0 : (_ReactGA$event = ReactGA$c.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$c, {
|
|
7938
8719
|
category: "ACTIONS",
|
|
7939
8720
|
action: "Subscribed",
|
|
7940
8721
|
nonInteraction: true
|
|
@@ -8023,9 +8804,9 @@ function getDateWithoutTime(dateObject) {
|
|
|
8023
8804
|
return date;
|
|
8024
8805
|
}
|
|
8025
8806
|
function userMustVerifyEmail() {
|
|
8026
|
-
var _window$Pelcro$site$
|
|
8807
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
|
|
8027
8808
|
|
|
8028
|
-
const isEmailVerificationEnabled = (_window$Pelcro$site$
|
|
8809
|
+
const isEmailVerificationEnabled = (_window$Pelcro$site$r = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.email_verify_enabled) !== null && _window$Pelcro$site$r !== void 0 ? _window$Pelcro$site$r : false;
|
|
8029
8810
|
const isUserEmailVerified = (_window$Pelcro$user$r9 = (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.email_confirm) !== null && _window$Pelcro$user$r9 !== void 0 ? _window$Pelcro$user$r9 : false;
|
|
8030
8811
|
return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
|
|
8031
8812
|
}
|
|
@@ -8161,6 +8942,9 @@ function _classPrivateFieldGet(receiver, privateMap) {
|
|
|
8161
8942
|
return descriptor.value;
|
|
8162
8943
|
}
|
|
8163
8944
|
|
|
8945
|
+
var _window$b, _window$Pelcro$b, _window$Pelcro$uiSett$b;
|
|
8946
|
+
const ReactGA$b = (_window$b = window) !== null && _window$b !== void 0 && (_window$Pelcro$b = _window$b.Pelcro) !== null && _window$Pelcro$b !== void 0 && (_window$Pelcro$uiSett$b = _window$Pelcro$b.uiSettings) !== null && _window$Pelcro$uiSett$b !== void 0 && _window$Pelcro$uiSett$b.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
8947
|
+
|
|
8164
8948
|
var _isAlreadySaved = /*#__PURE__*/new WeakMap();
|
|
8165
8949
|
|
|
8166
8950
|
var _markButtonAsLoading = /*#__PURE__*/new WeakMap();
|
|
@@ -8319,7 +9103,7 @@ class SaveToMetadataButtonClass {
|
|
|
8319
9103
|
|
|
8320
9104
|
_classPrivateFieldGet(this, _markButtonAsSaved).call(this, button);
|
|
8321
9105
|
|
|
8322
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
9106
|
+
ReactGA$b === null || ReactGA$b === void 0 ? void 0 : (_ReactGA$event = ReactGA$b.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$b, {
|
|
8323
9107
|
category: "ACTIONS",
|
|
8324
9108
|
action: "Save/Follow",
|
|
8325
9109
|
label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
|
|
@@ -8357,7 +9141,7 @@ class SaveToMetadataButtonClass {
|
|
|
8357
9141
|
|
|
8358
9142
|
_classPrivateFieldGet(this, _unmarkSavedButton).call(this, button);
|
|
8359
9143
|
|
|
8360
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
|
|
9144
|
+
ReactGA$b === null || ReactGA$b === void 0 ? void 0 : (_ReactGA$event2 = ReactGA$b.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA$b, {
|
|
8361
9145
|
category: "ACTIONS",
|
|
8362
9146
|
action: "Unsave/Unfollow",
|
|
8363
9147
|
label: title
|
|
@@ -10025,6 +10809,8 @@ function getSiteCardProcessor() {
|
|
|
10025
10809
|
return "stripe";
|
|
10026
10810
|
}
|
|
10027
10811
|
|
|
10812
|
+
var _window$a, _window$Pelcro$a, _window$Pelcro$uiSett$a;
|
|
10813
|
+
const ReactGA$a = (_window$a = window) !== null && _window$a !== void 0 && (_window$Pelcro$a = _window$a.Pelcro) !== null && _window$Pelcro$a !== void 0 && (_window$Pelcro$uiSett$a = _window$Pelcro$a.uiSettings) !== null && _window$Pelcro$uiSett$a !== void 0 && _window$Pelcro$uiSett$a.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
10028
10814
|
/**
|
|
10029
10815
|
* @typedef {Object} OptionsType
|
|
10030
10816
|
* @property {boolean} loadPaymentSDKs
|
|
@@ -10159,13 +10945,13 @@ const initSecuritySdk = () => {
|
|
|
10159
10945
|
const initGATracking = () => {
|
|
10160
10946
|
var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
|
|
10161
10947
|
|
|
10162
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$initialize = ReactGA.initialize) === null || _ReactGA$initialize === void 0 ? void 0 : _ReactGA$initialize.call(ReactGA, window.Pelcro.site.read().google_analytics_id);
|
|
10163
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin = ReactGA.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$requi = _ReactGA$plugin.require) === null || _ReactGA$plugin$requi === void 0 ? void 0 : _ReactGA$plugin$requi.call(_ReactGA$plugin, "ecommerce");
|
|
10948
|
+
ReactGA$a === null || ReactGA$a === void 0 ? void 0 : (_ReactGA$initialize = ReactGA$a.initialize) === null || _ReactGA$initialize === void 0 ? void 0 : _ReactGA$initialize.call(ReactGA$a, window.Pelcro.site.read().google_analytics_id);
|
|
10949
|
+
ReactGA$a === null || ReactGA$a === void 0 ? void 0 : (_ReactGA$plugin = ReactGA$a.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$requi = _ReactGA$plugin.require) === null || _ReactGA$plugin$requi === void 0 ? void 0 : _ReactGA$plugin$requi.call(_ReactGA$plugin, "ecommerce");
|
|
10164
10950
|
};
|
|
10165
10951
|
const dispatchModalDisplayEvents = modalName => {
|
|
10166
10952
|
var _ReactGA$event, _modalName$replace, _modalName$replace2;
|
|
10167
10953
|
|
|
10168
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
10954
|
+
ReactGA$a === null || ReactGA$a === void 0 ? void 0 : (_ReactGA$event = ReactGA$a.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$a, {
|
|
10169
10955
|
category: "VIEWS",
|
|
10170
10956
|
action: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ")} viewed`,
|
|
10171
10957
|
nonInteraction: true
|
|
@@ -11306,12 +12092,14 @@ function ConfirmPassword({
|
|
|
11306
12092
|
}, otherProps));
|
|
11307
12093
|
}
|
|
11308
12094
|
|
|
12095
|
+
var _window$9, _window$Pelcro$9, _window$Pelcro$uiSett$9;
|
|
12096
|
+
const ReactGA$9 = (_window$9 = window) !== null && _window$9 !== void 0 && (_window$Pelcro$9 = _window$9.Pelcro) !== null && _window$Pelcro$9 !== void 0 && (_window$Pelcro$uiSett$9 = _window$Pelcro$9.uiSettings) !== null && _window$Pelcro$uiSett$9 !== void 0 && _window$Pelcro$uiSett$9.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
11309
12097
|
const Logout = props => {
|
|
11310
12098
|
const handleLogout = () => {
|
|
11311
12099
|
var _ReactGA$event;
|
|
11312
12100
|
|
|
11313
12101
|
window.Pelcro.user.logout();
|
|
11314
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
12102
|
+
ReactGA$9 === null || ReactGA$9 === void 0 ? void 0 : (_ReactGA$event = ReactGA$9.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$9, {
|
|
11315
12103
|
category: "ACTIONS",
|
|
11316
12104
|
action: "Logged out",
|
|
11317
12105
|
nonInteraction: true
|
|
@@ -12851,6 +13639,8 @@ const RegisterCompany = props => {
|
|
|
12851
13639
|
}, props));
|
|
12852
13640
|
};
|
|
12853
13641
|
|
|
13642
|
+
var _window$8, _window$Pelcro$8, _window$Pelcro$uiSett$8;
|
|
13643
|
+
const ReactGA$8 = (_window$8 = window) !== null && _window$8 !== void 0 && (_window$Pelcro$8 = _window$8.Pelcro) !== null && _window$Pelcro$8 !== void 0 && (_window$Pelcro$uiSett$8 = _window$Pelcro$8.uiSettings) !== null && _window$Pelcro$uiSett$8 !== void 0 && _window$Pelcro$uiSett$8.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
12854
13644
|
/**
|
|
12855
13645
|
*
|
|
12856
13646
|
*/
|
|
@@ -12882,7 +13672,7 @@ function RegisterModal(props) {
|
|
|
12882
13672
|
const handleAfterRegistrationLogic = () => {
|
|
12883
13673
|
var _ReactGA$event, _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
12884
13674
|
|
|
12885
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
13675
|
+
ReactGA$8 === null || ReactGA$8 === void 0 ? void 0 : (_ReactGA$event = ReactGA$8.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$8, {
|
|
12886
13676
|
category: "ACTIONS",
|
|
12887
13677
|
action: "Registered",
|
|
12888
13678
|
nonInteraction: true
|
|
@@ -14416,6 +15206,8 @@ function SvgArrowLeft(props) {
|
|
|
14416
15206
|
})));
|
|
14417
15207
|
}
|
|
14418
15208
|
|
|
15209
|
+
var _window$7, _window$Pelcro$7, _window$Pelcro$uiSett$7;
|
|
15210
|
+
const ReactGA$7 = (_window$7 = window) !== null && _window$7 !== void 0 && (_window$Pelcro$7 = _window$7.Pelcro) !== null && _window$Pelcro$7 !== void 0 && (_window$Pelcro$uiSett$7 = _window$Pelcro$7.uiSettings) !== null && _window$Pelcro$uiSett$7 !== void 0 && _window$Pelcro$uiSett$7.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
14419
15211
|
/**
|
|
14420
15212
|
*
|
|
14421
15213
|
*/
|
|
@@ -14850,7 +15642,7 @@ class SelectModal extends Component {
|
|
|
14850
15642
|
if (this.state.mode === "product") {
|
|
14851
15643
|
var _ReactGA$event;
|
|
14852
15644
|
|
|
14853
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
15645
|
+
ReactGA$7 === null || ReactGA$7 === void 0 ? void 0 : (_ReactGA$event = ReactGA$7.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$7, {
|
|
14854
15646
|
category: "VIEWS",
|
|
14855
15647
|
action: "Product Modal Viewed",
|
|
14856
15648
|
nonInteraction: true
|
|
@@ -14858,7 +15650,7 @@ class SelectModal extends Component {
|
|
|
14858
15650
|
} else if (this.state.mode === "plan") {
|
|
14859
15651
|
var _ReactGA$event2;
|
|
14860
15652
|
|
|
14861
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
|
|
15653
|
+
ReactGA$7 === null || ReactGA$7 === void 0 ? void 0 : (_ReactGA$event2 = ReactGA$7.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA$7, {
|
|
14862
15654
|
category: "VIEWS",
|
|
14863
15655
|
action: "Plan Modal Viewed",
|
|
14864
15656
|
nonInteraction: true
|
|
@@ -19638,6 +20430,8 @@ const SubscriptionRenewView = ({
|
|
|
19638
20430
|
}));
|
|
19639
20431
|
};
|
|
19640
20432
|
|
|
20433
|
+
var _window$6, _window$Pelcro$6, _window$Pelcro$uiSett$6;
|
|
20434
|
+
const ReactGA$6 = (_window$6 = window) !== null && _window$6 !== void 0 && (_window$Pelcro$6 = _window$6.Pelcro) !== null && _window$Pelcro$6 !== void 0 && (_window$Pelcro$uiSett$6 = _window$Pelcro$6.uiSettings) !== null && _window$Pelcro$uiSett$6 !== void 0 && _window$Pelcro$uiSett$6.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
19641
20435
|
/**
|
|
19642
20436
|
*
|
|
19643
20437
|
*/
|
|
@@ -19658,7 +20452,7 @@ function SubscriptionRenewModal({
|
|
|
19658
20452
|
var _otherProps$onSuccess, _ReactGA$event;
|
|
19659
20453
|
|
|
19660
20454
|
(_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
|
|
19661
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
20455
|
+
ReactGA$6 === null || ReactGA$6 === void 0 ? void 0 : (_ReactGA$event = ReactGA$6.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$6, {
|
|
19662
20456
|
category: "ACTIONS",
|
|
19663
20457
|
action: "Renewed",
|
|
19664
20458
|
nonInteraction: true
|
|
@@ -19670,7 +20464,7 @@ function SubscriptionRenewModal({
|
|
|
19670
20464
|
var _otherProps$onGiftRen, _ReactGA$event2;
|
|
19671
20465
|
|
|
19672
20466
|
(_otherProps$onGiftRen = otherProps.onGiftRenewalSuccess) === null || _otherProps$onGiftRen === void 0 ? void 0 : _otherProps$onGiftRen.call(otherProps);
|
|
19673
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
|
|
20467
|
+
ReactGA$6 === null || ReactGA$6 === void 0 ? void 0 : (_ReactGA$event2 = ReactGA$6.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA$6, {
|
|
19674
20468
|
category: "ACTIONS",
|
|
19675
20469
|
action: "Renewed Gift",
|
|
19676
20470
|
nonInteraction: true
|
|
@@ -19854,6 +20648,8 @@ function SvgSubscription(props) {
|
|
|
19854
20648
|
}))))));
|
|
19855
20649
|
}
|
|
19856
20650
|
|
|
20651
|
+
var _window$5, _window$Pelcro$5, _window$Pelcro$uiSett$5;
|
|
20652
|
+
const ReactGA$5 = (_window$5 = window) !== null && _window$5 !== void 0 && (_window$Pelcro$5 = _window$5.Pelcro) !== null && _window$Pelcro$5 !== void 0 && (_window$Pelcro$uiSett$5 = _window$Pelcro$5.uiSettings) !== null && _window$Pelcro$uiSett$5 !== void 0 && _window$Pelcro$uiSett$5.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
19857
20653
|
const SubscriptionCancelNowButton = ({
|
|
19858
20654
|
subscription,
|
|
19859
20655
|
onClick,
|
|
@@ -19887,7 +20683,7 @@ const SubscriptionCancelNowButton = ({
|
|
|
19887
20683
|
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
19888
20684
|
}
|
|
19889
20685
|
|
|
19890
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
20686
|
+
ReactGA$5 === null || ReactGA$5 === void 0 ? void 0 : (_ReactGA$event = ReactGA$5.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$5, {
|
|
19891
20687
|
category: "ACTIONS",
|
|
19892
20688
|
action: "Canceled",
|
|
19893
20689
|
nonInteraction: true
|
|
@@ -19926,6 +20722,8 @@ const SubscriptionCancelNowButton = ({
|
|
|
19926
20722
|
}, t("messages.cancelNow"));
|
|
19927
20723
|
};
|
|
19928
20724
|
|
|
20725
|
+
var _window$4, _window$Pelcro$4, _window$Pelcro$uiSett$4;
|
|
20726
|
+
const ReactGA$4 = (_window$4 = window) !== null && _window$4 !== void 0 && (_window$Pelcro$4 = _window$4.Pelcro) !== null && _window$Pelcro$4 !== void 0 && (_window$Pelcro$uiSett$4 = _window$Pelcro$4.uiSettings) !== null && _window$Pelcro$uiSett$4 !== void 0 && _window$Pelcro$uiSett$4.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
19929
20727
|
const SubscriptionCancelLaterButton = ({
|
|
19930
20728
|
subscription,
|
|
19931
20729
|
onClick,
|
|
@@ -19959,7 +20757,7 @@ const SubscriptionCancelLaterButton = ({
|
|
|
19959
20757
|
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
19960
20758
|
}
|
|
19961
20759
|
|
|
19962
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
20760
|
+
ReactGA$4 === null || ReactGA$4 === void 0 ? void 0 : (_ReactGA$event = ReactGA$4.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$4, {
|
|
19963
20761
|
category: "ACTIONS",
|
|
19964
20762
|
action: "Canceled",
|
|
19965
20763
|
nonInteraction: true
|
|
@@ -20174,6 +20972,8 @@ const SubscriptionSuspendDate = props => {
|
|
|
20174
20972
|
}, props));
|
|
20175
20973
|
};
|
|
20176
20974
|
|
|
20975
|
+
var _window$3, _window$Pelcro$3, _window$Pelcro$uiSett$3;
|
|
20976
|
+
const ReactGA$3 = (_window$3 = window) !== null && _window$3 !== void 0 && (_window$Pelcro$3 = _window$3.Pelcro) !== null && _window$Pelcro$3 !== void 0 && (_window$Pelcro$uiSett$3 = _window$Pelcro$3.uiSettings) !== null && _window$Pelcro$uiSett$3 !== void 0 && _window$Pelcro$uiSett$3.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
20177
20977
|
const SubscriptionSuspendButton = ({
|
|
20178
20978
|
subscription,
|
|
20179
20979
|
onClick,
|
|
@@ -20206,7 +21006,7 @@ const SubscriptionSuspendButton = ({
|
|
|
20206
21006
|
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
20207
21007
|
}
|
|
20208
21008
|
|
|
20209
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
21009
|
+
ReactGA$3 === null || ReactGA$3 === void 0 ? void 0 : (_ReactGA$event = ReactGA$3.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$3, {
|
|
20210
21010
|
category: "ACTIONS",
|
|
20211
21011
|
action: "Suspended",
|
|
20212
21012
|
nonInteraction: true
|
|
@@ -23111,6 +23911,8 @@ function PaymentMethodUpdateView(props) {
|
|
|
23111
23911
|
}));
|
|
23112
23912
|
}
|
|
23113
23913
|
|
|
23914
|
+
var _window$2, _window$Pelcro$2, _window$Pelcro$uiSett$2;
|
|
23915
|
+
const ReactGA$2 = (_window$2 = window) !== null && _window$2 !== void 0 && (_window$Pelcro$2 = _window$2.Pelcro) !== null && _window$Pelcro$2 !== void 0 && (_window$Pelcro$uiSett$2 = _window$Pelcro$2.uiSettings) !== null && _window$Pelcro$uiSett$2 !== void 0 && _window$Pelcro$uiSett$2.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
23114
23916
|
const PaymentMethodUpdateModal = props => {
|
|
23115
23917
|
const {
|
|
23116
23918
|
t
|
|
@@ -23120,7 +23922,7 @@ const PaymentMethodUpdateModal = props => {
|
|
|
23120
23922
|
var _props$onSuccess, _ReactGA$event;
|
|
23121
23923
|
|
|
23122
23924
|
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
|
|
23123
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
23925
|
+
ReactGA$2 === null || ReactGA$2 === void 0 ? void 0 : (_ReactGA$event = ReactGA$2.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$2, {
|
|
23124
23926
|
category: "ACTIONS",
|
|
23125
23927
|
action: "Updated payment card",
|
|
23126
23928
|
nonInteraction: true
|
|
@@ -27205,6 +28007,8 @@ const Card = ({
|
|
|
27205
28007
|
})), children);
|
|
27206
28008
|
};
|
|
27207
28009
|
|
|
28010
|
+
var _window$1, _window$Pelcro$1, _window$Pelcro$uiSett$1;
|
|
28011
|
+
const ReactGA$1 = (_window$1 = window) !== null && _window$1 !== void 0 && (_window$Pelcro$1 = _window$1.Pelcro) !== null && _window$Pelcro$1 !== void 0 && (_window$Pelcro$uiSett$1 = _window$Pelcro$1.uiSettings) !== null && _window$Pelcro$uiSett$1 !== void 0 && _window$Pelcro$uiSett$1.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
27208
28012
|
const SavedItemsMenu = () => {
|
|
27209
28013
|
const {
|
|
27210
28014
|
t
|
|
@@ -27255,7 +28059,7 @@ const SavedItems = ({
|
|
|
27255
28059
|
}
|
|
27256
28060
|
|
|
27257
28061
|
setItems(response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.metadata);
|
|
27258
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
28062
|
+
ReactGA$1 === null || ReactGA$1 === void 0 ? void 0 : (_ReactGA$event = ReactGA$1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$1, {
|
|
27259
28063
|
category: "ACTIONS",
|
|
27260
28064
|
action: "Unsave/Unfollow",
|
|
27261
28065
|
label: title
|
|
@@ -29934,6 +30738,8 @@ const NewsLettersItems = ({
|
|
|
29934
30738
|
});
|
|
29935
30739
|
};
|
|
29936
30740
|
|
|
30741
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
30742
|
+
const ReactGA = (_window = window) !== null && _window !== void 0 && (_window$Pelcro = _window.Pelcro) !== null && _window$Pelcro !== void 0 && (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) !== null && _window$Pelcro$uiSett !== void 0 && _window$Pelcro$uiSett.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
29937
30743
|
const SUB_MENUS = {
|
|
29938
30744
|
PROFILE: "profile",
|
|
29939
30745
|
QRCODE: "qr-code",
|
|
@@ -30301,14 +31107,14 @@ class Dashboard extends Component {
|
|
|
30301
31107
|
}
|
|
30302
31108
|
|
|
30303
31109
|
render() {
|
|
30304
|
-
var _window$Pelcro$user$r3, _window$
|
|
31110
|
+
var _window$Pelcro$user$r3, _window$Pelcro2, _window$Pelcro2$uiSet;
|
|
30305
31111
|
|
|
30306
31112
|
const {
|
|
30307
31113
|
isOpen
|
|
30308
31114
|
} = this.state;
|
|
30309
31115
|
const userHasName = this.user.first_name || this.user.last_name;
|
|
30310
31116
|
const profilePicture = (_window$Pelcro$user$r3 = window.Pelcro.user.read().profile_photo) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : userSolidIcon;
|
|
30311
|
-
const newsletters = (_window$
|
|
31117
|
+
const newsletters = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$uiSet = _window$Pelcro2.uiSettings) === null || _window$Pelcro2$uiSet === void 0 ? void 0 : _window$Pelcro2$uiSet.newsletters;
|
|
30312
31118
|
Array.isArray(newsletters) && newsletters.length > 0;
|
|
30313
31119
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Transition, {
|
|
30314
31120
|
className: "plc-fixed plc-inset-y-0 plc-left-0 plc-h-full lg:plc-w-3/12 plc-w-full plc-overflow-y-auto plc-text-left plc-bg-white plc-shadow-xl plc-z-max",
|