@inseefr/lunatic 2.4.5-beta → 2.4.6-beta

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 (70) hide show
  1. package/lib/components/commons/components/dragger/dragger.scss +7 -7
  2. package/lib/components/commons/components/is-network/use-online-status.spec.js +0 -4
  3. package/lib/components/commons/components/lunatic-component-without-label.js +4 -11
  4. package/lib/components/commons/components/md-label/md-label.js +2 -1
  5. package/lib/components/commons/components/orchestrated-component.js +3 -2
  6. package/lib/components/component-set/html/component-set-components.js +6 -2
  7. package/lib/components/component-set/lunatic-component-set.js +3 -1
  8. package/lib/components/declarations/declarations.spec.js +0 -1
  9. package/lib/components/dropdown/html/dropdown-simple/simple-label-renderer.js +1 -1
  10. package/lib/components/dropdown/html/dropdown-simple/simple-option-renderer.js +5 -7
  11. package/lib/components/dropdown/html/dropdown-writable/writable-label-renderer.js +1 -1
  12. package/lib/components/dropdown/html/dropdown-writable/writable-option-renderer.js +1 -1
  13. package/lib/components/dropdown/html/dropdown.scss +0 -3
  14. package/lib/components/index.js +14 -0
  15. package/lib/components/loop/roster-for-loop/roster-table.js +0 -1
  16. package/lib/components/loop/roster-for-loop/roster.scss +0 -3
  17. package/lib/components/modal-controls/modal-controls.spec.js +0 -14
  18. package/lib/components/pairwise-links/pairwise-links.js +0 -1
  19. package/lib/components/questions/question-context.js +21 -7
  20. package/lib/components/questions/question-context.scss +1 -0
  21. package/lib/components/questions/question-information.js +19 -5
  22. package/lib/components/questions/question-information.scss +1 -0
  23. package/lib/components/roundabout/components/roundabout.scss +0 -3
  24. package/lib/components/sequence/html/sequence.js +8 -3
  25. package/lib/components/sequence/lunatic-sequence.js +1 -5
  26. package/lib/components/sequence/sequence.spec.js +0 -3
  27. package/lib/components/suggester/html/default-style.scss +1 -6
  28. package/lib/components/suggester/idb-suggester/check-store.js +2 -1
  29. package/lib/components/suggester-loader-widget/loader-row.js +2 -1
  30. package/lib/components/switch/html/switch.scss +0 -2
  31. package/lib/components/switch/lunatic-switch.js +1 -1
  32. package/lib/src/components/commons/components/lunatic-component-without-label.d.ts +1 -1
  33. package/lib/src/components/commons/components/orchestrated-component.d.ts +1 -1
  34. package/lib/src/components/commons/create-row-orchestrator.d.ts +2 -2
  35. package/lib/src/components/component-set/html/component-set-components.d.ts +3 -2
  36. package/lib/src/components/index.d.ts +2 -0
  37. package/lib/src/components/loop/commons/handle-row-button.d.ts +1 -2
  38. package/lib/src/components/questions/question-context.d.ts +1 -2
  39. package/lib/src/components/questions/question-information.d.ts +1 -2
  40. package/lib/src/components/sequence/html/sequence.d.ts +1 -1
  41. package/lib/src/components/sequence/lunatic-sequence.d.ts +1 -1
  42. package/lib/src/components/suggester/idb-suggester/suggester-notification.d.ts +1 -3
  43. package/lib/src/components/type.d.ts +2 -3
  44. package/lib/src/hooks/use-ref-sync.d.ts +1 -1
  45. package/lib/src/use-lunatic/reducer/commons/resize-array-variable.d.ts +1 -1
  46. package/lib/src/utils/logger.d.ts +6 -0
  47. package/lib/stories/component-set/data2.json +7 -0
  48. package/lib/stories/component-set/source2.json +31 -31
  49. package/lib/stories/custom-mui/suggester-mui/suggester-mui.js +0 -1
  50. package/lib/stories/input/input.stories.js +9 -1
  51. package/lib/stories/input/source-with-question.json +74 -0
  52. package/lib/stories/questionnaires/simpsons/simpsons.stories.js +2 -1
  53. package/lib/stories/sequence/sequence.stories.js +1 -8
  54. package/lib/stories/sequence/source-declarations.json +9 -0
  55. package/lib/stories/suggester/suggester-workers.stories.js +6 -5
  56. package/lib/stories/suggester/suggester.stories.js +0 -1
  57. package/lib/stories/utils/orchestrator.js +4 -3
  58. package/lib/use-lunatic/commons/calculated-variables.js +1 -1
  59. package/lib/use-lunatic/commons/compile-controls.js +1 -1
  60. package/lib/use-lunatic/commons/execute-expression/create-execute-expression.js +1 -4
  61. package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js +1 -1
  62. package/lib/use-lunatic/commons/load-suggesters.js +46 -46
  63. package/lib/utils/logger.js +44 -0
  64. package/lib/utils/suggester-workers/append-to-index/create-append-task.js +2 -1
  65. package/lib/utils/suggester-workers/create-worker-ts.js +2 -1
  66. package/lib/utils/suggester-workers/create-worker.js +2 -1
  67. package/package.json +1 -1
  68. package/lib/components/questions/type.js +0 -5
  69. package/lib/src/components/questions/type.d.ts +0 -4
  70. package/lib/stories/sequence/source-questions.json +0 -19
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import './sequence.scss';
3
3
  import { LunaticBaseProps } from '../../type';
