@opengovsg/formsg-sdk 0.12.0-alpha.1 → 0.13.0

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
@@ -4,6 +4,42 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [v0.13.0](https://github.com/opengovsg/formsg-javascript-sdk/compare/v0.12.0...v0.13.0)
8
+
9
+ - add address to field type [`#111`](https://github.com/opengovsg/formsg-javascript-sdk/pull/111)
10
+
11
+ #### [v0.12.0](https://github.com/opengovsg/formsg-javascript-sdk/compare/v0.12.0-alpha.1...v0.12.0)
12
+
13
+ > 9 September 2024
14
+
15
+ - build(deps): bump axios from 1.6.4 to 1.7.4 [`#110`](https://github.com/opengovsg/formsg-javascript-sdk/pull/110)
16
+ - chore: update readme for paymentContent [`#105`](https://github.com/opengovsg/formsg-javascript-sdk/pull/105)
17
+ - fix: package.json & package-lock.json to reduce vulnerabilities [`#103`](https://github.com/opengovsg/formsg-javascript-sdk/pull/103)
18
+
19
+ #### [v0.12.0-alpha.1](https://github.com/opengovsg/formsg-javascript-sdk/compare/v0.11.0...v0.12.0-alpha.1)
20
+
21
+ > 15 December 2023
22
+
23
+ - build: bump version to 0.12.0-alpha.1 [`#102`](https://github.com/opengovsg/formsg-javascript-sdk/pull/102)
24
+ - feat: mrf crypto [`#101`](https://github.com/opengovsg/formsg-javascript-sdk/pull/101)
25
+
26
+ #### [v0.11.0](https://github.com/opengovsg/formsg-javascript-sdk/compare/v0.10.0...v0.11.0)
27
+
28
+ > 6 December 2023
29
+
30
+ - build: bump version to 0.11.0 [`#100`](https://github.com/opengovsg/formsg-javascript-sdk/pull/100)
31
+ - Create LICENSE [`#95`](https://github.com/opengovsg/formsg-javascript-sdk/pull/95)
32
+ - chore: upgrade axios to 1.6.2 [`#93`](https://github.com/opengovsg/formsg-javascript-sdk/pull/93)
33
+ - build(deps-dev): bump @babel/traverse from 7.16.3 to 7.23.3 [`#99`](https://github.com/opengovsg/formsg-javascript-sdk/pull/99)
34
+ - build(deps-dev): bump word-wrap from 1.2.3 to 1.2.5 [`#97`](https://github.com/opengovsg/formsg-javascript-sdk/pull/97)
35
+ - Update ci.yml [`#96`](https://github.com/opengovsg/formsg-javascript-sdk/pull/96)
36
+ - chore(readme): add wording for period inclusion of unstable fields [`#94`](https://github.com/opengovsg/formsg-javascript-sdk/pull/94)
37
+ - Update README.md to include existence of sister SDks [`#90`](https://github.com/opengovsg/formsg-javascript-sdk/pull/90)
38
+ - fix: upgrade axios from 0.24.0 to 0.25.0 [`#81`](https://github.com/opengovsg/formsg-javascript-sdk/pull/81)
39
+ - build(deps): bump json5 from 1.0.1 to 1.0.2 [`#88`](https://github.com/opengovsg/formsg-javascript-sdk/pull/88)
40
+ - build: release v0.10.0 [`#87`](https://github.com/opengovsg/formsg-javascript-sdk/pull/87)
41
+ - docs: add changelog and version script [`f207c3e`](https://github.com/opengovsg/formsg-javascript-sdk/commit/f207c3e42cb81347e1fbb9a080f506d6373b54df)
42
+
7
43
  #### [v0.10.0](https://github.com/opengovsg/formsg-javascript-sdk/compare/v0.9.0...v0.10.0)
8
44
 
9
45
  > 16 December 2022
package/README.md CHANGED
@@ -103,6 +103,9 @@ The underlying cryptosystem is `x25519-xsalsa20-poly1305` which is implemented b
103
103
  | encryptedContent | string | The encrypted submission in base64. |
104
104
  | created | string | Creation timestamp. |
105
105
  | attachmentDownloadUrls | Record<string, string> | (Optional) Records containing field IDs and URLs where encrypted uploaded attachments can be downloaded. |
106
+ | paymentContent | Record<string, string> | (Optional) Records containing payment details for forms with payments[1] |
107
+
108
+ [1] Forms with the deprecated Fixed Payment Type is not supported
106
109
 
107
110
  ### Format of Decrypted Submissions
108
111
 
@@ -130,7 +133,7 @@ decrypt and open the signed decrypted content with the package's own
130
133
  The resulting decrypted verifiedContent will be assigned to the `verified` key
131
134
  of the returned object.
132
135
 
133
- > **NOTE** <br>
136
+ > **Note:** <br>
134
137
  > If any errors occur, either from the failure to decrypt either `encryptedContent` or `verifiedContent`, or the failure to authenticate the decrypted signed message in `verifiedContent`, `null` will be returned.
135
138
 
136
139
  Note that due to end-to-end encryption, FormSG servers are unable to verify the data format.
@@ -146,8 +149,8 @@ decrypted content does not contain all of the fields displayed in the schema bel
146
149
  | fieldType | string | The type of field for the question. |
147
150
  | \_id | string | A unique identifier of the form field. WARNING: Changes when new fields are created/removed in the form. |
148
151
 
149
- **Important Note: **
150
- Additional internal fields may be included in webhooks from time to time, which will then be published as part of our official schema once it is stable for public consumption. If you are applying your own validation, you should account for this e.g. by not rejecting the webhook if there are additional fields included.
152
+ > **Note:** <br>
153
+ > Additional internal fields may be included in webhooks from time to time, which will then be published as part of our official schema once it is stable for public consumption. If you are applying your own validation, you should account for this e.g. by not rejecting the webhook if there are additional fields included.
151
154
 
152
155
  The full schema can be viewed in
153
156
  [`validate.ts`](https://github.com/opengovsg/formsg-javascript-sdk/tree/master/src/util/validate.ts).
@@ -178,6 +181,24 @@ Attachments are end-to-end encrypted in the same way as normal form submissions,
178
181
 
179
182
  _Warning:_ We do not have the ability to scan any attachments for malicious content (e.g. spyware or viruses), so careful handling is needed.
180
183
 
184
+ ### Format of Payment Content
185
+
186
+ These fields will be available if the submission is a payment submission, otherwise, the value will be an empty `{}`.
187
+
188
+ | Key | Type | Description |
189
+ | -------------- | ---------------- | ------------------------------------------------ |
190
+ | type | 'payment_charge' | Payment event associated with this webhook |
191
+ | status | string | Status of the payment intent |
192
+ | payer | string | The email associated with this email |
193
+ | url | string | The url of the proof of payment for this payment |
194
+ | paymentIntent | string | The payment intent associated with this payment |
195
+ | amount | string | The amount charged to the user |
196
+ | productService | string | The product or service name of the payment |
197
+ | dateTime | string | The time of which this payment was transacted |
198
+ | transactionFee | string | The fees charged for this transaction |
199
+
200
+
201
+
181
202
  ## Verifying Signatures Manually
182
203
 
183
204
  You can use the following information to create a custom solution, although we recommend using this SDK.
package/dist/types.d.ts CHANGED
@@ -6,7 +6,7 @@ export type PackageInitParams = {
6
6
  /** Initializes public key used for verifying and decrypting in this package. If not given, will default to "production". */
7
7
  mode?: PackageMode;
8
8
  };
9
- export type FieldType = 'section' | 'radiobutton' | 'dropdown' | 'checkbox' | 'nric' | 'email' | 'table' | 'number' | 'rating' | 'yes_no' | 'decimal' | 'textfield' | 'textarea' | 'attachment' | 'date' | 'mobile' | 'homeno' | 'statement' | 'image' | 'country_region' | 'uen' | 'children';
9
+ export type FieldType = 'section' | 'radiobutton' | 'dropdown' | 'checkbox' | 'nric' | 'email' | 'table' | 'number' | 'rating' | 'yes_no' | 'decimal' | 'textfield' | 'textarea' | 'attachment' | 'date' | 'mobile' | 'homeno' | 'statement' | 'image' | 'country_region' | 'uen' | 'children' | 'address';
10
10
  export type FormField = {
11
11
  _id: string;
12
12
  question: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengovsg/formsg-sdk",
3
- "version": "0.12.0-alpha.1",
3
+ "version": "0.13.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/opengovsg/formsg-javascript-sdk.git"
@@ -24,7 +24,7 @@
24
24
  "author": "Open Government Products (FormSG)",
25
25
  "license": "MIT",
26
26
  "dependencies": {
27
- "axios": "^1.6.2",
27
+ "axios": "^1.6.4",
28
28
  "tweetnacl": "^1.0.3",
29
29
  "tweetnacl-util": "^0.15.1"
30
30
  },