@oneblink/sdk-core 0.2.5 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,19 @@
1
- import { FormTypes, ConditionTypes, SubmissionTypes } from '@oneblink/types';
2
- declare function evaluateConditionalOptionsPredicate({ predicate, predicateElement, submission, }: {
3
- predicate: ConditionTypes.ConditionalPredicateOptions;
4
- submission: SubmissionTypes.S3SubmissionData['submission'];
5
- predicateElement: FormTypes.FormElementWithOptions;
6
- }): boolean;
7
- declare function evaluateConditionalPredicate({ predicate, predicateElement, submission, }: {
8
- predicate: ConditionTypes.ConditionalPredicate;
9
- predicateElement: FormTypes.FormElement;
10
- submission: SubmissionTypes.S3SubmissionData['submission'];
11
- }): boolean;
12
- declare function evaluateConditionalPredicates({ isConditional, requiresAllConditionalPredicates, conditionalPredicates, formElements, submission, }: {
13
- isConditional: boolean;
14
- requiresAllConditionalPredicates: boolean;
15
- conditionalPredicates: ConditionTypes.ConditionalPredicate[];
16
- formElements: FormTypes.FormElement[];
17
- submission: SubmissionTypes.S3SubmissionData['submission'];
18
- }): boolean;
19
- export { evaluateConditionalOptionsPredicate, evaluateConditionalPredicate, evaluateConditionalPredicates, };
1
+ import { FormTypes, ConditionTypes, SubmissionTypes } from '@oneblink/types';
2
+ declare function evaluateConditionalOptionsPredicate({ predicate, predicateElement, submission, }: {
3
+ predicate: ConditionTypes.ConditionalPredicateOptions;
4
+ submission: SubmissionTypes.S3SubmissionData['submission'];
5
+ predicateElement: FormTypes.FormElementWithOptions;
6
+ }): boolean;
7
+ declare function evaluateConditionalPredicate({ predicate, predicateElement, submission, }: {
8
+ predicate: ConditionTypes.ConditionalPredicate;
9
+ predicateElement: FormTypes.FormElement;
10
+ submission: SubmissionTypes.S3SubmissionData['submission'];
11
+ }): boolean;
12
+ declare function evaluateConditionalPredicates({ isConditional, requiresAllConditionalPredicates, conditionalPredicates, formElements, submission, }: {
13
+ isConditional: boolean;
14
+ requiresAllConditionalPredicates: boolean;
15
+ conditionalPredicates: ConditionTypes.ConditionalPredicate[];
16
+ formElements: FormTypes.FormElement[];
17
+ submission: SubmissionTypes.S3SubmissionData['submission'];
18
+ }): boolean;
19
+ export { evaluateConditionalOptionsPredicate, evaluateConditionalPredicate, evaluateConditionalPredicates, };
@@ -1,139 +1,139 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.evaluateConditionalPredicates = exports.evaluateConditionalPredicate = exports.evaluateConditionalOptionsPredicate = void 0;
4
- const fnMap = {
5
- '>': (lhs, rhs) => lhs > rhs,
6
- '>=': (lhs, rhs) => lhs >= rhs,
7
- '===': (lhs, rhs) => lhs === rhs,
8
- '!==': (lhs, rhs) => lhs !== rhs,
9
- '<=': (lhs, rhs) => lhs <= rhs,
10
- '<': (lhs, rhs) => lhs < rhs,
11
- };
12
- function evaluateConditionalOptionsPredicate({ predicate, predicateElement, submission, }) {
13
- return predicate.optionIds.some((optionId) => {
14
- var _a;
15
- const option = (_a = predicateElement.options) === null || _a === void 0 ? void 0 : _a.find((o) => o.id === optionId);
16
- if (option) {
17
- const value = submission[predicateElement.name];
18
- if (Array.isArray(value)) {
19
- return value.some((modelValue) => {
20
- return modelValue === option.value;
21
- });
22
- }
23
- else if (predicateElement.type === 'compliance' && value) {
24
- return option.value === value.value;
25
- }
26
- else {
27
- return option.value === value;
28
- }
29
- }
30
- else {
31
- return false;
32
- }
33
- });
34
- }
35
- exports.evaluateConditionalOptionsPredicate = evaluateConditionalOptionsPredicate;
36
- function evaluateConditionalPredicate({ predicate, predicateElement, submission, }) {
37
- if (!predicateElement ||
38
- predicateElement.type === 'page' ||
39
- predicateElement.type === 'section') {
40
- return false;
41
- }
42
- switch (predicate.type) {
43
- case 'VALUE': {
44
- return !predicate.hasValue === !submission[predicateElement.name];
45
- }
46
- case 'NUMERIC': {
47
- const lhs = Number.parseFloat(submission[predicateElement.name]);
48
- const rhs = typeof predicate.value === 'string'
49
- ? Number.parseFloat(predicate.value)
50
- : predicate.value;
51
- // if either of the values is not a number or the operator fn doesn't exist, hide the control
52
- const operatorFn = fnMap[predicate.operator];
53
- if (!operatorFn || Number.isNaN(lhs) || Number.isNaN(rhs))
54
- return false;
55
- return operatorFn(lhs, rhs);
56
- }
57
- case 'BETWEEN': {
58
- const value = Number.parseFloat(submission[predicateElement.name]);
59
- if (Number.isNaN(value)) {
60
- return false;
61
- }
62
- return value >= predicate.min && value <= predicate.max;
63
- }
64
- case 'OPTIONS':
65
- default: {
66
- if (predicateElement.type !== 'select' &&
67
- predicateElement.type !== 'autocomplete' &&
68
- predicateElement.type !== 'radio' &&
69
- predicateElement.type !== 'checkboxes' &&
70
- predicateElement.type !== 'compliance') {
71
- return false;
72
- }
73
- // If the predicate element does not have any options to evaluate,
74
- // we will show the element.
75
- // Unless the predicate element has dynamic options and
76
- // options have not been fetched yet.
77
- if (!Array.isArray(predicateElement.options)) {
78
- return predicateElement.optionsType !== 'DYNAMIC';
79
- }
80
- else {
81
- return evaluateConditionalOptionsPredicate({
82
- predicate,
83
- submission,
84
- predicateElement,
85
- });
86
- }
87
- }
88
- }
89
- }
90
- exports.evaluateConditionalPredicate = evaluateConditionalPredicate;
91
- const getPredicateElement = (elements, elementId) => {
92
- for (const element of elements) {
93
- if (element.type === 'page' || element.type === 'section') {
94
- const predicateElement = getPredicateElement(element.elements, elementId);
95
- if (predicateElement) {
96
- return predicateElement;
97
- }
98
- }
99
- else if (element.id === elementId) {
100
- return element;
101
- }
102
- }
103
- };
104
- function evaluateConditionalPredicates({ isConditional, requiresAllConditionalPredicates, conditionalPredicates, formElements, submission, }) {
105
- if (!isConditional || !conditionalPredicates.length) {
106
- return true;
107
- }
108
- const predicateResults = [];
109
- for (const predicate of conditionalPredicates) {
110
- const predicateElement = getPredicateElement(formElements, predicate.elementId);
111
- if (!predicateElement) {
112
- throw new Error('Could not find element referenced in execution condition');
113
- }
114
- const predicateIsSatisfied = evaluateConditionalPredicate({
115
- predicate,
116
- predicateElement,
117
- submission,
118
- });
119
- predicateResults.push(predicateIsSatisfied);
120
- if (requiresAllConditionalPredicates) {
121
- if (!predicateIsSatisfied)
122
- break;
123
- }
124
- else {
125
- // Doesn't require all predicates
126
- if (predicateIsSatisfied)
127
- break;
128
- }
129
- }
130
- if (requiresAllConditionalPredicates) {
131
- return !predicateResults.includes(false);
132
- }
133
- else {
134
- // Doesn't require all predicates
135
- return predicateResults.includes(true);
136
- }
137
- }
138
- exports.evaluateConditionalPredicates = evaluateConditionalPredicates;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.evaluateConditionalPredicates = exports.evaluateConditionalPredicate = exports.evaluateConditionalOptionsPredicate = void 0;
4
+ const fnMap = {
5
+ '>': (lhs, rhs) => lhs > rhs,
6
+ '>=': (lhs, rhs) => lhs >= rhs,
7
+ '===': (lhs, rhs) => lhs === rhs,
8
+ '!==': (lhs, rhs) => lhs !== rhs,
9
+ '<=': (lhs, rhs) => lhs <= rhs,
10
+ '<': (lhs, rhs) => lhs < rhs,
11
+ };
12
+ function evaluateConditionalOptionsPredicate({ predicate, predicateElement, submission, }) {
13
+ return predicate.optionIds.some((optionId) => {
14
+ var _a;
15
+ const option = (_a = predicateElement.options) === null || _a === void 0 ? void 0 : _a.find((o) => o.id === optionId);
16
+ if (option) {
17
+ const value = submission[predicateElement.name];
18
+ if (Array.isArray(value)) {
19
+ return value.some((modelValue) => {
20
+ return modelValue === option.value;
21
+ });
22
+ }
23
+ else if (predicateElement.type === 'compliance' && value) {
24
+ return option.value === value.value;
25
+ }
26
+ else {
27
+ return option.value === value;
28
+ }
29
+ }
30
+ else {
31
+ return false;
32
+ }
33
+ });
34
+ }
35
+ exports.evaluateConditionalOptionsPredicate = evaluateConditionalOptionsPredicate;
36
+ function evaluateConditionalPredicate({ predicate, predicateElement, submission, }) {
37
+ if (!predicateElement ||
38
+ predicateElement.type === 'page' ||
39
+ predicateElement.type === 'section') {
40
+ return false;
41
+ }
42
+ switch (predicate.type) {
43
+ case 'VALUE': {
44
+ return !predicate.hasValue === !submission[predicateElement.name];
45
+ }
46
+ case 'NUMERIC': {
47
+ const lhs = Number.parseFloat(submission[predicateElement.name]);
48
+ const rhs = typeof predicate.value === 'string'
49
+ ? Number.parseFloat(predicate.value)
50
+ : predicate.value;
51
+ // if either of the values is not a number or the operator fn doesn't exist, hide the control
52
+ const operatorFn = fnMap[predicate.operator];
53
+ if (!operatorFn || Number.isNaN(lhs) || Number.isNaN(rhs))
54
+ return false;
55
+ return operatorFn(lhs, rhs);
56
+ }
57
+ case 'BETWEEN': {
58
+ const value = Number.parseFloat(submission[predicateElement.name]);
59
+ if (Number.isNaN(value)) {
60
+ return false;
61
+ }
62
+ return value >= predicate.min && value <= predicate.max;
63
+ }
64
+ case 'OPTIONS':
65
+ default: {
66
+ if (predicateElement.type !== 'select' &&
67
+ predicateElement.type !== 'autocomplete' &&
68
+ predicateElement.type !== 'radio' &&
69
+ predicateElement.type !== 'checkboxes' &&
70
+ predicateElement.type !== 'compliance') {
71
+ return false;
72
+ }
73
+ // If the predicate element does not have any options to evaluate,
74
+ // we will show the element.
75
+ // Unless the predicate element has dynamic options and
76
+ // options have not been fetched yet.
77
+ if (!Array.isArray(predicateElement.options)) {
78
+ return predicateElement.optionsType !== 'DYNAMIC';
79
+ }
80
+ else {
81
+ return evaluateConditionalOptionsPredicate({
82
+ predicate,
83
+ submission,
84
+ predicateElement,
85
+ });
86
+ }
87
+ }
88
+ }
89
+ }
90
+ exports.evaluateConditionalPredicate = evaluateConditionalPredicate;
91
+ const getPredicateElement = (elements, elementId) => {
92
+ for (const element of elements) {
93
+ if (element.type === 'page' || element.type === 'section') {
94
+ const predicateElement = getPredicateElement(element.elements, elementId);
95
+ if (predicateElement) {
96
+ return predicateElement;
97
+ }
98
+ }
99
+ else if (element.id === elementId) {
100
+ return element;
101
+ }
102
+ }
103
+ };
104
+ function evaluateConditionalPredicates({ isConditional, requiresAllConditionalPredicates, conditionalPredicates, formElements, submission, }) {
105
+ if (!isConditional || !conditionalPredicates.length) {
106
+ return true;
107
+ }
108
+ const predicateResults = [];
109
+ for (const predicate of conditionalPredicates) {
110
+ const predicateElement = getPredicateElement(formElements, predicate.elementId);
111
+ if (!predicateElement) {
112
+ throw new Error('Could not find element referenced in execution condition');
113
+ }
114
+ const predicateIsSatisfied = evaluateConditionalPredicate({
115
+ predicate,
116
+ predicateElement,
117
+ submission,
118
+ });
119
+ predicateResults.push(predicateIsSatisfied);
120
+ if (requiresAllConditionalPredicates) {
121
+ if (!predicateIsSatisfied)
122
+ break;
123
+ }
124
+ else {
125
+ // Doesn't require all predicates
126
+ if (predicateIsSatisfied)
127
+ break;
128
+ }
129
+ }
130
+ if (requiresAllConditionalPredicates) {
131
+ return !predicateResults.includes(false);
132
+ }
133
+ else {
134
+ // Doesn't require all predicates
135
+ return predicateResults.includes(true);
136
+ }
137
+ }
138
+ exports.evaluateConditionalPredicates = evaluateConditionalPredicates;
139
139
  //# sourceMappingURL=conditionalLogicService.js.map
