@salesforce/lds-adapters-experience-marketing-integration 1.124.2 → 1.124.3

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 (28) hide show
  1. package/dist/es/es2018/experience-marketing-integration.js +889 -889
  2. package/dist/{types → es/es2018/types}/src/generated/adapters/adapter-utils.d.ts +66 -66
  3. package/dist/{types → es/es2018/types}/src/generated/adapters/getForm.d.ts +28 -28
  4. package/dist/{types → es/es2018/types}/src/generated/adapters/saveForm.d.ts +16 -16
  5. package/dist/{types → es/es2018/types}/src/generated/adapters/submitForm.d.ts +17 -17
  6. package/dist/{types → es/es2018/types}/src/generated/artifacts/main.d.ts +3 -3
  7. package/dist/{types → es/es2018/types}/src/generated/artifacts/sfdc.d.ts +6 -6
  8. package/dist/{types → es/es2018/types}/src/generated/resources/getSitesMarketingIntegrationFormsByFormIdAndSiteId.d.ts +17 -17
  9. package/dist/{types → es/es2018/types}/src/generated/resources/postSitesMarketingIntegrationFormsBySiteId.d.ts +16 -16
  10. package/dist/{types → es/es2018/types}/src/generated/resources/postSitesMarketingIntegrationFormsDataByFormIdAndSiteId.d.ts +17 -17
  11. package/dist/{types → es/es2018/types}/src/generated/types/FormFieldInputList.d.ts +30 -30
  12. package/dist/{types → es/es2018/types}/src/generated/types/FormFieldInputRepresentation.d.ts +32 -32
  13. package/dist/{types → es/es2018/types}/src/generated/types/FormFieldList.d.ts +30 -30
  14. package/dist/{types → es/es2018/types}/src/generated/types/FormFieldRepresentation.d.ts +32 -32
  15. package/dist/{types → es/es2018/types}/src/generated/types/FormInputRepresentation.d.ts +36 -36
  16. package/dist/{types → es/es2018/types}/src/generated/types/FormInputWrapperRepresentation.d.ts +30 -30
  17. package/dist/{types → es/es2018/types}/src/generated/types/FormRepresentation.d.ts +49 -49
  18. package/dist/{types → es/es2018/types}/src/generated/types/FormSubmissionFieldInputList.d.ts +30 -30
  19. package/dist/{types → es/es2018/types}/src/generated/types/FormSubmissionFieldInputRepresentation.d.ts +32 -32
  20. package/dist/{types → es/es2018/types}/src/generated/types/FormSubmissionInputRepresentation.d.ts +30 -30
  21. package/dist/{types → es/es2018/types}/src/generated/types/FormSubmissionInputWrapperRepresentation.d.ts +30 -30
  22. package/dist/{types → es/es2018/types}/src/generated/types/FormSubmissionRepresentation.d.ts +39 -39
  23. package/dist/{types → es/es2018/types}/src/generated/types/type-utils.d.ts +39 -39
  24. package/package.json +3 -3
  25. package/sfdc/index.d.ts +1 -1
  26. package/sfdc/index.js +959 -959
  27. package/dist/umd/es2018/experience-marketing-integration.js +0 -944
  28. package/dist/umd/es5/experience-marketing-integration.js +0 -954
@@ -6,929 +6,929 @@
6
6
 
7
7
  import { serializeStructuredKey, StoreKeyMap } from '@luvio/engine';
8
8
 
9
- const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
- const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
11
- const { isArray: ArrayIsArray$1 } = Array;
12
- /**
13
- * Validates an adapter config is well-formed.
14
- * @param config The config to validate.
15
- * @param adapter The adapter validation configuration.
16
- * @param oneOf The keys the config must contain at least one of.
17
- * @throws A TypeError if config doesn't satisfy the adapter's config validation.
18
- */
19
- function validateConfig(config, adapter, oneOf) {
20
- const { displayName } = adapter;
21
- const { required, optional, unsupported } = adapter.parameters;
22
- if (config === undefined ||
23
- required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
24
- throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
25
- }
26
- if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
27
- throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
28
- }
29
- if (unsupported !== undefined &&
30
- unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
31
- throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
32
- }
33
- const supported = required.concat(optional);
34
- if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
35
- throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
36
- }
37
- }
38
- function untrustedIsObject(untrusted) {
39
- return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
40
- }
41
- function areRequiredParametersPresent(config, configPropertyNames) {
42
- return configPropertyNames.parameters.required.every(req => req in config);
43
- }
44
- const snapshotRefreshOptions = {
45
- overrides: {
46
- headers: {
47
- 'Cache-Control': 'no-cache',
48
- },
49
- }
50
- };
9
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
+ const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
11
+ const { isArray: ArrayIsArray$1 } = Array;
12
+ /**
13
+ * Validates an adapter config is well-formed.
14
+ * @param config The config to validate.
15
+ * @param adapter The adapter validation configuration.
16
+ * @param oneOf The keys the config must contain at least one of.
17
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
18
+ */
19
+ function validateConfig(config, adapter, oneOf) {
20
+ const { displayName } = adapter;
21
+ const { required, optional, unsupported } = adapter.parameters;
22
+ if (config === undefined ||
23
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
24
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
25
+ }
26
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
27
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
28
+ }
29
+ if (unsupported !== undefined &&
30
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
31
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
32
+ }
33
+ const supported = required.concat(optional);
34
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
35
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
36
+ }
37
+ }
38
+ function untrustedIsObject(untrusted) {
39
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
40
+ }
41
+ function areRequiredParametersPresent(config, configPropertyNames) {
42
+ return configPropertyNames.parameters.required.every(req => req in config);
43
+ }
44
+ const snapshotRefreshOptions = {
45
+ overrides: {
46
+ headers: {
47
+ 'Cache-Control': 'no-cache',
48
+ },
49
+ }
50
+ };
51
51
  const keyPrefix = 'marketing-integration';
52
52
 
53
- const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
54
- const { isArray: ArrayIsArray } = Array;
55
- function equalsArray(a, b, equalsItem) {
56
- const aLength = a.length;
57
- const bLength = b.length;
58
- if (aLength !== bLength) {
59
- return false;
60
- }
61
- for (let i = 0; i < aLength; i++) {
62
- if (equalsItem(a[i], b[i]) === false) {
63
- return false;
64
- }
65
- }
66
- return true;
67
- }
68
- function deepFreeze(value) {
69
- // No need to freeze primitives
70
- if (typeof value !== 'object' || value === null) {
71
- return;
72
- }
73
- if (ArrayIsArray(value)) {
74
- for (let i = 0, len = value.length; i < len; i += 1) {
75
- deepFreeze(value[i]);
76
- }
77
- }
78
- else {
79
- const keys = ObjectKeys(value);
80
- for (let i = 0, len = keys.length; i < len; i += 1) {
81
- deepFreeze(value[keys[i]]);
82
- }
83
- }
84
- ObjectFreeze(value);
85
- }
86
- function createLink(ref) {
87
- return {
88
- __ref: serializeStructuredKey(ref),
89
- };
53
+ const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
54
+ const { isArray: ArrayIsArray } = Array;
55
+ function equalsArray(a, b, equalsItem) {
56
+ const aLength = a.length;
57
+ const bLength = b.length;
58
+ if (aLength !== bLength) {
59
+ return false;
60
+ }
61
+ for (let i = 0; i < aLength; i++) {
62
+ if (equalsItem(a[i], b[i]) === false) {
63
+ return false;
64
+ }
65
+ }
66
+ return true;
67
+ }
68
+ function deepFreeze(value) {
69
+ // No need to freeze primitives
70
+ if (typeof value !== 'object' || value === null) {
71
+ return;
72
+ }
73
+ if (ArrayIsArray(value)) {
74
+ for (let i = 0, len = value.length; i < len; i += 1) {
75
+ deepFreeze(value[i]);
76
+ }
77
+ }
78
+ else {
79
+ const keys = ObjectKeys(value);
80
+ for (let i = 0, len = keys.length; i < len; i += 1) {
81
+ deepFreeze(value[keys[i]]);
82
+ }
83
+ }
84
+ ObjectFreeze(value);
85
+ }
86
+ function createLink(ref) {
87
+ return {
88
+ __ref: serializeStructuredKey(ref),
89
+ };
90
90
  }
91
91
 
92
- function validate$9(obj, path = 'FormFieldInputRepresentation') {
93
- const v_error = (() => {
94
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
95
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
96
- }
97
- const obj_name = obj.name;
98
- const path_name = path + '.name';
99
- if (typeof obj_name !== 'string') {
100
- return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
101
- }
102
- const obj_type = obj.type;
103
- const path_type = path + '.type';
104
- if (typeof obj_type !== 'string') {
105
- return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
106
- }
107
- })();
108
- return v_error === undefined ? null : v_error;
92
+ function validate$9(obj, path = 'FormFieldInputRepresentation') {
93
+ const v_error = (() => {
94
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
95
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
96
+ }
97
+ const obj_name = obj.name;
98
+ const path_name = path + '.name';
99
+ if (typeof obj_name !== 'string') {
100
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
101
+ }
102
+ const obj_type = obj.type;
103
+ const path_type = path + '.type';
104
+ if (typeof obj_type !== 'string') {
105
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
106
+ }
107
+ })();
108
+ return v_error === undefined ? null : v_error;
109
109
  }
