@arquimedes.co/eureka-forms 3.0.67 → 3.0.68-test

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 (143) hide show
  1. package/README +1 -33
  2. package/dist/@Types/FormStep.d.ts +2 -7
  3. package/dist/@Types/FormStep.js +1 -2
  4. package/dist/App/App.stories.d.ts +0 -10
  5. package/dist/App/App.stories.js +0 -189
  6. package/dist/App/AppHooks.js +0 -8
  7. package/dist/App/AppHooks.test.js +0 -8
  8. package/dist/Form/Form.js +6 -7
  9. package/dist/Form/FormFunctions.d.ts +0 -17
  10. package/dist/Form/FormFunctions.js +0 -22
  11. package/dist/Form/FormFunctions.test.js +1 -28
  12. package/dist/FormSteps/CheckBoxStep/CheckBoxStep.mobileLabel.test.js +12 -20
  13. package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +13 -6
  14. package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.module.css +13 -2
  15. package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +1 -3
  16. package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +26 -26
  17. package/dist/FormSteps/Step.js +0 -16
  18. package/dist/FormSteps/StepFunctions.js +0 -14
  19. package/dist/FormSteps/StepFunctions.test.js +0 -54
  20. package/dist/FormSteps/StepHooks.d.ts +0 -21
  21. package/dist/FormSteps/StepHooks.js +8 -55
  22. package/dist/Shared/ErkDatePicker/ErkDatePicker.js +12 -4
  23. package/dist/Shared/ErkDatePicker/ErkDatePicker.locale.test.js +39 -0
  24. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.d.ts +3 -2
  25. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.js +16 -11
  26. package/dist/Shared/ErkSelect/ErkSelect.js +9 -1
  27. package/dist/Shared/ErkSelect/ErkSelect.test.d.ts +2 -0
  28. package/dist/Shared/ErkSelect/ErkSelect.test.js +53 -0
  29. package/dist/Shared/ErkTimePicker/ErkTimePicker.js +8 -1
  30. package/dist/Shared/ErkTimePicker/ErkTimePicker.test.d.ts +2 -0
  31. package/dist/Shared/ErkTimePicker/ErkTimePicker.test.js +24 -0
  32. package/dist/Utils/AxiosWidget.js +1 -9
  33. package/dist/Utils/LocaleUtils.d.ts +1 -0
  34. package/dist/Utils/LocaleUtils.js +10 -3
  35. package/dist/constants/FormStepTypes.d.ts +1 -5
  36. package/dist/constants/FormStepTypes.js +0 -4
  37. package/dist/index.lib.d.ts +2 -4
  38. package/dist/index.lib.js +1 -3
  39. package/package.json +1 -2
  40. package/dist/@Types/AvailabilityFormStep.d.ts +0 -48
  41. package/dist/@Types/AvailabilityFormStep.js +0 -24
  42. package/dist/@Types/BankAccountFormStep.d.ts +0 -67
  43. package/dist/@Types/BankAccountFormStep.js +0 -14
  44. package/dist/@Types/BookingFormStep.d.ts +0 -187
  45. package/dist/@Types/BookingFormStep.js +0 -44
  46. package/dist/@Types/CalendarFormStep.d.ts +0 -209
  47. package/dist/@Types/CalendarFormStep.js +0 -55
  48. package/dist/@Types/CommunicationChannelFormStep.d.ts +0 -51
  49. package/dist/@Types/CommunicationChannelFormStep.js +0 -15
  50. package/dist/@Types/ConsentFormStep.d.ts +0 -36
  51. package/dist/@Types/ConsentFormStep.js +0 -8
  52. package/dist/@Types/EntityFormFormStep.d.ts +0 -66
  53. package/dist/@Types/EntityFormFormStep.js +0 -20
  54. package/dist/@Types/EventFormStep.d.ts +0 -52
  55. package/dist/@Types/EventFormStep.js +0 -13
  56. package/dist/@Types/ExternalReferenceFormStep.d.ts +0 -74
  57. package/dist/@Types/ExternalReferenceFormStep.js +0 -20
  58. package/dist/@Types/LocationFormStep.d.ts +0 -159
  59. package/dist/@Types/LocationFormStep.js +0 -46
  60. package/dist/@Types/NumericFormSteps.d.ts +0 -108
  61. package/dist/@Types/NumericFormSteps.js +0 -20
  62. package/dist/@Types/PredefinedSelectorFormStep.d.ts +0 -51
  63. package/dist/@Types/PredefinedSelectorFormStep.js +0 -39
  64. package/dist/@Types/StepRef.d.ts +0 -135
  65. package/dist/@Types/StepRef.js +0 -49
  66. package/dist/FormSteps/AvailabilityStep/AvailabilityStep.d.ts +0 -7
  67. package/dist/FormSteps/AvailabilityStep/AvailabilityStep.js +0 -14
  68. package/dist/FormSteps/AvailabilityStep/MaterialAvailabilityStep/MaterialAvailabilityStep.d.ts +0 -8
  69. package/dist/FormSteps/AvailabilityStep/MaterialAvailabilityStep/MaterialAvailabilityStep.js +0 -32
  70. package/dist/FormSteps/BookingStep/BookingStep.d.ts +0 -17
  71. package/dist/FormSteps/BookingStep/BookingStep.js +0 -14
  72. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.d.ts +0 -7
  73. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.js +0 -32
  74. package/dist/FormSteps/ClassifierSelectorStep/ClassifierSelectorStep.lateClassifiers.test.js +0 -70
  75. package/dist/FormSteps/EntityValueStep/entityValueDependencyValue.d.ts +0 -12
  76. package/dist/FormSteps/EntityValueStep/entityValueDependencyValue.js +0 -35
  77. package/dist/FormSteps/EntityValueStep/entityValueDependencyValue.test.d.ts +0 -1
  78. package/dist/FormSteps/EntityValueStep/entityValueDependencyValue.test.js +0 -31
  79. package/dist/FormSteps/EntityValueStep/entityValuePickerWatchedSteps.d.ts +0 -27
  80. package/dist/FormSteps/EntityValueStep/entityValuePickerWatchedSteps.js +0 -64
  81. package/dist/FormSteps/EntityValueStep/entityValuePickerWatchedSteps.test.d.ts +0 -1
  82. package/dist/FormSteps/EntityValueStep/entityValuePickerWatchedSteps.test.js +0 -95
  83. package/dist/FormSteps/LocationStep/LocationStep.d.ts +0 -10
  84. package/dist/FormSteps/LocationStep/LocationStep.js +0 -14
  85. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.d.ts +0 -3
  86. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.js +0 -54
  87. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.module.css +0 -18
  88. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.d.ts +0 -3
  89. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.js +0 -170
  90. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.module.css +0 -96
  91. package/dist/FormSteps/NumberStep/NumberStep.d.ts +0 -10
  92. package/dist/FormSteps/NumberStep/NumberStep.js +0 -14
  93. package/dist/FormSteps/StepHooks.test.d.ts +0 -1
  94. package/dist/FormSteps/StepHooks.test.js +0 -92
  95. package/dist/FormSteps/isStepHiddenByCondition.test.d.ts +0 -1
  96. package/dist/FormSteps/isStepHiddenByCondition.test.js +0 -42
  97. package/dist/Icons/AddIcon.d.ts +0 -3
  98. package/dist/Icons/AddIcon.js +0 -7
  99. package/dist/Icons/EditIcon.d.ts +0 -3
  100. package/dist/Icons/EditIcon.js +0 -7
  101. package/dist/Icons/RemoveIcon.d.ts +0 -3
  102. package/dist/Icons/RemoveIcon.js +0 -7
  103. package/dist/Icons/ViewDayIcon.d.ts +0 -3
  104. package/dist/Icons/ViewDayIcon.js +0 -7
  105. package/dist/Icons/ViewWeekIcon.d.ts +0 -3
  106. package/dist/Icons/ViewWeekIcon.js +0 -7
  107. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.d.ts +0 -19
  108. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.js +0 -80
  109. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.module.css +0 -88
  110. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.d.ts +0 -29
  111. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.js +0 -139
  112. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.d.ts +0 -25
  113. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.js +0 -112
  114. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.module.css +0 -88
  115. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.test.d.ts +0 -1
  116. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.test.js +0 -73
  117. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.d.ts +0 -31
  118. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.js +0 -228
  119. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.module.css +0 -608
  120. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.d.ts +0 -28
  121. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.js +0 -117
  122. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.test.d.ts +0 -1
  123. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.test.js +0 -49
  124. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.test.d.ts +0 -1
  125. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.test.js +0 -107
  126. package/dist/Shared/ErkIconButton/ErkIconButton.d.ts +0 -17
  127. package/dist/Shared/ErkIconButton/ErkIconButton.js +0 -11
  128. package/dist/Shared/ErkIconButton/ErkIconButton.module.css +0 -41
  129. package/dist/Shared/ErkLocationField/ErkLocationField.d.ts +0 -24
  130. package/dist/Shared/ErkLocationField/ErkLocationField.js +0 -128
  131. package/dist/Shared/ErkLocationField/ErkLocationField.module.css +0 -164
  132. package/dist/Shared/ErkLocationField/ErkLocationField.test.d.ts +0 -1
  133. package/dist/Shared/ErkLocationField/ErkLocationField.test.js +0 -82
  134. package/dist/Shared/ErkLocationField/addressFields.d.ts +0 -12
  135. package/dist/Shared/ErkLocationField/addressFields.js +0 -34
  136. package/dist/Shared/ErkLocationField/locationRestrictions.d.ts +0 -6
  137. package/dist/Shared/ErkLocationField/locationRestrictions.js +0 -51
  138. package/dist/Shared/ErkLocationInput/ErkLocationInput.d.ts +0 -15
  139. package/dist/Shared/ErkLocationInput/ErkLocationInput.js +0 -502
  140. package/dist/Shared/ErkLocationInput/ErkLocationInput.module.css +0 -128
  141. package/dist/Shared/ErkNumberField/ErkNumberField.d.ts +0 -42
  142. package/dist/Shared/ErkNumberField/ErkNumberField.js +0 -169
  143. /package/dist/{FormSteps/ClassifierSelectorStep/ClassifierSelectorStep.lateClassifiers.test.d.ts → Shared/ErkDatePicker/ErkDatePicker.locale.test.d.ts} +0 -0
