File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,6 +109,9 @@ export interface Options {
109109 } ;
110110 ariaLabel ?: string ;
111111 placeholder ?: string ;
112+ validCardBrands ?: {
113+ type : string ;
114+ } [ ] | null ;
112115 } ;
113116 "transaction.ccvv" ?: {
114117 showCardIcon ?: boolean | object ;
Original file line number Diff line number Diff line change @@ -141,6 +141,7 @@ export class VGS {
141141 // Autocomplete is not customizable
142142 autoComplete : "cc-number" ,
143143 validations : [ "required" , "validCardNumber" ] ,
144+ validCardBrands : null
144145 } ,
145146 "transaction.ccvv" : {
146147 showCardIcon : false ,
@@ -158,6 +159,12 @@ export class VGS {
158159 css : styles ,
159160 } ,
160161 } ;
162+ // Override the validCardBrands if set in the theme options, as this should not be deep merged.
163+ if ( options &&
164+ options [ "transaction.ccnumber" ] &&
165+ options [ "transaction.ccnumber" ] . validCardBrands ) {
166+ defaultOptions [ "transaction.ccnumber" ] . validCardBrands = options [ "transaction.ccnumber" ] . validCardBrands ;
167+ }
161168 // Deep merge the default options with the options set in the theme
162169 this . options = ENGrid . deepMerge ( defaultOptions , options ) ;
163170 this . logger . log ( "Options" , this . options ) ;
Original file line number Diff line number Diff line change @@ -112,6 +112,9 @@ export interface Options {
112112 } ;
113113 ariaLabel ?: string ;
114114 placeholder ?: string ;
115+ validCardBrands ?: {
116+ type : string ;
117+ } [ ] | null ;
115118 } ;
116119 "transaction.ccvv" ?: {
117120 showCardIcon ?: boolean | object ;
Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ export class VGS {
113113 // Autocomplete is not customizable
114114 autoComplete : "cc-number" ,
115115 validations : [ "required" , "validCardNumber" ] ,
116+ validCardBrands : < { type : string } [ ] | null > null
116117 } ,
117118 "transaction.ccvv" : {
118119 showCardIcon : false ,
@@ -130,6 +131,14 @@ export class VGS {
130131 css : styles ,
131132 } ,
132133 } ;
134+ // Override the validCardBrands if set in the theme options, as this should not be deep merged.
135+ if (
136+ options &&
137+ options [ "transaction.ccnumber" ] &&
138+ options [ "transaction.ccnumber" ] . validCardBrands
139+ ) {
140+ defaultOptions [ "transaction.ccnumber" ] . validCardBrands = options [ "transaction.ccnumber" ] . validCardBrands ;
141+ }
133142 // Deep merge the default options with the options set in the theme
134143 this . options = ENGrid . deepMerge ( defaultOptions , options ) ;
135144 this . logger . log ( "Options" , this . options ) ;
You can’t perform that action at this time.
0 commit comments