110
110
 
111
- function validate$8(obj, path = 'FormFieldInputList') {
112
- const v_error = (() => {
113
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
114
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
115
- }
116
- const obj_formFields = obj.formFields;
117
- const path_formFields = path + '.formFields';
118
- if (!ArrayIsArray(obj_formFields)) {
119
- return new TypeError('Expected "array" but received "' + typeof obj_formFields + '" (at "' + path_formFields + '")');
120
- }
121
- for (let i = 0; i < obj_formFields.length; i++) {
122
- const obj_formFields_item = obj_formFields[i];
123
- const path_formFields_item = path_formFields + '[' + i + ']';
124
- const referencepath_formFields_itemValidationError = validate$9(obj_formFields_item, path_formFields_item);
125
- if (referencepath_formFields_itemValidationError !== null) {
126
- let message = 'Object doesn\'t match FormFieldInputRepresentation (at "' + path_formFields_item + '")\n';
127
- message += referencepath_formFields_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
128
- return new TypeError(message);
129
- }
130
- }
131
- })();
132
- return v_error === undefined ? null : v_error;
111
+ function validate$8(obj, path = 'FormFieldInputList') {
112
+ const v_error = (() => {
113
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
114
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
115
+ }
116
+ const obj_formFields = obj.formFields;
117
+ const path_formFields = path + '.formFields';
118
+ if (!ArrayIsArray(obj_formFields)) {
119
+ return new TypeError('Expected "array" but received "' + typeof obj_formFields + '" (at "' + path_formFields + '")');
120
+ }
121
+ for (let i = 0; i < obj_formFields.length; i++) {
122
+ const obj_formFields_item = obj_formFields[i];
123
+ const path_formFields_item = path_formFields + '[' + i + ']';
124
+ const referencepath_formFields_itemValidationError = validate$9(obj_formFields_item, path_formFields_item);
125
+ if (referencepath_formFields_itemValidationError !== null) {
126
+ let message = 'Object doesn\'t match FormFieldInputRepresentation (at "' + path_formFields_item + '")\n';
127
+ message += referencepath_formFields_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
128
+ return new TypeError(message);
129
+ }
130
+ }
131
+ })();
132
+ return v_error === undefined ? null : v_error;
133
133
  }
134
134
 
135
- function validate$7(obj, path = 'FormInputRepresentation') {
136
- const v_error = (() => {
137
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
138
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
139
- }
140
- const obj_formFieldsList = obj.formFieldsList;
141
- const path_formFieldsList = path + '.formFieldsList';
142
- const referencepath_formFieldsListValidationError = validate$8(obj_formFieldsList, path_formFieldsList);
143
- if (referencepath_formFieldsListValidationError !== null) {
144
- let message = 'Object doesn\'t match FormFieldInputList (at "' + path_formFieldsList + '")\n';
145
- message += referencepath_formFieldsListValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
146
- return new TypeError(message);
147
- }
148
- const obj_formName = obj.formName;
149
- const path_formName = path + '.formName';
150
- if (typeof obj_formName !== 'string') {
151
- return new TypeError('Expected "string" but received "' + typeof obj_formName + '" (at "' + path_formName + '")');
152
- }
153
- const obj_memberIdentificationCode = obj.memberIdentificationCode;
154
- const path_memberIdentificationCode = path + '.memberIdentificationCode';
155
- if (typeof obj_memberIdentificationCode !== 'string') {
156
- return new TypeError('Expected "string" but received "' + typeof obj_memberIdentificationCode + '" (at "' + path_memberIdentificationCode + '")');
157
- }
158
- })();
159
- return v_error === undefined ? null : v_error;
135
+ function validate$7(obj, path = 'FormInputRepresentation') {
136
+ const v_error = (() => {
137
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
138
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
139
+ }
140
+ const obj_formFieldsList = obj.formFieldsList;
141
+ const path_formFieldsList = path + '.formFieldsList';
142
+ const referencepath_formFieldsListValidationError = validate$8(obj_formFieldsList, path_formFieldsList);
143
+ if (referencepath_formFieldsListValidationError !== null) {
144
+ let message = 'Object doesn\'t match FormFieldInputList (at "' + path_formFieldsList + '")\n';
145
+ message += referencepath_formFieldsListValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
146
+ return new TypeError(message);
147
+ }
148
+ const obj_formName = obj.formName;
149
+ const path_formName = path + '.formName';
150
+ if (typeof obj_formName !== 'string') {
151
+ return new TypeError('Expected "string" but received "' + typeof obj_formName + '" (at "' + path_formName + '")');
152
+ }
153
+ const obj_memberIdentificationCode = obj.memberIdentificationCode;
154
+ const path_memberIdentificationCode = path + '.memberIdentificationCode';
155
+ if (typeof obj_memberIdentificationCode !== 'string') {
156
+ return new TypeError('Expected "string" but received "' + typeof obj_memberIdentificationCode + '" (at "' + path_memberIdentificationCode + '")');
157
+ }
158
+ })();
159
+ return v_error === undefined ? null : v_error;
160
160
  }
161
161
 
162
- const VERSION$3 = "dbb6d8636675e188a8a1a56ad6dead24";
163
- function validate$6(obj, path = 'FormFieldRepresentation') {
164
- const v_error = (() => {
165
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
166
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
167
- }
168
- const obj_name = obj.name;
169
- const path_name = path + '.name';
170
- if (typeof obj_name !== 'string') {
171
- return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
172
- }
173
- const obj_type = obj.type;
174
- const path_type = path + '.type';
175
- if (typeof obj_type !== 'string') {
176
- return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
177
- }
178
- })();
179
- return v_error === undefined ? null : v_error;
180
- }
181
- const select$6 = function FormFieldRepresentationSelect() {
182
- return {
183
- kind: 'Fragment',
184
- version: VERSION$3,
185
- private: [],
186
- selections: [
187
- {
188
- name: 'name',
189
- kind: 'Scalar'
190
- },
191
- {
192
- name: 'type',
193
- kind: 'Scalar'
194
- }
195
- ]
196
- };
197
- };
198
- function equals$3(existing, incoming) {
199
- const existing_name = existing.name;
200
- const incoming_name = incoming.name;
201
- if (!(existing_name === incoming_name)) {
202
- return false;
203
- }
204
- const existing_type = existing.type;
205
- const incoming_type = incoming.type;
206
- if (!(existing_type === incoming_type)) {
207
- return false;
208
- }
209
- return true;
162
+ const VERSION$3 = "dbb6d8636675e188a8a1a56ad6dead24";
163
+ function validate$6(obj, path = 'FormFieldRepresentation') {
164
+ const v_error = (() => {
165
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
166
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
167
+ }
168
+ const obj_name = obj.name;
169
+ const path_name = path + '.name';
170
+ if (typeof obj_name !== 'string') {
171
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
172
+ }
173
+ const obj_type = obj.type;
174
+ const path_type = path + '.type';
175
+ if (typeof obj_type !== 'string') {
176
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
177
+ }
178
+ })();
179
+ return v_error === undefined ? null : v_error;
180
+ }
181
+ const select$6 = function FormFieldRepresentationSelect() {
182
+ return {
183
+ kind: 'Fragment',
184
+ version: VERSION$3,
185
+ private: [],
186
+ selections: [
187
+ {
188
+ name: 'name',
189
+ kind: 'Scalar'
190
+ },
191
+ {
192
+ name: 'type',
193
+ kind: 'Scalar'
194
+ }
195
+ ]
196
+ };
197
+ };
198
+ function equals$3(existing, incoming) {
199
+ const existing_name = existing.name;
200
+ const incoming_name = incoming.name;
201
+ if (!(existing_name === incoming_name)) {
202
+ return false;
203
+ }
204
+ const existing_type = existing.type;
205
+ const incoming_type = incoming.type;
206
+ if (!(existing_type === incoming_type)) {
207
+ return false;
208
+ }
209
+ return true;
210
210
  }
211
211
 
