@wordpress/e2e-test-utils-playwright 1.32.0 → 1.32.1-next.ff1cebbba.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 (113) hide show
  1. package/build/admin/create-new-post.js +46 -28
  2. package/build/admin/create-new-post.js.map +7 -1
  3. package/build/admin/edit-post.js +35 -17
  4. package/build/admin/edit-post.js.map +7 -1
  5. package/build/admin/get-page-error.js +30 -22
  6. package/build/admin/get-page-error.js.map +7 -1
  7. package/build/admin/index.js +54 -34
  8. package/build/admin/index.js.map +7 -1
  9. package/build/admin/visit-admin-page.js +42 -29
  10. package/build/admin/visit-admin-page.js.map +7 -1
  11. package/build/admin/visit-site-editor.js +71 -64
  12. package/build/admin/visit-site-editor.js.map +7 -1
  13. package/build/config.js +40 -10
  14. package/build/config.js.map +7 -1
  15. package/build/editor/click-block-options-menu-item.js +29 -14
  16. package/build/editor/click-block-options-menu-item.js.map +7 -1
  17. package/build/editor/click-block-toolbar-button.js +33 -13
  18. package/build/editor/click-block-toolbar-button.js.map +7 -1
  19. package/build/editor/get-blocks.js +59 -43
  20. package/build/editor/get-blocks.js.map +7 -1
  21. package/build/editor/get-edited-post-content.js +31 -12
  22. package/build/editor/get-edited-post-content.js.map +7 -1
  23. package/build/editor/index.js +92 -72
  24. package/build/editor/index.js.map +7 -1
  25. package/build/editor/insert-block.js +50 -21
  26. package/build/editor/insert-block.js.map +7 -1
  27. package/build/editor/open-document-settings-sidebar.js +37 -24
  28. package/build/editor/open-document-settings-sidebar.js.map +7 -1
  29. package/build/editor/preview.js +37 -18
  30. package/build/editor/preview.js.map +7 -1
  31. package/build/editor/publish-post.js +42 -42
  32. package/build/editor/publish-post.js.map +7 -1
  33. package/build/editor/save-draft.js +29 -15
  34. package/build/editor/save-draft.js.map +7 -1
  35. package/build/editor/select-blocks.js +46 -25
  36. package/build/editor/select-blocks.js.map +7 -1
  37. package/build/editor/set-content.js +34 -14
  38. package/build/editor/set-content.js.map +7 -1
  39. package/build/editor/set-is-fixed-toolbar.js +31 -15
  40. package/build/editor/set-is-fixed-toolbar.js.map +7 -1
  41. package/build/editor/set-preferences.js +38 -18
  42. package/build/editor/set-preferences.js.map +7 -1
  43. package/build/editor/show-block-toolbar.js +30 -16
  44. package/build/editor/show-block-toolbar.js.map +7 -1
  45. package/build/editor/site-editor.js +46 -41
  46. package/build/editor/site-editor.js.map +7 -1
  47. package/build/editor/switch-editor-tool.js +42 -30
  48. package/build/editor/switch-editor-tool.js.map +7 -1
  49. package/build/editor/switch-to-legacy-canvas.js +33 -14
  50. package/build/editor/switch-to-legacy-canvas.js.map +7 -1
  51. package/build/editor/transform-block-to.js +41 -21
  52. package/build/editor/transform-block-to.js.map +7 -1
  53. package/build/index.js +50 -32
  54. package/build/index.js.map +7 -1
  55. package/build/lighthouse/index.js +89 -53
  56. package/build/lighthouse/index.js.map +7 -1
  57. package/build/metrics/index.js +298 -249
  58. package/build/metrics/index.js.map +7 -1
  59. package/build/page-utils/drag-files.js +134 -112
  60. package/build/page-utils/drag-files.js.map +7 -1
  61. package/build/page-utils/emulate-network-conditions.js +92 -66
  62. package/build/page-utils/emulate-network-conditions.js.map +7 -1
  63. package/build/page-utils/index.js +54 -34
  64. package/build/page-utils/index.js.map +7 -1
  65. package/build/page-utils/is-current-url.js +31 -18
  66. package/build/page-utils/is-current-url.js.map +7 -1
  67. package/build/page-utils/keycodes.js +51 -39
  68. package/build/page-utils/keycodes.js.map +7 -1
  69. package/build/page-utils/press-keys.js +148 -127
  70. package/build/page-utils/press-keys.js.map +7 -1
  71. package/build/page-utils/set-browser-viewport.js +32 -41
  72. package/build/page-utils/set-browser-viewport.js.map +7 -1
  73. package/build/request-utils/blocks.js +49 -40
  74. package/build/request-utils/blocks.js.map +7 -1
  75. package/build/request-utils/comments.js +57 -45
  76. package/build/request-utils/comments.js.map +7 -1
  77. package/build/request-utils/gutenberg-experiments.js +48 -26
  78. package/build/request-utils/gutenberg-experiments.js.map +7 -1
  79. package/build/request-utils/index.js +187 -153
  80. package/build/request-utils/index.js.map +7 -1
  81. package/build/request-utils/login.js +43 -18
  82. package/build/request-utils/login.js.map +7 -1
  83. package/build/request-utils/media.js +72 -64
  84. package/build/request-utils/media.js.map +7 -1
  85. package/build/request-utils/menus.js +119 -109
  86. package/build/request-utils/menus.js.map +7 -1
  87. package/build/request-utils/pages.js +60 -49
  88. package/build/request-utils/pages.js.map +7 -1
  89. package/build/request-utils/patterns.js +39 -24
  90. package/build/request-utils/patterns.js.map +7 -1
  91. package/build/request-utils/plugins.js +68 -74
  92. package/build/request-utils/plugins.js.map +7 -1
  93. package/build/request-utils/posts.js +52 -39
  94. package/build/request-utils/posts.js.map +7 -1
  95. package/build/request-utils/preferences.js +36 -17
  96. package/build/request-utils/preferences.js.map +7 -1
  97. package/build/request-utils/rest.js +153 -129
  98. package/build/request-utils/rest.js.map +7 -1
  99. package/build/request-utils/site-settings.js +38 -28
  100. package/build/request-utils/site-settings.js.map +7 -1
  101. package/build/request-utils/templates.js +57 -45
  102. package/build/request-utils/templates.js.map +7 -1
  103. package/build/request-utils/themes.js +78 -53
  104. package/build/request-utils/themes.js.map +7 -1
  105. package/build/request-utils/users.js +72 -72
  106. package/build/request-utils/users.js.map +7 -1
  107. package/build/request-utils/widgets.js +71 -55
  108. package/build/request-utils/widgets.js.map +7 -1
  109. package/build/test.js +128 -146
  110. package/build/test.js.map +7 -1
  111. package/build/types.js +16 -2
  112. package/build/types.js.map +7 -1
  113. package/package.json +6 -2
