eddev 0.2.67-beta1 → 0.3.0-beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/components/ImageWell.d.ts +2 -2
- package/admin/components/ImageWell.js +51 -39
- package/admin/defineField.d.ts +2 -2
- package/admin/defineWidget.d.ts +1 -1
- package/admin/defineWidget.js +2 -2
- package/admin/index.js +1 -5
- package/admin/installFieldTypes.js +26 -26
- package/admin/runWidgets.js +28 -17
- package/admin/selectMedia.d.ts +2 -2
- package/admin/selectMedia.js +1 -1
- package/blocks/ContentBlocks.d.ts +6 -6
- package/blocks/ContentBlocks.js +66 -58
- package/blocks/ErrorBoundaryEditor.d.ts +1 -1
- package/blocks/ErrorBoundaryEditor.js +45 -16
- package/blocks/ErrorBoundaryFrontend.d.ts +1 -1
- package/blocks/ErrorBoundaryFrontend.js +45 -16
- package/blocks/InspectorControls.d.ts +1 -1
- package/blocks/InspectorControls.js +3 -3
- package/blocks/blockAttributes.d.ts +2 -2
- package/blocks/blockAttributes.js +44 -24
- package/blocks/index.js +1 -5
- package/blocks/inlineEditing.d.ts +6 -6
- package/blocks/inlineEditing.js +55 -36
- package/blocks/installGutenbergHooks.js +68 -48
- package/build/babel/plugin-name-defined-components.js +16 -15
- package/build/build-favicon.js +62 -11
- package/build/clean.js +52 -5
- package/build/create-codegen-worker.js +33 -78
- package/build/create-serverless-dev-worker.js +39 -61
- package/build/create-webpack-worker.js +33 -65
- package/build/file-tree.d.ts +2 -2
- package/build/file-tree.js +12 -12
- package/build/get-webpack-config.js +395 -341
- package/build/graphql-codegen/graphql-codegen-files.js +25 -31
- package/build/graphql-codegen/graphql-codegen-no-duplicates.js +4 -4
- package/build/graphql-codegen/graphql-codegen-queries.js +99 -102
- package/build/manifests/manifest-blocks.d.ts +1 -1
- package/build/manifests/manifest-blocks.js +29 -37
- package/build/manifests/manifest-fields.d.ts +1 -1
- package/build/manifests/manifest-fields.js +21 -23
- package/build/manifests/manifest-views.d.ts +1 -1
- package/build/manifests/manifest-views.js +25 -32
- package/build/manifests/manifest-widgets.d.ts +1 -1
- package/build/manifests/manifest-widgets.js +20 -22
- package/build/manifests/manifest.d.ts +2 -2
- package/build/manifests/manifest.js +94 -30
- package/build/reporter.d.ts +1 -1
- package/build/reporter.js +32 -29
- package/build/serverless/create-next-app.d.ts +1 -1
- package/build/serverless/create-next-app.js +467 -245
- package/build/state/codegen-state.d.ts +4 -4
- package/build/state/compiler-state.d.ts +5 -5
- package/build/state/serverless-state.d.ts +3 -3
- package/build/workers/codegen-worker-script.js +519 -393
- package/build/workers/serverless-worker-dev-script.js +4 -4
- package/build/workers/webpack-worker-script.js +156 -90
- package/cli/build.dev.d.ts +1 -1
- package/cli/build.dev.js +126 -79
- package/cli/build.prod.d.ts +1 -1
- package/cli/build.prod.js +98 -42
- package/cli/cli.js +28 -19
- package/cli/display/components/BundleDisplay.d.ts +1 -1
- package/cli/display/components/BundleDisplay.js +24 -13
- package/cli/display/components/CodegenDisplay.d.ts +1 -1
- package/cli/display/components/CodegenDisplay.js +25 -14
- package/cli/display/components/DevCLIDisplay.d.ts +2 -2
- package/cli/display/components/DevCLIDisplay.js +25 -14
- package/cli/display/components/Fullscreen.js +20 -9
- package/cli/display/components/ServerlessDisplay.d.ts +2 -2
- package/cli/display/components/ServerlessDisplay.js +26 -15
- package/cli/display/components/StatusIcon.d.ts +2 -2
- package/cli/display/components/StatusIcon.js +3 -3
- package/cli/preinstall.js +5 -4
- package/cli/setup.js +73 -25
- package/components/AdminBar.d.ts +1 -1
- package/components/AdminBar.js +3 -37
- package/components/BrowserRouter.d.ts +2 -2
- package/components/BrowserRouter.js +54 -41
- package/components/InlinePage.d.ts +2 -2
- package/components/InlinePage.js +29 -17
- package/components/NextRouter.d.ts +2 -2
- package/components/NextRouter.js +29 -20
- package/components/index.js +1 -5
- package/config/config-schema.d.ts +1 -1
- package/config/config-schema.js +1 -1
- package/config/create-schema-file.js +6 -6
- package/config/get-config.js +13 -10
- package/config/index.js +1 -5
- package/config/parse-config.js +1 -1
- package/config/print-zod-errors.js +3 -3
- package/dev-ui/components/BreakpointColumnHeader.d.ts +2 -2
- package/dev-ui/components/BreakpointColumnHeader.js +18 -7
- package/dev-ui/components/BreakpointIndicator.d.ts +1 -1
- package/dev-ui/components/BreakpointIndicator.js +32 -25
- package/dev-ui/components/DevUI.d.ts +1 -1
- package/dev-ui/components/DevUI.js +13 -13
- package/dev-ui/components/Launcher.d.ts +2 -2
- package/dev-ui/components/Launcher.js +25 -13
- package/dev-ui/components/PanelWrapper.d.ts +2 -2
- package/dev-ui/components/PanelWrapper.js +8 -8
- package/dev-ui/components/ResponsiveLerpControl.d.ts +2 -2
- package/dev-ui/components/ResponsiveLerpControl.js +38 -27
- package/dev-ui/components/ResponsiveScaleEditor.d.ts +4 -4
- package/dev-ui/components/ResponsiveScaleEditor.js +78 -64
- package/dev-ui/components/atoms/Button.js +1 -1
- package/dev-ui/components/atoms/Dropdown.d.ts +3 -3
- package/dev-ui/components/atoms/Dropdown.js +9 -8
- package/dev-ui/components/atoms/NumberField.d.ts +2 -2
- package/dev-ui/components/atoms/NumberField.js +42 -29
- package/dev-ui/components/atoms/Spacer.js +1 -1
- package/dev-ui/components/atoms/Text.js +1 -1
- package/dev-ui/components/atoms/ToggleButton.d.ts +2 -2
- package/dev-ui/components/atoms/ToggleButton.js +16 -5
- package/dev-ui/components/atoms/Tooltip.d.ts +2 -2
- package/dev-ui/components/atoms/Tooltip.js +20 -8
- package/dev-ui/components/panels/AppDataDebugger.d.ts +1 -1
- package/dev-ui/components/panels/AppDataDebugger.js +19 -8
- package/dev-ui/components/panels/ColorEditor.d.ts +1 -1
- package/dev-ui/components/panels/ColorEditor.js +42 -35
- package/dev-ui/components/panels/PageDataDebugger.d.ts +1 -1
- package/dev-ui/components/panels/PageDataDebugger.js +20 -8
- package/dev-ui/components/panels/QueryDebugger.d.ts +1 -1
- package/dev-ui/components/panels/QueryDebugger.js +24 -12
- package/dev-ui/components/panels/SpacingEditor.d.ts +1 -1
- package/dev-ui/components/panels/SpacingEditor.js +48 -34
- package/dev-ui/components/panels/TypographyEditor.d.ts +1 -1
- package/dev-ui/components/panels/TypographyEditor.js +46 -38
- package/dev-ui/hooks/useBreakpoint.d.ts +1 -1
- package/dev-ui/hooks/useBreakpoint.js +13 -13
- package/dev-ui/hooks/usePersistState.js +7 -6
- package/dev-ui/hooks/useStylesheet.js +6 -6
- package/dev-ui/icons.d.ts +15 -15
- package/dev-ui/icons.js +27 -16
- package/dev-ui/index.js +1 -5
- package/dev-ui/loader.d.ts +1 -1
- package/dev-ui/loader.js +9 -13
- package/dev-ui/panels.d.ts +2 -2
- package/dev-ui/panels.js +7 -7
- package/dev-ui/theme.js +3 -3
- package/dynamic/dynamic-component.js +1 -1
- package/dynamic/index.js +1 -5
- package/entry/Root.d.ts +2 -2
- package/entry/Root.js +26 -16
- package/entry/entry.admin.dev.js +4 -4
- package/entry/entry.admin.prod.js +4 -4
- package/entry/entry.monolith.dev.js +5 -5
- package/entry/entry.monolith.prod.js +5 -5
- package/gravityforms/gravity-forms.d.ts +2 -2
- package/gravityforms/index.js +1 -5
- package/gravityforms/useGravityForm.d.ts +2 -2
- package/gravityforms/useGravityForm.js +130 -126
- package/hooks/index.js +1 -5
- package/hooks/queryUtils.d.ts +14 -14
- package/hooks/queryUtils.js +192 -101
- package/hooks/useAppData.d.ts +2 -2
- package/hooks/useAppData.js +9 -9
- package/hooks/usePageLoad.js +4 -4
- package/hooks/useQueryDebug.d.ts +1 -1
- package/hooks/useQueryDebug.js +7 -7
- package/hooks/useRPC.d.ts +4 -4
- package/hooks/useRPC.js +3 -3
- package/package.json +11 -11
- package/routing/index.js +1 -5
- package/routing/remoteProps.d.ts +1 -1
- package/routing/remoteProps.js +72 -31
- package/routing/routing.d.ts +25 -15
- package/routing/routing.js +200 -112
- package/routing/updateEditLink.js +1 -1
- package/serverless/define-api.d.ts +1 -1
- package/serverless/define-rpc-router.js +4 -8
- package/serverless/index.js +2 -6
- package/style/createStitches.js +142 -164
- package/style/index.js +1 -5
- package/tsconfig.json +1 -1
- package/utils/Observable.d.ts +2 -2
- package/utils/Observable.js +15 -12
- package/utils/getRepoName.js +3 -3
- package/utils/promptIfRepoNameIncorrect.js +64 -18
- package/utils/refreshOverlayInterop.js +1 -1
- package/utils/reportErrorStack.d.ts +1 -1
- package/utils/reportErrorStack.js +1 -1
- package/utils/serverlessAppContext.js +1 -1
- package/utils/updateEnvFile.js +69 -19
- package/utils/useObservable.js +3 -3
- package/views/index.js +1 -5
|
@@ -1,70 +1,77 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
2
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
50
|
exports.useGravityForm = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
51
|
+
var react_1 = require("react");
|
|
52
|
+
var react_2 = require("react");
|
|
53
|
+
var react_3 = require("react");
|
|
54
|
+
var reducer = function (state, action) {
|
|
55
|
+
var _a, _b, _c;
|
|
8
56
|
switch (action.type) {
|
|
9
57
|
case "field":
|
|
10
|
-
return {
|
|
11
|
-
...state,
|
|
12
|
-
errors: {
|
|
13
|
-
...state.errors,
|
|
14
|
-
[action.id]: undefined,
|
|
15
|
-
},
|
|
16
|
-
values: {
|
|
17
|
-
...state.values,
|
|
18
|
-
[action.id]: action.value,
|
|
19
|
-
},
|
|
20
|
-
};
|
|
58
|
+
return __assign(__assign({}, state), { errors: __assign(__assign({}, state.errors), (_a = {}, _a[action.id] = undefined, _a)), values: __assign(__assign({}, state.values), (_b = {}, _b[action.id] = action.value, _b)) });
|
|
21
59
|
case "submitting":
|
|
22
|
-
return {
|
|
23
|
-
...state,
|
|
24
|
-
errors: {},
|
|
25
|
-
validity: {},
|
|
26
|
-
hasErrors: false,
|
|
27
|
-
submitting: true,
|
|
28
|
-
};
|
|
60
|
+
return __assign(__assign({}, state), { errors: {}, validity: {}, hasErrors: false, submitting: true });
|
|
29
61
|
case "success":
|
|
30
|
-
return {
|
|
31
|
-
...state,
|
|
32
|
-
submitting: false,
|
|
33
|
-
complete: true,
|
|
34
|
-
errors: {},
|
|
35
|
-
validity: {},
|
|
36
|
-
hasErrors: false,
|
|
37
|
-
successMessage: action.message,
|
|
38
|
-
};
|
|
62
|
+
return __assign(__assign({}, state), { submitting: false, complete: true, errors: {}, validity: {}, hasErrors: false, successMessage: action.message });
|
|
39
63
|
case "mainError":
|
|
40
|
-
return {
|
|
41
|
-
...state,
|
|
42
|
-
submitting: false,
|
|
43
|
-
hasErrors: true,
|
|
44
|
-
mainError: action.message,
|
|
45
|
-
};
|
|
64
|
+
return __assign(__assign({}, state), { submitting: false, hasErrors: true, mainError: action.message });
|
|
46
65
|
case "errors":
|
|
47
|
-
return {
|
|
48
|
-
...state,
|
|
49
|
-
submitting: false,
|
|
50
|
-
hasErrors: true,
|
|
51
|
-
errors: action.errors,
|
|
52
|
-
};
|
|
66
|
+
return __assign(__assign({}, state), { submitting: false, hasErrors: true, errors: action.errors });
|
|
53
67
|
case "clearError":
|
|
54
|
-
return {
|
|
55
|
-
...state,
|
|
56
|
-
submitting: false,
|
|
57
|
-
errors: {
|
|
58
|
-
...state.errors,
|
|
59
|
-
[action.id]: undefined,
|
|
60
|
-
},
|
|
61
|
-
};
|
|
68
|
+
return __assign(__assign({}, state), { submitting: false, errors: __assign(__assign({}, state.errors), (_c = {}, _c[action.id] = undefined, _c)) });
|
|
62
69
|
default:
|
|
63
|
-
throw new Error(
|
|
70
|
+
throw new Error("Unknown GravityForms action ".concat(JSON.stringify(action)));
|
|
64
71
|
}
|
|
65
72
|
return state;
|
|
66
73
|
};
|
|
67
|
-
|
|
74
|
+
var initializer = function (form) {
|
|
68
75
|
return {
|
|
69
76
|
submitting: false,
|
|
70
77
|
mainError: null,
|
|
@@ -77,23 +84,18 @@ const initializer = (form) => {
|
|
|
77
84
|
};
|
|
78
85
|
};
|
|
79
86
|
function useGravityForm(opts) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
}));
|
|
90
|
-
const [submitter, setSubmitter] = (0, react_2.useState)(null);
|
|
91
|
-
(0, react_1.useEffect)(() => {
|
|
92
|
-
let cancelled = false;
|
|
87
|
+
var form = opts.form;
|
|
88
|
+
var _a = (0, react_3.useReducer)(reducer, form, initializer), state = _a[0], dispatch = _a[1];
|
|
89
|
+
var fields = form.fields.map(function (field) { return (__assign(__assign({}, field), { value: state.values[field.id], error: state.errors[field.id], set: function (value) {
|
|
90
|
+
dispatch({ type: "field", id: field.id, value: value });
|
|
91
|
+
} })); });
|
|
92
|
+
var _b = (0, react_2.useState)(null), submitter = _b[0], setSubmitter = _b[1];
|
|
93
|
+
(0, react_1.useEffect)(function () {
|
|
94
|
+
var cancelled = false;
|
|
93
95
|
setSubmitter({
|
|
94
|
-
submit: (state)
|
|
96
|
+
submit: function (state) {
|
|
95
97
|
dispatch({ type: "submitting" });
|
|
96
|
-
submit(form, state).then((result)
|
|
98
|
+
submit(form, state).then(function (result) {
|
|
97
99
|
if (cancelled)
|
|
98
100
|
return;
|
|
99
101
|
if (result.success) {
|
|
@@ -108,32 +110,27 @@ function useGravityForm(opts) {
|
|
|
108
110
|
});
|
|
109
111
|
},
|
|
110
112
|
});
|
|
111
|
-
return ()
|
|
113
|
+
return function () {
|
|
112
114
|
cancelled = true;
|
|
113
115
|
};
|
|
114
116
|
}, []);
|
|
115
|
-
return {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
},
|
|
121
|
-
updateField(id, value) {
|
|
122
|
-
dispatch({ type: "field", id, value });
|
|
123
|
-
},
|
|
124
|
-
};
|
|
117
|
+
return __assign(__assign({}, state), { fields: fields, submit: function () {
|
|
118
|
+
submitter === null || submitter === void 0 ? void 0 : submitter.submit(state);
|
|
119
|
+
}, updateField: function (id, value) {
|
|
120
|
+
dispatch({ type: "field", id: id, value: value });
|
|
121
|
+
} });
|
|
125
122
|
}
|
|
126
123
|
exports.useGravityForm = useGravityForm;
|
|
127
124
|
function prepareValuesPayload(form, state, data) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
125
|
+
var _loop_1 = function (field) {
|
|
126
|
+
var value = state.values[field.id];
|
|
127
|
+
var key = "input_" + field.id;
|
|
131
128
|
if (field.type === "consent") {
|
|
132
129
|
key += "_1";
|
|
133
130
|
}
|
|
134
131
|
if (field.type === "checkbox") {
|
|
135
|
-
field.choices.forEach((choice, i)
|
|
136
|
-
data.append(
|
|
132
|
+
field.choices.forEach(function (choice, i) {
|
|
133
|
+
data.append("".concat(key, ".").concat(i + 1), (value === null || value === void 0 ? void 0 : value.includes(choice.value)) ? choice.value : "");
|
|
137
134
|
// data[`${key}.${i + 1}`] =
|
|
138
135
|
});
|
|
139
136
|
}
|
|
@@ -147,50 +144,57 @@ function prepareValuesPayload(form, state, data) {
|
|
|
147
144
|
}
|
|
148
145
|
// data[key] = value
|
|
149
146
|
}
|
|
147
|
+
};
|
|
148
|
+
for (var _i = 0, _a = form.fields; _i < _a.length; _i++) {
|
|
149
|
+
var field = _a[_i];
|
|
150
|
+
_loop_1(field);
|
|
150
151
|
}
|
|
151
152
|
// return data
|
|
152
153
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
154
|
+
function submit(form, state) {
|
|
155
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
156
|
+
var url, data, result, payload, err_1;
|
|
157
|
+
return __generator(this, function (_a) {
|
|
158
|
+
switch (_a.label) {
|
|
159
|
+
case 0:
|
|
160
|
+
_a.trys.push([0, 3, , 4]);
|
|
161
|
+
url = process.serverless ? "/api/rest/form-submit" : "/wp-json/ed/v1/gf/submit-with-uploads";
|
|
162
|
+
data = new FormData();
|
|
163
|
+
data.append("formID", String(form.id));
|
|
164
|
+
prepareValuesPayload(form, state, data);
|
|
165
|
+
return [4 /*yield*/, fetch(url, {
|
|
166
|
+
method: "POST",
|
|
167
|
+
headers: {
|
|
168
|
+
// "Content-type": "application/json",
|
|
169
|
+
},
|
|
170
|
+
credentials: "include",
|
|
171
|
+
body: data,
|
|
172
|
+
})];
|
|
173
|
+
case 1:
|
|
174
|
+
result = _a.sent();
|
|
175
|
+
return [4 /*yield*/, result.json()];
|
|
176
|
+
case 2:
|
|
177
|
+
payload = _a.sent();
|
|
178
|
+
if (!payload.is_valid) {
|
|
179
|
+
return [2 /*return*/, __assign(__assign({}, payload), { success: false, errors: payload.validation_messages })];
|
|
180
|
+
}
|
|
181
|
+
else if (payload.is_valid) {
|
|
182
|
+
return [2 /*return*/, __assign(__assign({}, payload), { success: true, successMessage: payload.confirmation_message })];
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
console.error("Not sure what to do with GF response", payload);
|
|
186
|
+
return [2 /*return*/, __assign({}, payload)];
|
|
187
|
+
}
|
|
188
|
+
return [3 /*break*/, 4];
|
|
189
|
+
case 3:
|
|
190
|
+
err_1 = _a.sent();
|
|
191
|
+
console.error(err_1);
|
|
192
|
+
return [2 /*return*/, {
|
|
193
|
+
success: false,
|
|
194
|
+
mainError: "An error occurred while submitting this form. Please contact us directly if the issue persists.",
|
|
195
|
+
}];
|
|
196
|
+
case 4: return [2 /*return*/];
|
|
197
|
+
}
|
|
166
198
|
});
|
|
167
|
-
|
|
168
|
-
if (!payload.is_valid) {
|
|
169
|
-
return {
|
|
170
|
-
...payload,
|
|
171
|
-
success: false,
|
|
172
|
-
errors: payload.validation_messages,
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
else if (payload.is_valid) {
|
|
176
|
-
return {
|
|
177
|
-
...payload,
|
|
178
|
-
success: true,
|
|
179
|
-
successMessage: payload.confirmation_message,
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
console.error("Not sure what to do with GF response", payload);
|
|
184
|
-
return {
|
|
185
|
-
...payload,
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
catch (err) {
|
|
190
|
-
console.error(err);
|
|
191
|
-
return {
|
|
192
|
-
success: false,
|
|
193
|
-
mainError: "An error occurred while submitting this form. Please contact us directly if the issue persists.",
|
|
194
|
-
};
|
|
195
|
-
}
|
|
199
|
+
});
|
|
196
200
|
}
|
package/hooks/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
|
|
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);
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
5
|
}) : (function(o, m, k, k2) {
|
|
10
6
|
if (k2 === undefined) k2 = k;
|
|
11
7
|
o[k2] = m[k];
|
package/hooks/queryUtils.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
/** Generic Error */
|
|
2
|
-
type GraphQLError = {
|
|
2
|
+
declare type GraphQLError = {
|
|
3
3
|
message: string;
|
|
4
4
|
};
|
|
5
5
|
/** Regular queries */
|
|
6
|
-
type CreateUseQueryOptions = {
|
|
6
|
+
declare type CreateUseQueryOptions = {
|
|
7
7
|
name: string;
|
|
8
8
|
};
|
|
9
|
-
type QueryOptions = {
|
|
9
|
+
declare type QueryOptions = {
|
|
10
10
|
revalidateIfStale?: boolean;
|
|
11
11
|
revalidateOnFocus?: boolean;
|
|
12
12
|
};
|
|
13
|
-
type MaybeVars = {
|
|
13
|
+
declare type MaybeVars = {
|
|
14
14
|
[key: string]: any;
|
|
15
15
|
} | undefined;
|
|
16
|
-
type QueryHookReturn<TReturn, TVars> = {
|
|
16
|
+
declare type QueryHookReturn<TReturn, TVars> = {
|
|
17
17
|
loading: boolean;
|
|
18
18
|
errors?: GraphQLError[];
|
|
19
19
|
data?: TReturn;
|
|
20
20
|
refresh: (vars?: TVars) => void;
|
|
21
21
|
};
|
|
22
|
-
type QueryHook<TReturn, TVars> = TVars extends undefined ? (vars?: TVars, opts?: QueryOptions) => QueryHookReturn<TReturn, TVars> : (vars: TVars, opts?: QueryOptions) => QueryHookReturn<TReturn, TVars>;
|
|
23
|
-
type QueryFetcher<TReturn, TVars> = {
|
|
22
|
+
declare type QueryHook<TReturn, TVars> = TVars extends undefined ? (vars?: TVars, opts?: QueryOptions) => QueryHookReturn<TReturn, TVars> : (vars: TVars, opts?: QueryOptions) => QueryHookReturn<TReturn, TVars>;
|
|
23
|
+
declare type QueryFetcher<TReturn, TVars> = {
|
|
24
24
|
fetch: TVars extends undefined ? (vars?: TVars) => Promise<TReturn> : (vars: TVars) => Promise<TReturn>;
|
|
25
25
|
};
|
|
26
26
|
export declare function createUseQuery<TReturn extends any, TVars extends MaybeVars>(init: CreateUseQueryOptions): QueryHook<TReturn, TVars> & QueryFetcher<TReturn, TVars>;
|
|
27
27
|
/** Infinite queries */
|
|
28
|
-
type CreateUseInfiniteQueryOptions = {
|
|
28
|
+
declare type CreateUseInfiniteQueryOptions = {
|
|
29
29
|
name: string;
|
|
30
30
|
defaultLimit: number;
|
|
31
31
|
paths: {
|
|
@@ -35,7 +35,7 @@ type CreateUseInfiniteQueryOptions = {
|
|
|
35
35
|
hasNextPagePath: string[];
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
|
-
type InfiniteQueryHookReturn<TItem, TVars> = {
|
|
38
|
+
declare type InfiniteQueryHookReturn<TItem, TVars> = {
|
|
39
39
|
loading: boolean;
|
|
40
40
|
loadingMore: boolean;
|
|
41
41
|
errors?: GraphQLError[];
|
|
@@ -45,18 +45,18 @@ type InfiniteQueryHookReturn<TItem, TVars> = {
|
|
|
45
45
|
refresh: () => void;
|
|
46
46
|
loadMore: () => void;
|
|
47
47
|
};
|
|
48
|
-
type InfiniteQueryHasAdditionalVars<TVars> = Exclude<keyof TVars, "limit" | "cursor"> extends never ? false : true;
|
|
49
|
-
type InfiniteQueryHook<TItem, TVars> = InfiniteQueryHasAdditionalVars<TVars> extends false ? (vars?: TVars, opts?: QueryOptions) => InfiniteQueryHookReturn<TItem, TVars> : (vars: TVars, opts?: QueryOptions) => InfiniteQueryHookReturn<TItem, TVars>;
|
|
48
|
+
declare type InfiniteQueryHasAdditionalVars<TVars> = Exclude<keyof TVars, "limit" | "cursor"> extends never ? false : true;
|
|
49
|
+
declare type InfiniteQueryHook<TItem, TVars> = InfiniteQueryHasAdditionalVars<TVars> extends false ? (vars?: TVars, opts?: QueryOptions) => InfiniteQueryHookReturn<TItem, TVars> : (vars: TVars, opts?: QueryOptions) => InfiniteQueryHookReturn<TItem, TVars>;
|
|
50
50
|
export declare function createUseInfiniteQuery<TItem, TVars extends MaybeVars>(init: CreateUseInfiniteQueryOptions): InfiniteQueryHook<TItem, TVars>;
|
|
51
|
-
type MutationHookReturn<TReturn, TVars> = {
|
|
51
|
+
declare type MutationHookReturn<TReturn, TVars> = {
|
|
52
52
|
submitting: boolean;
|
|
53
53
|
submitted: boolean;
|
|
54
54
|
errors?: GraphQLError[];
|
|
55
55
|
data?: TReturn;
|
|
56
56
|
submit: (vars: TVars) => void;
|
|
57
57
|
};
|
|
58
|
-
type MutationHook<TReturn, TVars> = (opts?: QueryOptions) => MutationHookReturn<TReturn, TVars>;
|
|
59
|
-
type MutationFetcher<TReturn, TVars> = {
|
|
58
|
+
declare type MutationHook<TReturn, TVars> = (opts?: QueryOptions) => MutationHookReturn<TReturn, TVars>;
|
|
59
|
+
declare type MutationFetcher<TReturn, TVars> = {
|
|
60
60
|
mutate: (vars: TVars) => Promise<TReturn>;
|
|
61
61
|
};
|
|
62
62
|
export declare function createUseMutation<TReturn extends any, TVars extends MaybeVars>(init: CreateUseQueryOptions): MutationHook<TReturn, TVars> & MutationFetcher<TReturn, TVars>;
|