@panneau/form-auth 4.0.2 → 4.0.5

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.
Files changed (2) hide show
  1. package/es/index.js +107 -92
  2. package/package.json +5 -5
package/es/index.js CHANGED
@@ -1,6 +1,8 @@
1
+ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
1
2
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
2
3
  import { FormattedMessage } from 'react-intl';
3
4
  import Form from '@panneau/form';
5
+ import { jsx } from 'react/jsx-runtime';
4
6
  import Link from '@panneau/element-link';
5
7
  import { postJSON, getCSRFHeaders } from '@folklore/fetch';
6
8
  import { useCallback } from 'react';
@@ -22,14 +24,14 @@ function ChangePassword(_ref) {
22
24
  _ref$submitButtonLabe = _ref.submitButtonLabel,
23
25
  submitButtonLabel = _ref$submitButtonLabe === void 0 ? null : _ref$submitButtonLabe,
24
26
  props = _objectWithoutProperties(_ref, _excluded$8);
25
- return /*#__PURE__*/React.createElement(Form, Object.assign({
27
+ return /*#__PURE__*/jsx(Form, _objectSpread({
26
28
  action: action,
27
29
  method: "PUT",
28
30
  fields: fields || [{
29
31
  name: 'current_password',
30
32
  type: 'password',
31
33
  size: size,
32
- label: currentPasswordLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
34
+ label: currentPasswordLabel || /*#__PURE__*/jsx(FormattedMessage, {
33
35
  id: "8LSb8C",
34
36
  defaultMessage: [{
35
37
  "type": 0,
@@ -40,7 +42,7 @@ function ChangePassword(_ref) {
40
42
  name: 'password',
41
43
  type: 'password',
42
44
  size: size,
43
- label: passwordLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
45
+ label: passwordLabel || /*#__PURE__*/jsx(FormattedMessage, {
44
46
  id: "XJ1dc3",
45
47
  defaultMessage: [{
46
48
  "type": 0,
@@ -51,7 +53,7 @@ function ChangePassword(_ref) {
51
53
  name: 'password_confirmation',
52
54
  type: 'password',
53
55
  size: size,
54
- label: passwordConfirmationLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
56
+ label: passwordConfirmationLabel || /*#__PURE__*/jsx(FormattedMessage, {
55
57
  id: "DUbv+u",
56
58
  defaultMessage: [{
57
59
  "type": 0,
@@ -59,7 +61,7 @@ function ChangePassword(_ref) {
59
61
  }]
60
62
  })
61
63
  }],
62
- submitButtonLabel: submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
64
+ submitButtonLabel: submitButtonLabel || /*#__PURE__*/jsx(FormattedMessage, {
63
65
  id: "XW9IKQ",
64
66
  defaultMessage: [{
65
67
  "type": 0,
@@ -82,13 +84,13 @@ function ConfirmPassword(_ref) {
82
84
  _ref$submitButtonLabe = _ref.submitButtonLabel,
83
85
  submitButtonLabel = _ref$submitButtonLabe === void 0 ? null : _ref$submitButtonLabe,
84
86
  props = _objectWithoutProperties(_ref, _excluded$7);
85
- return /*#__PURE__*/React.createElement(Form, Object.assign({
87
+ return /*#__PURE__*/jsx(Form, _objectSpread({
86
88
  action: action,
87
89
  fields: fields || [{
88
90
  name: 'password',
89
91
  type: 'password',
90
92
  size: size,
91
- label: passwordLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
93
+ label: passwordLabel || /*#__PURE__*/jsx(FormattedMessage, {
92
94
  id: "B1h3gd",
93
95
  defaultMessage: [{
94
96
  "type": 0,
@@ -96,7 +98,7 @@ function ConfirmPassword(_ref) {
96
98
  }]
97
99
  })
98
100
  }],
99
- submitButtonLabel: submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
101
+ submitButtonLabel: submitButtonLabel || /*#__PURE__*/jsx(FormattedMessage, {
100
102
  id: "QUAHwy",
101
103
  defaultMessage: [{
102
104
  "type": 0,
@@ -125,13 +127,13 @@ function ForgotPassword(_ref) {
125
127
  _ref$loginLabel = _ref.loginLabel,
126
128
  loginLabel = _ref$loginLabel === void 0 ? null : _ref$loginLabel,
127
129
  props = _objectWithoutProperties(_ref, _excluded$6);
128
- return /*#__PURE__*/React.createElement(Form, Object.assign({
130
+ return /*#__PURE__*/jsx(Form, _objectSpread({
129
131
  action: action,
130
132
  fields: fields || [{
131
133
  name: 'email',
132
134
  type: 'email',
133
135
  size: size,
134
- label: emailLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
136
+ label: emailLabel || /*#__PURE__*/jsx(FormattedMessage, {
135
137
  id: "LI0Gz4",
136
138
  defaultMessage: [{
137
139
  "type": 0,
@@ -139,23 +141,24 @@ function ForgotPassword(_ref) {
139
141
  }]
140
142
  })
141
143
  }],
142
- submitButtonLabel: submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
144
+ submitButtonLabel: submitButtonLabel || /*#__PURE__*/jsx(FormattedMessage, {
143
145
  id: "12Px0g",
144
146
  defaultMessage: [{
145
147
  "type": 0,
146
148
  "value": "Send reset link"
147
149
  }]
148
150
  }),
149
- actions: withLoginLink ? /*#__PURE__*/React.createElement(Link, {
151
+ actions: withLoginLink ? /*#__PURE__*/jsx(Link, {
150
152
  href: loginLink,
151
- className: "py-2 px-4"
152
- }, loginLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
153
- id: "tPeIKO",
154
- defaultMessage: [{
155
- "type": 0,
156
- "value": "Go back to login"
157
- }]
158
- })) : null
153
+ className: "py-2 px-4",
154
+ children: loginLabel || /*#__PURE__*/jsx(FormattedMessage, {
155
+ id: "tPeIKO",
156
+ defaultMessage: [{
157
+ "type": 0,
158
+ "value": "Go back to login"
159
+ }]
160
+ })
161
+ }) : null
159
162
  }, props));
160
163
  }
161
164
 
@@ -182,14 +185,14 @@ function Login(_ref) {
182
185
  _ref$forgotPasswordLa = _ref.forgotPasswordLabel,
183
186
  forgotPasswordLabel = _ref$forgotPasswordLa === void 0 ? null : _ref$forgotPasswordLa,
184
187
  props = _objectWithoutProperties(_ref, _excluded$5);
185
- return /*#__PURE__*/React.createElement(Form, Object.assign({
188
+ return /*#__PURE__*/jsx(Form, _objectSpread({
186
189
  action: action,
187
190
  postForm: postForm,
188
191
  fields: fields || [{
189
192
  name: 'email',
190
193
  type: 'email',
191
194
  size: size,
192
- label: emailLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
195
+ label: emailLabel || /*#__PURE__*/jsx(FormattedMessage, {
193
196
  id: "LI0Gz4",
194
197
  defaultMessage: [{
195
198
  "type": 0,
@@ -200,7 +203,7 @@ function Login(_ref) {
200
203
  name: 'password',
201
204
  type: 'password',
202
205
  size: size,
203
- label: passwordLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
206
+ label: passwordLabel || /*#__PURE__*/jsx(FormattedMessage, {
204
207
  id: "4yfet+",
205
208
  defaultMessage: [{
206
209
  "type": 0,
@@ -208,23 +211,24 @@ function Login(_ref) {
208
211
  }]
209
212
  })
210
213
  }],
211
- submitButtonLabel: submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
214
+ submitButtonLabel: submitButtonLabel || /*#__PURE__*/jsx(FormattedMessage, {
212
215
  id: "g6qbbX",
213
216
  defaultMessage: [{
214
217
  "type": 0,
215
218
  "value": "Log in"
216
219
  }]
217
220
  }),
218
- actions: withForgotPassword ? /*#__PURE__*/React.createElement(Link, {
221
+ actions: withForgotPassword ? /*#__PURE__*/jsx(Link, {
219
222
  href: forgotPasswordLink,
220
- className: "py-2 px-4"
221
- }, forgotPasswordLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
222
- id: "ZBNqY2",
223
- defaultMessage: [{
224
- "type": 0,
225
- "value": "Forgot your password?"
226
- }]
227
- })) : null
223
+ className: "py-2 px-4",
224
+ children: forgotPasswordLabel || /*#__PURE__*/jsx(FormattedMessage, {
225
+ id: "ZBNqY2",
226
+ defaultMessage: [{
227
+ "type": 0,
228
+ "value": "Forgot your password?"
229
+ }]
230
+ })
231
+ }) : null
228
232
  }, props));
229
233
  }
230
234
 
@@ -253,13 +257,13 @@ function Register(_ref) {
253
257
  _ref$loginLabel = _ref.loginLabel,
254
258
  loginLabel = _ref$loginLabel === void 0 ? null : _ref$loginLabel,
255
259
  props = _objectWithoutProperties(_ref, _excluded$4);
256
- return /*#__PURE__*/React.createElement(Form, Object.assign({
260
+ return /*#__PURE__*/jsx(Form, _objectSpread({
257
261
  action: action,
258
262
  fields: fields || [{
259
263
  name: 'name',
260
264
  type: 'text',
261
265
  size: size,
262
- label: nameLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
266
+ label: nameLabel || /*#__PURE__*/jsx(FormattedMessage, {
263
267
  id: "UUv8FR",
264
268
  defaultMessage: [{
265
269
  "type": 0,
@@ -270,7 +274,7 @@ function Register(_ref) {
270
274
  name: 'email',
271
275
  type: 'email',
272
276
  size: size,
273
- label: emailLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
277
+ label: emailLabel || /*#__PURE__*/jsx(FormattedMessage, {
274
278
  id: "LI0Gz4",
275
279
  defaultMessage: [{
276
280
  "type": 0,
@@ -281,7 +285,7 @@ function Register(_ref) {
281
285
  name: 'password',
282
286
  type: 'password',
283
287
  size: size,
284
- label: passwordLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
288
+ label: passwordLabel || /*#__PURE__*/jsx(FormattedMessage, {
285
289
  id: "4yfet+",
286
290
  defaultMessage: [{
287
291
  "type": 0,
@@ -292,7 +296,7 @@ function Register(_ref) {
292
296
  name: 'password_confirmation',
293
297
  type: 'password',
294
298
  size: size,
295
- label: passwordConfirmationLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
299
+ label: passwordConfirmationLabel || /*#__PURE__*/jsx(FormattedMessage, {
296
300
  id: "VhJUeW",
297
301
  defaultMessage: [{
298
302
  "type": 0,
@@ -300,23 +304,24 @@ function Register(_ref) {
300
304
  }]
301
305
  })
302
306
  }],
303
- submitButtonLabel: submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
307
+ submitButtonLabel: submitButtonLabel || /*#__PURE__*/jsx(FormattedMessage, {
304
308
  id: "PQX/ph",
305
309
  defaultMessage: [{
306
310
  "type": 0,
307
311
  "value": "Create account"
308
312
  }]
309
313
  }),
310
- actions: withLoginLink ? /*#__PURE__*/React.createElement(Link, {
314
+ actions: withLoginLink ? /*#__PURE__*/jsx(Link, {
311
315
  href: loginLink,
312
- className: "py-2 px-4"
313
- }, loginLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
314
- id: "wa783M",
315
- defaultMessage: [{
316
- "type": 0,
317
- "value": "Already have an account? Go to login"
318
- }]
319
- })) : null
316
+ className: "py-2 px-4",
317
+ children: loginLabel || /*#__PURE__*/jsx(FormattedMessage, {
318
+ id: "wa783M",
319
+ defaultMessage: [{
320
+ "type": 0,
321
+ "value": "Already have an account? Go to login"
322
+ }]
323
+ })
324
+ }) : null
320
325
  }, props));
321
326
  }
322
327
 
@@ -337,13 +342,13 @@ function ResetPassword(_ref) {
337
342
  _ref$submitButtonLabe = _ref.submitButtonLabel,
338
343
  submitButtonLabel = _ref$submitButtonLabe === void 0 ? null : _ref$submitButtonLabe,
339
344
  props = _objectWithoutProperties(_ref, _excluded$3);
340
- return /*#__PURE__*/React.createElement(Form, Object.assign({
345
+ return /*#__PURE__*/jsx(Form, _objectSpread({
341
346
  action: action,
342
347
  fields: fields || [{
343
348
  name: 'email',
344
349
  type: 'email',
345
350
  size: size,
346
- label: emailLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
351
+ label: emailLabel || /*#__PURE__*/jsx(FormattedMessage, {
347
352
  id: "LI0Gz4",
348
353
  defaultMessage: [{
349
354
  "type": 0,
@@ -355,7 +360,7 @@ function ResetPassword(_ref) {
355
360
  name: 'password',
356
361
  type: 'password',
357
362
  size: size,
358
- label: passwordLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
363
+ label: passwordLabel || /*#__PURE__*/jsx(FormattedMessage, {
359
364
  id: "4yfet+",
360
365
  defaultMessage: [{
361
366
  "type": 0,
@@ -366,7 +371,7 @@ function ResetPassword(_ref) {
366
371
  name: 'password_confirmation',
367
372
  type: 'password',
368
373
  size: size,
369
- label: passwordConfirmationLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
374
+ label: passwordConfirmationLabel || /*#__PURE__*/jsx(FormattedMessage, {
370
375
  id: "VhJUeW",
371
376
  defaultMessage: [{
372
377
  "type": 0,
@@ -374,7 +379,7 @@ function ResetPassword(_ref) {
374
379
  }]
375
380
  })
376
381
  }],
377
- submitButtonLabel: submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
382
+ submitButtonLabel: submitButtonLabel || /*#__PURE__*/jsx(FormattedMessage, {
378
383
  id: "zwks3g",
379
384
  defaultMessage: [{
380
385
  "type": 0,
@@ -397,13 +402,13 @@ function TwoFactorChallenge(_ref) {
397
402
  _ref$submitButtonLabe = _ref.submitButtonLabel,
398
403
  submitButtonLabel = _ref$submitButtonLabe === void 0 ? null : _ref$submitButtonLabe,
399
404
  props = _objectWithoutProperties(_ref, _excluded$2);
400
- return /*#__PURE__*/React.createElement(Form, Object.assign({
405
+ return /*#__PURE__*/jsx(Form, _objectSpread({
401
406
  action: action,
402
407
  fields: fields || [{
403
408
  name: 'code',
404
409
  type: 'text',
405
410
  size: size,
406
- label: codeLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
411
+ label: codeLabel || /*#__PURE__*/jsx(FormattedMessage, {
407
412
  id: "22Ld5M",
408
413
  defaultMessage: [{
409
414
  "type": 0,
@@ -411,7 +416,7 @@ function TwoFactorChallenge(_ref) {
411
416
  }]
412
417
  })
413
418
  }],
414
- submitButtonLabel: submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
419
+ submitButtonLabel: submitButtonLabel || /*#__PURE__*/jsx(FormattedMessage, {
415
420
  id: "QUAHwy",
416
421
  defaultMessage: [{
417
422
  "type": 0,
@@ -445,33 +450,38 @@ function TwoFactorDisable(_ref) {
445
450
  method: 'DELETE'
446
451
  });
447
452
  }, []);
448
- return /*#__PURE__*/React.createElement(Form, Object.assign({
453
+ return /*#__PURE__*/jsx(Form, _objectSpread(_objectSpread({
449
454
  action: action,
450
- submitButtonLabel: submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
455
+ submitButtonLabel: submitButtonLabel || /*#__PURE__*/jsx(FormattedMessage, {
451
456
  id: "gWmL5V",
452
457
  defaultMessage: [{
453
458
  "type": 0,
454
459
  "value": "Disable two factor authentication"
455
460
  }]
456
461
  }),
457
- actions: withCancelLink ? /*#__PURE__*/React.createElement(Link, {
462
+ actions: withCancelLink ? /*#__PURE__*/jsx(Link, {
458
463
  className: "py-2 px-4",
459
- href: cancelLink
460
- }, cancelLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
461
- id: "U/ye2x",
462
- defaultMessage: [{
463
- "type": 0,
464
- "value": "Cancel"
465
- }]
466
- })) : null,
464
+ href: cancelLink,
465
+ children: cancelLabel || /*#__PURE__*/jsx(FormattedMessage, {
466
+ id: "U/ye2x",
467
+ defaultMessage: [{
468
+ "type": 0,
469
+ "value": "Cancel"
470
+ }]
471
+ })
472
+ }) : null,
467
473
  postForm: defaultPostForm
468
- }, props), /*#__PURE__*/React.createElement("p", null, explainationLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
469
- id: "5nHK/H",
470
- defaultMessage: [{
471
- "type": 0,
472
- "value": "Do you really wish to disable two factor authentication on your account?"
473
- }]
474
- })));
474
+ }, props), {}, {
475
+ children: /*#__PURE__*/jsx("p", {
476
+ children: explainationLabel || /*#__PURE__*/jsx(FormattedMessage, {
477
+ id: "5nHK/H",
478
+ defaultMessage: [{
479
+ "type": 0,
480
+ "value": "Do you really wish to disable two factor authentication on your account?"
481
+ }]
482
+ })
483
+ })
484
+ }));
475
485
  }
476
486
 
477
487
  var _excluded = ["action", "fields", "explainationLabel", "submitButtonLabel", "size", "withSkipLink", "skipLink", "skipLabel"];
@@ -491,32 +501,37 @@ function TwoFactorEnable(_ref) {
491
501
  _ref$skipLabel = _ref.skipLabel,
492
502
  skipLabel = _ref$skipLabel === void 0 ? null : _ref$skipLabel,
493
503
  props = _objectWithoutProperties(_ref, _excluded);
494
- return /*#__PURE__*/React.createElement(Form, Object.assign({
504
+ return /*#__PURE__*/jsx(Form, _objectSpread(_objectSpread({
495
505
  action: action,
496
- submitButtonLabel: submitButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
506
+ submitButtonLabel: submitButtonLabel || /*#__PURE__*/jsx(FormattedMessage, {
497
507
  id: "pVHYDd",
498
508
  defaultMessage: [{
499
509
  "type": 0,
500
510
  "value": "Enable two factor authentication"
501
511
  }]
502
512
  }),
503
- actions: withSkipLink ? /*#__PURE__*/React.createElement(Link, {
513
+ actions: withSkipLink ? /*#__PURE__*/jsx(Link, {
504
514
  className: "py-2 px-4",
505
- href: skipLink
506
- }, skipLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
507
- id: "li2Qqu",
508
- defaultMessage: [{
509
- "type": 0,
510
- "value": "Skip setup"
511
- }]
512
- })) : null
513
- }, props), /*#__PURE__*/React.createElement("p", null, explainationLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
514
- id: "zTiC4D",
515
- defaultMessage: [{
516
- "type": 0,
517
- "value": "Do you wish to enable two factor authentication on your account? You will have to use an authentication app such as Google Authenticator or Microsoft Authenticator in addition to your password to connect."
518
- }]
519
- })));
515
+ href: skipLink,
516
+ children: skipLabel || /*#__PURE__*/jsx(FormattedMessage, {
517
+ id: "li2Qqu",
518
+ defaultMessage: [{
519
+ "type": 0,
520
+ "value": "Skip setup"
521
+ }]
522
+ })
523
+ }) : null
524
+ }, props), {}, {
525
+ children: /*#__PURE__*/jsx("p", {
526
+ children: explainationLabel || /*#__PURE__*/jsx(FormattedMessage, {
527
+ id: "zTiC4D",
528
+ defaultMessage: [{
529
+ "type": 0,
530
+ "value": "Do you wish to enable two factor authentication on your account? You will have to use an authentication app such as Google Authenticator or Microsoft Authenticator in addition to your password to connect."
531
+ }]
532
+ })
533
+ })
534
+ }));
520
535
  }
521
536
 
522
537
  export { ChangePassword, ConfirmPassword, ForgotPassword, Login, Register, ResetPassword, TwoFactorChallenge, TwoFactorDisable, TwoFactorEnable };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/form-auth",
3
- "version": "4.0.2",
3
+ "version": "4.0.5",
4
4
  "description": "Basic forgot password form",
5
5
  "keywords": [
6
6
  "javascript"
@@ -50,9 +50,9 @@
50
50
  "dependencies": {
51
51
  "@babel/runtime": "^7.12.5",
52
52
  "@folklore/fetch": "^0.1.21",
53
- "@panneau/core": "^4.0.2",
54
- "@panneau/element-link": "^4.0.2",
55
- "@panneau/form": "^4.0.2",
53
+ "@panneau/core": "^4.0.5",
54
+ "@panneau/element-link": "^4.0.5",
55
+ "@panneau/form": "^4.0.5",
56
56
  "classnames": "^2.5.1",
57
57
  "lodash-es": "^4.17.21",
58
58
  "prop-types": "^15.7.2",
@@ -61,5 +61,5 @@
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "53ad0f27e467992c23158732e0f7d39d8615780b"
64
+ "gitHead": "ac8b065e8c7ada1d176d15eff1c0fa53599ad31f"
65
65
  }