package/README CHANGED
@@ -1,36 +1,4 @@
1
1
  # E2E
2
2
  Se prueban los 3 casos:
3
3
  Standalone, desplegando la app buildeada
4
- Widget y Libreria con el TestApp,
5
-
6
- # Desarrollo contra lambdas locales
7
-
8
- Por defecto `/api` va a la API desplegada del dominio que diga `VITE_REACT_APP_DOMAIN` en `.env`
9
- (`api.forms.eureka-test.click`). Con la variable `LOCAL_LAMBDAS` va al dev server de serverless, que
10
- corre las lambdas desde el código de tu máquina — sin desplegar nada.
11
-
12
- Primero levantá el dev server en el repo de serverless (`npm start` en `serverless/devserver`), y después:
13
-
14
- ```bash
15
- LOCAL_LAMBDAS=1 npm start # la app en :3003
16
- LOCAL_LAMBDAS=1 npm run storybook # las stories en :6006
17
- ```
18
-
19
- La organización sale del subdominio, igual que desplegada: entrá por `http://arquimedes.localhost:3003`
20
- y las lambdas atienden a esa org (los navegadores resuelven cualquier subdominio de `localhost` a
21
- 127.0.0.1). Para Storybook, o si preferís entrar por `localhost` pelado, hay que decirla:
22
-
23
- ```bash
24
- LOCAL_LAMBDAS=1 LOCAL_ORG=arquimedes npm run storybook
25
- ```
26
-
27
- Ambos comandos anuncian a dónde apuntan al arrancar.
28
-
29
- Variables:
30
-
31
- | variable | para qué |
32
- | --- | --- |
33
- | `LOCAL_LAMBDAS=1` | usar las lambdas locales en vez de la API desplegada |
34
- | `LOCAL_ORG` | la organización, si no entrás por `<org>.localhost` |
35
- | `DEVSERVER_PORT` | puerto del dev server, si no es 3100 |
36
- | `FORMS_API_TARGET` | apuntar a otro lado (un túnel, otro stage) e ignorar todo lo anterior |
4
+ Widget y Libreria con el TestApp,
@@ -5,13 +5,7 @@ import { EurekaDraft } from './Draft/Draft';
5
5
  import { ErkValue } from './ErkValue';
