@pelcro/react-pelcro-js 2.6.1 → 2.7.0-beta.4

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 CHANGED
@@ -6800,6 +6800,8 @@ class SaveToMetadataButtonClass {
6800
6800
  _saveToMetadata.set(this, {
6801
6801
  writable: true,
6802
6802
  value: event => {
6803
+ var _user$metadata;
6804
+
6803
6805
  const button = event.currentTarget;
6804
6806
  const user = window.Pelcro.user.read();
6805
6807
  const {
@@ -6815,7 +6817,7 @@ class SaveToMetadataButtonClass {
6815
6817
 
6816
6818
  let newMetadataValue = [buttonMetadata]; // if this key already exist in user metadata object, append to it.
6817
6819
 
6818
- const oldValue = user.metadata[`metadata_saved_${key}`];
6820
+ const oldValue = (_user$metadata = user.metadata) === null || _user$metadata === void 0 ? void 0 : _user$metadata[`metadata_saved_${key}`];
6819
6821
 
6820
6822
  if (oldValue) {
6821
6823
  if (Array.isArray(oldValue)) {
@@ -6929,8 +6931,8 @@ const saveToMetadataButton = new SaveToMetadataButtonClass();
6929
6931
 
6930
6932
  let e={data:""},t=t=>"undefined"!=typeof window?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||e,l=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(})/g,a=/\/\*[^]*?\*\/|\s\s+|\n/g,n=(e,t)=>{let r,l="",a="",o="";for(let c in e){let s=e[c];"object"==typeof s?(r=t?t.replace(/([^,])+/g,e=>c.replace(/([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):c,a+="@"==c[0]?"f"==c[1]?n(s,c):c+"{"+n(s,"k"==c[1]?"":t)+"}":n(s,r)):"@"==c[0]&&"i"==c[1]?l=c+" "+s+";":(c=c.replace(/[A-Z]/g,"-$&").toLowerCase(),o+=n.p?n.p(c,s):c+":"+s+";");}return o[0]?(r=t?t+"{"+o+"}":o,l+r+a):l+a},o={},c=e=>{let t="";for(let r in e)t+=r+("object"==typeof e[r]?c(e[r]):e[r]);return t},s=(e,t,r,s,i)=>{let p="object"==typeof e?c(e):e,u=o[p]||(o[p]=(e=>{let t=0,r=11;for(;t<e.length;)r=101*r+e.charCodeAt(t++)>>>0;return "go"+r})(p));if(!o[u]){let t="object"==typeof e?e:(e=>{let t,r=[{}];for(;t=l.exec(e.replace(a,""));)t[4]&&r.shift(),t[3]?r.unshift(r[0][t[3]]=r[0][t[3]]||{}):t[4]||(r[0][t[1]]=t[2]);return r[0]})(e);o[u]=n(i?{["@keyframes "+u]:t}:t,r?"":"."+u);}return ((e,t,r)=>{-1==t.data.indexOf(e)&&(t.data=r?e+t.data:t.data+e);})(o[u],t,s),u},i=(e,t,r)=>e.reduce((e,l,a)=>{let o=t[a];if(o&&o.call){let e=o(r),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;o=t?"."+t:e&&"object"==typeof e?e.props?"":n(e,""):e;}return e+l+(null==o?"":o)},"");function p(e){let r=this||{},l=e.call?e(r.p):e;return s(l.unshift?l.raw?i(l,[].slice.call(arguments,1),r.p):l.reduce((e,t)=>t?Object.assign(e,t.call?t(r.p):t):e,{}):l,t(r.target),r.g,r.o,r.k)}let u,f,d;p.bind({g:1});let b=p.bind({k:1});function h(e,t,r,l){n.p=t,u=e,f=r,d=l;}function y(e,t){let r=this||{};return function(){let l=arguments;function a(n,o){let c=Object.assign({},n),s=c.className||a.className;r.p=Object.assign({theme:f&&f()},c),r.o=/ *go\d+/.test(s),c.className=p.apply(r,l)+(s?" "+s:""),t&&(c.ref=o);let i=c.as||e;return d&&i[0]&&d(c),u(i,c)}return t?t(a):a}}
6931
6933
 
6932
- function _extends$v() {
6933
- _extends$v = Object.assign || function (target) {
6934
+ function _extends$w() {
6935
+ _extends$w = Object.assign || function (target) {
6934
6936
  for (var i = 1; i < arguments.length; i++) {
6935
6937
  var source = arguments[i];
6936
6938
 
@@ -6944,7 +6946,7 @@ function _extends$v() {
6944
6946
  return target;
6945
6947
  };
6946
6948
 
6947
- return _extends$v.apply(this, arguments);
6949
+ return _extends$w.apply(this, arguments);
6948
6950
  }
6949
6951
 
6950
6952
  function _taggedTemplateLiteralLoose(strings, raw) {
@@ -7034,7 +7036,7 @@ var clearFromRemoveQueue = function clearFromRemoveQueue(toastId) {
7034
7036
  var reducer = function reducer(state, action) {
7035
7037
  switch (action.type) {
7036
7038
  case ActionType.ADD_TOAST:
7037
- return _extends$v({}, state, {
7039
+ return _extends$w({}, state, {
7038
7040
  toasts: [action.toast].concat(state.toasts).slice(0, TOAST_LIMIT)
7039
7041
  });
7040
7042
 
@@ -7044,9 +7046,9 @@ var reducer = function reducer(state, action) {
7044
7046
  clearFromRemoveQueue(action.toast.id);
7045
7047
  }
7046
7048
 
7047
- return _extends$v({}, state, {
7049
+ return _extends$w({}, state, {
7048
7050
  toasts: state.toasts.map(function (t) {
7049
- return t.id === action.toast.id ? _extends$v({}, t, action.toast) : t;
7051
+ return t.id === action.toast.id ? _extends$w({}, t, action.toast) : t;
7050
7052
  })
7051
7053
  });
7052
7054
 
@@ -7073,9 +7075,9 @@ var reducer = function reducer(state, action) {
7073
7075
  });
7074
7076
  }
7075
7077
 
7076
- return _extends$v({}, state, {
7078
+ return _extends$w({}, state, {
7077
7079
  toasts: state.toasts.map(function (t) {
7078
- return t.id === toastId || toastId === undefined ? _extends$v({}, t, {
7080
+ return t.id === toastId || toastId === undefined ? _extends$w({}, t, {
7079
7081
  visible: false
7080
7082
  }) : t;
7081
7083
  })
@@ -7083,28 +7085,28 @@ var reducer = function reducer(state, action) {
7083
7085
 
7084
7086
  case ActionType.REMOVE_TOAST:
7085
7087
  if (action.toastId === undefined) {
7086
- return _extends$v({}, state, {
7088
+ return _extends$w({}, state, {
7087
7089
  toasts: []
7088
7090
  });
7089
7091
  }
7090
7092
 
7091
- return _extends$v({}, state, {
7093
+ return _extends$w({}, state, {
7092
7094
  toasts: state.toasts.filter(function (t) {
7093
7095
  return t.id !== action.toastId;
7094
7096
  })
7095
7097
  });
7096
7098
 
7097
7099
  case ActionType.START_PAUSE:
7098
- return _extends$v({}, state, {
7100
+ return _extends$w({}, state, {
7099
7101
  pausedAt: action.time
7100
7102
  });
7101
7103
 
7102
7104
  case ActionType.END_PAUSE:
7103
7105
  var diff = action.time - (state.pausedAt || 0);
7104
- return _extends$v({}, state, {
7106
+ return _extends$w({}, state, {
7105
7107
  pausedAt: undefined,
7106
7108
  toasts: state.toasts.map(function (t) {
7107
- return _extends$v({}, t, {
7109
+ return _extends$w({}, t, {
7108
7110
  pauseDuration: t.pauseDuration + diff
7109
7111
  });
7110
7112
  })
@@ -7151,12 +7153,12 @@ var useStore = function useStore(toastOptions) {
7151
7153
  var mergedToasts = state.toasts.map(function (t) {
7152
7154
  var _toastOptions$t$type, _toastOptions, _toastOptions$t$type2;
7153
7155
 
7154
- return _extends$v({}, toastOptions, toastOptions[t.type], t, {
7156
+ return _extends$w({}, toastOptions, toastOptions[t.type], t, {
7155
7157
  duration: t.duration || ((_toastOptions$t$type = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type.duration) || ((_toastOptions = toastOptions) == null ? void 0 : _toastOptions.duration) || defaultTimeouts[t.type],
7156
- style: _extends$v({}, toastOptions.style, (_toastOptions$t$type2 = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type2.style, t.style)
7158
+ style: _extends$w({}, toastOptions.style, (_toastOptions$t$type2 = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type2.style, t.style)
7157
7159
  });
7158
7160
  });
7159
- return _extends$v({}, state, {
7161
+ return _extends$w({}, state, {
7160
7162
  toasts: mergedToasts
7161
7163
  });
7162
7164
  };
@@ -7166,7 +7168,7 @@ var createToast = function createToast(message, type, opts) {
7166
7168
  type = 'blank';
7167
7169
  }
7168
7170
 
7169
- return _extends$v({
7171
+ return _extends$w({
7170
7172
  createdAt: Date.now(),
7171
7173
  visible: true,
7172
7174
  type: type,
@@ -7216,14 +7218,14 @@ toast.remove = function (toastId) {
7216
7218
  };
7217
7219
 
7218
7220
  toast.promise = function (promise, msgs, opts) {
7219
- var id = toast.loading(msgs.loading, _extends$v({}, opts, opts == null ? void 0 : opts.loading));
7221
+ var id = toast.loading(msgs.loading, _extends$w({}, opts, opts == null ? void 0 : opts.loading));
7220
7222
  promise.then(function (p) {
7221
- toast.success(resolveValue(msgs.success, p), _extends$v({
7223
+ toast.success(resolveValue(msgs.success, p), _extends$w({
7222
7224
  id: id
7223
7225
  }, opts, opts == null ? void 0 : opts.success));
7224
7226
  return p;
7225
7227
  })["catch"](function (e) {
7226
- toast.error(resolveValue(msgs.error, e), _extends$v({
7228
+ toast.error(resolveValue(msgs.error, e), _extends$w({
7227
7229
  id: id
7228
7230
  }, opts, opts == null ? void 0 : opts.error));
7229
7231
  });
@@ -7562,7 +7564,7 @@ var ToastBar = /*#__PURE__*/React.memo(function (_ref2) {
7562
7564
  var message = React.createElement(Message, Object.assign({}, toast.ariaProps), resolveValue(toast.message, toast));
7563
7565
  return React.createElement(ToastBarBase, {
7564
7566
  className: toast.className,
7565
- style: _extends$v({}, animationStyle, style, toast.style)
7567
+ style: _extends$w({}, animationStyle, style, toast.style)
7566
7568
  }, typeof children === 'function' ? children({
7567
7569
  icon: icon,
7568
7570
  message: message
@@ -7592,7 +7594,7 @@ var getPositionStyle = function getPositionStyle(position, offset) {
7592
7594
  } : position.includes('right') ? {
7593
7595
  justifyContent: 'flex-end'
7594
7596
  } : {};
7595
- return _extends$v({
7597
+ return _extends$w({
7596
7598
  left: 0,
7597
7599
  right: 0,
7598
7600
  display: 'flex',
@@ -7619,7 +7621,7 @@ var Toaster = function Toaster(_ref) {
7619
7621
  handlers = _useToaster.handlers;
7620
7622
 
7621
7623
  return React.createElement("div", {
7622
- style: _extends$v({
7624
+ style: _extends$w({
7623
7625
  position: 'fixed',
7624
7626
  zIndex: 9999,
7625
7627
  top: DEFAULT_OFFSET,
@@ -7654,82 +7656,82 @@ var Toaster = function Toaster(_ref) {
7654
7656
  }));
7655
7657
  };
7656
7658
 
7657
- var _path$s;
7659
+ var _path$t;
7658
7660
 
7659
- function _extends$u() { _extends$u = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$u.apply(this, arguments); }
7661
+ function _extends$v() { _extends$v = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$v.apply(this, arguments); }
7660
7662
 
7661
7663
  function SvgCheckSolid(props) {
7662
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$u({
7664
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$v({
7663
7665
  xmlns: "http://www.w3.org/2000/svg",
7664
7666
  className: "h-5 w-5",
7665
7667
  viewBox: "0 0 20 20",
7666
7668
  fill: "currentColor"
7667
- }, props), _path$s || (_path$s = /*#__PURE__*/React__namespace.createElement("path", {
7669
+ }, props), _path$t || (_path$t = /*#__PURE__*/React__namespace.createElement("path", {
7668
7670
  fillRule: "evenodd",
7669
7671
  d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",
7670
7672
  clipRule: "evenodd"
7671
7673
  })));
7672
7674
  }
7673
7675
 
7674
- var _path$r;
7676
+ var _path$s;
7675
7677
 
7676
- function _extends$t() { _extends$t = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$t.apply(this, arguments); }
7678
+ function _extends$u() { _extends$u = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$u.apply(this, arguments); }
7677
7679
 
7678
7680
  function SvgXIcon(props) {
7679
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$t({
7681
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$u({
7680
7682
  xmlns: "http://www.w3.org/2000/svg",
7681
7683
  viewBox: "0 0 20 20",
7682
7684
  fill: "currentColor"
7683
- }, props), _path$r || (_path$r = /*#__PURE__*/React__namespace.createElement("path", {
7685
+ }, props), _path$s || (_path$s = /*#__PURE__*/React__namespace.createElement("path", {
7684
7686
  fill: "evenodd",
7685
7687
  d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
7686
7688
  clipRule: "evenodd"
7687
7689
  })));
7688
7690
  }
7689
7691
 
7690
- var _path$q;
7692
+ var _path$r;
7691
7693
 
7692
- function _extends$s() { _extends$s = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$s.apply(this, arguments); }
7694
+ function _extends$t() { _extends$t = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$t.apply(this, arguments); }
7693
7695
 
7694
7696
  function SvgXIconSolid(props) {
7695
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$s({
7697
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$t({
7696
7698
  className: "plc-w-4 plc-h-4",
7697
7699
  fill: "currentColor",
7698
7700
  xmlns: "http://www.w3.org/2000/svg",
7699
7701
  viewBox: "0 0 100 100"
7700
- }, props), _path$q || (_path$q = /*#__PURE__*/React__namespace.createElement("path", {
7702
+ }, props), _path$r || (_path$r = /*#__PURE__*/React__namespace.createElement("path", {
7701
7703
  d: "M94.842 48.408c0 24.852-20.148 44.999-45.002 44.999-24.851 0-44.997-20.146-44.997-44.999 0-24.854 20.146-45 44.997-45 24.853 0 45.002 20.146 45.002 45zM71.073 64.841L54.73 48.497l16.344-16.344-4.979-4.979-16.343 16.345-16.343-16.344-4.799 4.799 16.344 16.344L28.61 64.661l4.979 4.978 16.344-16.344 16.343 16.344 4.797-4.798z"
7702
7704
  })));
7703
7705
  }
7704
7706
 
7705
- var _path$p;
7707
+ var _path$q;
7706
7708
 
7707
- function _extends$r() { _extends$r = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$r.apply(this, arguments); }
7709
+ function _extends$s() { _extends$s = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$s.apply(this, arguments); }
7708
7710
 
7709
7711
  function SvgExclamation(props) {
7710
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
7712
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$s({
7711
7713
  className: "plc-w-4 plc-h-4 plc-mr-1",
7712
7714
  xmlns: "http://www.w3.org/2000/svg",
7713
7715
  viewBox: "0 0 20 20",
7714
7716
  fill: "currentColor"
7715
- }, props), _path$p || (_path$p = /*#__PURE__*/React__namespace.createElement("path", {
7717
+ }, props), _path$q || (_path$q = /*#__PURE__*/React__namespace.createElement("path", {
7716
7718
  fillRule: "evenodd",
7717
7719
  d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",
7718
7720
  clipRule: "evenodd"
7719
7721
  })));
7720
7722
  }
7721
7723
 
7722
- var _path$o, _path2$3;
7724
+ var _path$p, _path2$3;
7723
7725
 
7724
- function _extends$q() { _extends$q = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$q.apply(this, arguments); }
7726
+ function _extends$r() { _extends$r = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$r.apply(this, arguments); }
7725
7727
 
7726
7728
  function SvgSpinner(props) {
7727
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$q({
7729
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
7728
7730
  className: "plc-animate-spin",
7729
7731
  viewBox: "0 0 24 24",
7730
7732
  fill: "currentColor",
7731
7733
  xmlns: "http://www.w3.org/2000/svg"
7732
- }, props), _path$o || (_path$o = /*#__PURE__*/React__namespace.createElement("path", {
7734
+ }, props), _path$p || (_path$p = /*#__PURE__*/React__namespace.createElement("path", {
7733
7735
  opacity: 0.2,
7734
7736
  fill: "evenodd",
7735
7737
  clipRule: "evenodd",
@@ -8481,6 +8483,7 @@ const optionsController = options => {
8481
8483
 
8482
8484
  const optionsMethodsDict = {
8483
8485
  loadPaymentSDKs: loadPaymentSDKs,
8486
+ loadAuth0SDK: loadAuth0SDK,
8484
8487
  enableURLTriggers: initViewFromURL,
8485
8488
  enableTheme: applyPelcroTheme,
8486
8489
  enablePaywalls: initPaywalls,
@@ -8546,6 +8549,13 @@ const loadPaymentSDKs = () => {
8546
8549
  window.Pelcro.helpers.loadSDK("https://js.braintreegateway.com/web/3.69.0/js/paypal-checkout.min.js", "braintree-paypal-sdk");
8547
8550
  }
8548
8551
  };
8552
+ const loadAuth0SDK = () => {
8553
+ const auth0Enabled = Boolean(window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url);
8554
+
8555
+ if (auth0Enabled) {
8556
+ window.Pelcro.helpers.loadSDK("https://cdn.auth0.com/js/auth0/9.18/auth0.min.js", "auth0-sdk");
8557
+ }
8558
+ };
8549
8559
  const initSecuritySdk = () => {
8550
8560
  const {
8551
8561
  whenSiteReady
@@ -8842,6 +8852,7 @@ const initCartFromUrl = () => {
8842
8852
 
8843
8853
  const defaultOptions = {
8844
8854
  loadPaymentSDKs: true,
8855
+ loadAuth0SDK: true,
8845
8856
  enableURLTriggers: true,
8846
8857
  enableTheme: true,
8847
8858
  enablePaywalls: true,
@@ -9667,16 +9678,16 @@ const LoginPassword = props => /*#__PURE__*/React__default['default'].createElem
9667
9678
  store: store$f
9668
9679
  }, props));
9669
9680
 
9670
- var _path$n;
9681
+ var _path$o;
9671
9682
 
9672
- function _extends$p() { _extends$p = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$p.apply(this, arguments); }
9683
+ function _extends$q() { _extends$q = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$q.apply(this, arguments); }
9673
9684
 
9674
9685
  function SvgCheck(props) {
9675
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$p({
9686
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$q({
9676
9687
  xmlns: "http://www.w3.org/2000/svg",
9677
9688
  fill: "currentColor",
9678
9689
  viewBox: "0 0 20 20"
9679
- }, props), _path$n || (_path$n = /*#__PURE__*/React__namespace.createElement("path", {
9690
+ }, props), _path$o || (_path$o = /*#__PURE__*/React__namespace.createElement("path", {
9680
9691
  fillRule: "evenodd",
9681
9692
  d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
9682
9693
  clipRule: "evenodd"
@@ -9993,15 +10004,15 @@ function hasSecurityTokenEnabled$1() {
9993
10004
  return hasSecuritySdkLoaded;
9994
10005
  }
9995
10006
 
9996
- var _path$m;
10007
+ var _path$n;
9997
10008
 
9998
- function _extends$o() { _extends$o = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$o.apply(this, arguments); }
10009
+ function _extends$p() { _extends$p = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$p.apply(this, arguments); }
9999
10010
 
10000
10011
  function SvgFacebookLogo(props) {
10001
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$o({
10012
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$p({
10002
10013
  xmlns: "http://www.w3.org/2000/svg",
10003
10014
  viewBox: "88.428 12.828 107.543 207.085"
10004
- }, props), _path$m || (_path$m = /*#__PURE__*/React__namespace.createElement("path", {
10015
+ }, props), _path$n || (_path$n = /*#__PURE__*/React__namespace.createElement("path", {
10005
10016
  d: "M158.232 219.912v-94.461h31.707l4.747-36.813h-36.454V65.134c0-10.658 2.96-17.922 18.245-17.922l19.494-.009V14.278c-3.373-.447-14.944-1.449-28.406-1.449-28.106 0-47.348 17.155-47.348 48.661v27.149H88.428v36.813h31.788v94.461l38.016-.001z",
10006
10017
  fill: "#3c5a9a"
10007
10018
  })));
@@ -10074,15 +10085,15 @@ var googleLogin = createCommonjsModule(function (module, exports) {
10074
10085
  unwrapExports(googleLogin);
10075
10086
  var googleLogin_1 = googleLogin.GoogleLogin;
10076
10087
 
10077
- var _path$l, _path2$2, _path3$1, _path4;
10088
+ var _path$m, _path2$2, _path3$1, _path4;
10078
10089
 
10079
- function _extends$n() { _extends$n = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$n.apply(this, arguments); }
10090
+ function _extends$o() { _extends$o = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$o.apply(this, arguments); }
10080
10091
 
10081
10092
  function SvgGoogleLogo(props) {
10082
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$n({
10093
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$o({
10083
10094
  viewBox: "0 0 24 24",
10084
10095
  xmlns: "http://www.w3.org/2000/svg"
10085
- }, props), _path$l || (_path$l = /*#__PURE__*/React__namespace.createElement("path", {
10096
+ }, props), _path$m || (_path$m = /*#__PURE__*/React__namespace.createElement("path", {
10086
10097
  fill: "#4285F4",
10087
10098
  d: "M23.745 12.27c0-.79-.07-1.54-.19-2.27h-11.3v4.51h6.47c-.29 1.48-1.14 2.73-2.4 3.58v3h3.86c2.26-2.09 3.56-5.17 3.56-8.82z"
10088
10099
  })), _path2$2 || (_path2$2 = /*#__PURE__*/React__namespace.createElement("path", {
@@ -10159,17 +10170,127 @@ const GoogleLoginButton = ({
10159
10170
  }) : null;
10160
10171
  };
10161
10172
 
10173
+ var _path$l;
10174
+
10175
+ function _extends$n() { _extends$n = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$n.apply(this, arguments); }
10176
+
10177
+ function SvgAuth0Logo(props) {
10178
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$n({
10179
+ viewBox: "0 0 256 285",
10180
+ xmlns: "http://www.w3.org/2000/svg"
10181
+ }, props), _path$l || (_path$l = /*#__PURE__*/React__namespace.createElement("path", {
10182
+ d: "M220.412 0h-92.415l28.562 89.006h92.416l-74.77 53.077 28.57 89.511c48.128-35.06 63.854-88.12 46.208-142.588L220.413 0zM7.018 89.006h92.416L127.997 0H35.589L7.019 89.006c-17.655 54.468-1.92 107.529 46.207 142.588l28.563-89.51-74.77-53.078zm46.208 142.588l74.77 52.97 74.77-52.97-74.77-53.847-74.77 53.847z"
10183
+ })));
10184
+ }
10185
+
10186
+ const Auth0LoginButton = ({
10187
+ label = "Auth0",
10188
+ className = "",
10189
+ labelClassName = "",
10190
+ iconClassName = ""
10191
+ }) => {
10192
+ if (!window.auth0 && window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url) {
10193
+ console.error("Auth0 sdk script wasn't loaded, you need to load auth0 sdk before rendering the Auth0LoginButton");
10194
+ }
10195
+
10196
+ const auth0Enabled = Boolean(window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url && window.auth0);
10197
+ const auth0InstanceRef = React__default['default'].useRef(null);
10198
+ React__default['default'].useEffect(() => {
10199
+ if (auth0Enabled) {
10200
+ auth0InstanceRef.current = new window.auth0.WebAuth({
10201
+ domain: window.Pelcro.site.read().auth0_base_url,
10202
+ clientID: window.Pelcro.site.read().auth0_client_id
10203
+ });
10204
+ }
10205
+ }, []);
10206
+ const {
10207
+ dispatch: loginDispatch
10208
+ } = React.useContext(store$f);
10209
+ const {
10210
+ dispatch: registerDispatch
10211
+ } = React.useContext(store$e);
10212
+
10213
+ function handleClick() {
10214
+ var _auth0InstanceRef$cur, _auth0InstanceRef$cur2, _auth0InstanceRef$cur3;
10215
+
10216
+ (_auth0InstanceRef$cur = auth0InstanceRef.current) === null || _auth0InstanceRef$cur === void 0 ? void 0 : (_auth0InstanceRef$cur2 = _auth0InstanceRef$cur.popup) === null || _auth0InstanceRef$cur2 === void 0 ? void 0 : (_auth0InstanceRef$cur3 = _auth0InstanceRef$cur2.authorize) === null || _auth0InstanceRef$cur3 === void 0 ? void 0 : _auth0InstanceRef$cur3.call(_auth0InstanceRef$cur2, {
10217
+ responseType: "token id_token",
10218
+ owp: true // close popup when finished
10219
+
10220
+ }, function (error, authResult) {
10221
+ if (error) {
10222
+ return onFailure(error);
10223
+ }
10224
+
10225
+ onSuccess(authResult);
10226
+ });
10227
+ }
10228
+
10229
+ const onSuccess = authResult => {
10230
+ var _auth0InstanceRef$cur4, _auth0InstanceRef$cur5, _auth0InstanceRef$cur6;
10231
+
10232
+ const {
10233
+ accessToken
10234
+ } = authResult;
10235
+ (_auth0InstanceRef$cur4 = auth0InstanceRef.current) === null || _auth0InstanceRef$cur4 === void 0 ? void 0 : (_auth0InstanceRef$cur5 = _auth0InstanceRef$cur4.client) === null || _auth0InstanceRef$cur5 === void 0 ? void 0 : (_auth0InstanceRef$cur6 = _auth0InstanceRef$cur5.userInfo) === null || _auth0InstanceRef$cur6 === void 0 ? void 0 : _auth0InstanceRef$cur6.call(_auth0InstanceRef$cur5, accessToken, (error, user) => {
10236
+ if (error) {
10237
+ return onFailure(error);
10238
+ }
10239
+
10240
+ const {
10241
+ email,
10242
+ nickname
10243
+ } = user;
10244
+ loginDispatch === null || loginDispatch === void 0 ? void 0 : loginDispatch({
10245
+ type: HANDLE_SOCIAL_LOGIN,
10246
+ payload: {
10247
+ idpName: "auth0",
10248
+ idpToken: accessToken,
10249
+ firstName: nickname,
10250
+ email
10251
+ }
10252
+ });
10253
+ registerDispatch === null || registerDispatch === void 0 ? void 0 : registerDispatch({
10254
+ type: HANDLE_SOCIAL_LOGIN,
10255
+ payload: {
10256
+ idpName: "auth0",
10257
+ idpToken: accessToken,
10258
+ firstName: nickname,
10259
+ email
10260
+ }
10261
+ });
10262
+ });
10263
+ };
10264
+
10265
+ const onFailure = error => {
10266
+ console.error(error);
10267
+ };
10268
+
10269
+ if (auth0Enabled) {
10270
+ return /*#__PURE__*/React__default['default'].createElement("button", {
10271
+ onClick: handleClick,
10272
+ className: `plc-flex plc-items-center plc-justify-center plc-w-full plc-p-3 plc-space-x-3 plc-text-gray-700 plc-border plc-border-gray-200 plc-rounded-3xl hover:plc-bg-gray-200 pelcro-auth0-login ${className}`
10273
+ }, /*#__PURE__*/React__default['default'].createElement(SvgAuth0Logo, {
10274
+ className: `plc-w-6 plc-h-auto pelcro-auth0-login-icon" ${iconClassName}`
10275
+ }), /*#__PURE__*/React__default['default'].createElement("p", {
10276
+ className: `pelcro-auth0-login-label ${labelClassName}`
10277
+ }, label));
10278
+ }
10279
+
10280
+ return null;
10281
+ };
10282
+
10162
10283
  /**
10163
10284
  *
10164
10285
  */
10165
10286
 
10166
10287
  function LoginView(props) {
10167
- var _window$Pelcro$site$r, _window$Pelcro$site$r2;
10288
+ var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3;
10168
10289
 
10169
10290
  const {
10170
10291
  t
10171
10292
  } = useTranslation("login");
10172
- const socialLoginEnabled = ((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.facebook_app_id) || ((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.google_app_id);
10293
+ const socialLoginEnabled = ((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.facebook_app_id) || ((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.google_app_id) || ((_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.auth0_client_id);
10173
10294
  return /*#__PURE__*/React__default['default'].createElement("div", {
10174
10295
  id: "pelcro-login-view"
10175
10296
  }, /*#__PURE__*/React__default['default'].createElement("div", {
@@ -10213,7 +10334,7 @@ function LoginView(props) {
10213
10334
  className: "plc-w-full plc-border-gray-300"
10214
10335
  })), /*#__PURE__*/React__default['default'].createElement("div", {
10215
10336
  className: "plc-flex plc-justify-center plc-px-5 plc-mt-1 plc-space-x-3"
10216
- }, /*#__PURE__*/React__default['default'].createElement(GoogleLoginButton, null), /*#__PURE__*/React__default['default'].createElement(FacebookLoginButton, null))))));
10337
+ }, /*#__PURE__*/React__default['default'].createElement(GoogleLoginButton, null), /*#__PURE__*/React__default['default'].createElement(FacebookLoginButton, null), /*#__PURE__*/React__default['default'].createElement(Auth0LoginButton, null))))));
10217
10338
  }
10218
10339
 
10219
10340
  var _path$k, _path2$1, _path3;
@@ -10572,7 +10693,7 @@ const RegisterLastName = props => /*#__PURE__*/React__default['default'].createE
10572
10693
  */
10573
10694
 
10574
10695
  function RegisterView(props) {
10575
- var _product$paywall$regi, _product$paywall, _product$paywall$regi2, _product$paywall2, _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro, _window$Pelcro$uiSett;
10696
+ var _product$paywall$regi, _product$paywall, _product$paywall$regi2, _product$paywall2, _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro, _window$Pelcro$uiSett;
10576
10697
 
10577
10698
  const {
10578
10699
  t
@@ -10582,7 +10703,7 @@ function RegisterView(props) {
10582
10703
  } = usePelcro();
10583
10704
  const title = (_product$paywall$regi = product === null || product === void 0 ? void 0 : (_product$paywall = product.paywall) === null || _product$paywall === void 0 ? void 0 : _product$paywall.register_title) !== null && _product$paywall$regi !== void 0 ? _product$paywall$regi : t("title");
10584
10705
  const subtitle = (_product$paywall$regi2 = product === null || product === void 0 ? void 0 : (_product$paywall2 = product.paywall) === null || _product$paywall2 === void 0 ? void 0 : _product$paywall2.register_subtitle) !== null && _product$paywall$regi2 !== void 0 ? _product$paywall$regi2 : t("subtitle");
10585
- const socialLoginEnabled = ((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.facebook_app_id) || ((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.google_app_id);
10706
+ const socialLoginEnabled = ((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.facebook_app_id) || ((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.google_app_id) || ((_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.auth0_client_id);
10586
10707
  const showNameFields = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableNameFieldsInRegister;
10587
10708
  return /*#__PURE__*/React__default['default'].createElement("div", {
10588
10709
  id: "pelcro-register-view"
@@ -10640,7 +10761,7 @@ function RegisterView(props) {
10640
10761
  className: "plc-w-full plc-border-gray-300"
10641
10762
  })), /*#__PURE__*/React__default['default'].createElement("div", {
10642
10763
  className: "plc-flex plc-justify-center plc-px-5 plc-mt-1 plc-space-x-3"
10643
- }, /*#__PURE__*/React__default['default'].createElement(GoogleLoginButton, null), /*#__PURE__*/React__default['default'].createElement(FacebookLoginButton, null))))));
10764
+ }, /*#__PURE__*/React__default['default'].createElement(GoogleLoginButton, null), /*#__PURE__*/React__default['default'].createElement(FacebookLoginButton, null), /*#__PURE__*/React__default['default'].createElement(Auth0LoginButton, null))))));
10644
10765
  }
10645
10766
  /**
10646
10767
  * Checks if the current site has security token enabled
@@ -10648,9 +10769,9 @@ function RegisterView(props) {
10648
10769
  */
10649
10770
 
10650
10771
  function hasSecurityTokenEnabled() {
10651
- var _window$Pelcro$site, _window$Pelcro$site$r3;
10772
+ var _window$Pelcro$site, _window$Pelcro$site$r4;
10652
10773
 
10653
- return Boolean((_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r3 = _window$Pelcro$site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.security_key);
10774
+ return Boolean((_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r4 = _window$Pelcro$site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.security_key);
10654
10775
  }
10655
10776
 
10656
10777
  function TextInput({
@@ -23923,6 +24044,7 @@ exports.AddressUpdateView = AddressUpdateView;
23923
24044
  exports.Alert = AlertWithContext;
23924
24045
  exports.AlertElement = Alert;
23925
24046
  exports.ApplyCouponButton = ApplyCouponButton;
24047
+ exports.Auth0LoginButton = Auth0LoginButton;
23926
24048
  exports.Badge = Badge;
23927
24049
  exports.BankRedirection = BankRedirection;
23928
24050
  exports.Button = Button;
package/dist/index.esm.js CHANGED
@@ -6770,6 +6770,8 @@ class SaveToMetadataButtonClass {
6770
6770
  _saveToMetadata.set(this, {
6771
6771
  writable: true,
6772
6772
  value: event => {
6773
+ var _user$metadata;
6774
+
6773
6775
  const button = event.currentTarget;
6774
6776
  const user = window.Pelcro.user.read();
6775
6777
  const {
@@ -6785,7 +6787,7 @@ class SaveToMetadataButtonClass {
6785
6787
 
6786
6788
  let newMetadataValue = [buttonMetadata]; // if this key already exist in user metadata object, append to it.
6787
6789
 
6788
- const oldValue = user.metadata[`metadata_saved_${key}`];
6790
+ const oldValue = (_user$metadata = user.metadata) === null || _user$metadata === void 0 ? void 0 : _user$metadata[`metadata_saved_${key}`];
6789
6791
 
6790
6792
  if (oldValue) {
6791
6793
  if (Array.isArray(oldValue)) {
@@ -6899,8 +6901,8 @@ const saveToMetadataButton = new SaveToMetadataButtonClass();
6899
6901
 
6900
6902
  let e={data:""},t=t=>"undefined"!=typeof window?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||e,l=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(})/g,a=/\/\*[^]*?\*\/|\s\s+|\n/g,n=(e,t)=>{let r,l="",a="",o="";for(let c in e){let s=e[c];"object"==typeof s?(r=t?t.replace(/([^,])+/g,e=>c.replace(/([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):c,a+="@"==c[0]?"f"==c[1]?n(s,c):c+"{"+n(s,"k"==c[1]?"":t)+"}":n(s,r)):"@"==c[0]&&"i"==c[1]?l=c+" "+s+";":(c=c.replace(/[A-Z]/g,"-$&").toLowerCase(),o+=n.p?n.p(c,s):c+":"+s+";");}return o[0]?(r=t?t+"{"+o+"}":o,l+r+a):l+a},o={},c=e=>{let t="";for(let r in e)t+=r+("object"==typeof e[r]?c(e[r]):e[r]);return t},s=(e,t,r,s,i)=>{let p="object"==typeof e?c(e):e,u=o[p]||(o[p]=(e=>{let t=0,r=11;for(;t<e.length;)r=101*r+e.charCodeAt(t++)>>>0;return "go"+r})(p));if(!o[u]){let t="object"==typeof e?e:(e=>{let t,r=[{}];for(;t=l.exec(e.replace(a,""));)t[4]&&r.shift(),t[3]?r.unshift(r[0][t[3]]=r[0][t[3]]||{}):t[4]||(r[0][t[1]]=t[2]);return r[0]})(e);o[u]=n(i?{["@keyframes "+u]:t}:t,r?"":"."+u);}return ((e,t,r)=>{-1==t.data.indexOf(e)&&(t.data=r?e+t.data:t.data+e);})(o[u],t,s),u},i=(e,t,r)=>e.reduce((e,l,a)=>{let o=t[a];if(o&&o.call){let e=o(r),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;o=t?"."+t:e&&"object"==typeof e?e.props?"":n(e,""):e;}return e+l+(null==o?"":o)},"");function p(e){let r=this||{},l=e.call?e(r.p):e;return s(l.unshift?l.raw?i(l,[].slice.call(arguments,1),r.p):l.reduce((e,t)=>t?Object.assign(e,t.call?t(r.p):t):e,{}):l,t(r.target),r.g,r.o,r.k)}let u,f,d;p.bind({g:1});let b=p.bind({k:1});function h(e,t,r,l){n.p=t,u=e,f=r,d=l;}function y(e,t){let r=this||{};return function(){let l=arguments;function a(n,o){let c=Object.assign({},n),s=c.className||a.className;r.p=Object.assign({theme:f&&f()},c),r.o=/ *go\d+/.test(s),c.className=p.apply(r,l)+(s?" "+s:""),t&&(c.ref=o);let i=c.as||e;return d&&i[0]&&d(c),u(i,c)}return t?t(a):a}}
6901
6903
 
6902
- function _extends$v() {
6903
- _extends$v = Object.assign || function (target) {
6904
+ function _extends$w() {
6905
+ _extends$w = Object.assign || function (target) {
6904
6906
  for (var i = 1; i < arguments.length; i++) {
6905
6907
  var source = arguments[i];
6906
6908
 
@@ -6914,7 +6916,7 @@ function _extends$v() {
6914
6916
  return target;
6915
6917
  };
6916
6918
 
6917
- return _extends$v.apply(this, arguments);
6919
+ return _extends$w.apply(this, arguments);
6918
6920
  }
6919
6921
 
6920
6922
  function _taggedTemplateLiteralLoose(strings, raw) {
@@ -7004,7 +7006,7 @@ var clearFromRemoveQueue = function clearFromRemoveQueue(toastId) {
7004
7006
  var reducer = function reducer(state, action) {
7005
7007
  switch (action.type) {
7006
7008
  case ActionType.ADD_TOAST:
7007
- return _extends$v({}, state, {
7009
+ return _extends$w({}, state, {
7008
7010
  toasts: [action.toast].concat(state.toasts).slice(0, TOAST_LIMIT)
7009
7011
  });
7010
7012
 
@@ -7014,9 +7016,9 @@ var reducer = function reducer(state, action) {
7014
7016
  clearFromRemoveQueue(action.toast.id);
7015
7017
  }
7016
7018
 
7017
- return _extends$v({}, state, {
7019
+ return _extends$w({}, state, {
7018
7020
  toasts: state.toasts.map(function (t) {
7019
- return t.id === action.toast.id ? _extends$v({}, t, action.toast) : t;
7021
+ return t.id === action.toast.id ? _extends$w({}, t, action.toast) : t;
7020
7022
  })
7021
7023
  });
7022
7024
 
@@ -7043,9 +7045,9 @@ var reducer = function reducer(state, action) {
7043
7045
  });
7044
7046
  }
7045
7047
 
7046
- return _extends$v({}, state, {
7048
+ return _extends$w({}, state, {
7047
7049
  toasts: state.toasts.map(function (t) {
7048
- return t.id === toastId || toastId === undefined ? _extends$v({}, t, {
7050
+ return t.id === toastId || toastId === undefined ? _extends$w({}, t, {
7049
7051
  visible: false
7050
7052
  }) : t;
7051
7053
  })
@@ -7053,28 +7055,28 @@ var reducer = function reducer(state, action) {
7053
7055
 
7054
7056
  case ActionType.REMOVE_TOAST:
7055
7057
  if (action.toastId === undefined) {
7056
- return _extends$v({}, state, {
7058
+ return _extends$w({}, state, {
7057
7059
  toasts: []
7058
7060
  });
7059
7061
  }
7060
7062
 
7061
- return _extends$v({}, state, {
7063
+ return _extends$w({}, state, {
7062
7064
  toasts: state.toasts.filter(function (t) {
7063
7065
  return t.id !== action.toastId;
7064
7066
  })
7065
7067
  });
7066
7068
 
7067
7069
  case ActionType.START_PAUSE:
7068
- return _extends$v({}, state, {
7070
+ return _extends$w({}, state, {
7069
7071
  pausedAt: action.time
7070
7072
  });
7071
7073
 
7072
7074
  case ActionType.END_PAUSE:
7073
7075
  var diff = action.time - (state.pausedAt || 0);
7074
- return _extends$v({}, state, {
7076
+ return _extends$w({}, state, {
7075
7077
  pausedAt: undefined,
7076
7078
  toasts: state.toasts.map(function (t) {
7077
- return _extends$v({}, t, {
7079
+ return _extends$w({}, t, {
7078
7080
  pauseDuration: t.pauseDuration + diff
7079
7081
  });
7080
7082
  })
@@ -7121,12 +7123,12 @@ var useStore = function useStore(toastOptions) {
7121
7123
  var mergedToasts = state.toasts.map(function (t) {
7122
7124
  var _toastOptions$t$type, _toastOptions, _toastOptions$t$type2;
7123
7125
 
7124
- return _extends$v({}, toastOptions, toastOptions[t.type], t, {
7126
+ return _extends$w({}, toastOptions, toastOptions[t.type], t, {
7125
7127
  duration: t.duration || ((_toastOptions$t$type = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type.duration) || ((_toastOptions = toastOptions) == null ? void 0 : _toastOptions.duration) || defaultTimeouts[t.type],
7126
- style: _extends$v({}, toastOptions.style, (_toastOptions$t$type2 = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type2.style, t.style)
7128
+ style: _extends$w({}, toastOptions.style, (_toastOptions$t$type2 = toastOptions[t.type]) == null ? void 0 : _toastOptions$t$type2.style, t.style)
7127
7129
  });
7128
7130
  });
7129
- return _extends$v({}, state, {
7131
+ return _extends$w({}, state, {
7130
7132
  toasts: mergedToasts
7131
7133
  });
7132
7134
  };
@@ -7136,7 +7138,7 @@ var createToast = function createToast(message, type, opts) {
7136
7138
  type = 'blank';
7137
7139
  }
7138
7140
 
7139
- return _extends$v({
7141
+ return _extends$w({
7140
7142
  createdAt: Date.now(),
7141
7143
  visible: true,
7142
7144
  type: type,
@@ -7186,14 +7188,14 @@ toast.remove = function (toastId) {
7186
7188
  };
7187
7189
 
7188
7190
  toast.promise = function (promise, msgs, opts) {
7189
- var id = toast.loading(msgs.loading, _extends$v({}, opts, opts == null ? void 0 : opts.loading));
7191
+ var id = toast.loading(msgs.loading, _extends$w({}, opts, opts == null ? void 0 : opts.loading));
7190
7192
  promise.then(function (p) {
7191
- toast.success(resolveValue(msgs.success, p), _extends$v({
7193
+ toast.success(resolveValue(msgs.success, p), _extends$w({
7192
7194
  id: id
7193
7195
  }, opts, opts == null ? void 0 : opts.success));
7194
7196
  return p;
7195
7197
  })["catch"](function (e) {
7196
- toast.error(resolveValue(msgs.error, e), _extends$v({
7198
+ toast.error(resolveValue(msgs.error, e), _extends$w({
7197
7199
  id: id
7198
7200
  }, opts, opts == null ? void 0 : opts.error));
7199
7201
  });
@@ -7532,7 +7534,7 @@ var ToastBar = /*#__PURE__*/memo(function (_ref2) {
7532
7534
  var message = createElement(Message, Object.assign({}, toast.ariaProps), resolveValue(toast.message, toast));
7533
7535
  return createElement(ToastBarBase, {
7534
7536
  className: toast.className,
7535
- style: _extends$v({}, animationStyle, style, toast.style)
7537
+ style: _extends$w({}, animationStyle, style, toast.style)
7536
7538
  }, typeof children === 'function' ? children({
7537
7539
  icon: icon,
7538
7540
  message: message
@@ -7562,7 +7564,7 @@ var getPositionStyle = function getPositionStyle(position, offset) {
7562
7564
  } : position.includes('right') ? {
7563
7565
  justifyContent: 'flex-end'
7564
7566
  } : {};
7565
- return _extends$v({
7567
+ return _extends$w({
7566
7568
  left: 0,
7567
7569
  right: 0,
7568
7570
  display: 'flex',
@@ -7589,7 +7591,7 @@ var Toaster = function Toaster(_ref) {
7589
7591
  handlers = _useToaster.handlers;
7590
7592
 
7591
7593
  return createElement("div", {
7592
- style: _extends$v({
7594
+ style: _extends$w({
7593
7595
  position: 'fixed',
7594
7596
  zIndex: 9999,
7595
7597
  top: DEFAULT_OFFSET,
@@ -7624,82 +7626,82 @@ var Toaster = function Toaster(_ref) {
7624
7626
  }));
7625
7627
  };
7626
7628
 
7627
- var _path$s;
7629
+ var _path$t;
7628
7630
 
7629
- function _extends$u() { _extends$u = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$u.apply(this, arguments); }
7631
+ function _extends$v() { _extends$v = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$v.apply(this, arguments); }
7630
7632
 
7631
7633
  function SvgCheckSolid(props) {
7632
- return /*#__PURE__*/React.createElement("svg", _extends$u({
7634
+ return /*#__PURE__*/React.createElement("svg", _extends$v({
7633
7635
  xmlns: "http://www.w3.org/2000/svg",
7634
7636
  className: "h-5 w-5",
7635
7637
  viewBox: "0 0 20 20",
7636
7638
  fill: "currentColor"
7637
- }, props), _path$s || (_path$s = /*#__PURE__*/React.createElement("path", {
7639
+ }, props), _path$t || (_path$t = /*#__PURE__*/React.createElement("path", {
7638
7640
  fillRule: "evenodd",
7639
7641
  d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",
7640
7642
  clipRule: "evenodd"
7641
7643
  })));
7642
7644
  }
7643
7645
 
7644
- var _path$r;
7646
+ var _path$s;
7645
7647
 
7646
- function _extends$t() { _extends$t = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$t.apply(this, arguments); }
7648
+ function _extends$u() { _extends$u = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$u.apply(this, arguments); }
7647
7649
 
7648
7650
  function SvgXIcon(props) {
7649
- return /*#__PURE__*/React.createElement("svg", _extends$t({
7651
+ return /*#__PURE__*/React.createElement("svg", _extends$u({
7650
7652
  xmlns: "http://www.w3.org/2000/svg",
7651
7653
  viewBox: "0 0 20 20",
7652
7654
  fill: "currentColor"
7653
- }, props), _path$r || (_path$r = /*#__PURE__*/React.createElement("path", {
7655
+ }, props), _path$s || (_path$s = /*#__PURE__*/React.createElement("path", {
7654
7656
  fill: "evenodd",
7655
7657
  d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
7656
7658
  clipRule: "evenodd"
7657
7659
  })));
7658
7660
  }
7659
7661
 
7660
- var _path$q;
7662
+ var _path$r;
7661
7663
 
7662
- function _extends$s() { _extends$s = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$s.apply(this, arguments); }
7664
+ function _extends$t() { _extends$t = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$t.apply(this, arguments); }
7663
7665
 
7664
7666
  function SvgXIconSolid(props) {
7665
- return /*#__PURE__*/React.createElement("svg", _extends$s({
7667
+ return /*#__PURE__*/React.createElement("svg", _extends$t({
7666
7668
  className: "plc-w-4 plc-h-4",
7667
7669
  fill: "currentColor",
7668
7670
  xmlns: "http://www.w3.org/2000/svg",
7669
7671
  viewBox: "0 0 100 100"
7670
- }, props), _path$q || (_path$q = /*#__PURE__*/React.createElement("path", {
7672
+ }, props), _path$r || (_path$r = /*#__PURE__*/React.createElement("path", {
7671
7673
  d: "M94.842 48.408c0 24.852-20.148 44.999-45.002 44.999-24.851 0-44.997-20.146-44.997-44.999 0-24.854 20.146-45 44.997-45 24.853 0 45.002 20.146 45.002 45zM71.073 64.841L54.73 48.497l16.344-16.344-4.979-4.979-16.343 16.345-16.343-16.344-4.799 4.799 16.344 16.344L28.61 64.661l4.979 4.978 16.344-16.344 16.343 16.344 4.797-4.798z"
7672
7674
  })));
7673
7675
  }
7674
7676
 
7675
- var _path$p;
7677
+ var _path$q;
7676
7678
 
7677
- function _extends$r() { _extends$r = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$r.apply(this, arguments); }
7679
+ function _extends$s() { _extends$s = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$s.apply(this, arguments); }
7678
7680
 
7679
7681
  function SvgExclamation(props) {
7680
- return /*#__PURE__*/React.createElement("svg", _extends$r({
7682
+ return /*#__PURE__*/React.createElement("svg", _extends$s({
7681
7683
  className: "plc-w-4 plc-h-4 plc-mr-1",
7682
7684
  xmlns: "http://www.w3.org/2000/svg",
7683
7685
  viewBox: "0 0 20 20",
7684
7686
  fill: "currentColor"
7685
- }, props), _path$p || (_path$p = /*#__PURE__*/React.createElement("path", {
7687
+ }, props), _path$q || (_path$q = /*#__PURE__*/React.createElement("path", {
7686
7688
  fillRule: "evenodd",
7687
7689
  d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",
7688
7690
  clipRule: "evenodd"
7689
7691
  })));
7690
7692
  }
7691
7693
 
7692
- var _path$o, _path2$3;
7694
+ var _path$p, _path2$3;
7693
7695
 
7694
- function _extends$q() { _extends$q = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$q.apply(this, arguments); }
7696
+ function _extends$r() { _extends$r = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$r.apply(this, arguments); }
7695
7697
 
7696
7698
  function SvgSpinner(props) {
7697
- return /*#__PURE__*/React.createElement("svg", _extends$q({
7699
+ return /*#__PURE__*/React.createElement("svg", _extends$r({
7698
7700
  className: "plc-animate-spin",
7699
7701
  viewBox: "0 0 24 24",
7700
7702
  fill: "currentColor",
7701
7703
  xmlns: "http://www.w3.org/2000/svg"
7702
- }, props), _path$o || (_path$o = /*#__PURE__*/React.createElement("path", {
7704
+ }, props), _path$p || (_path$p = /*#__PURE__*/React.createElement("path", {
7703
7705
  opacity: 0.2,
7704
7706
  fill: "evenodd",
7705
7707
  clipRule: "evenodd",
@@ -8451,6 +8453,7 @@ const optionsController = options => {
8451
8453
 
8452
8454
  const optionsMethodsDict = {
8453
8455
  loadPaymentSDKs: loadPaymentSDKs,
8456
+ loadAuth0SDK: loadAuth0SDK,
8454
8457
  enableURLTriggers: initViewFromURL,
8455
8458
  enableTheme: applyPelcroTheme,
8456
8459
  enablePaywalls: initPaywalls,
@@ -8516,6 +8519,13 @@ const loadPaymentSDKs = () => {
8516
8519
  window.Pelcro.helpers.loadSDK("https://js.braintreegateway.com/web/3.69.0/js/paypal-checkout.min.js", "braintree-paypal-sdk");
8517
8520
  }
8518
8521
  };
8522
+ const loadAuth0SDK = () => {
8523
+ const auth0Enabled = Boolean(window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url);
8524
+
8525
+ if (auth0Enabled) {
8526
+ window.Pelcro.helpers.loadSDK("https://cdn.auth0.com/js/auth0/9.18/auth0.min.js", "auth0-sdk");
8527
+ }
8528
+ };
8519
8529
  const initSecuritySdk = () => {
8520
8530
  const {
8521
8531
  whenSiteReady
@@ -8812,6 +8822,7 @@ const initCartFromUrl = () => {
8812
8822
 
8813
8823
  const defaultOptions = {
8814
8824
  loadPaymentSDKs: true,
8825
+ loadAuth0SDK: true,
8815
8826
  enableURLTriggers: true,
8816
8827
  enableTheme: true,
8817
8828
  enablePaywalls: true,
@@ -9637,16 +9648,16 @@ const LoginPassword = props => /*#__PURE__*/React__default.createElement(Passwor
9637
9648
  store: store$f
9638
9649
  }, props));
9639
9650
 
9640
- var _path$n;
9651
+ var _path$o;
9641
9652
 
9642
- function _extends$p() { _extends$p = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$p.apply(this, arguments); }
9653
+ function _extends$q() { _extends$q = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$q.apply(this, arguments); }
9643
9654
 
9644
9655
  function SvgCheck(props) {
9645
- return /*#__PURE__*/React.createElement("svg", _extends$p({
9656
+ return /*#__PURE__*/React.createElement("svg", _extends$q({
9646
9657
  xmlns: "http://www.w3.org/2000/svg",
9647
9658
  fill: "currentColor",
9648
9659
  viewBox: "0 0 20 20"
9649
- }, props), _path$n || (_path$n = /*#__PURE__*/React.createElement("path", {
9660
+ }, props), _path$o || (_path$o = /*#__PURE__*/React.createElement("path", {
9650
9661
  fillRule: "evenodd",
9651
9662
  d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
9652
9663
  clipRule: "evenodd"
@@ -9963,15 +9974,15 @@ function hasSecurityTokenEnabled$1() {
9963
9974
  return hasSecuritySdkLoaded;
9964
9975
  }
9965
9976
 
9966
- var _path$m;
9977
+ var _path$n;
9967
9978
 
9968
- function _extends$o() { _extends$o = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$o.apply(this, arguments); }
9979
+ function _extends$p() { _extends$p = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$p.apply(this, arguments); }
9969
9980
 
9970
9981
  function SvgFacebookLogo(props) {
9971
- return /*#__PURE__*/React.createElement("svg", _extends$o({
9982
+ return /*#__PURE__*/React.createElement("svg", _extends$p({
9972
9983
  xmlns: "http://www.w3.org/2000/svg",
9973
9984
  viewBox: "88.428 12.828 107.543 207.085"
9974
- }, props), _path$m || (_path$m = /*#__PURE__*/React.createElement("path", {
9985
+ }, props), _path$n || (_path$n = /*#__PURE__*/React.createElement("path", {
9975
9986
  d: "M158.232 219.912v-94.461h31.707l4.747-36.813h-36.454V65.134c0-10.658 2.96-17.922 18.245-17.922l19.494-.009V14.278c-3.373-.447-14.944-1.449-28.406-1.449-28.106 0-47.348 17.155-47.348 48.661v27.149H88.428v36.813h31.788v94.461l38.016-.001z",
9976
9987
  fill: "#3c5a9a"
9977
9988
  })));
@@ -10044,15 +10055,15 @@ var googleLogin = createCommonjsModule(function (module, exports) {
10044
10055
  unwrapExports(googleLogin);
10045
10056
  var googleLogin_1 = googleLogin.GoogleLogin;
10046
10057
 
10047
- var _path$l, _path2$2, _path3$1, _path4;
10058
+ var _path$m, _path2$2, _path3$1, _path4;
10048
10059
 
10049
- function _extends$n() { _extends$n = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$n.apply(this, arguments); }
10060
+ function _extends$o() { _extends$o = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$o.apply(this, arguments); }
10050
10061
 
10051
10062
  function SvgGoogleLogo(props) {
10052
- return /*#__PURE__*/React.createElement("svg", _extends$n({
10063
+ return /*#__PURE__*/React.createElement("svg", _extends$o({
10053
10064
  viewBox: "0 0 24 24",
10054
10065
  xmlns: "http://www.w3.org/2000/svg"
10055
- }, props), _path$l || (_path$l = /*#__PURE__*/React.createElement("path", {
10066
+ }, props), _path$m || (_path$m = /*#__PURE__*/React.createElement("path", {
10056
10067
  fill: "#4285F4",
10057
10068
  d: "M23.745 12.27c0-.79-.07-1.54-.19-2.27h-11.3v4.51h6.47c-.29 1.48-1.14 2.73-2.4 3.58v3h3.86c2.26-2.09 3.56-5.17 3.56-8.82z"
10058
10069
  })), _path2$2 || (_path2$2 = /*#__PURE__*/React.createElement("path", {
@@ -10129,17 +10140,127 @@ const GoogleLoginButton = ({
10129
10140
  }) : null;
10130
10141
  };
10131
10142
 
10143
+ var _path$l;
10144
+
10145
+ function _extends$n() { _extends$n = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$n.apply(this, arguments); }
10146
+
10147
+ function SvgAuth0Logo(props) {
10148
+ return /*#__PURE__*/React.createElement("svg", _extends$n({
10149
+ viewBox: "0 0 256 285",
10150
+ xmlns: "http://www.w3.org/2000/svg"
10151
+ }, props), _path$l || (_path$l = /*#__PURE__*/React.createElement("path", {
10152
+ d: "M220.412 0h-92.415l28.562 89.006h92.416l-74.77 53.077 28.57 89.511c48.128-35.06 63.854-88.12 46.208-142.588L220.413 0zM7.018 89.006h92.416L127.997 0H35.589L7.019 89.006c-17.655 54.468-1.92 107.529 46.207 142.588l28.563-89.51-74.77-53.078zm46.208 142.588l74.77 52.97 74.77-52.97-74.77-53.847-74.77 53.847z"
10153
+ })));
10154
+ }
10155
+
10156
+ const Auth0LoginButton = ({
10157
+ label = "Auth0",
10158
+ className = "",
10159
+ labelClassName = "",
10160
+ iconClassName = ""
10161
+ }) => {
10162
+ if (!window.auth0 && window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url) {
10163
+ console.error("Auth0 sdk script wasn't loaded, you need to load auth0 sdk before rendering the Auth0LoginButton");
10164
+ }
10165
+
10166
+ const auth0Enabled = Boolean(window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url && window.auth0);
10167
+ const auth0InstanceRef = React__default.useRef(null);
10168
+ React__default.useEffect(() => {
10169
+ if (auth0Enabled) {
10170
+ auth0InstanceRef.current = new window.auth0.WebAuth({
10171
+ domain: window.Pelcro.site.read().auth0_base_url,
10172
+ clientID: window.Pelcro.site.read().auth0_client_id
10173
+ });
10174
+ }
10175
+ }, []);
10176
+ const {
10177
+ dispatch: loginDispatch
10178
+ } = useContext(store$f);
10179
+ const {
10180
+ dispatch: registerDispatch
10181
+ } = useContext(store$e);
10182
+
10183
+ function handleClick() {
10184
+ var _auth0InstanceRef$cur, _auth0InstanceRef$cur2, _auth0InstanceRef$cur3;
10185
+
10186
+ (_auth0InstanceRef$cur = auth0InstanceRef.current) === null || _auth0InstanceRef$cur === void 0 ? void 0 : (_auth0InstanceRef$cur2 = _auth0InstanceRef$cur.popup) === null || _auth0InstanceRef$cur2 === void 0 ? void 0 : (_auth0InstanceRef$cur3 = _auth0InstanceRef$cur2.authorize) === null || _auth0InstanceRef$cur3 === void 0 ? void 0 : _auth0InstanceRef$cur3.call(_auth0InstanceRef$cur2, {
10187
+ responseType: "token id_token",
10188
+ owp: true // close popup when finished
10189
+
10190
+ }, function (error, authResult) {
10191
+ if (error) {
10192
+ return onFailure(error);
10193
+ }
10194
+
10195
+ onSuccess(authResult);
10196
+ });
10197
+ }
10198
+
10199
+ const onSuccess = authResult => {
10200
+ var _auth0InstanceRef$cur4, _auth0InstanceRef$cur5, _auth0InstanceRef$cur6;
10201
+
10202
+ const {
10203
+ accessToken
10204
+ } = authResult;
10205
+ (_auth0InstanceRef$cur4 = auth0InstanceRef.current) === null || _auth0InstanceRef$cur4 === void 0 ? void 0 : (_auth0InstanceRef$cur5 = _auth0InstanceRef$cur4.client) === null || _auth0InstanceRef$cur5 === void 0 ? void 0 : (_auth0InstanceRef$cur6 = _auth0InstanceRef$cur5.userInfo) === null || _auth0InstanceRef$cur6 === void 0 ? void 0 : _auth0InstanceRef$cur6.call(_auth0InstanceRef$cur5, accessToken, (error, user) => {
10206
+ if (error) {
10207
+ return onFailure(error);
10208
+ }
10209
+
10210
+ const {
10211
+ email,
10212
+ nickname
10213
+ } = user;
10214
+ loginDispatch === null || loginDispatch === void 0 ? void 0 : loginDispatch({
10215
+ type: HANDLE_SOCIAL_LOGIN,
10216
+ payload: {
10217
+ idpName: "auth0",
10218
+ idpToken: accessToken,
10219
+ firstName: nickname,
10220
+ email
10221
+ }
10222
+ });
10223
+ registerDispatch === null || registerDispatch === void 0 ? void 0 : registerDispatch({
10224
+ type: HANDLE_SOCIAL_LOGIN,
10225
+ payload: {
10226
+ idpName: "auth0",
10227
+ idpToken: accessToken,
10228
+ firstName: nickname,
10229
+ email
10230
+ }
10231
+ });
10232
+ });
10233
+ };
10234
+
10235
+ const onFailure = error => {
10236
+ console.error(error);
10237
+ };
10238
+
10239
+ if (auth0Enabled) {
10240
+ return /*#__PURE__*/React__default.createElement("button", {
10241
+ onClick: handleClick,
10242
+ className: `plc-flex plc-items-center plc-justify-center plc-w-full plc-p-3 plc-space-x-3 plc-text-gray-700 plc-border plc-border-gray-200 plc-rounded-3xl hover:plc-bg-gray-200 pelcro-auth0-login ${className}`
10243
+ }, /*#__PURE__*/React__default.createElement(SvgAuth0Logo, {
10244
+ className: `plc-w-6 plc-h-auto pelcro-auth0-login-icon" ${iconClassName}`
10245
+ }), /*#__PURE__*/React__default.createElement("p", {
10246
+ className: `pelcro-auth0-login-label ${labelClassName}`
10247
+ }, label));
10248
+ }
10249
+
10250
+ return null;
10251
+ };
10252
+
10132
10253
  /**
10133
10254
  *
10134
10255
  */
10135
10256
 
10136
10257
  function LoginView(props) {
10137
- var _window$Pelcro$site$r, _window$Pelcro$site$r2;
10258
+ var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3;
10138
10259
 
10139
10260
  const {
10140
10261
  t
10141
10262
  } = useTranslation("login");
10142
- const socialLoginEnabled = ((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.facebook_app_id) || ((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.google_app_id);
10263
+ const socialLoginEnabled = ((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.facebook_app_id) || ((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.google_app_id) || ((_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.auth0_client_id);
10143
10264
  return /*#__PURE__*/React__default.createElement("div", {
10144
10265
  id: "pelcro-login-view"
10145
10266
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -10183,7 +10304,7 @@ function LoginView(props) {
10183
10304
  className: "plc-w-full plc-border-gray-300"
10184
10305
  })), /*#__PURE__*/React__default.createElement("div", {
10185
10306
  className: "plc-flex plc-justify-center plc-px-5 plc-mt-1 plc-space-x-3"
10186
- }, /*#__PURE__*/React__default.createElement(GoogleLoginButton, null), /*#__PURE__*/React__default.createElement(FacebookLoginButton, null))))));
10307
+ }, /*#__PURE__*/React__default.createElement(GoogleLoginButton, null), /*#__PURE__*/React__default.createElement(FacebookLoginButton, null), /*#__PURE__*/React__default.createElement(Auth0LoginButton, null))))));
10187
10308
  }
10188
10309
 
10189
10310
  var _path$k, _path2$1, _path3;
@@ -10542,7 +10663,7 @@ const RegisterLastName = props => /*#__PURE__*/React__default.createElement(Last
10542
10663
  */
10543
10664
 
10544
10665
  function RegisterView(props) {
10545
- var _product$paywall$regi, _product$paywall, _product$paywall$regi2, _product$paywall2, _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro, _window$Pelcro$uiSett;
10666
+ var _product$paywall$regi, _product$paywall, _product$paywall$regi2, _product$paywall2, _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro, _window$Pelcro$uiSett;
10546
10667
 
10547
10668
  const {
10548
10669
  t
@@ -10552,7 +10673,7 @@ function RegisterView(props) {
10552
10673
  } = usePelcro();
10553
10674
  const title = (_product$paywall$regi = product === null || product === void 0 ? void 0 : (_product$paywall = product.paywall) === null || _product$paywall === void 0 ? void 0 : _product$paywall.register_title) !== null && _product$paywall$regi !== void 0 ? _product$paywall$regi : t("title");
10554
10675
  const subtitle = (_product$paywall$regi2 = product === null || product === void 0 ? void 0 : (_product$paywall2 = product.paywall) === null || _product$paywall2 === void 0 ? void 0 : _product$paywall2.register_subtitle) !== null && _product$paywall$regi2 !== void 0 ? _product$paywall$regi2 : t("subtitle");
10555
- const socialLoginEnabled = ((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.facebook_app_id) || ((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.google_app_id);
10676
+ const socialLoginEnabled = ((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.facebook_app_id) || ((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.google_app_id) || ((_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.auth0_client_id);
10556
10677
  const showNameFields = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableNameFieldsInRegister;
10557
10678
  return /*#__PURE__*/React__default.createElement("div", {
10558
10679
  id: "pelcro-register-view"
@@ -10610,7 +10731,7 @@ function RegisterView(props) {
10610
10731
  className: "plc-w-full plc-border-gray-300"
10611
10732
  })), /*#__PURE__*/React__default.createElement("div", {
10612
10733
  className: "plc-flex plc-justify-center plc-px-5 plc-mt-1 plc-space-x-3"
10613
- }, /*#__PURE__*/React__default.createElement(GoogleLoginButton, null), /*#__PURE__*/React__default.createElement(FacebookLoginButton, null))))));
10734
+ }, /*#__PURE__*/React__default.createElement(GoogleLoginButton, null), /*#__PURE__*/React__default.createElement(FacebookLoginButton, null), /*#__PURE__*/React__default.createElement(Auth0LoginButton, null))))));
10614
10735
  }
10615
10736
  /**
10616
10737
  * Checks if the current site has security token enabled
@@ -10618,9 +10739,9 @@ function RegisterView(props) {
10618
10739
  */
10619
10740
 
10620
10741
  function hasSecurityTokenEnabled() {
10621
- var _window$Pelcro$site, _window$Pelcro$site$r3;
10742
+ var _window$Pelcro$site, _window$Pelcro$site$r4;
10622
10743
 
10623
- return Boolean((_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r3 = _window$Pelcro$site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.security_key);
10744
+ return Boolean((_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r4 = _window$Pelcro$site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.security_key);
10624
10745
  }
10625
10746
 
10626
10747
  function TextInput({
@@ -23859,4 +23980,4 @@ function ProfilePicChangeModal({
23859
23980
  }
23860
23981
  ProfilePicChangeModal.viewId = "profile-picture";
23861
23982
 
23862
- export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplyCouponButton, Badge, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, Input, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCreateContainer, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, TaxAmount, TextArea, Tooltip, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, notify, unauthenticatedButtons, usePelcro };
23983
+ export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplyCouponButton, Auth0LoginButton, Badge, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, Input, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCreateContainer, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, TaxAmount, TextArea, Tooltip, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, notify, unauthenticatedButtons, usePelcro };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pelcro/react-pelcro-js",
3
3
  "description": "Pelcro's React UI Elements",
4
- "version": "2.6.1",
4
+ "version": "2.7.0-beta.4",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",