tf-checkout-react 1.6.6-beta.32 → 1.6.6-beta.33

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.6.6-beta.32",
2
+ "version": "1.6.6-beta.33",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -49,7 +49,7 @@ export const SimpleAddonsContainer = ({
49
49
  onAddOnSelect = _identity,
50
50
  handleConfirm = _identity,
51
51
  }: ISimpleAddonContainerProps) => {
52
- const [addons, setAddons] = useState<any>([])
52
+ const [addons, setAddons] = useState<any>(null)
53
53
  const [addonsOptions, setAddonsOptions] = useState<any>({})
54
54
  const [groupsWithSelectedVariants, setGroupsWithSelectedVariants] = useState<any>({})
55
55
  const [groupsWithInitialVariantsValues, setGroupsWithInitialVariantsValues] =
@@ -191,7 +191,7 @@ export const SimpleAddonsContainer = ({
191
191
  return addOnsData
192
192
  }, [addons, addOnDataWithCustomFields])
193
193
 
194
- if (loading) {
194
+ if (loading || !addons) {
195
195
  return (
196
196
  <div className={`${classNamePrefix}_loader`}>
197
197
  <CircularProgress size={50} />
@@ -199,10 +199,6 @@ export const SimpleAddonsContainer = ({
199
199
  )
200
200
  }
201
201
 
202
- if (addons?.length === 0) {
203
- return null
204
- }
205
-
206
202
  return (
207
203
  <div className={`${classNamePrefix}_container`}>
208
204
  <div className={`${classNamePrefix}_block`}>
@@ -315,8 +315,11 @@ const BillingInfoContainer = React.memo(
315
315
  : {}
316
316
  const additionalConfigs =
317
317
  isBrowser && window.localStorage.getItem('checkoutAdditionalConfigs')
318
- ? JSON.parse(window.localStorage.getItem('checkoutAdditionalConfigs') || '{"resale": false, "resaleWithAddons": false}')
319
- : {resale: false, resaleWithAddons: false}
318
+ ? JSON.parse(
319
+ window.localStorage.getItem('checkoutAdditionalConfigs') ||
320
+ '{"resale": false, "resaleWithAddons": false}'
321
+ )
322
+ : { resale: false, resaleWithAddons: false }
320
323
  const [dataWithUniqueIds, setDataWithUniqueIds] = useState<IBillingInfoData[]>(
321
324
  assingUniqueIds(data)
322
325
  )
@@ -763,20 +766,25 @@ const BillingInfoContainer = React.memo(
763
766
  const stripePublishableKey =
764
767
  reviewData?.payment_method?.stripe_publishable_key ||
765
768
  checkoutUpdateData?.additional_payment_information?.basic_config?.apiKey
766
- const stripeAccountId = reviewData?.payment_method?.stripe_connected_account ||
769
+ const stripeAccountId =
770
+ reviewData?.payment_method?.stripe_connected_account ||
767
771
  checkoutUpdateData?.additional_payment_information?.basic_config?.accountId
768
- const addOnsIncludedOnInvitation = additionalConfigs.resale && additionalConfigs.resaleWithAddons
772
+ const addOnsIncludedOnInvitation =
773
+ additionalConfigs.resale && additionalConfigs.resaleWithAddons
774
+
775
+ if (loading || cardLoading || isCountriesLoading || isConfigLoading || !eventId) {
776
+ return (
777
+ <Backdrop
778
+ sx={{ color: '#fff', backgroundColor: '#000000bd', zIndex: 1205 }}
779
+ open={true}
780
+ >
781
+ <CircularProgress color="inherit" />
782
+ </Backdrop>
783
+ )
784
+ }
769
785
 
770
786
  return (
771
787
  <ThemeProvider theme={themeMui}>
772
- {(loading || cardLoading || isCountriesLoading || isConfigLoading) && (
773
- <Backdrop
774
- sx={{ color: '#fff', backgroundColor: '#000000bd', zIndex: 1205 }}
775
- open={true}
776
- >
777
- <CircularProgress color="inherit" />
778
- </Backdrop>
779
- )}
780
788
  {!!expirationTime && enableTimer && (
781
789
  <TimerWidget
782
790
  expires_at={expirationTime}
@@ -817,13 +825,14 @@ const BillingInfoContainer = React.memo(
817
825
 
818
826
  if (isSinglePageCheckout && !orderIsFree) {
819
827
  const card = cardRef.current
820
- const stripePaymentMethodResponse = await stripeRef.current.createPaymentMethod({
821
- type: 'card',
822
- card: card || { token: '' },
823
- billing_details: {
824
- address: addressRef.current,
825
- },
826
- })
828
+ const stripePaymentMethodResponse =
829
+ await stripeRef.current.createPaymentMethod({
830
+ type: 'card',
831
+ card: card || { token: '' },
832
+ billing_details: {
833
+ address: addressRef.current,
834
+ },
835
+ })
827
836
 
828
837
  if (stripePaymentMethodResponse?.error) {
829
838
  setError('' + stripePaymentMethodResponse?.error?.message)
@@ -1000,12 +1009,13 @@ const BillingInfoContainer = React.memo(
1000
1009
  return
1001
1010
  }
1002
1011
 
1003
- const confirmationResult = await stripeRef.current.confirmCardPayment(
1004
- paymentMethod.stripe_client_secret,
1005
- {
1006
- payment_method: stripePaymentMethod.id,
1007
- }
1008
- )
1012
+ const confirmationResult =
1013
+ await stripeRef.current.confirmCardPayment(
1014
+ paymentMethod.stripe_client_secret,
1015
+ {
1016
+ payment_method: stripePaymentMethod.id,
1017
+ }
1018
+ )
1009
1019
 
1010
1020
  if (confirmationResult?.error) {
1011
1021
  setError('' + confirmationResult?.error?.message)
@@ -1103,15 +1113,17 @@ const BillingInfoContainer = React.memo(
1103
1113
  shouldFetchCountries={shouldFetchCountries}
1104
1114
  />
1105
1115
  <div className={`billing-info-container ${theme}`}>
1106
- <SnackbarAlert
1107
- type="error"
1108
- isOpen={!!error}
1109
- message={error || ''}
1110
- onClose={() => {
1111
- setError(null)
1112
- onErrorClose()
1113
- }}
1114
- />
1116
+ {!!error && (
1117
+ <SnackbarAlert
1118
+ type="error"
1119
+ isOpen={!!error}
1120
+ message={error || ''}
1121
+ onClose={() => {
1122
+ setError(null)
1123
+ onErrorClose()
1124
+ }}
1125
+ />
1126
+ )}
1115
1127
  {!isLoggedIn && !isSinglePageCheckout && (
1116
1128
  <div className="account-actions-block">
1117
1129
  <div className="action-item">