212
- const VERSION$2 = "8bc86c34b586e7b5050caa1c4c45a801";
213
- function validate$5(obj, path = 'FormFieldList') {
214
- const v_error = (() => {
215
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
216
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
217
- }
218
- const obj_formFields = obj.formFields;
219
- const path_formFields = path + '.formFields';
220
- if (!ArrayIsArray(obj_formFields)) {
221
- return new TypeError('Expected "array" but received "' + typeof obj_formFields + '" (at "' + path_formFields + '")');
222
- }
223
- for (let i = 0; i < obj_formFields.length; i++) {
224
- const obj_formFields_item = obj_formFields[i];
225
- const path_formFields_item = path_formFields + '[' + i + ']';
226
- const referencepath_formFields_itemValidationError = validate$6(obj_formFields_item, path_formFields_item);
227
- if (referencepath_formFields_itemValidationError !== null) {
228
- let message = 'Object doesn\'t match FormFieldRepresentation (at "' + path_formFields_item + '")\n';
229
- message += referencepath_formFields_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
230
- return new TypeError(message);
231
- }
232
- }
233
- })();
234
- return v_error === undefined ? null : v_error;
235
- }
236
- const select$5 = function FormFieldListSelect() {
237
- const { selections: FormFieldRepresentation__selections, opaque: FormFieldRepresentation__opaque, } = select$6();
238
- return {
239
- kind: 'Fragment',
240
- version: VERSION$2,
241
- private: [],
242
- selections: [
243
- {
244
- name: 'formFields',
245
- kind: 'Object',
246
- plural: true,
247
- selections: FormFieldRepresentation__selections
248
- }
249
- ]
250
- };
251
- };
252
- function equals$2(existing, incoming) {
253
- const existing_formFields = existing.formFields;
254
- const incoming_formFields = incoming.formFields;
255
- const equals_formFields_items = equalsArray(existing_formFields, incoming_formFields, (existing_formFields_item, incoming_formFields_item) => {
256
- if (!(equals$3(existing_formFields_item, incoming_formFields_item))) {
257
- return false;
258
- }
259
- });
260
- if (equals_formFields_items === false) {
261
- return false;
262
- }
263
- return true;
212
+ const VERSION$2 = "8bc86c34b586e7b5050caa1c4c45a801";
213
+ function validate$5(obj, path = 'FormFieldList') {
214
+ const v_error = (() => {
215
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
216
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
217
+ }
218
+ const obj_formFields = obj.formFields;
219
+ const path_formFields = path + '.formFields';
220
+ if (!ArrayIsArray(obj_formFields)) {
221
+ return new TypeError('Expected "array" but received "' + typeof obj_formFields + '" (at "' + path_formFields + '")');
222
+ }
223
+ for (let i = 0; i < obj_formFields.length; i++) {
224
+ const obj_formFields_item = obj_formFields[i];
225
+ const path_formFields_item = path_formFields + '[' + i + ']';
226
+ const referencepath_formFields_itemValidationError = validate$6(obj_formFields_item, path_formFields_item);
227
+ if (referencepath_formFields_itemValidationError !== null) {
228
+ let message = 'Object doesn\'t match FormFieldRepresentation (at "' + path_formFields_item + '")\n';
229
+ message += referencepath_formFields_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
230
+ return new TypeError(message);
231
+ }
232
+ }
233
+ })();
234
+ return v_error === undefined ? null : v_error;
235
+ }
236
+ const select$5 = function FormFieldListSelect() {
237
+ const { selections: FormFieldRepresentation__selections, opaque: FormFieldRepresentation__opaque, } = select$6();
238
+ return {
239
+ kind: 'Fragment',
240
+ version: VERSION$2,
241
+ private: [],
242
+ selections: [
243
+ {
244
+ name: 'formFields',
245
+ kind: 'Object',
246
+ plural: true,
247
+ selections: FormFieldRepresentation__selections
248
+ }
249
+ ]
250
+ };
251
+ };
252
+ function equals$2(existing, incoming) {
253
+ const existing_formFields = existing.formFields;
254
+ const incoming_formFields = incoming.formFields;
255
+ const equals_formFields_items = equalsArray(existing_formFields, incoming_formFields, (existing_formFields_item, incoming_formFields_item) => {
256
+ if (!(equals$3(existing_formFields_item, incoming_formFields_item))) {
257
+ return false;
258
+ }
259
+ });
260
+ if (equals_formFields_items === false) {
261
+ return false;
262
+ }
263
+ return true;
264
264
  }
265
265
 
