skyflow-js 1.38.0 → 1.38.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -343,7 +343,8 @@ const options = {
343
343
  enableCardIcon: true, // Optional, indicates whether a card icon should be enabled (only applicable for CARD_NUMBER ElementType).
344
344
  enableCopy: false, // Optional, enables the copy icon to collect elements to copy text to clipboard. Defaults to 'false').
345
345
  format: String, // Optional, format for the element
346
- translation: {} // Optional, indicates the allowed data type value for format.
346
+ translation: {}, // Optional, indicates the allowed data type value for format.
347
+ cardMetadata:{} // Optional, metadata to control card number element behavior. (only applicable for CARD_NUMBER ElementType).
347
348
  };
348
349
  ```
349
350
 
@@ -370,6 +371,29 @@ Accepted values by element type:
370
371
  | CARD_NUMBER | <li>`format`</li> <ul><li>`XXXX XXXX XXXX XXXX` (default)</li><li>`XXXX-XXXX-XXXX-XXXX`</li></ul> | <ul><li>1234 5678 9012 3456</li><li>1234-5678-9012-3456</li></ul> |
371
372
  | INPUT_FIELD | <li>`format`: A string that matches the desired output, with placeholder characters of your choice.</li><li>`translation`: An object of key/value pairs. Defaults to `{"X": "[0-9]"}`</li> | With a `format` of `+91 XXXX-XX-XXXX` and a `translation` of `[ "X": "[0-9]"]`, user input of "1234121234" displays as "+91 1234-12-1234". |
372
373
 
374
+ `cardMetadata`: An object of metadata keys to control card number element behavior. It supports an optional key called `scheme`, which accepts an array of Skyflow accept card types based on which SDK will display card brand choice dropdown in the card number element. `Skyflow.CardType` is an enum with all skyflow supported card schemes.
375
+
376
+ ```javascript
377
+ import Skyflow from 'skyflow-js'
378
+
379
+ const cardMetadata = {
380
+ scheme: Skyflow.CardType [] // Optional, array of skyflow supported card types.
381
+ }
382
+ ```
383
+
384
+ <div id="supported-card-types-by-skyflowcardtype">Supported card types by Skyflow.CardType :</div>
385
+
386
+ - `VISA`
387
+ - `MASTERCARD`
388
+ - `AMEX`
389
+ - `DINERS_CLUB`
390
+ - `DISCOVER`
391
+ - `JCB`
392
+ - `MAESTRO`
393
+ - `UNIONPAY`
394
+ - `HIPERCARD`
395
+ - `CARTES_BANCAIRES`
396
+
373
397
  **Collect Element Options examples for INPUT_FIELD**
374
398
  Example 1
375
399
  ```js
@@ -1019,11 +1043,13 @@ state : {
1019
1043
  isFocused: boolean
1020
1044
  isValid: boolean
1021
1045
  value: string
1046
+ selectedCardScheme: Skyflow.CardType // only for CARD_NUMBER element type
1022
1047
  }
1023
1048
  ```
1024
1049
 
1025
- `Note:`
1026
- values of SkyflowElements will be returned in element state object only when `env` is `DEV`, else it is empty string i.e, '', but in case of CARD_NUMBER type element when the `env` is `PROD` for all the card types except AMEX, it will return first eight digits, for AMEX it will return first six digits and rest all digits in masked format.
1050
+ **Note:**
1051
+ - values of SkyflowElements will be returned in element state object only when `env` is `DEV`, else it is empty string i.e, '', but in case of CARD_NUMBER type element when the `env` is `PROD` for all the card types except AMEX, it will return first eight digits, for AMEX it will return first six digits and rest all digits in masked format.
1052
+ - `selectedCardScheme` will exist for `CARD_NUMBER` element state and the value of <a href="#supported-card-types-by-skyflowcardtype">Skyflow.CardType</a> will be only populated when cardbrand choice selection is triggered otherwise, it will always be an empty string.
1027
1053
 
1028
1054
  ##### Sample [code snippet](https://github.com/skyflowapi/skyflow-js/blob/main/samples/using-script-tag/collect-element-listeners.html) for using listeners
1029
1055
  ```javascript