@tellescope/react-components 1.148.1 → 1.150.0

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@tellescope/react-components",
3
- "version": "1.148.1",
3
+ "version": "1.150.0",
4
4
  "description": "",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -45,15 +45,15 @@
45
45
  "@mui/icons-material": "^5.0.1",
46
46
  "@mui/material": "^5.0.2",
47
47
  "@reduxjs/toolkit": "^1.6.2",
48
- "@stripe/react-stripe-js": "^2.1.0",
48
+ "@stripe/react-stripe-js": "^2.9.0",
49
49
  "@stripe/stripe-js": "^1.52.1",
50
- "@tellescope/constants": "^1.148.0",
51
- "@tellescope/sdk": "^1.148.1",
52
- "@tellescope/types-client": "^1.148.0",
53
- "@tellescope/types-models": "^1.148.0",
54
- "@tellescope/types-utilities": "^1.148.0",
55
- "@tellescope/utilities": "^1.148.0",
56
- "@tellescope/validation": "^1.148.0",
50
+ "@tellescope/constants": "^1.150.0",
51
+ "@tellescope/sdk": "^1.150.0",
52
+ "@tellescope/types-client": "^1.150.0",
53
+ "@tellescope/types-models": "^1.150.0",
54
+ "@tellescope/types-utilities": "^1.150.0",
55
+ "@tellescope/utilities": "^1.150.0",
56
+ "@tellescope/validation": "^1.150.0",
57
57
  "@typescript-eslint/eslint-plugin": "^4.33.0",
58
58
  "@typescript-eslint/parser": "^4.33.0",
59
59
  "css-to-react-native": "^3.0.0",
@@ -80,7 +80,7 @@
80
80
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
81
81
  "react-native": "^0.65.0 || ^0.66.0 || ^0.67.0 || ^0.68.0 || ^0.71.0"
82
82
  },
83
- "gitHead": "e557342a6982e69ee08124c95003163cb5f9a4ba",
83
+ "gitHead": "1746b2c4cfc5907edd752c62b9bb65befc9ac3dc",
84
84
  "publishConfig": {
85
85
  "access": "public"
86
86
  }
@@ -21,9 +21,9 @@ import heic2any from "heic2any"
21
21
  import AddPhotoAlternateIcon from '@mui/icons-material/AddPhotoAlternate';
22
22
  import LanguageIcon from '@mui/icons-material/Language';
23
23
 
24
- import { Elements, PaymentElement, useStripe, useElements } from '@stripe/react-stripe-js';
24
+ import { Elements, PaymentElement, useStripe, useElements, EmbeddedCheckout, EmbeddedCheckoutProvider } from '@stripe/react-stripe-js';
25
25
  import { loadStripe } from '@stripe/stripe-js';
26
- import { CheckCircleOutline, Delete, Edit, PropaneSharp } from "@mui/icons-material"
26
+ import { CheckCircleOutline, Delete, Edit } from "@mui/icons-material"
27
27
 
28
28
  export const LanguageSelect = ({ value, ...props }: { value: string, onChange: (s: string) => void}) => (
29
29
  <Grid container alignItems="center" justifyContent={"center"} wrap="nowrap" spacing={1}>
@@ -1420,6 +1420,7 @@ export const StripeInput = ({ field, value, onChange, setCustomerId }: FormInput
1420
1420
  const session = useResolvedSession()
1421
1421
  const [clientSecret, setClientSecret] = useState('')
1422
1422
  const [businessName, setBusinessName] = useState('')
1423
+ const [isCheckout, setIsCheckout] = useState(false)
1423
1424
  const [stripePromise, setStripePromise] = useState<ReturnType<typeof loadStripe>>()
1424
1425
  const [, { findById: findProduct }] = useProducts({ dontFetch: true })
1425
1426
 
@@ -1432,7 +1433,8 @@ export const StripeInput = ({ field, value, onChange, setCustomerId }: FormInput
1432
1433
  fetchRef.current = true
1433
1434
 
1434
1435
  session.api.form_responses.stripe_details({ fieldId: field.id })
1435
- .then(({ clientSecret, publishableKey, stripeAccount, businessName, customerId }) => {
1436
+ .then(({ clientSecret, publishableKey, stripeAccount, businessName, customerId, isCheckout }) => {
1437
+ setIsCheckout(!!isCheckout)
1436
1438
  setClientSecret(clientSecret)
1437
1439
  setStripePromise(loadStripe(publishableKey, { stripeAccount }))
1438
1440
  setBusinessName(businessName)
@@ -1448,7 +1450,7 @@ export const StripeInput = ({ field, value, onChange, setCustomerId }: FormInput
1448
1450
 
1449
1451
  if (value) {
1450
1452
  return (
1451
- <Grid container alignItems="center" wrap="nowrap">
1453
+ <Grid container alignItems="center" wrap="nowrap">
1452
1454
  <CheckCircleOutline color="success" />
1453
1455
 
1454
1456
  <Typography sx={{ ml: 1, fontSize: 20 }}>
@@ -1458,6 +1460,16 @@ export const StripeInput = ({ field, value, onChange, setCustomerId }: FormInput
1458
1460
  )
1459
1461
  }
1460
1462
  if (!(clientSecret && stripePromise)) return <LinearProgress />
1463
+ if (isCheckout && stripePromise) return (
1464
+ <EmbeddedCheckoutProvider stripe={stripePromise}
1465
+ options={{
1466
+ clientSecret,
1467
+ onComplete: () => onChange('Completed checkout', field.id),
1468
+ }}
1469
+ >
1470
+ <EmbeddedCheckout />
1471
+ </EmbeddedCheckoutProvider>
1472
+ )
1461
1473
  return (
1462
1474
  <Elements stripe={stripePromise} options={{
1463
1475
  clientSecret,