Repository navigation
feat(rn-davinci): add DaVinci METADATA collector pause/resume support (SDKS-5384) #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
37db11d
feat(rn-davinci): add DaVinci METADATA collector pause/resume support…
pingidentity-gaurav 1b798c2
fix(rn-davinci): address METADATA collector review feedback (SDKS-5384)
pingidentity-gaurav 669c73e
Merge remote-tracking branch 'origin/main' into SDKS-5384
pingidentity-gaurav File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| --- | ||
| '@ping-identity/rn-davinci': minor | ||
| --- | ||
|
|
||
| feat(rn-davinci): add DaVinci METADATA collector pause/resume support (SDKS-5384) | ||
|
|
||
| Exposes the SDK Integrator connector pause/resume flow: a `METADATA` field now | ||
| surfaces as a typed `MetadataCollector` with the opaque connector payload on | ||
| `metadata` and the new `metadata` execution mode/field kind. The flow pauses | ||
| until the app sets a result as the collector's form value and resumes via | ||
| `next()` — an object is POSTed as the success result (wrap it with the new | ||
| `buildMetadataResult` helper, which keeps the form value type from accepting | ||
| arbitrary objects for other collectors), and a `{ error: { code, message } }` | ||
| envelope (build one with the new `buildMetadataError` helper) routes the | ||
| connector's error branch. Submit | ||
| planning blocks with `METADATA_RESULT_REQUIRED` while no result is set and | ||
| with `METADATA_RESULT_MALFORMED` for non-object, array, or malformed-envelope | ||
| values; `computeFormMeta` gains `hasMetadata`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
136 changes: 136 additions & 0 deletions
136
PingSampleApp/ui/davinci/components/molecules/DaVinciMetadataField.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| /* | ||
| * Copyright (c) 2026 Ping Identity Corporation. All rights reserved. | ||
| * | ||
| * This software may be modified and distributed under the terms | ||
| * of the MIT license. See the LICENSE file for details. | ||
| */ | ||
|
|
||
| import React from 'react'; | ||
| import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'; | ||
| import { | ||
| buildMetadataError, | ||
| buildMetadataResult, | ||
| type MetadataCollector, | ||
| } from '@ping-identity/rn-davinci'; | ||
| import { colors } from '../../../../src/styles/colors'; | ||
| import { commonStyles } from '../../../../src/styles/common'; | ||
| import { davinciFieldStyles } from '../../../../src/styles/davinciStyles'; | ||
| import type { DaVinciCollectorRendererProps } from './types'; | ||
|
|
||
| /** | ||
| * Demo success result stored by the "Set result" control. | ||
| * | ||
| * @remarks | ||
| * A real integration replaces this with the object the connector expects — | ||
| * any non-empty JSON object is a valid success result. | ||
| */ | ||
| const DEMO_SUCCESS_RESULT = buildMetadataResult({ | ||
| status: 'success', | ||
| source: 'sample-app', | ||
| }); | ||
|
|
||
| /** | ||
| * Renders a {@link MetadataCollector} pause field: the connector payload as | ||
| * pretty JSON plus demo controls that store a success result, an error | ||
| * envelope, or clear the stored result. | ||
| * | ||
| * @remarks | ||
| * SDK Integrator connector pause/resume: the SDK surfaces the opaque | ||
| * `metadata` payload; the app performs the on-device work and stores a result | ||
| * as the collector's form value before the flow can resume via `next()`. | ||
| * This molecule is sample-app demo scaffolding — "Set result" stores | ||
| * {@link DEMO_SUCCESS_RESULT} and "Set error" stores a | ||
| * {@link buildMetadataError} envelope; a real integration would replace both | ||
| * with the actual SDK work. "Clear" stores `null`, which the submit helper | ||
| * treats as unset and blocks with `METADATA_RESULT_REQUIRED` until a result | ||
| * is present (gating is result-set-based, independent of the server | ||
| * `required` flag). | ||
| * | ||
| * @param props Renderer props. | ||
| * @returns Metadata field element. | ||
| */ | ||
| export default function DaVinciMetadataField( | ||
| props: DaVinciCollectorRendererProps, | ||
| ): React.ReactElement { | ||
| const { collector, value, onChange } = props; | ||
| const metadataCollector = collector as MetadataCollector; | ||
| const isSet = value !== undefined && value !== null; | ||
|
|
||
| return ( | ||
| <View style={davinciFieldStyles.card}> | ||
| <Text style={davinciFieldStyles.fieldLabel}> | ||
| {metadataCollector.label || 'SDK metadata'} | ||
| </Text> | ||
| <Text style={davinciFieldStyles.helperText}>Connector payload:</Text> | ||
| <Text | ||
| testID={`davinci-field-${collector.key}-metadata-payload`} | ||
| style={styles.jsonText} | ||
| selectable | ||
| > | ||
| {JSON.stringify(metadataCollector.metadata, null, 2)} | ||
| </Text> | ||
| <Text style={davinciFieldStyles.helperText}>Result:</Text> | ||
| <Text | ||
| testID={`davinci-field-${collector.key}-metadata-value`} | ||
| style={styles.jsonText} | ||
| selectable | ||
| > | ||
| {isSet ? JSON.stringify(value, null, 2) : 'Not set'} | ||
| </Text> | ||
| {!isSet ? ( | ||
| <Text | ||
| testID={`davinci-field-${collector.key}-metadata-unset`} | ||
| style={davinciFieldStyles.errorText} | ||
| > | ||
| A result is required before the flow can resume. | ||
| </Text> | ||
| ) : null} | ||
| <TouchableOpacity | ||
| testID={`davinci-field-${collector.key}-metadata-set-result`} | ||
| style={commonStyles.buttonSecondary} | ||
| onPress={() => onChange(DEMO_SUCCESS_RESULT)} | ||
| > | ||
| <Text style={commonStyles.buttonTextSecondary}>Set result</Text> | ||
| </TouchableOpacity> | ||
| <TouchableOpacity | ||
| testID={`davinci-field-${collector.key}-metadata-set-error`} | ||
| style={commonStyles.buttonSecondary} | ||
| onPress={() => | ||
| onChange( | ||
| buildMetadataError( | ||
| 'USER_CANCELLED', | ||
| 'User cancelled the operation', | ||
| ), | ||
| ) | ||
| } | ||
| > | ||
| <Text style={commonStyles.buttonTextSecondary}>Set error</Text> | ||
| </TouchableOpacity> | ||
| <TouchableOpacity | ||
| testID={`davinci-field-${collector.key}-metadata-clear`} | ||
| style={commonStyles.buttonSecondary} | ||
| disabled={!isSet} | ||
| // setValue(key, null) keeps the key present with a null value; the | ||
| // submit helper treats null the same as unset | ||
| // (METADATA_RESULT_REQUIRED), so null is sufficient to "clear" here | ||
| // and no clearValue prop needs threading through the renderer. | ||
| onPress={() => onChange(null)} | ||
| > | ||
| <Text style={commonStyles.buttonTextSecondary}>Clear</Text> | ||
| </TouchableOpacity> | ||
| </View> | ||
| ); | ||
| } | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| jsonText: { | ||
| fontFamily: 'Courier', | ||
| fontSize: 12, | ||
| color: colors.textDark, | ||
| backgroundColor: colors.background, | ||
| borderRadius: 8, | ||
| padding: 8, | ||
| marginTop: 4, | ||
| marginBottom: 4, | ||
| }, | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.