skyflow-js 1.34.0 → 1.34.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/CHANGELOG.md CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.34.1] - 2024-01-10
6
+ ### Added
7
+ - File name validations in file upload
8
+
9
+ ### Fixed
10
+ - Invalid styles applied on expiry date and expiry month on initial render
11
+ - Custom validation error text overridden by required error text on empty values.
12
+
13
+ ## [1.34.0] - 2023-12-15
14
+ ### Added
15
+ - Ability to update Collect and Reveal element properties dynamically.
16
+
17
+ ### Fixed
18
+ - iFrame height resize issue
19
+ - ExpiryMonth Element's invalid input styles issue
20
+
21
+ ## [1.33.4] - 2023-12-07
22
+ ## Fixed
23
+ - jQuery dependency replacement changes.
24
+
5
25
  ## [1.33.3] - 2023-11-15
6
26
  ## Fixed
7
27
  - Patch fix for reverting changes for internal jQuery dependency changes.
package/README.md CHANGED
@@ -127,14 +127,16 @@ For `env` parameter, there are 2 accepted values in Skyflow.Env
127
127
  ---
128
128
 
129
129
  # Securely collecting data client-side
130
- - [**Insert data into the vault**](#insert-data-into-the-vault)
131
- - [**Using Skyflow Elements to collect data**](#using-skyflow-elements-to-collect-data)
132
- - [**Using Skyflow Elements to update data**](#using-skyflow-elements-to-update-data)
133
- - [**Using validations on Collect Elements**](#validations)
134
- - [**Event Listener on Collect Elements**](#event-listener-on-collect-elements)
135
- - [**UI Error for Collect Elements**](#ui-error-for-collect-elements)
130
+ - [**Insert data into the vault**](#insert-data-into-the-vault)
131
+ - [**Using Skyflow Elements to collect data**](#using-skyflow-elements-to-collect-data)
132
+ - [**Using Skyflow Elements to update data**](#using-skyflow-elements-to-update-data)
133
+ - [**Using validations on Collect Elements**](#validations)
134
+ - [**Event Listener on Collect Elements**](#event-listener-on-collect-elements)
135
+ - [**UI Error for Collect Elements**](#ui-error-for-collect-elements)
136
136
  - [**Set and Clear value for Collect Elements (DEV ENV ONLY)**](#set-and-clear-value-for-collect-elements-dev-env-only)
137
+ - [**Update Collect Elements**](#update-collect-elements)
137
138
  - [**Using Skyflow File Element to upload a file**](#using-skyflow-file-element-to-upload-a-file)
139
+
138
140
  ## Insert data into the vault
139
141
 
140
142
  To insert data into the vault, use the `insert(records, options?)` method of the Skyflow client. The `records` parameter takes a JSON object of the records to insert into the below format. The `options` parameter takes an object of optional parameters for the insertion. The `insert` method also supports upsert operations.
@@ -1155,6 +1157,115 @@ cardNumber.clearValue();
1155
1157
 
1156
1158
  ```
1157
1159
 
1160
+ ### Update Collect Elements
1161
+
1162
+ You can update collect element properties with the `update` interface.
1163
+
1164
+ The `update` interface takes the below object:
1165
+
1166
+ ```javascript
1167
+ const updateElement = {
1168
+ table: 'string', // Optional. The table this data belongs to.
1169
+ column: 'string', // Optional. The column this data belongs to.
1170
+ inputStyles: {}, // Optional. Styles applied to the form element.
1171
+ labelStyles: {}, // Optional. Styles for the label of the element.
1172
+ errorTextStyles: {}, // Optional. Styles for the errorText of element.
1173
+ label: 'string', // Optional. Label for the form element.
1174
+ placeholder: 'string', // Optional. Placeholder for the form element.
1175
+ validations: [], // Optional. Array of validation rules.
1176
+ skyflowID: 'string' // Optional. SkyflowID of the record.
1177
+ };
1178
+ ```
1179
+
1180
+ Only include the properties that you want to update for the specified collect element.
1181
+
1182
+ Properties your provided when you created the element remain the same until you explicitly update them.
1183
+
1184
+ `Note`: You can't update the `type` property of an element.
1185
+
1186
+ ### End to end example
1187
+ ```javascript
1188
+ // Create a collect container.
1189
+ const collectContainer = skyflow.container(Skyflow.ContainerType.COLLECT);
1190
+
1191
+ const stylesOptions = {
1192
+ inputStyles: {
1193
+ base: {
1194
+ fontFamily: 'Inter',
1195
+ fontStyle: 'normal',
1196
+ fontWeight: 400,
1197
+ fontSize: '14px',
1198
+ lineHeight: '21px',
1199
+ width: '294px',
1200
+ },
1201
+ },
1202
+ labelStyles: {},
1203
+ errorTextStyles: {
1204
+ base: {},
1205
+ },
1206
+ };
1207
+
1208
+ // Create collect elements
1209
+ const cardHolderNameElement = collectContainer.create({
1210
+ table: 'pii_fields',
1211
+ column: 'first_name',
1212
+ ...stylesOptions,
1213
+ placeholder: 'Cardholder Name',
1214
+ type: Skyflow.ElementType.CARDHOLDER_NAME,
1215
+ });
1216
+
1217
+ const cardNumberElement = collectContainer.create({
1218
+ table: 'pii_fields',
1219
+ column: 'card_number',
1220
+ ...stylesOptions,
1221
+ placeholder: 'Card Number',
1222
+ type: Skyflow.ElementType.CARD_NUMBER,
1223
+ });
1224
+
1225
+ const cvvElement = collectContainer.create({
1226
+ table: 'pii_fields',
1227
+ column: 'cvv',
1228
+ ...stylesOptions,
1229
+ placeholder: 'CVV',
1230
+ type: Skyflow.ElementType.CVV,
1231
+ });
1232
+
1233
+ // Mount the collect elements.
1234
+ cardHolderNameElement.mount('#cardHolderNameElement'); // Assumes there is a div with id='#cardHolderNameElement' in the webpage.
1235
+ cardNumberElement.mount('#cardNumberElement'); // Assumes there is a div with id='#cardNumberElement' in the webpage.
1236
+ cvvElement.mount('#cvvElement'); // Assumes there is a div with id='#cvvElement' in the webpage.
1237
+
1238
+ // ...
1239
+
1240
+ // Update validations property on cvvElement.
1241
+ cvvElement.update({
1242
+ validations: [{
1243
+ type: Skyflow.ValidationRuleType.LENGTH_MATCH_RULE,
1244
+ params: {
1245
+ max: 3,
1246
+ error: 'cvv must be 3 digits',
1247
+ },
1248
+ }]
1249
+ })
1250
+
1251
+ // Update label, placeholder properties on cardHolderNameElement.
1252
+ cardHolderNameElement.update({
1253
+ label: 'CARDHOLDER NAME',
1254
+ placeholder: 'Eg: John'
1255
+ });
1256
+
1257
+ // Update table, column, inputStyles properties on cardNumberElement.
1258
+ cardNumberElement.update({
1259
+ table:'cards',
1260
+ column:'card_number',
1261
+ inputStyles:{
1262
+ base:{
1263
+ color:'blue'
1264
+ }
1265
+ }
1266
+ });
1267
+ ```
1268
+
1158
1269
  ---
1159
1270
 
1160
1271
  # Securely collecting data client-side using Composable Elements
@@ -1752,6 +1863,7 @@ composableContainer.on(Skyflow.EventName.SUBMIT, ()=> {
1752
1863
  - [**Set token for Reveal Elements**](#set-token-for-reveal-elements)
1753
1864
  - [**Set and clear altText for Reveal Elements**](#set-and-clear-alttext-for-reveal-elements)
1754
1865
  - [**Render a file with a File Element**](#render-a-file-with-a-file-element)
1866
+ - [**Update Reveal Elements**](#update-reveal-elements)
1755
1867
 
1756
1868
  ## Retrieving data from the vault
1757
1869
 
@@ -2596,6 +2708,8 @@ collectContainer.uploadFiles();
2596
2708
  }
2597
2709
  ```
2598
2710
 
2711
+ Note: File name should contain only alphanumeric characters and !-_.*()
2712
+
2599
2713
  ## Render a file with a File Element
2600
2714
 
2601
2715
  You can render files using the Skyflow File Element. Use the following steps to securely render a file.
@@ -2615,9 +2729,9 @@ const fileElement = {
2615
2729
  inputStyles: {}, // Optional, styles to be applied to the element.
2616
2730
  errorTextStyles: {}, // Optional, styles that will be applied to the errorText of the render element.
2617
2731
  altText: 'string', // Optional, string that is shown before file render call
2618
- skyflowID: 'string', // Required, skyflow id of the file to be render
2619
- column: 'string', // Required, column name of the file to be render
2620
- table: 'string', // Required, table name of the file to be render
2732
+ skyflowID: 'string', // Required, skyflow id of the file to render
2733
+ column: 'string', // Required, column name of the file to render
2734
+ table: 'string', // Required, table name of the file to render
2621
2735
  };
2622
2736
  ```
2623
2737
  The inputStyles and errorTextStyles parameters accept a styles object as described in the [previous section](https://github.com/skyflowapi/skyflow-js#step-2-create-a-collect-element) for collecting data. But for render file elements, inputStyles accepts only base variant, global style objects.
@@ -2732,6 +2846,104 @@ fetch("<BACKEND_URL>")
2732
2846
  }
2733
2847
  ```
2734
2848
 
2849
+ ### Update Reveal Elements
2850
+
2851
+ You can update reveal element properties with the `update` interface.
2852
+
2853
+ The `update` interface takes the below object:
2854
+ ```javascript
2855
+ const updateElement = {
2856
+ token: 'string', // Optional, token of the data being revealed.
2857
+ inputStyles: {}, // Optional, styles to be applied to the element.
2858
+ labelStyles: {}, // Optional, styles to be applied to the label of the reveal element.
2859
+ errorTextStyles: {}, // Optional, styles that will be applied to the errorText of the reveal element.
2860
+ label: 'string', // Optional, label for the form element.
2861
+ altText: 'string', // Optional, string that is shown before reveal, will show token if altText is not provided.
2862
+ redaction: RedactionType, // Optional, Redaction Type to be applied to data.
2863
+ skyflowID: 'string', // Optional, Skyflow ID of the file to render.
2864
+ table: 'string', // Optional, table name of the file to render.
2865
+ column: 'string' // Optional, column name of the file to render.
2866
+ };
2867
+ ```
2868
+
2869
+ Only include the properties that you want to update for the specified reveal element.
2870
+
2871
+ Properties your provided when you created the element remain the same until you explicitly update them.
2872
+
2873
+ ### End to end example
2874
+ ```javascript
2875
+ // Create a reveal container.
2876
+ const revealContainer = skyflow.container(Skyflow.ContainerType.REVEAL);
2877
+
2878
+ const stylesOptions = {
2879
+ inputStyles: {
2880
+ base: {
2881
+ fontFamily: 'Inter',
2882
+ fontStyle: 'normal',
2883
+ fontWeight: 400,
2884
+ fontSize: '14px',
2885
+ lineHeight: '21px',
2886
+ width: '294px',
2887
+ },
2888
+ },
2889
+ labelStyles: {},
2890
+ errorTextStyles: {
2891
+ base: {
2892
+ color: '#f44336'
2893
+ },
2894
+ },
2895
+ };
2896
+
2897
+ // Create reveal elements
2898
+ const cardHolderNameRevealElement = revealContainer.create({
2899
+ token: 'ed5fdd1f-5009-435c-a06b-3417ce76d2c8',
2900
+ altText: 'first name',
2901
+ ...stylesOptions,
2902
+ label: 'Card Holder Name',
2903
+ });
2904
+
2905
+ const cardNumberRevealElement = revealContainer.create({
2906
+ token: '8ee84061-7107-4faf-bb25-e044f3d191fe',
2907
+ altText: 'xxxx',
2908
+ ...stylesOptions,
2909
+ label: 'Card Number',
2910
+ redaction: 'RedactionType.CARD_NUMBER'
2911
+ });
2912
+
2913
+ // Mount the reveal elements.
2914
+ cardHolderNameRevealElement.mount('#cardHolderNameRevealElement'); // Assumes there is a div with id='#cardHolderNameRevealElement' in the webpage.
2915
+ cardNumberRevealElement.mount('#cardNumberRevealElement'); // Assumes there is a div with id='#cardNumberRevealElement' in the webpage.
2916
+
2917
+ // ...
2918
+
2919
+ // Update label, labelStyles properties on cardHolderNameRevealElement.
2920
+ cardHolderNameRevealElement.update({
2921
+ label: 'CARDHOLDER NAME',
2922
+ labelStyles: {
2923
+ base: {
2924
+ color: '#aa11aa'
2925
+ }
2926
+ }
2927
+ });
2928
+
2929
+ // Update inputStyles, errorTextStyles properties on cardNumberRevealElement.
2930
+ cardNumberRevealElement.update({
2931
+ inputStyles: {
2932
+ base: {
2933
+ color: '#fff',
2934
+ backgroundColor: '#000',
2935
+ borderColor: '#f00',
2936
+ borderWidth: '5px'
2937
+ }
2938
+ },
2939
+ errorTextStyles: {
2940
+ base: {
2941
+ backgroundColor: '#000',
2942
+ }
2943
+ }
2944
+ });
2945
+ ```
2946
+
2735
2947
  ---
2736
2948
  # Securely deleting data client-side
2737
2949
  - [**Deleting data from the vault**](#deleting-data-from-the-vault)