@blocklet/payment-react 1.13.166 → 1.13.168

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.
@@ -80,8 +80,8 @@ export default function PaymentForm({
80
80
  }
81
81
  }, [session?.user, getValues, setValue]);
82
82
  useEffect(() => {
83
- setValue("payment_method", currencies[paymentCurrencyIndex].method.id);
84
- setValue("payment_currency", currencies[paymentCurrencyIndex].id);
83
+ setValue("payment_method", currencies[paymentCurrencyIndex]?.method?.id);
84
+ setValue("payment_currency", currencies[paymentCurrencyIndex]?.id);
85
85
  }, [paymentCurrencyIndex, currencies, setValue]);
86
86
  const paymentMethod = useWatch({ control, name: "payment_method" });
87
87
  const domSize = useSize(document.body);
@@ -99,8 +99,8 @@ function PaymentForm({
99
99
  }
100
100
  }, [session?.user, getValues, setValue]);
101
101
  (0, _react.useEffect)(() => {
102
- setValue("payment_method", currencies[paymentCurrencyIndex].method.id);
103
- setValue("payment_currency", currencies[paymentCurrencyIndex].id);
102
+ setValue("payment_method", currencies[paymentCurrencyIndex]?.method?.id);
103
+ setValue("payment_currency", currencies[paymentCurrencyIndex]?.id);
104
104
  }, [paymentCurrencyIndex, currencies, setValue]);
105
105
  const paymentMethod = (0, _reactHookForm.useWatch)({
106
106
  control,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/payment-react",
3
- "version": "1.13.166",
3
+ "version": "1.13.168",
4
4
  "description": "Reusable react components for payment kit v2",
5
5
  "keywords": [
6
6
  "react",
@@ -89,7 +89,7 @@
89
89
  "@babel/core": "^7.23.9",
90
90
  "@babel/preset-env": "^7.23.9",
91
91
  "@babel/preset-react": "^7.23.3",
92
- "@blocklet/payment-types": "1.13.166",
92
+ "@blocklet/payment-types": "1.13.168",
93
93
  "@storybook/addon-essentials": "^7.6.13",
94
94
  "@storybook/addon-interactions": "^7.6.13",
95
95
  "@storybook/addon-links": "^7.6.13",
@@ -118,5 +118,5 @@
118
118
  "vite-plugin-babel": "^1.2.0",
119
119
  "vite-plugin-node-polyfills": "^0.19.0"
120
120
  },
121
- "gitHead": "70ee269e307cbab0ecb58fb4f287b749df0f2277"
121
+ "gitHead": "ba4ab8d0dda39aa44636e62f9a4c56e2295432b7"
122
122
  }
@@ -122,8 +122,8 @@ export default function PaymentForm({
122
122
  }, [session?.user, getValues, setValue]);
123
123
 
124
124
  useEffect(() => {
125
- setValue('payment_method', (currencies[paymentCurrencyIndex] as any).method.id);
126
- setValue('payment_currency', currencies[paymentCurrencyIndex].id);
125
+ setValue('payment_method', (currencies[paymentCurrencyIndex] as any)?.method?.id);
126
+ setValue('payment_currency', currencies[paymentCurrencyIndex]?.id);
127
127
  }, [paymentCurrencyIndex, currencies, setValue]);
128
128
 
129
129
  const paymentMethod = useWatch({ control, name: 'payment_method' });