266
- const TTL$1 = 30000;
267
- const VERSION$1 = "3c88c4c66505e9fa43c3198e8e40cd5d";
268
- function validate$4(obj, path = 'FormRepresentation') {
269
- const v_error = (() => {
270
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
271
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
272
- }
273
- const obj_dataExtensionId = obj.dataExtensionId;
274
- const path_dataExtensionId = path + '.dataExtensionId';
275
- if (typeof obj_dataExtensionId !== 'string') {
276
- return new TypeError('Expected "string" but received "' + typeof obj_dataExtensionId + '" (at "' + path_dataExtensionId + '")');
277
- }
278
- const obj_formFieldsList = obj.formFieldsList;
279
- const path_formFieldsList = path + '.formFieldsList';
280
- const referencepath_formFieldsListValidationError = validate$5(obj_formFieldsList, path_formFieldsList);
281
- if (referencepath_formFieldsListValidationError !== null) {
282
- let message = 'Object doesn\'t match FormFieldList (at "' + path_formFieldsList + '")\n';
283
- message += referencepath_formFieldsListValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
284
- return new TypeError(message);
285
- }
286
- const obj_formId = obj.formId;
287
- const path_formId = path + '.formId';
288
- if (typeof obj_formId !== 'string') {
289
- return new TypeError('Expected "string" but received "' + typeof obj_formId + '" (at "' + path_formId + '")');
290
- }
291
- const obj_formName = obj.formName;
292
- const path_formName = path + '.formName';
293
- if (typeof obj_formName !== 'string') {
294
- return new TypeError('Expected "string" but received "' + typeof obj_formName + '" (at "' + path_formName + '")');
295
- }
296
- })();
297
- return v_error === undefined ? null : v_error;
298
- }
299
- const RepresentationType$1 = 'FormRepresentation';
300
- function keyBuilder$3(luvio, config) {
301
- return keyPrefix + '::' + RepresentationType$1 + ':' + config.form_id;
302
- }
303
- function keyBuilderFromType$1(luvio, object) {
304
- const keyParams = {
305
- form_id: object.formId
306
- };
307
- return keyBuilder$3(luvio, keyParams);
308
- }
309
- function normalize$1(input, existing, path, luvio, store, timestamp) {
310
- return input;
311
- }
312
- const select$4 = function FormRepresentationSelect() {
313
- const { selections: FormFieldList__selections, opaque: FormFieldList__opaque, } = select$5();
314
- return {
315
- kind: 'Fragment',
316
- version: VERSION$1,
317
- private: [],
318
- selections: [
319
- {
320
- name: 'dataExtensionId',
321
- kind: 'Scalar'
322
- },
323
- {
324
- name: 'formFieldsList',
325
- kind: 'Object',
326
- selections: FormFieldList__selections
327
- },
328
- {
329
- name: 'formId',
330
- kind: 'Scalar'
331
- },
332
- {
333
- name: 'formName',
334
- kind: 'Scalar'
335
- }
336
- ]
337
- };
338
- };
339
- function equals$1(existing, incoming) {
340
- const existing_dataExtensionId = existing.dataExtensionId;
341
- const incoming_dataExtensionId = incoming.dataExtensionId;
342
- if (!(existing_dataExtensionId === incoming_dataExtensionId)) {
343
- return false;
344
- }
345
- const existing_formId = existing.formId;
346
- const incoming_formId = incoming.formId;
347
- if (!(existing_formId === incoming_formId)) {
348
- return false;
349
- }
350
- const existing_formName = existing.formName;
351
- const incoming_formName = incoming.formName;
352
- if (!(existing_formName === incoming_formName)) {
353
- return false;
354
- }
355
- const existing_formFieldsList = existing.formFieldsList;
356
- const incoming_formFieldsList = incoming.formFieldsList;
357
- if (!(equals$2(existing_formFieldsList, incoming_formFieldsList))) {
358
- return false;
359
- }
360
- return true;
361
- }
362
- const ingest$1 = function FormRepresentationIngest(input, path, luvio, store, timestamp) {
363
- if (process.env.NODE_ENV !== 'production') {
364
- const validateError = validate$4(input);
365
- if (validateError !== null) {
366
- throw validateError;
367
- }
368
- }
369
- const key = keyBuilderFromType$1(luvio, input);
370
- const existingRecord = store.readEntry(key);
371
- const ttlToUse = TTL$1;
372
- let incomingRecord = normalize$1(input, store.readEntry(key), {
373
- fullPath: key,
374
- parent: path.parent,
375
- propertyName: path.propertyName,
376
- ttl: ttlToUse
377
- });
378
- if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
379
- luvio.storePublish(key, incomingRecord);
380
- }
381
- {
382
- const storeMetadataParams = {
383
- ttl: ttlToUse,
384
- namespace: "marketing-integration",
385
- version: VERSION$1,
386
- representationName: RepresentationType$1,
387
- };
388
- luvio.publishStoreMetadata(key, storeMetadataParams);
389
- }
390
- return createLink(key);
391
- };
392
- function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
393
- const rootKeySet = new StoreKeyMap();
394
- // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
395
- const rootKey = keyBuilderFromType$1(luvio, input);
396
- rootKeySet.set(rootKey, {
397
- namespace: keyPrefix,
398
- representationName: RepresentationType$1,
399
- mergeable: false
400
- });
401
- return rootKeySet;
266
+ const TTL$1 = 30000;
267
+ const VERSION$1 = "3c88c4c66505e9fa43c3198e8e40cd5d";
268
+ function validate$4(obj, path = 'FormRepresentation') {
269
+ const v_error = (() => {
270
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
271
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
272
+ }
273
+ const obj_dataExtensionId = obj.dataExtensionId;
274
+ const path_dataExtensionId = path + '.dataExtensionId';
275
+ if (typeof obj_dataExtensionId !== 'string') {
276
+ return new TypeError('Expected "string" but received "' + typeof obj_dataExtensionId + '" (at "' + path_dataExtensionId + '")');
277
+ }
278
+ const obj_formFieldsList = obj.formFieldsList;
279
+ const path_formFieldsList = path + '.formFieldsList';
280
+ const referencepath_formFieldsListValidationError = validate$5(obj_formFieldsList, path_formFieldsList);
281
+ if (referencepath_formFieldsListValidationError !== null) {
282
+ let message = 'Object doesn\'t match FormFieldList (at "' + path_formFieldsList + '")\n';
283
+ message += referencepath_formFieldsListValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
284
+ return new TypeError(message);
285
+ }
286
+ const obj_formId = obj.formId;
287
+ const path_formId = path + '.formId';
288
+ if (typeof obj_formId !== 'string') {
289
+ return new TypeError('Expected "string" but received "' + typeof obj_formId + '" (at "' + path_formId + '")');
290
+ }
291
+ const obj_formName = obj.formName;
292
+ const path_formName = path + '.formName';
293
+ if (typeof obj_formName !== 'string') {
294
+ return new TypeError('Expected "string" but received "' + typeof obj_formName + '" (at "' + path_formName + '")');
295
+ }
296
+ })();
297
+ return v_error === undefined ? null : v_error;
298
+ }
299
+ const RepresentationType$1 = 'FormRepresentation';
300
+ function keyBuilder$3(luvio, config) {
301
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.form_id;
302
+ }
303
+ function keyBuilderFromType$1(luvio, object) {
304
+ const keyParams = {
305
+ form_id: object.formId
306
+ };
307
+ return keyBuilder$3(luvio, keyParams);
308
+ }
309
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
310
+ return input;
311
+ }
312
+ const select$4 = function FormRepresentationSelect() {
313
+ const { selections: FormFieldList__selections, opaque: FormFieldList__opaque, } = select$5();
314
+ return {
315
+ kind: 'Fragment',
316
+ version: VERSION$1,
317
+ private: [],
318
+ selections: [
319
+ {
320
+ name: 'dataExtensionId',
321
+ kind: 'Scalar'
322
+ },
323
+ {
324
+ name: 'formFieldsList',
325
+ kind: 'Object',
326
+ selections: FormFieldList__selections
327
+ },
328
+ {
329
+ name: 'formId',
330
+ kind: 'Scalar'
331
+ },
332
+ {
333
+ name: 'formName',
334
+ kind: 'Scalar'
335
+ }
336
+ ]
337
+ };
338
+ };
339
+ function equals$1(existing, incoming) {
340
+ const existing_dataExtensionId = existing.dataExtensionId;
341
+ const incoming_dataExtensionId = incoming.dataExtensionId;
342
+ if (!(existing_dataExtensionId === incoming_dataExtensionId)) {
343
+ return false;
344
+ }
345
+ const existing_formId = existing.formId;
346
+ const incoming_formId = incoming.formId;
347
+ if (!(existing_formId === incoming_formId)) {
348
+ return false;
349
+ }
350
+ const existing_formName = existing.formName;
351
+ const incoming_formName = incoming.formName;
352
+ if (!(existing_formName === incoming_formName)) {
353
+ return false;
354
+ }
355
+ const existing_formFieldsList = existing.formFieldsList;
356
+ const incoming_formFieldsList = incoming.formFieldsList;
357
+ if (!(equals$2(existing_formFieldsList, incoming_formFieldsList))) {
358
+ return false;
359
+ }
360
+ return true;
361
+ }
362
+ const ingest$1 = function FormRepresentationIngest(input, path, luvio, store, timestamp) {
363
+ if (process.env.NODE_ENV !== 'production') {
364
+ const validateError = validate$4(input);
365
+ if (validateError !== null) {
366
+ throw validateError;
367
+ }
368
+ }
369
+ const key = keyBuilderFromType$1(luvio, input);
370
+ const existingRecord = store.readEntry(key);
371
+ const ttlToUse = TTL$1;
372
+ let incomingRecord = normalize$1(input, store.readEntry(key), {
373
+ fullPath: key,
374
+ parent: path.parent,
375
+ propertyName: path.propertyName,
376
+ ttl: ttlToUse
377
+ });
378
+ if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
379
+ luvio.storePublish(key, incomingRecord);
380
+ }
381
+ {
382
+ const storeMetadataParams = {
383
+ ttl: ttlToUse,
384
+ namespace: "marketing-integration",
385
+ version: VERSION$1,
386
+ representationName: RepresentationType$1,
387
+ };
388
+ luvio.publishStoreMetadata(key, storeMetadataParams);
389
+ }
390
+ return createLink(key);
391
+ };
392
+ function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
393
+ const rootKeySet = new StoreKeyMap();
394
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
395
+ const rootKey = keyBuilderFromType$1(luvio, input);
396
+ rootKeySet.set(rootKey, {
397
+ namespace: keyPrefix,
398
+ representationName: RepresentationType$1,
399
+ mergeable: false
400
+ });
401
+ return rootKeySet;
402
402
  }
403
403
 