6
6
  import * as GSteps from './GenericFormSteps';
7
7
  import { Time } from './Time';
8
- import { LocationStep } from './LocationFormStep';
9
- import { NumberStep, NumberStepType } from './NumericFormSteps';
10
- import { BookingStep } from './BookingFormStep';
11
- import { CalendarStep } from './CalendarFormStep';
12
- export type { LocationStep, NumberStep, BookingStep, CalendarStep };
13
- export { NumberStepType };
14
- export type FormStep = Title | TimePicker | Rating | CheckBox | TextArea | TextInput | DatePicker | FileUpload | Separator | FormSelector | ClassifierSelector | Collapsible | EntityValuePicker | ApiSelector | Mapper | DatePickerRange | LocationStep | NumberStep | BookingStep | CalendarStep;
8
+ export type FormStep = Title | TimePicker | Rating | CheckBox | TextArea | TextInput | DatePicker | FileUpload | Separator | FormSelector | ClassifierSelector | Collapsible | EntityValuePicker | ApiSelector | Mapper | DatePickerRange;
15
9
  export interface Title extends GSteps.GBaseStep {
16
10
  type: FormStepTypes.TITLE;
17
11
  title?: EurekaDraft;
@@ -238,3 +232,4 @@ export interface Mapper extends GSteps.GBaseStep {
238
232
  deletable?: boolean;
239
233
  max?: number;
240
234
  }
235
+ export {};
@@ -1,2 +1 @@
1
- import { NumberStepType } from './NumericFormSteps';
2
- export { NumberStepType };
1
+ export {};
@@ -28,13 +28,3 @@ export declare const ParseadoConValores: Story;
28
28
  export declare const PreParseado: Story;
29
29
  /** Final view (postview): what the user submitted, rendered read-only. */
30
30
  export declare const Postview: Story;
31
- /**
32
- * Every checkbox variant in one form: sizes 1–4, required, description, list mode, long
33
- * labels, nested `steps` / `uncheckedSteps`, and a checkbox inside a collapsible. Resize the
34
- * preview below ~900px to see the collapsed label mode (100% width, 1-line clamp, "ver más").
35
- * Inside the collapsible, close/reopen it and then check the checkbox to reproduce the clipped
36
- * nested steps.
37
- */
38
- export declare const Checkboxes: Story;
39
- /** Same checkboxes form in postview, read-only. */
40
- export declare const CheckboxesPostview: Story;
@@ -296,192 +296,3 @@ export const Postview = {
296
296
  editable: false,
297
297
  },
298
298
  };
