Skip to content

Commit 319cd7e

Browse files
feat: Preserve credential field order
Stainless-Generated-From: c5b3821f6a2709e60f33d319561c17434b4c831c
1 parent ec6d02f commit 319cd7e

1 file changed

Lines changed: 28 additions & 5 deletions

File tree

‎src/resources/vaults/items.ts‎

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,11 @@ export interface CredentialCollectionAction {
601601
}
602602

603603
export interface CredentialVaultFieldDefinition {
604+
/**
605+
* Stable field name used to key values, updates, and browser fills.
606+
*/
607+
name: string;
608+
604609
/**
605610
* Whether a nonempty value is required for readiness and form submission.
606611
*/
@@ -627,6 +632,11 @@ export interface CredentialVaultFieldDefinition {
627632
}
628633

629634
export interface CredentialVaultFieldInput {
635+
/**
636+
* Unique stable field name used to key values, updates, and browser fills.
637+
*/
638+
name: string;
639+
630640
/**
631641
* Text, email, and password have form inputs; totp does not and is omitted from
632642
* both Kernel-hosted and customer React forms. Password and totp must be
@@ -795,15 +805,20 @@ export interface CredentialVaultItemRequest {
795805
/**
796806
* Credential fields are for login and other non-payment credentials. Do not store,
797807
* collect, or fill credit card data in credential items. Use wallet and card item
798-
* types for credit cards and payment checkout instead.
808+
* types for credit cards and payment checkout instead. Field order is preserved in
809+
* the user-facing collection form, so list fields in the same top-to-bottom order
810+
* as the website.
799811
*/
800812
spec: CredentialVaultItemSpecInput;
801813

802814
type: 'credential';
803815
}
804816

805817
export interface CredentialVaultItemSpec {
806-
fields: { [key: string]: CredentialVaultFieldDefinition };
818+
/**
819+
* Ordered field definitions rendered in this order by credential collection forms.
820+
*/
821+
fields: Array<CredentialVaultFieldDefinition>;
807822

808823
/**
809824
* Recognizable site or service name displayed verbatim as the form title, without
@@ -816,10 +831,16 @@ export interface CredentialVaultItemSpec {
816831
/**
817832
* Credential fields are for login and other non-payment credentials. Do not store,
818833
* collect, or fill credit card data in credential items. Use wallet and card item
819-
* types for credit cards and payment checkout instead.
834+
* types for credit cards and payment checkout instead. Field order is preserved in
835+
* the user-facing collection form, so list fields in the same top-to-bottom order
836+
* as the website.
820837
*/
821838
export interface CredentialVaultItemSpecInput {
822-
fields: { [key: string]: CredentialVaultFieldInput };
839+
/**
840+
* Ordered field definitions. Use the website's top-to-bottom field order; the
841+
* collection form renders this order unchanged.
842+
*/
843+
fields: Array<CredentialVaultFieldInput>;
823844

824845
/**
825846
* The site's recognizable display name, used verbatim as the user-facing form
@@ -2005,7 +2026,9 @@ export declare namespace ItemUpsertParams {
20052026
/**
20062027
* Body param: Credential fields are for login and other non-payment credentials.
20072028
* Do not store, collect, or fill credit card data in credential items. Use wallet
2008-
* and card item types for credit cards and payment checkout instead.
2029+
* and card item types for credit cards and payment checkout instead. Field order
2030+
* is preserved in the user-facing collection form, so list fields in the same
2031+
* top-to-bottom order as the website.
20092032
*/
20102033
spec: CredentialVaultItemSpecInput;
20112034

0 commit comments

Comments
 (0)