@availity/native-form 1.0.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 +387 -0
- package/README.md +25 -0
- package/dist/index.d.mts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +138 -0
- package/dist/index.mjs +120 -0
- package/jest.config.js +7 -0
- package/package.json +45 -0
- package/project.json +39 -0
- package/src/flattenObject.js +22 -0
- package/src/index.d.ts +13 -0
- package/src/index.js +74 -0
- package/tsconfig.json +5 -0
- package/tsconfig.spec.json +10 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
|
+
|
|
5
|
+
# 1.0.0 (2023-08-23)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* add browser field for output ([0ce7170](https://github.com/Availity/sdk-js/commit/0ce717075a82675b8707e4db0cc07cd4af370f3d))
|
|
11
|
+
* append function is not defined for ie and edge mobile ([d995343](https://github.com/Availity/sdk-js/commit/d995343c63484b5df1b0660d5a44e52db5c2c6a9))
|
|
12
|
+
* **native-form:** fixed error trying to call toString on undefined ([c009460](https://github.com/Availity/sdk-js/commit/c0094607e992ef7072eeb37dedfc908eb2911f3e))
|
|
13
|
+
* **native-form:** update types and use api-axiosv6 ([02b0cd6](https://github.com/Availity/sdk-js/commit/02b0cd6a6c1f401c71b4ddc8482297604531983a))
|
|
14
|
+
* **native-form:** updated handling of falsey values ([ab57615](https://github.com/Availity/sdk-js/commit/ab57615e2158b41a54132e92e05026a2cfd1e0ea))
|
|
15
|
+
* **native-form:** updated test suite name ([fbf824c](https://github.com/Availity/sdk-js/commit/fbf824c7f2c5540193ab3d244a9598524f44d443))
|
|
16
|
+
* update babel and jest configs, rename tests ([c80e194](https://github.com/Availity/sdk-js/commit/c80e1947f0c3cb28c3c7db842c82f381622d72e7))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Code Refactoring
|
|
20
|
+
|
|
21
|
+
* **analytics-core,api-core,authorizations-core,message-core,native-form,upload-core:** eslint fixes ([00e3395](https://github.com/Availity/sdk-js/commit/00e339595962501c96acf2895650f104d4c49809))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
* build!: switch from lerna to nx and compile to esm with tsup ([c586085](https://github.com/Availity/sdk-js/commit/c5860856ca96b743a0653d335ea00f0889132f7f))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* **native-form:** add native form ([#62](https://github.com/Availity/sdk-js/issues/62)) ([8aa0471](https://github.com/Availity/sdk-js/commit/8aa047123d240906c129466800102b9dff2139d5))
|
|
30
|
+
* **native-form:** add operationName to graphql request for query tracking ([5772f57](https://github.com/Availity/sdk-js/commit/5772f57f30278ede6d85daefe2ab7341e8b78b92))
|
|
31
|
+
* **native-form:** call avWebQLApi to obtain sso type ([23a1bd9](https://github.com/Availity/sdk-js/commit/23a1bd98cc71334454d137be822a5a5a23a32447))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### BREAKING CHANGES
|
|
35
|
+
|
|
36
|
+
* Drop Internet Explorer support
|
|
37
|
+
* **native-form:** native-form now exports an async function, no longer defaults type
|
|
38
|
+
MIGRATION:
|
|
39
|
+
Before: nativeForm(...args);
|
|
40
|
+
After: await nativeForm(...args);
|
|
41
|
+
* **analytics-core,api-core,authorizations-core,message-core,native-form,upload-core:** .filter()[0] replaced with .find(), .forEach() replaced with for...of
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## [5.0.3](https://github.com/Availity/sdk-js/compare/@availity/native-form@5.0.2...@availity/native-form@5.0.3) (2022-06-15)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
## [5.0.2](https://github.com/Availity/sdk-js/compare/@availity/native-form@5.0.1...@availity/native-form@5.0.2) (2022-05-24)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
## [5.0.1](https://github.com/Availity/sdk-js/compare/@availity/native-form@5.0.0...@availity/native-form@5.0.1) (2022-04-28)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Bug Fixes
|
|
57
|
+
|
|
58
|
+
* add browser field for output ([0ce7170](https://github.com/Availity/sdk-js/commit/0ce717075a82675b8707e4db0cc07cd4af370f3d))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# [5.0.0](https://github.com/Availity/sdk-js/compare/@availity/native-form@4.0.12...@availity/native-form@5.0.0) (2022-04-28)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
* build!: switch from lerna to nx and compile to esm with tsup ([c586085](https://github.com/Availity/sdk-js/commit/c5860856ca96b743a0653d335ea00f0889132f7f))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### BREAKING CHANGES
|
|
69
|
+
|
|
70
|
+
* Drop Internet Explorer support
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## [4.0.12](https://github.com/availity/sdk-js/compare/@availity/native-form@4.0.10...@availity/native-form@4.0.12) (2022-02-22)
|
|
75
|
+
|
|
76
|
+
**Note:** Version bump only for package @availity/native-form
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## [4.0.11](https://github.com/availity/sdk-js/compare/@availity/native-form@4.0.10...@availity/native-form@4.0.11) (2022-01-19)
|
|
83
|
+
|
|
84
|
+
**Note:** Version bump only for package @availity/native-form
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
## 4.0.10 (2021-12-21)
|
|
91
|
+
|
|
92
|
+
**Note:** Version bump only for package @availity/native-form
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## [4.0.9](https://github.com/Availity/sdk-js/compare/@availity/native-form@4.0.8...@availity/native-form@4.0.9) (2021-10-29)
|
|
99
|
+
|
|
100
|
+
**Note:** Version bump only for package @availity/native-form
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
## [4.0.8](https://github.com/Availity/sdk-js/compare/@availity/native-form@4.0.7...@availity/native-form@4.0.8) (2021-10-22)
|
|
107
|
+
|
|
108
|
+
**Note:** Version bump only for package @availity/native-form
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
## 4.0.7 (2021-10-20)
|
|
115
|
+
|
|
116
|
+
**Note:** Version bump only for package @availity/native-form
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
## [4.0.6](https://github.com/Availity/sdk-js/compare/@availity/native-form@4.0.5...@availity/native-form@4.0.6) (2021-10-19)
|
|
123
|
+
|
|
124
|
+
**Note:** Version bump only for package @availity/native-form
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## [4.0.5](https://github.com/Availity/sdk-js/compare/@availity/native-form@4.0.4...@availity/native-form@4.0.5) (2021-10-08)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
### Bug Fixes
|
|
134
|
+
|
|
135
|
+
* **native-form:** update types and use api-axiosv6 ([02b0cd6](https://github.com/Availity/sdk-js/commit/02b0cd6a6c1f401c71b4ddc8482297604531983a))
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
## [4.0.4](https://github.com/Availity/sdk-js/compare/@availity/native-form@4.0.3...@availity/native-form@4.0.4) (2021-09-30)
|
|
142
|
+
|
|
143
|
+
**Note:** Version bump only for package @availity/native-form
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
## [4.0.3](https://github.com/Availity/sdk-js/compare/@availity/native-form@4.0.2...@availity/native-form@4.0.3) (2021-09-30)
|
|
150
|
+
|
|
151
|
+
**Note:** Version bump only for package @availity/native-form
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
## [4.0.2](https://github.com/Availity/sdk-js/compare/@availity/native-form@4.0.1...@availity/native-form@4.0.2) (2021-09-28)
|
|
158
|
+
|
|
159
|
+
**Note:** Version bump only for package @availity/native-form
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
## [4.0.1](https://github.com/Availity/sdk-js/compare/@availity/native-form@4.0.0...@availity/native-form@4.0.1) (2021-09-16)
|
|
166
|
+
|
|
167
|
+
**Note:** Version bump only for package @availity/native-form
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
# 4.0.0 (2021-09-01)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
### Features
|
|
177
|
+
|
|
178
|
+
* **native-form:** add operationName to graphql request for query tracking ([5772f57](https://github.com/Availity/sdk-js/commit/5772f57f30278ede6d85daefe2ab7341e8b78b92))
|
|
179
|
+
* **native-form:** call avWebQLApi to obtain sso type ([23a1bd9](https://github.com/Availity/sdk-js/commit/23a1bd98cc71334454d137be822a5a5a23a32447))
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
### BREAKING CHANGES
|
|
183
|
+
|
|
184
|
+
* **native-form:** native-form now exports an async function, no longer defaults type
|
|
185
|
+
MIGRATION:
|
|
186
|
+
Before: nativeForm(...args);
|
|
187
|
+
After: await nativeForm(...args);
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
# 3.0.0 (2021-05-17)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
### Code Refactoring
|
|
197
|
+
|
|
198
|
+
* **analytics-core,api-core,authorizations-core,message-core,native-form,upload-core:** eslint fixes ([00e3395](https://github.com/Availity/sdk-js/commit/00e339595962501c96acf2895650f104d4c49809))
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
### BREAKING CHANGES
|
|
202
|
+
|
|
203
|
+
* **analytics-core,api-core,authorizations-core,message-core,native-form,upload-core:** .filter()[0] replaced with .find(), .forEach() replaced with for...of
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
## 2.8.22 (2020-06-22)
|
|
210
|
+
|
|
211
|
+
**Note:** Version bump only for package @availity/native-form
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
## 2.8.21 (2020-05-01)
|
|
218
|
+
|
|
219
|
+
**Note:** Version bump only for package @availity/native-form
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
## 2.8.20 (2020-04-30)
|
|
226
|
+
|
|
227
|
+
**Note:** Version bump only for package @availity/native-form
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
## 2.8.19 (2020-04-22)
|
|
234
|
+
|
|
235
|
+
**Note:** Version bump only for package @availity/native-form
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
## 2.8.18 (2020-04-08)
|
|
242
|
+
|
|
243
|
+
**Note:** Version bump only for package @availity/native-form
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
## 2.8.17 (2020-04-06)
|
|
250
|
+
|
|
251
|
+
**Note:** Version bump only for package @availity/native-form
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
## 2.8.16 (2020-04-06)
|
|
258
|
+
|
|
259
|
+
**Note:** Version bump only for package @availity/native-form
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
## [2.8.15](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.12...@availity/native-form@2.8.15) (2020-02-13)
|
|
266
|
+
|
|
267
|
+
**Note:** Version bump only for package @availity/native-form
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
## [2.8.14](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.13...@availity/native-form@2.8.14) (2020-02-13)
|
|
274
|
+
|
|
275
|
+
**Note:** Version bump only for package @availity/native-form
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
## [2.8.13](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.11...@availity/native-form@2.8.13) (2020-02-13)
|
|
282
|
+
|
|
283
|
+
**Note:** Version bump only for package @availity/native-form
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
## [2.8.12](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.10...@availity/native-form@2.8.12) (2020-02-13)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
### Bug Fixes
|
|
293
|
+
|
|
294
|
+
* update babel and jest configs, rename tests ([c80e194](https://github.com/Availity/sdk-js/commit/c80e1947f0c3cb28c3c7db842c82f381622d72e7))
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
## [2.8.11](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.10...@availity/native-form@2.8.11) (2020-02-13)
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
### Bug Fixes
|
|
304
|
+
|
|
305
|
+
* update babel and jest configs, rename tests ([c80e194](https://github.com/Availity/sdk-js/commit/c80e1947f0c3cb28c3c7db842c82f381622d72e7))
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
## [2.8.10](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.7...@availity/native-form@2.8.10) (2020-02-13)
|
|
312
|
+
|
|
313
|
+
**Note:** Version bump only for package @availity/native-form
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
## [2.8.9](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.8...@availity/native-form@2.8.9) (2020-02-13)
|
|
320
|
+
|
|
321
|
+
**Note:** Version bump only for package @availity/native-form
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
## [2.8.8](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.7...@availity/native-form@2.8.8) (2020-02-13)
|
|
328
|
+
|
|
329
|
+
**Note:** Version bump only for package @availity/native-form
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
## [2.8.7](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.6...@availity/native-form@2.8.7) (2020-01-14)
|
|
336
|
+
|
|
337
|
+
### Bug Fixes
|
|
338
|
+
|
|
339
|
+
- **native-form:** fixed error trying to call toString on undefined ([c009460](https://github.com/Availity/sdk-js/commit/c009460))
|
|
340
|
+
- **native-form:** updated handling of falsey values ([ab57615](https://github.com/Availity/sdk-js/commit/ab57615))
|
|
341
|
+
- **native-form:** updated test suite name ([fbf824c](https://github.com/Availity/sdk-js/commit/fbf824c))
|
|
342
|
+
|
|
343
|
+
## [2.8.6](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.5...@availity/native-form@2.8.6) (2020-01-03)
|
|
344
|
+
|
|
345
|
+
**Note:** Version bump only for package @availity/native-form
|
|
346
|
+
|
|
347
|
+
## [2.8.5](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.4...@availity/native-form@2.8.5) (2020-01-03)
|
|
348
|
+
|
|
349
|
+
**Note:** Version bump only for package @availity/native-form
|
|
350
|
+
|
|
351
|
+
## [2.8.4](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.3...@availity/native-form@2.8.4) (2019-10-29)
|
|
352
|
+
|
|
353
|
+
**Note:** Version bump only for package @availity/native-form
|
|
354
|
+
|
|
355
|
+
## [2.8.3](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.2...@availity/native-form@2.8.3) (2019-09-27)
|
|
356
|
+
|
|
357
|
+
**Note:** Version bump only for package @availity/native-form
|
|
358
|
+
|
|
359
|
+
## [2.8.2](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.1...@availity/native-form@2.8.2) (2019-02-20)
|
|
360
|
+
|
|
361
|
+
### Bug Fixes
|
|
362
|
+
|
|
363
|
+
- append function is not defined for ie and edge mobile ([d995343](https://github.com/Availity/sdk-js/commit/d995343))
|
|
364
|
+
|
|
365
|
+
## [2.8.1](https://github.com/Availity/sdk-js/compare/@availity/native-form@2.8.0...@availity/native-form@2.8.1) (2019-02-12)
|
|
366
|
+
|
|
367
|
+
**Note:** Version bump only for package @availity/native-form
|
|
368
|
+
|
|
369
|
+
# 2.8.0 (2019-02-12)
|
|
370
|
+
|
|
371
|
+
# 2.5.0 (2018-08-20)
|
|
372
|
+
|
|
373
|
+
### Features
|
|
374
|
+
|
|
375
|
+
- **native-form:** add native form ([#62](https://github.com/Availity/sdk-js/issues/62)) ([8aa0471](https://github.com/Availity/sdk-js/commit/8aa0471))
|
|
376
|
+
|
|
377
|
+
<a name="2.7.0"></a>
|
|
378
|
+
|
|
379
|
+
# 2.7.0 (2018-11-20)
|
|
380
|
+
|
|
381
|
+
<a name="2.5.0"></a>
|
|
382
|
+
|
|
383
|
+
# 2.5.0 (2018-08-20)
|
|
384
|
+
|
|
385
|
+
### Features
|
|
386
|
+
|
|
387
|
+
- **native-form:** add native form ([#62](https://github.com/Availity/sdk-js/issues/62)) ([8aa0471](https://github.com/Availity/sdk-js/commit/8aa0471))
|
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @availity/native-form
|
|
2
|
+
|
|
3
|
+
> Submit JSON data via a native form, not AJAX. Useful when you need to open a new page with a POST action.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@availity/native-form)
|
|
6
|
+
[](https://www.npmjs.com/package/@availity/native-form)
|
|
7
|
+
[](https://github.com/Availity/sdk-js/blob/master/packages/native-form/package.json)
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
### NPM
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @availity/native-form
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Yarn
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
yarn add @availity/native-form
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Documentation
|
|
24
|
+
|
|
25
|
+
Check out more documentation at [availity.github.io](https://availity.github.io/sdk-js/resources/native-form)
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
type SsoType = 'saml' | 'openid';
|
|
4
|
+
|
|
5
|
+
declare function nativeForm(
|
|
6
|
+
spaceId: string,
|
|
7
|
+
params?: Record<string, any>,
|
|
8
|
+
formAttributes?: Record<string, any>,
|
|
9
|
+
type?: SsoType,
|
|
10
|
+
clientId?: string
|
|
11
|
+
): Promise<void>;
|
|
12
|
+
|
|
13
|
+
export { nativeForm as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
type SsoType = 'saml' | 'openid';
|
|
4
|
+
|
|
5
|
+
declare function nativeForm(
|
|
6
|
+
spaceId: string,
|
|
7
|
+
params?: Record<string, any>,
|
|
8
|
+
formAttributes?: Record<string, any>,
|
|
9
|
+
type?: SsoType,
|
|
10
|
+
clientId?: string
|
|
11
|
+
): Promise<void>;
|
|
12
|
+
|
|
13
|
+
export { nativeForm as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
var __export = (target, all) => {
|
|
21
|
+
for (var name in all)
|
|
22
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
23
|
+
};
|
|
24
|
+
var __copyProps = (to, from, except, desc) => {
|
|
25
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
26
|
+
for (let key of __getOwnPropNames(from))
|
|
27
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
28
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
29
|
+
}
|
|
30
|
+
return to;
|
|
31
|
+
};
|
|
32
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
|
+
var __async = (__this, __arguments, generator) => {
|
|
34
|
+
return new Promise((resolve, reject) => {
|
|
35
|
+
var fulfilled = (value) => {
|
|
36
|
+
try {
|
|
37
|
+
step(generator.next(value));
|
|
38
|
+
} catch (e) {
|
|
39
|
+
reject(e);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var rejected = (value) => {
|
|
43
|
+
try {
|
|
44
|
+
step(generator.throw(value));
|
|
45
|
+
} catch (e) {
|
|
46
|
+
reject(e);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
50
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// src/index.js
|
|
55
|
+
var src_exports = {};
|
|
56
|
+
__export(src_exports, {
|
|
57
|
+
default: () => src_default
|
|
58
|
+
});
|
|
59
|
+
module.exports = __toCommonJS(src_exports);
|
|
60
|
+
var import_api_axios = require("@availity/api-axios");
|
|
61
|
+
|
|
62
|
+
// src/flattenObject.js
|
|
63
|
+
var parseValue = (value) => value === void 0 || value === null ? value : value.toString();
|
|
64
|
+
var flattenObject = (ob) => Object.keys(ob).reduce((toReturn, k) => {
|
|
65
|
+
if (Object.prototype.toString.call(ob[k]) === "[object Date]") {
|
|
66
|
+
toReturn[k] = ob[k].toJSON();
|
|
67
|
+
} else if (ob[k] && typeof ob[k] === "object") {
|
|
68
|
+
const flatObject = flattenObject(ob[k]);
|
|
69
|
+
const isArray = Array.isArray(ob[k]);
|
|
70
|
+
for (const k2 of Object.keys(flatObject)) {
|
|
71
|
+
toReturn[`${k}${isArray ? k2.replace(/^(\d+)(\..*)?/, "[$1]$2") : `.${k2}`}`] = parseValue(flatObject[k2]);
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
toReturn[k] = parseValue(ob[k]);
|
|
75
|
+
}
|
|
76
|
+
return toReturn;
|
|
77
|
+
}, {});
|
|
78
|
+
var flattenObject_default = flattenObject;
|
|
79
|
+
|
|
80
|
+
// src/index.js
|
|
81
|
+
var ssoTypeQuery = `
|
|
82
|
+
query ssoTypeFindById($id: ID!){
|
|
83
|
+
configurationFindOne(id: $id){
|
|
84
|
+
...on Saml{
|
|
85
|
+
type
|
|
86
|
+
}
|
|
87
|
+
...on OpenId{
|
|
88
|
+
type
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
`;
|
|
93
|
+
var nativeForm = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (spaceId, params = {}, formAttributes = {}, type, clientId = "clientId") {
|
|
94
|
+
var _a, _b, _c;
|
|
95
|
+
if (!spaceId)
|
|
96
|
+
throw new Error("spaceId is required and was not provided");
|
|
97
|
+
let typeLower = type == null ? void 0 : type.toLowerCase();
|
|
98
|
+
if (typeLower !== "saml" && typeLower !== "openid") {
|
|
99
|
+
try {
|
|
100
|
+
const { data } = yield import_api_axios.avWebQLApi.create(
|
|
101
|
+
{
|
|
102
|
+
query: ssoTypeQuery,
|
|
103
|
+
variables: { id: spaceId },
|
|
104
|
+
operationName: "ssoTypeFindById"
|
|
105
|
+
},
|
|
106
|
+
{ headers: { "X-Client-ID": clientId } }
|
|
107
|
+
);
|
|
108
|
+
typeLower = (_c = (_b = (_a = data == null ? void 0 : data.data) == null ? void 0 : _a.configurationFindOne) == null ? void 0 : _b.type) == null ? void 0 : _c.toLowerCase();
|
|
109
|
+
} catch (error) {
|
|
110
|
+
if (error.response) {
|
|
111
|
+
throw new Error("The server responded with an error");
|
|
112
|
+
} else if (error.request) {
|
|
113
|
+
throw new Error("No response received");
|
|
114
|
+
} else {
|
|
115
|
+
throw new Error("An error occurred while setting up request, check your configurations");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const mergedOptions = __spreadValues({
|
|
120
|
+
method: "post",
|
|
121
|
+
action: `/ms/api/availity/internal/spc/magneto/sso/v1/${typeLower}/${spaceId}`,
|
|
122
|
+
target: "_blank"
|
|
123
|
+
}, formAttributes);
|
|
124
|
+
const form = document.createElement("form");
|
|
125
|
+
for (const key of Object.keys(mergedOptions)) {
|
|
126
|
+
form.setAttribute(key, mergedOptions[key]);
|
|
127
|
+
}
|
|
128
|
+
const flat = flattenObject_default(params);
|
|
129
|
+
const fields = Object.keys(flat).map((key) => {
|
|
130
|
+
const name = key.replace(/\[\d+]/g, "[]");
|
|
131
|
+
const value = flat[key];
|
|
132
|
+
return `<input type="hidden" name="${name}" value="${value}" />`;
|
|
133
|
+
}).join("");
|
|
134
|
+
form.insertAdjacentHTML("beforeend", fields);
|
|
135
|
+
document.body.appendChild(form);
|
|
136
|
+
form.submit();
|
|
137
|
+
});
|
|
138
|
+
var src_default = nativeForm;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
var __async = (__this, __arguments, generator) => {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
var fulfilled = (value) => {
|
|
20
|
+
try {
|
|
21
|
+
step(generator.next(value));
|
|
22
|
+
} catch (e) {
|
|
23
|
+
reject(e);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var rejected = (value) => {
|
|
27
|
+
try {
|
|
28
|
+
step(generator.throw(value));
|
|
29
|
+
} catch (e) {
|
|
30
|
+
reject(e);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
34
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/index.js
|
|
39
|
+
import { avWebQLApi } from "@availity/api-axios";
|
|
40
|
+
|
|
41
|
+
// src/flattenObject.js
|
|
42
|
+
var parseValue = (value) => value === void 0 || value === null ? value : value.toString();
|
|
43
|
+
var flattenObject = (ob) => Object.keys(ob).reduce((toReturn, k) => {
|
|
44
|
+
if (Object.prototype.toString.call(ob[k]) === "[object Date]") {
|
|
45
|
+
toReturn[k] = ob[k].toJSON();
|
|
46
|
+
} else if (ob[k] && typeof ob[k] === "object") {
|
|
47
|
+
const flatObject = flattenObject(ob[k]);
|
|
48
|
+
const isArray = Array.isArray(ob[k]);
|
|
49
|
+
for (const k2 of Object.keys(flatObject)) {
|
|
50
|
+
toReturn[`${k}${isArray ? k2.replace(/^(\d+)(\..*)?/, "[$1]$2") : `.${k2}`}`] = parseValue(flatObject[k2]);
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
toReturn[k] = parseValue(ob[k]);
|
|
54
|
+
}
|
|
55
|
+
return toReturn;
|
|
56
|
+
}, {});
|
|
57
|
+
var flattenObject_default = flattenObject;
|
|
58
|
+
|
|
59
|
+
// src/index.js
|
|
60
|
+
var ssoTypeQuery = `
|
|
61
|
+
query ssoTypeFindById($id: ID!){
|
|
62
|
+
configurationFindOne(id: $id){
|
|
63
|
+
...on Saml{
|
|
64
|
+
type
|
|
65
|
+
}
|
|
66
|
+
...on OpenId{
|
|
67
|
+
type
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
var nativeForm = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (spaceId, params = {}, formAttributes = {}, type, clientId = "clientId") {
|
|
73
|
+
var _a, _b, _c;
|
|
74
|
+
if (!spaceId)
|
|
75
|
+
throw new Error("spaceId is required and was not provided");
|
|
76
|
+
let typeLower = type == null ? void 0 : type.toLowerCase();
|
|
77
|
+
if (typeLower !== "saml" && typeLower !== "openid") {
|
|
78
|
+
try {
|
|
79
|
+
const { data } = yield avWebQLApi.create(
|
|
80
|
+
{
|
|
81
|
+
query: ssoTypeQuery,
|
|
82
|
+
variables: { id: spaceId },
|
|
83
|
+
operationName: "ssoTypeFindById"
|
|
84
|
+
},
|
|
85
|
+
{ headers: { "X-Client-ID": clientId } }
|
|
86
|
+
);
|
|
87
|
+
typeLower = (_c = (_b = (_a = data == null ? void 0 : data.data) == null ? void 0 : _a.configurationFindOne) == null ? void 0 : _b.type) == null ? void 0 : _c.toLowerCase();
|
|
88
|
+
} catch (error) {
|
|
89
|
+
if (error.response) {
|
|
90
|
+
throw new Error("The server responded with an error");
|
|
91
|
+
} else if (error.request) {
|
|
92
|
+
throw new Error("No response received");
|
|
93
|
+
} else {
|
|
94
|
+
throw new Error("An error occurred while setting up request, check your configurations");
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const mergedOptions = __spreadValues({
|
|
99
|
+
method: "post",
|
|
100
|
+
action: `/ms/api/availity/internal/spc/magneto/sso/v1/${typeLower}/${spaceId}`,
|
|
101
|
+
target: "_blank"
|
|
102
|
+
}, formAttributes);
|
|
103
|
+
const form = document.createElement("form");
|
|
104
|
+
for (const key of Object.keys(mergedOptions)) {
|
|
105
|
+
form.setAttribute(key, mergedOptions[key]);
|
|
106
|
+
}
|
|
107
|
+
const flat = flattenObject_default(params);
|
|
108
|
+
const fields = Object.keys(flat).map((key) => {
|
|
109
|
+
const name = key.replace(/\[\d+]/g, "[]");
|
|
110
|
+
const value = flat[key];
|
|
111
|
+
return `<input type="hidden" name="${name}" value="${value}" />`;
|
|
112
|
+
}).join("");
|
|
113
|
+
form.insertAdjacentHTML("beforeend", fields);
|
|
114
|
+
document.body.appendChild(form);
|
|
115
|
+
form.submit();
|
|
116
|
+
});
|
|
117
|
+
var src_default = nativeForm;
|
|
118
|
+
export {
|
|
119
|
+
src_default as default
|
|
120
|
+
};
|
package/jest.config.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@availity/native-form",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Submit JSON data via a native form, not AJAX. Useful when you need to open a new page with a POST action.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"availity",
|
|
7
|
+
"form",
|
|
8
|
+
"native",
|
|
9
|
+
"submission"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://availity.github.io/sdk-js/resources/native-form",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/availity/sdk-js/issues"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/availity/sdk-js.git",
|
|
18
|
+
"directory": "packages/native-form"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "Evan Sharp <evan.sharp@availity.com>",
|
|
22
|
+
"browser": "./dist/index.js",
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"module": "./dist/index.mjs",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsup src/index.js --format esm,cjs --dts",
|
|
28
|
+
"dev": "tsup src/index.js --format esm,cjs --watch --dts",
|
|
29
|
+
"lint": "eslint src",
|
|
30
|
+
"lint:fix": "eslint src --fix",
|
|
31
|
+
"clean": "rm -rf node_modules && rm -rf dist",
|
|
32
|
+
"bundlesize": "bundlesize",
|
|
33
|
+
"publish": "yarn npm publish --tolerate-republish --access public"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@availity/api-axios": "1.0.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"tsup": "^7.2.0",
|
|
40
|
+
"typescript": "^5.1.6"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/project.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": "packages/native-form",
|
|
3
|
+
"projectType": "library",
|
|
4
|
+
"targets": {
|
|
5
|
+
"test": {
|
|
6
|
+
"executor": "@nx/jest:jest",
|
|
7
|
+
"outputs": ["coverage/native-form"],
|
|
8
|
+
"options": {
|
|
9
|
+
"jestConfig": "packages/native-form/jest.config.js",
|
|
10
|
+
"passWithNoTests": true
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"version": {
|
|
14
|
+
"executor": "@jscutlery/semver:version",
|
|
15
|
+
"options": {
|
|
16
|
+
"preset": "angular",
|
|
17
|
+
"commitMessageFormat": "chore(${projectName}): release version ${version} [skip ci]",
|
|
18
|
+
"tagPrefix": "@availity/${projectName}@",
|
|
19
|
+
"baseBranch": "master"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"lint": {
|
|
23
|
+
"executor": "@nx/linter:eslint",
|
|
24
|
+
"options": {
|
|
25
|
+
"eslintConfig": ".eslintrc.yaml",
|
|
26
|
+
"lintFilePatterns": ["packages/native-form/**/*.{js,ts}"],
|
|
27
|
+
"silent": false,
|
|
28
|
+
"fix": false,
|
|
29
|
+
"cache": true,
|
|
30
|
+
"cacheLocation": "./node_modules/.cache/native-form/.eslintcache",
|
|
31
|
+
"maxWarnings": -1,
|
|
32
|
+
"quiet": false,
|
|
33
|
+
"noEslintrc": false,
|
|
34
|
+
"hasTypeAwareRules": true,
|
|
35
|
+
"cacheStrategy": "metadata"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copied from https://github.com/Availity/sdk-js/blob/master/packages/native-form/flattenObject.js
|
|
2
|
+
const parseValue = (value) => (value === undefined || value === null ? value : value.toString());
|
|
3
|
+
|
|
4
|
+
const flattenObject = (ob) =>
|
|
5
|
+
Object.keys(ob).reduce((toReturn, k) => {
|
|
6
|
+
if (Object.prototype.toString.call(ob[k]) === '[object Date]') {
|
|
7
|
+
toReturn[k] = ob[k].toJSON();
|
|
8
|
+
} else if (ob[k] && typeof ob[k] === 'object') {
|
|
9
|
+
const flatObject = flattenObject(ob[k]);
|
|
10
|
+
const isArray = Array.isArray(ob[k]);
|
|
11
|
+
|
|
12
|
+
for (const k2 of Object.keys(flatObject)) {
|
|
13
|
+
toReturn[`${k}${isArray ? k2.replace(/^(\d+)(\..*)?/, '[$1]$2') : `.${k2}`}`] = parseValue(flatObject[k2]);
|
|
14
|
+
}
|
|
15
|
+
} else {
|
|
16
|
+
toReturn[k] = parseValue(ob[k]);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return toReturn;
|
|
20
|
+
}, {});
|
|
21
|
+
|
|
22
|
+
export default flattenObject;
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
type SsoType = 'saml' | 'openid';
|
|
4
|
+
|
|
5
|
+
declare function nativeForm(
|
|
6
|
+
spaceId: string,
|
|
7
|
+
params?: Record<string, any>,
|
|
8
|
+
formAttributes?: Record<string, any>,
|
|
9
|
+
type?: SsoType,
|
|
10
|
+
clientId?: string
|
|
11
|
+
): Promise<void>;
|
|
12
|
+
|
|
13
|
+
export default nativeForm;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { avWebQLApi } from '@availity/api-axios';
|
|
2
|
+
|
|
3
|
+
import flattenObject from './flattenObject';
|
|
4
|
+
|
|
5
|
+
const ssoTypeQuery = `
|
|
6
|
+
query ssoTypeFindById($id: ID!){
|
|
7
|
+
configurationFindOne(id: $id){
|
|
8
|
+
...on Saml{
|
|
9
|
+
type
|
|
10
|
+
}
|
|
11
|
+
...on OpenId{
|
|
12
|
+
type
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
const nativeForm = async (spaceId, params = {}, formAttributes = {}, type, clientId = 'clientId') => {
|
|
19
|
+
if (!spaceId) throw new Error('spaceId is required and was not provided');
|
|
20
|
+
|
|
21
|
+
let typeLower = type?.toLowerCase();
|
|
22
|
+
if (typeLower !== 'saml' && typeLower !== 'openid') {
|
|
23
|
+
try {
|
|
24
|
+
const { data } = await avWebQLApi.create(
|
|
25
|
+
{
|
|
26
|
+
query: ssoTypeQuery,
|
|
27
|
+
variables: { id: spaceId },
|
|
28
|
+
operationName: 'ssoTypeFindById',
|
|
29
|
+
},
|
|
30
|
+
{ headers: { 'X-Client-ID': clientId } }
|
|
31
|
+
);
|
|
32
|
+
typeLower = data?.data?.configurationFindOne?.type?.toLowerCase();
|
|
33
|
+
} catch (error) {
|
|
34
|
+
// https://github.com/axios/axios#handling-errors
|
|
35
|
+
if (error.response) {
|
|
36
|
+
// The request was made and the server responded with a status code
|
|
37
|
+
// that falls out of the range of 2xx
|
|
38
|
+
throw new Error('The server responded with an error');
|
|
39
|
+
} else if (error.request) {
|
|
40
|
+
// The request was made but no response was received
|
|
41
|
+
// `error.request` is an instance of XMLHttpRequest in the browser
|
|
42
|
+
throw new Error('No response received');
|
|
43
|
+
} else {
|
|
44
|
+
// Something happened in setting up the request that triggered an Error
|
|
45
|
+
throw new Error('An error occurred while setting up request, check your configurations');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const mergedOptions = {
|
|
51
|
+
method: 'post',
|
|
52
|
+
action: `/ms/api/availity/internal/spc/magneto/sso/v1/${typeLower}/${spaceId}`,
|
|
53
|
+
target: '_blank',
|
|
54
|
+
...formAttributes,
|
|
55
|
+
};
|
|
56
|
+
const form = document.createElement('form');
|
|
57
|
+
for (const key of Object.keys(mergedOptions)) {
|
|
58
|
+
form.setAttribute(key, mergedOptions[key]);
|
|
59
|
+
}
|
|
60
|
+
const flat = flattenObject(params);
|
|
61
|
+
const fields = Object.keys(flat)
|
|
62
|
+
.map((key) => {
|
|
63
|
+
const name = key.replace(/\[\d+]/g, '[]');
|
|
64
|
+
const value = flat[key];
|
|
65
|
+
return `<input type="hidden" name="${name}" value="${value}" />`;
|
|
66
|
+
})
|
|
67
|
+
.join('');
|
|
68
|
+
|
|
69
|
+
form.insertAdjacentHTML('beforeend', fields);
|
|
70
|
+
document.body.appendChild(form);
|
|
71
|
+
form.submit();
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default nativeForm;
|
package/tsconfig.json
ADDED