404
- function select$3(luvio, params) {
405
- return select$4();
406
- }
407
- function getResponseCacheKeys$2(luvio, resourceParams, response) {
408
- return getTypeCacheKeys$1(luvio, response);
409
- }
410
- function ingestSuccess$2(luvio, resourceParams, response) {
411
- const { body } = response;
412
- const key = keyBuilderFromType$1(luvio, body);
413
- luvio.storeIngest(key, ingest$1, body);
414
- const snapshot = luvio.storeLookup({
415
- recordId: key,
416
- node: select$3(),
417
- variables: {},
418
- });
419
- if (process.env.NODE_ENV !== 'production') {
420
- if (snapshot.state !== 'Fulfilled') {
421
- throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
422
- }
423
- }
424
- return snapshot;
425
- }
426
- function createResourceRequest$2(config) {
427
- const headers = {};
428
- return {
429
- baseUri: '/services/data/v58.0',
430
- basePath: '/sites/' + config.urlParams.siteId + '/marketing-integration/forms',
431
- method: 'post',
432
- body: config.body,
433
- urlParams: config.urlParams,
434
- queryParams: {},
435
- headers,
436
- priority: 'normal',
437
- };
404
+ function select$3(luvio, params) {
405
+ return select$4();
406
+ }
407
+ function getResponseCacheKeys$2(luvio, resourceParams, response) {
408
+ return getTypeCacheKeys$1(luvio, response);
409
+ }
410
+ function ingestSuccess$2(luvio, resourceParams, response) {
411
+ const { body } = response;
412
+ const key = keyBuilderFromType$1(luvio, body);
413
+ luvio.storeIngest(key, ingest$1, body);
414
+ const snapshot = luvio.storeLookup({
415
+ recordId: key,
416
+ node: select$3(),
417
+ variables: {},
418
+ });
419
+ if (process.env.NODE_ENV !== 'production') {
420
+ if (snapshot.state !== 'Fulfilled') {
421
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
422
+ }
423
+ }
424
+ return snapshot;
425
+ }
426
+ function createResourceRequest$2(config) {
427
+ const headers = {};
428
+ return {
429
+ baseUri: '/services/data/v58.0',
430
+ basePath: '/sites/' + config.urlParams.siteId + '/marketing-integration/forms',
431
+ method: 'post',
432
+ body: config.body,
433
+ urlParams: config.urlParams,
434
+ queryParams: {},
435
+ headers,
436
+ priority: 'normal',
437
+ };
438
438
  }
439
439
 
440
- const saveForm_ConfigPropertyNames = {
441
- displayName: 'saveForm',
442
- parameters: {
443
- required: ['siteId', 'formInput'],
444
- optional: []
445
- }
446
- };
447
- function createResourceParams$2(config) {
448
- const resourceParams = {
449
- urlParams: {
450
- siteId: config.siteId
451
- },
452
- body: {
453
- formInput: config.formInput
454
- }
455
- };
456
- return resourceParams;
457
- }
458
- function typeCheckConfig$2(untrustedConfig) {
459
- const config = {};
460
- const untrustedConfig_siteId = untrustedConfig.siteId;
461
- if (typeof untrustedConfig_siteId === 'string') {
462
- config.siteId = untrustedConfig_siteId;
463
- }
464
- const untrustedConfig_formInput = untrustedConfig.formInput;
465
- const referenceFormInputRepresentationValidationError = validate$7(untrustedConfig_formInput);
466
- if (referenceFormInputRepresentationValidationError === null) {
467
- config.formInput = untrustedConfig_formInput;
468
- }
469
- return config;
470
- }
471
- function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
472
- if (!untrustedIsObject(untrustedConfig)) {
473
- return null;
474
- }
475
- if (process.env.NODE_ENV !== 'production') {
476
- validateConfig(untrustedConfig, configPropertyNames);
477
- }
478
- const config = typeCheckConfig$2(untrustedConfig);
479
- if (!areRequiredParametersPresent(config, configPropertyNames)) {
480
- return null;
481
- }
482
- return config;
483
- }
484
- function buildNetworkSnapshot$2(luvio, config, options) {
485
- const resourceParams = createResourceParams$2(config);
486
- const request = createResourceRequest$2(resourceParams);
487
- return luvio.dispatchResourceRequest(request, options)
488
- .then((response) => {
489
- return luvio.handleSuccessResponse(() => {
490
- const snapshot = ingestSuccess$2(luvio, resourceParams, response);
491
- return luvio.storeBroadcast().then(() => snapshot);
492
- }, () => getResponseCacheKeys$2(luvio, resourceParams, response.body));
493
- }, (response) => {
494
- deepFreeze(response);
495
- throw response;
496
- });
497
- }
498
- const saveFormAdapterFactory = (luvio) => {
499
- return function saveForm(untrustedConfig) {
500
- const config = validateAdapterConfig$2(untrustedConfig, saveForm_ConfigPropertyNames);
501
- // Invalid or incomplete config
502
- if (config === null) {
503
- throw new Error('Invalid config for "saveForm"');
504
- }
505
- return buildNetworkSnapshot$2(luvio, config);
506
- };
440
+ const saveForm_ConfigPropertyNames = {
441
+ displayName: 'saveForm',
442
+ parameters: {
443
+ required: ['siteId', 'formInput'],
444
+ optional: []
445
+ }
446
+ };
447
+ function createResourceParams$2(config) {
448
+ const resourceParams = {
449
+ urlParams: {
450
+ siteId: config.siteId
451
+ },
452
+ body: {
453
+ formInput: config.formInput
454
+ }
455
+ };
456
+ return resourceParams;
457
+ }
458
+ function typeCheckConfig$2(untrustedConfig) {
459
+ const config = {};
460
+ const untrustedConfig_siteId = untrustedConfig.siteId;
461
+ if (typeof untrustedConfig_siteId === 'string') {
462
+ config.siteId = untrustedConfig_siteId;
463
+ }
464
+ const untrustedConfig_formInput = untrustedConfig.formInput;
465
+ const referenceFormInputRepresentationValidationError = validate$7(untrustedConfig_formInput);
466
+ if (referenceFormInputRepresentationValidationError === null) {
467
+ config.formInput = untrustedConfig_formInput;
468
+ }
469
+ return config;
470
+ }
471
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
472
+ if (!untrustedIsObject(untrustedConfig)) {
473
+ return null;
474
+ }
475
+ if (process.env.NODE_ENV !== 'production') {
476
+ validateConfig(untrustedConfig, configPropertyNames);
477
+ }
478
+ const config = typeCheckConfig$2(untrustedConfig);
479
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
480
+ return null;
481
+ }
482
+ return config;
483
+ }
484
+ function buildNetworkSnapshot$2(luvio, config, options) {
485
+ const resourceParams = createResourceParams$2(config);
486
+ const request = createResourceRequest$2(resourceParams);
487
+ return luvio.dispatchResourceRequest(request, options)
488
+ .then((response) => {
489
+ return luvio.handleSuccessResponse(() => {
490
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response);
491
+ return luvio.storeBroadcast().then(() => snapshot);
492
+ }, () => getResponseCacheKeys$2(luvio, resourceParams, response.body));
493
+ }, (response) => {
494
+ deepFreeze(response);
495
+ throw response;
496
+ });
497
+ }
498
+ const saveFormAdapterFactory = (luvio) => {
499
+ return function saveForm(untrustedConfig) {
500
+ const config = validateAdapterConfig$2(untrustedConfig, saveForm_ConfigPropertyNames);
501
+ // Invalid or incomplete config
502
+ if (config === null) {
503
+ throw new Error('Invalid config for "saveForm"');
504
+ }
505
+ return buildNetworkSnapshot$2(luvio, config);
506
+ };
507
507
  };
508
508
 
509
- function select$2(luvio, params) {
510
- return select$4();
511
- }
512
- function keyBuilder$2(luvio, params) {
513
- return keyBuilder$3(luvio, {
514
- form_id: params.urlParams.formId
515
- });
516
- }
517
- function getResponseCacheKeys$1(luvio, resourceParams, response) {
518
- return getTypeCacheKeys$1(luvio, response);
519
- }
520
- function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
521
- const { body } = response;
522
- const key = keyBuilder$2(luvio, resourceParams);
523
- luvio.storeIngest(key, ingest$1, body);
524
- const snapshot = luvio.storeLookup({
525
- recordId: key,
526
- node: select$2(),
527
- variables: {},
528
- }, snapshotRefresh);
529
- if (process.env.NODE_ENV !== 'production') {
530
- if (snapshot.state !== 'Fulfilled') {
531
- throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
532
- }
533
- }
534
- return snapshot;
535
- }
536
- function ingestError(luvio, params, error, snapshotRefresh) {
537
- const key = keyBuilder$2(luvio, params);
538
- const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
539
- const storeMetadataParams = {
540
- ttl: TTL$1,
541
- namespace: keyPrefix,
542
- version: VERSION$1,
543
- representationName: RepresentationType$1
544
- };
545
- luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
546
- return errorSnapshot;
547
- }
548
- function createResourceRequest$1(config) {
549
- const headers = {};
550
- return {
551
- baseUri: '/services/data/v58.0',
552
- basePath: '/sites/' + config.urlParams.siteId + '/marketing-integration/forms/' + config.urlParams.formId + '',
553
- method: 'get',
554
- body: null,
555
- urlParams: config.urlParams,
556
- queryParams: {},
557
- headers,
558
- priority: 'normal',
559
- };
509
+ function select$2(luvio, params) {
510
+ return select$4();
511
+ }
512
+ function keyBuilder$2(luvio, params) {
513
+ return keyBuilder$3(luvio, {
514
+ form_id: params.urlParams.formId
515
+ });
516
+ }
517
+ function getResponseCacheKeys$1(luvio, resourceParams, response) {
518
+ return getTypeCacheKeys$1(luvio, response);
519
+ }
520
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
521
+ const { body } = response;
522
+ const key = keyBuilder$2(luvio, resourceParams);
523
+ luvio.storeIngest(key, ingest$1, body);
524
+ const snapshot = luvio.storeLookup({
525
+ recordId: key,
526
+ node: select$2(),
527
+ variables: {},
528
+ }, snapshotRefresh);
529
+ if (process.env.NODE_ENV !== 'production') {
530
+ if (snapshot.state !== 'Fulfilled') {
531
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
532
+ }
533
+ }
534
+ return snapshot;
535
+ }
536
+ function ingestError(luvio, params, error, snapshotRefresh) {
537
+ const key = keyBuilder$2(luvio, params);
538
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
539
+ const storeMetadataParams = {
540
+ ttl: TTL$1,
541
+ namespace: keyPrefix,
542
+ version: VERSION$1,
543
+ representationName: RepresentationType$1
544
+ };
545
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
546
+ return errorSnapshot;
547
+ }
548
+ function createResourceRequest$1(config) {
549
+ const headers = {};
550
+ return {
551
+ baseUri: '/services/data/v58.0',
552
+ basePath: '/sites/' + config.urlParams.siteId + '/marketing-integration/forms/' + config.urlParams.formId + '',
553
+ method: 'get',
554
+ body: null,
555
+ urlParams: config.urlParams,
556
+ queryParams: {},
557
+ headers,
558
+ priority: 'normal',
559
+ };
560
560
  }
561
561
 