@@ -1,45 +1,54 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteAllBlocks = deleteAllBlocks;
4
- exports.createBlock = createBlock;
5
- /**
6
- * Delete all blocks using REST API.
7
- *
8
- * @see https://developer.wordpress.org/rest-api/reference/blocks/#list-editor-blocks
9
- * @param this
10
- */
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var blocks_exports = {};
20
+ __export(blocks_exports, {
21
+ createBlock: () => createBlock,
22
+ deleteAllBlocks: () => deleteAllBlocks
23
+ });
24
+ module.exports = __toCommonJS(blocks_exports);
11
25
  async function deleteAllBlocks() {
12
- // List all blocks.
13
- // https://developer.wordpress.org/rest-api/reference/blocks/#list-editor-blocks
14
- const blocks = await this.rest({
15
- path: '/wp/v2/blocks',
16
- params: {
17
- per_page: 100,
18
- // All possible statuses.
19
- status: 'publish,future,draft,pending,private,trash',
20
- },
21
- });
22
- // Delete blocks.
23
- // https://developer.wordpress.org/rest-api/reference/blocks/#delete-a-editor-block
24
- // "/wp/v2/posts" not yet supports batch requests.
25
- await this.batchRest(blocks.map((block) => ({
26
- method: 'DELETE',
27
- path: `/wp/v2/blocks/${block.id}?force=true`,
28
- })));
26
+ const blocks = await this.rest({
27
+ path: "/wp/v2/blocks",
28
+ params: {
29
+ per_page: 100,
30
+ // All possible statuses.
31
+ status: "publish,future,draft,pending,private,trash"
32
+ }
33
+ });
34
+ await this.batchRest(
35
+ blocks.map((block) => ({
36
+ method: "DELETE",
37
+ path: `/wp/v2/blocks/${block.id}?force=true`
38
+ }))
39
+ );
29
40
  }
