@clxmedia/clxforms-client 1.1.7 → 1.1.9

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.
@@ -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
  };
@@ -104,6 +107,7 @@ const CLXFormLayoutProcessor = ({ mode, responseData, formRights }) => {
104
107
  }
105
108
  let isGated = false;
106
109
  const isCLXInternalUser = isResponseBooleanTrue('is_clxinternal_user');
110
+ const isGateSatisfied = isResponseBooleanTrue(`cliq_form_gate_satisfied_${layout.form.slug}`);
107
111
  let blockedByAi = false;
108
112
  const steps = formRights === 'none'
109
113
  ? []
@@ -111,20 +115,20 @@ const CLXFormLayoutProcessor = ({ mode, responseData, formRights }) => {
111
115
  .map(step => stepProcessor(step))
112
116
  .filter(step => step.sections.length > 0)
113
117
  .reduce((acc, step) => {
114
- if (isGated && !isCLXInternalUser) {
118
+ if (isGated && !isGateSatisfied && !isCLXInternalUser) {
115
119
  return acc;
116
120
  }
117
- if (step.has_ai && !isCLXInternalUser) {
121
+ if (step.has_ai && !isGateSatisfied && !isCLXInternalUser) {
118
122
  blockedByAi = true;
119
123
  return acc;
120
124
  }
121
- if (step.is_gate && !isCLXInternalUser) {
125
+ if (step.is_gate && !isGateSatisfied && !isCLXInternalUser) {
122
126
  isGated = !step.is_complete;
123
127
  }
124
128
  acc.push(step);
125
129
  return acc;
126
130
  }, [])
127
- .filter(step => !step.is_gate || isCLXInternalUser);
131
+ .filter(step => !step.is_gate || isGateSatisfied || isCLXInternalUser);
128
132
  return { form: layout.form, steps: blockedByAi ? [] : steps, stats: gatherFormStats(steps) };
129
133
  };
130
134
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clxmedia/clxforms-client",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
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.12.0",
47
+ "@clxmedia/types": "1.12.1",
48
48
  "luxon": "3.4.4"
49
49
  },
50
50
  "devDependencies": {