Skip to content

Commit

Permalink
chore: Make FormField analyticsMetadata public (#3255)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldowseza authored Feb 6, 2025
1 parent 0905da2 commit 03d0574
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pages/funnel-analytics/static-single-page-flow.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ export default function StaticSinglePageCreatePage() {
>
<SpaceBetween size="s">
<FormField
analyticsMetadata={{
instanceIdentifier: 'field1',
}}
info={
<Link data-testid="external-link" external={true} href="#">
Learn more
Expand Down
19 changes: 19 additions & 0 deletions src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8513,6 +8513,25 @@ exports[`Documenter definition for form-field matches the snapshot: form-field 1
"functions": [],
"name": "FormField",
"properties": [
{
"analyticsTag": "",
"description": "Specifies additional analytics-related metadata.
* \`instanceIdentifier\` - A unique string that identifies this component instance in your application.",
"inlineType": {
"name": "FormFieldProps.AnalyticsMetadata",
"properties": [
{
"name": "instanceIdentifier",
"optional": true,
"type": "string",
},
],
"type": "object",
},
"name": "analyticsMetadata",
"optional": true,
"type": "FormFieldProps.AnalyticsMetadata",
},
{
"deprecatedTag": "Custom CSS is not supported. For testing and other use cases, use [data attributes](https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes).",
"description": "Adds the specified classes to the root element of the component.",
Expand Down
11 changes: 11 additions & 0 deletions src/form-field/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,20 @@ export interface FormFieldProps extends BaseComponentProps {
* non-empty string, it will render the form field in a warning state.
*/
warningText?: React.ReactNode;

/**
* Specifies additional analytics-related metadata.
* * `instanceIdentifier` - A unique string that identifies this component instance in your application.
* @analytics
*/
analyticsMetadata?: FormFieldProps.AnalyticsMetadata;
}

export namespace FormFieldProps {
export interface AnalyticsMetadata {
instanceIdentifier?: string;
}

export interface I18nStrings {
/**
* Provides a text alternative for the error icon in the error message.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ describe.each(['refresh', 'refresh-toolbar'] as Theme[])('%s', theme => {
stepNumber: 1,
subStepName: 'Container 1 - header',
fieldErrorContext: null,
fieldIdentifier: null,
fieldIdentifier: 'field1',
subStepErrorContext: null,
});

Expand Down

0 comments on commit 03d0574

Please sign in to comment.