299
- // ---------------------------------------------------------------------------------------------
300
- // Checkboxes: a full form exercising every checkbox variant side by side (sizes, required,
301
- // description, list mode, long label, nested steps, uncheckedSteps and a checkbox inside a
302
- // collapsible). Resize the preview to see the collapsed (100% width, 1-line clamp) label mode.
303
- // ---------------------------------------------------------------------------------------------
304
- const cbTextInput = (id, label, size = 2) => ({
305
- id,
306
- type: 'TEXTINPUT',
307
- label,
308
- description: '',
309
- required: false,
310
- size,
311
- isSubject: false,
312
- });
313
- const checkboxesForm = {
314
- steps: {
315
- 'CHECKBOX-size-1': {
316
- id: 'CHECKBOX-size-1',
317
- type: 'CHECKBOX',
318
- label: 'Tamaño 1',
319
- description: null,
320
- required: false,
321
- size: 1,
322
- },
323
- 'CHECKBOX-size-2': {
324
- id: 'CHECKBOX-size-2',
325
- type: 'CHECKBOX',
326
- label: 'Tamaño 2 con descripción',
327
- description: 'Texto de ayuda debajo del checkbox.',
328
- required: false,
329
- size: 2,
330
- },
331
- 'CHECKBOX-size-1-required': {
332
- id: 'CHECKBOX-size-1-required',
333
- type: 'CHECKBOX',
334
- label: 'Obligatorio',
335
- description: null,
336
- required: true,
337
- size: 1,
338
- },
339
- 'CHECKBOX-size-3': {
340
- id: 'CHECKBOX-size-3',
341
- type: 'CHECKBOX',
342
- label: 'Tamaño 3 con un label bastante largo que en escritorio se corta con puntos suspensivos',
343
- description: null,
344
- required: false,
345
- size: 3,
346
- },
347
- 'CHECKBOX-size-1-checked': {
348
- id: 'CHECKBOX-size-1-checked',
349
- type: 'CHECKBOX',
350
- label: 'Marcado',
351
- description: null,
352
- required: false,
353
- size: 1,
354
- defaultValue: true,
355
- },
356
- 'CHECKBOX-size-4': {
357
- id: 'CHECKBOX-size-4',
358
- type: 'CHECKBOX',
359
- label: 'Tamaño 4 (ancho completo): confirmo que la información suministrada es veraz, que he leído la ' +
360
- 'política de tratamiento de datos personales y autorizo el uso de mis datos para los fines ' +
361
- 'descritos en el presente formulario',
362
- description: null,
363
- required: true,
364
- size: 4,
365
- },
366
- 'CHECKBOX-list': {
367
- id: 'CHECKBOX-list',
368
- type: 'CHECKBOX',
369
- label: 'Modo lista (isList): el checkbox va antes del label y sin dos puntos',
370
- description: null,
371
- required: false,
372
- size: 4,
373
- isList: true,
374
- },
375
- 'CHECKBOX-nested': {
376
- id: 'CHECKBOX-nested',
377
- type: 'CHECKBOX',
378
- label: '¿Desea agregar una dirección de envío distinta?',
379
- description: 'Al marcarlo aparecen los campos de la dirección.',
380
- required: false,
381
- size: 4,
382
- steps: ['TEXTINPUT-shipping-address', 'TEXTINPUT-shipping-city'],
383
- },
384
- 'TEXTINPUT-shipping-address': cbTextInput('TEXTINPUT-shipping-address', 'Dirección de envío', 2),
385
- 'TEXTINPUT-shipping-city': cbTextInput('TEXTINPUT-shipping-city', 'Ciudad', 2),
386
- 'CHECKBOX-unchecked-steps': {
387
- id: 'CHECKBOX-unchecked-steps',
388
- type: 'CHECKBOX',
389
- label: 'Usar los datos de contacto registrados',
390
- description: 'Al desmarcarlo aparecen los campos de contacto (uncheckedSteps).',
391
- required: false,
392
- size: 4,
393
- defaultValue: true,
394
- uncheckedSteps: ['TEXTINPUT-contact-phone', 'TEXTINPUT-contact-email'],
395
- },
396
- 'TEXTINPUT-contact-phone': cbTextInput('TEXTINPUT-contact-phone', 'Teléfono', 2),
397
- 'TEXTINPUT-contact-email': cbTextInput('TEXTINPUT-contact-email', 'Correo', 2),
398
- 'COLLAPSIBLE-checkbox': {
399
- id: 'COLLAPSIBLE-checkbox',
400
- type: 'COLLAPSIBLE',
401
- label: 'Colapsable con checkbox anidado',
402
- defaultValue: true,
403
- steps: ['CHECKBOX-in-collapsible'],
404
- },
405
- 'CHECKBOX-in-collapsible': {
406
- id: 'CHECKBOX-in-collapsible',
407
- type: 'CHECKBOX',
408
- label: '¿Desea agregar información adicional?',
409
- description: null,
410
- required: false,
411
- size: 4,
412
- steps: ['TEXTINPUT-extra-1', 'TEXTINPUT-extra-2'],
413
- },
414
- 'TEXTINPUT-extra-1': cbTextInput('TEXTINPUT-extra-1', 'Información adicional 1', 2),
415
- 'TEXTINPUT-extra-2': cbTextInput('TEXTINPUT-extra-2', 'Información adicional 2', 2),
416
- },
417
- size: { blockNum: 4, blockSize: 210, spacingSize: 20 },
418
- rootSteps: [
419
- 'CHECKBOX-size-1',
420
- 'CHECKBOX-size-2',
421
- 'CHECKBOX-size-1-required',
422
- 'CHECKBOX-size-3',
423
- 'CHECKBOX-size-1-checked',
424
- 'CHECKBOX-size-4',
425
- 'CHECKBOX-list',
426
- 'CHECKBOX-nested',
427
- 'CHECKBOX-unchecked-steps',
428
- 'COLLAPSIBLE-checkbox',
429
- ],
430
- label: 'Enviar',
431
- firstSection: 'FIRST',
432
- sections: {
433
- FIRST: {
434
- id: 'FIRST',
435
- steps: [
436
- 'CHECKBOX-size-1',
437
- 'CHECKBOX-size-2',
438
- 'CHECKBOX-size-1-required',
439
- 'CHECKBOX-size-3',
440
- 'CHECKBOX-size-1-checked',
441
- 'CHECKBOX-size-4',
442
- 'CHECKBOX-list',
443
- 'CHECKBOX-nested',
444
- 'CHECKBOX-unchecked-steps',
445
- 'COLLAPSIBLE-checkbox',
446
- ],
447
- name: '',
448
- nextSection: null,
449
- },
450
- },
451
- };
452
- /**
453
- * Every checkbox variant in one form: sizes 1–4, required, description, list mode, long
454
- * labels, nested `steps` / `uncheckedSteps`, and a checkbox inside a collapsible. Resize the
455
- * preview below ~900px to see the collapsed label mode (100% width, 1-line clamp, "ver más").
456
- * Inside the collapsible, close/reopen it and then check the checkbox to reproduce the clipped
457
- * nested steps.
458
- */
459
- export const Checkboxes = {
460
- args: {
461
- formData: checkboxesForm,
462
- },
463
- };
464
- /** Same checkboxes form in postview, read-only. */
465
- export const CheckboxesPostview = {
466
- args: {
467
- formData: checkboxesForm,
468
- valuesData: {
469
- 'CHECKBOX-size-1': true,
470
- 'CHECKBOX-size-2': false,
471
- 'CHECKBOX-size-1-required': true,
472
- 'CHECKBOX-size-3': true,
473
- 'CHECKBOX-size-1-checked': true,
474
- 'CHECKBOX-size-4': true,
475
- 'CHECKBOX-list': true,
476
- 'CHECKBOX-nested': true,
477
- 'TEXTINPUT-shipping-address': 'Calle 123 # 45-67',
478
- 'TEXTINPUT-shipping-city': 'Bogotá',
479
- 'CHECKBOX-unchecked-steps': true,
480
- 'COLLAPSIBLE-checkbox': true,
481
- 'CHECKBOX-in-collapsible': false,
482
- },
483
- postview: true,
484
- internal: true,
485
- editable: false,
486
- },
487
- };
@@ -158,14 +158,6 @@ export const useSetupApp = (isEmbedded, props) => {
158
158
  idCurrentAgent,
159
159
  handleConfirmed,
160
160
  ]);
