slice-machine-ui 1.24.2-beta.1 → 1.24.2-beta.3

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 (78) hide show
  1. package/components/AppLayout/index.tsx +1 -1
  2. package/components/Button/index.tsx +5 -5
  3. package/components/CustomTypeTable/changesPage.tsx +5 -2
  4. package/components/DeleteDocumentsDrawer/AssociatedDocumentsCard.tsx +2 -2
  5. package/components/EmptyState/index.tsx +1 -1
  6. package/components/Forms/CreateCustomTypeModal/CreateCustomTypeModal.tsx +3 -3
  7. package/components/Forms/CreateSliceModal/CreateSliceModal.tsx +2 -2
  8. package/components/Forms/RenameCustomTypeModal/RenameCustomTypeModal.tsx +2 -2
  9. package/components/Forms/RenameSliceModal/RenameSliceModal.tsx +3 -3
  10. package/components/Forms/components/InputBox.tsx +4 -4
  11. package/components/Forms/components/SelectRepeatable.tsx +2 -2
  12. package/components/ItemHeader/index.tsx +1 -1
  13. package/components/ListItem/Header.tsx +2 -2
  14. package/components/ListItem/index.tsx +4 -4
  15. package/components/ModalFormCard/index.tsx +10 -8
  16. package/components/Navigation/RunningVersion.tsx +1 -1
  17. package/components/ReviewModal/ReviewForm.tsx +1 -1
  18. package/components/ReviewModal/ReviewFormSelect.tsx +1 -1
  19. package/components/Simulator/components/Header/index.tsx +1 -1
  20. package/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx +1 -1
  21. package/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +1 -1
  22. package/lib/builders/CustomTypeBuilder/TabZone/index.tsx +1 -1
  23. package/lib/builders/SliceBuilder/FieldZones/index.tsx +2 -2
  24. package/lib/builders/common/SelectFieldTypeModal/FieldTypeCard.jsx +1 -1
  25. package/lib/builders/common/Zone/Card/components/NewField.tsx +3 -3
  26. package/lib/builders/common/Zone/Card/index.jsx +3 -3
  27. package/lib/builders/common/Zone/components/EmptyState/index.tsx +1 -1
  28. package/lib/builders/common/Zone/index.jsx +4 -4
  29. package/lib/models/common/widgets/Group/ListItem/index.jsx +1 -1
  30. package/out/404.html +1 -1
  31. package/out/_next/static/{fL0LayuU6DO9yacV7F_NS → Ri5Fsf9Uw8sbx2475l_JK}/_buildManifest.js +1 -1
  32. package/out/_next/static/chunks/{25-3aa4d4b24167d340.js → 25-792af14760d9df34.js} +1 -1
  33. package/out/_next/static/chunks/318-2426f74a0d6c3b89.js +1 -0
  34. package/out/_next/static/chunks/727-5e50dd9b10462347.js +1 -0
  35. package/out/_next/static/chunks/799-9bea9069969f5fe0.js +1 -0
  36. package/out/_next/static/chunks/904-b3710ed82582f33b.js +1 -0
  37. package/out/_next/static/chunks/pages/{_app-595ea4cb47d299e3.js → _app-cd77f4bc30fc0e7c.js} +1 -1
  38. package/out/_next/static/chunks/pages/changes-23829ddb11cac992.js +1 -0
  39. package/out/_next/static/chunks/pages/settings-12f209f1d5d42b1c.js +1 -0
  40. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-8343067eddc3a2b4.js +1 -0
  41. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/{[variation]-89c911fd39271b5d.js → [variation]-60858a3cead6dc81.js} +1 -1
  42. package/out/_next/static/chunks/pages/slices-c33645b1828857c4.js +1 -0
  43. package/out/changelog.html +1 -1
  44. package/out/changes.html +1 -1
  45. package/out/custom-types/[customTypeId].html +1 -1
  46. package/out/custom-types.html +1 -1
  47. package/out/index.html +1 -1
  48. package/out/labs.html +1 -1
  49. package/out/page-types/[pageTypeId].html +1 -1
  50. package/out/settings.html +1 -1
  51. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  52. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  53. package/out/slices.html +1 -1
  54. package/package.json +3 -3
  55. package/pages/changes.tsx +7 -8
  56. package/pages/slices.tsx +1 -2
  57. package/src/ErrorBoundary.tsx +8 -4
  58. package/src/components/SideNav/SideNavEnvironmentSelector.tsx +2 -2
  59. package/src/features/changes/PushChangesButton.tsx +83 -0
  60. package/src/features/changes/StatusBadge.tsx +2 -2
  61. package/src/features/customTypes/customTypesBuilder/SliceZoneBlankSlate.tsx +5 -1
  62. package/src/features/customTypes/customTypesTable/CustomTypesTablePage.tsx +1 -1
  63. package/src/features/settings/git/GitOwnerSelect.tsx +2 -2
  64. package/src/features/settings/git/GitProviderConnectButtons.tsx +2 -2
  65. package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewSliceDialog.tsx +1 -1
  66. package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewVariationDialog.tsx +2 -2
  67. package/src/features/slices/convertLegacySlice/ConvertLegacySliceButton.tsx +1 -1
  68. package/src/features/slices/sliceCards/SharedSliceCard.tsx +1 -2
  69. package/test/pages/slices.test.tsx +2 -4
  70. package/out/_next/static/chunks/318-19dbcae10cdb6408.js +0 -1
  71. package/out/_next/static/chunks/727-ffb4c69fbb971ed7.js +0 -1
  72. package/out/_next/static/chunks/799-0af1215eb2b3c17e.js +0 -1
  73. package/out/_next/static/chunks/904-d9089efa6d974e3e.js +0 -1
  74. package/out/_next/static/chunks/pages/changes-ea6064c1db5ab5e1.js +0 -1
  75. package/out/_next/static/chunks/pages/settings-768fc1a6367d7d03.js +0 -1
  76. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-22770c807a7d7090.js +0 -1
  77. package/out/_next/static/chunks/pages/slices-5dc0c55c386e047a.js +0 -1
  78. /package/out/_next/static/{fL0LayuU6DO9yacV7F_NS → Ri5Fsf9Uw8sbx2475l_JK}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/75711e840ea6c200.css" as="style"/><link rel="stylesheet" href="/_next/static/css/75711e840ea6c200.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-595ea4cb47d299e3.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/72585f70-28b4d7d5384b3703.js" defer=""></script><script src="/_next/static/chunks/18539003-a5a5d48f20a7b261.js" defer=""></script><script src="/_next/static/chunks/777-7bc4ca95c82802e5.js" defer=""></script><script src="/_next/static/chunks/pages/slices/%5Blib%5D/%5BsliceName%5D/%5Bvariation%5D/simulator-22770c807a7d7090.js" defer=""></script><script src="/_next/static/fL0LayuU6DO9yacV7F_NS/_buildManifest.js" defer=""></script><script src="/_next/static/fL0LayuU6DO9yacV7F_NS/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/slices/[lib]/[sliceName]/[variation]/simulator","query":{},"buildId":"fL0LayuU6DO9yacV7F_NS","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/75711e840ea6c200.css" as="style"/><link rel="stylesheet" href="/_next/static/css/75711e840ea6c200.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-cd77f4bc30fc0e7c.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/72585f70-28b4d7d5384b3703.js" defer=""></script><script src="/_next/static/chunks/18539003-a5a5d48f20a7b261.js" defer=""></script><script src="/_next/static/chunks/777-7bc4ca95c82802e5.js" defer=""></script><script src="/_next/static/chunks/pages/slices/%5Blib%5D/%5BsliceName%5D/%5Bvariation%5D/simulator-8343067eddc3a2b4.js" defer=""></script><script src="/_next/static/Ri5Fsf9Uw8sbx2475l_JK/_buildManifest.js" defer=""></script><script src="/_next/static/Ri5Fsf9Uw8sbx2475l_JK/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/slices/[lib]/[sliceName]/[variation]/simulator","query":{},"buildId":"Ri5Fsf9Uw8sbx2475l_JK","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/75711e840ea6c200.css" as="style"/><link rel="stylesheet" href="/_next/static/css/75711e840ea6c200.css" data-n-g=""/><link rel="preload" href="/_next/static/css/b22c0750c14cc089.css" as="style"/><link rel="stylesheet" href="/_next/static/css/b22c0750c14cc089.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-595ea4cb47d299e3.js" defer=""></script><script src="/_next/static/chunks/59b4e022-7a3b5554b806349f.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/f36c6662-03bb5e9d9aa0b0aa.js" defer=""></script><script src="/_next/static/chunks/4c744e84-e3161d754618373f.js" defer=""></script><script src="/_next/static/chunks/065a3ddb-9a38ca0d60f0bf2f.js" defer=""></script><script src="/_next/static/chunks/1cc2734a-2c5b6c0367fcde86.js" defer=""></script><script src="/_next/static/chunks/183-4feb6bb3eddbc768.js" defer=""></script><script src="/_next/static/chunks/50-cfc2514205b86001.js" defer=""></script><script src="/_next/static/chunks/543-f8766685f7f451e2.js" defer=""></script><script src="/_next/static/chunks/696-b12edad30a3617e5.js" defer=""></script><script src="/_next/static/chunks/25-3aa4d4b24167d340.js" defer=""></script><script src="/_next/static/chunks/318-19dbcae10cdb6408.js" defer=""></script><script src="/_next/static/chunks/286-877cd7b96660f95f.js" defer=""></script><script src="/_next/static/chunks/pages/slices/%5Blib%5D/%5BsliceName%5D/%5Bvariation%5D-89c911fd39271b5d.js" defer=""></script><script src="/_next/static/fL0LayuU6DO9yacV7F_NS/_buildManifest.js" defer=""></script><script src="/_next/static/fL0LayuU6DO9yacV7F_NS/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/slices/[lib]/[sliceName]/[variation]","query":{},"buildId":"fL0LayuU6DO9yacV7F_NS","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/75711e840ea6c200.css" as="style"/><link rel="stylesheet" href="/_next/static/css/75711e840ea6c200.css" data-n-g=""/><link rel="preload" href="/_next/static/css/b22c0750c14cc089.css" as="style"/><link rel="stylesheet" href="/_next/static/css/b22c0750c14cc089.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-cd77f4bc30fc0e7c.js" defer=""></script><script src="/_next/static/chunks/59b4e022-7a3b5554b806349f.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/f36c6662-03bb5e9d9aa0b0aa.js" defer=""></script><script src="/_next/static/chunks/4c744e84-e3161d754618373f.js" defer=""></script><script src="/_next/static/chunks/065a3ddb-9a38ca0d60f0bf2f.js" defer=""></script><script src="/_next/static/chunks/1cc2734a-2c5b6c0367fcde86.js" defer=""></script><script src="/_next/static/chunks/183-4feb6bb3eddbc768.js" defer=""></script><script src="/_next/static/chunks/50-cfc2514205b86001.js" defer=""></script><script src="/_next/static/chunks/543-f8766685f7f451e2.js" defer=""></script><script src="/_next/static/chunks/696-b12edad30a3617e5.js" defer=""></script><script src="/_next/static/chunks/25-792af14760d9df34.js" defer=""></script><script src="/_next/static/chunks/318-2426f74a0d6c3b89.js" defer=""></script><script src="/_next/static/chunks/286-877cd7b96660f95f.js" defer=""></script><script src="/_next/static/chunks/pages/slices/%5Blib%5D/%5BsliceName%5D/%5Bvariation%5D-60858a3cead6dc81.js" defer=""></script><script src="/_next/static/Ri5Fsf9Uw8sbx2475l_JK/_buildManifest.js" defer=""></script><script src="/_next/static/Ri5Fsf9Uw8sbx2475l_JK/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/slices/[lib]/[sliceName]/[variation]","query":{},"buildId":"Ri5Fsf9Uw8sbx2475l_JK","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
package/out/slices.html CHANGED
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/75711e840ea6c200.css" as="style"/><link rel="stylesheet" href="/_next/static/css/75711e840ea6c200.css" data-n-g=""/><link rel="preload" href="/_next/static/css/f8eb526e10bc2441.css" as="style"/><link rel="stylesheet" href="/_next/static/css/f8eb526e10bc2441.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-595ea4cb47d299e3.js" defer=""></script><script src="/_next/static/chunks/59b4e022-7a3b5554b806349f.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/50-cfc2514205b86001.js" defer=""></script><script src="/_next/static/chunks/25-3aa4d4b24167d340.js" defer=""></script><script src="/_next/static/chunks/286-877cd7b96660f95f.js" defer=""></script><script src="/_next/static/chunks/pages/slices-5dc0c55c386e047a.js" defer=""></script><script src="/_next/static/fL0LayuU6DO9yacV7F_NS/_buildManifest.js" defer=""></script><script src="/_next/static/fL0LayuU6DO9yacV7F_NS/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/slices","query":{},"buildId":"fL0LayuU6DO9yacV7F_NS","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/75711e840ea6c200.css" as="style"/><link rel="stylesheet" href="/_next/static/css/75711e840ea6c200.css" data-n-g=""/><link rel="preload" href="/_next/static/css/f8eb526e10bc2441.css" as="style"/><link rel="stylesheet" href="/_next/static/css/f8eb526e10bc2441.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-cdccea7a52cc6e81.js" defer=""></script><script src="/_next/static/chunks/main-5e6780279ca21cb9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-cd77f4bc30fc0e7c.js" defer=""></script><script src="/_next/static/chunks/59b4e022-7a3b5554b806349f.js" defer=""></script><script src="/_next/static/chunks/c8eae200-966ce352f7b5d2b9.js" defer=""></script><script src="/_next/static/chunks/50-cfc2514205b86001.js" defer=""></script><script src="/_next/static/chunks/25-792af14760d9df34.js" defer=""></script><script src="/_next/static/chunks/286-877cd7b96660f95f.js" defer=""></script><script src="/_next/static/chunks/pages/slices-c33645b1828857c4.js" defer=""></script><script src="/_next/static/Ri5Fsf9Uw8sbx2475l_JK/_buildManifest.js" defer=""></script><script src="/_next/static/Ri5Fsf9Uw8sbx2475l_JK/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/slices","query":{},"buildId":"Ri5Fsf9Uw8sbx2475l_JK","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slice-machine-ui",
3
- "version": "1.24.2-beta.1",
3
+ "version": "1.24.2-beta.3",
4
4
  "license": "MIT",
5
5
  "description": "A visual builder for your Slice Models with all the tools you need to generate data models and mock CMS content locally.",
