@clxmedia/clxforms-client 1.1.6 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/layout-processor.js +9 -4
- package/package.json +2 -2
package/dist/layout-processor.js
CHANGED
|
@@ -85,6 +85,9 @@ const CLXFormLayoutProcessor = ({ mode, responseData, formRights }) => {
|
|
|
85
85
|
};
|
|
86
86
|
};
|
|
87
87
|
const isResponseBooleanTrue = (key) => {
|
|
88
|
+
if (!key) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
88
91
|
const value = responseCopy[key];
|
|
89
92
|
return !!value && value.type === 'BOOLEAN' && value.value;
|
|
90
93
|
};
|
|
@@ -99,11 +102,13 @@ const CLXFormLayoutProcessor = ({ mode, responseData, formRights }) => {
|
|
|
99
102
|
};
|
|
100
103
|
};
|
|
101
104
|
const process = (layout) => {
|
|
105
|
+
var _a;
|
|
102
106
|
if (mode === 'edit') {
|
|
103
107
|
return MockProcessor(layout);
|
|
104
108
|
}
|
|
105
109
|
let isGated = false;
|
|
106
110
|
const isCLXInternalUser = isResponseBooleanTrue('is_clxinternal_user');
|
|
111
|
+
const isGateSatisfied = isCLXInternalUser || isResponseBooleanTrue((_a = layout.form.settings) === null || _a === void 0 ? void 0 : _a.gateSatisfiedResponseSlug);
|
|
107
112
|
let blockedByAi = false;
|
|
108
113
|
const steps = formRights === 'none'
|
|
109
114
|
? []
|
|
@@ -111,20 +116,20 @@ const CLXFormLayoutProcessor = ({ mode, responseData, formRights }) => {
|
|
|
111
116
|
.map(step => stepProcessor(step))
|
|
112
117
|
.filter(step => step.sections.length > 0)
|
|
113
118
|
.reduce((acc, step) => {
|
|
114
|
-
if (isGated && !
|
|
119
|
+
if (isGated && !isGateSatisfied) {
|
|
115
120
|
return acc;
|
|
116
121
|
}
|
|
117
|
-
if (step.has_ai && !
|
|
122
|
+
if (step.has_ai && !isGateSatisfied) {
|
|
118
123
|
blockedByAi = true;
|
|
119
124
|
return acc;
|
|
120
125
|
}
|
|
121
|
-
if (step.is_gate && !
|
|
126
|
+
if (step.is_gate && !isGateSatisfied) {
|
|
122
127
|
isGated = !step.is_complete;
|
|
123
128
|
}
|
|
124
129
|
acc.push(step);
|
|
125
130
|
return acc;
|
|
126
131
|
}, [])
|
|
127
|
-
.filter(step => !step.is_gate ||
|
|
132
|
+
.filter(step => !step.is_gate || isGateSatisfied);
|
|
128
133
|
return { form: layout.form, steps: blockedByAi ? [] : steps, stats: gatherFormStats(steps) };
|
|
129
134
|
};
|
|
130
135
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clxmedia/clxforms-client",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "CLXperience Forms Client",
|
|
5
5
|
"author": "Brandon Thompson <brandont@clxmedia.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"bugs": "https://github.com/adsupnow/xperience-library/clxforms-client",
|
|
45
45
|
"peerDependencies": {},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@clxmedia/types": "1.
|
|
47
|
+
"@clxmedia/types": "1.12.1",
|
|
48
48
|
"luxon": "3.4.4"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|