@@ -1,6 +1,6 @@
1
- import { FormTypes } from '@oneblink/types';
2
- declare function forEachFormElement(elements: FormTypes.FormElement[], forEach: (element: FormTypes.FormElement, elements: FormTypes.FormElement[]) => void): void;
3
- declare function forEachFormElementWithOptions(elements: FormTypes.FormElement[], forEach: (elementWithOptions: FormTypes.FormElementWithOptions, elements: FormTypes.FormElement[]) => void): void;
4
- declare function findFormElement(elements: FormTypes.FormElement[], predicate: (element: FormTypes.FormElement, elements: FormTypes.FormElement[]) => boolean, parentElements?: FormTypes.FormElement[]): FormTypes.FormElement | void;
5
- declare function parseFormElementOptionsSet(data: unknown): FormTypes.ChoiceElementOption[];
6
- export { forEachFormElement, forEachFormElementWithOptions, findFormElement, parseFormElementOptionsSet, };
1
+ import { FormTypes } from '@oneblink/types';
2
+ declare function forEachFormElement(elements: FormTypes.FormElement[], forEach: (element: FormTypes.FormElement, elements: FormTypes.FormElement[]) => void): void;
3
+ declare function forEachFormElementWithOptions(elements: FormTypes.FormElement[], forEach: (elementWithOptions: FormTypes.FormElementWithOptions, elements: FormTypes.FormElement[]) => void): void;
4
+ declare function findFormElement(elements: FormTypes.FormElement[], predicate: (element: FormTypes.FormElement, elements: FormTypes.FormElement[]) => boolean, parentElements?: FormTypes.FormElement[]): FormTypes.FormElement | void;
5
+ declare function parseFormElementOptionsSet(data: unknown): FormTypes.ChoiceElementOption[];
6
+ export { forEachFormElement, forEachFormElementWithOptions, findFormElement, parseFormElementOptionsSet, };
@@ -1,82 +1,82 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseFormElementOptionsSet = exports.findFormElement = exports.forEachFormElementWithOptions = exports.forEachFormElement = void 0;
4
- function forEachFormElement(elements, forEach) {
5
- findFormElement(elements, (formElement, parentElements) => {
6
- forEach(formElement, parentElements);
7
- return false;
8
- });
9
- }
10
- exports.forEachFormElement = forEachFormElement;
11
- function forEachFormElementWithOptions(elements, forEach) {
12
- findFormElement(elements, (formElement, parentElements) => {
13
- if (formElement.type === 'select' ||
14
- formElement.type === 'autocomplete' ||
15
- formElement.type === 'checkboxes' ||
16
- formElement.type === 'radio' ||
17
- formElement.type === 'compliance') {
18
- forEach(formElement, parentElements);
19
- }
20
- return false;
21
- });
22
- }
23
- exports.forEachFormElementWithOptions = forEachFormElementWithOptions;
24
- function findFormElement(elements, predicate, parentElements = []) {
25
- for (const element of elements) {
26
- if (predicate(element, parentElements)) {
27
- return element;
28
- }
29
- if ((element.type === 'repeatableSet' ||
30
- element.type === 'page' ||
31
- element.type === 'form' ||
32
- element.type === 'infoPage' ||
33
- element.type === 'section') &&
34
- Array.isArray(element.elements)) {
35
- const nestedElement = findFormElement(element.elements, predicate, [
36
- ...parentElements,
37
- element,
38
- ]);
39
- if (nestedElement) {
40
- return nestedElement;
41
- }
42
- }
43
- }
44
- }
45
- exports.findFormElement = findFormElement;
46
- function parseFormElementOptionsSet(data) {
47
- if (!Array.isArray(data)) {
48
- return [];
49
- }
50
- return data.reduce((options, record, index) => {
51
- if (typeof record === 'string') {
52
- options.push({
53
- id: index.toString(),
54
- value: record,
55
- label: record,
56
- });
57
- }
58
- else if (typeof record === 'object') {
59
- const option = record;
60
- const value = typeof option.value === 'string' && option.value
61
- ? option.value
62
- : index.toString();
63
- const id = typeof option.id === 'string' && option.id ? option.id : value;
64
- const label = typeof option.label === 'string' && option.label
65
- ? option.label
66
- : value;
67
- const colour = typeof option.colour === 'string' && option.colour
68
- ? option.colour
69
- : undefined;
70
- options.push({
71
- ...option,
72
- id,
73
- value,
74
- label,
75
- colour,
76
- });
77
- }
78
- return options;
79
- }, []);
80
- }
81
- exports.parseFormElementOptionsSet = parseFormElementOptionsSet;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseFormElementOptionsSet = exports.findFormElement = exports.forEachFormElementWithOptions = exports.forEachFormElement = void 0;
4
+ function forEachFormElement(elements, forEach) {
5
+ findFormElement(elements, (formElement, parentElements) => {
6
+ forEach(formElement, parentElements);
7
+ return false;
8
+ });
9
+ }
10
+ exports.forEachFormElement = forEachFormElement;
11
+ function forEachFormElementWithOptions(elements, forEach) {
12
+ findFormElement(elements, (formElement, parentElements) => {
13
+ if (formElement.type === 'select' ||
14
+ formElement.type === 'autocomplete' ||
15
+ formElement.type === 'checkboxes' ||
16
+ formElement.type === 'radio' ||
17
+ formElement.type === 'compliance') {
18
+ forEach(formElement, parentElements);
19
+ }
20
+ return false;
21
+ });
22
+ }
23
+ exports.forEachFormElementWithOptions = forEachFormElementWithOptions;
24
+ function findFormElement(elements, predicate, parentElements = []) {
25
+ for (const element of elements) {
26
+ if (predicate(element, parentElements)) {
27
+ return element;
28
+ }
29
+ if ((element.type === 'repeatableSet' ||
30
+ element.type === 'page' ||
31
+ element.type === 'form' ||
32
+ element.type === 'infoPage' ||
33
+ element.type === 'section') &&
34
+ Array.isArray(element.elements)) {
35
+ const nestedElement = findFormElement(element.elements, predicate, [
36
+ ...parentElements,
37
+ element,
38
+ ]);
39
+ if (nestedElement) {
40
+ return nestedElement;
41
+ }
42
+ }
43
+ }
44
+ }
45
+ exports.findFormElement = findFormElement;
46
+ function parseFormElementOptionsSet(data) {
47
+ if (!Array.isArray(data)) {
48
+ return [];
49
+ }
50
+ return data.reduce((options, record, index) => {
51
+ if (typeof record === 'string') {
52
+ options.push({
53
+ id: index.toString(),
54
+ value: record,
55
+ label: record,
56
+ });
57
+ }
58
+ else if (typeof record === 'object') {
59
+ const option = record;
60
+ const value = typeof option.value === 'string' && option.value
61
+ ? option.value
62
+ : index.toString();
63
+ const id = typeof option.id === 'string' && option.id ? option.id : value;
64
+ const label = typeof option.label === 'string' && option.label
65
+ ? option.label
66
+ : value;
67
+ const colour = typeof option.colour === 'string' && option.colour
68
+ ? option.colour
69
+ : undefined;
70
+ options.push({
71
+ ...option,
72
+ id,
73
+ value,
74
+ label,
75
+ colour,
76
+ });
77
+ }
78
+ return options;
79
+ }, []);
80
+ }
81
+ exports.parseFormElementOptionsSet = parseFormElementOptionsSet;
82
82
  //# sourceMappingURL=formElementsService.js.map
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export * as formElementsService from './formElementsService';
2
- export * as conditionalLogicService from './conditionalLogicService';
3
- import replaceCustomValues, { getElementSubmissionValue } from './replaceCustomValues';
4
- export * as typeCastService from './typeCastService';
5
- export * as userService from './userService';
6
- export { replaceCustomValues, getElementSubmissionValue };
1
+ export * as formElementsService from './formElementsService';
2
+ export * as conditionalLogicService from './conditionalLogicService';
3
+ import replaceCustomValues, { getElementSubmissionValue } from './replaceCustomValues';
4
+ export * as typeCastService from './typeCastService';
5
+ export * as userService from './userService';
6
+ export { replaceCustomValues, getElementSubmissionValue };
package/dist/index.js CHANGED
@@ -1,30 +1,30 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.getElementSubmissionValue = exports.replaceCustomValues = exports.userService = exports.typeCastService = exports.conditionalLogicService = exports.formElementsService = void 0;
23
- exports.formElementsService = __importStar(require("./formElementsService"));
24
- exports.conditionalLogicService = __importStar(require("./conditionalLogicService"));
25
- const replaceCustomValues_1 = __importStar(require("./replaceCustomValues"));
26
- exports.replaceCustomValues = replaceCustomValues_1.default;
27
- Object.defineProperty(exports, "getElementSubmissionValue", { enumerable: true, get: function () { return replaceCustomValues_1.getElementSubmissionValue; } });
28
- exports.typeCastService = __importStar(require("./typeCastService"));
29
- exports.userService = __importStar(require("./userService"));
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.getElementSubmissionValue = exports.replaceCustomValues = exports.userService = exports.typeCastService = exports.conditionalLogicService = exports.formElementsService = void 0;
23
+ exports.formElementsService = __importStar(require("./formElementsService"));
24
+ exports.conditionalLogicService = __importStar(require("./conditionalLogicService"));
25
+ const replaceCustomValues_1 = __importStar(require("./replaceCustomValues"));
26
+ exports.replaceCustomValues = replaceCustomValues_1.default;
27
+ Object.defineProperty(exports, "getElementSubmissionValue", { enumerable: true, get: function () { return replaceCustomValues_1.getElementSubmissionValue; } });
28
+ exports.typeCastService = __importStar(require("./typeCastService"));
29
+ exports.userService = __importStar(require("./userService"));
30
30
  //# sourceMappingURL=index.js.map
