@wix/auto_sdk_forms_form-submissions 1.0.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.
Files changed (61) hide show
  1. package/build/cjs/index.d.ts +2 -0
  2. package/build/cjs/index.js +19 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/index.typings.d.ts +12 -0
  5. package/build/cjs/index.typings.js +18 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/src/interfaces-forms-v4-submission-extension.context.d.ts +5 -0
  8. package/build/cjs/src/interfaces-forms-v4-submission-extension.context.js +9 -0
  9. package/build/cjs/src/interfaces-forms-v4-submission-extension.context.js.map +1 -0
  10. package/build/cjs/src/interfaces-forms-v4-submission-extension.public.d.ts +16 -0
  11. package/build/cjs/src/interfaces-forms-v4-submission-extension.public.js +34 -0
  12. package/build/cjs/src/interfaces-forms-v4-submission-extension.public.js.map +1 -0
  13. package/build/cjs/src/service-plugins-types.d.ts +313 -0
  14. package/build/cjs/src/service-plugins-types.js +66 -0
  15. package/build/cjs/src/service-plugins-types.js.map +1 -0
  16. package/build/es/index.d.ts +2 -0
  17. package/build/es/index.js +3 -0
  18. package/build/es/index.js.map +1 -0
  19. package/build/es/index.typings.d.ts +12 -0
  20. package/build/es/index.typings.js +2 -0
  21. package/build/es/index.typings.js.map +1 -0
  22. package/build/es/src/interfaces-forms-v4-submission-extension.context.d.ts +5 -0
  23. package/build/es/src/interfaces-forms-v4-submission-extension.context.js +6 -0
  24. package/build/es/src/interfaces-forms-v4-submission-extension.context.js.map +1 -0
  25. package/build/es/src/interfaces-forms-v4-submission-extension.public.d.ts +16 -0
  26. package/build/es/src/interfaces-forms-v4-submission-extension.public.js +31 -0
  27. package/build/es/src/interfaces-forms-v4-submission-extension.public.js.map +1 -0
  28. package/build/es/src/service-plugins-types.d.ts +313 -0
  29. package/build/es/src/service-plugins-types.js +63 -0
  30. package/build/es/src/service-plugins-types.js.map +1 -0
  31. package/build/internal/cjs/index.d.ts +2 -0
  32. package/build/internal/cjs/index.js +19 -0
  33. package/build/internal/cjs/index.js.map +1 -0
  34. package/build/internal/cjs/index.typings.d.ts +12 -0
  35. package/build/internal/cjs/index.typings.js +18 -0
  36. package/build/internal/cjs/index.typings.js.map +1 -0
  37. package/build/internal/cjs/src/interfaces-forms-v4-submission-extension.context.d.ts +5 -0
  38. package/build/internal/cjs/src/interfaces-forms-v4-submission-extension.context.js +9 -0
  39. package/build/internal/cjs/src/interfaces-forms-v4-submission-extension.context.js.map +1 -0
  40. package/build/internal/cjs/src/interfaces-forms-v4-submission-extension.public.d.ts +16 -0
  41. package/build/internal/cjs/src/interfaces-forms-v4-submission-extension.public.js +34 -0
  42. package/build/internal/cjs/src/interfaces-forms-v4-submission-extension.public.js.map +1 -0
  43. package/build/internal/cjs/src/service-plugins-types.d.ts +313 -0
  44. package/build/internal/cjs/src/service-plugins-types.js +66 -0
  45. package/build/internal/cjs/src/service-plugins-types.js.map +1 -0
  46. package/build/internal/es/index.d.ts +2 -0
  47. package/build/internal/es/index.js +3 -0
  48. package/build/internal/es/index.js.map +1 -0
  49. package/build/internal/es/index.typings.d.ts +12 -0
  50. package/build/internal/es/index.typings.js +2 -0
  51. package/build/internal/es/index.typings.js.map +1 -0
  52. package/build/internal/es/src/interfaces-forms-v4-submission-extension.context.d.ts +5 -0
  53. package/build/internal/es/src/interfaces-forms-v4-submission-extension.context.js +6 -0
  54. package/build/internal/es/src/interfaces-forms-v4-submission-extension.context.js.map +1 -0
  55. package/build/internal/es/src/interfaces-forms-v4-submission-extension.public.d.ts +16 -0
  56. package/build/internal/es/src/interfaces-forms-v4-submission-extension.public.js +31 -0
  57. package/build/internal/es/src/interfaces-forms-v4-submission-extension.public.js.map +1 -0
  58. package/build/internal/es/src/service-plugins-types.d.ts +313 -0
  59. package/build/internal/es/src/service-plugins-types.js +63 -0
  60. package/build/internal/es/src/service-plugins-types.js.map +1 -0
  61. package/package.json +52 -0
