@pelcro/react-pelcro-js 3.10.0 → 3.10.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -10530,14 +10530,10 @@ const showInvoiceDetailsFromUrl = () => {
10530
10530
  const {
10531
10531
  isAuthenticated,
10532
10532
  setInvoice,
10533
- whenSiteReady,
10533
+ whenUserReady,
10534
10534
  switchView
10535
10535
  } = usePelcro.getStore();
10536
- whenSiteReady(() => {
10537
- if (!isAuthenticated()) {
10538
- return switchView("login");
10539
- }
10540
-
10536
+ whenUserReady(() => {
10541
10537
  const invoiceId = window.Pelcro.helpers.getURLParameter("id");
10542
10538
  const wasSetSuccessfully = setInvoice(invoiceId);
10543
10539
 
@@ -10548,6 +10544,10 @@ const showInvoiceDetailsFromUrl = () => {
10548
10544
  return notify.error(errorMessage);
10549
10545
  }
10550
10546
 
10547
+ if (!isAuthenticated()) {
10548
+ return switchView("login");
10549
+ }
10550
+
10551
10551
  const {
10552
10552
  invoice
10553
10553
  } = usePelcro.getStore();
@@ -12232,18 +12232,24 @@ function LoginModal({
12232
12232
  } = useTranslation("login");
12233
12233
  const {
12234
12234
  switchView,
12235
- resetView
12235
+ resetView,
12236
+ invoice
12236
12237
  } = usePelcro();
12237
12238
 
12238
12239
  const onSuccess = res => {
12239
12240
  var _props$onSuccess;
12240
12241
 
12241
- (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
12242
- resetView();
12242
+ (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res); // If this is an invoice
12243
+
12244
+ if (invoice) {
12245
+ switchView("invoice-details");
12246
+ }
12243
12247
 
12244
12248
  if (window.Pelcro.paywall.isArticleRestricted()) {
12245
12249
  initPaywalls();
12246
12250
  }
12251
+
12252
+ resetView();
12247
12253
  };
12248
12254
 
12249
12255
  const onCreateAccountClick = () => {
@@ -16073,6 +16079,7 @@ const PaymentMethodContainerWithoutStripe = ({
16073
16079
 
16074
16080
  if (err) {
16075
16081
  onFailure(err);
16082
+ console.error(err);
16076
16083
  dispatch({
16077
16084
  type: SET_COUPON_ERROR,
16078
16085
  payload: getErrorMessages(err)
package/dist/index.esm.js CHANGED
@@ -10500,14 +10500,10 @@ const showInvoiceDetailsFromUrl = () => {
10500
10500
  const {
10501
10501
  isAuthenticated,
10502
10502
  setInvoice,
10503
- whenSiteReady,
10503
+ whenUserReady,
10504
10504
  switchView
10505
10505
  } = usePelcro.getStore();
10506
- whenSiteReady(() => {
10507
- if (!isAuthenticated()) {
10508
- return switchView("login");
10509
- }
10510
-
10506
+ whenUserReady(() => {
10511
10507
  const invoiceId = window.Pelcro.helpers.getURLParameter("id");
10512
10508
  const wasSetSuccessfully = setInvoice(invoiceId);
10513
10509
 
@@ -10518,6 +10514,10 @@ const showInvoiceDetailsFromUrl = () => {
10518
10514
  return notify.error(errorMessage);
10519
10515
  }
10520
10516
 
10517
+ if (!isAuthenticated()) {
10518
+ return switchView("login");
10519
+ }
10520
+
10521
10521
  const {
10522
10522
  invoice
10523
10523
  } = usePelcro.getStore();
@@ -12202,18 +12202,24 @@ function LoginModal({
12202
12202
  } = useTranslation("login");
12203
12203
  const {
12204
12204
  switchView,
12205
- resetView
12205
+ resetView,
12206
+ invoice
12206
12207
  } = usePelcro();
12207
12208
 
12208
12209
  const onSuccess = res => {
12209
12210
  var _props$onSuccess;
12210
12211
 
12211
- (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
12212
- resetView();
12212
+ (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res); // If this is an invoice
12213
+
12214
+ if (invoice) {
12215
+ switchView("invoice-details");
12216
+ }
12213
12217
 
12214
12218
  if (window.Pelcro.paywall.isArticleRestricted()) {
12215
12219
  initPaywalls();
12216
12220
  }
12221
+
12222
+ resetView();
12217
12223
  };
12218
12224
 
12219
12225
  const onCreateAccountClick = () => {
@@ -16043,6 +16049,7 @@ const PaymentMethodContainerWithoutStripe = ({
16043
16049
 
16044
16050
  if (err) {
16045
16051
  onFailure(err);
16052
+ console.error(err);
16046
16053
  dispatch({
16047
16054
  type: SET_COUPON_ERROR,
16048
16055
  payload: getErrorMessages(err)
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": "3.10.0",
4
+ "version": "3.10.1-beta.2",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",