30
- /**
31
- * Creates a new block using the REST API.
32
- *
33
- * @see https://developer.wordpress.org/rest-api/reference/blocks/#create-a-editor-block.
34
- * @param this
35
- * @param payload Block payload.
36
- */
37
41
  async function createBlock(payload) {
38
- const block = await this.rest({
39
- path: '/wp/v2/blocks',
40
- method: 'POST',
41
- data: { ...payload },
42
- });
43
- return block;
42
+ const block = await this.rest({
43
+ path: "/wp/v2/blocks",
44
+ method: "POST",
45
+ data: { ...payload }
46
+ });
47
+ return block;
44
48
  }
45
- //# sourceMappingURL=blocks.js.map
49
+ // Annotate the CommonJS export names for ESM import in node:
50
+ 0 && (module.exports = {
51
+ createBlock,
52
+ deleteAllBlocks
53
+ });
54
+ //# sourceMappingURL=blocks.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"blocks.js","sourceRoot":"","sources":["../../src/request-utils/blocks.ts"],"names":[],"mappings":";;AAsBA,0CAqBC;AASD,kCAWC;AA/CD;;;;;GAKG;AACI,KAAK,UAAU,eAAe;IACpC,mBAAmB;IACnB,gFAAgF;IAChF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAE;QAC/B,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE;YACP,QAAQ,EAAE,GAAG;YACb,yBAAyB;YACzB,MAAM,EAAE,4CAA4C;SACpD;KACD,CAAE,CAAC;IAEJ,iBAAiB;IACjB,mFAAmF;IACnF,kDAAkD;IAClD,MAAM,IAAI,CAAC,SAAS,CACnB,MAAM,CAAC,GAAG,CAAE,CAAE,KAAqB,EAAG,EAAE,CAAC,CAAE;QAC1C,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,iBAAkB,KAAK,CAAC,EAAG,aAAa;KAC9C,CAAE,CAAE,CACL,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAEhC,OAA2B;IAE3B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,CAAE;QAC9B,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE;KACpB,CAAE,CAAC;IAEJ,OAAO,KAAK,CAAC;AACd,CAAC"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/request-utils/blocks.ts"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { RequestUtils } from './index';\n\ntype CreateBlockPayload = {\n\tdate?: string;\n\tdate_gmt?: string;\n\tslug?: string;\n\ttitle: string;\n\tstatus: 'publish' | 'future' | 'draft' | 'pending' | 'private';\n\tcontent?: string;\n\tmeta?: unknown;\n\twp_pattern_category?: number[];\n};\n\n/**\n * Delete all blocks using REST API.\n *\n * @see https://developer.wordpress.org/rest-api/reference/blocks/#list-editor-blocks\n * @param this\n */\nexport async function deleteAllBlocks( this: RequestUtils ) {\n\t// List all blocks.\n\t// https://developer.wordpress.org/rest-api/reference/blocks/#list-editor-blocks\n\tconst blocks = await this.rest( {\n\t\tpath: '/wp/v2/blocks',\n\t\tparams: {\n\t\t\tper_page: 100,\n\t\t\t// All possible statuses.\n\t\t\tstatus: 'publish,future,draft,pending,private,trash',\n\t\t},\n\t} );\n\n\t// Delete blocks.\n\t// https://developer.wordpress.org/rest-api/reference/blocks/#delete-a-editor-block\n\t// \"/wp/v2/posts\" not yet supports batch requests.\n\tawait this.batchRest(\n\t\tblocks.map( ( block: { id: number } ) => ( {\n\t\t\tmethod: 'DELETE',\n\t\t\tpath: `/wp/v2/blocks/${ block.id }?force=true`,\n\t\t} ) )\n\t);\n}\n\n/**\n * Creates a new block using the REST API.\n *\n * @see https://developer.wordpress.org/rest-api/reference/blocks/#create-a-editor-block.\n * @param this\n * @param payload Block payload.\n */\nexport async function createBlock(\n\tthis: RequestUtils,\n\tpayload: CreateBlockPayload\n) {\n\tconst block = await this.rest( {\n\t\tpath: '/wp/v2/blocks',\n\t\tmethod: 'POST',\n\t\tdata: { ...payload },\n\t} );\n\n\treturn block;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBA,eAAsB,kBAAsC;AAG3D,QAAM,SAAS,MAAM,KAAK,KAAM;AAAA,IAC/B,MAAM;AAAA,IACN,QAAQ;AAAA,MACP,UAAU;AAAA;AAAA,MAEV,QAAQ;AAAA,IACT;AAAA,EACD,CAAE;AAKF,QAAM,KAAK;AAAA,IACV,OAAO,IAAK,CAAE,WAA6B;AAAA,MAC1C,QAAQ;AAAA,MACR,MAAM,iBAAkB,MAAM,EAAG;AAAA,IAClC,EAAI;AAAA,EACL;AACD;AASA,eAAsB,YAErB,SACC;AACD,QAAM,QAAQ,MAAM,KAAK,KAAM;AAAA,IAC9B,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM,EAAE,GAAG,QAAQ;AAAA,EACpB,CAAE;AAEF,SAAO;AACR;",
6
+ "names": []
7
+ }
@@ -1,52 +1,64 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createComment = createComment;
4
- exports.deleteAllComments = deleteAllComments;
5
- /**
6
- * Create new comment using the REST API.
7
- *
8
- * @param this
9
- * @param payload
10
- */
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var comments_exports = {};
20
+ __export(comments_exports, {
21
+ createComment: () => createComment,
22
+ deleteAllComments: () => deleteAllComments
23
+ });
24
+ module.exports = __toCommonJS(comments_exports);
11
25
  async function createComment(payload) {
12
- const currentUser = await this.rest({
13
- path: '/wp/v2/users/me',
14
- method: 'GET',
15
- });
16
- const author = currentUser.id;
17
- const comment = await this.rest({
18
- method: 'POST',
19
- path: '/wp/v2/comments',
20
- data: { ...payload, author },
21
- });
22
- return comment;
26
+ const currentUser = await this.rest({
27
+ path: "/wp/v2/users/me",
28
+ method: "GET"
29
+ });
30
+ const author = currentUser.id;
31
+ const comment = await this.rest({
32
+ method: "POST",
33
+ path: "/wp/v2/comments",
34
+ data: { ...payload, author }
35
+ });
36
+ return comment;
23
37
  }