@@ -0,0 +1,2 @@
1
+ export * from './src/service-plugins-types';
2
+ export * from './src/interfaces-forms-v4-submission-extension.context';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./src/service-plugins-types"), exports);
18
+ __exportStar(require("./src/interfaces-forms-v4-submission-extension.context"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C;AAC5C,yFAAuE"}
@@ -0,0 +1,12 @@
1
+ import { ValidateSubmissionResponse } from './src/service-plugins-types.js';
2
+ import { ValidateSubmissionEnvelope } from './src/interfaces-forms-v4-submission-extension.public.js';
3
+ export * from './src/service-plugins-types';
4
+ export { ValidateSubmissionEnvelope };
5
+ /**
6
+ * > **Note:** The Form Submission service plugin only works with the Wix Forms app.
7
+ *
8
+ * Validates a submission.
9
+ *
10
+ * Validates a site visitor's form submission and returns any validation violations. Site visitors can see the validation violations on their forms. For example, invalid fields are highlighted in red.
11
+ */
12
+ export declare function validateSubmission(payload: ValidateSubmissionEnvelope): ValidateSubmissionResponse | Promise<ValidateSubmissionResponse>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./src/service-plugins-types"), exports);
18
+ //# sourceMappingURL=index.typings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.typings.js","sourceRoot":"","sources":["../../index.typings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGA,8DAA4C"}
@@ -0,0 +1,5 @@
1
+ import './interfaces-forms-v4-submission-extension.public.js';
2
+ import { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';
3
+ import { provideHandlers as publicProvideHandlers } from './interfaces-forms-v4-submission-extension.public.js';
4
+ export { publicProvideHandlers };
5
+ export declare const provideHandlers: ReturnType<typeof createServicePluginModule<typeof publicProvideHandlers>>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.provideHandlers = exports.publicProvideHandlers = void 0;
4
+ require("./interfaces-forms-v4-submission-extension.public.js");
5
+ const service_plugin_modules_1 = require("@wix/sdk-runtime/service-plugin-modules");
6
+ const interfaces_forms_v4_submission_extension_public_js_1 = require("./interfaces-forms-v4-submission-extension.public.js");
7
+ Object.defineProperty(exports, "publicProvideHandlers", { enumerable: true, get: function () { return interfaces_forms_v4_submission_extension_public_js_1.provideHandlers; } });
8
+ exports.provideHandlers = (0, service_plugin_modules_1.createServicePluginModule)(interfaces_forms_v4_submission_extension_public_js_1.provideHandlers);
9
+ //# sourceMappingURL=interfaces-forms-v4-submission-extension.context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces-forms-v4-submission-extension.context.js","sourceRoot":"","sources":["../../../src/interfaces-forms-v4-submission-extension.context.ts"],"names":[],"mappings":";;;AAAA,gEAA8D;AAC9D,oFAAoF;AACpF,6HAAgH;AAEvG,sGAFmB,oEAAqB,OAEnB;AAEjB,QAAA,eAAe,GAExB,IAAA,kDAAyB,EAAC,oEAAqB,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { ServicePluginDefinition } from '@wix/sdk-types';
2
+ import { Context, ValidateSubmissionRequest, ValidateSubmissionResponse } from './service-plugins-types.js';
3
+ export interface ValidateSubmissionEnvelope {
4
+ request: ValidateSubmissionRequest;
5
+ metadata: Context;
6
+ }
7
+ export declare const provideHandlers: ServicePluginDefinition<{
8
+ /**
9
+ *
10
+ * > **Note:** The Form Submission service plugin only works with the Wix Forms app.
11
+ *
12
+ * Validates a submission.
13
+ *
14
+ * Validates a site visitor's form submission and returns any validation violations. Site visitors can see the validation violations on their forms. For example, invalid fields are highlighted in red. */
15
+ validateSubmission(payload: ValidateSubmissionEnvelope): ValidateSubmissionResponse | Promise<ValidateSubmissionResponse>;
16
+ }>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.provideHandlers = void 0;
4
+ const sdk_types_1 = require("@wix/sdk-types");
5
+ const timestamp_1 = require("@wix/sdk-runtime/transformations/timestamp");
6
+ const transform_paths_1 = require("@wix/sdk-runtime/transformations/transform-paths");
7
+ const rename_all_nested_keys_1 = require("@wix/sdk-runtime/rename-all-nested-keys");
8
+ exports.provideHandlers = (0, sdk_types_1.ServicePluginDefinition)('FORMS_SUBMISSIONS_EXTENSION_PROVIDER', [
9
+ {
10
+ name: 'validateSubmission',
11
+ primaryHttpMappingPath: '/v4/submissions/validate',
12
+ transformations: {
13
+ toREST: (payload) => {
14
+ const toRestResponse = payload;
15
+ return (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
16
+ },
17
+ fromREST: (payload) => {
18
+ const fromRestRequest = (0, transform_paths_1.transformPaths)(payload, [
19
+ {
20
+ transformFn: timestamp_1.transformRESTTimestampToSDKTimestamp,
21
+ paths: [
22
+ { path: 'request.updateOptions.currentSubmission.createdDate' },
23
+ { path: 'request.updateOptions.currentSubmission.updatedDate' },
24
+ { path: 'request.submission.createdDate' },
25
+ { path: 'request.submission.updatedDate' },
26
+ ],
27
+ },
28
+ ]);
29
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
30
+ },
31
+ },
32
+ },
33
+ ]);
34
+ //# sourceMappingURL=interfaces-forms-v4-submission-extension.public.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces-forms-v4-submission-extension.public.js","sourceRoot":"","sources":["../../../src/interfaces-forms-v4-submission-extension.public.ts"],"names":[],"mappings":";;;AAAA,8CAAyD;AAMzD,0EAAkG;AAClG,sFAAkF;AAClF,oFAGiD;AAOpC,QAAA,eAAe,GAAG,IAAA,mCAAuB,EAWnD,sCAAsC,EAAE;IACzC;QACE,IAAI,EAAE,oBAAoB;QAC1B,sBAAsB,EAAE,0BAA0B;QAClD,eAAe,EAAE;YACf,MAAM,EAAE,CAAC,OAAY,EAAE,EAAE;gBACvB,MAAM,cAAc,GAAG,OAAO,CAAC;gBAE/B,OAAO,IAAA,8DAAqC,EAAC,cAAc,CAAC,CAAC;YAC/D,CAAC;YACD,QAAQ,EAAE,CAAC,OAAY,EAAE,EAAE;gBACzB,MAAM,eAAe,GAAG,IAAA,gCAAc,EAAC,OAAO,EAAE;oBAC9C;wBACE,WAAW,EAAE,gDAAoC;wBACjD,KAAK,EAAE;4BACL,EAAE,IAAI,EAAE,qDAAqD,EAAE;4BAC/D,EAAE,IAAI,EAAE,qDAAqD,EAAE;4BAC/D,EAAE,IAAI,EAAE,gCAAgC,EAAE;4BAC1C,EAAE,IAAI,EAAE,gCAAgC,EAAE;yBAC3C;qBACF;iBACF,CAAC,CAAC;gBAEH,OAAO,IAAA,gEAAuC,EAAC,eAAe,CAAC,CAAC;YAClE,CAAC;SACF;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,313 @@
1
+ export interface ValidateSubmissionRequest extends ValidateSubmissionRequestActionsOneOf {
2
+ /** Data for updating an existing submission. */
3
+ updateOptions?: UpdateOptions;
4
+ /** Submission to validate. */
5
+ submission: FormSubmission;
6
+ /** Whether to create or update the submission. */
7
+ actionType: ActionType;
8
+ }
9
+ /** @oneof */
10
+ export interface ValidateSubmissionRequestActionsOneOf {
11
+ /** Data for updating an existing submission. */
12
+ updateOptions?: UpdateOptions;
13
+ }
14
+ /** Form submission that was created or retrieved. */
15
+ export interface FormSubmission {
16
+ /**
17
+ * Submission ID.
18
+ * @readonly
19
+ */
20
+ _id?: string | null;
21
+ /** ID of the form which the submission belongs to. */
22
+ formId?: string;
23
+ /**
24
+ * The app which the form submissions belong to. For example, the namespace for the Wix Forms app is `wix.form_app.form`. Call `Get Submission` to retrieve the namespace.
25
+ * @readonly
26
+ */
27
+ namespace?: string;
28
+ /** Status of the submission. */
29
+ status?: SubmissionStatus;
30
+ /** Submission values where `key` is the form field and `value` is the data submitted for the given field. */
31
+ submissions?: Record<string, any>;
32
+ /** Date and time the form submission was created. */
33
+ _createdDate?: Date | null;
34
+ /**
35
+ * Date and time the form submission was updated.
36
+ * @readonly
37
+ */
38
+ _updatedDate?: Date | null;
39
+ /**
40
+ * Revision number, which increments by 1 each time the form submission is updated. To prevent conflicting changes, the existing revision must be used when updating a form submission.
41
+ * @readonly
42
+ */
43
+ revision?: string | null;
44
+ /**
45
+ * ID of the visitor that submitted the form.
46
+ * @readonly
47
+ */
48
+ submitter?: Submitter;
49
+ /** Whether a site owner marked a submission as "seen". */
50
+ seen?: boolean;
51
+ /** Data extension object that holds users' and apps' fields. */
52
+ extendedFields?: ExtendedFields;
53
+ /**
54
+ * Order details. <br>
55
+ * <b>Note</b>: This object is only applicable when submittng a form in the Wix Payments app.
56
+ */
57
+ orderDetails?: OrderDetails;
58
+ /** Contact ID of a site visitor who created the submission. */
59
+ contactId?: string | null;
60
+ /** authorized viewer user id */
61
+ accessRestriction?: string | null;
62
+ /** Tag ids collections associated with current entity. */
63
+ tags?: PublicTags;
64
+ }
65
+ export declare enum SubmissionStatus {
66
+ UNKNOWN_SUBMISSION_STATUS = "UNKNOWN_SUBMISSION_STATUS",
67
+ /** A submission is created, but has not yet been recorded in the Wix Forms collection. */
68
+ PENDING = "PENDING",
69
+ /** A submission is recorded in the Wix Forms collection. */
70
+ CONFIRMED = "CONFIRMED",
71
+ /** A form submission requiring payment is created. */
72
+ PAYMENT_WAITING = "PAYMENT_WAITING",
73
+ /** An order of a form submission is canceled. */
74
+ PAYMENT_CANCELED = "PAYMENT_CANCELED"
75
+ }
76
+ export interface Submitter extends SubmitterSubmitterOneOf {
77
+ /** Member ID. */
78
+ memberId?: string | null;
79
+ /** Visitor ID. */
80
+ visitorId?: string | null;
81
+ /** Application ID. */
82
+ applicationId?: string | null;
83
+ /** User ID. */
84
+ userId?: string | null;
85
+ }
86
+ /** @oneof */
87
+ export interface SubmitterSubmitterOneOf {
88
+ /** Member ID. */
89
+ memberId?: string | null;
90
+ /** Visitor ID. */
91
+ visitorId?: string | null;
92
+ /** Application ID. */
93
+ applicationId?: string | null;
94
+ /** User ID. */
95
+ userId?: string | null;
96
+ }
97
+ export interface ExtendedFields {
98
+ /**
99
+ * Extended field data. Each key corresponds to the namespace of the app that created the extended fields.
100
+ * The value of each key is structured according to the schema defined when the extended fields were configured.
101
+ *
102
+ * You can only access fields for which you have the appropriate permissions.
103
+ *
104
+ * Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields).
105
+ */
106
+ namespaces?: Record<string, Record<string, any>>;
107
+ }
108
+ export interface OrderDetails {
109
+ /**
110
+ * ID of the order related to submission (only applicable if a form has payments).
111
+ * @readonly
112
+ */
113
+ orderId?: string | null;
114
+ /**
115
+ * Order number.
116
+ * @readonly
117
+ */
118
+ number?: string | null;
119
+ /**
120
+ * Currency.
121
+ * @readonly
122
+ */
123
+ currency?: string | null;
124
+ /**
125
+ * Item subtotal.
126
+ * @readonly
127
+ */
128
+ itemSubtotal?: string;
129
+ /**
130
+ * ID of the checkout related to submission (only applicable if a form has payments).
131
+ * @readonly
132
+ */
133
+ checkoutId?: string;
134
+ }
135
+ export interface PublicTags {
136
+ /** Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors. */
137
+ tags?: TagList;
138
+ }
139
+ export interface TagList {
140
+ /** List of tag IDs */
141
+ tagIds?: string[];
142
+ }
143
+ export declare enum ActionType {
144
+ /** Unknown action type. */
145
+ UNKNOWN_ACTION = "UNKNOWN_ACTION",
146
+ /** Update submission. */
147
+ UPDATE = "UPDATE",
148
+ /** Create submission. */
149
+ CREATE = "CREATE"
150
+ }
151
+ export interface UpdateOptions {
152
+ /** Submission to update. */
153
+ currentSubmission?: FormSubmission;
154
+ }
155
+ export interface ValidateSubmissionResponse {
156
+ /**
157
+ * List of validation errors. <br>
158
+ * If there are no validation errors, returns an empty array.
159
+ */
160
+ errors?: SubmissionValidationError[];
161
+ }
162
+ export interface SubmissionValidationError extends SubmissionValidationErrorErrorMessageOneOf {
163
+ /** Predefined error type. */
164
+ errorType?: SubmissionErrorType;
165
+ /** Custom error message. The message is displayed instead of an error type. */
166
+ customErrorMessage?: string;
167
+ /** Path indicating the source of the error, such as `form.fields.target`. */
168
+ errorPath?: string;
169
+ /** Additional error parameters. */
170
+ params?: Record<string, any> | null;
171
+ }
172
+ /** @oneof */
173
+ export interface SubmissionValidationErrorErrorMessageOneOf {
174
+ /** Predefined error type. */
175
+ errorType?: SubmissionErrorType;
176
+ /** Custom error message. The message is displayed instead of an error type. */
177
+ customErrorMessage?: string;
178
+ }
179
+ export declare enum SubmissionErrorType {
180
+ /** Error is unknown or unsuitable for any of the options below. */
181
+ UNKNOWN_ERROR = "UNKNOWN_ERROR",
182
+ /** Type of submitted value is incorrect. */
183
+ TYPE_ERROR = "TYPE_ERROR",
184
+ /** Value is required to be provided. */
185
+ REQUIRED_VALUE_ERROR = "REQUIRED_VALUE_ERROR",
186
+ /** Value contains additional properties not expected in schema. */
187
+ UNKNOWN_VALUE_ERROR = "UNKNOWN_VALUE_ERROR",
188
+ /** Text value exceeds max length. */
189
+ MAX_LENGTH_ERROR = "MAX_LENGTH_ERROR",
190
+ /** Text value does not reach min length. */
191
+ MIN_LENGTH_ERROR = "MIN_LENGTH_ERROR",
192
+ /** Text value is not applicable for expected pattern. */
193
+ PATTERN_ERROR = "PATTERN_ERROR",
194
+ /** Text value is not applicable for expected format. */
195
+ FORMAT_ERROR = "FORMAT_ERROR",
196
+ /** Number value is too big. */
197
+ MAX_VALUE_ERROR = "MAX_VALUE_ERROR",
198
+ /** Number value is too small. */
199
+ MIN_VALUE_ERROR = "MIN_VALUE_ERROR",
200
+ /** Number value is not a multiple of expected number. */
201
+ MULTIPLE_OF_VALUE_ERROR = "MULTIPLE_OF_VALUE_ERROR",
202
+ /** Array value has too many items. */
203
+ MIN_ITEMS_ERROR = "MIN_ITEMS_ERROR",
204
+ /** Array value has not enough items. */
205
+ MAX_ITEMS_ERROR = "MAX_ITEMS_ERROR",
206
+ /** Value is not in the list of allowed values. */
207
+ NOT_ALLOWED_VALUE_ERROR = "NOT_ALLOWED_VALUE_ERROR",
208
+ /** Submitted form is disabled. */
209
+ DISABLED_FORM_ERROR = "DISABLED_FORM_ERROR"
210
+ }
211
+ export interface FormSubmissionSpiExtensionConfig {
212
+ /**
213
+ * Deployment URI where the endpoints are called. Wix Forms appends the endpoint path to the deployment URI.
214
+ * For example, to call the Validate Submission endpoint at `https://my-form-submissions.com/v1/validateSubmission`,
215
+ * the `deploymentUri` you provide here is `https://my-form-submissions.com/`.
216
+ */
217
+ deploymentUri?: SpiBaseUri;
218
+ /** Namespace names. */
219
+ namespaceConfigs?: FormsSubmissionsExtensionNamespaceConfig[];
220
+ }
221
+ export interface SpiBaseUri {
222
+ /**
223
+ * Base URI where the methods are called. Wix appends the path to the `baseUri`.
224
+ * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.
225
+ */
226
+ baseUri?: string;
227
+ /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */
228
+ alternativeUris?: AlternativeUri[];
229
+ }
230
+ export interface AlternativeUri {
231
+ /**
232
+ * Name of the method to create a custom URI for.
233
+ *
234
+ * For `methodName`, use the name of the method in PascalCase.
235
+ * For example, for Get Shipping Rates use `GetShippingRates`.
236
+ */
237
+ methodName?: string;
238
+ /**
239
+ * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.
240
+ * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.
241
+ */
242
+ absoluteUri?: string;
243
+ }
244
+ export interface FormsSubmissionsExtensionNamespaceConfig {
245
+ /**
246
+ * The app which the form submissions belong to. For example, the namespace for the Wix Forms app is `wix.form_app.form`.
247
+ *
248
+ * Call `Get Submission` to retrieve the namespace.
249
+ */
250
+ namespace?: string;
251
+ /**
252
+ * The ID of the specific form that will trigger the defined methods when a submission is made.
253
+ * This field is optional. If not provided, submissions from all forms will trigger the methods.
254
+ */
255
+ formId?: string | null;
256
+ /** Enable submission validation. */
257
+ submissionValidationEnabled?: boolean;
258
+ }
259
+ /**
260
+ * this message is not directly used by any service,
261
+ * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.
262
+ * e.g. SPIs, event-handlers, etc..
263
+ * NOTE: this context object MUST be provided as the last argument in each Velo method signature.
264
+ *
265
+ * Example:
266
+ * ```typescript
267
+ * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {
268
+ * ...
269
+ * }
270
+ * ```
271
+ */
272
+ export interface Context {
273
+ /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */
274
+ requestId?: string | null;
275
+ /** [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code. */
276
+ currency?: string | null;
277
+ /** An object that describes the identity that triggered this request. */
278
+ identity?: IdentificationData;
279
+ /** A string representing a language and region in the format of `"xx-XX"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash "-", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `"en-US"`. */
280
+ languages?: string[];
281
+ /** The service provider app's instance ID. */
282
+ instanceId?: string | null;
283
+ }
284
+ export declare enum IdentityType {
285
+ UNKNOWN = "UNKNOWN",
286
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
287
+ MEMBER = "MEMBER",
288
+ WIX_USER = "WIX_USER",
289
+ APP = "APP"
290
+ }
291
+ export interface IdentificationData extends IdentificationDataIdOneOf {
292
+ /** ID of a site visitor that has not logged in to the site. */
293
+ anonymousVisitorId?: string;
294
+ /** ID of a site visitor that has logged in to the site. */
295
+ memberId?: string;
296
+ /** ID of a Wix user (site owner, contributor, etc.). */
297
+ wixUserId?: string;
298
+ /** ID of an app. */
299
+ appId?: string;
300
+ /** @readonly */
301
+ identityType?: IdentityType;
302
+ }
303
+ /** @oneof */
304
+ export interface IdentificationDataIdOneOf {
305
+ /** ID of a site visitor that has not logged in to the site. */
306
+ anonymousVisitorId?: string;
307
+ /** ID of a site visitor that has logged in to the site. */
308
+ memberId?: string;
309
+ /** ID of a Wix user (site owner, contributor, etc.). */
310
+ wixUserId?: string;
311
+ /** ID of an app. */
312
+ appId?: string;
313
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IdentityType = exports.SubmissionErrorType = exports.ActionType = exports.SubmissionStatus = void 0;
4
+ var SubmissionStatus;
5
+ (function (SubmissionStatus) {
6
+ SubmissionStatus["UNKNOWN_SUBMISSION_STATUS"] = "UNKNOWN_SUBMISSION_STATUS";
7
+ /** A submission is created, but has not yet been recorded in the Wix Forms collection. */
8
+ SubmissionStatus["PENDING"] = "PENDING";
9
+ /** A submission is recorded in the Wix Forms collection. */
10
+ SubmissionStatus["CONFIRMED"] = "CONFIRMED";
11
+ /** A form submission requiring payment is created. */
12
+ SubmissionStatus["PAYMENT_WAITING"] = "PAYMENT_WAITING";
13
+ /** An order of a form submission is canceled. */
14
+ SubmissionStatus["PAYMENT_CANCELED"] = "PAYMENT_CANCELED";
15
+ })(SubmissionStatus || (exports.SubmissionStatus = SubmissionStatus = {}));
16
+ var ActionType;
17
+ (function (ActionType) {
18
+ /** Unknown action type. */
19
+ ActionType["UNKNOWN_ACTION"] = "UNKNOWN_ACTION";
20
+ /** Update submission. */
21
+ ActionType["UPDATE"] = "UPDATE";
22
+ /** Create submission. */
23
+ ActionType["CREATE"] = "CREATE";
24
+ })(ActionType || (exports.ActionType = ActionType = {}));
25
+ var SubmissionErrorType;
26
+ (function (SubmissionErrorType) {
27
+ /** Error is unknown or unsuitable for any of the options below. */
28
+ SubmissionErrorType["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
29
+ /** Type of submitted value is incorrect. */
30
+ SubmissionErrorType["TYPE_ERROR"] = "TYPE_ERROR";
31
+ /** Value is required to be provided. */
32
+ SubmissionErrorType["REQUIRED_VALUE_ERROR"] = "REQUIRED_VALUE_ERROR";
33
+ /** Value contains additional properties not expected in schema. */
34
+ SubmissionErrorType["UNKNOWN_VALUE_ERROR"] = "UNKNOWN_VALUE_ERROR";
35
+ /** Text value exceeds max length. */
36
+ SubmissionErrorType["MAX_LENGTH_ERROR"] = "MAX_LENGTH_ERROR";
37
+ /** Text value does not reach min length. */
38
+ SubmissionErrorType["MIN_LENGTH_ERROR"] = "MIN_LENGTH_ERROR";
39
+ /** Text value is not applicable for expected pattern. */
40
+ SubmissionErrorType["PATTERN_ERROR"] = "PATTERN_ERROR";
41
+ /** Text value is not applicable for expected format. */
42
+ SubmissionErrorType["FORMAT_ERROR"] = "FORMAT_ERROR";
43
+ /** Number value is too big. */
44
+ SubmissionErrorType["MAX_VALUE_ERROR"] = "MAX_VALUE_ERROR";
45
+ /** Number value is too small. */
46
+ SubmissionErrorType["MIN_VALUE_ERROR"] = "MIN_VALUE_ERROR";
47
+ /** Number value is not a multiple of expected number. */
48
+ SubmissionErrorType["MULTIPLE_OF_VALUE_ERROR"] = "MULTIPLE_OF_VALUE_ERROR";
49
+ /** Array value has too many items. */
50
+ SubmissionErrorType["MIN_ITEMS_ERROR"] = "MIN_ITEMS_ERROR";
51
+ /** Array value has not enough items. */
52
+ SubmissionErrorType["MAX_ITEMS_ERROR"] = "MAX_ITEMS_ERROR";
53
+ /** Value is not in the list of allowed values. */
54
+ SubmissionErrorType["NOT_ALLOWED_VALUE_ERROR"] = "NOT_ALLOWED_VALUE_ERROR";
55
+ /** Submitted form is disabled. */
56
+ SubmissionErrorType["DISABLED_FORM_ERROR"] = "DISABLED_FORM_ERROR";
57
+ })(SubmissionErrorType || (exports.SubmissionErrorType = SubmissionErrorType = {}));
58
+ var IdentityType;
59
+ (function (IdentityType) {
60
+ IdentityType["UNKNOWN"] = "UNKNOWN";
61
+ IdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
62
+ IdentityType["MEMBER"] = "MEMBER";
63
+ IdentityType["WIX_USER"] = "WIX_USER";
64
+ IdentityType["APP"] = "APP";
65
+ })(IdentityType || (exports.IdentityType = IdentityType = {}));
66
+ //# sourceMappingURL=service-plugins-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-plugins-types.js","sourceRoot":"","sources":["../../../src/service-plugins-types.ts"],"names":[],"mappings":";;;AAoEA,IAAY,gBAUX;AAVD,WAAY,gBAAgB;IAC1B,2EAAuD,CAAA;IACvD,0FAA0F;IAC1F,uCAAmB,CAAA;IACnB,4DAA4D;IAC5D,2CAAuB,CAAA;IACvB,sDAAsD;IACtD,uDAAmC,CAAA;IACnC,iDAAiD;IACjD,yDAAqC,CAAA;AACvC,CAAC,EAVW,gBAAgB,gCAAhB,gBAAgB,QAU3B;AA2ED,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,2BAA2B;IAC3B,+CAAiC,CAAA;IACjC,yBAAyB;IACzB,+BAAiB,CAAA;IACjB,yBAAyB;IACzB,+BAAiB,CAAA;AACnB,CAAC,EAPW,UAAU,0BAAV,UAAU,QAOrB;AAmCD,IAAY,mBA+BX;AA/BD,WAAY,mBAAmB;IAC7B,mEAAmE;IACnE,sDAA+B,CAAA;IAC/B,4CAA4C;IAC5C,gDAAyB,CAAA;IACzB,wCAAwC;IACxC,oEAA6C,CAAA;IAC7C,mEAAmE;IACnE,kEAA2C,CAAA;IAC3C,qCAAqC;IACrC,4DAAqC,CAAA;IACrC,4CAA4C;IAC5C,4DAAqC,CAAA;IACrC,yDAAyD;IACzD,sDAA+B,CAAA;IAC/B,wDAAwD;IACxD,oDAA6B,CAAA;IAC7B,+BAA+B;IAC/B,0DAAmC,CAAA;IACnC,iCAAiC;IACjC,0DAAmC,CAAA;IACnC,yDAAyD;IACzD,0EAAmD,CAAA;IACnD,sCAAsC;IACtC,0DAAmC,CAAA;IACnC,wCAAwC;IACxC,0DAAmC,CAAA;IACnC,kDAAkD;IAClD,0EAAmD,CAAA;IACnD,kCAAkC;IAClC,kEAA2C,CAAA;AAC7C,CAAC,EA/BW,mBAAmB,mCAAnB,mBAAmB,QA+B9B;AAgFD,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,uDAAuC,CAAA;IACvC,iCAAiB,CAAA;IACjB,qCAAqB,CAAA;IACrB,2BAAW,CAAA;AACb,CAAC,EANW,YAAY,4BAAZ,YAAY,QAMvB"}
@@ -0,0 +1,2 @@
1
+ export * from './src/service-plugins-types';
2
+ export * from './src/interfaces-forms-v4-submission-extension.context';
@@ -0,0 +1,3 @@
1
+ export * from './src/service-plugins-types';
2
+ export * from './src/interfaces-forms-v4-submission-extension.context';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wDAAwD,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { ValidateSubmissionResponse } from './src/service-plugins-types.js';
2
+ import { ValidateSubmissionEnvelope } from './src/interfaces-forms-v4-submission-extension.public.js';
3
+ export * from './src/service-plugins-types';
4
+ export { ValidateSubmissionEnvelope };
5
+ /**
6
+ * > **Note:** The Form Submission service plugin only works with the Wix Forms app.
7
+ *
8
+ * Validates a submission.
9
+ *
10
+ * Validates a site visitor's form submission and returns any validation violations. Site visitors can see the validation violations on their forms. For example, invalid fields are highlighted in red.
11
+ */
12
+ export declare function validateSubmission(payload: ValidateSubmissionEnvelope): ValidateSubmissionResponse | Promise<ValidateSubmissionResponse>;
@@ -0,0 +1,2 @@
1
+ export * from './src/service-plugins-types';
2
+ //# sourceMappingURL=index.typings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.typings.js","sourceRoot":"","sources":["../../index.typings.ts"],"names":[],"mappings":"AAGA,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,5 @@
1
+ import './interfaces-forms-v4-submission-extension.public.js';
2
+ import { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';
3
+ import { provideHandlers as publicProvideHandlers } from './interfaces-forms-v4-submission-extension.public.js';
4
+ export { publicProvideHandlers };
5
+ export declare const provideHandlers: ReturnType<typeof createServicePluginModule<typeof publicProvideHandlers>>;
@@ -0,0 +1,6 @@
1
+ import './interfaces-forms-v4-submission-extension.public.js';
2
+ import { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';
3
+ import { provideHandlers as publicProvideHandlers } from './interfaces-forms-v4-submission-extension.public.js';
4
+ export { publicProvideHandlers };
5
+ export const provideHandlers = createServicePluginModule(publicProvideHandlers);
6
+ //# sourceMappingURL=interfaces-forms-v4-submission-extension.context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces-forms-v4-submission-extension.context.js","sourceRoot":"","sources":["../../../src/interfaces-forms-v4-submission-extension.context.ts"],"names":[],"mappings":"AAAA,OAAO,sDAAsD,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM,sDAAsD,CAAC;AAEhH,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC,MAAM,CAAC,MAAM,eAAe,GAExB,yBAAyB,CAAC,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { ServicePluginDefinition } from '@wix/sdk-types';
2
+ import { Context, ValidateSubmissionRequest, ValidateSubmissionResponse } from './service-plugins-types.js';
3
+ export interface ValidateSubmissionEnvelope {
4
+ request: ValidateSubmissionRequest;
5
+ metadata: Context;
6
+ }
7
+ export declare const provideHandlers: ServicePluginDefinition<{
8
+ /**
9
+ *
10
+ * > **Note:** The Form Submission service plugin only works with the Wix Forms app.
11
+ *
12
+ * Validates a submission.
13
+ *
14
+ * Validates a site visitor's form submission and returns any validation violations. Site visitors can see the validation violations on their forms. For example, invalid fields are highlighted in red. */
15
+ validateSubmission(payload: ValidateSubmissionEnvelope): ValidateSubmissionResponse | Promise<ValidateSubmissionResponse>;
16
+ }>;
@@ -0,0 +1,31 @@
1
+ import { ServicePluginDefinition } from '@wix/sdk-types';
2
+ import { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';
3
+ import { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';
4
+ import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys';
5
+ export const provideHandlers = ServicePluginDefinition('FORMS_SUBMISSIONS_EXTENSION_PROVIDER', [
6
+ {
7
+ name: 'validateSubmission',
8
+ primaryHttpMappingPath: '/v4/submissions/validate',
9
+ transformations: {
10
+ toREST: (payload) => {
11
+ const toRestResponse = payload;
12
+ return renameKeysFromSDKRequestToRESTRequest(toRestResponse);
13
+ },
14
+ fromREST: (payload) => {
15
+ const fromRestRequest = transformPaths(payload, [
16
+ {
17
+ transformFn: transformRESTTimestampToSDKTimestamp,
18
+ paths: [
19
+ { path: 'request.updateOptions.currentSubmission.createdDate' },
20
+ { path: 'request.updateOptions.currentSubmission.updatedDate' },
21
+ { path: 'request.submission.createdDate' },
22
+ { path: 'request.submission.updatedDate' },
23
+ ],
24
+ },
25
+ ]);
26
+ return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);
27
+ },
28
+ },
29
+ },
30
+ ]);
31
+ //# sourceMappingURL=interfaces-forms-v4-submission-extension.public.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces-forms-v4-submission-extension.public.js","sourceRoot":"","sources":["../../../src/interfaces-forms-v4-submission-extension.public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAMzD,OAAO,EAAE,oCAAoC,EAAE,MAAM,4CAA4C,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AAClF,OAAO,EACL,qCAAqC,EACrC,uCAAuC,GACxC,MAAM,yCAAyC,CAAC;AAOjD,MAAM,CAAC,MAAM,eAAe,GAAG,uBAAuB,CAWnD,sCAAsC,EAAE;IACzC;QACE,IAAI,EAAE,oBAAoB;QAC1B,sBAAsB,EAAE,0BAA0B;QAClD,eAAe,EAAE;YACf,MAAM,EAAE,CAAC,OAAY,EAAE,EAAE;gBACvB,MAAM,cAAc,GAAG,OAAO,CAAC;gBAE/B,OAAO,qCAAqC,CAAC,cAAc,CAAC,CAAC;YAC/D,CAAC;YACD,QAAQ,EAAE,CAAC,OAAY,EAAE,EAAE;gBACzB,MAAM,eAAe,GAAG,cAAc,CAAC,OAAO,EAAE;oBAC9C;wBACE,WAAW,EAAE,oCAAoC;wBACjD,KAAK,EAAE;4BACL,EAAE,IAAI,EAAE,qDAAqD,EAAE;4BAC/D,EAAE,IAAI,EAAE,qDAAqD,EAAE;4BAC/D,EAAE,IAAI,EAAE,gCAAgC,EAAE;4BAC1C,EAAE,IAAI,EAAE,gCAAgC,EAAE;yBAC3C;qBACF;iBACF,CAAC,CAAC;gBAEH,OAAO,uCAAuC,CAAC,eAAe,CAAC,CAAC;YAClE,CAAC;SACF;KACF;CACF,CAAC,CAAC"}