161
- // The host may resolve the classifiers asynchronously (the admin fetches them while the form is
162
- // already mounted). `loadData` only copies the prop it saw when it ran, so patch the form whenever a
163
- // new dictionary arrives — without re-running the load, which would reset what the user typed.
164
- useEffect(() => {
165
- if (!classifiers || !form || form.classifiers === classifiers)
166
- return;
167
- setForm({ ...form, classifiers });
168
- }, [classifiers, form]);
169
161
  const reload = useCallback(() => {
170
162
  if (!form)
171
163
  return;
@@ -81,14 +81,6 @@ describe('AppHooks', function () {
81
81
  expect(result.current.organization).toBeNull();
82
82
  expect(result.current.branding).toBeUndefined();
83
83
  });
84
- test('picks up classifiers that arrive after the first render', async () => {
85
- const classifier = { _id: 'tipo', name: 'Tipo de solicitud', children: [] };
86
- const { result, rerender } = renderHookWithProviders((props) => useSetupApp(false, { formData: BaseForm, internal: true, classifiers: props.classifiers }), { initialProps: { classifiers: {} } });
87
- await waitFor(() => expect(result.current.form).toBeTruthy());
88
- expect(result.current.form?.classifiers).toEqual({});
89
- rerender({ classifiers: { tipo: classifier } });
90
- await waitFor(() => expect(result.current.form?.classifiers?.tipo).toEqual(classifier));
91
- });
92
84
  test('Apikey Default', async () => {
93
85
  mocks.get.mockImplementation((a) => {
94
86
  if (a === '/organization') {
package/dist/Form/Form.js CHANGED
@@ -6,7 +6,7 @@ import InternalFormStyle from '../constants/InternalFormStyle';
6
6
  import ColumnForm from './FormTypes/ColumnForm/ColumnForm';
7
7
  import StepperForm from './FormTypes/StepperForm/StepperForm';
8
8
  import { FormStyleTypes, FormTypes } from '../constants/FormStepTypes';
9
- import { calcValue, resolveCaptchaToken } from './FormFunctions';
9
+ import { calcValue } from './FormFunctions';
10
10
  import { FormProvider, useForm } from 'react-hook-form';
11
11
  import widgetInstance from '../Utils/AxiosWidget';
12
12
  import axiosInstance from '../Utils/AxiosAPI';
@@ -38,16 +38,15 @@ function FormComponent({ form, apiKey, reload, isWidget, branding, setSubmit, sc
38
38
  // eslint-disable-next-line react-hooks/exhaustive-deps
39
39
  }, [idFocusStep]);
40
40
  const onSubmit = useCallback(async (values) => {
41
+ let token = null;
42
+ if (form.hasCaptcha && !internal && !customSubmit) {
43
+ token = recaptchaRef.current?.getValue();
44
+ token ?? (token = await recaptchaRef?.current.executeAsync());
45
+ }
41
46
  const ApiKey = internal ? form.apiKey : apiKey;
42
47
  if (!ApiKey && !customSubmit && !customSubmitBtns)
43
48
  return;
44
49
  try {
45
- // Resolved inside the try so a captcha that cannot mint a token surfaces through the same
46
- // error path as any other submit failure, rather than rejecting out of the handler and
47
- // leaving the submitter with no feedback at all.
48
- const token = form.hasCaptcha && !internal && !customSubmit
49
- ? await resolveCaptchaToken(recaptchaRef.current)
50
- : null;
51
50
  const state = await dispatch(getAppState({ idForm })).unwrap();
52
51
  const newValues = {
53
52
  ...state.site.values.global,
@@ -4,23 +4,6 @@ import { CustomStep } from '../FormSteps/CustomStep';
4
4
  import { CBRFormStep } from '../@Types/CBRFormStep';
5
5
  import { MapperElement } from '../@Types/MapperElement';
6
6
  import { ValuesStore } from '../States/SiteSlice';
7
- /** The reCAPTCHA widget surface a submission needs: the response it holds, and the challenge that mints one. */
8
- export interface CaptchaWidget {
9
- getValue(): string | null;
10
- executeAsync(): Promise<string | null>;
11
- }
12
- /**
13
- * Resolve the reCAPTCHA response to send with a submission, running the invisible challenge when the widget
14
- * is not holding one yet.
15
- *
16
- * An unsolved invisible widget answers `getValue()` with an EMPTY STRING rather than null, so emptiness —
17
- * not nullishness — is what decides whether the challenge still has to run. A submission that skips the
18
- * challenge carries no token, and the API rejects every captcha-protected public form with a 403.
19
- *
20
- * Yields null when no widget is mounted, leaving the caller to submit tokenless rather than throwing out of
21
- * the submit handler.
22
- */
23
- export declare function resolveCaptchaToken(captcha: CaptchaWidget | null | undefined): Promise<string | null>;
24
7
  /**
25
8
  * Function that cals the value of a step to output on submit
26
9
  */
@@ -3,28 +3,6 @@ import FormStepTypes, { EntityValueDataTypes } from '../constants/FormStepTypes'
3
3
  import { calcStepDeps } from '../FormSteps/StepHooks';
4
4
  import { calcRecursiveData } from '../Utils/FormStepFunctions';
5
5
  import { isValidPhoneNumber } from '../Utils/PhoneFunctions';
6
- /**
7
- * Resolve the reCAPTCHA response to send with a submission, running the invisible challenge when the widget
8
- * is not holding one yet.
9
- *
10
- * An unsolved invisible widget answers `getValue()` with an EMPTY STRING rather than null, so emptiness —
11
- * not nullishness — is what decides whether the challenge still has to run. A submission that skips the
12
- * challenge carries no token, and the API rejects every captcha-protected public form with a 403.
13
- *
14
- * Yields null when no widget is mounted, leaving the caller to submit tokenless rather than throwing out of
15
- * the submit handler.
16
- */
17
- export async function resolveCaptchaToken(captcha) {
18
- if (!captcha)
19
- return null;
20
- const held = captcha.getValue();
21
- if (held)
22
- return held;
23
- const solved = await captcha.executeAsync();
24
- if (solved)
25
- return solved;
26
- return null;
27
- }
28
6
  /**
29
7
  * Function that cals the value of a step to output on submit
30
8
  */
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/require-await */
2
2
  import { ContentState, EditorState } from 'draft-js';
3
3
  import FormStepTypes, { EntityValueDataTypes } from '../constants/FormStepTypes';
4
- import { calcDependencies, calcValue, resolveCaptchaToken } from './FormFunctions';
4
+ import { calcDependencies, calcValue } from './FormFunctions';
5
5
  import { stringToDraft } from '../Utils/DraftFunctions';
6
6
  import { describe, expect, test } from 'vitest';
7
7
  describe('FormFunctions', function () {
@@ -455,31 +455,4 @@ describe('FormFunctions', function () {
455
455
  expect(dependencyStore.idStep.dependents.length).toBe(1);
456
456
  });
457
457
  });
458
- describe('resolveCaptchaToken', function () {
459
- test('Uses the token the widget already holds without re-running the challenge', async () => {
460
- let executed = false;
461
- const token = await resolveCaptchaToken({
462
- getValue: () => 'already-solved',
463
- executeAsync: async () => {
464
- executed = true;
465
- return 'freshly-solved';
466
- },
467
- });
468
- expect(token).toBe('already-solved');
469
- expect(executed).toBe(false);
470
- });
471
- test('Runs the challenge when the invisible widget reports an empty response', async () => {
472
- // An unsolved invisible captcha answers `getValue()` with '' — not null — so emptiness is what
473
- // must decide whether the challenge still has to run. Treating only nullish as unsolved leaves
474
- // the submission tokenless and the API answers 403.
475
- const token = await resolveCaptchaToken({
476
- getValue: () => '',
477
- executeAsync: async () => 'freshly-solved',
478
- });
479
- expect(token).toBe('freshly-solved');
480
- });
481
- test('Yields no token when the widget is not mounted', async () => {
482
- expect(await resolveCaptchaToken(null)).toBeNull();
483
- });
484
- });
485
458
  });
@@ -48,7 +48,7 @@ function makeStore(currentBreakPoint) {
48
48
  ...defaultRootState,
49
49
  widthStats: {
50
50
  currentBreakPoint,
51
- isMobile: currentBreakPoint <= 1,
51
+ isMobile: currentBreakPoint <= checkBoxStep.size,
52
52
  isResponsive: true,
53
53
  },
54
54
  },
@@ -57,15 +57,15 @@ function makeStore(currentBreakPoint) {
57
57
  middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(RootApi.middleware),
58
58
  });
59
59
  }
60
- function Harness({ currentBreakPoint, step = checkBoxStep, }) {
60
+ function Harness({ currentBreakPoint }) {
61
61
  const methods = useForm({ mode: 'onTouched' });
62
- return (_jsx(MaterialProviders, { formStyle: InternalFormStyle, children: _jsx(Provider, { store: makeStore(currentBreakPoint), context: StoreContext, children: _jsx(IdFormContext.Provider, { value: STORY_FORM_ID, children: _jsx(FormContext.Provider, { value: { ...form, steps: { ...form.steps, [step.id]: step } }, children: _jsx(SectionContext.Provider, { value: "SECTION_1", children: _jsx(FormProvider, { ...methods, children: _jsx(CheckBoxStep, { step: step, editable: true }) }) }) }) }) }) }));
62
+ return (_jsx(MaterialProviders, { formStyle: InternalFormStyle, children: _jsx(Provider, { store: makeStore(currentBreakPoint), context: StoreContext, children: _jsx(IdFormContext.Provider, { value: STORY_FORM_ID, children: _jsx(FormContext.Provider, { value: form, children: _jsx(SectionContext.Provider, { value: "SECTION_1", children: _jsx(FormProvider, { ...methods, children: _jsx(CheckBoxStep, { step: checkBoxStep, editable: true }) }) }) }) }) }) }));
63
63
  }
64
64
  function getLabelDiv() {
65
65
  // the leaf div holding only the label text (the wrapping column also matches by textContent)
66
66
  return screen.getByText((_, element) => element?.tagName === 'DIV' && element.children.length === 0 && element.textContent === `${LONG_LABEL}:`);
67
67
  }
68
- /** Makes every element report a 1-line-clamped overflow (jsdom has no layout). */
68
+ /** Makes every element report a 2-line-clamped overflow (jsdom has no layout). */
69
69
  function mockLabelOverflow() {
70
70
  Object.defineProperty(HTMLElement.prototype, 'scrollHeight', {
71
71
  configurable: true,
@@ -76,7 +76,7 @@ function mockLabelOverflow() {
76
76
  Object.defineProperty(HTMLElement.prototype, 'clientHeight', {
77
77
  configurable: true,
78
78
  get() {
79
- return 24;
79
+ return 48;
80
80
  },
81
81
  });
82
82
  }
@@ -85,30 +85,22 @@ afterEach(() => {
85
85
  delete HTMLElement.prototype.scrollHeight;
86
86
  delete HTMLElement.prototype.clientHeight;
87
87
  });
88
- describe('CheckBoxStep long labels', () => {
89
- it('clamps the label to 1 line with a toggle instead of a plain ellipsis when the step collapses to 100% width', () => {
88
+ describe('CheckBoxStep label on collapsed (mobile) breakpoints', () => {
89
+ it('wraps the label (2-line clamp) instead of single-line truncating it when the step collapses to 100% width', () => {
90
90
  // breakpoint 1 <= size 2 → MaterialInputContainer renders the step at width: 100%
91
91
  render(_jsx(Harness, { currentBreakPoint: 1 }));
92
92
  const label = getLabelDiv();
93
93
  expect(label.className).toBe(styles.clampLbl);
94
- // no fixed desktop pixel maxWidth constrains the label
94
+ expect(label.className).not.toBe(styles.overflowLbl);
95
+ // the fixed desktop pixel maxWidth must not constrain the collapsed label
95
96
  expect(label.style.maxWidth).toBe('');
96
97
  });
97
- it('also clamps (with "ver más") when the step keeps a fixed width on a phone where 2 columns fit', () => {
98
- // regression: a size-1 checkbox at breakpoint 2 used to render a single-line ellipsis with
99
- // no way to read the full label
100
- mockLabelOverflow();
101
- render(_jsx(Harness, { currentBreakPoint: 2, step: { ...checkBoxStep, size: 1 } }));
102
- const label = getLabelDiv();
103
- expect(label.className).toBe(styles.clampLbl);
104
- expect(label.style.maxWidth).toBe('');
105
- expect(screen.getByRole('button', { name: 'ver más' })).toBeInTheDocument();
106
- });
107
- it('clamps on desktop widths too, without a toggle while the label fits', () => {
98
+ it('keeps the single-line ellipsis label on desktop widths (control)', () => {
108
99
  // breakpoint 4 > size 2 → the step keeps its fixed desktop width
109
100
  render(_jsx(Harness, { currentBreakPoint: 4 }));
110
101
  const label = getLabelDiv();
111
- expect(label.className).toBe(styles.clampLbl);
102
+ expect(label.className).toBe(styles.overflowLbl);
103
+ expect(label.style.maxWidth).not.toBe('');
112
104
  expect(screen.queryByRole('button', { name: 'ver más' })).not.toBeInTheDocument();
113
105
  });
114
106
  it('shows no "ver más" toggle when the label fits in the clamp', () => {
@@ -8,6 +8,7 @@ import { useAppSelector, selectWidthStats } from '../../../hooks';
8
8
  import { useFormStep } from '../../StepHooks';
9
9
  import StepFillerContainer from '../../Utils/@StepFiller/StepFiller';
10
10
  import MaterialInputContainer from '../../Utils/MaterialInputContainer/MaterialInputContainer';
11
+ import { calcStepWidth, resolveStepSpan } from '../../StepFunctions';
11
12
  function CheckBoxStep({ step, editable }) {
12
13
  const { ref, value, onChange, error, field } = useFormStep(step, {
13
14
  defaultValue: step.defaultValue ?? false,
@@ -19,15 +20,15 @@ function CheckBoxStep({ step, editable }) {
19
20
  const { formStyle, postview } = useAppSelector((state) => state.global);
20
21
  const form = useContext(FormContext);
21
22
  const widthStats = useAppSelector(selectWidthStats);
22
- // The label is clamped to 1 line with a "ver más" toggle at every width. A plain
23
- // ellipsis was used while the step kept its fixed desktop pixel width, but that left long
24
- // labels unreadable wherever the step is narrow (e.g. a size-1 checkbox on a phone where 2
25
- // columns fit).
23
+ const span = resolveStepSpan(step, widthStats, form.size);
24
+ // when the breakpoint collapses the step to width: 100% (see MaterialInputContainer),
25
+ // the fixed desktop pixel width no longer matches the real available space
26
+ const collapsed = widthStats.currentBreakPoint <= span;
26
27
  const labelRef = useRef(null);
27
28
  const [expanded, setExpanded] = useState(false);
28
29
  const [clamped, setClamped] = useState(false);
29
30
  useLayoutEffect(() => {
30
- if (expanded)
31
+ if (!collapsed || expanded)
31
32
  return;
32
33
  const measure = () => {
33
34
  const label = labelRef.current;
@@ -37,7 +38,7 @@ function CheckBoxStep({ step, editable }) {
37
38
  measure();
38
39
  window.addEventListener('resize', measure);
39
40
  return () => window.removeEventListener('resize', measure);
40
- }, [expanded, step.label, widthStats.currentBreakPoint]);
41
+ }, [collapsed, expanded, step.label]);
41
42
  const renderNested = () => {
42
43
  const steps = value ? step.steps : step.uncheckedSteps;
43
44
  return (_jsx(React.Fragment, { children: steps?.map((idStep) => {
@@ -47,12 +48,18 @@ function CheckBoxStep({ step, editable }) {
47
48
  };
48
49
  const renderLabel = (colon = false) => {
49
50
  const label = `${step.label}${step.required ? ' *' : ''}${colon ? ':' : ''}`;
51
+ if (!collapsed) {
52
+ return (_jsx("div", { className: span === 4 ? styles.checkboxLbl : styles.overflowLbl, style: {
53
+ maxWidth: calcStepWidth(span, form.size) - 45,
54
+ }, children: label }));
55
+ }
50
56
  return (_jsxs("div", { className: styles.labelColumn, children: [_jsx("div", { ref: labelRef, className: expanded ? styles.expandedLbl : styles.clampLbl, children: label }), (clamped || expanded) && (_jsx("button", { type: "button", className: styles.toggleLbl, style: { color: formStyle.primaryColor }, onClick: (event) => {
51
57
  event.stopPropagation();
52
58
  setExpanded(!expanded);
53
59
  }, children: expanded ? 'ver menos' : 'ver más' }))] }));
54
60
  };
55
61
  return (_jsxs(StepFillerContainer, { step: step, children: [_jsx(MaterialInputContainer, { step: step, editable: editable, maxHeight: step.size < 4, children: _jsxs("div", { className: styles.container, children: [_jsxs("div", { className: styles.labelCheckBoxContainer, style: {
62
+ height: span < 4 && !collapsed ? 31 : undefined,
56
63
  minHeight: 31,
57
64
  alignItems: step.isList ? 'start' : 'center',
58
65
  }, children: [step.label && !step.isList && renderLabel(true), _jsx(ErkCheckBox, { ...field, padding: "0px", inputRef: ref, error: !!error, checked: value, onChange: onChange, "data-testid": step.id, readOnly: !editable || postview }), step.label && step.isList && renderLabel()] }), (step.description ?? !!error) && (_jsx("div", { className: styles.descriptionPar, style: {
@@ -3,6 +3,17 @@
3
3
  flex-direction: column;
4
4
  max-width: 100%;
5
5
  }
6
+ .checkboxLbl,
7
+ .overflowLbl {
8
+ font-size: 18px;
9
+ margin-right: 10px;
10
+ margin-left: 10px;
11
+ }
12
+ .overflowLbl {
13
+ white-space: nowrap;
14
+ overflow: hidden;
15
+ text-overflow: ellipsis;
16
+ }
6
17
  .labelColumn {
7
18
  display: flex;
8
19
  flex-direction: column;
@@ -19,8 +30,8 @@
19
30
  .clampLbl {
20
31
  display: -webkit-box;
21
32
  -webkit-box-orient: vertical;
22
- -webkit-line-clamp: 1;
23
- line-clamp: 1;
33
+ -webkit-line-clamp: 2;
34
+ line-clamp: 2;
24
35
  overflow: hidden;
25
36
  }
26
37
  .toggleLbl {
@@ -50,10 +50,8 @@ function ClassifierSelectorStep({ step, editable }) {
50
50
  };
51
51
  }) ?? []);
52
52
  },
53
- // The classifiers dictionary can arrive after the first render (see useSetupApp), so the
54
- // options must follow it, not only the dependency values.
55
53
  // eslint-disable-next-line react-hooks/exhaustive-deps
56
- [dependenciesValues, classifier, form.classifiers]);
54
+ [dependenciesValues]);
57
55
  useEffect(() => {
58
56
  if (value && !options?.find((option) => option.value === value?.value)) {
59
57
  onChange('');