@pelcro/react-pelcro-js 3.26.0-sandbox.35 → 3.26.0-sandbox.37

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
@@ -11564,6 +11564,8 @@ const initPaywalls = () => {
11564
11564
  switchView,
11565
11565
  isAuthenticated
11566
11566
  } = usePelcro.getStore();
11567
+
11568
+ // eslint-disable-next-line no-inner-declarations
11567
11569
  function displayPaywalls() {
11568
11570
  if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayMeterPaywall()) {
11569
11571
  /*
@@ -11580,12 +11582,12 @@ const initPaywalls = () => {
11580
11582
  switchView("plan-select");
11581
11583
  }
11582
11584
  }
11583
- if (isAuthenticated()) {
11585
+ if ("id" in Pelcro.user.read() || !isAuthenticated()) {
11586
+ displayPaywalls();
11587
+ } else {
11584
11588
  addEventListener("PelcroUserLoaded", function () {
11585
11589
  displayPaywalls();
11586
- });
11587
- } else {
11588
- displayPaywalls();
11590
+ }, true);
11589
11591
  }
11590
11592
  }
11591
11593
  };
@@ -20373,7 +20375,7 @@ const ApplePayButton = _ref => {
20373
20375
  if (pelcroApplyPayButton) {
20374
20376
  pelcroApplyPayButton.style.display = "block";
20375
20377
  }
20376
- console.log("canMakePayments", canMakePayments);
20378
+ console.log("ApplePay canMakePayments: ", canMakePayments);
20377
20379
  }
20378
20380
  });
20379
20381
  } else {
@@ -20415,7 +20417,7 @@ const ApplePayButton = _ref => {
20415
20417
  amount: updatedPrice / 100
20416
20418
  }
20417
20419
  };
20418
- console.log(ApplePayPaymentRequest);
20420
+
20419
20421
  // Create ApplePaySession
20420
20422
  // @todo - Clarify supported version parameter
20421
20423
  // @odo - Apple Pay demo uses version 6 (https://applepaydemo.apple.com/)
@@ -20428,7 +20430,6 @@ const ApplePayButton = _ref => {
20428
20430
  const {
20429
20431
  validationURL
20430
20432
  } = event;
20431
- console.log("then merchantSession step", event);
20432
20433
  // Call your own server to request a new merchant session.
20433
20434
  window.Pelcro.payment.startSession({
20434
20435
  auth_token: window.Pelcro.user.read().auth_token,
@@ -20437,7 +20438,6 @@ const ApplePayButton = _ref => {
20437
20438
  }, (err, res) => {
20438
20439
  if (err) {
20439
20440
  // Handle any errors during merchant validation
20440
- console.error("Merchant validation SDK error: ", err);
20441
20441
  session.abort();
20442
20442
  return dispatch({
20443
20443
  type: SHOW_ALERT,
@@ -20448,13 +20448,11 @@ const ApplePayButton = _ref => {
20448
20448
  });
20449
20449
  }
20450
20450
  // Complete merchant validation with the merchant session object
20451
- console.log("Merchant validation SDK response: ", res);
20452
20451
  const merchantSession = res;
20453
20452
  session.completeMerchantValidation(merchantSession);
20454
20453
  });
20455
20454
  };
20456
20455
  session.onpaymentmethodselected = event => {
20457
- console.log("payment method selected step", event);
20458
20456
  // Define ApplePayPaymentMethodUpdate based on the selected payment method.
20459
20457
  // No updates or errors are needed, pass an empty object.
20460
20458
  const newTotal = {
@@ -20472,7 +20470,6 @@ const ApplePayButton = _ref => {
20472
20470
 
20473
20471
  // TODO: Check if onshippingmethodselected it should be implemented
20474
20472
  // session.onshippingmethodselected = (event) => {
20475
- // console.log("on shipping method selected step", event);
20476
20473
  // // Define ApplePayShippingMethodUpdate based on the selected shipping method.
20477
20474
  // // No updates or errors are needed, pass an empty object.
20478
20475
  // const newTotal = {
@@ -20494,14 +20491,12 @@ const ApplePayButton = _ref => {
20494
20491
 
20495
20492
  // TODO: Check if onshippingcontactselected it should be implemented
20496
20493
  // session.onshippingcontactselected = (event) => {
20497
- // console.log("on shipping contact selected step", event);
20498
20494
  // // Define ApplePayShippingContactUpdate based on the selected shipping contact.
20499
20495
  // const update = {};
20500
20496
  // session.completeShippingContactSelection(update);
20501
20497
  // };
20502
20498
 
20503
20499
  session.onpaymentauthorized = event => {
20504
- console.log("on payment authorized step", event);
20505
20500
  // Define ApplePayPaymentAuthorizationResult
20506
20501
  const result = {
20507
20502
  status: ApplePaySession.STATUS_SUCCESS // eslint-disable-line no-undef
@@ -20530,7 +20525,6 @@ const ApplePayButton = _ref => {
20530
20525
  transactionId: transactionId
20531
20526
  }
20532
20527
  };
20533
- console.log(applePayToken);
20534
20528
  const orderId = `pelcro-${new Date().getTime()}`;
20535
20529
  const eProtectRequest = {
20536
20530
  paypageId: payPageId,
@@ -20546,7 +20540,6 @@ const ApplePayButton = _ref => {
20546
20540
  const {
20547
20541
  expDate
20548
20542
  } = vantivResponse;
20549
- console.log("Response:", vantivResponse);
20550
20543
  const expMonth = expDate.substring(0, 2);
20551
20544
  const expYear = expDate.substring(2);
20552
20545
  const vantivPaymentRequest = {
@@ -20585,7 +20578,6 @@ const ApplePayButton = _ref => {
20585
20578
 
20586
20579
  // TODO: Check if oncouponcodechanged it should be implemented
20587
20580
  // session.oncouponcodechanged = (event) => {
20588
- // console.log("on coupon code changed step", event);
20589
20581
  // // Define ApplePayCouponCodeUpdate
20590
20582
  // const newTotal = calculateNewTotal(event.couponCode);
20591
20583
  // const newLineItems = calculateNewLineItems(event.couponCode);
@@ -20604,7 +20596,6 @@ const ApplePayButton = _ref => {
20604
20596
 
20605
20597
  session.oncancel = event => {
20606
20598
  // Payment cancelled by WebKit
20607
- console.log("on cancel step", event);
20608
20599
  dispatch({
20609
20600
  type: LOADING,
20610
20601
  payload: false
@@ -25909,7 +25900,9 @@ const CartRemoveItemButton = _ref => {
25909
25900
  "data-key": itemId,
25910
25901
  icon: /*#__PURE__*/React__default['default'].createElement(SvgXIcon, {
25911
25902
  "aria-hidden": "true",
25912
- focusable: "false"
25903
+ focusable: "false",
25904
+ height: "20",
25905
+ width: "20"
25913
25906
  }),
25914
25907
  className: "plc-bg-transparent plc-w-9 plc-h-9 plc-p-2",
25915
25908
  onClick: () => {
package/dist/index.esm.js CHANGED
@@ -11534,6 +11534,8 @@ const initPaywalls = () => {
11534
11534
  switchView,
11535
11535
  isAuthenticated
11536
11536
  } = usePelcro.getStore();
11537
+
11538
+ // eslint-disable-next-line no-inner-declarations
11537
11539
  function displayPaywalls() {
11538
11540
  if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayMeterPaywall()) {
11539
11541
  /*
@@ -11550,12 +11552,12 @@ const initPaywalls = () => {
11550
11552
  switchView("plan-select");
11551
11553
  }
11552
11554
  }
11553
- if (isAuthenticated()) {
11555
+ if ("id" in Pelcro.user.read() || !isAuthenticated()) {
11556
+ displayPaywalls();
11557
+ } else {
11554
11558
  addEventListener("PelcroUserLoaded", function () {
11555
11559
  displayPaywalls();
11556
- });
11557
- } else {
11558
- displayPaywalls();
11560
+ }, true);
11559
11561
  }
11560
11562
  }
11561
11563
  };
@@ -20343,7 +20345,7 @@ const ApplePayButton = _ref => {
20343
20345
  if (pelcroApplyPayButton) {
20344
20346
  pelcroApplyPayButton.style.display = "block";
20345
20347
  }
20346
- console.log("canMakePayments", canMakePayments);
20348
+ console.log("ApplePay canMakePayments: ", canMakePayments);
20347
20349
  }
20348
20350
  });
20349
20351
  } else {
@@ -20385,7 +20387,7 @@ const ApplePayButton = _ref => {
20385
20387
  amount: updatedPrice / 100
20386
20388
  }
20387
20389
  };
20388
- console.log(ApplePayPaymentRequest);
20390
+
20389
20391
  // Create ApplePaySession
20390
20392
  // @todo - Clarify supported version parameter
20391
20393
  // @odo - Apple Pay demo uses version 6 (https://applepaydemo.apple.com/)
@@ -20398,7 +20400,6 @@ const ApplePayButton = _ref => {
20398
20400
  const {
20399
20401
  validationURL
20400
20402
  } = event;
20401
- console.log("then merchantSession step", event);
20402
20403
  // Call your own server to request a new merchant session.
20403
20404
  window.Pelcro.payment.startSession({
20404
20405
  auth_token: window.Pelcro.user.read().auth_token,
@@ -20407,7 +20408,6 @@ const ApplePayButton = _ref => {
20407
20408
  }, (err, res) => {
20408
20409
  if (err) {
20409
20410
  // Handle any errors during merchant validation
20410
- console.error("Merchant validation SDK error: ", err);
20411
20411
  session.abort();
20412
20412
  return dispatch({
20413
20413
  type: SHOW_ALERT,
@@ -20418,13 +20418,11 @@ const ApplePayButton = _ref => {
20418
20418
  });
20419
20419
  }
20420
20420
  // Complete merchant validation with the merchant session object
20421
- console.log("Merchant validation SDK response: ", res);
20422
20421
  const merchantSession = res;
20423
20422
  session.completeMerchantValidation(merchantSession);
20424
20423
  });
20425
20424
  };
20426
20425
  session.onpaymentmethodselected = event => {
20427
- console.log("payment method selected step", event);
20428
20426
  // Define ApplePayPaymentMethodUpdate based on the selected payment method.
20429
20427
  // No updates or errors are needed, pass an empty object.
20430
20428
  const newTotal = {
@@ -20442,7 +20440,6 @@ const ApplePayButton = _ref => {
20442
20440
 
20443
20441
  // TODO: Check if onshippingmethodselected it should be implemented
20444
20442
  // session.onshippingmethodselected = (event) => {
20445
- // console.log("on shipping method selected step", event);
20446
20443
  // // Define ApplePayShippingMethodUpdate based on the selected shipping method.
20447
20444
  // // No updates or errors are needed, pass an empty object.
20448
20445
  // const newTotal = {
@@ -20464,14 +20461,12 @@ const ApplePayButton = _ref => {
20464
20461
 
20465
20462
  // TODO: Check if onshippingcontactselected it should be implemented
20466
20463
  // session.onshippingcontactselected = (event) => {
20467
- // console.log("on shipping contact selected step", event);
20468
20464
  // // Define ApplePayShippingContactUpdate based on the selected shipping contact.
20469
20465
  // const update = {};
20470
20466
  // session.completeShippingContactSelection(update);
20471
20467
  // };
20472
20468
 
20473
20469
  session.onpaymentauthorized = event => {
20474
- console.log("on payment authorized step", event);
20475
20470
  // Define ApplePayPaymentAuthorizationResult
20476
20471
  const result = {
20477
20472
  status: ApplePaySession.STATUS_SUCCESS // eslint-disable-line no-undef
@@ -20500,7 +20495,6 @@ const ApplePayButton = _ref => {
20500
20495
  transactionId: transactionId
20501
20496
  }
20502
20497
  };
20503
- console.log(applePayToken);
20504
20498
  const orderId = `pelcro-${new Date().getTime()}`;
20505
20499
  const eProtectRequest = {
20506
20500
  paypageId: payPageId,
@@ -20516,7 +20510,6 @@ const ApplePayButton = _ref => {
20516
20510
  const {
20517
20511
  expDate
20518
20512
  } = vantivResponse;
20519
- console.log("Response:", vantivResponse);
20520
20513
  const expMonth = expDate.substring(0, 2);
20521
20514
  const expYear = expDate.substring(2);
20522
20515
  const vantivPaymentRequest = {
@@ -20555,7 +20548,6 @@ const ApplePayButton = _ref => {
20555
20548
 
20556
20549
  // TODO: Check if oncouponcodechanged it should be implemented
20557
20550
  // session.oncouponcodechanged = (event) => {
20558
- // console.log("on coupon code changed step", event);
20559
20551
  // // Define ApplePayCouponCodeUpdate
20560
20552
  // const newTotal = calculateNewTotal(event.couponCode);
20561
20553
  // const newLineItems = calculateNewLineItems(event.couponCode);
@@ -20574,7 +20566,6 @@ const ApplePayButton = _ref => {
20574
20566
 
20575
20567
  session.oncancel = event => {
20576
20568
  // Payment cancelled by WebKit
20577
- console.log("on cancel step", event);
20578
20569
  dispatch({
20579
20570
  type: LOADING,
20580
20571
  payload: false
@@ -25879,7 +25870,9 @@ const CartRemoveItemButton = _ref => {
25879
25870
  "data-key": itemId,
25880
25871
  icon: /*#__PURE__*/React__default.createElement(SvgXIcon, {
25881
25872
  "aria-hidden": "true",
25882
- focusable: "false"
25873
+ focusable: "false",
25874
+ height: "20",
25875
+ width: "20"
25883
25876
  }),
25884
25877
  className: "plc-bg-transparent plc-w-9 plc-h-9 plc-p-2",
25885
25878
  onClick: () => {
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.26.0-sandbox.35",
4
+ "version": "3.26.0-sandbox.37",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",