6
6
  "repository": {
@@ -36,8 +36,8 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@radix-ui/react-visually-hidden": "1.0.3",
39
- "@slicemachine/manager": "0.18.2-beta.1",
40
- "start-slicemachine": "0.12.17-beta.1"
39
+ "@slicemachine/manager": "0.18.2-beta.4",
40
+ "start-slicemachine": "0.12.17-beta.4"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@emotion/react": "11.11.1",
package/pages/changes.tsx CHANGED
@@ -1,4 +1,3 @@
1
- import { Button } from "@prismicio/editor-ui";
2
1
  import React, { useEffect, useMemo, useState } from "react";
3
2
  import { toast } from "react-toastify";
4
3
  import Head from "next/head";
@@ -15,6 +14,7 @@ import {
15
14
  import { ChangesItems } from "@components/ChangesItems";
16
15
  import { AuthErrorPage, OfflinePage } from "@components/ChangesEmptyState";
17
16
  import { NoChangesBlankSlate } from "@src/features/changes/BlankSlates";
17
+ import { PushChangesButton } from "@src/features/changes/PushChangesButton";
18
18
  import { AuthStatus } from "@src/modules/userContext/types";
19
19
  import useSliceMachineActions from "@src/modules/useSliceMachineActions";
20
20
  import {
@@ -136,9 +136,7 @@ const Changes: React.FunctionComponent = () => {
136
136
  <AppLayoutHeader>
137
137
  <AppLayoutBreadcrumb folder="Changes" />
138
138
  <AppLayoutActions>
139
- <Button
140
- onClick={() => void onPush(false)} // not deleting documents by default
141
- loading={isSyncing}
139
+ <PushChangesButton
142
140
  disabled={
143
141
  numberOfChanges === 0 ||
144
142
  !isOnline ||
@@ -146,10 +144,11 @@ const Changes: React.FunctionComponent = () => {
146
144
  authStatus === AuthStatus.FORBIDDEN ||
147
145
  isSyncing
148
146
  }
149
- data-cy="push-changes"
150
- >
151
- Push Changes
152
- </Button>
147
+ loading={isSyncing}
148
+ onClick={() => {
149
+ void onPush(false); // not deleting documents by default
150
+ }}
151
+ />
153
152
  </AppLayoutActions>
154
153
  </AppLayoutHeader>
155
154
  <AppLayoutContent>
package/pages/slices.tsx CHANGED
@@ -83,7 +83,6 @@ const SlicesIndex: React.FunctionComponent = () => {
83
83
  <AppLayoutActions>
84
84
  <Button
85
85
  data-testid="create-slice"
86
- data-cy="create-slice"
87
86
  onClick={() => {
88
87
  setIsCreateSliceModalOpen(true);
89
88
  }}
@@ -248,7 +247,7 @@ const SlicesIndex: React.FunctionComponent = () => {
248
247
  onClose={() => {
249
248
  setIsRenameSliceModalOpen(false);
250
249
  }}
251
- data-cy="rename-slice-modal"
250
+ data-testid="rename-slice-modal"
252
251
  />
253
252
  <DeleteSliceModal
254
253
  isOpen={isDeleteSliceModalOpen}
@@ -3,16 +3,20 @@ import {
3
3
  isUnauthenticatedError,
4
4
  isUnauthorizedError,
5
5
  } from "@slicemachine/manager/client";
6
- import { type ComponentProps, type FC, useCallback, useRef } from "react";
6
+ import {
7
+ type ComponentPropsWithoutRef,
8
+ type FC,
9
+ useCallback,
10
+ useRef,
11
+ } from "react";
7
12
 
8
13
  import { useAuthStatus } from "@src/hooks/useAuthStatus";
9
14
 
10
15
  type ErrorBoundaryProps = Pick<
11
- EditorUiErrorBoundaryProps,
16
+ // TODO(DT-1979): Export the `ErrorBoundaryProps` type from `@prismicio/editor-ui`.
17
+ ComponentPropsWithoutRef<typeof EditorUiErrorBoundary>,
12
18
  "children" | "renderError"
13
19
  >;
14
- // TODO(DT-1979): Export the `ErrorBoundaryProps` type from `@prismicio/editor-ui`.
15
- type EditorUiErrorBoundaryProps = ComponentProps<typeof EditorUiErrorBoundary>;
16
20
 
17
21
  export const ErrorBoundary: FC<ErrorBoundaryProps> = (props) => {
18
22
  const errorRef = useRef<unknown>();
@@ -55,7 +55,7 @@ export const SideNavEnvironmentSelector: FC<SideNavEnvironmentSelectorProps> = (
55
55
  kind={activeEnvironment?.kind ?? "prod"}
56
56
  asStatus={true}
57
57
  className={styles.activeEnvironmentDot}
58
- data-cy="active-environment-dot"
58
+ data-testid="active-environment-dot"
59
59
  />
60
60
  )}
61
61
  </Box>
@@ -85,7 +85,7 @@ export const SideNavEnvironmentSelector: FC<SideNavEnvironmentSelectorProps> = (
85
85
  <Text
86
86
  component="span"
87
87
  className={styles.activeEnvironmentName}
88
- data-cy="active-environment-name"
88
+ data-testid="active-environment-name"
89
89
  >
90
90
  {isProductionEnvironmentActive || activeEnvironment === undefined
91
91
  ? "Production"
@@ -0,0 +1,83 @@
1
+ import { Button, Skeleton, Tooltip } from "@prismicio/editor-ui";
2
+ import {
3
+ type ComponentPropsWithoutRef,
4
+ type ElementRef,
5
+ type FC,
6
+ type ReactNode,
7
+ Suspense,
8
+ forwardRef,
9
+ } from "react";
10
+
11
+ import { gitProviderToConfig } from "@src/features/settings/git/GitProvider";
12
+ import { useGitIntegrationExperiment } from "@src/features/settings/git/useGitIntegrationExperiment";
13
+ import { useLinkedGitRepos } from "@src/features/settings/git/useLinkedGitRepos";
14
+ import { ErrorBoundary } from "@src/ErrorBoundary";
15
+
16
+ type PushChangesButtonProps = Required<BarePushChangesButtonProps>;
17
+
18
+ export const PushChangesButton: FC<PushChangesButtonProps> = (props) => (
19
+ <ErrorBoundary renderError={renderError}>
20
+ <Suspense fallback={<PushChangesButtonSkeleton />}>
21
+ <PushChangesButtonUsingGitIntegrationExperiment {...props} />
22
+ </Suspense>
23
+ </ErrorBoundary>
24
+ );
25
+
26
+ const PushChangesButtonUsingGitIntegrationExperiment: FC<
27
+ PushChangesButtonProps
28
+ > = (props) => {
29
+ const gitIntegrationExperiment = useGitIntegrationExperiment();
30
+ return gitIntegrationExperiment.eligible ? (
31
+ <PushChangesButtonUsingLinkedGitRepos {...props} />
32
+ ) : (
33
+ <BarePushChangesButton {...props} />
34
+ );
35
+ };
36
+
37
+ const PushChangesButtonUsingLinkedGitRepos: FC<PushChangesButtonProps> = (
38
+ props,
39
+ ) => {
40
+ const { linkedGitRepos } = useLinkedGitRepos();
41
+ if (linkedGitRepos.length > 0) {
42
+ const providerConfig = gitProviderToConfig[linkedGitRepos[0].provider];
43
+ return (
44
+ <Tooltip
45
+ content={`This project uses the Git workflow. Update Prismic by pushing your changes to ${providerConfig.name}.`}
46
+ side="bottom"
47
+ >
48
+ <BarePushChangesButton disabled />
49
+ </Tooltip>
50
+ );
51
+ } else {
52
+ return <BarePushChangesButton {...props} />;
53
+ }
54
+ };
55
+
56
+ type BarePushChangesButtonProps = Pick<
57
+ ComponentPropsWithoutRef<typeof Button>,
58
+ "disabled" | "loading" | "onClick"
59
+ >;
60
+
61
+ const BarePushChangesButton = forwardRef<
62
+ ElementRef<typeof Button>,
63
+ BarePushChangesButtonProps
64
+ >((props, ref) => (
65
+ <Button {...props} data-cy="push-changes" ref={ref} startIcon="upload">
66
+ Push
67
+ </Button>
68
+ ));
69
+
70
+ function renderError(): ReactNode {
71
+ return (
72
+ <Tooltip
73
+ content="An error occurred while fetching the list of connected Git repositories."
74
+ side="bottom"
75
+ >
76
+ <BarePushChangesButton disabled />
77
+ </Tooltip>
78
+ );
79
+ }
80
+
81
+ const PushChangesButtonSkeleton: FC = () => (
82
+ <Skeleton height={32} width={71.32} />
83
+ );
@@ -1,5 +1,5 @@
1
1
  import { Badge, Tooltip } from "@prismicio/editor-ui";
2
- import type { ComponentProps, FC } from "react";
2
+ import type { ComponentPropsWithoutRef, FC } from "react";
3
3
 
4
4
  import { ModelStatus } from "@lib/models/common/ModelStatus";
5
5
  import { AuthStatus } from "@src/modules/userContext/types";
@@ -26,7 +26,7 @@ type GetStatusBadgeContentArgs = {
26
26
  type ModelType = "CustomType" | "Slice";
27
27
 
28
28
  type StatusBadgeContent = {
29
- badgeColor: ComponentProps<typeof Badge>["color"];
29
+ badgeColor: ComponentPropsWithoutRef<typeof Badge>["color"];
30
30
  badgeTitle: string;
31
31
  tooltipContent: string;
32
32
  };
@@ -26,7 +26,11 @@ export const SliceZoneBlankSlate: FC<SliceZoneBlankSlateProps> = ({
26
26
  isSlicesTemplatesSupported,
27
27
  }) => {
28
28
  return (
29
- <Box flexGrow={1} justifyContent="center" data-cy="slice-zone-blank-slate">
29
+ <Box
30
+ flexGrow={1}
31
+ justifyContent="center"
32
+ data-testid="slice-zone-blank-slate"
33
+ >
30
34
  <BlankSlate backgroundImage="/blank-slate-slice-zone.png">
31
35
  <BlankSlateContent>
32
36
  <Box justifyContent="center" padding={{ bottom: 16 }}>
@@ -89,7 +89,7 @@ export const CustomTypesTablePage: FC<CustomTypesTablePageProps> = ({
89
89
  />
90
90
  <AppLayoutActions>
91
91
  <Button
92
- data-cy="create-ct"
92
+ data-testid="create-ct"
93
93
  loading={isCreatingCustomType}
94
94
  onClick={() => {
95
95
  setIsCreateCustomTypeModalOpen(true);
@@ -1,6 +1,6 @@
1
1
  import { Select, SelectItem, tokens } from "@prismicio/editor-ui";
2
2
  import type { GitOwner } from "@slicemachine/manager";
3
- import type { ComponentProps, FC } from "react";
3
+ import type { ComponentPropsWithoutRef, FC } from "react";
4
4
 
5
5
  import { gitProviderToConfig } from "@src/features/settings/git/GitProvider";
6
6
 
@@ -68,4 +68,4 @@ function parseGitOwnerKey(key: string): string[] {
68
68
  }
69
69
 
70
70
  // TODO(DT-1928): export the `SX` type from `@prismicio/editor-ui`.
71
- type SX = ComponentProps<typeof Select>["sx"];
71
+ type SX = ComponentPropsWithoutRef<typeof Select>["sx"];
@@ -1,6 +1,6 @@
1
1
  import { keys } from "@prismicio/editor-support/Object";
2
2
  import { Button, ButtonGroup, Text, tokens } from "@prismicio/editor-ui";
3
- import { type ComponentProps, type FC, useState } from "react";
3
+ import { type ComponentPropsWithoutRef, type FC, useState } from "react";
4
4
  import { toast } from "react-toastify";
5
5
 
6
6
  import { gitProviderToConfig } from "@src/features/settings/git/GitProvider";
@@ -60,4 +60,4 @@ const GitProviderConnectButton: FC<GitProviderConnectButtonProps> = ({
60
60
  };
61
61
 
62
62
  // TODO(DT-1928): export the `SX` type from `@prismicio/editor-ui`.
63
- type SX = ComponentProps<typeof Button>["sx"];
63
+ type SX = ComponentPropsWithoutRef<typeof Button>["sx"];
@@ -94,7 +94,7 @@ export const ConvertLegacySliceAsNewSliceDialog: FC<DialogProps> = ({
94
94
  value.slice(0, 30),
95
95
  )
96
96
  }
97
- data-cy="slice-name-input"
97
+ data-testid="slice-name-input"
98
98
  />
99
99
  <Text variant="normal" color="grey11">
100
100
  A display name for the slice
@@ -142,7 +142,7 @@ export const ConvertLegacySliceAsNewVariationDialog: FC<DialogProps> = ({
142
142
 
143
143
  formik.setValues(values, true);
144
144
  }}
145
- data-cy="variation-name-input"
145
+ data-testid="variation-name-input"
146
146
  />
147
147
  </Box>
148
148
  <Box display="flex" flexDirection="column" gap={4}>
@@ -165,7 +165,7 @@ export const ConvertLegacySliceAsNewVariationDialog: FC<DialogProps> = ({
165
165
  camelCase(value.slice(0, 30)),
166
166
  );
167
167
  }}
168
- data-cy="variation-id-input"
168
+ data-testid="variation-id-input"
169
169
  />
170
170
  </Box>
171
171
  </ScrollArea>
@@ -175,7 +175,7 @@ export const ConvertLegacySliceButton: FC<ConvertLegacySliceButtonProps> = ({
175
175
  <DropdownMenu>
176
176
  <DropdownMenuTrigger>
177
177
  <Button
178
- data-cy="convert-legacy-slice"
178
+ data-testid="convert-legacy-slice"
179
179
  startIcon="refresh"
180
180
  endIcon="arrowDropDown"
181
181
  size="medium"
@@ -115,7 +115,6 @@ export const SharedSliceCard: FC<SharedSliceCardProps> = (props) => {
115
115
  <Card
116
116
  aria-label={`${slice.model.name} ${variation.name} slice card`}
117
117
  checked={selected}
118
- data-cy="shared-slice-card"
119
118
  data-testid="shared-slice-card"
120
119
  {...modeProps}
121
120
  {...variantProps}
@@ -167,7 +166,7 @@ export const SharedSliceCard: FC<SharedSliceCardProps> = (props) => {
167
166
  </DropdownMenuTrigger>
168
167
  <DropdownMenuContent
169
168
  align="end"
170
- data-cy="slice-action-icon-dropdown"
169
+ data-testid="slice-action-icon-dropdown"
171
170
  >
172
171
  {canUpdateScreenshot && disableOverlay ? (
173
172
  <DropdownMenuItem
@@ -337,15 +337,13 @@ describe("slices", () => {
337
337
  },
338
338
  });
339
339
 
340
- const createOneButton = document.querySelector('[data-cy="create-slice"]');
340
+ const createOneButton = screen.getByTestId("create-slice");
341
341
  await act(async () => {
342
- // @ts-expect-error TS(2345) FIXME: Argument of type 'Element | null' is not assignabl... Remove this comment to see the full error message
343
342
  fireEvent.click(createOneButton);
344
343
  });
345
344
 
346
- const nameInput = document.querySelector('[data-cy="slice-name-input"]');
345
+ const nameInput = await screen.findByTestId("slice-name-input");
347
346
  await act(async () => {
348
- // @ts-expect-error TS(2345) FIXME: Argument of type 'Element | null' is not assignabl... Remove this comment to see the full error message
349
347
  fireEvent.change(nameInput, { target: { value: "FooBar" } });
350
348
  });
351
349
 
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[318],{39576:function(e,n,t){"use strict";t.d(n,{Z:function(){return u}});var i=t(62230),r=t(52322);t(2784);var o=t(59326),l=t(75289),a=t(61183),s=function(e){return{subLanguage:"xml",contains:[e.COMMENT("<!--","-->",{relevance:10}),{begin:/^(\s*)(<script(\s*context="module")?>)/gm,end:/^(\s*)(<\/script>)/gm,subLanguage:"javascript",excludeBegin:!0,excludeEnd:!0,contains:[{begin:/^(\s*)(\$:)/gm,end:/(\s*)/gm,className:"keyword"},]},{begin:/^(\s*)(<style.*>)/gm,end:/^(\s*)(<\/style>)/gm,subLanguage:"css",excludeBegin:!0,excludeEnd:!0},{begin:/\{/gm,end:/\}/gm,subLanguage:"javascript",contains:[{begin:/[\{]/,end:/[\}]/,skip:!0},{begin:/([#:\/@])(if|else|each|await|then|catch|debug|html)/gm,className:"keyword",relevance:10},]},]}};a.Z.registerLanguage("svelte",s);var c=["javascript","bash","xml","html","json"],u=function(e){var n,t=e.children,s=e.lang,u=e.sx,d=e.codeStyle,f=e.codeClass,p=e.Header,x=(0,o.B7)().theme,m=s?a.Z.highlight(t,{language:"vue"===s?"html":s}).value:a.Z.highlightAuto(t,c).value;return(0,r.jsxs)(l.kC,{as:"pre",sx:u,children:[p?(0,r.jsx)(p,{}):null,(0,r.jsx)("code",{className:"hljs".concat(f?" ".concat(f):""),style:(0,i.Z)({overflowX:"auto",padding:"3px 5px",borderRadius:"6px",border:"1px solid",borderColor:String(null===(n=x.colors)||void 0===n?void 0:n.textClear)},d),dangerouslySetInnerHTML:{__html:m}})]})}},3026:function(e,n,t){"use strict";t.d(n,{J:function(){return c},k:function(){return s}});var i=t(62230),r=t(85244),o=t(98240),l=t(52322);t(2784);var a=t(75289),s=function(e){var n=e.children,t=e.sx,s=(0,o.Z)(e,["children","sx"]);return(0,l.jsx)(a.xu,(0,r.Z)((0,i.Z)({sx:(0,i.Z)({display:["block","block","flex"],flexWrap:"wrap",justifyContent:"space-between"},t)},s),{children:n}))},c=function(e){var n=e.children,t=e.cols;return(0,l.jsx)(a.xu,{sx:{flex:"0 ".concat(100/(void 0===t?2:t)-1,"%"),mb:1},children:n})}},59872:function(e,n,t){"use strict";t.d(n,{$w:function(){return i},Hq:function(){return d},tM:function(){return u}});var i,r=t(62230),o=t(85244),l=t(52322),a=t(63397);t(2784);var s,c=t(75289);(s=i||(i={}))[s.ERROR=0]="ERROR",s[s.DISABLED=1]="DISABLED",s[s.WARNING=2]="WARNING";var u=function(e){var n={"&::placeholder":{color:"#C9D0D8"}};switch(e){case i.DISABLED:return(0,o.Z)((0,r.Z)({},n),{border:"1px solid #E6E6EA",backgroundColor:"#F3F5F7"});case i.ERROR:return(0,o.Z)((0,r.Z)({},n),{border:"1px solid #E26049","&:focus":{outline:"none",borderColor:"#E26049",boxShadow:"0 0 0 3px rgba(226, 96, 73, 0.2), inset 0 1px 2px rgba(226, 96, 73, 0.2)"}});case i.WARNING:return(0,o.Z)((0,r.Z)({},n),{border:"1px solid orange","&:focus":{outline:"none",borderColor:"orange",boxShadow:"0 0 0 3px rgba(255, 165, 0, 0.2), inset 0 1px 2px rgba(255, 165, 0, 0.2)"}});default:return n}},d=function(e){var n=e.sx,t=e.field,s=e.meta,d=e.formField,f=e.fieldName,p=e.fields,x=e.initialValues,m=e.isDisabled,h=s.error?i.ERROR:m||d.disabled?i.DISABLED:void 0;return(0,l.jsxs)(c.xu,{sx:void 0===n?{}:n,children:[(0,l.jsxs)(c.__,{variant:"label.primary",htmlFor:f,children:[d.label||f,s.touched&&s.error?(0,l.jsx)(c.xv,{as:"span",variant:"text.labelError",children:s.error}):null]}),(0,l.jsx)(a.gN,(0,o.Z)((0,r.Z)({id:f,name:f,type:"text",placeholder:d.placeholder||d.label||f},d.fieldLevelValidation&&x?{validate:function(e){return d.fieldLevelValidation&&d.fieldLevelValidation({value:e,fields:p,initialId:x.id})}}:null,t),{as:c.II,sx:u(h),disabled:m||d.disabled}))]})}},34066:function(e,n,t){"use strict";t.d(n,{kp:function(){return c},sP:function(){return d},w8:function(){return f},Hq:function(){return p.Hq}});var i=t(62230),r=t(85244),o=t(52322),l=t(2784),a=t(63397),s=t(75289),c=function(e){var n=e.field,t=e.meta,c=e.fieldName,u=e.label,d=e.focusOnNewEntry,f=void 0===d||d,p=e.inputPlaceholder,x=e.buttonLabel,m=(0,l.useState)(t.value.length),h=m[0],v=m[1],g=(0,l.useRef)(Array(t.value.length));return(0,l.useEffect)(function(){g.current=g.current.slice(0,t.value.length)},[t.value.length]),(0,l.useEffect)(function(){var e=g.current.length;f&&e>h&&g.current[e-1].focus(),v(e)},[g.current.length,f,h]),(0,o.jsxs)(l.Fragment,{children:[(0,o.jsxs)(s.__,{variant:"label.primary",htmlFor:c,children:[u,t.touched&&t.error?(0,o.jsx)(s.xv,{as:"span",variant:"text.labelError",children:t.error}):null]}),(0,o.jsx)(a.F2,(0,r.Z)((0,i.Z)({name:c,id:c},n),{render:function(e){return(0,o.jsxs)("div",{children:[n.value&&n.value.length>0?n.value.map(function(n,t){return(0,o.jsxs)(s.kC,{my:2,children:[(0,o.jsx)(s.II,{placeholder:p,name:"".concat(c,".").concat(t),value:n,ref:function(e){return g.current[t]=e},onChange:function(n){var i=n.target.value;return e.replace(t,i)}}),(0,o.jsx)(s.zx,{ml:2,type:"button",variant:"secondary",onClick:function(){return e.remove(t)},children:"-"})]},"".concat(c,"-").concat(+t+1))}):null,(0,o.jsx)(s.zx,{type:"button",onClick:function(){return e.insert(n.value.length,"")},children:x})]})}}))]})},u=t(98240),d=function(e){e.initialValues;var n=e.meta,t=e.label,l=e.fieldName,c=e.onChange,d=(0,u.Z)(e,["initialValues","meta","label","fieldName","onChange"]);return(0,o.jsxs)(s.__,(0,r.Z)((0,i.Z)({variant:"label.border"},d),{children:[(0,o.jsx)(a.gN,{as:s.XZ,type:"checkbox",name:l,onChange:function(){return c(!n.value)},checked:n.value}),t]}))},f=function(e){var n=e.field,t=e.label,i=e.defaultValue,r=e.onChange,a=e.controlledValue,s=e.setControlledValue,c=e.buildControlledValue,u=(0,l.useState)(i||n.defaultValue||!1),f=u[0],p=u[1];return(0,l.useEffect)(function(){c?s(c(a,f)):s(c)},[f,a,c]),(0,o.jsx)(d,{meta:{value:f},fieldName:n.name,onChange:function(e){return p(e)&&r&&r(e)},label:"function"==typeof t?t(a,f):t})},p=t(59872)},71168:function(e,n,t){"use strict";var i=t(62230),r=t(85244),o=t(98240),l=t(52322),a=t(2784),s=t(75289),c=(0,a.forwardRef)(function(e,n){var t=e.children,a=e.Component,c=void 0===a?s.kC:a,u=e.sx,d=(0,o.Z)(e,["children","Component","sx"]);return(0,l.jsx)(c,(0,r.Z)((0,i.Z)({as:"li",sx:(0,i.Z)({p:3,mx:3,alignItems:"center",variant:"styles.listItem"},void 0===u?{}:u),ref:n},d),{children:t}))});n.Z=c},28728:function(e,n,t){"use strict";t.d(n,{Z:function(){return j}});var i=t(62230),r=t(85244),o=t(52322),l=t(2784),a=t(40023),s=t(5446),c=t(59326),u=t(75289),d=t(71168),f=t(39031),p=t(98240),x=t(33710),m=t(39295),h=function(e){var n=e.text,t=e.as,a=e.sx,s=(0,p.Z)(e,["text","as","sx"]),c=(0,l.useRef)(null),d=(0,l.useState)(null),f=d[0],h=d[1],v=function(){h(c.current&&c.current.offsetWidth<c.current.scrollWidth)};return(0,l.useEffect)(function(){return v(),window.addEventListener("resize",v),function(){window.removeEventListener("resize",v)}},[]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(u.xv,(0,r.Z)((0,i.Z)({"data-for":n,"data-tip":!0,sx:(0,i.Z)({flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},void 0===a?{}:a),as:t,ref:c},s),{children:n})),f&&(0,o.jsx)(m.X,{children:(0,o.jsx)(x.Z,{id:n,type:"dark",multiline:!0,border:!0,borderColor:"black",place:"bottom",effect:"solid",children:n})})]})},v=function(e){var n,t,i=e.text,r=e.sliceFieldName,l=e.theme,a=e.WidgetIcon;return(0,o.jsxs)(u.kC,{sx:{alignItems:"center",position:"relative"},children:[(0,o.jsx)(a,{size:28,style:{color:null===(n=l.colors)||void 0===n?void 0:n.primary,marginRight:"8px",borderRadius:"4px",padding:"4px",border:"2px solid",borderColor:null===(t=l.colors)||void 0===t?void 0:t.primary}}),(0,o.jsx)(h,{text:i,as:"p",sx:{py:0,px:1,fontWeight:"label",fontSize:"15px"},"data-cy":"field-name"}),(0,o.jsx)(u.xv,{as:"p",sx:{display:["none","none","initial"],fontSize:"14px",ml:1,color:"textClear"},"data-cy":"field-id",children:r})]})},g=t(951),b=t(8799),y=t(18978),j=function(e){var n=e.item,t=e.index,p=e.deleteItem,x=e.enterEditMode,m=e.modelFieldName,h=e.renderFieldAccessor,j=e.HintElement,Z=e.CustomEditElement,C=e.CustomEditElements,k=e.widget,S=e.draggableId,I=e.dataCy,F=e.isRepeatableCustomType,E=e.children,w=(0,c.B7)().theme,T=n.key,A=n.value,_=A.config,N=A.type;return(0,o.jsx)(l.Fragment,{children:(0,o.jsx)(a._l,{draggableId:S,index:t,children:function(e){var a,c,S,A,R;return(0,o.jsx)(l.Fragment,{children:(0,o.jsxs)(d.Z,(0,r.Z)((0,i.Z)({"data-cy":I,ref:e.innerRef},e.draggableProps),{Component:u.xu,sx:{p:0,mx:0,my:3},children:[(0,o.jsxs)(u.kC,{sx:{width:"100%"},children:[(0,o.jsx)(f.Z,(0,i.Z)({label:"Reorder slice field (drag and drop)",Icon:y.Fm7,color:null===(a=w.colors)||void 0===a?void 0:a.icons,mr:1,mt:3},e.dragHandleProps)),(0,o.jsxs)(u.xu,{sx:{bg:"headSection",width:"100%",borderRadius:"3px",border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:[(0,o.jsxs)(u.kC,{sx:{p:3,alignItems:"center",justifyContent:"space-between",width:"100%"},children:[(0,o.jsx)(v,{theme:w,text:(null==_?void 0:_.label)||T,sliceFieldName:h&&h(T),WidgetIcon:k.Meta.icon}),(0,o.jsxs)(u.kC,{children:[C||null,Z||(0,o.jsx)(f.Z,{size:22,Icon:g.$iz,label:"Edit field",sx:{cursor:"pointer",color:null===(c=w.colors)||void 0===c?void 0:c.icons},onClick:function(){return x([T,n.value],m,t)}}),!(!0===F&&"UID"==N)&&(0,o.jsxs)(s.v2,{children:[(0,o.jsx)(s.j2,{className:"sliceMenuButton","data-cy":"field-menu-button",style:{padding:"0",cursor:"pointer",width:"32px",height:"32px",border:"none",background:"transparent",outline:"0"},children:(0,o.jsx)(b.FQA,{size:20,color:null===(S=w.colors)||void 0===S?void 0:S.icons,style:{pointerEvents:"none"}})}),(0,o.jsx)(s.qy,{style:{background:null===(A=w.colors)||void 0===A?void 0:A.gray,border:"1px solid",borderRadius:"3px",borderColor:null===(R=w.colors)||void 0===R?void 0:R.borders,outline:"0"},children:(0,o.jsx)(s.sN,{style:{padding:"6px",cursor:"pointer"},onSelect:function(){return p(T)},children:"Delete field"})})]})]})]}),j||null]})]}),E]}))})}})})}},39031:function(e,n,t){"use strict";var i=t(62230),r=t(85244),o=t(98240),l=t(52322),a=t(75289),s=function(e,n){return n?{border:function(e){var n=e.colors;return"1px solid ".concat(n.error)}}:e?{border:function(e){var n=e.colors;return"1px solid ".concat(n.primary)}}:{border:function(e){var n=e.colors;return"1px solid ".concat(n.borders)}}},c=function(e){var n=e.sx,t=e.onClick,c=e.label,u=e.Icon,d=e.error,f=e.size,p=void 0===f?16:f,x=e.fitButton,m=e.active,h=e.useActive,v=e.activeSx,g=(0,o.Z)(e,["sx","onClick","label","Icon","error","size","fitButton","active","useActive","activeSx"]);return(0,l.jsx)(a.hU,(0,r.Z)((0,i.Z)({onClick:void 0===t?function(){return null}:t,"aria-label":c,type:"button",sx:(0,i.Z)({},void 0!==x&&x?{width:p,height:p}:null,void 0!==h&&h&&(void 0===v?s:v)(void 0!==m&&m,void 0===d?null:d),void 0===n?null:n)},g),{children:(0,l.jsx)(u,{size:p})}))};n.Z=c},89853:function(e,n,t){"use strict";var i=t(62230),r=t(17064),o=t(52322),l=t(2784),a=t(63397),s=t(34066),c=t(78610),u=t(75289),d=function(e){var n=e.fieldName,t=e.formField,d=e.fields,f=e.initialValues,p=(0,r.Z)((0,a.U$)(n),3),x=p[0],m=p[1],h=p[2],v=t.component;return(0,o.jsx)(u.xu,{sx:(0,i.Z)({mt:2,alignItems:"center"},t.type===c.h.CHECKBOX?{display:"flex",height:"130%"}:null),children:v?(0,o.jsx)(v,{meta:m,field:x,helpers:h,fieldName:n,formField:t,initialValues:f}):(0,o.jsxs)(l.Fragment,{children:[t.type===c.h.INPUT?(0,o.jsx)(s.Hq,{meta:m,field:x,fields:d,formField:t,fieldName:n,initialValues:f}):null,t.type===c.h.CHECKBOX&&(0,o.jsx)(s.sP,{meta:m,label:t.label,fieldName:n,initialValues:f,onChange:function(e){return h.setValue(e)}})]})})};n.Z=d},4092:function(e,n,t){"use strict";t.d(n,{Z:function(){return B}});var i=t(62230),r=t(85244),o=t(17064),l=t(52322),a=t(37149),s=t.n(a),c=t(25812),u=t(59326),d=t(75289),f=t(65413),p=t(83239),x=t(60113),m=t(2784),h=t(92928),v=t(98240),g=function(e){var n=e.children,t=(0,v.Z)(e,["children"]);return(0,l.jsx)(d.xu,(0,r.Z)((0,i.Z)({as:"ul",sx:{p:0,m:0,px:function(e){return"calc(".concat(e.space[3],"px + 8px)")},borderBottom:"1px solid #DFE1E5",position:"relative"}},t),{children:n}))};g.tabsRole="TabList";var b=function(e){var n=e.children,t=(0,v.Z)(e,["children"]),o=(0,u.B7)().theme;return(0,l.jsx)(h.OK,(0,r.Z)((0,i.Z)({},t),{style:(0,i.Z)({margin:"0 32px 0 0",top:"0",padding:"8px 0px",border:"none",bottom:"-1px",opacity:"0.8",transition:"all 150ms cubic-bezier(0.215,0.60,0.355,1)",borderRadius:"0"},t.selected?{borderBottom:"3px solid ".concat(o.colors.primary),color:o.colors.text,fontWeight:"500",opacity:"1",backgroundColor:"transparent"}:{borderBottom:"3px solid transparent"}),children:n}))};b.tabsRole="Tab";var y=t(54132),j=function(e){var n=e.children,t=e.Footer,r=e.Header,o=e.tabs,a=e.bodySx,s=e.footerSx,c=e.defaultIndex,u=void 0===c?0:c,f=(0,m.useState)(u),p=f[0],x=f[1];return(0,l.jsx)(y.Z,{borderFooter:!0,footerSx:(0,i.Z)({p:0},s),bodySx:(0,i.Z)({p:0},a),sx:{border:"none"},Header:r,Footer:t,children:(0,l.jsxs)(h.mQ,{defaultIndex:u,onSelect:function(e){return x(e)},children:[(0,l.jsx)(g,{children:(o||[]).map(function(e){return(0,l.jsx)(b,{children:e},e)})}),m.Children.map(n,function(e,n){return(0,l.jsx)(d.xu,{sx:{p:function(e){return"calc(".concat(e.space[3],"px + 8px)")},display:n===p?"block":"none"},children:(0,l.jsx)(h.x4,{children:e})})})]})})},Z=(0,m.memo)(j),C=function(e){var n,t,i=e.text,r=e.sliceFieldName,o=e.theme,a=e.WidgetIcon;return(0,l.jsxs)(d.kC,{sx:{alignItems:"center"},children:[(0,l.jsx)(a,{size:28,style:{color:null===(n=o.colors)||void 0===n?void 0:n.primary,marginRight:"8px",borderRadius:"4px",padding:"4px",border:"2px solid",borderColor:null===(t=o.colors)||void 0===t?void 0:t.primary}}),(0,l.jsx)(d.xv,{as:"p","data-cy":"item-header-text",sx:{py:0,px:1,fontWeight:"label",fontSize:"15px"},children:i}),(0,l.jsx)(d.xv,{as:"p",sx:{display:["none","none","initial"],fontSize:"14px",ml:1,color:"textClear"},children:r})]})},k=t(3026),S=t(67557),I=t(77033),F=t(63397),E=function(e){var n=e.formId,t=e.initialValues,a=e.validationSchema,s=e.onSave,c=e.FormFields,u=e.children;return(0,l.jsx)(d.xu,{children:(0,l.jsx)(F.J9,{initialValues:t,validationSchema:a,onSubmit:function(e,n){var t;s({newKey:e.id,value:Object.entries((0,v.Z)(e,["id"])).reduce(function(e,n){var t=(0,o.Z)(n,2),l=t[0],a=t[1];if((void 0===a?"undefined":(0,I.Z)(a))!==Boolean&&!a){var s,u=null===(s=c[l])||void 0===s?void 0:s.defaultValue;if(void 0!==u)return(0,r.Z)((0,i.Z)({},e),(0,S.Z)({},l,u))}return(0,r.Z)((0,i.Z)({},e),(0,S.Z)({},l,a))},{})})},children:function(e){return(0,l.jsx)(F.l0,{id:n,children:u((0,r.Z)((0,i.Z)({},e),{initialValues:t}))})}})})},w=(0,m.memo)(E),T=t(89853),A=t(99968),_=t(83462),N=t(5632),R=t(75329),M=t(65186),z=function(){var e=(0,N.useRouter)();return(0,l.jsxs)(d.xu,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"60px"},children:[(0,l.jsx)(M.wr$,{size:48,color:"#C9D0D8"}),(0,l.jsx)(d.xu,{sx:{height:"12px"}}),(0,l.jsx)(d.xv,{color:"text",sx:{fontWeight:600,fontSize:"24px",lineHeight:"32px",textAlign:"center"},children:"Your mock data has moved"}),(0,l.jsx)(d.xu,{sx:{height:"8px"}}),(0,l.jsx)(d.xv,{color:"text",sx:{fontWeight:400,fontSize:"14px",lineHeight:"24px",textAlign:"center"},children:"You can now edit directly your mock data in the new Slice Simulator."}),(0,l.jsx)(d.xu,{sx:{height:"24px"}}),(0,l.jsx)(d.zx,{onClick:function(n){n.preventDefault(),window.open("".concat(e.asPath,"/simulator"),R.pq)},children:"Go to the Slice Simulator"})]})};s().setAppElement("#__next");var B=function(e){var n=e.close,t=e.data,a=e.fields,s=e.onSave,m=e.zoneType,h=(0,u.B7)().theme;if(!t.isOpen)return null;var v=(0,o.Z)(t.field,2),g=v[0],b=v[1],y=(0,A.t)(p,b.config,b.type);if(!y)return(0,l.jsxs)("div",{children:[b.type," not found"]});var j=y.Meta.icon,S=y.FormFields,I=y.Form,F=y.schema,E=(0,i.Z)({},(0,x.f7)((0,_.B9)(S,"id")),y.prepareInitialValues?y.prepareInitialValues(b.config):b.config),N=function(){try{return{res:F.validateSync({type:b.type,config:E},{stripUnknown:!0})}}catch(e){return{err:e}}}(),R=N.res,M=N.err;M&&(console.error("[EditModal] Failed to validate field of type ".concat(b.type,".\n Please update model.json accordingly.")),console.error(M));var B={id:g,config:R?R.config:E},q=(0,o.Z)(S.id.validate.matches,2),D=q[0],O=q[1],P=f.object().shape({id:f.string().matches(D,O).min(3).max(35).required(),config:F.fields.config}),V="".concat("edit-modal-form","-").concat(Math.random().toString());return(0,l.jsx)(c.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,onRequestClose:n,contentLabel:"Widget Form Modal",children:(0,l.jsx)(w,{apiId:g,formId:V,initialValues:B,validationSchema:P,FormFields:S,onSave:function(e){var t=e.newKey,r=e.value;s({apiId:g,newKey:t,value:(0,i.Z)({},b,r)}),n()},children:function(e){var t=e.values,s=t.id,c=t.config.label,u=e.isValid,f=e.isSubmitting,p=e.initialValues,v=I?(0,l.jsx)(I,(0,r.Z)((0,i.Z)({},e),{fields:a}),"field-model-tab-content"):(0,l.jsx)(k.k,{children:Object.entries(S).map(function(e){var n=(0,o.Z)(e,2),t=n[0],i=n[1];return(0,l.jsx)(k.J,{children:(0,l.jsx)(T.Z,{fieldName:(0,x.lm)(t),formField:i,fields:a,initialValues:p})},t)})},"field-model-tab-content"),g=["Field Model"],b=[v];if("slice"===m){var y=(0,l.jsx)(d.xu,{children:(0,l.jsx)(z,{})},"mock-data-tab-content");g.push("Mock Data"),b.push(y)}return(0,l.jsx)(Z,{borderFooter:!0,footerSx:{position:"sticky",bottom:0,p:0},tabs:g,Header:function(e){var t=e.radius;return(0,l.jsxs)(d.kC,{sx:{position:"sticky",zIndex:1,top:0,p:3,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:t,borderTopRightRadius:t},children:[(0,l.jsx)(C,{theme:h,text:c||s,WidgetIcon:j}),(0,l.jsx)(d.x8,{onClick:n,type:"button"})]})},Footer:(0,l.jsxs)(d.kC,{sx:{position:"sticky",bottom:0,alignItems:"space-between",bg:"headSection",p:3},children:[(0,l.jsx)(d.xu,{sx:{ml:"auto"}}),(0,l.jsx)(d.zx,{mr:2,type:"button",onClick:n,variant:"secondary",children:"Cancel"}),(0,l.jsx)(d.zx,{form:V,type:"submit",disabled:!u&&f,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"},children:"Done"})]}),children:b})}})})}},75012:function(e,n,t){"use strict";t.d(n,{Z:function(){return x}});var i=t(62230),r=t(85244),o=t(52322),l=t(37149),a=t.n(l),s=t(25812),c=t(75289),u=t(54132),d=t(3026),f=t(59326),p=function(e){var n=e.title,t=e.description,i=e.icon,r=e.onSelect,l=(0,f.B7)().theme;return(0,o.jsxs)(c.kC,{sx:{p:3,my:2,alignItems:"center",cursor:"pointer",borderRadius:"3px",border:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)},"&:hover":{border:function(e){var n=e.colors;return"1px solid ".concat(n.primary)},boxShadow:"0 0 0 3px rgba(81, 99, 186, 0.2)"}},"data-cy":n,onClick:r,children:[(0,o.jsx)(i,{label:'Select field of type "'.concat(n,'"'),style:{color:l.colors.primary,marginRight:"8px",borderRadius:"4px",padding:"5px",border:"2px solid",borderColor:l.colors.primary},size:32}),(0,o.jsxs)(c.xu,{ml:1,children:[(0,o.jsx)(c.X6,{as:"h4",sx:{fontSize:1},children:(0,o.jsx)("b",{children:n})}),(0,o.jsx)(c.xv,{as:"p",variant:"xs",children:t})]})]})};a().setAppElement("#__next");var x=function(e){var n=e.data,t=e.close,l=e.onSelect,a=e.widgetsArray;return n.isOpen?(0,o.jsx)(s.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,onRequestClose:t,contentLabel:"Widget Form Modal",children:(0,o.jsx)(u.Z,{borderFooter:!0,footerSx:{p:3},bodySx:{pt:2,pb:4,px:4},sx:{border:"none"},Header:function(e){var n=e.radius;return(0,o.jsxs)(c.kC,{sx:{position:"sticky",top:0,zIndex:1,p:3,pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)}},children:[(0,o.jsx)(c.X6,{children:"Add a new field"}),(0,o.jsx)(c.x8,{onClick:t})]})},children:(0,o.jsx)(d.k,{children:a.filter(function(e){return e}).map(function(e){var n=e.Meta,t=e.TYPE_NAME,a=e.CUSTOM_NAME;return(0,o.jsx)(d.J,{children:(0,o.jsx)(p,(0,r.Z)((0,i.Z)({},n),{onSelect:function(){return l(a||t)}}))},a||t)})})})}):null}},70697:function(e,n,t){"use strict";t.d(n,{Z:function(){return v}});var i=t(22710),r=t(99267),o=t(52322),l=t(2784),a=t(49857),s=t(81038),c=t(59326),u=t(75289),d=t(8799),f=t(77245),p=t(65186),x=t(39576),m={position:"relative",top:"3px"},h=function(e){var n,t,i,r=e.code,a=e.lang,s=(0,c.B7)().theme,h=(0,l.useState)(!1),v=h[0],g=h[1],b=function(){r&&navigator.clipboard.writeText(r).then(function(){g(!0),setTimeout(function(){g(!1)},1200)})};return r?(0,o.jsxs)(u.kC,{sx:{p:2,px:3,alignItems:"center",borderTop:"1px solid",borderColor:"borders",justifyContent:"space-between"},children:[(0,o.jsxs)(u.kC,{sx:{alignItems:"center",display:["none","none","flex"],maxWidth:"80%"},children:[(0,o.jsx)(d.vcz,{size:26,color:null==s?void 0:null===(n=s.colors)||void 0===n?void 0:n.icons,style:{border:"1px solid",borderColor:null==s?void 0:null===(t=s.colors)||void 0===t?void 0:t.borders,borderRadius:"3px",padding:"4px",marginRight:"2px"}}),(0,o.jsx)(x.Z,{sx:{margin:"0px 8px",border:"none",borderRadius:"3px",fontSize:"13px"},lang:a,children:r})]}),(0,o.jsx)(u.xu,{children:(0,o.jsxs)(u.zx,{"aria-label":v?"Code snippet copied":"Copy code snippet",onClick:b,variant:"textButton",children:[v?(0,o.jsx)(p.HhX,{size:16,color:null==s?void 0:null===(i=s.colors)||void 0===i?void 0:i.success,style:m}):(0,o.jsx)(f.LhG,{size:16,style:m}),(0,o.jsx)(u.xv,{as:"span",sx:{display:["none","inline","none","inline"]},children:"\xa0Copy"})]})})]}):null},v=function(e){var n=e.show,t=e.renderHintBase,l=e.item,c=t({item:l}),u=(0,a.ZP)(c,(0,i.Z)(function(){return(0,r.__generator)(this,function(e){switch(e.label){case 0:return[4,s.j.snippets.readSnippets({fieldPath:c.split("."),model:l.value})];case 1:return[2,e.sent()]}})})),d=u.data,f=u.error;if(f&&console.error(f),!d||f)return null;var p=d.snippets||[];return p[0]?(0,o.jsx)("div",{style:{display:n?"initial":"none"},children:(0,o.jsx)(h,{code:p[0].code,lang:p[0].language})}):null}},9620:function(e,n,t){"use strict";t.d(n,{Z:function(){return Z}});var i=t(62230),r=t(85244),o=t(98240),l=t(52322),a=t(2784),s=t(63397),c=t(75289),u=t(59326),d=t(22715),f=t(90569),p=t(60113),x=t(83239),m=t(38876),h=t(33710),v=t(18978),g=t(39295),b=function(e){var n=e.error;return n?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(g.X,{children:(0,l.jsx)(h.Z,{type:"light",multiline:!0,border:!0,borderColor:"tomato"})}),(0,l.jsx)(v.Zlu,{color:"tomato","data-tip":n,style:{position:"absolute",right:"8px"},size:16})]}):null},y=t(59872),j=function(e){var n=e.innerRef,t=(0,o.Z)(e,["innerRef"]);return(0,l.jsx)(c.II,(0,r.Z)((0,i.Z)({},t),{ref:n}))},Z=function(e){var n=e.widgetTypeName,t=e.fields,o=e.onSave,h=e.onCancelNewField,v=(0,a.useRef)(null),g=(0,u.B7)().theme,Z=(0,a.useState)(!0),C=Z[0],k=Z[1];(0,a.useEffect)(function(){v.current&&v.current.focus()},[v]);var S=x[n];if(!S)return console.error('Widget of type "'.concat(n,'" not found. This is a problem on our side!')),(0,l.jsx)("div",{children:"Unexpected error. Contact us for more info."});var I=S.FormFields,F=S.Meta.icon,E={id:I.id,label:I.label},w=(0,r.Z)((0,i.Z)({},(0,p.f7)(E),"UID"===n?{id:"uid"}:{}),{widgetTypeName:n}),T=(0,p.gc)(E),A=function(e,n,t){t(C&&!E.id.disabled?(0,r.Z)((0,i.Z)({},n),{label:e.target.value,id:(0,m.lV)(e.target.value)}):(0,r.Z)((0,i.Z)({},n),{label:e.target.value}))},_=function(e,n){n("id",e.target.value),k(!1)};return(0,l.jsx)(s.J9,{onSubmit:o,validationSchema:T,initialValues:w,children:function(e){var n,o,a=e.errors,u=e.values,p=e.setValues,x=e.setFieldValue,m=e.submitForm;return(0,l.jsx)(s.l0,{"data-cy":"new-field-form",children:(0,l.jsxs)(c.kC,{as:"li",sx:{bg:"white",p:3,px:3,mx:0,ml:"34px",alignItems:"center",variant:"styles.listItem",border:function(e){var n,t;return"1px solid ".concat((null===(n=e.colors)||void 0===n?void 0:null===(t=n.borders)||void 0===t?void 0:t.toString())||"")},flexWrap:"wrap",gap:"12px",justifyContent:"flex-start"},children:[(0,l.jsx)(F,{style:{color:null===(n=g.colors)||void 0===n?void 0:n.primary,borderRadius:"4px",padding:"4px",border:"2px solid",borderColor:null===(o=g.colors)||void 0===o?void 0:o.primary},size:28}),(0,l.jsxs)(c.kC,{sx:{alignItems:"center",flexGrow:1,gap:2,position:"relative"},children:[(0,l.jsx)(c.xv,{as:"p",sx:{fontWeight:500,whiteSpace:"nowrap"},children:"Field Name"}),(0,l.jsx)(s.gN,{onChange:function(e){return A(e,u,p)},onKeyDown:function(e){"Enter"===e.key&&m()},name:"label",placeholder:"Field Name",type:"text",validate:function(e){if(!e.length)return"This field is required"},as:j,innerRef:v,sx:(0,r.Z)((0,i.Z)({},(0,y.tM)(E.label.disabled?y.$w.DISABLED:a.label?y.$w.ERROR:void 0)),{flexGrow:1,minWidth:"128px",width:"initial"}),"aria-label":"label-input","data-cy":"new-field-name-input"}),(0,l.jsx)(b,{error:a.label})]}),(0,l.jsxs)(c.kC,{sx:{alignItems:"center",flexGrow:1,gap:2,position:"relative"},children:[(0,l.jsx)(c.xv,{as:"p",sx:{fontWeight:500,whiteSpace:"nowrap"},children:"Field ID"}),(0,l.jsx)(s.gN,{onChange:function(e){return _(e,x)},onKeyDown:function(e){"Enter"===e.key&&m()},name:"id",placeholder:"e.g. buttonLink",type:"text",disabled:E.id.disabled,validate:function(e){return(0,f.u)({value:e,fields:t,initialId:null})},as:j,sx:(0,r.Z)((0,i.Z)({},(0,y.tM)(E.id.disabled?y.$w.DISABLED:a.id?y.$w.ERROR:void 0)),{flexGrow:1,minWidth:"128px",width:"initial"}),"data-cy":"new-field-id-input"}),(0,l.jsx)(b,{error:a.id})]}),(0,l.jsxs)(c.kC,{sx:{gap:2},children:[(0,l.jsx)(d.zx,{onClick:h,color:"grey",children:"Cancel"}),(0,l.jsx)(d.zx,{onClick:function(){m()},children:"Add"})]})]})})}})}},8482:function(e,n,t){"use strict";t.d(n,{Z:function(){return S}});var i=t(62230),r=t(85244),o=t(17064),l=t(81541),a=t(52322),s=t(22715),c=t(13980),u=t(2784),d=t(65077),f=t(28173),p=t(75012),x=t(9620),m=t(40023),h=t(75289),v=t(71168),g=t(28728),b=t(83239),y=t(99968),j=t(70697),Z=function(e){var n=e.fields,t=e.title,o=e.tabId,l=e.enterEditMode,s=e.enterSelectMode,c=e.onDragEnd,u=e.renderFieldAccessor,d=e.onDeleteItem,f=e.showHints,p=e.newField,x=e.renderHintBase,Z=e.isRepeatable,C=e.dataCy,k=e.isRepeatableCustomType;return(0,a.jsx)(m.Z5,{onDragEnd:c,children:(0,a.jsx)(m.bK,{droppableId:t,children:function(e,t){return(0,a.jsxs)(h.xu,(0,r.Z)((0,i.Z)({as:"ul",ref:e.innerRef},e.droppableProps),{"data-cy":C,sx:{paddingInline:"16px !important"},children:[n.map(function(e,n){var c=e.value,p=c.config,m=c.type,C=(0,y.t)(b,p,m);if(!C)return(0,a.jsx)(v.Z,{children:(0,a.jsxs)(h.xv,{children:['Field type "',m,'" not supported']})});var S={item:e,index:n,tabId:o,widget:C,showHints:f,key:e.key,enterSelectMode:s,renderFieldAccessor:u,enterEditMode:l,parentSnapshot:t,deleteItem:d,draggableId:"list-item-".concat(e.key),isRepeatableCustomType:k,dataCy:"list-item-".concat(e.key)};if(C.CustomListItem){var I=C.CustomListItem;return(0,a.jsx)(I,(0,i.Z)({},S))}var F=(0,a.jsx)(j.Z,{item:e,show:f,isRepeatable:Z,renderHintBase:x,Widgets:b,typeName:C.CUSTOM_NAME||C.TYPE_NAME});return(0,a.jsx)(g.Z,(0,r.Z)((0,i.Z)({},S),{HintElement:F}))}),e.placeholder,p]}))}})})},C=function(e){var n=e.onEnterSelectMode,t=e.zoneName;return(0,a.jsxs)(h.xu,{sx:{textAlign:"center",my:4},children:[(0,a.jsx)(h.X6,{as:"h5",children:"Add a new field here"}),(0,a.jsx)(h.xu,{sx:{my:2},children:(0,a.jsxs)(h.xv,{sx:{color:"textClear"},children:["Add a field to your ",t," Zone"]})}),(0,a.jsx)(h.xu,{sx:{display:"flex",justifyContent:"center",marginTop:16},children:(0,a.jsx)(s.zx,{color:"grey",onClick:function(){return n()},"data-cy":"add-".concat(t,"-field"),startIcon:"add",children:"Add a new field"})})]})},k=function(e){var n=e.zoneType,t=e.tabId,c=e.title,m=e.fields,h=e.poolOfFieldsToCheck,v=e.widgetsArray,g=e.isRepeatable,b=e.onDeleteItem,y=e.onSaveNewField,j=e.onDragEnd,k=e.EditModal,S=e.onSave,I=e.dataTip,F=e.renderHintBase,E=e.renderFieldAccessor,w=e.dataCy,T=e.isRepeatableCustomType,A=Object.entries(h).find(function(e){return"UID"===(0,o.Z)(e,2)[1].value.type})?v.filter(function(e){return"UID"!==e.TYPE_NAME}):v,_=(0,u.useState)(!1),N=_[0],R=_[1],M=(0,u.useState)({isOpen:!1}),z=M[0],B=M[1],q=(0,u.useState)({isOpen:!1}),D=q[0],O=q[1],P=(0,u.useState)(null),V=P[0],L=P[1],H=function(e){B({isOpen:!0,field:e})},J=function(){O({isOpen:!0})},U=function(){B({isOpen:!1})},W=function(){return O({isOpen:!1})},$=function(e){L({widgetTypeName:e,fields:m}),O({isOpen:!1})},G=function(){return L(null)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f.Bu,{actions:m.length>0?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.xv,{color:"grey11",component:"span",noWrap:!0,children:"Show code snippets?"}),(0,a.jsx)(s.rs,{checked:N,onCheckedChange:R,size:"small",style:{flexShrink:0},"data-cy":"code-snippets-switch"}),(0,a.jsx)(s.zx,{"data-cy":"add-".concat(g?"Repeatable":"Static","-field"),onClick:J,startIcon:"add",color:"grey",disabled:null!==V,children:"Add a new field"})]}):void 0,children:c}),0!==m.length||V?m.length>0||V?(0,a.jsx)(d.xR,{children:(0,a.jsx)(Z,{tabId:t,isRepeatable:g,fields:m,showHints:N,dataTip:I,title:c,renderFieldAccessor:E,renderHintBase:F,enterEditMode:H,enterSelectMode:J,onDragEnd:j,onDeleteItem:b,dataCy:w,isRepeatableCustomType:T,newField:V&&(0,a.jsx)(x.Z,(0,r.Z)((0,i.Z)({},V),{fields:h||m,onSave:function(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];y.apply(void 0,(0,l.Z)(n)),L(null)},onCancelNewField:G}))})}):void 0:(0,a.jsx)(d.xR,{children:(0,a.jsx)(C,{onEnterSelectMode:function(){return J()},zoneName:g?"Repeatable":"Static"})}),(0,a.jsx)(k,{data:z,close:U,onSave:S,fields:h,zoneType:n}),(0,a.jsx)(p.Z,{data:D,close:W,onSelect:$,widgetsArray:A})]})};k.propTypes={isRepeatable:c.bool,title:c.string.isRequired,dataTip:c.string.isRequired,onSave:c.func.isRequired,onSaveNewField:c.func.isRequired,onDragEnd:c.func.isRequired,onDeleteItem:c.func.isRequired,poolOfFieldsToCheck:(0,c.arrayOf)((0,c.shape)({key:c.string,value:c.object})),renderHintBase:c.func.isRequired,renderFieldAccessor:c.func.isRequired,widgetsArray:c.array.isRequired,fields:(0,c.arrayOf)((0,c.shape)({key:c.string.isRequired,value:(0,c.shape)({config:c.object,fields:c.array,type:c.string.isRequired})}))};var S=k},99968:function(e,n,t){"use strict";t.d(n,{t:function(){return i}});var i=function(e,n,t){if("Link"===t)switch(null==n?void 0:n.select){case"document":return e.ContentRelationship;case"media":return e.LinkToMedia;default:return e.Link}return e[t]}},90569:function(e,n,t){"use strict";t.d(n,{J:function(){return l},u:function(){return o}});var i=t(34671),r=t(75329),o=function(e){var n=e.value,t=e.fields,i=e.initialId;return n?t.find(function(e){return e.key===n})&&n!==i?'Field "'.concat(n,'" already exists.'):void 0:"Field is required"},l={label:(0,i.II)("Label",{required:"This field is required",max:!0},void 0,void 0,"Label for content creators (defaults to field type)"),id:(0,i.II)("API ID*",{min:!0,max:!0,required:"This field is required",matches:[r.xo,"No special characters allowed (except _)"]},o,void 0,"A unique identifier for the field (e.g. buttonLink)"),placeholder:(0,i.II)("Placeholder",{required:"This field is required",max:[100,"String is too long. Max: 100"]},void 0,void 0,"Placeholder text for content creators")}},34671:function(e,n,t){"use strict";t.d(n,{II:function(){return c},Jg:function(){return o}});var i=t(78610),r=t(60113),o=function(e){var n=!(arguments.length>1)||void 0===arguments[1]||arguments[1],t=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return{type:i.h.CHECKBOX,validate:{required:(0,r.MJ)(n,s)},required:n,label:e,defaultValue:t,yupType:"boolean"}},l=[3,"String is too short. Min: 3"],a=[35,"String is too long. Max: 35"],s=["Field is required"],c=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{min:l,max:a,required:s},t=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,c=arguments.length>4?arguments[4]:void 0,u=n||{},d=u.min,f=u.max,p=u.required,x=u.matches;return{type:i.h.INPUT,label:e,validate:{required:(0,r.MJ)(p,s),min:(0,r.MJ)(d,l),max:(0,r.MJ)(f,a),matches:x},defaultValue:o,fieldLevelValidation:t,yupType:"string",placeholder:c}}},60113:function(e,n,t){"use strict";t.d(n,{MJ:function(){return d},f7:function(){return f},gc:function(){return p},lm:function(){return u}});var i=t(67557),r=t(62230),o=t(85244),l=t(17064),a=t(81541),s=t(65413),c=t(78610),u=function(e){return"id"===e?"id":"config.".concat(e)},d=function(e,n){return Array.isArray(e)?e:"boolean"==typeof e&&e?n:null},f=function(e){return Object.entries(e).reduce(function(e,n){var t,a=(0,l.Z)(n,2),s=a[0],u=null===(t=a[1]).defaultValue?void 0:void 0!==t.defaultValue?t.defaultValue:t.type===c.h.CHECKBOX||(t.type===c.h.INPUT?"":t.type===c.h.SELECT?[]:void 0);return void 0!==u?(0,o.Z)((0,r.Z)({},e),(0,i.Z)({},s,u)):e},{})},p=function(e){return s.object().shape(Object.entries(e).filter(function(e){return e}).reduce(function(e,n){var t=(0,l.Z)(n,2),c=t[0],u=t[1],d=u.validate,f=u.yupType;if(!d)return e;if("function"==typeof d)return(0,o.Z)((0,r.Z)({},e),(0,i.Z)({},c,d(c,u)));var p=s[f]();return Object.entries(d).filter(function(e){return e&&e[1]}).forEach(function(e){var n,t=(0,l.Z)(e,2),i=t[0],r=t[1];if(r&&p[i]){p=(n=p)[i].apply(n,(0,a.Z)(Array.isArray(r)?r:[r]));return}console.warn('Invalid Yup validator for field "'.concat(c,'"'))}),(0,o.Z)((0,r.Z)({},e),(0,i.Z)({},c,p))},{})).required().default(void 0).noUnknown(!0)}},78610:function(e,n,t){"use strict";var i,r;t.d(n,{h:function(){return i}}),(r=i||(i={})).CHECKBOX="checkbox",r.INPUT="input",r.SELECT="select"},82910:function(e,n,t){"use strict";t.d(n,{H:function(){return f}});var i=t(65413),r=t(8799),o=t(83462),l=t(60113),a=t(90569),s=t(34671),c={icon:r.XGl,title:"Boolean",description:"An input that is either true or false"},u={label:a.J.label,id:a.J.id,placeholder_false:(0,s.II)("False Placeholder",{required:!1},null,"false","Value the content creator sees (Output as 'false' in the API)."),placeholder_true:(0,s.II)("True Placeholder",{required:!1},null,"true","Value the content creator sees (Output as 'true' in the API)"),default_value:(0,s.Jg)("Default to true")},d=i.object().shape({type:i.string().matches(/^Boolean$/,{excludeEmptyString:!0}).required(),config:(0,l.gc)((0,o.B9)(u,"id"))}),f={TYPE_NAME:"Boolean",create:function(e){return{type:"Boolean",config:{label:e,default_value:!1,placeholder_true:"true",placeholder_false:"false"}}},Meta:c,schema:d,FormFields:u}},12174:function(e,n,t){"use strict";t.d(n,{S:function(){return c}});var i,r=t(65186),o=t(83462),l={icon:r.jqW,title:"Color",description:"A color picker"},a=(0,o.zg)("Color"),s=a.TYPE_NAME,c={create:function(e){return{type:"Color",config:{label:e,placeholder:""}}},FormFields:a.FormFields,TYPE_NAME:s,schema:a.schema,Meta:l}},86495:function(e,n,t){"use strict";t.d(n,{l:function(){return k}});var i=t(62230),r=t(85244),o=t(65413),l=t(17064),a=t(52322),s=t(75289),c=t(90569),u=t(89853),d=t(36131),f=t(3026),p=t(60113),x=t(56580),m=t(31667),h=t(7819),v={label:c.J.label,id:c.J.id,customtypes:{validate:function(){return o.array().of(o.string())}}},g=function(e){var n=e.initialValues,t=e.values,o=e.fields,c=e.setFieldValue,g=(0,x.v9)(m.Ch).filter(h.TG),b=g.map(function(e){return{value:e.local.id,label:e.local.label}}),y=t.config.customtypes?t.config.customtypes.map(function(e){var n=g.find(function(n){return n.local.id===e});return{value:null==n?void 0:n.local.id,label:null==n?void 0:n.local.label}}):null;return(0,a.jsxs)(f.k,{children:[Object.entries(v).filter(function(e){return"customtypes"!==e[0]}).map(function(e){var t=(0,l.Z)(e,2),i=t[0],r=t[1];return(0,a.jsx)(f.J,{children:(0,a.jsx)(u.Z,{fieldName:(0,p.lm)(i),formField:r,fields:o,initialValues:n})},i)}),(0,a.jsx)(f.J,{children:(0,a.jsxs)(s.xu,{sx:{mt:2,alignItems:"center"},children:[(0,a.jsx)(s.__,{htmlFor:"origin",mb:"1",children:"Types"}),(0,a.jsx)(d.ZP,{isMulti:!0,name:"origin",options:b,onChange:function(e){e&&c("config.customtypes",e.map(function(e){return e.value}))},value:y,theme:function(e){return(0,r.Z)((0,i.Z)({},e),{colors:(0,r.Z)((0,i.Z)({},e.colors),{text:"text",primary:"background"})})}})]})})]})},b=t(65186),y=t(348),j={icon:b.I2R,title:"Content Relationship",description:"Define content relations & internal links"},Z=y.I.shape({label:o.string().max(35,"String is too long. Max: 35"),select:o.string().required().matches(/^document$/,{excludeEmptyString:!0}),customtypes:o.array(o.string()).strict().optional()}),C=o.object().shape({type:o.string().matches(/^Link$/,{excludeEmptyString:!0}).required(),config:Z}),k={create:function(e){return{type:"Link",config:{label:e,select:"document"}}},Meta:j,schema:C,TYPE_NAME:"Link",FormFields:v,CUSTOM_NAME:"ContentRelationship",Form:g,prepareInitialValues:function(e){var n=(0,x.v9)(m.Ch).filter(h.TG);return(null==e?void 0:e.customtypes)?(0,r.Z)((0,i.Z)({},e),{customtypes:e.customtypes.filter(function(e){return n.find(function(n){return n.local.id===e})})}):e}}},71516:function(e,n,t){"use strict";t.d(n,{v:function(){return a}});var i,r=t(65186),o=(0,t(83462).zg)("Date"),l=o.FormFields,a={create:function(e){return{type:"Date",config:{label:e,placeholder:""}}},FormFields:l,TYPE_NAME:"Date",schema:o.schema,Meta:{icon:r.f$3,title:"Date",description:"A calendar date picker"}}},79583:function(e,n,t){"use strict";t.d(n,{S:function(){return a}});var i,r=t(34543),o=(0,t(83462).zg)("Embed"),l=o.FormFields,a={create:function(e){return{type:"Embed",config:{label:e,placeholder:""}}},FormFields:l,TYPE_NAME:"Embed",schema:o.schema,Meta:{icon:r.xqv,title:"Embed",description:"Embed videos, songs, tweets, slides, …"}}},37191:function(e,n,t){"use strict";t.d(n,{X:function(){return s}});var i,r=t(65413),o=t(65186),l=t(90569),a={label:l.J.label,id:l.J.id},s={create:function(e){return{type:"GeoPoint",config:{label:e}}},FormFields:a,TYPE_NAME:"GeoPoint",schema:r.object().shape({type:r.string().matches(/^GeoPoint$/,{excludeEmptyString:!0}).required(),config:r.object().shape({label:r.string()}).required().default(void 0).noUnknown(!0)}),Meta:{icon:o.c7Z,title:"GeoPoint",description:"A field for storing geo-coordinates"}}},64118:function(e,n,t){"use strict";t.d(n,{b:function(){return _}});var i=t(65413),r=t(62230),o=t(85244),l=t(17064),a=t(52322),s=t(2784),c=t(90569),u=t(60113),d=t(89853),f=t(63397),p=t(75289),x=t(3026),m=t(98240),h=t(8799),v=t(65186),g=t(39031),b=t(34066),y=function(e){var n=e.onClick,t=e.error,i=e.onDelete,o=e.active,l=e.text,c=e.sx;return(0,a.jsx)(g.Z,{useActive:!0,fitButton:!0,error:t,onClick:n,active:o,sx:(0,r.Z)({position:"relative",width:"64px",height:"64px"},c),Icon:function(){return(0,a.jsxs)(s.Fragment,{children:[(0,a.jsxs)(p.kC,{sx:{flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[(0,a.jsx)(h.jnY,{size:22}),(0,a.jsx)(p.xv,{mt:1,children:l})]}),i?(0,a.jsx)(p.Ct,{onClick:i,variant:"circle-right",children:(0,a.jsx)(v.B4e,{})}):null]})}})},j=function(e){var n=e.onClick;return(0,a.jsx)(g.Z,{fitButton:!0,onClick:n,sx:{width:"64px",height:"64px",border:function(e){var n=e.colors;return"1px solid ".concat(String(null==n?void 0:n.borders))}},Icon:function(){return(0,a.jsx)(p.kC,{sx:{flexDirection:"column",justifyContent:"center",alignItems:"center"},children:(0,a.jsx)(h.iTs,{size:34,color:"#5263BA","aria-label":"Add a thumbnail"})})}})},Z=function(e){var n=e.prefix,t=e.required,i=e.display,r=(0,l.Z)((0,f.U$)(n),2),o=(r[0],r[1]),c=void 0!==t&&t?"*":"";return i?(0,a.jsxs)(s.Fragment,{children:[(0,a.jsx)(C,{name:"".concat(n,".name"),label:"Name".concat(c),placeholder:"main",sx:{mb:3},isConstraint:"config.constraint"===n,meta:o}),(0,a.jsx)(k,{name:"".concat(n,".width"),label:"Width (px)".concat(c),placeholder:" ",sx:{mb:3}}),(0,a.jsx)(k,{name:"".concat(n,".height"),label:"Height (px)".concat(c),placeholder:" "})]}):null},C=function(e){var n=e.name,t=e.label,i=e.placeholder,s=e.meta,c=e.isConstraint,u=(0,m.Z)(e,["name","label","placeholder","meta","isConstraint"]),d=(0,l.Z)((0,f.U$)(n),1)[0];return(0,a.jsx)(b.Hq,(0,o.Z)((0,r.Z)({},u),{fieldName:n,meta:s,formField:{label:t,placeholder:i},field:c?{value:"main",readOnly:!0}:{value:d.value},variant:c?"disabled":"primary"}))},k=function(e){var n=e.name,t=e.label,i=e.placeholder,s=(0,m.Z)(e,["name","label","placeholder"]),c=(0,l.Z)((0,f.U$)(n),2),u=c[0],d=c[1];return(0,a.jsx)(b.Hq,(0,o.Z)((0,r.Z)({},s),{fieldName:n,formField:{label:t,placeholder:i},meta:d,field:{min:0,type:"number",value:u.value||"",onKeyDown:function(e){("e"===e.key||"-"===e.key||"+"===e.key)&&e.preventDefault()}}}))},S=function(){return i.number().nullable().transform(function(e,n){return""===n?null:e})},I={label:c.J.label,id:c.J.id,constraint:{validate:function(){return i.object().defined().shape({width:S(),height:S()})}},thumbnails:{validate:function(){return i.array().defined().of(i.object().test({name:"Thumbnails",message:"Must set name and width or height at minimum",test:function(e){if(!e.name)return!1;var n="number"==typeof e.width&&e.width,t="number"==typeof e.height&&e.height;return e.name&&(n||t)}}))}}},F={name:"",width:"",height:""},E=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.width,t=e.height,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!i||n||t?n||t?"".concat(n||"auto","x").concat(t||"auto"):"...":"auto"},w=function(e){var n=e.initialValues,t=e.values,i=e.errors,c=e.fields,m=e.touched,h=(0,s.useState)(0),v=h[0],g=h[1],b=t.config,C=b.thumbnails,k=b.constraint;return(0,s.useEffect)(function(){g(C.length)},[C.length]),(0,a.jsxs)(x.k,{children:[Object.entries(I).map(function(e){var t=(0,l.Z)(e,2),i=t[0],r=t[1];return(0,a.jsx)(x.J,{children:(0,a.jsx)(d.Z,{fieldName:(0,u.lm)(i),formField:r,fields:c,initialValues:n})},i)}),(0,a.jsxs)(x.J,{children:[(0,a.jsx)(p.__,{htmlFor:"thumbnails",variant:"label.primary",sx:{mt:1,display:"flex",alignItems:"center"},children:"Responsive views*"}),(0,a.jsx)(p.Zb,{p:3,children:(0,a.jsx)(f.F2,{name:"config.thumbnails",render:function(n){var t=n.push,l=n.remove;return(0,a.jsxs)(s.Fragment,{children:[(0,a.jsxs)(p.kC,{mb:3,children:[(0,a.jsx)(y,{active:0===v,text:E(k,!0),sx:{mr:2},onClick:function(){return g(0)}}),C.map(function(e,n){return(0,a.jsx)(y,{sx:{mr:3},active:v===+n+1,text:E(e),error:!!i.thumbnails&&!!m.thumbnails&&!!m.thumbnails[n]&&!!i.thumbnails&&!!i.thumbnails[n],onDelete:function(){return l(n)},onClick:function(){return g(+n+1)}},"thumbnail-button-".concat(+n+1))}),(0,a.jsx)(j,{onClick:function(){t(F)}})]}),(0,a.jsx)(Z,(0,o.Z)((0,r.Z)({},e),{display:0===v,prefix:"config.constraint"})),C.map(function(n,t){return(0,s.createElement)(Z,(0,o.Z)((0,r.Z)({},e),{required:!0,key:"thumbnail-".concat(+t+1),display:v===+t+1,prefix:"config.thumbnails[".concat(t,"]")}))})]})}})})]})]})},T=t(83462),A=i.object().shape({type:i.string().matches(/^Image$/,{excludeEmptyString:!0}).required(),config:(0,u.gc)((0,T.B9)(I,"id"))}),_={Meta:{icon:h.jnY,title:"Image",description:"A responsive image field with constraints"},Form:w,schema:A,create:function(e){return{type:"Image",config:{label:e,constraint:{},thumbnails:[]}}},FormFields:I,TYPE_NAME:"Image"}},348:function(e,n,t){"use strict";t.d(n,{h:function(){return v},I:function(){return h}});var i=t(65413),r=t(62230),o=t(85244),l=t(17064),a=t(52322),s=t(90569),c=t(89853),u=t(34671),d=t(3026),f=t(60113),p=(0,o.Z)((0,r.Z)({},s.J),{allowTargetBlank:(0,u.Jg)("Allow target blank",!1,!1)}),x=function(e){var n=e.initialValues,t=e.fields;return(0,a.jsx)(d.k,{children:Object.entries(p).map(function(e){var i=(0,l.Z)(e,2),r=i[0],o=i[1];return(0,a.jsx)(d.J,{children:(0,a.jsx)(c.Z,{fieldName:(0,f.lm)(r),formField:o,fields:t,initialValues:n})},r)})})},m={icon:t(34543).eR7,title:"Link",description:"A link to web, media or Prismic document"},h=i.object().shape({label:i.string().optional(),useAsTitle:i.boolean().optional(),placeholder:i.string().optional(),select:i.string().optional().oneOf(["media","document","web",null]).nullable(),customtypes:i.array(i.string()).strict().optional(),masks:i.array(i.string()).optional(),tags:i.array(i.string()).optional(),allowTargetBlank:i.boolean().strict().optional()}).required().default(void 0).noUnknown(!0),v={Meta:m,FormFields:p,schema:i.object().shape({type:i.string().matches(/^Link$/,{excludeEmptyString:!0}).required(),config:h.optional()}),Form:x,create:function(e){return{type:"Link",config:{label:e,placeholder:"",select:null}}},TYPE_NAME:"Link"}},33949:function(e,n,t){"use strict";t.d(n,{H:function(){return v}});var i=t(65413),r=t(65186),o=t(348),l=t(62230),a=t(17064),s=t(52322),c=t(90569),u=t(89853),d=t(3026),f=t(60113),p=(0,l.Z)({},c.J),x=function(e){var n=e.initialValues,t=e.fields;return(0,s.jsx)(d.k,{children:Object.entries(p).map(function(e){var i=(0,a.Z)(e,2),r=i[0],o=i[1];return(0,s.jsx)(d.J,{children:(0,s.jsx)(u.Z,{fieldName:(0,f.lm)(r),formField:o,fields:t,initialValues:n})},r)})})},m={icon:r.x2k,title:"Link to media",description:"A link to files, document and media"},h=o.I.shape({select:i.string().required().matches(/^media$/,{excludeEmptyString:!0})}),v={Meta:m,FormFields:p,schema:i.object().shape({type:i.string().matches(/^Link$/,{excludeEmptyString:!0}).required(),config:h.optional()}),Form:x,create:function(e){return{type:"Link",config:{label:e,placeholder:"",select:"media"}}},TYPE_NAME:"Link",CUSTOM_NAME:"LinkToMedia"}},51490:function(e,n,t){"use strict";t.d(n,{L:function(){return a}});var i,r=t(951),o=(0,t(83462).zg)("Number"),l=o.FormFields,a={create:function(e){return{type:"Number",config:{label:e,placeholder:""}}},FormFields:l,TYPE_NAME:"Number",schema:o.schema,Meta:{icon:r.JUs,title:"Number",description:"A number input field"}}},74269:function(e,n,t){"use strict";t.d(n,{u:function(){return b}});var i=t(65413),r=t(65186),o=t(60113),l=t(83462),a=t(62230),s=t(85244),c=t(52322),u=t(63397),d=t(34066),f=t(78610),p=t(90569),x=function(e){return"use first value as default ".concat(e?'("'.concat(e,'")'):"")},m=function(e,n){return n?e:void 0},h=(0,s.Z)((0,a.Z)({},p.J),{default_value:{type:f.h.CHECKBOX,yupType:"string",defaultValue:null,validate:function(){return i.string().test({name:"default_value",message:'Default value is not part of field "options" in Select',test:function(e){return void 0===e||this.parent&&this.parent.options&&this.parent.options.find(function(n){return n===e})}})},component:function(e){var n,t=null===(n=(0,u.u6)().values.config)||void 0===n?void 0:n.options[0];return(0,c.jsx)(d.w8,(0,s.Z)((0,a.Z)({},e),{defaultValue:e.field.value,controlledValue:t,setControlledValue:e.helpers.setValue,buildControlledValue:m,label:x}))}},options:{yupType:"array",defaultValue:["1","2"],validate:{required:["Select requires a minimum of 2 options"],min:[2,"Choose at least 2 options"],test:{name:"non-empty values",message:"Values cannot be empty",test:function(e){return!e.some(function(e){return!e||!e.length})}}},component:function(e){return(0,c.jsx)(d.kp,(0,a.Z)({label:"Options",inputPlaceholder:"Select option output in API (e.g. 'blueTheme')",buttonLabel:"Add option"},e))}}}),v={icon:r.dzP,title:"Select",description:"A dropdown field of options for content creators."},g=i.object().shape({type:i.string().matches(/^Select$/,{excludeEmptyString:!0}).required(),config:(0,o.gc)((0,l.B9)(h,"id"))}),b={FormFields:h,create:function(e){return{type:"Select",config:{label:e,placeholder:"",options:["1","2"]}}},schema:g,Meta:v,TYPE_NAME:"Select"}},810:function(e,n,t){"use strict";t.d(n,{P:function(){return M}});var i=t(62230),r=t(65413),o=t(85244),l=t(17064),a=t(81541),s=t(52322),c=t(2784),u=t(60113),d=t(34671),f=t(90569),p=t(34543),x=t(8799),m=function(e){return function(n){var t=n.size;return(0,s.jsx)("span",{style:{fontSize:t},children:e})}},h=[{value:"paragraph",label:"P",icon:m("p")},{value:"preformatted",label:"PRE",icon:m("pre")},{value:"heading1",label:"H1",icon:m("h1")},{value:"heading2",label:"H2",icon:m("h2")},{value:"heading3",label:"H3",icon:m("h3")},{value:"heading4",label:"H4",icon:m("h4")},{value:"heading5",label:"H5",icon:m("h5")},{value:"heading6",label:"H6",icon:m("h6")},{value:"strong",label:"Strong",icon:m((0,s.jsx)("b",{children:"b"}))},{value:"em",label:"em",icon:m((0,s.jsx)("em",{style:{fontFamily:"serif"},children:"I"}))},{value:"hyperlink",label:"hyperlink",icon:m((0,s.jsx)(p.eR7,{}))},{value:"image",label:"image",icon:m((0,s.jsx)(p.LFN,{}))},{value:"embed",label:"embed",icon:m((0,s.jsx)(p.xqv,{}))},{value:"list-item",label:"list",icon:m((0,s.jsx)(p.SnF,{}))},{value:"o-list-item",label:"o",icon:m((0,s.jsx)(x.KyO,{}))},{value:"rtl",label:"rtl",icon:m("rtl")},],v=h.map(function(e){return e.value}),g=t(89853),b=t(75289),y=t(3026),j=t(39031),Z=t(47927),C=t(76635),k=function(e){return!v.find(function(n){return!e.includes(n)})},S=function(e){var n=e.split(",");return h.reduce(function(e,t){var i=t.value;return n.includes(i)?(0,a.Z)(e).concat([i]):e},[])};function I(e,n){return(0,Z.has)("parent",e)&&(0,C.isObject)(e.parent)&&(0,Z.has)(n,e.parent)&&(0,C.isString)(e.parent[n])?e.parent[n]:null}function F(e){return function(){return r.string().test({name:e,message:"Options cannot be empty",test:function(n,t){var i=I(t,e),r=I(t,"single"===e?"multi":"single");return!!r&&"string"==typeof r||"string"==typeof i&&(!!i&&!!i.length||!!r&&!!r.length)&&!i.split(",").find(function(e){return!v.includes(e)})}})}}var E=(0,o.Z)((0,i.Z)({},f.J),{allowTargetBlank:(0,d.Jg)("Allow target blank for links"),single:{validate:F("single")},multi:{validate:F("multi")}}),w=["config.single","config.multi"],T=function(e){var n,t=e.initialValues,i=e.values,r=e.errors,o=e.fields,d=e.setFieldValue,f=i.config,p=f.single,x=f.multi,m=p?S(p):x&&S(x)||v,Z=(0,c.useState)(!p),C=Z[0],I=Z[1],F=(0,c.useState)(m),T=F[0],A=F[1];return(0,c.useEffect)(function(){var e=C?1:0;d(w[e],T.join(",")),setTimeout(function(){d(w[1-e],void 0)},100)},[C,T]),(0,s.jsxs)(y.k,{children:[Object.entries(E).map(function(e){var n=(0,l.Z)(e,2),i=n[0],r=n[1];return(0,s.jsx)(y.J,{children:(0,s.jsx)(g.Z,{fieldName:(0,u.lm)(i),formField:r,fields:o,initialValues:t})},i)}),(0,s.jsxs)(y.J,{children:[(0,s.jsxs)(b.__,{htmlFor:"accept",variant:"label.primary",sx:{mt:1,display:"flex",alignItems:"center"},children:["Accept*",(0,s.jsx)(b.zx,{type:"button",variant:"buttons.textButton",onClick:function(){if(k(T))return A([]);A(v)},children:k(T)?"Unselect All":"Select all"})]}),h.map(function(e){return(0,s.jsx)(j.Z,{fitButton:!0,useActive:!0,label:e.label,size:14,Icon:e.icon,sx:{p:"16px",mb:2,mr:2,variant:"buttons.selectIcon"},active:T.includes(e.value),onClick:function(){if(T.find(function(n){return n===e.value}))return A(T.filter(function(n){return n!==e.value}));A((0,a.Z)(T).concat([e.value]))}},e.value)}),(null===(n=r.config)||void 0===n?void 0:n[C?"multi":"single"])?(0,s.jsx)(b.xu,{sx:{position:"absolute"},children:(0,s.jsx)(b.xv,{as:"span",variant:"text.labelError",pl:0,children:r.config[C?"multi":"single"]})}):null]}),(0,s.jsx)(y.J,{children:(0,s.jsx)(b.kC,{sx:{mt:2,alignItems:"center",height:"100%"},children:(0,s.jsxs)(b.__,{variant:"label.border",children:[(0,s.jsx)(b.XZ,{checked:C,onChange:function(){return I(!C)}}),"Allow multiple paragraphs"]})})})]})},A=t(65186),_=t(83462),N={icon:A.BAW,title:"Rich Text",description:"A rich text field with formatting options"},R=r.object().shape({type:r.string().matches(/^StructuredText$/,{excludeEmptyString:!0}).required(),config:(0,u.gc)((0,_.B9)((0,i.Z)({},E,{labels:{yupType:"array",validate:{}}}),"id"))}),M={create:function(e){return{type:"StructuredText",config:{label:e,placeholder:"",allowTargetBlank:!0,multi:v.join(",")}}},FormFields:E,Meta:N,schema:R,TYPE_NAME:"StructuredText",Form:T}},89928:function(e,n,t){"use strict";t.d(n,{y:function(){return u}});var i=t(65413),r=t(65186),o=t(83462),l=t(90569),a=t(60113),s=l.J,c=i.object().shape({type:i.string().matches(/^Text$/,{excludeEmptyString:!0}).required(),config:(0,a.gc)((0,o.B9)(s,"id"))}),u={create:function(e){return{type:"Text",config:{label:e,placeholder:""}}},Meta:{icon:r.SQS,title:"Key Text",description:"A simple text string field"},schema:c,TYPE_NAME:"Text",FormFields:s}},64797:function(e,n,t){"use strict";t.d(n,{d:function(){return u}});var i,r=t(65413),o=t(65186),l=t(83462),a=t(90569),s=t(60113),c=a.J,u={create:function(e){return{type:"Timestamp",config:{label:e,placeholder:""}}},schema:r.object().shape({type:r.string().matches(/^Timestamp$/,{excludeEmptyString:!0}).required(),config:(0,s.gc)((0,l.B9)(c,"id"))}),FormFields:c,TYPE_NAME:"Timestamp",Meta:{icon:o.f$3,title:"Timestamp",description:"A calendar date picker with time"}}},2353:function(e,n,t){"use strict";t.r(n),t.d(n,{Boolean:function(){return i.H},Color:function(){return r.S},ContentRelationship:function(){return o.l},Date:function(){return l.v},Embed:function(){return a.S},GeoPoint:function(){return s.X},Image:function(){return c.b},Link:function(){return u.h},LinkToMedia:function(){return d.H},Number:function(){return f.L},Select:function(){return p.u},StructuredText:function(){return x.P},Text:function(){return m.y},Timestamp:function(){return h.d},UID:function(){return I}});var i=t(82910),r=t(12174),o=t(86495),l=t(71516),a=t(79583),s=t(37191),c=t(64118),u=t(348),d=t(33949),f=t(51490),p=t(74269),x=t(810),m=t(89928),h=t(64797),v=t(62230),g=t(85244),b=t(65413),y=t(65186),j=t(83462),Z=t(90569),C=t(60113),k={label:Z.J.label,id:(0,g.Z)((0,v.Z)({},Z.J.id),{validate:{required:"This field is required",matches:[/^uid$/,"Api ID must be 'uid' for this field."]},disabled:!0}),placeholder:Z.J.placeholder},S=b.object().shape({type:b.string().matches(/^UID$/,{excludeEmptyString:!0}).required(),config:(0,C.gc)((0,j.B9)(k,"id"))}),I={create:function(e){return{type:"UID",config:{label:e,placeholder:""}}},Meta:{icon:y.izl,title:"UID",description:"Unique Identifier"},schema:S,TYPE_NAME:"UID",FormFields:k}},44384:function(e,n,t){"use strict";var i=t(82910),r=t(12174),o=t(86495),l=t(71516),a=t(79583),s=t(37191),c=t(64118),u=t(348),d=t(33949),f=t(51490),p=t(74269),x=t(810),m=t(89928),h=t(64797);n.Z=[x.P,c.b,u.h,d.H,o.l,p.u,i.H,l.v,h.d,a.S,f.L,s.X,r.S,m.y,]},83239:function(e,n,t){"use strict";t.r(n),t.d(n,{Boolean:function(){return r.Boolean},Color:function(){return r.Color},ContentRelationship:function(){return r.ContentRelationship},Date:function(){return r.Date},Embed:function(){return r.Embed},GeoPoint:function(){return r.GeoPoint},Group:function(){return B},Image:function(){return r.Image},Link:function(){return r.Link},LinkToMedia:function(){return r.LinkToMedia},Number:function(){return r.Number},Select:function(){return r.Select},SharedSlice:function(){return q},SliceZone:function(){return D},StructuredText:function(){return r.StructuredText},Text:function(){return r.Text},Timestamp:function(){return r.Timestamp},UID:function(){return r.UID}});var i,r=t(2353),o=t(65413),l=t(65186),a=t(62230),s=t(85244),c=t(98240),u=t(81541),d=t(52322),f=t(2784),p=t(28316),x=t(40023),m=t(75289),h=t(83462),v=t(38876),g=t(75012),b=t(9620),y=t(4092),j=t(99968),Z=t(44384),C=t(70697),k=t(28728),S=t(81787),I=t(14137),F=t(91061),E=function(e){var n=e.tabId,t=e.widget,i=(e.parentSnapshot,e.showHints),o=e.isRepeatable,l=e.item,E=e.draggableId,w=(e.renderFieldAccessor,(0,c.Z)(e,["tabId","widget","parentSnapshot","showHints","isRepeatable","item","draggableId","renderFieldAccessor"])),T=(0,f.useState)(!1),A=T[0],_=T[1],N=(0,f.useState)(null),R=N[0],M=N[1],z=(0,f.useState)({isOpen:!1}),B=z[0],q=z[1],D=(0,S.G)(),O=D.customType,P=D.setCustomType,V=function(e){M({widgetTypeName:e}),_(!1)},L=function(){M(null)},H=function(){q({isOpen:!1})},J=function(e){var t=e.id,i=e.label,o=r[e.widgetTypeName].create(i),a=I.L$.fromSM(o),s=(0,F.kQ)({customType:O,sectionId:n,groupFieldId:l.key,newField:a,newFieldId:t});P(s)},U=function(e){var t=e.apiId,i=e.newKey,o=e.value;if(!(0,h.Ss)(r,o.type)){var a=I.L$.fromSM(o),s=(0,F.l9)({customType:O,sectionId:n,groupFieldId:l.key,previousFieldId:t,newFieldId:i,newField:a});P(s)}},W=function(e){if(!(0,h.uS)(e)){var t=e.source,i=e.destination;if(i){var r=t.index,o=i.index,a=(0,F.GA)({customType:O,sectionId:n,groupFieldId:l.key,sourceIndex:r,destinationIndex:o});(0,p.flushSync)(function(){return P(a)})}}},$=function(e){var t=(0,F.j6)({customType:O,sectionId:n,groupFieldId:l.key,fieldId:e});P(t)},G=function(e){q({isOpen:!0,field:e})};return(0,d.jsxs)(f.Fragment,{children:[(0,d.jsx)(k.Z,(0,s.Z)((0,a.Z)({item:l,widget:t,draggableId:E,renderFieldAccessor:function(e){return"data.".concat(l.key,".[...]")}},w),{CustomEditElements:[(0,d.jsx)(m.zx,{mr:2,variant:"buttons.darkSmall",onClick:function(){return _(!0)},children:"Add Field"},"custom-edit-element-".concat(l.key)),],children:(0,d.jsx)(m.xu,{sx:{ml:4},children:(0,d.jsx)(x.Z5,{onDragEnd:W,children:(0,d.jsx)(x.bK,{droppableId:"".concat(n,"-").concat(l.key,"-zone"),children:function(e){return(0,d.jsxs)("ul",(0,s.Z)((0,a.Z)({ref:e.innerRef},e.droppableProps),{children:[l.value.config.fields.map(function(e,n){var t=e.value,c=t.config,u=t.type,f=(0,j.t)(r,c,u);if(!f)return null;var p={item:e,index:n,widget:f,key:e.key,enterEditMode:G,deleteItem:$,renderFieldAccessor:function(e){return"data.".concat(l.key,".").concat(e)},draggableId:"group-".concat(l.key,"-").concat(e.key,"-").concat(n),dataCy:"list-item-group-".concat(l.key,"-").concat(e.key)},x=(0,d.jsx)(C.Z,{item:e,show:i,isRepeatable:o,renderHintBase:function(e){var n=e.item;return"data.".concat(l.key).concat((0,v.Ti)(n.key))},Widgets:r,typeName:f.CUSTOM_NAME||f.TYPE_NAME});return(0,d.jsx)(k.Z,(0,s.Z)((0,a.Z)({},p),{HintElement:x}))}),e.placeholder,R&&(0,d.jsx)(b.Z,(0,s.Z)((0,a.Z)({},R),{fields:l.value.config.fields||[],onSave:function(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];J.apply(void 0,(0,u.Z)(n)),M(null)},onCancelNewField:L}))]}))}})})})})),(0,d.jsx)(g.Z,{data:{isOpen:A},close:function(){return _(!1)},onSelect:V,widgetsArray:Z.Z}),(0,d.jsx)(y.Z,{data:B,close:H,onSave:U,fields:l.value.config.fields})]})},w=t(17064),T=t(3026),A=t(90569),_=t(89853),N=t(34671),R=t(60113),M=(0,s.Z)((0,a.Z)({},A.J),{repeat:(0,N.Jg)("Repeatable",!1,!0)}),z=function(e){var n=e.initialValues,t=e.fields,i=e.values,r=e.setFieldValue,o=i.config.repeat;return(0,d.jsxs)(T.k,{children:[Object.entries(M).filter(function(e){return"repeat"!==(0,w.Z)(e,1)[0]}).map(function(e){var i=(0,w.Z)(e,2),r=i[0],o=i[1];return(0,d.jsx)(T.J,{children:(0,d.jsx)(_.Z,{fieldName:(0,R.lm)(r),formField:o,fields:t,initialValues:n})},r)}),(0,d.jsx)(T.J,{children:(0,d.jsx)(m.xu,{sx:{mt:2,alignItems:"center",display:"flex",height:"130%"},children:(0,d.jsxs)(m.__,{variant:"label.border",sx:{mb:0},children:[(0,d.jsx)(m.XZ,{checked:o,onChange:function(){return r("config.repeat",!o)}}),"Repeatable"]})})})]})},B={Meta:{icon:l.cC1,title:"Group",description:"A Group of Prismic fields"},Form:z,FormFields:M,schema:o.object().shape({type:o.string().matches(/^Group$/,{excludeEmptyString:!0}).required(),config:o.object().shape({fields:o.array(),label:o.string(),placeholder:o.string(),repeat:o.boolean().optional()})}),create:function(e){return{type:"Group",config:{label:e,repeat:!0,fields:[]}}},CustomListItem:E,TYPE_NAME:"Group"},q=null,D=null},83462:function(e,n,t){"use strict";t.d(n,{B9:function(){return s},Ss:function(){return u},uS:function(){return c},zg:function(){return d}});var i=t(98240),r=t(9849),o=t(65413),l=t(90569),a=t(60113),s=function(e,n){return e[n],(0,i.Z)(e,[n].map(r.Z))},c=function(e){return!e.destination||e.source.index===e.destination.index||e.source.droppableId!==e.destination.droppableId},u=function(e,n){return!e[n]&&(console.log('Could not find widget with type name "'.concat(n,'".')),!0)},d=function(e){return{TYPE_NAME:e,FormFields:l.J,schema:o.object().shape({type:o.string().test({name:"type",test:function(n){return n===e}}),config:(0,a.gc)(s(l.J,"id"))}),create:function(){return{type:e,config:(0,a.f7)(s(l.J,"id"))}}}}},28173:function(e,n,t){"use strict";t.d(n,{aV:function(){return s},Bu:function(){return c}});var i=t(62230),r=t(85244),o=t(98240),l=t(52322),a=t(22715);t(82432),t(84779);var s=function(e){return(0,l.jsx)("div",(0,r.Z)((0,i.Z)({},e),{className:"_2a96i71 _1ecs97dez0 _1ecs97dez2 _1ecs97d3fg _1ecs97d3mt _1ecs97df0r _1ecs97df23 _1ecs97df2h _1ecs97dezb _1ecs97dezr"}))},c=function(e){var n=e.actions,t=e.children,s=e.toggle,c=(0,o.Z)(e,["actions","children","toggle"]);return(0,l.jsxs)("div",(0,r.Z)((0,i.Z)({},c),{className:"_2a96i73 _2a96i72 _1ecs97dez0 _1ecs97dez2 _1ecs97dezc _1ecs97dez8 _1ecs97d6r8 _1ecs97d6yl _1ecs97df2l _1ecs97dez1 _1ecs97df71 _1ecs97dfie _1ecs97d18 _1ecs97d8l _1ecs97df29 _1ecs97df92 _1ecs97dfi1",children:[(0,l.jsx)(a.xv,{color:"grey11",component:"span",noWrap:!0,variant:"bold",children:t}),s,Boolean(n)?(0,l.jsx)("div",{className:"_1ecs97dez0 _1ecs97dez2 _1ecs97dezc _1ecs97dez8 _1ecs97dezd _1ecs97df92 _1ecs97dezj _1ecs97df51",children:n}):null]}))}},47976:function(e,n,t){"use strict";t.d(n,{X:function(){return o}});var i=t(52322),r=t(22715),o=function(e){var n,t=e.status;switch(t){case"pending":n={icon:(0,i.jsx)(r._3,{color:"grey11"}),text:"Saving..."};break;case"failed":n={icon:(0,i.jsx)(r.I5,{name:"close",color:"tomato11",size:"medium"}),text:"Failed to save"};break;case"done":n={icon:(0,i.jsx)(r.I5,{name:"check",color:"green11",size:"medium"}),text:"Auto-saved"}}return(0,i.jsxs)(r.xu,{gap:8,alignItems:"center",children:[n.icon,(0,i.jsx)(r.xv,{color:"grey11",children:n.text})]})}},81787:function(e,n,t){"use strict";t.d(n,{G:function(){return h},k:function(){return m}});var i=t(22710),r=t(99267),o=t(52322),l=t(2784),a=t(74217),s=t(90374),c=t(50950),u=t(91061),d=t(82770),f=t(26921),p=t(78656),x=(0,l.createContext)(void 0);function m(e){var n=e.children,t=e.initialCustomType,m=(0,l.useState)(t),h=m[0],v=m[1],g=(0,u.y6)(h),b=p.$[g],y=(0,f.c)({errorMessage:b.autoSaveFailed}),j=y.actionQueueStatus,Z=y.setNextAction,C=(0,s.Z)().saveCustomTypeSuccess,k=(0,a.R9)(C),S=(0,c.g)().syncChanges,I=(0,l.useCallback)(function(e){v(e),Z((0,i.Z)(function(){var n;return(0,r.__generator)(this,function(t){switch(t.label){case 0:return[4,(0,d.KA)(e)];case 1:if((n=t.sent().errors).length>0)throw n;return k(e),S(),[2]}})}))},[Z,k,S]),F=(0,l.useMemo)(function(){return{actionQueueStatus:j,customType:h,setCustomType:I}},[j,h,I]);return(0,o.jsx)(x.Provider,{value:F,children:"function"==typeof n?n(F):n})}function h(){var e=(0,l.useContext)(x);if(!e)throw Error("CustomTypeProvider not found");return e}},84779:function(){},82432:function(){}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[727],{54132:function(e,n,r){"use strict";r.d(n,{Z:function(){return o}});var t=r(62230),s=r(85244),a=r(98240),c=r(52322);r(2784);var i=r(75289),l=function(e){var n=e.bg,r=e.background,s=e.sx,a=e.withRadius,l=e.radius,o=e.children;return(0,c.jsx)(i.xu,{sx:(0,t.Z)({p:4,bg:n||r},a?{borderBottomLeftRadius:l,borderBottomRightRadius:l}:null,s),children:o})},o=function(e){var n=e.Header,r=void 0===n?null:n,o=e.SubHeader,d=void 0===o?null:o,u=e.Body,h=void 0===u?null:u,f=e.Footer,x=void 0===f?null:f,p=e.borderFooter,m=e.radius,C=void 0===m?"6px":m,j=e.bodySx,g=e.footerSx,v=e.sx,b=e.bg,y=e.background,_=e.children,S=(0,a.Z)(e,["Header","SubHeader","Body","Footer","borderFooter","radius","bodySx","footerSx","sx","bg","background","children"]);return(0,c.jsxs)(i.Zb,(0,s.Z)((0,t.Z)({sx:(0,t.Z)({border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))},borderRadius:C},void 0===v?null:v)},S),{children:[r?(0,c.jsx)(r,{radius:C}):null,d?(0,c.jsx)(d,{radius:C}):null,(0,c.jsxs)(l,{bg:b,background:y,sx:void 0===j?{}:j,withRadius:!x,children:[h?(0,c.jsx)(h,{}):null,_||null]}),x?(0,c.jsx)(l,{bg:b,background:y,sx:(0,t.Z)({},void 0!==p&&p?{borderTop:function(e){var n=e.colors;return"1px solid ".concat(String(null==n?void 0:n.borders))}}:null,void 0===g?{}:g),radius:C,withRadius:!0,children:"object"==typeof x?x:(0,c.jsx)(x,{})}):null]}))}},58882:function(e,n,r){"use strict";r.d(n,{M:function(){return H}});var t=r(22710),s=r(62230),a=r(85244),c=r(99267),i=r(52322),l=r(2784),o=r(75289),d=r(56580),u=r(5632),h=r(68780),f=r(90374),x=r(31667),p=r(38876),m=r(75329),C=r(78656),j=r(88932),g=r(13858),v=r(82770),b=r(91061);function y(){return(y=(0,t.Z)(function(e){var n,r,t,s,a,i,l,o,d,u;return(0,c.__generator)(this,function(c){switch(c.label){case 0:n=e.id,r=e.label,t=e.repeatable,s=e.format,a=e.onSuccess,i=C.$[s],l=(0,b.Ue)({id:n,label:r,repeatable:t,format:s}),c.label=1;case 1:return c.trys.push([1,4,,5]),[4,(0,v.KA)(l)];case 2:if((o=c.sent().errors).length>0)throw o;return v.Xe.track({event:"custom-type:created",id:l.id,name:r,format:s,type:t?"repeatable":"single",origin:"table"}),[4,a(l)];case 3:return c.sent(),j.Am.success((0,g.GX)({message:"".concat(i.name({start:!0,plural:!1})," saved successfully at "),path:"./customtypes/".concat(l.id,"/index.json")})),[3,5];case 4:return d=c.sent(),u="Internal Error: ".concat(i.name({start:!0,plural:!1})," not saved"),console.error(u,d),j.Am.error(u),[3,5];case 5:return[2]}})})).apply(this,arguments)}var _=r(67445),S=r(50950),w=r(70041),L=r(17064),Z=r(63397),k=r(98240),T=function(e){var n=e.selected,r=(0,k.Z)(e,["selected"]);return(0,i.jsx)(o.kC,(0,s.Z)({sx:{p:"24px",mb:3,alignItems:"top",cursor:"pointer",borderRadius:"6px",backgroundColor:"grayLight",boxShadow:n?function(e){var n;return"0 0 0 2px ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.primary))}:"none","&:hover":{boxShadow:function(e){var n;return"0 0 0 2px ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.primary))}}}},r))},z=function(e){var n=e.format,r=(0,L.Z)((0,Z.U$)("repeatable"),3),t=r[0],s=r[2],a=C.$[n];return(0,i.jsxs)(o.xu,{mb:2,children:[(0,i.jsxs)(T,{selected:t.value,onClick:function(){return s.setValue(!0)},children:[(0,i.jsx)(o.Y8,{checked:t.value,onChange:function(){},"data-cy":"repeatable-type-radio-btn"}),(0,i.jsxs)(o.xu,{sx:{marginLeft:2},children:["Reusable type",(0,i.jsx)(o.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintRepeatable})]})]}),(0,i.jsxs)(T,{selected:!t.value,onClick:function(){return s.setValue(!1)},children:[(0,i.jsx)(o.Y8,{checked:!t.value,onChange:function(){},"data-cy":"single-type-radio-btn"}),(0,i.jsxs)(o.xu,{sx:{marginLeft:2},children:["Single type",(0,i.jsx)(o.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintSingle})]})]})]})},H=function(e){var n,r=e.format,j=e.isCreating,g=e.isOpen,v=e.origin,L=void 0===v?"table":v,Z=e.onCreateChange,k=e.onOpenChange,T=(0,f.Z)().createCustomTypeSuccess,H=(0,d.v9)(function(e){return{customTypeIds:(0,x.W6)(e),customTypeLabels:(0,x.YS)(e)}}),R=H.customTypeIds,I=H.customTypeLabels,N=C.$[r],V=(0,l.useState)(!0),M=V[0],E=V[1],F=(0,S.g)().syncChanges,P=(0,u.useRouter)(),A=(n=(0,t.Z)(function(e){var n,s,a;return(0,c.__generator)(this,function(i){switch(i.label){case 0:var l;return n=e.id,s=e.label,a=e.repeatable,Z(!0),[4,function(e){return y.apply(this,arguments)}({format:r,id:n,label:s,origin:L,repeatable:a,onSuccess:(l=(0,t.Z)(function(e){var r,t;return(0,c.__generator)(this,function(s){switch(s.label){case 0:return T(e),r=(0,b.y6)(e),t=_.cd[r],E(!0),[4,P.push({pathname:t.getBuilderPagePathname(n),query:"page"===e.format?{newPageType:!0}:void 0})];case 1:return s.sent(),F(),[2]}})}),function(e){return l.apply(this,arguments)})})];case 1:return i.sent(),Z(!1),k(!1),[2]}})}),function(e){return n.apply(this,arguments)}),D=function(e,n,r){r(M?(0,a.Z)((0,s.Z)({},n),{label:e.target.value,id:(0,p.lV)(e.target.value)}):(0,a.Z)((0,s.Z)({},n),{label:e.target.value}))},O=function(e,n){n("id",e.target.value),E(!1)};return(0,i.jsx)(h.Z,{dataCy:"create-ct-modal",isOpen:g,widthInPx:"530px",formId:"create-custom-type",buttonLabel:"Create",close:function(){k(!1),E(!0)},onSubmit:function(e){A(e)},isLoading:j,initialValues:{repeatable:!0,id:"",label:""},validate:function(e){var n=e.id,r=e.label,t={};return r&&r.length||(t.label="Cannot be empty."),!t.label&&I.includes(r)&&(t.label="".concat(N.name({start:!0,plural:!1})," name is already taken.")),n&&n.length||(t.id="ID cannot be empty."),t.id||!n||m.xo.exec(n)||(t.id="Invalid id: No special characters allowed."),!t.id&&n&&R.map(function(e){return e.toLowerCase()}).includes(n)&&(t.id='ID "'.concat(n,'" exists already.')),Object.keys(t).length>0?t:void 0},content:{title:"Create a new ".concat(N.name({start:!1,plural:!1}))},children:function(e){var n=e.errors,t=e.setValues,s=e.setFieldValue,a=e.values,c=e.touched;return(0,i.jsxs)(o.xu,{children:[(0,i.jsx)(z,{format:r}),(0,i.jsx)(w.W,{name:"label",label:"".concat(N.name({start:!0,plural:!1})," Name"),dataCy:"ct-name-input",placeholder:"A display name for the ".concat(N.name({start:!1,plural:!1})),error:c.label?n.label:void 0,onChange:function(e){return D(e,a,t)}}),(0,i.jsx)(w.W,{name:"id",dataCy:"ct-id-input",label:"".concat(N.name({start:!0,plural:!1})," ID"),placeholder:N.inputPlaceholder,error:c.id?n.id:void 0,onChange:function(e){return O(e,s)}})]})}})}},75329:function(e,n,r){"use strict";r.d(n,{Sn:function(){return i},lS:function(){return t},nG:function(){return s},pq:function(){return l},rd:function(){return c},xo:function(){return a}});var t=["components"],s=["png","jpg","jpeg"],a=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,c="placeholders/What_are_Slices_mrvome",i="SM_HELP_VIDEOS/mock_data",l="slice-machine-simulator"},840:function(e,n,r){"use strict";r.d(n,{F:function(){return P}});var t=r(52322),s=r(2784),a=r(22715),c=r(97729),i=r.n(c),l=r(42050),o=r(58882),d=r(78656),u=r(8564),h=r(5632),f=r(67557),x=r(50002),p=r(6277);r(64117);var m=function(e){var n=e.children;return(0,t.jsx)("div",{className:"_1ecs97dez0 _1ecs97dez5 _1ecs97d3fg _1ecs97d3mt _1ecs97df0r _1ecs97df23 _1ecs97df2h _1ecs97dezr",children:(0,t.jsx)("table",{className:"gdfsm51 _1ecs97dez0 _1ecs97dez5 _1ecs97df3p _1ecs97df4v",children:n})})},C=(0,s.createContext)("body");function j(){return(0,s.useContext)(C)}var g=function(e){var n=e.children;return(0,t.jsx)(C.Provider,{value:"head",children:(0,t.jsx)("thead",{className:"gdfsm52 _1ecs97dez0 _1ecs97dez5 _1ecs97d18 _1ecs97d8l",children:n})})},v=function(e){var n=e.children;return(0,t.jsx)(C.Provider,{value:"body",children:(0,t.jsx)("tbody",{className:"gdfsm53 _1ecs97dez0 _1ecs97dez5",children:n})})},b=function(e){var n,r=e.children,s=e.onClick,a=j();return(0,t.jsx)("tr",{className:(0,p.W)("_1ecs97dez0 _1ecs97dez5 _1ecs97df71",(n={},(0,f.Z)(n,"_1ecs97df41",!!s),(0,f.Z)(n,"_1ecs97dm _1ecs97d7z _1ecs97d3c _1ecs97dap _1ecs97d2w _1ecs97da9 _1ecs97df74 _1ecs97dfj8 _1ecs97df0d _1ecs97dfjb","body"===a),n)),onClick:function(e){var n,r=e.target;if(s&&e.currentTarget.contains(r)){var t=(0,x.JY)(r);(null===(n=null==t?void 0:t.contains(e.currentTarget))||void 0===n||n)&&s(e)}},children:r})},y=function(e){var n=e.children,r=j();return(0,t.jsx)("head"===r?"th":"td",{className:"gdfsm55 _1ecs97dez0 _1ecs97dez5 _1ecs97d3fg _1ecs97d3mt _1ecs97df2h _1ecs97dez1 _1ecs97da62 _1ecs97dadf _1ecs97df45 _1ecs97dfhi",children:(0,t.jsx)("div",{className:"gdfsm56 _1ecs97dez0 _1ecs97dez2",children:n})})},_=function(){return(0,t.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M8 28H24C25.1046 28 26 27.1046 26 26V9L21 4H8C6.89543 4 6 4.89543 6 6V26C6 27.1046 6.89543 28 8 28Z",fill:"#6E56CF"}),(0,t.jsx)("path",{d:"M23 9H26L21 4V7C21 8.10457 21.8954 9 23 9Z",fill:"#9E8CFC"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.0912 12C13.2794 12 11 14.2794 11 17.0912C11 19.903 13.2794 22.1824 16.0912 22.1824C17.9763 22.1824 19.6215 21.1577 20.501 19.6372C20.6563 19.3688 20.7878 19.0849 20.8926 18.7883C20.9846 18.5279 20.8482 18.2422 20.5878 18.1502C20.3275 18.0582 20.0418 18.1947 19.9498 18.455C19.8657 18.693 19.7601 18.9209 19.6354 19.1365C18.9273 20.3606 17.6049 21.1824 16.0912 21.1824C13.8317 21.1824 12 19.3507 12 17.0912C12 14.8317 13.8317 13 16.0912 13C17.4478 13 18.6507 13.66 19.3955 14.6782H17.6216C17.3455 14.6782 17.1216 14.9021 17.1216 15.1782C17.1216 15.4544 17.3455 15.6782 17.6216 15.6782H20.2998C20.576 15.6782 20.7998 15.4544 20.7998 15.1782V12.5C20.7998 12.2239 20.576 12 20.2998 12C20.0237 12 19.7998 12.2239 19.7998 12.5V13.6032C18.8717 12.6167 17.5536 12 16.0912 12Z",fill:"white"})]})},S=function(){return(0,t.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M8 28H24C25.1046 28 26 27.1046 26 26V9L21 4H8C6.89543 4 6 4.89543 6 6V26C6 27.1046 6.89543 28 8 28Z",fill:"#6E56CF"}),(0,t.jsx)("path",{d:"M23 9H26L21 4V7C21 8.10457 21.8954 9 23 9Z",fill:"#9E8CFC"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.0869 14.6818L14.6627 12.3787C14.7183 12.1561 14.9183 12 15.1477 12C15.473 12 15.7117 12.3057 15.6328 12.6213L15.1177 14.6818H17.7232L18.299 12.3787C18.3547 12.1561 18.5547 12 18.7841 12C19.1094 12 19.3481 12.3057 19.2692 12.6213L18.754 14.6818H21C21.2761 14.6818 21.5 14.9057 21.5 15.1818C21.5 15.458 21.2761 15.6818 21 15.6818H18.504L17.8449 18.3182H20C20.2761 18.3182 20.5 18.542 20.5 18.8182C20.5 19.0943 20.2761 19.3182 20 19.3182H17.5949L17.0192 21.6213C16.9635 21.8439 16.7635 22 16.5341 22C16.2088 22 15.9701 21.6943 16.049 21.3787L16.5642 19.3182H13.9586L13.3828 21.6213C13.3272 21.8439 13.1272 22 12.8977 22C12.5724 22 12.3338 21.6943 12.4127 21.3787L12.9278 19.3182H11C10.7239 19.3182 10.5 19.0943 10.5 18.8182C10.5 18.542 10.7239 18.3182 11 18.3182H13.1778L13.8369 15.6818H12C11.7239 15.6818 11.5 15.458 11.5 15.1818C11.5 14.9057 11.7239 14.6818 12 14.6818H14.0869ZM16.8142 18.3182L17.4732 15.6818H14.8677L14.2086 18.3182H16.8142Z",fill:"white"})]})},w=r(2754),L=r(67445),Z=r(19345),k=r(22710),T=r(99267),z=r(56580),H=r(17329),R=r(81038),I=r(31667),N=r(7819),V=r(14137);function M(e){return E.apply(this,arguments)}function E(){return(E=(0,k.Z)(function(e){var n,r,t;return(0,T.__generator)(this,function(s){switch(s.label){case 0:return[4,R.j.customTypes.readAllCustomTypes({format:e})];case 1:if(r=(n=s.sent()).errors,t=n.models,r.length>0)throw r;return[2,t.map(function(e){return e.model})]}})})).apply(this,arguments)}var F=function(e){var n,r,c,i,l,o,u=e.format,f=e.isCreatingCustomType,x=e.openCreateCustomTypeModal,p=(0,h.useRouter)(),C=(r=(0,s.useCallback)(function(e){return(0,H.VA)(M,[u],e)},[u]),{customTypes:(0,H.QT)(M,[u]),updateCustomTypes:r}),j=C.customTypes,k=C.updateCustomTypes,T=j.sort(function(e,n){return e.id.localeCompare(n.id)}),R=L.cd[u],E=d.$[u];return(o=(0,z.v9)(function(e){return{storeCustomTypes:(0,I.Ch)(e).filter(N.TG)}}).storeCustomTypes,(0,s.useEffect)(function(){var e=o.filter(function(e){return e.local.format===u});(e.length!==j.length||e.some(function(e){var n=j.find(function(n){return n.id===e.local.id});return!n||JSON.stringify(V.Dc.fromSM(e.local))!==JSON.stringify(n)}))&&k(e.map(function(e){var n=e.local;return V.Dc.fromSM(n)}))},[u,k,j,o]),0===T.length)?(0,t.jsxs)(w.R$,{style:{alignSelf:"center",marginTop:a.TV.size[72]},children:[(0,t.jsx)(w.u2,{children:(0,t.jsx)(a.Ee,{src:R.blankSlateImage,sizing:"cover"})}),(0,t.jsxs)(w.T9,{children:[(0,t.jsx)(w._T,{children:E.name({start:!0,plural:!0})}),(0,t.jsx)(w.nf,{children:E.blankSlateDescription}),(0,t.jsx)(w.Qj,{children:(0,t.jsx)(a.zx,{onClick:x,loading:f,children:"Create"})})]})]}):(0,t.jsxs)(m,{children:[(0,t.jsx)(g,{children:(0,t.jsxs)(b,{children:[(0,t.jsx)(y,{children:(0,t.jsx)(a.I5,{name:"notes",size:"medium"})}),(0,t.jsx)(y,{children:"Label"}),(0,t.jsx)(y,{children:"API ID"}),(0,t.jsx)(y,{children:"Limit"}),(0,t.jsx)(y,{})]})}),(0,t.jsx)(v,{children:T.map(function(e){var n=e.repeatable,r=e.label,s=e.id;return(0,t.jsxs)(b,{onClick:function(){p.push(L.cd[u].getBuilderPagePathname(s))},children:[(0,t.jsx)(y,{children:n?(0,t.jsx)(_,{}):(0,t.jsx)(S,{})}),(0,t.jsx)(y,{children:r}),(0,t.jsx)(y,{children:s}),(0,t.jsx)(y,{children:n?"Reusable":"Single"}),(0,t.jsx)(y,{children:(0,t.jsx)(Z._,{isChangesLocal:!1,format:u,customType:e})})]},s)})})]})},P=function(e){var n=e.format,r=d.$[n],c=(0,s.useState)(!1),h=c[0],f=c[1],x=(0,s.useState)(!1),p=x[0],m=x[1];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i(),{children:(0,t.jsxs)("title",{children:[r.name({start:!0,plural:!0})," - Slice Machine"]})}),(0,t.jsx)(u.S,{renderError:function(){return(0,t.jsx)(l.LN,{children:(0,t.jsx)(l.RN,{children:(0,t.jsx)(a.xu,{alignItems:"center",justifyContent:"center",children:(0,t.jsx)(a.Iq,{title:"Request failed",description:"An error occurred while fetching your ".concat(r.name({start:!1,plural:!0}),".")})})})})},children:(0,t.jsx)(s.Suspense,{fallback:(0,t.jsxs)(l.LN,{children:[(0,t.jsxs)(l.wd,{children:[(0,t.jsx)(l.Cx,{folder:r.name({start:!0,plural:!0})}),(0,t.jsx)(l.K2,{children:(0,t.jsx)(a.zx,{disabled:!0,startIcon:"add",children:"Create"})})]}),(0,t.jsx)(l.RN,{children:(0,t.jsx)(a._3,{})})]}),children:(0,t.jsxs)(l.LN,{children:[(0,t.jsxs)(l.wd,{children:[(0,t.jsx)(l.Cx,{folder:r.name({start:!0,plural:!0})}),(0,t.jsx)(l.K2,{children:(0,t.jsx)(a.zx,{"data-cy":"create-ct",loading:h,onClick:function(){m(!0)},startIcon:"add",children:"Create"})})]}),(0,t.jsx)(l.RN,{children:(0,t.jsxs)(a.xu,{flexDirection:"column",children:[(0,t.jsx)(F,{format:n,isCreatingCustomType:h,openCreateCustomTypeModal:function(){m(!0)}}),(0,t.jsx)(o.M,{format:n,isCreating:h,isOpen:p,onCreateChange:f,onOpenChange:m})]})})]})})})]})}},64117:function(){}}]);