24
- /**
25
- * Delete all comments using the REST API.
26
- *
27
- * @param this
28
- * @param type - Optional comment type to delete.
29
- */
30
38
  async function deleteAllComments(type) {
31
- // List all comments.
32
- // https://developer.wordpress.org/rest-api/reference/comments/#list-comments
33
- const comments = await this.rest({
34
- path: '/wp/v2/comments',
35
- params: {
36
- per_page: 100,
37
- status: 'all',
38
- type: type || 'comment',
39
- },
40
- });
41
- // Delete all comments one by one.
42
- // https://developer.wordpress.org/rest-api/reference/comments/#delete-a-comment
43
- // "/wp/v2/comments" doesn't support batch requests yet.
44
- await Promise.all(comments.map((comment) => this.rest({
45
- method: 'DELETE',
39
+ const comments = await this.rest({
40
+ path: "/wp/v2/comments",
41
+ params: {
42
+ per_page: 100,
43
+ status: "all",
44
+ type: type || "comment"
45
+ }
46
+ });
47
+ await Promise.all(
48
+ comments.map(
49
+ (comment) => this.rest({
50
+ method: "DELETE",
46
51
  path: `/wp/v2/comments/${comment.id}`,
47
52
  params: {
48
- force: true,
49
- },
50
- })));
53
+ force: true
54
+ }
55
+ })
56
+ )
57
+ );
51
58
  }
