eddev 0.2.17 → 0.2.20
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/config/config-schema.d.ts +13 -0
- package/config/config-schema.js +5 -0
- package/config/get-config.d.ts +9 -0
- package/config/parse-config.d.ts +6 -0
- package/gravityforms/useGravityForm.js +2 -0
- package/hooks/queryUtils.js +1 -1
- package/package.json +1 -1
- package/serverless-template/pages/_document.tsx +23 -0
- package/serverless-template/pages/api/rest/[...method].ts +2 -1
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const EDConfigSchema: z.ZodObject<{
|
|
3
3
|
$schema: z.ZodOptional<z.ZodString>;
|
|
4
|
+
tracking: z.ZodOptional<z.ZodObject<{
|
|
5
|
+
tagManagerID: z.ZodOptional<z.ZodString>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
tagManagerID?: string | undefined;
|
|
8
|
+
}, {
|
|
9
|
+
tagManagerID?: string | undefined;
|
|
10
|
+
}>>;
|
|
4
11
|
serverless: z.ZodOptional<z.ZodObject<{
|
|
5
12
|
enabled: z.ZodBoolean;
|
|
6
13
|
uploads: z.ZodEnum<["proxy", "remote"]>;
|
|
@@ -45,6 +52,9 @@ export declare const EDConfigSchema: z.ZodObject<{
|
|
|
45
52
|
devUI: z.ZodEnum<["disabled", "enabled"]>;
|
|
46
53
|
}, "strip", z.ZodTypeAny, {
|
|
47
54
|
$schema?: string | undefined;
|
|
55
|
+
tracking?: {
|
|
56
|
+
tagManagerID?: string | undefined;
|
|
57
|
+
} | undefined;
|
|
48
58
|
serverless?: {
|
|
49
59
|
themeAssets?: string[] | undefined;
|
|
50
60
|
apiOnly?: boolean | undefined;
|
|
@@ -63,6 +73,9 @@ export declare const EDConfigSchema: z.ZodObject<{
|
|
|
63
73
|
devUI: "disabled" | "enabled";
|
|
64
74
|
}, {
|
|
65
75
|
$schema?: string | undefined;
|
|
76
|
+
tracking?: {
|
|
77
|
+
tagManagerID?: string | undefined;
|
|
78
|
+
} | undefined;
|
|
66
79
|
serverless?: {
|
|
67
80
|
themeAssets?: string[] | undefined;
|
|
68
81
|
apiOnly?: boolean | undefined;
|
package/config/config-schema.js
CHANGED
|
@@ -4,6 +4,11 @@ exports.EDConfigSchema = void 0;
|
|
|
4
4
|
var zod_1 = require("zod");
|
|
5
5
|
exports.EDConfigSchema = zod_1.z.object({
|
|
6
6
|
$schema: zod_1.z.string().optional(),
|
|
7
|
+
tracking: zod_1.z
|
|
8
|
+
.object({
|
|
9
|
+
tagManagerID: zod_1.z.string().optional(),
|
|
10
|
+
})
|
|
11
|
+
.optional(),
|
|
7
12
|
serverless: zod_1.z
|
|
8
13
|
.object({
|
|
9
14
|
enabled: zod_1.z.boolean(),
|
package/config/get-config.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export declare function getEDConfig(dir?: string): import("zod").SafeParseReturnType<{
|
|
2
2
|
$schema?: string | undefined;
|
|
3
|
+
tracking?: {
|
|
4
|
+
tagManagerID?: string | undefined;
|
|
5
|
+
} | undefined;
|
|
3
6
|
serverless?: {
|
|
4
7
|
themeAssets?: string[] | undefined;
|
|
5
8
|
apiOnly?: boolean | undefined;
|
|
@@ -18,6 +21,9 @@ export declare function getEDConfig(dir?: string): import("zod").SafeParseReturn
|
|
|
18
21
|
devUI: "disabled" | "enabled";
|
|
19
22
|
}, {
|
|
20
23
|
$schema?: string | undefined;
|
|
24
|
+
tracking?: {
|
|
25
|
+
tagManagerID?: string | undefined;
|
|
26
|
+
} | undefined;
|
|
21
27
|
serverless?: {
|
|
22
28
|
themeAssets?: string[] | undefined;
|
|
23
29
|
apiOnly?: boolean | undefined;
|
|
@@ -37,6 +43,9 @@ export declare function getEDConfig(dir?: string): import("zod").SafeParseReturn
|
|
|
37
43
|
}>;
|
|
38
44
|
export declare function getEDConfigUnwrapped(dir?: string): {
|
|
39
45
|
$schema?: string | undefined;
|
|
46
|
+
tracking?: {
|
|
47
|
+
tagManagerID?: string | undefined;
|
|
48
|
+
} | undefined;
|
|
40
49
|
serverless?: {
|
|
41
50
|
themeAssets?: string[] | undefined;
|
|
42
51
|
apiOnly?: boolean | undefined;
|
package/config/parse-config.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export declare function parseConfig(config: any): import("zod").SafeParseReturnType<{
|
|
2
2
|
$schema?: string | undefined;
|
|
3
|
+
tracking?: {
|
|
4
|
+
tagManagerID?: string | undefined;
|
|
5
|
+
} | undefined;
|
|
3
6
|
serverless?: {
|
|
4
7
|
themeAssets?: string[] | undefined;
|
|
5
8
|
apiOnly?: boolean | undefined;
|
|
@@ -18,6 +21,9 @@ export declare function parseConfig(config: any): import("zod").SafeParseReturnT
|
|
|
18
21
|
devUI: "disabled" | "enabled";
|
|
19
22
|
}, {
|
|
20
23
|
$schema?: string | undefined;
|
|
24
|
+
tracking?: {
|
|
25
|
+
tagManagerID?: string | undefined;
|
|
26
|
+
} | undefined;
|
|
21
27
|
serverless?: {
|
|
22
28
|
themeAssets?: string[] | undefined;
|
|
23
29
|
apiOnly?: boolean | undefined;
|
|
@@ -53,6 +53,7 @@ var react_2 = require("react");
|
|
|
53
53
|
var react_3 = require("react");
|
|
54
54
|
var reducer = function (state, action) {
|
|
55
55
|
var _a, _b, _c;
|
|
56
|
+
console.log("Dispatch", state, action);
|
|
56
57
|
switch (action.type) {
|
|
57
58
|
case "field":
|
|
58
59
|
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)) });
|
|
@@ -98,6 +99,7 @@ function useGravityForm(opts) {
|
|
|
98
99
|
submit(form, state).then(function (result) {
|
|
99
100
|
if (cancelled)
|
|
100
101
|
return;
|
|
102
|
+
console.log("Submitted", result);
|
|
101
103
|
if (result.success) {
|
|
102
104
|
dispatch({ type: "success", message: result.successMessage || "" });
|
|
103
105
|
}
|
package/hooks/queryUtils.js
CHANGED
|
@@ -189,7 +189,7 @@ function createUseMutation(init) {
|
|
|
189
189
|
case 0:
|
|
190
190
|
setSubmitting(true);
|
|
191
191
|
setSubmitted(false);
|
|
192
|
-
url = process.serverless ? "/api/mutation/".concat(init.name) : "/wp-json/ed/v1/mutation/".concat(init.name);
|
|
192
|
+
url = process.serverless ? "/api/rest/mutation/".concat(init.name) : "/wp-json/ed/v1/mutation/".concat(init.name);
|
|
193
193
|
_a.label = 1;
|
|
194
194
|
case 1:
|
|
195
195
|
_a.trys.push([1, 4, , 5]);
|
package/package.json
CHANGED
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import NextDocument, { Html, Head, Main, NextScript } from "next/document"
|
|
3
|
+
// @ts-ignore
|
|
3
4
|
import { getCssText } from "@theme"
|
|
5
|
+
import Script from "next/script"
|
|
6
|
+
import settings from "_utils/ed-config"
|
|
4
7
|
|
|
5
8
|
export default class Document extends NextDocument {
|
|
6
9
|
render() {
|
|
10
|
+
console.log("GTM", settings.tracking?.tagManagerID)
|
|
7
11
|
return (
|
|
8
12
|
<Html lang="en">
|
|
9
13
|
<Head>
|
|
10
14
|
<style id="stitches" dangerouslySetInnerHTML={{ __html: getCssText() }} />
|
|
15
|
+
{settings.tracking?.tagManagerID ? (
|
|
16
|
+
<script
|
|
17
|
+
dangerouslySetInnerHTML={{
|
|
18
|
+
__html: `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
|
19
|
+
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
|
20
|
+
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
|
21
|
+
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
|
22
|
+
})(window,document,'script','dataLayer',${JSON.stringify(settings.tracking.tagManagerID)});console.log('GTM');`,
|
|
23
|
+
}}
|
|
24
|
+
></script>
|
|
25
|
+
) : null}
|
|
11
26
|
</Head>
|
|
12
27
|
<body>
|
|
28
|
+
{settings.tracking?.tagManagerID ? (
|
|
29
|
+
<noscript
|
|
30
|
+
dangerouslySetInnerHTML={{
|
|
31
|
+
__html: `<iframe src="https://www.googletagmanager.com/ns.html?id=${settings.tracking.tagManagerID}"
|
|
32
|
+
height="0" width="0" style="display:none;visibility:hidden"></iframe>`,
|
|
33
|
+
}}
|
|
34
|
+
></noscript>
|
|
35
|
+
) : null}
|
|
13
36
|
<Main />
|
|
14
37
|
<NextScript />
|
|
15
38
|
</body>
|
|
@@ -4,7 +4,7 @@ import { fetchWP } from "../../../_utils/fetch-wp"
|
|
|
4
4
|
const validProxyPaths = {
|
|
5
5
|
"form-submit": {
|
|
6
6
|
path: "/wp-json/ed/v1/gf/submit",
|
|
7
|
-
method: "
|
|
7
|
+
method: "POST",
|
|
8
8
|
},
|
|
9
9
|
query: {
|
|
10
10
|
path: "/wp-json/ed/v1/query/*",
|
|
@@ -35,6 +35,7 @@ export default async function (req: NextApiRequest, res: NextApiResponse) {
|
|
|
35
35
|
headers: {
|
|
36
36
|
"Content-Type": "application/json",
|
|
37
37
|
},
|
|
38
|
+
body: proxyPath.method === "POST" ? JSON.stringify(req.body) : undefined,
|
|
38
39
|
},
|
|
39
40
|
async (response) => ({
|
|
40
41
|
payload: await response.json(),
|