562
- const getForm_ConfigPropertyNames = {
563
- displayName: 'getForm',
564
- parameters: {
565
- required: ['formId', 'siteId'],
566
- optional: []
567
- }
568
- };
569
- function createResourceParams$1(config) {
570
- const resourceParams = {
571
- urlParams: {
572
- formId: config.formId, siteId: config.siteId
573
- }
574
- };
575
- return resourceParams;
576
- }
577
- function keyBuilder$1(luvio, config) {
578
- const resourceParams = createResourceParams$1(config);
579
- return keyBuilder$2(luvio, resourceParams);
580
- }
581
- function typeCheckConfig$1(untrustedConfig) {
582
- const config = {};
583
- const untrustedConfig_formId = untrustedConfig.formId;
584
- if (typeof untrustedConfig_formId === 'string') {
585
- config.formId = untrustedConfig_formId;
586
- }
587
- const untrustedConfig_siteId = untrustedConfig.siteId;
588
- if (typeof untrustedConfig_siteId === 'string') {
589
- config.siteId = untrustedConfig_siteId;
590
- }
591
- return config;
592
- }
593
- function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
594
- if (!untrustedIsObject(untrustedConfig)) {
595
- return null;
596
- }
597
- if (process.env.NODE_ENV !== 'production') {
598
- validateConfig(untrustedConfig, configPropertyNames);
599
- }
600
- const config = typeCheckConfig$1(untrustedConfig);
601
- if (!areRequiredParametersPresent(config, configPropertyNames)) {
602
- return null;
603
- }
604
- return config;
605
- }
606
- function adapterFragment(luvio, config) {
607
- createResourceParams$1(config);
608
- return select$2();
609
- }
610
- function onFetchResponseSuccess(luvio, config, resourceParams, response) {
611
- const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
612
- config,
613
- resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
614
- });
615
- return luvio.storeBroadcast().then(() => snapshot);
616
- }
617
- function onFetchResponseError(luvio, config, resourceParams, response) {
618
- const snapshot = ingestError(luvio, resourceParams, response, {
619
- config,
620
- resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
621
- });
622
- return luvio.storeBroadcast().then(() => snapshot);
623
- }
624
- function buildNetworkSnapshot$1(luvio, config, options) {
625
- const resourceParams = createResourceParams$1(config);
626
- const request = createResourceRequest$1(resourceParams);
627
- return luvio.dispatchResourceRequest(request, options)
628
- .then((response) => {
629
- return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
630
- }, (response) => {
631
- return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
632
- });
633
- }
634
- function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
635
- const { luvio, config } = context;
636
- const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
637
- const dispatchOptions = {
638
- resourceRequestContext: {
639
- requestCorrelator,
640
- luvioRequestMethod: undefined,
641
- },
642
- eventObservers
643
- };
644
- if (networkPriority !== 'normal') {
645
- dispatchOptions.overrides = {
646
- priority: networkPriority
647
- };
648
- }
649
- return buildNetworkSnapshot$1(luvio, config, dispatchOptions);
650
- }
651
- function buildCachedSnapshotCachePolicy(context, storeLookup) {
652
- const { luvio, config } = context;
653
- const selector = {
654
- recordId: keyBuilder$1(luvio, config),
655
- node: adapterFragment(luvio, config),
656
- variables: {},
657
- };
658
- const cacheSnapshot = storeLookup(selector, {
659
- config,
660
- resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
661
- });
662
- return cacheSnapshot;
663
- }
664
- const getFormAdapterFactory = (luvio) => function marketingIntegration__getForm(untrustedConfig, requestContext) {
665
- const config = validateAdapterConfig$1(untrustedConfig, getForm_ConfigPropertyNames);
666
- // Invalid or incomplete config
667
- if (config === null) {
668
- return null;
669
- }
670
- return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
671
- buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
562
+ const getForm_ConfigPropertyNames = {
563
+ displayName: 'getForm',
564
+ parameters: {
565
+ required: ['formId', 'siteId'],
566
+ optional: []
567
+ }
568
+ };
569
+ function createResourceParams$1(config) {
570
+ const resourceParams = {
571
+ urlParams: {
572
+ formId: config.formId, siteId: config.siteId
573
+ }
574
+ };
575
+ return resourceParams;
576
+ }
577
+ function keyBuilder$1(luvio, config) {
578
+ const resourceParams = createResourceParams$1(config);
579
+ return keyBuilder$2(luvio, resourceParams);
580
+ }
581
+ function typeCheckConfig$1(untrustedConfig) {
582
+ const config = {};
583
+ const untrustedConfig_formId = untrustedConfig.formId;
584
+ if (typeof untrustedConfig_formId === 'string') {
585
+ config.formId = untrustedConfig_formId;
586
+ }
587
+ const untrustedConfig_siteId = untrustedConfig.siteId;
588
+ if (typeof untrustedConfig_siteId === 'string') {
589
+ config.siteId = untrustedConfig_siteId;
590
+ }
591
+ return config;
592
+ }
593
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
594
+ if (!untrustedIsObject(untrustedConfig)) {
595
+ return null;
596
+ }
597
+ if (process.env.NODE_ENV !== 'production') {
598
+ validateConfig(untrustedConfig, configPropertyNames);
599
+ }
600
+ const config = typeCheckConfig$1(untrustedConfig);
601
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
602
+ return null;
603
+ }
604
+ return config;
605
+ }
606
+ function adapterFragment(luvio, config) {
607
+ createResourceParams$1(config);
608
+ return select$2();
609
+ }
610
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
611
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
612
+ config,
613
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
614
+ });
615
+ return luvio.storeBroadcast().then(() => snapshot);
616
+ }
617
+ function onFetchResponseError(luvio, config, resourceParams, response) {
618
+ const snapshot = ingestError(luvio, resourceParams, response, {
619
+ config,
620
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
621
+ });
622
+ return luvio.storeBroadcast().then(() => snapshot);
623
+ }
624
+ function buildNetworkSnapshot$1(luvio, config, options) {
625
+ const resourceParams = createResourceParams$1(config);
626
+ const request = createResourceRequest$1(resourceParams);
627
+ return luvio.dispatchResourceRequest(request, options)
628
+ .then((response) => {
629
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
630
+ }, (response) => {
631
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
632
+ });
633
+ }
634
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
635
+ const { luvio, config } = context;
636
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
637
+ const dispatchOptions = {
638
+ resourceRequestContext: {
639
+ requestCorrelator,
640
+ luvioRequestMethod: undefined,
641
+ },
642
+ eventObservers
643
+ };
644
+ if (networkPriority !== 'normal') {
645
+ dispatchOptions.overrides = {
646
+ priority: networkPriority
647
+ };
648
+ }
649
+ return buildNetworkSnapshot$1(luvio, config, dispatchOptions);
650
+ }
651
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
652
+ const { luvio, config } = context;
653
+ const selector = {
654
+ recordId: keyBuilder$1(luvio, config),
655
+ node: adapterFragment(luvio, config),
656
+ variables: {},
657
+ };
658
+ const cacheSnapshot = storeLookup(selector, {
659
+ config,
660
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
661
+ });
662
+ return cacheSnapshot;
663
+ }
664
+ const getFormAdapterFactory = (luvio) => function marketingIntegration__getForm(untrustedConfig, requestContext) {
665
+ const config = validateAdapterConfig$1(untrustedConfig, getForm_ConfigPropertyNames);
666
+ // Invalid or incomplete config
667
+ if (config === null) {
668
+ return null;
669
+ }
670
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
671
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
672
672
  };
673
673
 
674
- function validate$3(obj, path = 'FormSubmissionFieldInputRepresentation') {
675
- const v_error = (() => {
676
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
677
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
678
- }
679
- const obj_name = obj.name;
680
- const path_name = path + '.name';
681
- if (typeof obj_name !== 'string') {
682
- return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
683
- }
684
- const obj_value = obj.value;
685
- const path_value = path + '.value';
686
- if (typeof obj_value !== 'string') {
687
- return new TypeError('Expected "string" but received "' + typeof obj_value + '" (at "' + path_value + '")');
688
- }
689
- })();
690
- return v_error === undefined ? null : v_error;
674
+ function validate$3(obj, path = 'FormSubmissionFieldInputRepresentation') {
675
+ const v_error = (() => {
676
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
677
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
678
+ }
679
+ const obj_name = obj.name;
680
+ const path_name = path + '.name';
681
+ if (typeof obj_name !== 'string') {
682
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
683
+ }
684
+ const obj_value = obj.value;
685
+ const path_value = path + '.value';
686
+ if (typeof obj_value !== 'string') {
687
+ return new TypeError('Expected "string" but received "' + typeof obj_value + '" (at "' + path_value + '")');
688
+ }
689
+ })();
690
+ return v_error === undefined ? null : v_error;
691
691
  }
692
692
 