52
- //# sourceMappingURL=comments.js.map
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
61
+ createComment,
62
+ deleteAllComments
63
+ });
64
+ //# sourceMappingURL=comments.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"comments.js","sourceRoot":"","sources":["../../src/request-utils/comments.ts"],"names":[],"mappings":";;AA2BA,sCAkBC;AAQD,8CA0BC;AA1DD;;;;;GAKG;AACI,KAAK,UAAU,aAAa,CAElC,OAA6B;IAE7B,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,IAAI,CAAU;QAC5C,IAAI,EAAE,iBAAiB;QACvB,MAAM,EAAE,KAAK;KACb,CAAE,CAAC;IAEJ,MAAM,MAAM,GAAG,WAAW,CAAC,EAAE,CAAC;IAE9B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAa;QAC3C,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE;KAC5B,CAAE,CAAC;IAEJ,OAAO,OAAO,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,iBAAiB,CAAsB,IAAa;IACzE,qBAAqB;IACrB,6EAA6E;IAC7E,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAE;QACjC,IAAI,EAAE,iBAAiB;QACvB,MAAM,EAAE;YACP,QAAQ,EAAE,GAAG;YACb,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI,IAAI,SAAS;SACvB;KACD,CAAE,CAAC;IAEJ,kCAAkC;IAClC,gFAAgF;IAChF,wDAAwD;IACxD,MAAM,OAAO,CAAC,GAAG,CAChB,QAAQ,CAAC,GAAG,CAAE,CAAE,OAAgB,EAAG,EAAE,CACpC,IAAI,CAAC,IAAI,CAAE;QACV,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,mBAAoB,OAAO,CAAC,EAAG,EAAE;QACvC,MAAM,EAAE;YACP,KAAK,EAAE,IAAI;SACX;KACD,CAAE,CACH,CACD,CAAC;AACH,CAAC"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/request-utils/comments.ts"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { RequestUtils } from './index';\n\nexport interface Comment {\n\tid: number;\n\tauthor: number;\n\tcontent: string;\n\tpost: number;\n}\n\nexport interface CreateCommentPayload {\n\tcontent: string;\n\tpost: number;\n}\n\nexport interface User {\n\tid: number;\n}\n\n/**\n * Create new comment using the REST API.\n *\n * @param this\n * @param payload\n */\nexport async function createComment(\n\tthis: RequestUtils,\n\tpayload: CreateCommentPayload\n) {\n\tconst currentUser = await this.rest< User >( {\n\t\tpath: '/wp/v2/users/me',\n\t\tmethod: 'GET',\n\t} );\n\n\tconst author = currentUser.id;\n\n\tconst comment = await this.rest< Comment >( {\n\t\tmethod: 'POST',\n\t\tpath: '/wp/v2/comments',\n\t\tdata: { ...payload, author },\n\t} );\n\n\treturn comment;\n}\n\n/**\n * Delete all comments using the REST API.\n *\n * @param this\n * @param type - Optional comment type to delete.\n */\nexport async function deleteAllComments( this: RequestUtils, type?: string ) {\n\t// List all comments.\n\t// https://developer.wordpress.org/rest-api/reference/comments/#list-comments\n\tconst comments = await this.rest( {\n\t\tpath: '/wp/v2/comments',\n\t\tparams: {\n\t\t\tper_page: 100,\n\t\t\tstatus: 'all',\n\t\t\ttype: type || 'comment',\n\t\t},\n\t} );\n\n\t// Delete all comments one by one.\n\t// https://developer.wordpress.org/rest-api/reference/comments/#delete-a-comment\n\t// \"/wp/v2/comments\" doesn't support batch requests yet.\n\tawait Promise.all(\n\t\tcomments.map( ( comment: Comment ) =>\n\t\t\tthis.rest( {\n\t\t\t\tmethod: 'DELETE',\n\t\t\t\tpath: `/wp/v2/comments/${ comment.id }`,\n\t\t\t\tparams: {\n\t\t\t\t\tforce: true,\n\t\t\t\t},\n\t\t\t} )\n\t\t)\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BA,eAAsB,cAErB,SACC;AACD,QAAM,cAAc,MAAM,KAAK,KAAc;AAAA,IAC5C,MAAM;AAAA,IACN,QAAQ;AAAA,EACT,CAAE;AAEF,QAAM,SAAS,YAAY;AAE3B,QAAM,UAAU,MAAM,KAAK,KAAiB;AAAA,IAC3C,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM,EAAE,GAAG,SAAS,OAAO;AAAA,EAC5B,CAAE;AAEF,SAAO;AACR;AAQA,eAAsB,kBAAuC,MAAgB;AAG5E,QAAM,WAAW,MAAM,KAAK,KAAM;AAAA,IACjC,MAAM;AAAA,IACN,QAAQ;AAAA,MACP,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,MAAM,QAAQ;AAAA,IACf;AAAA,EACD,CAAE;AAKF,QAAM,QAAQ;AAAA,IACb,SAAS;AAAA,MAAK,CAAE,YACf,KAAK,KAAM;AAAA,QACV,QAAQ;AAAA,QACR,MAAM,mBAAoB,QAAQ,EAAG;AAAA,QACrC,QAAQ;AAAA,UACP,OAAO;AAAA,QACR;AAAA,MACD,CAAE;AAAA,IACH;AAAA,EACD;AACD;",
6
+ "names": []
7
+ }
@@ -1,29 +1,51 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setGutenbergExperiments = setGutenbergExperiments;
4
- /**
5
- * Sets the Gutenberg experiments.
6
- *
7
- * @param this
8
- * @param experiments Array of experimental flags to enable. Pass in an empty array to disable all experiments.
9
- */
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var gutenberg_experiments_exports = {};
20
+ __export(gutenberg_experiments_exports, {
21
+ setGutenbergExperiments: () => setGutenbergExperiments
22
+ });
23
+ module.exports = __toCommonJS(gutenberg_experiments_exports);
10
24
  async function setGutenbergExperiments(experiments) {
11
- const response = await this.request.get('/wp-admin/admin.php?page=gutenberg-experiments');
12
- const html = await response.text();
13
- const nonce = html.match(/name="_wpnonce" value="([^"]+)"/)[1];
14
- await this.request.post('/wp-admin/options.php', {
15
- form: {
16
- option_page: 'gutenberg-experiments',
17
- action: 'update',
18
- _wpnonce: nonce,
19
- _wp_http_referer: '/wp-admin/admin.php?page=gutenberg-experiments',
20
- ...Object.fromEntries(experiments.map((experiment) => [
21
- `gutenberg-experiments[${experiment}]`,
22
- 1,
23
- ])),
24
- submit: 'Save Changes',
25
- },
26
- failOnStatusCode: true,
27
- });
25
+ const response = await this.request.get(
26
+ "/wp-admin/admin.php?page=gutenberg-experiments"
27
+ );
28
+ const html = await response.text();
29
+ const nonce = html.match(/name="_wpnonce" value="([^"]+)"/)[1];
30
+ await this.request.post("/wp-admin/options.php", {
31
+ form: {
32
+ option_page: "gutenberg-experiments",
33
+ action: "update",
34
+ _wpnonce: nonce,
35
+ _wp_http_referer: "/wp-admin/admin.php?page=gutenberg-experiments",
36
+ ...Object.fromEntries(
37
+ experiments.map((experiment) => [
38
+ `gutenberg-experiments[${experiment}]`,
39
+ 1
40
+ ])
41
+ ),
42
+ submit: "Save Changes"
43
+ },
44
+ failOnStatusCode: true
45
+ });
28
46
  }
29
- //# sourceMappingURL=gutenberg-experiments.js.map
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ setGutenbergExperiments
50
+ });
51
+ //# sourceMappingURL=gutenberg-experiments.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"gutenberg-experiments.js","sourceRoot":"","sources":["../../src/request-utils/gutenberg-experiments.ts"],"names":[],"mappings":";;AAuCS,0DAAuB;AAlChC;;;;;GAKG;AACH,KAAK,UAAU,uBAAuB,CAErC,WAAqB;IAErB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CACtC,gDAAgD,CAChD,CAAC;IACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAE,iCAAiC,CAAG,CAAE,CAAC,CAAE,CAAC;IAEpE,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAE,uBAAuB,EAAE;QACjD,IAAI,EAAE;YACL,WAAW,EAAE,uBAAuB;YACpC,MAAM,EAAE,QAAQ;YAChB,QAAQ,EAAE,KAAK;YACf,gBAAgB,EAAE,gDAAgD;YAClE,GAAG,MAAM,CAAC,WAAW,CACpB,WAAW,CAAC,GAAG,CAAE,CAAE,UAAU,EAAG,EAAE,CAAC;gBAClC,yBAA0B,UAAW,GAAG;gBACxC,CAAC;aACD,CAAE,CACH;YACD,MAAM,EAAE,cAAc;SACtB;QACD,gBAAgB,EAAE,IAAI;KACtB,CAAE,CAAC;AACL,CAAC"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/request-utils/gutenberg-experiments.ts"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { RequestUtils } from './index';\n\n/**\n * Sets the Gutenberg experiments.\n *\n * @param this\n * @param experiments Array of experimental flags to enable. Pass in an empty array to disable all experiments.\n */\nasync function setGutenbergExperiments(\n\tthis: RequestUtils,\n\texperiments: string[]\n) {\n\tconst response = await this.request.get(\n\t\t'/wp-admin/admin.php?page=gutenberg-experiments'\n\t);\n\tconst html = await response.text();\n\tconst nonce = html.match( /name=\"_wpnonce\" value=\"([^\"]+)\"/ )![ 1 ];\n\n\tawait this.request.post( '/wp-admin/options.php', {\n\t\tform: {\n\t\t\toption_page: 'gutenberg-experiments',\n\t\t\taction: 'update',\n\t\t\t_wpnonce: nonce,\n\t\t\t_wp_http_referer: '/wp-admin/admin.php?page=gutenberg-experiments',\n\t\t\t...Object.fromEntries(\n\t\t\t\texperiments.map( ( experiment ) => [\n\t\t\t\t\t`gutenberg-experiments[${ experiment }]`,\n\t\t\t\t\t1,\n\t\t\t\t] )\n\t\t\t),\n\t\t\tsubmit: 'Save Changes',\n\t\t},\n\t\tfailOnStatusCode: true,\n\t} );\n}\n\nexport { setGutenbergExperiments };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,eAAe,wBAEd,aACC;AACD,QAAM,WAAW,MAAM,KAAK,QAAQ;AAAA,IACnC;AAAA,EACD;AACA,QAAM,OAAO,MAAM,SAAS,KAAK;AACjC,QAAM,QAAQ,KAAK,MAAO,iCAAkC,EAAI,CAAE;AAElE,QAAM,KAAK,QAAQ,KAAM,yBAAyB;AAAA,IACjD,MAAM;AAAA,MACL,aAAa;AAAA,MACb,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,kBAAkB;AAAA,MAClB,GAAG,OAAO;AAAA,QACT,YAAY,IAAK,CAAE,eAAgB;AAAA,UAClC,yBAA0B,UAAW;AAAA,UACrC;AAAA,QACD,CAAE;AAAA,MACH;AAAA,MACA,QAAQ;AAAA,IACT;AAAA,IACA,kBAAkB;AAAA,EACnB,CAAE;AACH;",
6
+ "names": []
7
+ }