@pelcro/react-pelcro-js 4.0.0-alpha.1 → 4.0.0-alpha.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/index.cjs.js +867 -61
- package/dist/index.esm.js +867 -61
- package/dist/pelcro.css +112 -0
- package/package.json +2 -1
package/dist/index.cjs.js
CHANGED
|
@@ -6363,6 +6363,53 @@ function _defineProperty$3(obj, key, value) {
|
|
|
6363
6363
|
return obj;
|
|
6364
6364
|
}
|
|
6365
6365
|
|
|
6366
|
+
// Polyfill
|
|
6367
|
+
(() => {
|
|
6368
|
+
if (typeof window.CustomEvent === "function") return false;
|
|
6369
|
+
|
|
6370
|
+
function CustomEvent(event, params = {
|
|
6371
|
+
bubbles: false,
|
|
6372
|
+
cancelable: false,
|
|
6373
|
+
detail: undefined
|
|
6374
|
+
}) {
|
|
6375
|
+
const evt = document.createEvent("CustomEvent");
|
|
6376
|
+
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
|
|
6377
|
+
return evt;
|
|
6378
|
+
}
|
|
6379
|
+
|
|
6380
|
+
CustomEvent.prototype = window.Event.prototype;
|
|
6381
|
+
window.CustomEvent = CustomEvent;
|
|
6382
|
+
})();
|
|
6383
|
+
/**
|
|
6384
|
+
* Should fire when the cart is opened and expects the cartItems inside the card to be sent
|
|
6385
|
+
*/
|
|
6386
|
+
|
|
6387
|
+
|
|
6388
|
+
const cartOpened = detail => createCustomEvent("PelcroElementsCartOpened", detail);
|
|
6389
|
+
/**
|
|
6390
|
+
* Should fire when an item added to the cart and expects the added item to be sent
|
|
6391
|
+
*/
|
|
6392
|
+
|
|
6393
|
+
const cartItemAdded = detail => createCustomEvent("PelcroElementsCartItemAdded", detail);
|
|
6394
|
+
/**
|
|
6395
|
+
* Should fire when an item removed from the cart and expects the removed item to be sent
|
|
6396
|
+
*/
|
|
6397
|
+
|
|
6398
|
+
const cartItemRemoved = detail => createCustomEvent("PelcroElementsCartItemRemoved", detail);
|
|
6399
|
+
/**
|
|
6400
|
+
* Check if the browser support custom events
|
|
6401
|
+
*/
|
|
6402
|
+
|
|
6403
|
+
function createCustomEvent(name, detail) {
|
|
6404
|
+
try {
|
|
6405
|
+
return new CustomEvent(name, {
|
|
6406
|
+
detail
|
|
6407
|
+
});
|
|
6408
|
+
} catch (e) {
|
|
6409
|
+
console.warn("Pelcro - Events are not supported in the browser");
|
|
6410
|
+
}
|
|
6411
|
+
}
|
|
6412
|
+
|
|
6366
6413
|
function warn(s) {
|
|
6367
6414
|
console.warn('[react-ga]', s);
|
|
6368
6415
|
}
|
|
@@ -7214,57 +7261,789 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
7214
7261
|
OutboundLink$1.origTrackLink = OutboundLink$1.trackLink;
|
|
7215
7262
|
OutboundLink$1.trackLink = outboundLink;
|
|
7216
7263
|
var OutboundLink = OutboundLink$1;
|
|
7217
|
-
var
|
|
7264
|
+
var ReactGA1 = _objectSpread({}, Defaults, {
|
|
7218
7265
|
OutboundLink: OutboundLink
|
|
7219
7266
|
});
|
|
7220
7267
|
|
|
7221
|
-
|
|
7222
|
-
(() => {
|
|
7223
|
-
if (typeof window.CustomEvent === "function") return false;
|
|
7268
|
+
var gtag_1 = createCommonjsModule(function (module, exports) {
|
|
7224
7269
|
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7270
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7271
|
+
value: true
|
|
7272
|
+
});
|
|
7273
|
+
exports["default"] = void 0;
|
|
7274
|
+
|
|
7275
|
+
var gtag = function gtag() {
|
|
7276
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
7277
|
+
args[_key] = arguments[_key];
|
|
7233
7278
|
}
|
|
7234
7279
|
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
})();
|
|
7238
|
-
/**
|
|
7239
|
-
* Should fire when the cart is opened and expects the cartItems inside the card to be sent
|
|
7240
|
-
*/
|
|
7280
|
+
if (typeof window !== "undefined") {
|
|
7281
|
+
var _window;
|
|
7241
7282
|
|
|
7283
|
+
if (typeof window.gtag === "undefined") {
|
|
7284
|
+
window.dataLayer = window.dataLayer || [];
|
|
7285
|
+
|
|
7286
|
+
window.gtag = function gtag() {
|
|
7287
|
+
window.dataLayer.push(arguments);
|
|
7288
|
+
};
|
|
7289
|
+
}
|
|
7290
|
+
|
|
7291
|
+
(_window = window).gtag.apply(_window, args);
|
|
7292
|
+
}
|
|
7293
|
+
};
|
|
7294
|
+
|
|
7295
|
+
var _default = gtag;
|
|
7296
|
+
exports["default"] = _default;
|
|
7297
|
+
});
|
|
7298
|
+
|
|
7299
|
+
unwrapExports(gtag_1);
|
|
7300
|
+
|
|
7301
|
+
var format_1 = createCommonjsModule(function (module, exports) {
|
|
7302
|
+
|
|
7303
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7304
|
+
value: true
|
|
7305
|
+
});
|
|
7306
|
+
exports["default"] = format;
|
|
7307
|
+
var smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i;
|
|
7308
|
+
|
|
7309
|
+
function toTitleCase(string) {
|
|
7310
|
+
return string.toString().trim().replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, function (match, index, title) {
|
|
7311
|
+
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) {
|
|
7312
|
+
return match.toLowerCase();
|
|
7313
|
+
}
|
|
7314
|
+
|
|
7315
|
+
if (match.substr(1).search(/[A-Z]|\../) > -1) {
|
|
7316
|
+
return match;
|
|
7317
|
+
}
|
|
7318
|
+
|
|
7319
|
+
return match.charAt(0).toUpperCase() + match.substr(1);
|
|
7320
|
+
});
|
|
7321
|
+
} // See if s could be an email address. We don't want to send personal data like email.
|
|
7322
|
+
// https://support.google.com/analytics/answer/2795983?hl=en
|
|
7323
|
+
|
|
7324
|
+
|
|
7325
|
+
function mightBeEmail(s) {
|
|
7326
|
+
// There's no point trying to validate rfc822 fully, just look for ...@...
|
|
7327
|
+
return typeof s === "string" && s.indexOf("@") !== -1;
|
|
7328
|
+
}
|
|
7329
|
+
|
|
7330
|
+
var redacted = "REDACTED (Potential Email Address)";
|
|
7331
|
+
|
|
7332
|
+
function redactEmail(string) {
|
|
7333
|
+
if (mightBeEmail(string)) {
|
|
7334
|
+
console.warn("This arg looks like an email address, redacting.");
|
|
7335
|
+
return redacted;
|
|
7336
|
+
}
|
|
7337
|
+
|
|
7338
|
+
return string;
|
|
7339
|
+
}
|
|
7340
|
+
|
|
7341
|
+
function format() {
|
|
7342
|
+
var s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
7343
|
+
var titleCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
7344
|
+
var redactingEmail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
7345
|
+
|
|
7346
|
+
var _str = s || "";
|
|
7347
|
+
|
|
7348
|
+
if (titleCase) {
|
|
7349
|
+
_str = toTitleCase(s);
|
|
7350
|
+
}
|
|
7351
|
+
|
|
7352
|
+
if (redactingEmail) {
|
|
7353
|
+
_str = redactEmail(_str);
|
|
7354
|
+
}
|
|
7355
|
+
|
|
7356
|
+
return _str;
|
|
7357
|
+
}
|
|
7358
|
+
});
|
|
7359
|
+
|
|
7360
|
+
unwrapExports(format_1);
|
|
7361
|
+
|
|
7362
|
+
var ga4 = createCommonjsModule(function (module, exports) {
|
|
7363
|
+
|
|
7364
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7365
|
+
value: true
|
|
7366
|
+
});
|
|
7367
|
+
exports["default"] = exports.GA4 = void 0;
|
|
7368
|
+
|
|
7369
|
+
var _gtag = _interopRequireDefault(gtag_1);
|
|
7370
|
+
|
|
7371
|
+
var _format = _interopRequireDefault(format_1);
|
|
7372
|
+
|
|
7373
|
+
var _excluded = ["eventCategory", "eventAction", "eventLabel", "eventValue", "hitType"],
|
|
7374
|
+
_excluded2 = ["title", "location"],
|
|
7375
|
+
_excluded3 = ["page", "hitType"],
|
|
7376
|
+
_excluded4 = ["action", "category", "label", "value", "nonInteraction", "transport"];
|
|
7377
|
+
|
|
7378
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
7379
|
+
|
|
7380
|
+
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; }
|
|
7381
|
+
|
|
7382
|
+
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; }
|
|
7383
|
+
|
|
7384
|
+
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); }
|
|
7385
|
+
|
|
7386
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
7387
|
+
|
|
7388
|
+
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."); }
|
|
7389
|
+
|
|
7390
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
7391
|
+
|
|
7392
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7393
|
+
|
|
7394
|
+
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; }
|
|
7395
|
+
|
|
7396
|
+
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; }
|
|
7397
|
+
|
|
7398
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7399
|
+
|
|
7400
|
+
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."); }
|
|
7401
|
+
|
|
7402
|
+
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); }
|
|
7403
|
+
|
|
7404
|
+
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; }
|
|
7405
|
+
|
|
7406
|
+
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; }
|
|
7407
|
+
|
|
7408
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7409
|
+
|
|
7410
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
7411
|
+
|
|
7412
|
+
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); } }
|
|
7413
|
+
|
|
7414
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
7415
|
+
|
|
7416
|
+
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; }
|
|
7417
|
+
|
|
7418
|
+
/*
|
|
7419
|
+
Links
|
|
7420
|
+
https://developers.google.com/gtagjs/reference/api
|
|
7421
|
+
https://developers.google.com/tag-platform/gtagjs/reference
|
|
7422
|
+
*/
|
|
7242
7423
|
|
|
7243
|
-
const cartOpened = detail => createCustomEvent("PelcroElementsCartOpened", detail);
|
|
7244
7424
|
/**
|
|
7245
|
-
*
|
|
7425
|
+
* @typedef GaOptions
|
|
7426
|
+
* @type {Object}
|
|
7427
|
+
* @property {boolean} [cookieUpdate=true]
|
|
7428
|
+
* @property {number} [cookieExpires=63072000] Default two years
|
|
7429
|
+
* @property {string} [cookieDomain="auto"]
|
|
7430
|
+
* @property {string} [cookieFlags]
|
|
7431
|
+
* @property {string} [userId]
|
|
7432
|
+
* @property {string} [clientId]
|
|
7433
|
+
* @property {boolean} [anonymizeIp]
|
|
7434
|
+
* @property {string} [contentGroup1]
|
|
7435
|
+
* @property {string} [contentGroup2]
|
|
7436
|
+
* @property {string} [contentGroup3]
|
|
7437
|
+
* @property {string} [contentGroup4]
|
|
7438
|
+
* @property {string} [contentGroup5]
|
|
7439
|
+
* @property {boolean} [allowAdFeatures=true]
|
|
7440
|
+
* @property {boolean} [allowAdPersonalizationSignals]
|
|
7441
|
+
* @property {boolean} [nonInteraction]
|
|
7442
|
+
* @property {string} [page]
|
|
7246
7443
|
*/
|
|
7247
7444
|
|
|
7248
|
-
const cartItemAdded = detail => createCustomEvent("PelcroElementsCartItemAdded", detail);
|
|
7249
7445
|
/**
|
|
7250
|
-
*
|
|
7446
|
+
* @typedef UaEventOptions
|
|
7447
|
+
* @type {Object}
|
|
7448
|
+
* @property {string} action
|
|
7449
|
+
* @property {string} category
|
|
7450
|
+
* @property {string} [label]
|
|
7451
|
+
* @property {number} [value]
|
|
7452
|
+
* @property {boolean} [nonInteraction]
|
|
7453
|
+
* @property {('beacon'|'xhr'|'image')} [transport]
|
|
7251
7454
|
*/
|
|
7252
7455
|
|
|
7253
|
-
const cartItemRemoved = detail => createCustomEvent("PelcroElementsCartItemRemoved", detail);
|
|
7254
7456
|
/**
|
|
7255
|
-
*
|
|
7457
|
+
* @typedef InitOptions
|
|
7458
|
+
* @type {Object}
|
|
7459
|
+
* @property {string} trackingId
|
|
7460
|
+
* @property {GaOptions|any} [gaOptions]
|
|
7461
|
+
* @property {Object} [gtagOptions] New parameter
|
|
7256
7462
|
*/
|
|
7463
|
+
var GA4 = /*#__PURE__*/function () {
|
|
7464
|
+
function GA4() {
|
|
7465
|
+
var _this = this;
|
|
7257
7466
|
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7467
|
+
_classCallCheck(this, GA4);
|
|
7468
|
+
|
|
7469
|
+
_defineProperty(this, "reset", function () {
|
|
7470
|
+
_this.isInitialized = false;
|
|
7471
|
+
_this._testMode = false;
|
|
7472
|
+
_this._currentMeasurementId;
|
|
7473
|
+
_this._hasLoadedGA = false;
|
|
7474
|
+
_this._isQueuing = false;
|
|
7475
|
+
_this._queueGtag = [];
|
|
7262
7476
|
});
|
|
7263
|
-
|
|
7264
|
-
|
|
7477
|
+
|
|
7478
|
+
_defineProperty(this, "_gtag", function () {
|
|
7479
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
7480
|
+
args[_key] = arguments[_key];
|
|
7481
|
+
}
|
|
7482
|
+
|
|
7483
|
+
if (!_this._testMode) {
|
|
7484
|
+
if (_this._isQueuing) {
|
|
7485
|
+
_this._queueGtag.push(args);
|
|
7486
|
+
} else {
|
|
7487
|
+
_gtag["default"].apply(void 0, args);
|
|
7488
|
+
}
|
|
7489
|
+
} else {
|
|
7490
|
+
_this._queueGtag.push(args);
|
|
7491
|
+
}
|
|
7492
|
+
});
|
|
7493
|
+
|
|
7494
|
+
_defineProperty(this, "_loadGA", function (GA_MEASUREMENT_ID, nonce) {
|
|
7495
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
7496
|
+
return;
|
|
7497
|
+
}
|
|
7498
|
+
|
|
7499
|
+
if (!_this._hasLoadedGA) {
|
|
7500
|
+
// Global Site Tag (gtag.js) - Google Analytics
|
|
7501
|
+
var script = document.createElement("script");
|
|
7502
|
+
script.async = true;
|
|
7503
|
+
script.src = "https://www.googletagmanager.com/gtag/js?id=".concat(GA_MEASUREMENT_ID);
|
|
7504
|
+
|
|
7505
|
+
if (nonce) {
|
|
7506
|
+
script.setAttribute("nonce", nonce);
|
|
7507
|
+
}
|
|
7508
|
+
|
|
7509
|
+
document.body.appendChild(script);
|
|
7510
|
+
window.dataLayer = window.dataLayer || [];
|
|
7511
|
+
|
|
7512
|
+
window.gtag = function gtag() {
|
|
7513
|
+
window.dataLayer.push(arguments);
|
|
7514
|
+
};
|
|
7515
|
+
|
|
7516
|
+
_this._hasLoadedGA = true;
|
|
7517
|
+
}
|
|
7518
|
+
});
|
|
7519
|
+
|
|
7520
|
+
_defineProperty(this, "_toGtagOptions", function (gaOptions) {
|
|
7521
|
+
if (!gaOptions) {
|
|
7522
|
+
return;
|
|
7523
|
+
}
|
|
7524
|
+
|
|
7525
|
+
var mapFields = {
|
|
7526
|
+
// Old https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#cookieUpdate
|
|
7527
|
+
// New https://developers.google.com/analytics/devguides/collection/gtagjs/cookies-user-id#cookie_update
|
|
7528
|
+
cookieUpdate: "cookie_update",
|
|
7529
|
+
cookieExpires: "cookie_expires",
|
|
7530
|
+
cookieDomain: "cookie_domain",
|
|
7531
|
+
cookieFlags: "cookie_flags",
|
|
7532
|
+
// must be in set method?
|
|
7533
|
+
userId: "user_id",
|
|
7534
|
+
clientId: "client_id",
|
|
7535
|
+
anonymizeIp: "anonymize_ip",
|
|
7536
|
+
// https://support.google.com/analytics/answer/2853546?hl=en#zippy=%2Cin-this-article
|
|
7537
|
+
contentGroup1: "content_group1",
|
|
7538
|
+
contentGroup2: "content_group2",
|
|
7539
|
+
contentGroup3: "content_group3",
|
|
7540
|
+
contentGroup4: "content_group4",
|
|
7541
|
+
contentGroup5: "content_group5",
|
|
7542
|
+
// https://support.google.com/analytics/answer/9050852?hl=en
|
|
7543
|
+
allowAdFeatures: "allow_google_signals",
|
|
7544
|
+
allowAdPersonalizationSignals: "allow_ad_personalization_signals",
|
|
7545
|
+
nonInteraction: "non_interaction",
|
|
7546
|
+
page: "page_path",
|
|
7547
|
+
hitCallback: "event_callback"
|
|
7548
|
+
};
|
|
7549
|
+
var gtagOptions = Object.entries(gaOptions).reduce(function (prev, _ref) {
|
|
7550
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
7551
|
+
key = _ref2[0],
|
|
7552
|
+
value = _ref2[1];
|
|
7553
|
+
|
|
7554
|
+
if (mapFields[key]) {
|
|
7555
|
+
prev[mapFields[key]] = value;
|
|
7556
|
+
} else {
|
|
7557
|
+
prev[key] = value;
|
|
7558
|
+
}
|
|
7559
|
+
|
|
7560
|
+
return prev;
|
|
7561
|
+
}, {});
|
|
7562
|
+
return gtagOptions;
|
|
7563
|
+
});
|
|
7564
|
+
|
|
7565
|
+
_defineProperty(this, "initialize", function (GA_MEASUREMENT_ID) {
|
|
7566
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7567
|
+
|
|
7568
|
+
if (!GA_MEASUREMENT_ID) {
|
|
7569
|
+
throw new Error("Require GA_MEASUREMENT_ID");
|
|
7570
|
+
}
|
|
7571
|
+
|
|
7572
|
+
var initConfigs = typeof GA_MEASUREMENT_ID === "string" ? [{
|
|
7573
|
+
trackingId: GA_MEASUREMENT_ID
|
|
7574
|
+
}] : GA_MEASUREMENT_ID;
|
|
7575
|
+
_this._currentMeasurementId = initConfigs[0].trackingId;
|
|
7576
|
+
var gaOptions = options.gaOptions,
|
|
7577
|
+
gtagOptions = options.gtagOptions,
|
|
7578
|
+
_options$legacyDimens = options.legacyDimensionMetric,
|
|
7579
|
+
legacyDimensionMetric = _options$legacyDimens === void 0 ? true : _options$legacyDimens,
|
|
7580
|
+
nonce = options.nonce,
|
|
7581
|
+
_options$testMode = options.testMode,
|
|
7582
|
+
testMode = _options$testMode === void 0 ? false : _options$testMode;
|
|
7583
|
+
_this._testMode = testMode;
|
|
7584
|
+
|
|
7585
|
+
if (!testMode) {
|
|
7586
|
+
_this._loadGA(_this._currentMeasurementId, nonce);
|
|
7587
|
+
}
|
|
7588
|
+
|
|
7589
|
+
if (!_this.isInitialized) {
|
|
7590
|
+
_this._gtag("js", new Date());
|
|
7591
|
+
|
|
7592
|
+
initConfigs.forEach(function (config) {
|
|
7593
|
+
var mergedGtagOptions = _this._appendCustomMap(_objectSpread(_objectSpread(_objectSpread({
|
|
7594
|
+
// https://developers.google.com/analytics/devguides/collection/gtagjs/pages#disable_pageview_measurement
|
|
7595
|
+
send_page_view: false
|
|
7596
|
+
}, _this._toGtagOptions(_objectSpread(_objectSpread({}, gaOptions), config.gaOptions))), gtagOptions), config.gtagOptions), legacyDimensionMetric);
|
|
7597
|
+
|
|
7598
|
+
_this._gtag("config", config.trackingId, mergedGtagOptions);
|
|
7599
|
+
});
|
|
7600
|
+
}
|
|
7601
|
+
|
|
7602
|
+
_this.isInitialized = true;
|
|
7603
|
+
|
|
7604
|
+
if (!testMode) {
|
|
7605
|
+
var queues = _toConsumableArray(_this._queueGtag);
|
|
7606
|
+
|
|
7607
|
+
_this._queueGtag = [];
|
|
7608
|
+
_this._isQueuing = false;
|
|
7609
|
+
|
|
7610
|
+
while (queues.length) {
|
|
7611
|
+
var queue = queues.shift();
|
|
7612
|
+
|
|
7613
|
+
_this._gtag.apply(_this, _toConsumableArray(queue));
|
|
7614
|
+
|
|
7615
|
+
if (queue[0] === "get") {
|
|
7616
|
+
_this._isQueuing = true;
|
|
7617
|
+
}
|
|
7618
|
+
}
|
|
7619
|
+
}
|
|
7620
|
+
});
|
|
7621
|
+
|
|
7622
|
+
_defineProperty(this, "set", function (fieldsObject) {
|
|
7623
|
+
if (!fieldsObject) {
|
|
7624
|
+
console.warn("`fieldsObject` is required in .set()");
|
|
7625
|
+
return;
|
|
7626
|
+
}
|
|
7627
|
+
|
|
7628
|
+
if (_typeof(fieldsObject) !== "object") {
|
|
7629
|
+
console.warn("Expected `fieldsObject` arg to be an Object");
|
|
7630
|
+
return;
|
|
7631
|
+
}
|
|
7632
|
+
|
|
7633
|
+
if (Object.keys(fieldsObject).length === 0) {
|
|
7634
|
+
console.warn("empty `fieldsObject` given to .set()");
|
|
7635
|
+
}
|
|
7636
|
+
|
|
7637
|
+
_this._gaCommand("set", fieldsObject);
|
|
7638
|
+
});
|
|
7639
|
+
|
|
7640
|
+
_defineProperty(this, "_gaCommandSendEvent", function (eventCategory, eventAction, eventLabel, eventValue, fieldsObject) {
|
|
7641
|
+
_this._gtag("event", eventAction, _objectSpread(_objectSpread({
|
|
7642
|
+
event_category: eventCategory,
|
|
7643
|
+
event_label: eventLabel,
|
|
7644
|
+
value: eventValue
|
|
7645
|
+
}, fieldsObject && {
|
|
7646
|
+
non_interaction: fieldsObject.nonInteraction
|
|
7647
|
+
}), _this._toGtagOptions(fieldsObject)));
|
|
7648
|
+
});
|
|
7649
|
+
|
|
7650
|
+
_defineProperty(this, "_gaCommandSendEventParameters", function () {
|
|
7651
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
7652
|
+
args[_key2] = arguments[_key2];
|
|
7653
|
+
}
|
|
7654
|
+
|
|
7655
|
+
if (typeof args[0] === "string") {
|
|
7656
|
+
_this._gaCommandSendEvent.apply(_this, _toConsumableArray(args.slice(1)));
|
|
7657
|
+
} else {
|
|
7658
|
+
var _args$ = args[0],
|
|
7659
|
+
eventCategory = _args$.eventCategory,
|
|
7660
|
+
eventAction = _args$.eventAction,
|
|
7661
|
+
eventLabel = _args$.eventLabel,
|
|
7662
|
+
eventValue = _args$.eventValue;
|
|
7663
|
+
_args$.hitType;
|
|
7664
|
+
var rest = _objectWithoutProperties(_args$, _excluded);
|
|
7665
|
+
|
|
7666
|
+
_this._gaCommandSendEvent(eventCategory, eventAction, eventLabel, eventValue, rest);
|
|
7667
|
+
}
|
|
7668
|
+
});
|
|
7669
|
+
|
|
7670
|
+
_defineProperty(this, "_gaCommandSendTiming", function (timingCategory, timingVar, timingValue, timingLabel) {
|
|
7671
|
+
_this._gtag("event", "timing_complete", {
|
|
7672
|
+
name: timingVar,
|
|
7673
|
+
value: timingValue,
|
|
7674
|
+
event_category: timingCategory,
|
|
7675
|
+
event_label: timingLabel
|
|
7676
|
+
});
|
|
7677
|
+
});
|
|
7678
|
+
|
|
7679
|
+
_defineProperty(this, "_gaCommandSendPageview", function (page, fieldsObject) {
|
|
7680
|
+
if (fieldsObject && Object.keys(fieldsObject).length) {
|
|
7681
|
+
var _this$_toGtagOptions = _this._toGtagOptions(fieldsObject),
|
|
7682
|
+
title = _this$_toGtagOptions.title,
|
|
7683
|
+
location = _this$_toGtagOptions.location,
|
|
7684
|
+
rest = _objectWithoutProperties(_this$_toGtagOptions, _excluded2);
|
|
7685
|
+
|
|
7686
|
+
_this._gtag("event", "page_view", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, page && {
|
|
7687
|
+
page_path: page
|
|
7688
|
+
}), title && {
|
|
7689
|
+
page_title: title
|
|
7690
|
+
}), location && {
|
|
7691
|
+
page_location: location
|
|
7692
|
+
}), rest));
|
|
7693
|
+
} else if (page) {
|
|
7694
|
+
_this._gtag("event", "page_view", {
|
|
7695
|
+
page_path: page
|
|
7696
|
+
});
|
|
7697
|
+
} else {
|
|
7698
|
+
_this._gtag("event", "page_view");
|
|
7699
|
+
}
|
|
7700
|
+
});
|
|
7701
|
+
|
|
7702
|
+
_defineProperty(this, "_gaCommandSendPageviewParameters", function () {
|
|
7703
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
7704
|
+
args[_key3] = arguments[_key3];
|
|
7705
|
+
}
|
|
7706
|
+
|
|
7707
|
+
if (typeof args[0] === "string") {
|
|
7708
|
+
_this._gaCommandSendPageview.apply(_this, _toConsumableArray(args.slice(1)));
|
|
7709
|
+
} else {
|
|
7710
|
+
var _args$2 = args[0],
|
|
7711
|
+
page = _args$2.page;
|
|
7712
|
+
_args$2.hitType;
|
|
7713
|
+
var rest = _objectWithoutProperties(_args$2, _excluded3);
|
|
7714
|
+
|
|
7715
|
+
_this._gaCommandSendPageview(page, rest);
|
|
7716
|
+
}
|
|
7717
|
+
});
|
|
7718
|
+
|
|
7719
|
+
_defineProperty(this, "_gaCommandSend", function () {
|
|
7720
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
7721
|
+
args[_key4] = arguments[_key4];
|
|
7722
|
+
}
|
|
7723
|
+
|
|
7724
|
+
var hitType = typeof args[0] === "string" ? args[0] : args[0].hitType;
|
|
7725
|
+
|
|
7726
|
+
switch (hitType) {
|
|
7727
|
+
case "event":
|
|
7728
|
+
_this._gaCommandSendEventParameters.apply(_this, args);
|
|
7729
|
+
|
|
7730
|
+
break;
|
|
7731
|
+
|
|
7732
|
+
case "pageview":
|
|
7733
|
+
_this._gaCommandSendPageviewParameters.apply(_this, args);
|
|
7734
|
+
|
|
7735
|
+
break;
|
|
7736
|
+
|
|
7737
|
+
case "timing":
|
|
7738
|
+
_this._gaCommandSendTiming.apply(_this, _toConsumableArray(args.slice(1)));
|
|
7739
|
+
|
|
7740
|
+
break;
|
|
7741
|
+
|
|
7742
|
+
case "screenview":
|
|
7743
|
+
case "transaction":
|
|
7744
|
+
case "item":
|
|
7745
|
+
case "social":
|
|
7746
|
+
case "exception":
|
|
7747
|
+
console.warn("Unsupported send command: ".concat(hitType));
|
|
7748
|
+
break;
|
|
7749
|
+
|
|
7750
|
+
default:
|
|
7751
|
+
console.warn("Send command doesn't exist: ".concat(hitType));
|
|
7752
|
+
}
|
|
7753
|
+
});
|
|
7754
|
+
|
|
7755
|
+
_defineProperty(this, "_gaCommandSet", function () {
|
|
7756
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
7757
|
+
args[_key5] = arguments[_key5];
|
|
7758
|
+
}
|
|
7759
|
+
|
|
7760
|
+
if (typeof args[0] === "string") {
|
|
7761
|
+
args[0] = _defineProperty({}, args[0], args[1]);
|
|
7762
|
+
}
|
|
7763
|
+
|
|
7764
|
+
_this._gtag("set", _this._toGtagOptions(args[0]));
|
|
7765
|
+
});
|
|
7766
|
+
|
|
7767
|
+
_defineProperty(this, "_gaCommand", function (command) {
|
|
7768
|
+
for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
|
|
7769
|
+
args[_key6 - 1] = arguments[_key6];
|
|
7770
|
+
}
|
|
7771
|
+
|
|
7772
|
+
switch (command) {
|
|
7773
|
+
case "send":
|
|
7774
|
+
_this._gaCommandSend.apply(_this, args);
|
|
7775
|
+
|
|
7776
|
+
break;
|
|
7777
|
+
|
|
7778
|
+
case "set":
|
|
7779
|
+
_this._gaCommandSet.apply(_this, args);
|
|
7780
|
+
|
|
7781
|
+
break;
|
|
7782
|
+
|
|
7783
|
+
default:
|
|
7784
|
+
console.warn("Command doesn't exist: ".concat(command));
|
|
7785
|
+
}
|
|
7786
|
+
});
|
|
7787
|
+
|
|
7788
|
+
_defineProperty(this, "ga", function () {
|
|
7789
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
7790
|
+
args[_key7] = arguments[_key7];
|
|
7791
|
+
}
|
|
7792
|
+
|
|
7793
|
+
if (typeof args[0] === "string") {
|
|
7794
|
+
_this._gaCommand.apply(_this, args);
|
|
7795
|
+
} else {
|
|
7796
|
+
var readyCallback = args[0];
|
|
7797
|
+
|
|
7798
|
+
_this._gtag("get", _this._currentMeasurementId, "client_id", function (clientId) {
|
|
7799
|
+
_this._isQueuing = false;
|
|
7800
|
+
var queues = _this._queueGtag;
|
|
7801
|
+
readyCallback({
|
|
7802
|
+
get: function get(property) {
|
|
7803
|
+
return property === "clientId" ? clientId : property === "trackingId" ? _this._currentMeasurementId : property === "apiVersion" ? "1" : undefined;
|
|
7804
|
+
}
|
|
7805
|
+
});
|
|
7806
|
+
|
|
7807
|
+
while (queues.length) {
|
|
7808
|
+
var queue = queues.shift();
|
|
7809
|
+
|
|
7810
|
+
_this._gtag.apply(_this, _toConsumableArray(queue));
|
|
7811
|
+
}
|
|
7812
|
+
});
|
|
7813
|
+
|
|
7814
|
+
_this._isQueuing = true;
|
|
7815
|
+
}
|
|
7816
|
+
|
|
7817
|
+
return _this.ga;
|
|
7818
|
+
});
|
|
7819
|
+
|
|
7820
|
+
_defineProperty(this, "event", function (optionsOrName, params) {
|
|
7821
|
+
if (typeof optionsOrName === "string") {
|
|
7822
|
+
_this._gtag("event", optionsOrName, _this._toGtagOptions(params));
|
|
7823
|
+
} else {
|
|
7824
|
+
var action = optionsOrName.action,
|
|
7825
|
+
category = optionsOrName.category,
|
|
7826
|
+
label = optionsOrName.label,
|
|
7827
|
+
value = optionsOrName.value,
|
|
7828
|
+
nonInteraction = optionsOrName.nonInteraction,
|
|
7829
|
+
transport = optionsOrName.transport,
|
|
7830
|
+
rest = _objectWithoutProperties(optionsOrName, _excluded4);
|
|
7831
|
+
|
|
7832
|
+
if (!category || !action) {
|
|
7833
|
+
console.warn("args.category AND args.action are required in event()");
|
|
7834
|
+
return;
|
|
7835
|
+
} // Required Fields
|
|
7836
|
+
|
|
7837
|
+
|
|
7838
|
+
var fieldObject = {
|
|
7839
|
+
hitType: "event",
|
|
7840
|
+
eventCategory: (0, _format["default"])(category),
|
|
7841
|
+
eventAction: (0, _format["default"])(action)
|
|
7842
|
+
}; // Optional Fields
|
|
7843
|
+
|
|
7844
|
+
if (label) {
|
|
7845
|
+
fieldObject.eventLabel = (0, _format["default"])(label);
|
|
7846
|
+
}
|
|
7847
|
+
|
|
7848
|
+
if (typeof value !== "undefined") {
|
|
7849
|
+
if (typeof value !== "number") {
|
|
7850
|
+
console.warn("Expected `args.value` arg to be a Number.");
|
|
7851
|
+
} else {
|
|
7852
|
+
fieldObject.eventValue = value;
|
|
7853
|
+
}
|
|
7854
|
+
}
|
|
7855
|
+
|
|
7856
|
+
if (typeof nonInteraction !== "undefined") {
|
|
7857
|
+
if (typeof nonInteraction !== "boolean") {
|
|
7858
|
+
console.warn("`args.nonInteraction` must be a boolean.");
|
|
7859
|
+
} else {
|
|
7860
|
+
fieldObject.nonInteraction = nonInteraction;
|
|
7861
|
+
}
|
|
7862
|
+
}
|
|
7863
|
+
|
|
7864
|
+
if (typeof transport !== "undefined") {
|
|
7865
|
+
if (typeof transport !== "string") {
|
|
7866
|
+
console.warn("`args.transport` must be a string.");
|
|
7867
|
+
} else {
|
|
7868
|
+
if (["beacon", "xhr", "image"].indexOf(transport) === -1) {
|
|
7869
|
+
console.warn("`args.transport` must be either one of these values: `beacon`, `xhr` or `image`");
|
|
7870
|
+
}
|
|
7871
|
+
|
|
7872
|
+
fieldObject.transport = transport;
|
|
7873
|
+
}
|
|
7874
|
+
}
|
|
7875
|
+
|
|
7876
|
+
Object.keys(rest).filter(function (key) {
|
|
7877
|
+
return key.substr(0, "dimension".length) === "dimension";
|
|
7878
|
+
}).forEach(function (key) {
|
|
7879
|
+
fieldObject[key] = rest[key];
|
|
7880
|
+
});
|
|
7881
|
+
Object.keys(rest).filter(function (key) {
|
|
7882
|
+
return key.substr(0, "metric".length) === "metric";
|
|
7883
|
+
}).forEach(function (key) {
|
|
7884
|
+
fieldObject[key] = rest[key];
|
|
7885
|
+
});
|
|
7886
|
+
|
|
7887
|
+
_this._gaCommand("send", fieldObject);
|
|
7888
|
+
}
|
|
7889
|
+
});
|
|
7890
|
+
|
|
7891
|
+
_defineProperty(this, "send", function (fieldObject) {
|
|
7892
|
+
_this._gaCommand("send", fieldObject);
|
|
7893
|
+
});
|
|
7894
|
+
|
|
7895
|
+
_defineProperty(this, "pageview", function (path, _, title) {
|
|
7896
|
+
var pathTrim = path === null || path === void 0 ? void 0 : path.trim();
|
|
7897
|
+
|
|
7898
|
+
if (pathTrim === "") {
|
|
7899
|
+
console.warn("path cannot be an empty string in .pageview()");
|
|
7900
|
+
return;
|
|
7901
|
+
}
|
|
7902
|
+
|
|
7903
|
+
_this._gaCommand("send", "pageview", pathTrim, {
|
|
7904
|
+
title: title
|
|
7905
|
+
});
|
|
7906
|
+
});
|
|
7907
|
+
|
|
7908
|
+
this.reset();
|
|
7265
7909
|
}
|
|
7266
|
-
}
|
|
7267
7910
|
|
|
7911
|
+
_createClass(GA4, [{
|
|
7912
|
+
key: "gtag",
|
|
7913
|
+
value: function gtag() {
|
|
7914
|
+
this._gtag.apply(this, arguments);
|
|
7915
|
+
}
|
|
7916
|
+
}, {
|
|
7917
|
+
key: "_appendCustomMap",
|
|
7918
|
+
value: function _appendCustomMap(options) {
|
|
7919
|
+
var legacyDimensionMetric = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
7920
|
+
|
|
7921
|
+
if (!legacyDimensionMetric) {
|
|
7922
|
+
return options;
|
|
7923
|
+
}
|
|
7924
|
+
|
|
7925
|
+
if (!options.custom_map) {
|
|
7926
|
+
options.custom_map = {};
|
|
7927
|
+
}
|
|
7928
|
+
|
|
7929
|
+
for (var i = 1; i <= 200; i++) {
|
|
7930
|
+
if (!options.custom_map["dimension".concat(i)]) {
|
|
7931
|
+
options.custom_map["dimension".concat(i)] = "dimension".concat(i);
|
|
7932
|
+
}
|
|
7933
|
+
|
|
7934
|
+
if (!options.custom_map["metric".concat(i)]) {
|
|
7935
|
+
options.custom_map["metric".concat(i)] = "metric".concat(i);
|
|
7936
|
+
}
|
|
7937
|
+
}
|
|
7938
|
+
|
|
7939
|
+
return options;
|
|
7940
|
+
}
|
|
7941
|
+
/**
|
|
7942
|
+
* @since v1.0.2
|
|
7943
|
+
* @param {string} [path="location.href"]
|
|
7944
|
+
* @param {string[]} [_] unsupported
|
|
7945
|
+
* @param {string} [title="location.pathname"]
|
|
7946
|
+
* @deprecated Use `.send("pageview")` instead
|
|
7947
|
+
*/
|
|
7948
|
+
|
|
7949
|
+
}, {
|
|
7950
|
+
key: "outboundLink",
|
|
7951
|
+
value:
|
|
7952
|
+
/**
|
|
7953
|
+
* @since v1.0.6
|
|
7954
|
+
* @param {Object} options
|
|
7955
|
+
* @param {string} options.label
|
|
7956
|
+
* @param {function} hitCallback
|
|
7957
|
+
* @deprecated Use `enhanced measurement` feature in Google Analytics.
|
|
7958
|
+
*/
|
|
7959
|
+
function outboundLink(_ref3, hitCallback) {
|
|
7960
|
+
var label = _ref3.label;
|
|
7961
|
+
|
|
7962
|
+
if (typeof hitCallback !== "function") {
|
|
7963
|
+
console.warn("hitCallback function is required");
|
|
7964
|
+
return;
|
|
7965
|
+
}
|
|
7966
|
+
|
|
7967
|
+
if (!label) {
|
|
7968
|
+
console.warn("args.label is required in outboundLink()");
|
|
7969
|
+
return;
|
|
7970
|
+
} // Required Fields
|
|
7971
|
+
|
|
7972
|
+
|
|
7973
|
+
var fieldObject = {
|
|
7974
|
+
hitType: "event",
|
|
7975
|
+
eventCategory: "Outbound",
|
|
7976
|
+
eventAction: "Click",
|
|
7977
|
+
eventLabel: (0, _format["default"])(label)
|
|
7978
|
+
};
|
|
7979
|
+
var safetyCallbackCalled = false;
|
|
7980
|
+
|
|
7981
|
+
var safetyCallback = function safetyCallback() {
|
|
7982
|
+
// This prevents a delayed response from GA
|
|
7983
|
+
// causing hitCallback from being fired twice
|
|
7984
|
+
safetyCallbackCalled = true;
|
|
7985
|
+
hitCallback();
|
|
7986
|
+
}; // Using a timeout to ensure the execution of critical application code
|
|
7987
|
+
// in the case when the GA server might be down
|
|
7988
|
+
// or an ad blocker prevents sending the data
|
|
7989
|
+
// register safety net timeout:
|
|
7990
|
+
|
|
7991
|
+
|
|
7992
|
+
var t = setTimeout(safetyCallback, 250);
|
|
7993
|
+
|
|
7994
|
+
var clearableCallbackForGA = function clearableCallbackForGA() {
|
|
7995
|
+
clearTimeout(t);
|
|
7996
|
+
|
|
7997
|
+
if (!safetyCallbackCalled) {
|
|
7998
|
+
hitCallback();
|
|
7999
|
+
}
|
|
8000
|
+
};
|
|
8001
|
+
|
|
8002
|
+
fieldObject.hitCallback = clearableCallbackForGA;
|
|
8003
|
+
|
|
8004
|
+
this._gaCommand("send", fieldObject);
|
|
8005
|
+
}
|
|
8006
|
+
}]);
|
|
8007
|
+
|
|
8008
|
+
return GA4;
|
|
8009
|
+
}();
|
|
8010
|
+
|
|
8011
|
+
exports.GA4 = GA4;
|
|
8012
|
+
|
|
8013
|
+
var _default = new GA4();
|
|
8014
|
+
|
|
8015
|
+
exports["default"] = _default;
|
|
8016
|
+
});
|
|
8017
|
+
|
|
8018
|
+
unwrapExports(ga4);
|
|
8019
|
+
ga4.GA4;
|
|
8020
|
+
|
|
8021
|
+
var dist = createCommonjsModule(function (module, exports) {
|
|
8022
|
+
|
|
8023
|
+
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); }
|
|
8024
|
+
|
|
8025
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8026
|
+
value: true
|
|
8027
|
+
});
|
|
8028
|
+
exports["default"] = exports.ReactGAImplementation = void 0;
|
|
8029
|
+
|
|
8030
|
+
var _ga = _interopRequireWildcard(ga4);
|
|
8031
|
+
|
|
8032
|
+
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); }
|
|
8033
|
+
|
|
8034
|
+
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; }
|
|
8035
|
+
|
|
8036
|
+
var ReactGAImplementation = _ga.GA4;
|
|
8037
|
+
exports.ReactGAImplementation = ReactGAImplementation;
|
|
8038
|
+
var _default = _ga["default"];
|
|
8039
|
+
exports["default"] = _default;
|
|
8040
|
+
});
|
|
8041
|
+
|
|
8042
|
+
var ReactGA4 = unwrapExports(dist);
|
|
8043
|
+
dist.ReactGAImplementation;
|
|
8044
|
+
|
|
8045
|
+
var _window$d, _window$Pelcro$d, _window$Pelcro$uiSett$d;
|
|
8046
|
+
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;
|
|
7268
8047
|
class PelcroActions {
|
|
7269
8048
|
constructor(storeSetter, storeGetter) {
|
|
7270
8049
|
_defineProperty$3(this, "resetState", () => {
|
|
@@ -7479,7 +8258,7 @@ class PelcroActions {
|
|
|
7479
8258
|
}
|
|
7480
8259
|
|
|
7481
8260
|
window.Pelcro.user.logout();
|
|
7482
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
8261
|
+
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, {
|
|
7483
8262
|
category: "ACTIONS",
|
|
7484
8263
|
action: "Logged out",
|
|
7485
8264
|
nonInteraction: true
|
|
@@ -7728,6 +8507,8 @@ if (process.env.NODE_ENV === "development") {
|
|
|
7728
8507
|
c$1("Pelcro Store", usePelcro);
|
|
7729
8508
|
}
|
|
7730
8509
|
|
|
8510
|
+
var _window$c, _window$Pelcro$c, _window$Pelcro$uiSett$c;
|
|
8511
|
+
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;
|
|
7731
8512
|
/**
|
|
7732
8513
|
* List of zero-decimal currencies.
|
|
7733
8514
|
* @see https://stripe.com/docs/currencies#zero-decimal
|
|
@@ -7809,9 +8590,9 @@ const getLanguageWithoutRegion = localeName => {
|
|
|
7809
8590
|
*/
|
|
7810
8591
|
|
|
7811
8592
|
const getPageOrDefaultLanguage = () => {
|
|
7812
|
-
var _window$Pelcro$helper, _window$
|
|
8593
|
+
var _window$Pelcro$helper, _window$Pelcro2, _window$Pelcro2$site, _window$Pelcro2$site$, _window$Pelcro2$site$2;
|
|
7813
8594
|
|
|
7814
|
-
return (_window$Pelcro$helper = window.Pelcro.helpers.getHtmlLanguageAttribute()) !== null && _window$Pelcro$helper !== void 0 ? _window$Pelcro$helper : getLanguageWithoutRegion((_window$
|
|
8595
|
+
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);
|
|
7815
8596
|
};
|
|
7816
8597
|
/**
|
|
7817
8598
|
* Returns a formatted price string depending on locale
|
|
@@ -7866,10 +8647,10 @@ const isValidViewFromURL = viewID => {
|
|
|
7866
8647
|
*/
|
|
7867
8648
|
|
|
7868
8649
|
function hasValidNewsletterUpdateUrl() {
|
|
7869
|
-
var _window$
|
|
8650
|
+
var _window$Pelcro3, _window$Pelcro3$uiSet;
|
|
7870
8651
|
|
|
7871
8652
|
if (viewID !== "newsletter-update") return false;
|
|
7872
|
-
const newsletters = (_window$
|
|
8653
|
+
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;
|
|
7873
8654
|
const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
|
|
7874
8655
|
|
|
7875
8656
|
if (!siteHasNewslettersDefined) {
|
|
@@ -7946,16 +8727,16 @@ const trackSubscriptionOnGA = () => {
|
|
|
7946
8727
|
}
|
|
7947
8728
|
|
|
7948
8729
|
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;
|
|
7949
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$set = ReactGA.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA, {
|
|
8730
|
+
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, {
|
|
7950
8731
|
currencyCode: currencyCode
|
|
7951
8732
|
});
|
|
7952
|
-
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", {
|
|
8733
|
+
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", {
|
|
7953
8734
|
id: lastSubscriptionId,
|
|
7954
8735
|
affiliation: "Pelcro",
|
|
7955
8736
|
revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
|
|
7956
8737
|
coupon: couponCode
|
|
7957
8738
|
});
|
|
7958
|
-
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", {
|
|
8739
|
+
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", {
|
|
7959
8740
|
id: lastSubscriptionId,
|
|
7960
8741
|
name: product.name,
|
|
7961
8742
|
category: product.description,
|
|
@@ -7963,8 +8744,8 @@ const trackSubscriptionOnGA = () => {
|
|
|
7963
8744
|
price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
|
|
7964
8745
|
quantity: 1
|
|
7965
8746
|
});
|
|
7966
|
-
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");
|
|
7967
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
8747
|
+
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");
|
|
8748
|
+
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, {
|
|
7968
8749
|
category: "ACTIONS",
|
|
7969
8750
|
action: "Subscribed",
|
|
7970
8751
|
nonInteraction: true
|
|
@@ -8053,9 +8834,9 @@ function getDateWithoutTime(dateObject) {
|
|
|
8053
8834
|
return date;
|
|
8054
8835
|
}
|
|
8055
8836
|
function userMustVerifyEmail() {
|
|
8056
|
-
var _window$Pelcro$site$
|
|
8837
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
|
|
8057
8838
|
|
|
8058
|
-
const isEmailVerificationEnabled = (_window$Pelcro$site$
|
|
8839
|
+
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;
|
|
8059
8840
|
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;
|
|
8060
8841
|
return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
|
|
8061
8842
|
}
|
|
@@ -8191,6 +8972,9 @@ function _classPrivateFieldGet(receiver, privateMap) {
|
|
|
8191
8972
|
return descriptor.value;
|
|
8192
8973
|
}
|
|
8193
8974
|
|
|
8975
|
+
var _window$b, _window$Pelcro$b, _window$Pelcro$uiSett$b;
|
|
8976
|
+
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;
|
|
8977
|
+
|
|
8194
8978
|
var _isAlreadySaved = /*#__PURE__*/new WeakMap();
|
|
8195
8979
|
|
|
8196
8980
|
var _markButtonAsLoading = /*#__PURE__*/new WeakMap();
|
|
@@ -8349,7 +9133,7 @@ class SaveToMetadataButtonClass {
|
|
|
8349
9133
|
|
|
8350
9134
|
_classPrivateFieldGet(this, _markButtonAsSaved).call(this, button);
|
|
8351
9135
|
|
|
8352
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
9136
|
+
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, {
|
|
8353
9137
|
category: "ACTIONS",
|
|
8354
9138
|
action: "Save/Follow",
|
|
8355
9139
|
label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
|
|
@@ -8387,7 +9171,7 @@ class SaveToMetadataButtonClass {
|
|
|
8387
9171
|
|
|
8388
9172
|
_classPrivateFieldGet(this, _unmarkSavedButton).call(this, button);
|
|
8389
9173
|
|
|
8390
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
|
|
9174
|
+
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, {
|
|
8391
9175
|
category: "ACTIONS",
|
|
8392
9176
|
action: "Unsave/Unfollow",
|
|
8393
9177
|
label: title
|
|
@@ -10055,6 +10839,8 @@ function getSiteCardProcessor() {
|
|
|
10055
10839
|
return "stripe";
|
|
10056
10840
|
}
|
|
10057
10841
|
|
|
10842
|
+
var _window$a, _window$Pelcro$a, _window$Pelcro$uiSett$a;
|
|
10843
|
+
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;
|
|
10058
10844
|
/**
|
|
10059
10845
|
* @typedef {Object} OptionsType
|
|
10060
10846
|
* @property {boolean} loadPaymentSDKs
|
|
@@ -10189,13 +10975,13 @@ const initSecuritySdk = () => {
|
|
|
10189
10975
|
const initGATracking = () => {
|
|
10190
10976
|
var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
|
|
10191
10977
|
|
|
10192
|
-
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);
|
|
10193
|
-
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");
|
|
10978
|
+
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);
|
|
10979
|
+
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");
|
|
10194
10980
|
};
|
|
10195
10981
|
const dispatchModalDisplayEvents = modalName => {
|
|
10196
10982
|
var _ReactGA$event, _modalName$replace, _modalName$replace2;
|
|
10197
10983
|
|
|
10198
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
10984
|
+
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, {
|
|
10199
10985
|
category: "VIEWS",
|
|
10200
10986
|
action: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ")} viewed`,
|
|
10201
10987
|
nonInteraction: true
|
|
@@ -11336,12 +12122,14 @@ function ConfirmPassword({
|
|
|
11336
12122
|
}, otherProps));
|
|
11337
12123
|
}
|
|
11338
12124
|
|
|
12125
|
+
var _window$9, _window$Pelcro$9, _window$Pelcro$uiSett$9;
|
|
12126
|
+
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;
|
|
11339
12127
|
const Logout = props => {
|
|
11340
12128
|
const handleLogout = () => {
|
|
11341
12129
|
var _ReactGA$event;
|
|
11342
12130
|
|
|
11343
12131
|
window.Pelcro.user.logout();
|
|
11344
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
12132
|
+
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, {
|
|
11345
12133
|
category: "ACTIONS",
|
|
11346
12134
|
action: "Logged out",
|
|
11347
12135
|
nonInteraction: true
|
|
@@ -12881,6 +13669,8 @@ const RegisterCompany = props => {
|
|
|
12881
13669
|
}, props));
|
|
12882
13670
|
};
|
|
12883
13671
|
|
|
13672
|
+
var _window$8, _window$Pelcro$8, _window$Pelcro$uiSett$8;
|
|
13673
|
+
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;
|
|
12884
13674
|
/**
|
|
12885
13675
|
*
|
|
12886
13676
|
*/
|
|
@@ -12912,7 +13702,7 @@ function RegisterModal(props) {
|
|
|
12912
13702
|
const handleAfterRegistrationLogic = () => {
|
|
12913
13703
|
var _ReactGA$event, _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
12914
13704
|
|
|
12915
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
13705
|
+
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, {
|
|
12916
13706
|
category: "ACTIONS",
|
|
12917
13707
|
action: "Registered",
|
|
12918
13708
|
nonInteraction: true
|
|
@@ -14446,6 +15236,8 @@ function SvgArrowLeft(props) {
|
|
|
14446
15236
|
})));
|
|
14447
15237
|
}
|
|
14448
15238
|
|
|
15239
|
+
var _window$7, _window$Pelcro$7, _window$Pelcro$uiSett$7;
|
|
15240
|
+
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;
|
|
14449
15241
|
/**
|
|
14450
15242
|
*
|
|
14451
15243
|
*/
|
|
@@ -14880,7 +15672,7 @@ class SelectModal extends React.Component {
|
|
|
14880
15672
|
if (this.state.mode === "product") {
|
|
14881
15673
|
var _ReactGA$event;
|
|
14882
15674
|
|
|
14883
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
15675
|
+
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, {
|
|
14884
15676
|
category: "VIEWS",
|
|
14885
15677
|
action: "Product Modal Viewed",
|
|
14886
15678
|
nonInteraction: true
|
|
@@ -14888,7 +15680,7 @@ class SelectModal extends React.Component {
|
|
|
14888
15680
|
} else if (this.state.mode === "plan") {
|
|
14889
15681
|
var _ReactGA$event2;
|
|
14890
15682
|
|
|
14891
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
|
|
15683
|
+
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, {
|
|
14892
15684
|
category: "VIEWS",
|
|
14893
15685
|
action: "Plan Modal Viewed",
|
|
14894
15686
|
nonInteraction: true
|
|
@@ -19668,6 +20460,8 @@ const SubscriptionRenewView = ({
|
|
|
19668
20460
|
}));
|
|
19669
20461
|
};
|
|
19670
20462
|
|
|
20463
|
+
var _window$6, _window$Pelcro$6, _window$Pelcro$uiSett$6;
|
|
20464
|
+
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;
|
|
19671
20465
|
/**
|
|
19672
20466
|
*
|
|
19673
20467
|
*/
|
|
@@ -19688,7 +20482,7 @@ function SubscriptionRenewModal({
|
|
|
19688
20482
|
var _otherProps$onSuccess, _ReactGA$event;
|
|
19689
20483
|
|
|
19690
20484
|
(_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
|
|
19691
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
20485
|
+
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, {
|
|
19692
20486
|
category: "ACTIONS",
|
|
19693
20487
|
action: "Renewed",
|
|
19694
20488
|
nonInteraction: true
|
|
@@ -19700,7 +20494,7 @@ function SubscriptionRenewModal({
|
|
|
19700
20494
|
var _otherProps$onGiftRen, _ReactGA$event2;
|
|
19701
20495
|
|
|
19702
20496
|
(_otherProps$onGiftRen = otherProps.onGiftRenewalSuccess) === null || _otherProps$onGiftRen === void 0 ? void 0 : _otherProps$onGiftRen.call(otherProps);
|
|
19703
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
|
|
20497
|
+
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, {
|
|
19704
20498
|
category: "ACTIONS",
|
|
19705
20499
|
action: "Renewed Gift",
|
|
19706
20500
|
nonInteraction: true
|
|
@@ -19884,6 +20678,8 @@ function SvgSubscription(props) {
|
|
|
19884
20678
|
}))))));
|
|
19885
20679
|
}
|
|
19886
20680
|
|
|
20681
|
+
var _window$5, _window$Pelcro$5, _window$Pelcro$uiSett$5;
|
|
20682
|
+
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;
|
|
19887
20683
|
const SubscriptionCancelNowButton = ({
|
|
19888
20684
|
subscription,
|
|
19889
20685
|
onClick,
|
|
@@ -19917,7 +20713,7 @@ const SubscriptionCancelNowButton = ({
|
|
|
19917
20713
|
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
19918
20714
|
}
|
|
19919
20715
|
|
|
19920
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
20716
|
+
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, {
|
|
19921
20717
|
category: "ACTIONS",
|
|
19922
20718
|
action: "Canceled",
|
|
19923
20719
|
nonInteraction: true
|
|
@@ -19956,6 +20752,8 @@ const SubscriptionCancelNowButton = ({
|
|
|
19956
20752
|
}, t("messages.cancelNow"));
|
|
19957
20753
|
};
|
|
19958
20754
|
|
|
20755
|
+
var _window$4, _window$Pelcro$4, _window$Pelcro$uiSett$4;
|
|
20756
|
+
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;
|
|
19959
20757
|
const SubscriptionCancelLaterButton = ({
|
|
19960
20758
|
subscription,
|
|
19961
20759
|
onClick,
|
|
@@ -19989,7 +20787,7 @@ const SubscriptionCancelLaterButton = ({
|
|
|
19989
20787
|
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
19990
20788
|
}
|
|
19991
20789
|
|
|
19992
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
20790
|
+
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, {
|
|
19993
20791
|
category: "ACTIONS",
|
|
19994
20792
|
action: "Canceled",
|
|
19995
20793
|
nonInteraction: true
|
|
@@ -20204,6 +21002,8 @@ const SubscriptionSuspendDate = props => {
|
|
|
20204
21002
|
}, props));
|
|
20205
21003
|
};
|
|
20206
21004
|
|
|
21005
|
+
var _window$3, _window$Pelcro$3, _window$Pelcro$uiSett$3;
|
|
21006
|
+
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;
|
|
20207
21007
|
const SubscriptionSuspendButton = ({
|
|
20208
21008
|
subscription,
|
|
20209
21009
|
onClick,
|
|
@@ -20236,7 +21036,7 @@ const SubscriptionSuspendButton = ({
|
|
|
20236
21036
|
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
20237
21037
|
}
|
|
20238
21038
|
|
|
20239
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
21039
|
+
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, {
|
|
20240
21040
|
category: "ACTIONS",
|
|
20241
21041
|
action: "Suspended",
|
|
20242
21042
|
nonInteraction: true
|
|
@@ -23141,6 +23941,8 @@ function PaymentMethodUpdateView(props) {
|
|
|
23141
23941
|
}));
|
|
23142
23942
|
}
|
|
23143
23943
|
|
|
23944
|
+
var _window$2, _window$Pelcro$2, _window$Pelcro$uiSett$2;
|
|
23945
|
+
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;
|
|
23144
23946
|
const PaymentMethodUpdateModal = props => {
|
|
23145
23947
|
const {
|
|
23146
23948
|
t
|
|
@@ -23150,7 +23952,7 @@ const PaymentMethodUpdateModal = props => {
|
|
|
23150
23952
|
var _props$onSuccess, _ReactGA$event;
|
|
23151
23953
|
|
|
23152
23954
|
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
|
|
23153
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
23955
|
+
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, {
|
|
23154
23956
|
category: "ACTIONS",
|
|
23155
23957
|
action: "Updated payment card",
|
|
23156
23958
|
nonInteraction: true
|
|
@@ -27235,6 +28037,8 @@ const Card = ({
|
|
|
27235
28037
|
})), children);
|
|
27236
28038
|
};
|
|
27237
28039
|
|
|
28040
|
+
var _window$1, _window$Pelcro$1, _window$Pelcro$uiSett$1;
|
|
28041
|
+
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;
|
|
27238
28042
|
const SavedItemsMenu = () => {
|
|
27239
28043
|
const {
|
|
27240
28044
|
t
|
|
@@ -27285,7 +28089,7 @@ const SavedItems = ({
|
|
|
27285
28089
|
}
|
|
27286
28090
|
|
|
27287
28091
|
setItems(response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.metadata);
|
|
27288
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
28092
|
+
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, {
|
|
27289
28093
|
category: "ACTIONS",
|
|
27290
28094
|
action: "Unsave/Unfollow",
|
|
27291
28095
|
label: title
|
|
@@ -29964,6 +30768,8 @@ const NewsLettersItems = ({
|
|
|
29964
30768
|
});
|
|
29965
30769
|
};
|
|
29966
30770
|
|
|
30771
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
30772
|
+
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;
|
|
29967
30773
|
const SUB_MENUS = {
|
|
29968
30774
|
PROFILE: "profile",
|
|
29969
30775
|
QRCODE: "qr-code",
|
|
@@ -30331,14 +31137,14 @@ class Dashboard extends React.Component {
|
|
|
30331
31137
|
}
|
|
30332
31138
|
|
|
30333
31139
|
render() {
|
|
30334
|
-
var _window$Pelcro$user$r3, _window$
|
|
31140
|
+
var _window$Pelcro$user$r3, _window$Pelcro2, _window$Pelcro2$uiSet;
|
|
30335
31141
|
|
|
30336
31142
|
const {
|
|
30337
31143
|
isOpen
|
|
30338
31144
|
} = this.state;
|
|
30339
31145
|
const userHasName = this.user.first_name || this.user.last_name;
|
|
30340
31146
|
const profilePicture = (_window$Pelcro$user$r3 = window.Pelcro.user.read().profile_photo) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : userSolidIcon;
|
|
30341
|
-
const newsletters = (_window$
|
|
31147
|
+
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;
|
|
30342
31148
|
Array.isArray(newsletters) && newsletters.length > 0;
|
|
30343
31149
|
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(Transition, {
|
|
30344
31150
|
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",
|