@pelcro/react-pelcro-js 4.0.0-alpha.72 → 4.0.0-alpha.74

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
@@ -25262,7 +25262,8 @@ const PaymentMethodContainer = props => {
25262
25262
 
25263
25263
  const [isStripeLoaded, setIsStripeLoaded] = React.useState(Boolean(window.Stripe));
25264
25264
  const {
25265
- whenUserReady
25265
+ whenUserReady,
25266
+ selectedPaymentMethodId
25266
25267
  } = usePelcro.getStore();
25267
25268
  const cardProcessor = getSiteCardProcessor(); // Create the Stripe object
25268
25269
 
@@ -25284,7 +25285,7 @@ const PaymentMethodContainer = props => {
25284
25285
  loader: "always"
25285
25286
  };
25286
25287
  React.useEffect(() => {
25287
- if (isStripeLoaded) {
25288
+ if (isStripeLoaded && !selectedPaymentMethodId) {
25288
25289
  window.Pelcro.user.createSetupIntent({
25289
25290
  auth_token: window.Pelcro.user.read().auth_token
25290
25291
  }, (err, res) => {
@@ -25310,7 +25311,7 @@ const PaymentMethodContainer = props => {
25310
25311
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
25311
25312
 
25312
25313
  if (isStripeLoaded) {
25313
- return /*#__PURE__*/React__default['default'].createElement("div", null, clientSecret ? /*#__PURE__*/React__default['default'].createElement(Elements, {
25314
+ return /*#__PURE__*/React__default['default'].createElement("div", null, clientSecret || selectedPaymentMethodId ? /*#__PURE__*/React__default['default'].createElement(Elements, {
25314
25315
  options: options,
25315
25316
  stripe: stripePromise
25316
25317
  }, /*#__PURE__*/React__default['default'].createElement(PaymentMethodContainerWithoutStripe, Object.assign({
@@ -34728,12 +34729,12 @@ const PaymentMethodDeleteBack = ({
34728
34729
  t
34729
34730
  } = useTranslation("paymentMethod");
34730
34731
  const {
34731
- switchView
34732
+ switchDashboardView
34732
34733
  } = usePelcro();
34733
34734
  return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
34734
34735
  variant: "outline",
34735
34736
  onClick: () => {
34736
- switchView("dashboard");
34737
+ switchDashboardView("payment-cards");
34737
34738
  onClick === null || onClick === void 0 ? void 0 : onClick();
34738
34739
  },
34739
34740
  className: "plc-w-full"
@@ -36323,7 +36324,6 @@ const DashboardContent = ({
36323
36324
  const {
36324
36325
  switchView,
36325
36326
  dashboardView,
36326
- switchDashboardView,
36327
36327
  logout
36328
36328
  } = usePelcro();
36329
36329
  const {
@@ -36376,14 +36376,16 @@ const DashboardContent = ({
36376
36376
  dispatch({
36377
36377
  type: CLOSE_DASHBOARD
36378
36378
  });
36379
- };
36379
+ }; // useEffect(() => {
36380
36380
  // return () => {
36381
36381
  // document.removeEventListener("click", hideMenuIfClickedOutside);
36382
36382
  // };
36383
36383
  // }, []); // eslint-disable-line react-hooks/exhaustive-deps
36384
36384
 
36385
36385
 
36386
- return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(Transition, {
36386
+ return /*#__PURE__*/React__default['default'].createElement("div", {
36387
+ className: "pelcro-modal-overlay"
36388
+ }, /*#__PURE__*/React__default['default'].createElement(Transition, {
36387
36389
  className: `plc-fixed plc-inset-y-0 plc-h-full lg:plc-w-3/12 plc-w-full plc-overflow-y-auto plc-text-left plc-bg-white plc-shadow-xl plc-z-max ${dashboardLayout == "left" ? "plc-left-0" : "plc-right-0"}`,
36388
36390
  show: isOpen,
36389
36391
  enter: "plc-transform plc-transition plc-duration-500",
@@ -36415,7 +36417,7 @@ const DashboardContent = ({
36415
36417
  }, userHasName && /*#__PURE__*/React__default['default'].createElement("p", {
36416
36418
  className: "plc-font-bold plc-break-all"
36417
36419
  }, user.first_name, " ", user.last_name), /*#__PURE__*/React__default['default'].createElement("p", {
36418
- className: `plc-m-0 plc-text-sm plc-break-all ${userHasName ? "plc-text-sm" : "plc-text-lg plc-font-bold plc-mt-auto"}`
36420
+ className: `plc-m-0 plc-break-all ${userHasName ? "plc-text-sm" : "plc-text-sm plc-font-bold plc-mt-auto"}`
36419
36421
  }, user.email)), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(Button, {
36420
36422
  variant: "ghost",
36421
36423
  type: "button",
@@ -36436,10 +36438,10 @@ const DashboardContent = ({
36436
36438
  title: t("labels.logout"),
36437
36439
  setActiveDashboardLink: setActiveDashboardLink,
36438
36440
  activeDashboardLink: activeDashboardLink
36439
- }))), /*#__PURE__*/React__default['default'].createElement("div", {
36441
+ }))), dashboardView && isOpen && /*#__PURE__*/React__default['default'].createElement("div", {
36440
36442
  id: "pelcro-view-dashboard-submenus",
36441
36443
  className: `plc-fixed plc-inset-y-0 plc-h-full lg:plc-w-9/12 plc-w-full plc-bg-gray-100 plc-z-max plc-overflow-auto ${dashboardLayout == "left" ? "plc-right-0" : "plc-left-0"}`
36442
- }, dashboardView && isOpen && /*#__PURE__*/React__default['default'].createElement(DashboardViewController, null, subView !== null && subView !== void 0 && subView.length ? subView.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
36444
+ }, /*#__PURE__*/React__default['default'].createElement(DashboardViewController, null, subView !== null && subView !== void 0 && subView.length ? subView.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
36443
36445
  store: store$4,
36444
36446
  key: i
36445
36447
  })) : /*#__PURE__*/React__default['default'].cloneElement(subView, {
package/dist/index.esm.js CHANGED
@@ -25232,7 +25232,8 @@ const PaymentMethodContainer = props => {
25232
25232
 
25233
25233
  const [isStripeLoaded, setIsStripeLoaded] = useState(Boolean(window.Stripe));
25234
25234
  const {
25235
- whenUserReady
25235
+ whenUserReady,
25236
+ selectedPaymentMethodId
25236
25237
  } = usePelcro.getStore();
25237
25238
  const cardProcessor = getSiteCardProcessor(); // Create the Stripe object
25238
25239
 
@@ -25254,7 +25255,7 @@ const PaymentMethodContainer = props => {
25254
25255
  loader: "always"
25255
25256
  };
25256
25257
  useEffect(() => {
25257
- if (isStripeLoaded) {
25258
+ if (isStripeLoaded && !selectedPaymentMethodId) {
25258
25259
  window.Pelcro.user.createSetupIntent({
25259
25260
  auth_token: window.Pelcro.user.read().auth_token
25260
25261
  }, (err, res) => {
@@ -25280,7 +25281,7 @@ const PaymentMethodContainer = props => {
25280
25281
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
25281
25282
 
25282
25283
  if (isStripeLoaded) {
25283
- return /*#__PURE__*/React__default.createElement("div", null, clientSecret ? /*#__PURE__*/React__default.createElement(Elements, {
25284
+ return /*#__PURE__*/React__default.createElement("div", null, clientSecret || selectedPaymentMethodId ? /*#__PURE__*/React__default.createElement(Elements, {
25284
25285
  options: options,
25285
25286
  stripe: stripePromise
25286
25287
  }, /*#__PURE__*/React__default.createElement(PaymentMethodContainerWithoutStripe, Object.assign({
@@ -34698,12 +34699,12 @@ const PaymentMethodDeleteBack = ({
34698
34699
  t
34699
34700
  } = useTranslation("paymentMethod");
34700
34701
  const {
34701
- switchView
34702
+ switchDashboardView
34702
34703
  } = usePelcro();
34703
34704
  return /*#__PURE__*/React__default.createElement(Button, Object.assign({
34704
34705
  variant: "outline",
34705
34706
  onClick: () => {
34706
- switchView("dashboard");
34707
+ switchDashboardView("payment-cards");
34707
34708
  onClick === null || onClick === void 0 ? void 0 : onClick();
34708
34709
  },
34709
34710
  className: "plc-w-full"
@@ -36293,7 +36294,6 @@ const DashboardContent = ({
36293
36294
  const {
36294
36295
  switchView,
36295
36296
  dashboardView,
36296
- switchDashboardView,
36297
36297
  logout
36298
36298
  } = usePelcro();
36299
36299
  const {
@@ -36346,14 +36346,16 @@ const DashboardContent = ({
36346
36346
  dispatch({
36347
36347
  type: CLOSE_DASHBOARD
36348
36348
  });
36349
- };
36349
+ }; // useEffect(() => {
36350
36350
  // return () => {
36351
36351
  // document.removeEventListener("click", hideMenuIfClickedOutside);
36352
36352
  // };
36353
36353
  // }, []); // eslint-disable-line react-hooks/exhaustive-deps
36354
36354
 
36355
36355
 
36356
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Transition, {
36356
+ return /*#__PURE__*/React__default.createElement("div", {
36357
+ className: "pelcro-modal-overlay"
36358
+ }, /*#__PURE__*/React__default.createElement(Transition, {
36357
36359
  className: `plc-fixed plc-inset-y-0 plc-h-full lg:plc-w-3/12 plc-w-full plc-overflow-y-auto plc-text-left plc-bg-white plc-shadow-xl plc-z-max ${dashboardLayout == "left" ? "plc-left-0" : "plc-right-0"}`,
36358
36360
  show: isOpen,
36359
36361
  enter: "plc-transform plc-transition plc-duration-500",
@@ -36385,7 +36387,7 @@ const DashboardContent = ({
36385
36387
  }, userHasName && /*#__PURE__*/React__default.createElement("p", {
36386
36388
  className: "plc-font-bold plc-break-all"
36387
36389
  }, user.first_name, " ", user.last_name), /*#__PURE__*/React__default.createElement("p", {
36388
- className: `plc-m-0 plc-text-sm plc-break-all ${userHasName ? "plc-text-sm" : "plc-text-lg plc-font-bold plc-mt-auto"}`
36390
+ className: `plc-m-0 plc-break-all ${userHasName ? "plc-text-sm" : "plc-text-sm plc-font-bold plc-mt-auto"}`
36389
36391
  }, user.email)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Button, {
36390
36392
  variant: "ghost",
36391
36393
  type: "button",
@@ -36406,10 +36408,10 @@ const DashboardContent = ({
36406
36408
  title: t("labels.logout"),
36407
36409
  setActiveDashboardLink: setActiveDashboardLink,
36408
36410
  activeDashboardLink: activeDashboardLink
36409
- }))), /*#__PURE__*/React__default.createElement("div", {
36411
+ }))), dashboardView && isOpen && /*#__PURE__*/React__default.createElement("div", {
36410
36412
  id: "pelcro-view-dashboard-submenus",
36411
36413
  className: `plc-fixed plc-inset-y-0 plc-h-full lg:plc-w-9/12 plc-w-full plc-bg-gray-100 plc-z-max plc-overflow-auto ${dashboardLayout == "left" ? "plc-right-0" : "plc-left-0"}`
36412
- }, dashboardView && isOpen && /*#__PURE__*/React__default.createElement(DashboardViewController, null, subView !== null && subView !== void 0 && subView.length ? subView.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
36414
+ }, /*#__PURE__*/React__default.createElement(DashboardViewController, null, subView !== null && subView !== void 0 && subView.length ? subView.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
36413
36415
  store: store$4,
36414
36416
  key: i
36415
36417
  })) : /*#__PURE__*/React__default.cloneElement(subView, {
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": "4.0.0-alpha.72",
4
+ "version": "4.0.0-alpha.74",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",