eddev 0.3.21 → 0.3.22

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.
@@ -21,7 +21,6 @@ var widgets_1 = __importDefault(require("@manifest/widgets"));
21
21
  var client_1 = require("react-dom/client");
22
22
  function runWidgets() {
23
23
  var elements = document.querySelectorAll("[data-widget]");
24
- console.log("Running widgets", elements, widgets_1.default);
25
24
  elements.forEach(function (el) {
26
25
  if (el instanceof HTMLElement) {
27
26
  var data = el.dataset;
package/cli/build.dev.js CHANGED
@@ -66,7 +66,7 @@ function devCommand(opts) {
66
66
  case 0:
67
67
  version = require(path_1.default.join(__dirname, "../package.json")).version;
68
68
  requiredVersion = require(path_1.default.join(process.cwd(), "package.json")).devDependencies.eddev;
69
- if ((0, compare_versions_1.default)(version, requiredVersion) < 0) {
69
+ if (!version.includes("*") && !version.includes("workspace:") && (0, compare_versions_1.default)(version, requiredVersion) < 0) {
70
70
  console.log(chalk_1.default.red("\uD83D\uDEA8 Incorrect 'eddev' version installed!\n\uD83D\uDEA8 Your package.json requires ".concat(chalk_1.default.yellow(requiredVersion), ", but you have ").concat(chalk_1.default.yellow(version), ".\n\uD83D\uDEA8 Do you need to run 'yarn'?")));
71
71
  process.exit(1);
72
72
  }
package/dev-ui/theme.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const styled: <Type extends import("@stitches/react/types/util").Function | keyof JSX.IntrinsicElements | import("react").ComponentType<any>, Composers extends (string | import("@stitches/react/types/util").Function | import("react").ComponentType<any> | {
3
2
  [name: string]: unknown;
4
3
  })[], CSS = import("@stitches/react/types/css-util").CSS<{}, {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const dynamic: {
3
2
  <Props, Module = import("@loadable/component").DefaultComponent<Props>>(loadFn: (props: Props) => Promise<Module>, options: import("@loadable/component").OptionsWithResolver<Props, Module>): import("@loadable/component").LoadableComponent<Props>;
4
3
  <Props_1>(loadFn: (props: Props_1) => Promise<import("@loadable/component").DefaultComponent<Props_1>>, options?: import("@loadable/component").OptionsWithoutResolver<Props_1> | undefined): import("@loadable/component").LoadableComponent<Props_1>;
@@ -62,6 +62,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
62
62
  exports.createUseMutation = exports.createUseInfiniteQuery = exports.createUseQuery = void 0;
63
63
  var react_1 = require("react");
64
64
  var swr_1 = __importDefault(require("swr"));
65
+ function getNonceHeader() {
66
+ var _a;
67
+ // @ts-ignore
68
+ if ((_a = window === null || window === void 0 ? void 0 : window.wpApiSettings) === null || _a === void 0 ? void 0 : _a.nonce) {
69
+ return {
70
+ // @ts-ignore
71
+ "X-WP-Nonce": window.wpApiSettings.nonce,
72
+ };
73
+ }
74
+ else {
75
+ return {};
76
+ }
77
+ }
65
78
  /** Generic fetcher functions */
66
79
  var fetcherGET = function (name, params) { return __awaiter(void 0, void 0, void 0, function () {
67
80
  var url, result, payload;
@@ -71,7 +84,9 @@ var fetcherGET = function (name, params) { return __awaiter(void 0, void 0, void
71
84
  url = process.serverless ? "/api/rest/query/".concat(name) : "/wp-json/ed/v1/query/".concat(name);
72
85
  if (params)
73
86
  url += "?params=" + encodeURIComponent(params);
74
- return [4 /*yield*/, fetch(url, {})];
87
+ return [4 /*yield*/, fetch(url, {
88
+ headers: getNonceHeader(),
89
+ })];
75
90
  case 1:
76
91
  result = _a.sent();
77
92
  return [4 /*yield*/, result.json()];
@@ -198,9 +213,7 @@ function createUseMutation(init) {
198
213
  _a.trys.push([1, 4, , 5]);
199
214
  return [4 /*yield*/, fetch(url, {
200
215
  method: "POST",
201
- headers: {
202
- "Content-type": "application/json",
203
- },
216
+ headers: __assign({ "Content-type": "application/json" }, getNonceHeader()),
204
217
  credentials: "include",
205
218
  body: JSON.stringify(params),
206
219
  })];
@@ -244,9 +257,7 @@ function createUseMutation(init) {
244
257
  url = process.serverless ? "/api/rest/mutation/".concat(init.name) : "/wp-json/ed/v1/mutation/".concat(init.name);
245
258
  return [4 /*yield*/, fetch(url, {
246
259
  method: "POST",
247
- headers: {
248
- "Content-type": "application/json",
249
- },
260
+ headers: __assign({ "Content-type": "application/json" }, getNonceHeader()),
250
261
  credentials: "include",
251
262
  body: JSON.stringify(vars),
252
263
  })];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eddev",
3
- "version": "0.3.21",
3
+ "version": "0.3.22",
4
4
  "main": "./index.js",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { DefaultThemeMap } from "@stitches/react";
3
2
  import { ConfigType } from "@stitches/core/types/config";
4
3
  import { Properties as CSS } from "csstype";
@@ -1,17 +0,0 @@
1
- export declare type GravityFormsField = {
2
- type: string;
3
- id: number;
4
- label: string;
5
- isRequired: boolean;
6
- } & {
7
- [key: string]: any;
8
- };
9
- export declare type GravityFormData = {
10
- id: number;
11
- fields: GravityFormsField[];
12
- title: string;
13
- description?: string;
14
- button: {
15
- text: string;
16
- };
17
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });