Skip to content

Commit

Permalink
fix: remove nullish coalescing operator (??) to improve compatibili…
Browse files Browse the repository at this point in the history
…ty with old browsers

should fix #50
  • Loading branch information
marsidev committed Jan 29, 2024
1 parent 2f1323f commit 80f61c6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions packages/lib/src/lib.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const Turnstile = forwardRef<TurnstileInstance | undefined, TurnstileProp
injectScript = true,
...divProps
} = props
const widgetSize = options.size ?? 'normal'
const widgetSize = options.size || 'normal'

const [containerStyle, setContainerStyle] = useState(
options.execution === 'execute'
Expand All @@ -53,7 +53,7 @@ export const Turnstile = forwardRef<TurnstileInstance | undefined, TurnstileProp
const [turnstileLoaded, setTurnstileLoaded] = useState(false)
const widgetId = useRef<string | undefined | null>()
const widgetSolved = useRef(false)
const containerId = id ?? DEFAULT_CONTAINER_ID
const containerId = id || DEFAULT_CONTAINER_ID
const scriptId = injectScript
? scriptOptions?.id || `${DEFAULT_SCRIPT_ID}__${containerId}`
: scriptOptions?.id || DEFAULT_SCRIPT_ID
Expand All @@ -77,17 +77,17 @@ export const Turnstile = forwardRef<TurnstileInstance | undefined, TurnstileProp
'before-interactive-callback': onBeforeInteractive,
'after-interactive-callback': onAfterInteractive,
'unsupported-callback': onUnsupported,
theme: options.theme ?? 'auto',
language: options.language ?? 'auto',
theme: options.theme || 'auto',
language: options.language || 'auto',
tabindex: options.tabIndex,
'response-field': options.responseField,
'response-field-name': options.responseFieldName,
size: getTurnstileSizeOpts(widgetSize),
retry: options.retry ?? 'auto',
'retry-interval': options.retryInterval ?? 8000,
'refresh-expired': options.refreshExpired ?? 'auto',
execution: options.execution ?? 'render',
appearance: options.appearance ?? 'always'
retry: options.retry || 'auto',
'retry-interval': options.retryInterval || 8000,
'refresh-expired': options.refreshExpired || 'auto',
execution: options.execution || 'render',
appearance: options.appearance || 'always'
}),
[
siteKey,
Expand Down

0 comments on commit 80f61c6

Please sign in to comment.