@@ -1,25 +1,25 @@
1
- import { FormTypes, SubmissionTypes } from '@oneblink/types';
2
- declare type CustomValuesOptions = {
3
- form: FormTypes.Form;
4
- externalId?: string;
5
- submissionId: string;
6
- submissionTimestamp: string;
7
- formatDate: (value: string) => string;
8
- formatTime: (value: string) => string;
9
- formatNumber: (value: number) => string;
10
- formatCurrency: (value: number) => string;
11
- previousApprovalId?: string;
12
- };
13
- export declare function getElementSubmissionValue({ propertyName, submission, form, formatDate, formatTime, formatNumber, formatCurrency, }: {
14
- propertyName: string;
15
- form: FormTypes.Form;
16
- submission: SubmissionTypes.S3SubmissionData['submission'];
17
- formatDate: (value: string) => string;
18
- formatTime: (value: string) => string;
19
- formatNumber: (value: number) => string;
20
- formatCurrency: (value: number) => string;
21
- }): unknown;
22
- export default function replaceCustomValues(text: string, { form, submission, externalId, submissionId, submissionTimestamp, formatDate, formatTime, formatNumber, formatCurrency, previousApprovalId, }: CustomValuesOptions & {
23
- submission: SubmissionTypes.S3SubmissionData['submission'];
24
- }): string;
25
- export {};
1
+ import { FormTypes, SubmissionTypes } from '@oneblink/types';
2
+ declare type CustomValuesOptions = {
3
+ form: FormTypes.Form;
4
+ externalId?: string;
5
+ submissionId: string;
6
+ submissionTimestamp: string;
7
+ formatDate: (value: string) => string;
8
+ formatTime: (value: string) => string;
9
+ formatNumber: (value: number) => string;
10
+ formatCurrency: (value: number) => string;
11
+ previousApprovalId?: string;
12
+ };
13
+ export declare function getElementSubmissionValue({ propertyName, submission, formElements, formatDate, formatTime, formatNumber, formatCurrency, }: {
14
+ propertyName: string;
15
+ formElements: FormTypes.FormElement[];
16
+ submission: SubmissionTypes.S3SubmissionData['submission'];
17
+ formatDate: (value: string) => string;
18
+ formatTime: (value: string) => string;
19
+ formatNumber: (value: number) => string;
20
+ formatCurrency: (value: number) => string;
21
+ }): unknown;
22
+ export default function replaceCustomValues(text: string, { form, submission, externalId, submissionId, submissionTimestamp, formatDate, formatTime, formatNumber, formatCurrency, previousApprovalId, }: CustomValuesOptions & {
23
+ submission: SubmissionTypes.S3SubmissionData['submission'];
24
+ }): string;
25
+ export {};