693
- function validate$2(obj, path = 'FormSubmissionFieldInputList') {
694
- const v_error = (() => {
695
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
696
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
697
- }
698
- const obj_formFields = obj.formFields;
699
- const path_formFields = path + '.formFields';
700
- if (!ArrayIsArray(obj_formFields)) {
701
- return new TypeError('Expected "array" but received "' + typeof obj_formFields + '" (at "' + path_formFields + '")');
702
- }
703
- for (let i = 0; i < obj_formFields.length; i++) {
704
- const obj_formFields_item = obj_formFields[i];
705
- const path_formFields_item = path_formFields + '[' + i + ']';
706
- const referencepath_formFields_itemValidationError = validate$3(obj_formFields_item, path_formFields_item);
707
- if (referencepath_formFields_itemValidationError !== null) {
708
- let message = 'Object doesn\'t match FormSubmissionFieldInputRepresentation (at "' + path_formFields_item + '")\n';
709
- message += referencepath_formFields_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
710
- return new TypeError(message);
711
- }
712
- }
713
- })();
714
- return v_error === undefined ? null : v_error;
693
+ function validate$2(obj, path = 'FormSubmissionFieldInputList') {
694
+ const v_error = (() => {
695
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
696
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
697
+ }
698
+ const obj_formFields = obj.formFields;
699
+ const path_formFields = path + '.formFields';
700
+ if (!ArrayIsArray(obj_formFields)) {
701
+ return new TypeError('Expected "array" but received "' + typeof obj_formFields + '" (at "' + path_formFields + '")');
702
+ }
703
+ for (let i = 0; i < obj_formFields.length; i++) {
704
+ const obj_formFields_item = obj_formFields[i];
705
+ const path_formFields_item = path_formFields + '[' + i + ']';
706
+ const referencepath_formFields_itemValidationError = validate$3(obj_formFields_item, path_formFields_item);
707
+ if (referencepath_formFields_itemValidationError !== null) {
708
+ let message = 'Object doesn\'t match FormSubmissionFieldInputRepresentation (at "' + path_formFields_item + '")\n';
709
+ message += referencepath_formFields_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
710
+ return new TypeError(message);
711
+ }
712
+ }
713
+ })();
714
+ return v_error === undefined ? null : v_error;
715
715
  }
716
716
 
717
- function validate$1(obj, path = 'FormSubmissionInputRepresentation') {
718
- const v_error = (() => {
719
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
720
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
721
- }
722
- const obj_formFieldsList = obj.formFieldsList;
723
- const path_formFieldsList = path + '.formFieldsList';
724
- const referencepath_formFieldsListValidationError = validate$2(obj_formFieldsList, path_formFieldsList);
725
- if (referencepath_formFieldsListValidationError !== null) {
726
- let message = 'Object doesn\'t match FormSubmissionFieldInputList (at "' + path_formFieldsList + '")\n';
727
- message += referencepath_formFieldsListValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
728
- return new TypeError(message);
729
- }
730
- })();
731
- return v_error === undefined ? null : v_error;
717
+ function validate$1(obj, path = 'FormSubmissionInputRepresentation') {
718
+ const v_error = (() => {
719
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
720
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
721
+ }
722
+ const obj_formFieldsList = obj.formFieldsList;
723
+ const path_formFieldsList = path + '.formFieldsList';
724
+ const referencepath_formFieldsListValidationError = validate$2(obj_formFieldsList, path_formFieldsList);
725
+ if (referencepath_formFieldsListValidationError !== null) {
726
+ let message = 'Object doesn\'t match FormSubmissionFieldInputList (at "' + path_formFieldsList + '")\n';
727
+ message += referencepath_formFieldsListValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
728
+ return new TypeError(message);
729
+ }
730
+ })();
731
+ return v_error === undefined ? null : v_error;
732
732
  }
733
733
 
734
- const TTL = 100;
735
- const VERSION = "0e1b8658b45a13a4f914328ee63d79fc";
736
- function validate(obj, path = 'FormSubmissionRepresentation') {
737
- const v_error = (() => {
738
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
739
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
740
- }
741
- const obj_formSubmissionId = obj.formSubmissionId;
742
- const path_formSubmissionId = path + '.formSubmissionId';
743
- if (typeof obj_formSubmissionId !== 'string') {
744
- return new TypeError('Expected "string" but received "' + typeof obj_formSubmissionId + '" (at "' + path_formSubmissionId + '")');
745
- }
746
- })();
747
- return v_error === undefined ? null : v_error;
748
- }
749
- const RepresentationType = 'FormSubmissionRepresentation';
750
- function keyBuilder(luvio, config) {
751
- return keyPrefix + '::' + RepresentationType + ':' + config.form_submission_id;
752
- }
753
- function keyBuilderFromType(luvio, object) {
754
- const keyParams = {
755
- form_submission_id: object.formSubmissionId
756
- };
757
- return keyBuilder(luvio, keyParams);
758
- }
759
- function normalize(input, existing, path, luvio, store, timestamp) {
760
- return input;
761
- }
762
- const select$1 = function FormSubmissionRepresentationSelect() {
763
- return {
764
- kind: 'Fragment',
765
- version: VERSION,
766
- private: [],
767
- selections: [
768
- {
769
- name: 'formSubmissionId',
770
- kind: 'Scalar'
771
- }
772
- ]
773
- };
774
- };
775
- function equals(existing, incoming) {
776
- const existing_formSubmissionId = existing.formSubmissionId;
777
- const incoming_formSubmissionId = incoming.formSubmissionId;
778
- if (!(existing_formSubmissionId === incoming_formSubmissionId)) {
779
- return false;
780
- }
781
- return true;
782
- }
783
- const ingest = function FormSubmissionRepresentationIngest(input, path, luvio, store, timestamp) {
784
- if (process.env.NODE_ENV !== 'production') {
785
- const validateError = validate(input);
786
- if (validateError !== null) {
787
- throw validateError;
788
- }
789
- }
790
- const key = keyBuilderFromType(luvio, input);
791
- const existingRecord = store.readEntry(key);
792
- const ttlToUse = TTL;
793
- let incomingRecord = normalize(input, store.readEntry(key), {
794
- fullPath: key,
795
- parent: path.parent,
796
- propertyName: path.propertyName,
797
- ttl: ttlToUse
798
- });
799
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
800
- luvio.storePublish(key, incomingRecord);
801
- }
802
- {
803
- const storeMetadataParams = {
804
- ttl: ttlToUse,
805
- namespace: "marketing-integration",
806
- version: VERSION,
807
- representationName: RepresentationType,
808
- };
809
- luvio.publishStoreMetadata(key, storeMetadataParams);
810
- }
811
- return createLink(key);
812
- };
813
- function getTypeCacheKeys(luvio, input, fullPathFactory) {
814
- const rootKeySet = new StoreKeyMap();
815
- // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
816
- const rootKey = keyBuilderFromType(luvio, input);
817
- rootKeySet.set(rootKey, {
818
- namespace: keyPrefix,
819
- representationName: RepresentationType,
820
- mergeable: false
821
- });
822
- return rootKeySet;
734
+ const TTL = 100;
735
+ const VERSION = "0e1b8658b45a13a4f914328ee63d79fc";
736
+ function validate(obj, path = 'FormSubmissionRepresentation') {
737
+ const v_error = (() => {
738
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
739
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
740
+ }
741
+ const obj_formSubmissionId = obj.formSubmissionId;
742
+ const path_formSubmissionId = path + '.formSubmissionId';
743
+ if (typeof obj_formSubmissionId !== 'string') {
744
+ return new TypeError('Expected "string" but received "' + typeof obj_formSubmissionId + '" (at "' + path_formSubmissionId + '")');
745
+ }
746
+ })();
747
+ return v_error === undefined ? null : v_error;
748
+ }
749
+ const RepresentationType = 'FormSubmissionRepresentation';
750
+ function keyBuilder(luvio, config) {
751
+ return keyPrefix + '::' + RepresentationType + ':' + config.form_submission_id;
752
+ }
753
+ function keyBuilderFromType(luvio, object) {
754
+ const keyParams = {
755
+ form_submission_id: object.formSubmissionId
756
+ };
757
+ return keyBuilder(luvio, keyParams);
758
+ }
759
+ function normalize(input, existing, path, luvio, store, timestamp) {
760
+ return input;
761
+ }
762
+ const select$1 = function FormSubmissionRepresentationSelect() {
763
+ return {
764
+ kind: 'Fragment',
765
+ version: VERSION,
766
+ private: [],
767
+ selections: [
768
+ {
769
+ name: 'formSubmissionId',
770
+ kind: 'Scalar'
771
+ }
772
+ ]
773
+ };
774
+ };
775
+ function equals(existing, incoming) {
776
+ const existing_formSubmissionId = existing.formSubmissionId;
777
+ const incoming_formSubmissionId = incoming.formSubmissionId;
778
+ if (!(existing_formSubmissionId === incoming_formSubmissionId)) {
779
+ return false;
780
+ }
781
+ return true;
782
+ }
783
+ const ingest = function FormSubmissionRepresentationIngest(input, path, luvio, store, timestamp) {
784
+ if (process.env.NODE_ENV !== 'production') {
785
+ const validateError = validate(input);
786
+ if (validateError !== null) {
787
+ throw validateError;
788
+ }
789
+ }
790
+ const key = keyBuilderFromType(luvio, input);
791
+ const existingRecord = store.readEntry(key);
792
+ const ttlToUse = TTL;
793
+ let incomingRecord = normalize(input, store.readEntry(key), {
794
+ fullPath: key,
795
+ parent: path.parent,
796
+ propertyName: path.propertyName,
797
+ ttl: ttlToUse
798
+ });
799
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
800
+ luvio.storePublish(key, incomingRecord);
801
+ }
802
+ {
803
+ const storeMetadataParams = {
804
+ ttl: ttlToUse,
805
+ namespace: "marketing-integration",
806
+ version: VERSION,
807
+ representationName: RepresentationType,
808
+ };
809
+ luvio.publishStoreMetadata(key, storeMetadataParams);
810
+ }
811
+ return createLink(key);
812
+ };
813
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
814
+ const rootKeySet = new StoreKeyMap();
815
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
816
+ const rootKey = keyBuilderFromType(luvio, input);
817
+ rootKeySet.set(rootKey, {
818
+ namespace: keyPrefix,
819
+ representationName: RepresentationType,
820
+ mergeable: false
821
+ });
822
+ return rootKeySet;
823
823
  }