4
- declare const _default: import("react").ComponentType<Pick<LunaticBaseProps<string>, "label" | "style" | "id">>;
4
+ declare const _default: import("react").ComponentType<Pick<LunaticBaseProps<string>, "label" | "style" | "id" | "description">>;
5
5
  export default _default;
@@ -1,3 +1,3 @@
1
1
  import { LunaticComponentProps } from '../type';
2
- declare function LunaticSequence({ declarations, label, id, style, questionContext, questionInformation, }: LunaticComponentProps<'Sequence'>): import("react/jsx-runtime").JSX.Element;
2
+ declare function LunaticSequence({ declarations, label, id, style }: LunaticComponentProps<'Sequence'>): import("react/jsx-runtime").JSX.Element;
3
3
  export default LunaticSequence;
@@ -1,7 +1,5 @@
1
- import React from 'react';
2
- import { PropsWithChildren } from 'react';
1
+ import React, { PropsWithChildren, ReactNode } from 'react';
3
2
  import { SuggesterStatus } from '../../../use-lunatic/use-suggesters';
4
- import { ReactNode } from 'react';
5
3
  type Props = PropsWithChildren<{
6
4
  status: SuggesterStatus;
7
5
  storeName: string;
@@ -36,8 +36,6 @@ export type LunaticBaseProps<ValueType = unknown> = {
36
36
  executeExpression: LunaticState['executeExpression'];
37
37
  features?: string[];
38
38
  componentType?: string;
39
- questionContext?: ReactNode;
40
- questionInformation?: ReactNode;
41
39
  };
42
40
  export type SuggesterOption = {
43
41
  children?: string[];
@@ -69,8 +67,9 @@ type ComponentPropsByType = {
69
67
  name: string;
70
68
  };
71
69
  };
72
- Sequence: Pick<LunaticBaseProps<string>, 'id' | 'declarations' | 'label' | 'style' | 'questionContext' | 'questionInformation'>;
70
+ Sequence: Pick<LunaticBaseProps<string>, 'id' | 'declarations' | 'label' | 'style'>;
73
71
  Subsequence: Pick<LunaticBaseProps<string>, 'id' | 'declarations' | 'label'>;
72
+ Question: Pick<LunaticBaseProps<unknown>, 'label' | 'description'>;
74
73
  ComponentSet: LunaticBaseProps<unknown> & {
75
74
  components: LunaticComponentDefinition[];
76
75
  value: Record<string, unknown>;
@@ -2,4 +2,4 @@
2
2
  /**
3
3
  * useRef, but keep the value in sync on every render
4
4
  */
5
- export declare function useRefSync<T extends unknown>(value: T): import("react").MutableRefObject<T>;
5
+ export declare function useRefSync<T>(value: T): import("react").MutableRefObject<T>;
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Cast the variable into an array and adjust the length if necessary
3
3
  */
4
- declare function resizeArrayVariable<T extends unknown = unknown>(array: unknown, length: number, defaultValue?: T): T[];
4
+ declare function resizeArrayVariable<T = unknown>(array: unknown, length: number, defaultValue?: T): T[];
5
5
  export default resizeArrayVariable;
@@ -0,0 +1,6 @@
1
+ export declare class Logger {
2
+ static info(...args: unknown[]): void;
3
+ static error(...args: unknown[]): void;
4
+ static log(...args: unknown[]): void;
5
+ static warn(...args: unknown[]): void;
6
+ }
@@ -1,5 +1,12 @@
1
1
  {
2
2
  "COLLECTED": {
3
+ "NB_HAB": {
4
+ "EDITED": null,
5
+ "FORCED": null,
6
+ "INPUTED": null,
7
+ "PREVIOUS": null,
8
+ "COLLECTED": 2
9
+ },
3
10
  "PRENOM": {
4
11
  "EDITED": [null],
5
12
  "FORCED": [null],
@@ -115,41 +115,11 @@
115
115
  "depth": 1,
116
116
  "conditionFilter": { "value": "true", "type": "VTL" },
117
117
  "label": {
118
- "value": "\"## Who are you? <- this is inside a roundabout ->\"",
118
+ "value": "\"## Who are you?\"",
119
119
  "type":"VTL|MD"
120
120
  },
121
121
  "description": { "value": "\"This is your opportunity to tell me about yourself!\"", "type": "VTL|MD" },
122
122
  "components": [
123
- {
124
- "id": "color",
125
- "componentType": "Input",
126
- "mandatory": false,
127
- "maxLength": 20,
128
- "label": {
129
- "value": "\"Favourite Color?\"))",
130
- "type": "VTL|MD"
131
- },
132
- "conditionFilter": {
133
- "value": "true",
134
- "type": "VTL"
135
- },
136
- "controls": [
137
- {
138
- "criticality": "WARN",
139
- "errorMessage": {
140
- "type": "VTL",
141
- "value": "\"booleen pas coché et on affiche un message un peu long histoire de tester le truc \""
142
- },
143
- "typeOfControl": "CONSISTENCY",
144
- "control": {
145
- "type": "VTL",
146
- "value": "false"
147
- },
148
- "id": "kfxmjupm-CI-0"
149
- }
150
- ],
151
- "response": { "name": "COLOR" }
152
- },
153
123
  {
154
124
  "id": "sexe",
155
125
  "componentType": "Radio",
@@ -173,6 +143,36 @@
173
143
  ],
174
144
  "response": { "name": "SEXE" }
175
145
  },
146
+ {
147
+ "id": "color",
148
+ "componentType": "Input",
149
+ "mandatory": false,
150
+ "maxLength": 20,
151
+ "label": {
152
+ "value": "\"Favourite Color?\"))",
153
+ "type": "VTL|MD"
154
+ },
155
+ "conditionFilter": {
156
+ "value": "not(isnull(SEXE))",
157
+ "type": "VTL"
158
+ },
159
+ "controls": [
160
+ {
161
+ "id": "j4nw5cqz",
162
+ "typeOfControl": "CONSISTENCY",
163
+ "criticality": "WARN",
164
+ "control": {
165
+ "value": "COLOR <> \"Green\"",
166
+ "type": "VTL"
167
+ },
168
+ "errorMessage": {
169
+ "value": "\"Green is the worst colour!!!\"",
170
+ "type": "VTL|MD"
171
+ }
172
+ }
173
+ ],
174
+ "response": { "name": "COLOR" }
175
+ },
176
176
  {
177
177
  "id": "j4nw5cqz",
178
178
  "componentType": "Dropdown",
@@ -258,7 +258,6 @@ function SuggesterMui(_ref7) {
258
258
  var onChangeEx = (0, _react.useCallback)(function (e) {
259
259
  onChange(e.target.value);
260
260
  setSearch(e.target.value);
261
- console.log(e.target.value);
262
261
  }, [onChange]);
263
262
  var onDelete = (0, _react.useCallback)(function () {
264
263
  setSearch('');
@@ -3,10 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports["default"] = exports.Default = void 0;
6
+ exports["default"] = exports.WithQuestion = exports.Default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _orchestrator = _interopRequireDefault(require("../utils/orchestrator"));
9
9
  var _source = _interopRequireDefault(require("./source"));
10
+ var _sourceWithQuestion = _interopRequireDefault(require("./source-with-question"));
10
11
  var _data = _interopRequireDefault(require("./data"));
11
12
  var _defaultArgTypes = _interopRequireDefault(require("../utils/default-arg-types"));
12
13
  var _jsxRuntime = require("react/jsx-runtime");
@@ -33,4 +34,11 @@ Default.args = {
33
34
  id: 'input',
34
35
  source: _source["default"],
35
36
  data: _data["default"]
37
+ };
38
+ var WithQuestion = Template.bind({});
39
+ exports.WithQuestion = WithQuestion;
40
+ WithQuestion.args = {
41
+ id: 'input',
42
+ source: _sourceWithQuestion["default"],
43
+ data: _data["default"]
36
44
  };
@@ -0,0 +1,74 @@
1
+ {
2
+ "components": [
3
+ {
4
+ "componentType": "QuestionInformation",
5
+ "label": { "value": "\"Question Information\"", "type": "VTL|MD" },
6
+ "description": { "value": "\"Question Information description\"", "type": "VTL|MD" },
7
+ "page": "1"
8
+ },
9
+ {
10
+ "componentType": "Input",
11
+ "label": {
12
+ "value": "\"Prénom de l'occupant principal.\"",
13
+ "type": "VTL|MD"
14
+ },
15
+ "conditionFilter": { "value": "true", "type": "VTL" },
16
+ "maxLength": 30,
17
+ "id": "name",
18
+ "response": {
19
+ "name": "PRENOM"
20
+ },
21
+ "page": "1"
22
+ },
23
+ {
24
+ "componentType": "QuestionContext",
25
+ "label": { "value": "\"Question Context\"", "type": "VTL|MD" },
26
+ "description": { "value": "\"Question Context description\"", "type": "VTL|MD" },
27
+ "page": "1"
28
+ },
29
+ {
30
+ "componentType": "Input",
31
+ "label": {
32
+ "value": "\"Nom de l'occupant principal.\"",
33
+ "type": "VTL|MD"
34
+ },
35
+ "conditionFilter": { "value": "true", "type": "VTL" },
36
+ "maxLength": 30,
37
+ "id": "surname",
38
+ "description": {
39
+ "value": "\"For example, Bob.\"",
40
+ "type": "VTL|MD"
41
+ },
42
+ "response": {
43
+ "name": "NOM"
44
+ },
45
+ "page": "1"
46
+ }
47
+ ],
48
+ "variables": [
49
+ {
50
+ "variableType": "COLLECTED",
51
+ "name": "NOM",
52
+ "componentRef": "name",
53
+ "values": {
54
+ "PREVIOUS": null,
55
+ "COLLECTED": null,
56
+ "FORCED": null,
57
+ "EDITED": null,
58
+ "INPUTED": null
59
+ }
60
+ },
61
+ {
62
+ "variableType": "COLLECTED",
63
+ "name": "PRENOM",
64
+ "componentRef": "name",
65
+ "values": {
66
+ "PREVIOUS": null,
67
+ "COLLECTED": null,
68
+ "FORCED": null,
69
+ "EDITED": null,
70
+ "INPUTED": null
71
+ }
72
+ }
73
+ ]
74
+ }
@@ -10,6 +10,7 @@ var _defaultArgTypes = _interopRequireDefault(require("../../utils/default-arg-t
10
10
  var _e2e = require("../../../../tests/utils/e2e");
11
11
  var _source = _interopRequireDefault(require("./source"));
12
12
  var _timer = require("../../../../tests/utils/timer");
13
+ var _logger = require("../../../utils/logger");
13
14
  var _jsxRuntime = require("react/jsx-runtime");
14
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
16
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
@@ -535,7 +536,7 @@ With_Missing.args = {
535
536
  pagination: true,
536
537
  missing: true,
537
538
  missingStrategy: function missingStrategy() {
538
- console.log('your strategy has been applied');
539
+ _logger.Logger.info('your strategy has been applied');
539
540
  },
540
541
  dontKnowButton: 'I dunno',
541
542
  refusedButton: 'Oh no!',
@@ -3,11 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports["default"] = exports.WithQuestions = exports.WithDeclarations = void 0;
6
+ exports["default"] = exports.WithDeclarations = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _orchestrator = _interopRequireDefault(require("../utils/orchestrator"));
9
9
  var _sourceDeclarations = _interopRequireDefault(require("./source-declarations.json"));
10
- var _sourceQuestions = _interopRequireDefault(require("./source-questions.json"));
11
10
  var _defaultArgTypes = _interopRequireDefault(require("../utils/default-arg-types"));
12
11
  var _jsxRuntime = require("react/jsx-runtime");
13
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -32,10 +31,4 @@ exports.WithDeclarations = WithDeclarations;
32
31
  WithDeclarations.args = {
33
32
  id: 'sequence-declarations',
34
33
  source: _sourceDeclarations["default"]
35
- };
36
- var WithQuestions = Template.bind({});
37
- exports.WithQuestions = WithQuestions;
38
- WithQuestions.args = {
39
- id: 'sequence-questions',
40
- source: _sourceQuestions["default"]
41
34
  };
@@ -16,6 +16,15 @@
16
16
  "type": "VTL|MD"
17
17
  }
18
18
  },
19
+ {
20
+ "id": "kb9hi4j0-krnoclfe",
21
+ "declarationType": "INSTRUCTION",
22
+ "position": "AFTER_QUESTION_TEXT",
23
+ "label": {
24
+ "value": "\"Déclaration AFTER\"",
25
+ "type": "VTL|MD"
26
+ }
27
+ },
19
28
  {
20
29
  "id": "kb9hi4j0-krnoclfe",
21
30
  "declarationType": "HELP",
@@ -12,6 +12,7 @@ var _idbTools = require("../../utils/idb-tools");
12
12
  var _storeTools = require("../../utils/store-tools");
13
13
  var _appendToIndex = _interopRequireDefault(require("../../utils/suggester-workers/append-to-index"));
14
14
  var _searching = _interopRequireDefault(require("../../utils/suggester-workers/searching"));
15
+ var _logger = require("../../utils/logger");
15
16
  var _jsxRuntime = require("react/jsx-runtime");
16
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
18
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -24,7 +25,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
24
25
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
25
26
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
27
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
27
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } // import source from './source';
28
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
28
29
  var stories = {
29
30
  title: 'Components/Suggester-workers',
30
31
  component: _orchestrator["default"],
@@ -103,12 +104,12 @@ function _loadOne() {
103
104
  _context2.next = 11;
104
105
  return (0, _idbTools.clearDb)(db, _storeTools.CONSTANTES.STORE_INFO_NAME);
105
106
  case 11:
106
- console.log({
107
+ _logger.Logger.log({
107
108
  info: info,
108
109
  rubriques: rubriques
109
110
  });
110
111
  _context2.next = 14;
111
- return (0, _appendToIndex["default"])(info, '1', rubriques, console.log);
112
+ return (0, _appendToIndex["default"])(info, '1', rubriques, _logger.Logger.log);
112
113
  case 14:
113
114
  _context2.next = 16;
114
115
  return (0, _idbTools.insertEntity)(db, _storeTools.CONSTANTES.STORE_INFO_NAME, info);
@@ -155,7 +156,7 @@ function Search(_ref) {
155
156
  });
156
157
  case 2:
157
158
  results = _context.sent;
158
- console.log(results);
159
+ _logger.Logger.log(results);
159
160
  case 4:
160
161
  case "end":
161
162
  return _context.stop();
@@ -165,7 +166,7 @@ function Search(_ref) {
165
166
  return _doIt.apply(this, arguments);
166
167
  }
167
168
  if (value.length) {
168
- doIt();
169
+ doIt()["catch"](_logger.Logger.error);
169
170
  }
170
171
  }, [value, name, version, max, order, meloto]);
171
172
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
@@ -9,7 +9,6 @@ var _orchestrator = _interopRequireDefault(require("../utils/orchestrator"));
9
9
  var _source = _interopRequireDefault(require("./source"));
10
10
  var _simple = _interopRequireDefault(require("./simple"));
11
11
  var _defaultArgTypes = _interopRequireDefault(require("../utils/default-arg-types"));
12
- var _SuggesterNotification = require("./SuggesterNotification");
13
12
  var _jsxRuntime = require("react/jsx-runtime");
14
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
14
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
@@ -11,6 +11,7 @@ var lunatic = _interopRequireWildcard(require("../.."));
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
  var _overview = require("./overview");
13
13
  var _waiting = _interopRequireDefault(require("./waiting"));
14
+ var _logger = require("../../utils/logger");
14
15
  var _jsxRuntime = require("react/jsx-runtime");
15
16
  var _excluded = ["source", "data", "management", "shortcut", "activeControls", "features", "initialPage", "getStoreInfo", "missing", "missingStrategy", "missingShortcut", "autoSuggesterLoading", "addExternal", "preferences", "custom", "showOverview", "filterDescription", "getReferentiel", "dontKnowButton", "refusedButton"],
16
17
  _excluded2 = ["id", "componentType", "response", "storeName", "conditionFilter"];
@@ -52,7 +53,7 @@ function DevOptions(_ref) {
52
53
  className: "contenur",
53
54
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(lunatic.Button, {
54
55
  onClick: function onClick() {
55
- return console.log(getData(true));
56
+ return _logger.Logger.log(getData(true));
56
57
  },
57
58
  children: "Get State"
58
59
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(lunatic.Button, {
@@ -107,14 +108,14 @@ function Pager(_ref2) {
107
108
  return null;
108
109
  }
109
110
  function onLogChange(response, value, args) {
110
- console.log('onChange', {
111
+ _logger.Logger.log('onChange', {
111
112
  response: response,
112
113
  value: value,
113
114
  args: args
114
115
  });
115
116
  }
116
117
  function logMissingStrategy() {
117
- console.log('no missing strategy');
118
+ _logger.Logger.log('no missing strategy');
118
119
  }
119
120
  function OrchestratorForStories(_ref3) {
120
121
  var source = _ref3.source,
@@ -24,7 +24,7 @@ var interpretAllCalculatedVariables = function interpretAllCalculatedVariables(_
24
24
  var variables = _ref.variables,
25
25
  partialVariables = _ref.partialVariables,
26
26
  builtVariables = _ref.builtVariables;
27
- return Object.entries(partialVariables || variables).reduce(function (acc, _ref2) {
27
+ return Object.entries(partialVariables !== null && partialVariables !== void 0 ? partialVariables : variables).reduce(function (acc, _ref2) {
28
28
  var _ref3 = _slicedToArray(_ref2, 2),
29
29
  k = _ref3[0],
30
30
  v = _ref3[1];
@@ -59,7 +59,7 @@ function computeErrors(state) {
59
59
  return (0, _fillComponentExpressions["default"])(component, state);
60
60
  }).filter(function (_ref2) {
61
61
  var conditionFilter = _ref2.conditionFilter;
62
- return conditionFilter !== undefined ? conditionFilter : true;
62
+ return conditionFilter !== null && conditionFilter !== void 0 ? conditionFilter : true;
63
63
  });
64
64
  var errors = validateComponents(state, componentFiltered);
65
65
  var currentErrors = Object.keys(errors).length > 0 ? errors : undefined;
@@ -62,7 +62,6 @@ function createExecuteExpression(variables, features) {
62
62
  // on aimerait map d'expression, avec les bindings
63
63
  var bindings = createBindings(variables);
64
64
  var tokensMap = new Map();
65
- var collectedUpdated = new Map();
66
65
  var _createMemoizer = (0, _createMemoizer3["default"])(),
67
66
  _createMemoizer2 = _slicedToArray(_createMemoizer, 2),
68
67
  memoize = _createMemoizer2[0],
@@ -98,7 +97,6 @@ function createExecuteExpression(variables, features) {
98
97
  function updateBindings(name, value) {
99
98
  if (name in bindings) {
100
99
  bindings[name] = value;
101
- collectedUpdated.set(name, []);
102
100
  }
103
101
  pushToLazy(name);
104
102
  }
@@ -162,8 +160,7 @@ function createExecuteExpression(variables, features) {
162
160
  return dependencies.reduce(function (map, name) {
163
161
  if (name in variables) {
164
162
  var data = variables[name];
165
- var variable = data.variable,
166
- type = data.type;
163
+ var variable = data.variable;
167
164
  if (!(name in map)) {
168
165
  if (variable.variableType === 'CALCULATED') {
169
166
  var _expression = variable.expression;
@@ -24,7 +24,7 @@ var VTL_ATTRIBUTES = ['label', 'options.label', 'responses.label', 'hierarchy.la
24
24
  // Disable controls compilation
25
25
  // 'controls.control',
26
26
  // 'controls.errorMessage',
27
- 'controls.iterations', 'lines.min', 'lines.max', 'iterations', 'xAxisIterations', 'yAxisIterations', 'conditionFilter', 'headers.label', 'header.label', 'questionContext', 'questionInformation'];
27
+ 'controls.iterations', 'lines.min', 'lines.max', 'iterations', 'xAxisIterations', 'yAxisIterations', 'conditionFilter', 'headers.label', 'header.label'];
28
28
 
29
29
  // Utility type to replace all expression from an object into a translated version
30
30
 
@@ -8,6 +8,7 @@ var _storeTools = require("../../utils/store-tools");
8
8
  var _appendToIndex = require("../../utils/suggester-workers/append-to-index");
9
9
  var _excluded = ["idbVersion", "fetch"];
10
10
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
11
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
11
12
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
13
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
14
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -98,59 +99,58 @@ function loadSuggesters() {
98
99
  function _loadSuggesters() {
99
100
  _loadSuggesters = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
100
101
  var suggesters,
101
- _loop,
102
- i,
103
- _args4 = arguments;
104
- return _regeneratorRuntime().wrap(function _callee3$(_context4) {
105
- while (1) switch (_context4.prev = _context4.next) {
102
+ _iterator,
103
+ _step,
104
+ suggester,
105
+ autoLoad,
106
+ _args3 = arguments;
107
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
108
+ while (1) switch (_context3.prev = _context3.next) {
106
109
  case 0:
107
- suggesters = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : [];
108
- _context4.prev = 1;
109
- _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
110
- var suggester, autoLoad, logging;
111
- return _regeneratorRuntime().wrap(function _loop$(_context3) {
112
- while (1) switch (_context3.prev = _context3.next) {
113
- case 0:
114
- logging = function _logging(message) {
115
- //console.log(name, message);
116
- };
117
- suggester = suggesters[i];
118
- autoLoad = suggester.autoLoad;
119
- if (!autoLoad) {
120
- _context3.next = 6;
121
- break;
122
- }
123
- _context3.next = 6;
124
- return loadOne(suggester, logging);
125
- case 6:
126
- case "end":
127
- return _context3.stop();
128
- }
129
- }, _loop);
130
- });
131
- i = 0;
132
- case 4:
133
- if (!(i < suggesters.length)) {
134
- _context4.next = 9;
110
+ suggesters = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : [];
111
+ _context3.prev = 1;
112
+ _iterator = _createForOfIteratorHelper(suggesters);
113
+ _context3.prev = 3;
114
+ _iterator.s();
115
+ case 5:
116
+ if ((_step = _iterator.n()).done) {
117
+ _context3.next = 13;
135
118
  break;
136
119
  }
137
- return _context4.delegateYield(_loop(), "t0", 6);
138
- case 6:
139
- i++;
140
- _context4.next = 4;
120
+ suggester = _step.value;
121
+ autoLoad = suggester.autoLoad;
122
+ if (!autoLoad) {
123
+ _context3.next = 11;
124
+ break;
125
+ }
126
+ _context3.next = 11;
127
+ return loadOne(suggester, function () {});
128
+ case 11:
129
+ _context3.next = 5;
141
130
  break;
142
- case 9:
143
- return _context4.abrupt("return", true);
144
- case 12:
145
- _context4.prev = 12;
146
- _context4.t1 = _context4["catch"](1);
131
+ case 13:
132
+ _context3.next = 18;
133
+ break;
134
+ case 15:
135
+ _context3.prev = 15;
136
+ _context3.t0 = _context3["catch"](3);
137
+ _iterator.e(_context3.t0);
138
+ case 18:
139
+ _context3.prev = 18;
140
+ _iterator.f();
141
+ return _context3.finish(18);
142
+ case 21:
143
+ return _context3.abrupt("return", true);
144
+ case 24:
145
+ _context3.prev = 24;
146
+ _context3.t1 = _context3["catch"](1);
147
147
  console.warn("Une erreur s'est produite lors de l'initialisation des suggesters.");
148
- return _context4.abrupt("return", false);
149
- case 16:
148
+ return _context3.abrupt("return", false);
149
+ case 28:
150
150
  case "end":
151
- return _context4.stop();
151
+ return _context3.stop();
152
152
  }
153
- }, _callee3, null, [[1, 12]]);
153
+ }, _callee3, null, [[1, 24], [3, 15, 18, 21]]);
154
154
  }));
155
155
  return _loadSuggesters.apply(this, arguments);
156
156
  }