Skip to content

Commit

Permalink
fix partner (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-t-wang authored Feb 21, 2025
1 parent 4d6b630 commit beb152e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 221 deletions.
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"copy-to-clipboard": "^3.3.3",
"framer-motion": "^11.2.14",
"qrcode": "^1.5.3",
"react-shadow": "^19.1.0",
"react-shadow": "^20.6.0",
"zustand": "^4.5.4"
},
"description": "The identity SDK. Privacy-preserving identity and proof of personhood with World ID.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const getOptions = (store: IDKitStore) => ({
setErrorState: store.setErrorState,
verification_level: store.verification_level,
action_description: store.action_description,
partner: store.partner,
})

const WorldIDState = () => {
Expand All @@ -35,6 +36,7 @@ const WorldIDState = () => {
action_description,
verification_level,
setErrorState,
partner,
} = useIDKitStore(getOptions, shallow)

const { connectorURI, reset, errorCode, result, verificationState } = useWorldBridge(
Expand All @@ -43,7 +45,8 @@ const WorldIDState = () => {
signal,
bridge_url,
verification_level,
action_description
action_description,
partner
)

useEffect(() => reset, [reset])
Expand Down
16 changes: 14 additions & 2 deletions packages/react/src/services/wld-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export const useWorldBridge = (
signal?: IDKitConfig['signal'],
bridge_url?: IDKitConfig['bridge_url'],
verification_level?: IDKitConfig['verification_level'],
action_description?: IDKitConfig['action_description']
action_description?: IDKitConfig['action_description'],
partner?: IDKitConfig['partner']
): UseAppBridgeResponse => {
const ref_verification_level = useRef(verification_level)
const { reset, result, connectorURI, createClient, pollForUpdates, verificationState, errorCode } =
Expand All @@ -31,9 +32,20 @@ export const useWorldBridge = (
bridge_url,
action_description,
verification_level: ref_verification_level.current,
partner,
})
}
}, [app_id, action, signal, action_description, createClient, ref_verification_level, bridge_url, connectorURI])
}, [
app_id,
action,
signal,
action_description,
createClient,
ref_verification_level,
bridge_url,
connectorURI,
partner,
])

useEffect(() => {
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
Expand Down
4 changes: 4 additions & 0 deletions packages/react/src/store/idkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export type IDKitStore = {
bridge_url?: IDKitConfig['bridge_url']
action_description?: IDKitConfig['action_description']
verification_level: NonNullable<IDKitConfig['verification_level']>
partner?: IDKitConfig['partner']

open: boolean
stage: IDKITStage
Expand Down Expand Up @@ -52,6 +53,7 @@ const useIDKitStore = createWithEqualityFn<IDKitStore>()(
action_description: '',
bridge_url: '',
verification_level: DEFAULT_VERIFICATION_LEVEL,
partner: false,

open: false,
result: null,
Expand Down Expand Up @@ -99,6 +101,7 @@ const useIDKitStore = createWithEqualityFn<IDKitStore>()(
signal,
action,
app_id,
partner,
onError,
verification_level,
action_description,
Expand All @@ -116,6 +119,7 @@ const useIDKitStore = createWithEqualityFn<IDKitStore>()(
autoClose: autoClose ?? true,
app_id: advanced?.self_hosted ? SELF_HOSTED_APP_ID : app_id,
verification_level: verification_level ?? DEFAULT_VERIFICATION_LEVEL,
partner,
})

get().addSuccessCallback(onSuccess, source)
Expand Down
Loading

0 comments on commit beb152e

Please sign in to comment.