824
824
 
825
- function select(luvio, params) {
826
- return select$1();
827
- }
828
- function getResponseCacheKeys(luvio, resourceParams, response) {
829
- return getTypeCacheKeys(luvio, response);
830
- }
831
- function ingestSuccess(luvio, resourceParams, response) {
832
- const { body } = response;
833
- const key = keyBuilderFromType(luvio, body);
834
- luvio.storeIngest(key, ingest, body);
835
- const snapshot = luvio.storeLookup({
836
- recordId: key,
837
- node: select(),
838
- variables: {},
839
- });
840
- if (process.env.NODE_ENV !== 'production') {
841
- if (snapshot.state !== 'Fulfilled') {
842
- throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
843
- }
844
- }
845
- return snapshot;
846
- }
847
- function createResourceRequest(config) {
848
- const headers = {};
849
- return {
850
- baseUri: '/services/data/v58.0',
851
- basePath: '/sites/' + config.urlParams.siteId + '/marketing-integration/forms/' + config.urlParams.formId + '/data',
852
- method: 'post',
853
- body: config.body,
854
- urlParams: config.urlParams,
855
- queryParams: {},
856
- headers,
857
- priority: 'normal',
858
- };
825
+ function select(luvio, params) {
826
+ return select$1();
827
+ }
828
+ function getResponseCacheKeys(luvio, resourceParams, response) {
829
+ return getTypeCacheKeys(luvio, response);
830
+ }
831
+ function ingestSuccess(luvio, resourceParams, response) {
832
+ const { body } = response;
833
+ const key = keyBuilderFromType(luvio, body);
834
+ luvio.storeIngest(key, ingest, body);
835
+ const snapshot = luvio.storeLookup({
836
+ recordId: key,
837
+ node: select(),
838
+ variables: {},
839
+ });
840
+ if (process.env.NODE_ENV !== 'production') {
841
+ if (snapshot.state !== 'Fulfilled') {
842
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
843
+ }
844
+ }
845
+ return snapshot;
846
+ }
847
+ function createResourceRequest(config) {
848
+ const headers = {};
849
+ return {
850
+ baseUri: '/services/data/v58.0',
851
+ basePath: '/sites/' + config.urlParams.siteId + '/marketing-integration/forms/' + config.urlParams.formId + '/data',
852
+ method: 'post',
853
+ body: config.body,
854
+ urlParams: config.urlParams,
855
+ queryParams: {},
856
+ headers,
857
+ priority: 'normal',
858
+ };
859
859
  }
860
860
 
861
- const submitForm_ConfigPropertyNames = {
862
- displayName: 'submitForm',
863
- parameters: {
864
- required: ['formId', 'siteId', 'formSubmissionInput'],
865
- optional: []
866
- }
867
- };
868
- function createResourceParams(config) {
869
- const resourceParams = {
870
- urlParams: {
871
- formId: config.formId, siteId: config.siteId
872
- },
873
- body: {
874
- formSubmissionInput: config.formSubmissionInput
875
- }
876
- };
877
- return resourceParams;
878
- }
879
- function typeCheckConfig(untrustedConfig) {
880
- const config = {};
881
- const untrustedConfig_formId = untrustedConfig.formId;
882
- if (typeof untrustedConfig_formId === 'string') {
883
- config.formId = untrustedConfig_formId;
884
- }
885
- const untrustedConfig_siteId = untrustedConfig.siteId;
886
- if (typeof untrustedConfig_siteId === 'string') {
887
- config.siteId = untrustedConfig_siteId;
888
- }
889
- const untrustedConfig_formSubmissionInput = untrustedConfig.formSubmissionInput;
890
- const referenceFormSubmissionInputRepresentationValidationError = validate$1(untrustedConfig_formSubmissionInput);
891
- if (referenceFormSubmissionInputRepresentationValidationError === null) {
892
- config.formSubmissionInput = untrustedConfig_formSubmissionInput;
893
- }
894
- return config;
895
- }
896
- function validateAdapterConfig(untrustedConfig, configPropertyNames) {
897
- if (!untrustedIsObject(untrustedConfig)) {
898
- return null;
899
- }
900
- if (process.env.NODE_ENV !== 'production') {
901
- validateConfig(untrustedConfig, configPropertyNames);
902
- }
903
- const config = typeCheckConfig(untrustedConfig);
904
- if (!areRequiredParametersPresent(config, configPropertyNames)) {
905
- return null;
906
- }
907
- return config;
908
- }
909
- function buildNetworkSnapshot(luvio, config, options) {
910
- const resourceParams = createResourceParams(config);
911
- const request = createResourceRequest(resourceParams);
912
- return luvio.dispatchResourceRequest(request, options)
913
- .then((response) => {
914
- return luvio.handleSuccessResponse(() => {
915
- const snapshot = ingestSuccess(luvio, resourceParams, response);
916
- return luvio.storeBroadcast().then(() => snapshot);
917
- }, () => getResponseCacheKeys(luvio, resourceParams, response.body));
918
- }, (response) => {
919
- deepFreeze(response);
920
- throw response;
921
- });
922
- }
923
- const submitFormAdapterFactory = (luvio) => {
924
- return function submitForm(untrustedConfig) {
925
- const config = validateAdapterConfig(untrustedConfig, submitForm_ConfigPropertyNames);
926
- // Invalid or incomplete config
927
- if (config === null) {
928
- throw new Error('Invalid config for "submitForm"');
929
- }
930
- return buildNetworkSnapshot(luvio, config);
931
- };
861
+ const submitForm_ConfigPropertyNames = {
862
+ displayName: 'submitForm',
863
+ parameters: {
864
+ required: ['formId', 'siteId', 'formSubmissionInput'],
865
+ optional: []
866
+ }
867
+ };
868
+ function createResourceParams(config) {
869
+ const resourceParams = {
870
+ urlParams: {
871
+ formId: config.formId, siteId: config.siteId
872
+ },
873
+ body: {
874
+ formSubmissionInput: config.formSubmissionInput
875
+ }
876
+ };
877
+ return resourceParams;
878
+ }
879
+ function typeCheckConfig(untrustedConfig) {
880
+ const config = {};
881
+ const untrustedConfig_formId = untrustedConfig.formId;
882
+ if (typeof untrustedConfig_formId === 'string') {
883
+ config.formId = untrustedConfig_formId;
884
+ }
885
+ const untrustedConfig_siteId = untrustedConfig.siteId;
886
+ if (typeof untrustedConfig_siteId === 'string') {
887
+ config.siteId = untrustedConfig_siteId;
888
+ }
889
+ const untrustedConfig_formSubmissionInput = untrustedConfig.formSubmissionInput;
890
+ const referenceFormSubmissionInputRepresentationValidationError = validate$1(untrustedConfig_formSubmissionInput);
891
+ if (referenceFormSubmissionInputRepresentationValidationError === null) {
892
+ config.formSubmissionInput = untrustedConfig_formSubmissionInput;
893
+ }
894
+ return config;
895
+ }
896
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
897
+ if (!untrustedIsObject(untrustedConfig)) {
898
+ return null;
899
+ }
900
+ if (process.env.NODE_ENV !== 'production') {
901
+ validateConfig(untrustedConfig, configPropertyNames);
902
+ }
903
+ const config = typeCheckConfig(untrustedConfig);
904
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
905
+ return null;
906
+ }
907
+ return config;
908
+ }
909
+ function buildNetworkSnapshot(luvio, config, options) {
910
+ const resourceParams = createResourceParams(config);
911
+ const request = createResourceRequest(resourceParams);
912
+ return luvio.dispatchResourceRequest(request, options)
913
+ .then((response) => {
914
+ return luvio.handleSuccessResponse(() => {
915
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
916
+ return luvio.storeBroadcast().then(() => snapshot);
917
+ }, () => getResponseCacheKeys(luvio, resourceParams, response.body));
918
+ }, (response) => {
919
+ deepFreeze(response);
920
+ throw response;
921
+ });
922
+ }
923
+ const submitFormAdapterFactory = (luvio) => {
924
+ return function submitForm(untrustedConfig) {
925
+ const config = validateAdapterConfig(untrustedConfig, submitForm_ConfigPropertyNames);
926
+ // Invalid or incomplete config
927
+ if (config === null) {
928
+ throw new Error('Invalid config for "submitForm"');
929
+ }
930
+ return buildNetworkSnapshot(luvio, config);
931
+ };
932
932
  };
933
933
 
934
934
  export { getFormAdapterFactory, saveFormAdapterFactory, submitFormAdapterFactory };