@makeswift/runtime 0.23.12-canary.5 → 0.23.13

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 (76) hide show
  1. package/dist/cjs/next/api-handler/handlers/clear-draft.js +64 -0
  2. package/dist/cjs/next/api-handler/handlers/clear-draft.js.map +1 -0
  3. package/dist/cjs/next/api-handler/handlers/manifest.js +1 -1
  4. package/dist/cjs/next/api-handler/handlers/redirect-draft.js +77 -0
  5. package/dist/cjs/next/api-handler/handlers/redirect-draft.js.map +1 -0
  6. package/dist/cjs/next/api-handler/handlers/redirect-preview.js +67 -0
  7. package/dist/cjs/next/api-handler/handlers/redirect-preview.js.map +1 -0
  8. package/dist/cjs/next/api-handler/handlers/utils/draft.js +53 -0
  9. package/dist/cjs/next/api-handler/handlers/utils/draft.js.map +1 -0
  10. package/dist/cjs/next/api-handler/handlers/webhook/site-published.js +2 -4
  11. package/dist/cjs/next/api-handler/handlers/webhook/site-published.js.map +1 -1
  12. package/dist/cjs/next/cache.js +29 -0
  13. package/dist/cjs/next/cache.js.map +1 -0
  14. package/dist/cjs/next/client.js +2 -2
  15. package/dist/cjs/next/client.js.map +1 -1
  16. package/dist/cjs/runtimes/react/components/draft-switcher/draft-switcher.js +72 -0
  17. package/dist/cjs/runtimes/react/components/draft-switcher/draft-switcher.js.map +1 -0
  18. package/dist/cjs/runtimes/react/components/draft-switcher/draft-toolbar.js +79 -0
  19. package/dist/cjs/runtimes/react/components/draft-switcher/draft-toolbar.js.map +1 -0
  20. package/dist/cjs/runtimes/react/components/hooks/use-builder-connection-ping.js +67 -0
  21. package/dist/cjs/runtimes/react/components/hooks/use-builder-connection-ping.js.map +1 -0
  22. package/dist/cjs/runtimes/react/components/hooks/use-builder-handshake.js +45 -0
  23. package/dist/cjs/runtimes/react/components/hooks/use-builder-handshake.js.map +1 -0
  24. package/dist/cjs/state/makeswift-api-client.js +2 -2
  25. package/dist/cjs/state/makeswift-api-client.js.map +1 -1
  26. package/dist/esm/next/api-handler/handlers/clear-draft.js +50 -0
  27. package/dist/esm/next/api-handler/handlers/clear-draft.js.map +1 -0
  28. package/dist/esm/next/api-handler/handlers/manifest.js +1 -1
  29. package/dist/esm/next/api-handler/handlers/redirect-draft.js +63 -0
  30. package/dist/esm/next/api-handler/handlers/redirect-draft.js.map +1 -0
  31. package/dist/esm/next/api-handler/handlers/redirect-preview.js +53 -0
  32. package/dist/esm/next/api-handler/handlers/redirect-preview.js.map +1 -0
  33. package/dist/esm/next/api-handler/handlers/utils/draft.js +24 -0
  34. package/dist/esm/next/api-handler/handlers/utils/draft.js.map +1 -0
  35. package/dist/esm/next/api-handler/handlers/webhook/site-published.js +1 -2
  36. package/dist/esm/next/api-handler/handlers/webhook/site-published.js.map +1 -1
  37. package/dist/esm/next/cache.js +5 -0
  38. package/dist/esm/next/cache.js.map +1 -0
  39. package/dist/esm/next/client.js +1 -1
  40. package/dist/esm/next/client.js.map +1 -1
  41. package/dist/esm/runtimes/react/components/draft-switcher/draft-switcher.js +48 -0
  42. package/dist/esm/runtimes/react/components/draft-switcher/draft-switcher.js.map +1 -0
  43. package/dist/esm/runtimes/react/components/draft-switcher/draft-toolbar.js +55 -0
  44. package/dist/esm/runtimes/react/components/draft-switcher/draft-toolbar.js.map +1 -0
  45. package/dist/esm/runtimes/react/components/hooks/use-builder-connection-ping.js +43 -0
  46. package/dist/esm/runtimes/react/components/hooks/use-builder-connection-ping.js.map +1 -0
  47. package/dist/esm/runtimes/react/components/hooks/use-builder-handshake.js +21 -0
  48. package/dist/esm/runtimes/react/components/hooks/use-builder-handshake.js.map +1 -0
  49. package/dist/esm/state/makeswift-api-client.js +1 -1
  50. package/dist/esm/state/makeswift-api-client.js.map +1 -1
  51. package/dist/types/locale.d.ts +1 -1
  52. package/dist/types/next/api-handler/handlers/clear-draft.d.ts +20 -0
  53. package/dist/types/next/api-handler/handlers/clear-draft.d.ts.map +1 -0
  54. package/dist/types/next/api-handler/handlers/redirect-draft.d.ts +18 -0
  55. package/dist/types/next/api-handler/handlers/redirect-draft.d.ts.map +1 -0
  56. package/dist/types/next/api-handler/handlers/redirect-preview.d.ts +18 -0
  57. package/dist/types/next/api-handler/handlers/redirect-preview.d.ts.map +1 -0
  58. package/dist/types/next/api-handler/handlers/utils/draft.d.ts +16 -0
  59. package/dist/types/next/api-handler/handlers/utils/draft.d.ts.map +1 -0
  60. package/dist/types/next/api-handler/handlers/webhook/site-published.d.ts +1 -2
  61. package/dist/types/next/api-handler/handlers/webhook/site-published.d.ts.map +1 -1
  62. package/dist/types/next/api-handler/handlers/webhook/types.d.ts +12 -12
  63. package/dist/types/next/cache.d.ts +2 -0
  64. package/dist/types/next/cache.d.ts.map +1 -0
  65. package/dist/types/next/client.d.ts +8 -8
  66. package/dist/types/next/types.d.ts +123 -0
  67. package/dist/types/next/types.d.ts.map +1 -0
  68. package/dist/types/runtimes/react/components/draft-switcher/draft-switcher.d.ts +4 -0
  69. package/dist/types/runtimes/react/components/draft-switcher/draft-switcher.d.ts.map +1 -0
  70. package/dist/types/runtimes/react/components/draft-switcher/draft-toolbar.d.ts +6 -0
  71. package/dist/types/runtimes/react/components/draft-switcher/draft-toolbar.d.ts.map +1 -0
  72. package/dist/types/runtimes/react/components/hooks/use-builder-connection-ping.d.ts +4 -0
  73. package/dist/types/runtimes/react/components/hooks/use-builder-connection-ping.d.ts.map +1 -0
  74. package/dist/types/runtimes/react/components/hooks/use-builder-handshake.d.ts +4 -0
  75. package/dist/types/runtimes/react/components/hooks/use-builder-handshake.d.ts.map +1 -0
  76. package/package.json +3 -3
@@ -0,0 +1,55 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ const makeswiftIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAABcRAAAXEQHKJvM/AAABjElEQVRYhc2XzU3EMBCFB8TddAAXn6EE6GCpgNABZ1/IXnymBOgAOmA7YM8+ABVsXEHQQFaKQryeN3Yk3ilKJtEnv/nLUd/3pFG0riGi88yrnQn+UfJ5FUi0riWiB2H4nQn+KRd0DFP8agXEfkqCYJBoHdtxIQxfm+DfFgEhoith3NYE30o/qgGR2BJB+xY7kdYEL8oNFUi0jiFMJuxVWrJqEMFxsyUNCsE6AeNztvBp7aJ143vXksoRnwhYtmNdSoIQa6RlO9YXEWW7KgoCleOgxgTf1QZBT+RZ2lXFING6UxCCq+ceeUE8fYdknY599v9sJvzGBP+yCEgC7GPmETc0OJ+0awAlkhe2pAbIXAeFZ8xe2g2Nk3c3ub0xwWt6zY9qbmiqGVMbZK21ZC/YmhlbeBMTzZNDQqcvDb1kM1x32iqZSt1HaqukfKvq34BAOTLsrH+ETNmUkKHHA+428RgeclPVWozeSyAI2EdWB34jtqXNTAySOY3i/KgFIlqOa4GkFmBegorzg4joG07he/M7zl6jAAAAAElFTkSuQmCC";
3
+ const styles = `
4
+ .exit-preview-container {
5
+ position: fixed;
6
+ bottom: 16px;
7
+ right: 16px;
8
+ z-index: 2147483647;
9
+ }
10
+
11
+ .exit-preview-button {
12
+ background: #2e2e2e;
13
+ padding: 10px 18px 10px 14px;
14
+ border: 0px;
15
+ border-radius: 32px;
16
+ color: #efefef;
17
+ box-shadow:
18
+ 0 11px 40px 0 rgba(0, 0, 0, 0.25),
19
+ 0 2px 10px 0 rgba(0, 0, 0, 0.12);
20
+ transition: 150ms;
21
+
22
+ font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji',
23
+ 'Segoe UI Emoji';
24
+ font-size: 14px;
25
+ cursor: pointer;
26
+
27
+ display: flex;
28
+ align-items: center;
29
+ gap: 6px;
30
+ }
31
+
32
+ .exit-preview-button > .label {
33
+ transform: translateY(-1px);
34
+ }
35
+
36
+ .exit-preview-container:hover > .exit-preview-button {
37
+ transform: translateY(-2px);
38
+ box-shadow:
39
+ 0 15px 40px 0 rgba(0, 0, 0, 0.3),
40
+ 0 6px 10px 0 rgba(0, 0, 0, 0.15);
41
+ }
42
+ `;
43
+ function DraftToolbar({ onExitDraft }) {
44
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
45
+ /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: styles } }),
46
+ /* @__PURE__ */ jsx("div", { className: "exit-preview-container", children: /* @__PURE__ */ jsxs("button", { className: "exit-preview-button", onClick: onExitDraft, children: [
47
+ /* @__PURE__ */ jsx("img", { src: makeswiftIcon, alt: "Makeswift Logo", width: 18, height: 18 }),
48
+ /* @__PURE__ */ jsx("span", { className: "label", children: "Exit Preview" })
49
+ ] }) })
50
+ ] });
51
+ }
52
+ export {
53
+ DraftToolbar
54
+ };
55
+ //# sourceMappingURL=draft-toolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/runtimes/react/components/draft-switcher/draft-toolbar.tsx"],"sourcesContent":["const makeswiftIcon =\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAABcRAAAXEQHKJvM/AAABjElEQVRYhc2XzU3EMBCFB8TddAAXn6EE6GCpgNABZ1/IXnymBOgAOmA7YM8+ABVsXEHQQFaKQryeN3Yk3ilKJtEnv/nLUd/3pFG0riGi88yrnQn+UfJ5FUi0riWiB2H4nQn+KRd0DFP8agXEfkqCYJBoHdtxIQxfm+DfFgEhoith3NYE30o/qgGR2BJB+xY7kdYEL8oNFUi0jiFMJuxVWrJqEMFxsyUNCsE6AeNztvBp7aJ143vXksoRnwhYtmNdSoIQa6RlO9YXEWW7KgoCleOgxgTf1QZBT+RZ2lXFING6UxCCq+ceeUE8fYdknY599v9sJvzGBP+yCEgC7GPmETc0OJ+0awAlkhe2pAbIXAeFZ8xe2g2Nk3c3ub0xwWt6zY9qbmiqGVMbZK21ZC/YmhlbeBMTzZNDQqcvDb1kM1x32iqZSt1HaqukfKvq34BAOTLsrH+ETNmUkKHHA+428RgeclPVWozeSyAI2EdWB34jtqXNTAySOY3i/KgFIlqOa4GkFmBegorzg4joG07he/M7zl6jAAAAAElFTkSuQmCC'\n\nconst styles = `\n.exit-preview-container {\n position: fixed;\n bottom: 16px;\n right: 16px;\n z-index: 2147483647;\n}\n\n.exit-preview-button {\n background: #2e2e2e;\n padding: 10px 18px 10px 14px;\n border: 0px;\n border-radius: 32px;\n color: #efefef;\n box-shadow:\n 0 11px 40px 0 rgba(0, 0, 0, 0.25),\n 0 2px 10px 0 rgba(0, 0, 0, 0.12);\n transition: 150ms;\n\n font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji',\n 'Segoe UI Emoji';\n font-size: 14px;\n cursor: pointer;\n\n display: flex;\n align-items: center;\n gap: 6px;\n}\n\n.exit-preview-button > .label {\n transform: translateY(-1px);\n}\n\n.exit-preview-container:hover > .exit-preview-button {\n transform: translateY(-2px);\n box-shadow:\n 0 15px 40px 0 rgba(0, 0, 0, 0.3),\n 0 6px 10px 0 rgba(0, 0, 0, 0.15);\n}\n`\n\ntype Props = {\n onExitDraft: () => void\n}\n\nexport function DraftToolbar({ onExitDraft }: Props) {\n return (\n <>\n <style dangerouslySetInnerHTML={{ __html: styles }} />\n <div className=\"exit-preview-container\">\n <button className=\"exit-preview-button\" onClick={onExitDraft}>\n <img src={makeswiftIcon} alt=\"Makeswift Logo\" width={18} height={18} />\n <span className=\"label\">Exit Preview</span>\n </button>\n </div>\n </>\n )\n}\n"],"mappings":"AAkDI,mBACE,KAEE,YAHJ;AAlDJ,MAAM,gBACJ;AAEF,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6CR,SAAS,aAAa,EAAE,YAAY,GAAU;AACnD,SACE,iCACE;AAAA,wBAAC,WAAM,yBAAyB,EAAE,QAAQ,OAAO,GAAG;AAAA,IACpD,oBAAC,SAAI,WAAU,0BACb,+BAAC,YAAO,WAAU,uBAAsB,SAAS,aAC/C;AAAA,0BAAC,SAAI,KAAK,eAAe,KAAI,kBAAiB,OAAO,IAAI,QAAQ,IAAI;AAAA,MACrE,oBAAC,UAAK,WAAU,SAAQ,0BAAY;AAAA,OACtC,GACF;AAAA,KACF;AAEJ;","names":[]}
@@ -0,0 +1,43 @@
1
+ import { useEffect } from "react";
2
+ import { ActionTypes } from "../../../../react";
3
+ const CONNECTION_PING_INTERVAL_MS = 20;
4
+ function useBuilderConnectionPing({ appOrigin }) {
5
+ useEffect(() => {
6
+ let connectionInterval;
7
+ if (window.parent !== window) {
8
+ window.addEventListener("message", messageHandler);
9
+ window.parent.postMessage(
10
+ { type: ActionTypes.MAKESWIFT_CONNECTION_INIT },
11
+ { targetOrigin: appOrigin }
12
+ );
13
+ }
14
+ return () => {
15
+ window.removeEventListener("message", messageHandler);
16
+ if (connectionInterval != null) {
17
+ window.clearInterval(connectionInterval);
18
+ connectionInterval = null;
19
+ }
20
+ };
21
+ function messageHandler(event) {
22
+ if (event.origin === appOrigin && event.data.type === ActionTypes.MAKESWIFT_CONNECTION_INIT) {
23
+ if (connectionInterval != null) {
24
+ window.clearInterval(connectionInterval);
25
+ connectionInterval = null;
26
+ }
27
+ connectionInterval = window.setInterval(() => {
28
+ window.parent.postMessage(
29
+ {
30
+ type: ActionTypes.MAKESWIFT_CONNECTION_CHECK,
31
+ payload: { currentUrl: window.location.href }
32
+ },
33
+ { targetOrigin: appOrigin }
34
+ );
35
+ }, CONNECTION_PING_INTERVAL_MS);
36
+ }
37
+ }
38
+ }, [appOrigin]);
39
+ }
40
+ export {
41
+ useBuilderConnectionPing
42
+ };
43
+ //# sourceMappingURL=use-builder-connection-ping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/runtimes/react/components/hooks/use-builder-connection-ping.ts"],"sourcesContent":["import { useEffect } from 'react'\nimport { ActionTypes } from '../../../../react'\n\nconst CONNECTION_PING_INTERVAL_MS = 20\n\nexport function useBuilderConnectionPing({ appOrigin }: { appOrigin: string }) {\n useEffect(() => {\n let connectionInterval: number | null\n\n if (window.parent !== window) {\n window.addEventListener('message', messageHandler)\n window.parent.postMessage(\n { type: ActionTypes.MAKESWIFT_CONNECTION_INIT },\n { targetOrigin: appOrigin },\n )\n }\n\n return () => {\n window.removeEventListener('message', messageHandler)\n if (connectionInterval != null) {\n window.clearInterval(connectionInterval)\n connectionInterval = null\n }\n }\n\n function messageHandler(event: MessageEvent): void {\n if (event.origin === appOrigin && event.data.type === ActionTypes.MAKESWIFT_CONNECTION_INIT) {\n if (connectionInterval != null) {\n window.clearInterval(connectionInterval)\n connectionInterval = null\n }\n\n connectionInterval = window.setInterval(() => {\n window.parent.postMessage(\n {\n type: ActionTypes.MAKESWIFT_CONNECTION_CHECK,\n payload: { currentUrl: window.location.href },\n },\n { targetOrigin: appOrigin },\n )\n }, CONNECTION_PING_INTERVAL_MS)\n }\n }\n }, [appOrigin])\n}\n"],"mappings":"AAAA,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAE5B,MAAM,8BAA8B;AAE7B,SAAS,yBAAyB,EAAE,UAAU,GAA0B;AAC7E,YAAU,MAAM;AACd,QAAI;AAEJ,QAAI,OAAO,WAAW,QAAQ;AAC5B,aAAO,iBAAiB,WAAW,cAAc;AACjD,aAAO,OAAO;AAAA,QACZ,EAAE,MAAM,YAAY,0BAA0B;AAAA,QAC9C,EAAE,cAAc,UAAU;AAAA,MAC5B;AAAA,IACF;AAEA,WAAO,MAAM;AACX,aAAO,oBAAoB,WAAW,cAAc;AACpD,UAAI,sBAAsB,MAAM;AAC9B,eAAO,cAAc,kBAAkB;AACvC,6BAAqB;AAAA,MACvB;AAAA,IACF;AAEA,aAAS,eAAe,OAA2B;AACjD,UAAI,MAAM,WAAW,aAAa,MAAM,KAAK,SAAS,YAAY,2BAA2B;AAC3F,YAAI,sBAAsB,MAAM;AAC9B,iBAAO,cAAc,kBAAkB;AACvC,+BAAqB;AAAA,QACvB;AAEA,6BAAqB,OAAO,YAAY,MAAM;AAC5C,iBAAO,OAAO;AAAA,YACZ;AAAA,cACE,MAAM,YAAY;AAAA,cAClB,SAAS,EAAE,YAAY,OAAO,SAAS,KAAK;AAAA,YAC9C;AAAA,YACA,EAAE,cAAc,UAAU;AAAA,UAC5B;AAAA,QACF,GAAG,2BAA2B;AAAA,MAChC;AAAA,IACF;AAAA,EACF,GAAG,CAAC,SAAS,CAAC;AAChB;","names":[]}
@@ -0,0 +1,21 @@
1
+ import { useEffect, useMemo } from "react";
2
+ import { useIsPagesRouter } from "../../../../next/hooks/use-is-pages-router";
3
+ const PAGES_ROUTER_HANDSHAKE_MESSAGE = "makeswift_preview_mode";
4
+ const APP_ROUTER_HANDSHAKE_MESSAGE = "makeswift_draft_mode";
5
+ function useBuilderHandshake({ appOrigin }) {
6
+ const isPagesRouter = useIsPagesRouter();
7
+ const handshakeInitiationMessage = useMemo(() => {
8
+ if (isPagesRouter)
9
+ return PAGES_ROUTER_HANDSHAKE_MESSAGE;
10
+ return APP_ROUTER_HANDSHAKE_MESSAGE;
11
+ }, [isPagesRouter]);
12
+ useEffect(() => {
13
+ if (window.parent !== window) {
14
+ window.parent.postMessage({ type: handshakeInitiationMessage }, { targetOrigin: appOrigin });
15
+ }
16
+ }, [appOrigin, handshakeInitiationMessage]);
17
+ }
18
+ export {
19
+ useBuilderHandshake
20
+ };
21
+ //# sourceMappingURL=use-builder-handshake.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/runtimes/react/components/hooks/use-builder-handshake.ts"],"sourcesContent":["import { useEffect, useMemo } from 'react'\nimport { useIsPagesRouter } from '../../../../next/hooks/use-is-pages-router'\n\nconst PAGES_ROUTER_HANDSHAKE_MESSAGE = 'makeswift_preview_mode'\nconst APP_ROUTER_HANDSHAKE_MESSAGE = 'makeswift_draft_mode'\n\nexport function useBuilderHandshake({ appOrigin }: { appOrigin: string }) {\n const isPagesRouter = useIsPagesRouter()\n\n const handshakeInitiationMessage = useMemo(() => {\n if (isPagesRouter) return PAGES_ROUTER_HANDSHAKE_MESSAGE\n return APP_ROUTER_HANDSHAKE_MESSAGE\n }, [isPagesRouter])\n\n useEffect(() => {\n if (window.parent !== window) {\n window.parent.postMessage({ type: handshakeInitiationMessage }, { targetOrigin: appOrigin })\n }\n }, [appOrigin, handshakeInitiationMessage])\n}\n"],"mappings":"AAAA,SAAS,WAAW,eAAe;AACnC,SAAS,wBAAwB;AAEjC,MAAM,iCAAiC;AACvC,MAAM,+BAA+B;AAE9B,SAAS,oBAAoB,EAAE,UAAU,GAA0B;AACxE,QAAM,gBAAgB,iBAAiB;AAEvC,QAAM,6BAA6B,QAAQ,MAAM;AAC/C,QAAI;AAAe,aAAO;AAC1B,WAAO;AAAA,EACT,GAAG,CAAC,aAAa,CAAC;AAElB,YAAU,MAAM;AACd,QAAI,OAAO,WAAW,QAAQ;AAC5B,aAAO,OAAO,YAAY,EAAE,MAAM,2BAA2B,GAAG,EAAE,cAAc,UAAU,CAAC;AAAA,IAC7F;AAAA,EACF,GAAG,CAAC,WAAW,0BAA0B,CAAC;AAC5C;","names":[]}
@@ -12,7 +12,7 @@ import { ActionTypes, apiResourceFulfilled, setLocalizedResourceId } from "./act
12
12
  import {
13
13
  APIResourceType
14
14
  } from "../api";
15
- import { MAKESWIFT_CACHE_TAG } from "../next/api-handler/handlers/webhook/site-published";
15
+ import { MAKESWIFT_CACHE_TAG } from "../next/cache";
16
16
  import { API_HANDLER_SITE_VERSION_HEADER } from "../api/site-version";
17
17
  const reducer = combineReducers({
18
18
  apiResources: APIResources.reducer,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/state/makeswift-api-client.ts"],"sourcesContent":["import {\n applyMiddleware,\n createStore,\n combineReducers,\n type Dispatch as ReduxDispatch,\n type Store as ReduxStore,\n type Middleware,\n} from 'redux'\nimport thunk, { type ThunkAction, type ThunkDispatch } from 'redux-thunk'\n\nimport { composeWithDevToolsDevelopmentOnly } from '@redux-devtools/extension'\n\nimport { serializeState } from '../utils/serializeState'\n\nimport * as APIResources from './modules/api-resources'\nimport * as LocalizedResourcesMap from './modules/localized-resources-map'\nimport { type Action, ActionTypes, apiResourceFulfilled, setLocalizedResourceId } from './actions'\nimport {\n APIResourceType,\n type APIResource,\n type Swatch,\n type File,\n type Typography,\n type GlobalElement,\n type PagePathnameSlice,\n type Table,\n type LocalizedGlobalElement,\n type APIResourceLocale,\n} from '../api'\nimport { MAKESWIFT_CACHE_TAG } from '../next/api-handler/handlers/webhook/site-published'\nimport { API_HANDLER_SITE_VERSION_HEADER, MakeswiftSiteVersion } from '../api/site-version'\n\nconst reducer = combineReducers({\n apiResources: APIResources.reducer,\n localizedResourcesMap: LocalizedResourcesMap.reducer,\n})\n\nexport type State = ReturnType<typeof reducer>\n\nexport type SerializedState = {\n apiResources: APIResources.SerializedState\n localizedResourcesMap: LocalizedResourcesMap.SerializedState\n}\n\nfunction getLocalizedResourceId(\n state: State,\n locale: string,\n resourceId: string,\n): string | undefined | null {\n return LocalizedResourcesMap.getLocalizedResourceId(\n state.localizedResourcesMap,\n locale,\n resourceId,\n )\n}\n\nexport function getHasAPIResource<T extends APIResourceType>(\n state: State,\n resourceType: APIResourceType,\n resourceId: string,\n locale?: APIResourceLocale<T>,\n): boolean {\n switch (resourceType) {\n case APIResourceType.LocalizedGlobalElement:\n if (locale == null) {\n console.error(`Attempt to access ${resourceType} ${resourceId} without a locale`)\n return false\n }\n\n const localizedId = getLocalizedResourceId(state, locale, resourceId)\n return (\n localizedId != null &&\n APIResources.getHasAPIResource(state.apiResources, resourceType, localizedId, locale)\n )\n\n default:\n return APIResources.getHasAPIResource(state.apiResources, resourceType, resourceId, locale)\n }\n}\n\nexport function getAPIResource<T extends APIResourceType>(\n state: State,\n resourceType: T,\n resourceId: string,\n locale?: APIResourceLocale<T>,\n): Extract<APIResource, { __typename: T }> | null {\n switch (resourceType) {\n case APIResourceType.LocalizedGlobalElement:\n if (locale == null) {\n console.error(`Attempt to access ${resourceType} ${resourceId} without a locale`)\n return null\n }\n\n const localizedId = getLocalizedResourceId(state, locale, resourceId)\n return localizedId != null\n ? APIResources.getAPIResource(state.apiResources, resourceType, localizedId, locale)\n : null\n\n default:\n return APIResources.getAPIResource(state.apiResources, resourceType, resourceId, locale)\n }\n}\n\ntype Thunk<ReturnType> = ThunkAction<ReturnType, State, unknown, Action>\n\nasync function fetchJson<T>(url: string, siteVersion: MakeswiftSiteVersion): Promise<T | null> {\n const response = await fetch(url, {\n headers: {\n 'Content-Type': 'application/json',\n [API_HANDLER_SITE_VERSION_HEADER]: siteVersion,\n },\n next: { tags: [MAKESWIFT_CACHE_TAG] },\n })\n\n if (response.status === 404) return null\n\n if (!response.ok) throw new Error(response.statusText)\n\n if (response.headers.get('content-type')?.includes('application/json') !== true) {\n throw new Error(\n `Expected JSON response from \"${url}\" but got \"${response.headers.get('content-type')}\"`,\n )\n }\n\n return response.json()\n}\n\nexport function fetchAPIResource<T extends APIResourceType>(\n resourceType: T,\n resourceId: string,\n siteVersion: MakeswiftSiteVersion,\n locale?: APIResourceLocale<T>,\n): Thunk<Promise<Extract<APIResource, { __typename: T }> | null>> {\n return async (dispatch, getState) => {\n const state = getState()\n\n if (getHasAPIResource(state, resourceType, resourceId, locale)) {\n return getAPIResource(state, resourceType, resourceId, locale)\n }\n\n let resource: APIResource | null\n\n switch (resourceType) {\n case APIResourceType.Swatch:\n resource = await fetchJson<Swatch>(`/api/makeswift/swatches/${resourceId}`, siteVersion)\n break\n\n case APIResourceType.File:\n resource = await fetchJson<File>(`/api/makeswift/files/${resourceId}`, siteVersion)\n break\n\n case APIResourceType.Typography:\n resource = await fetchJson<Typography>(\n `/api/makeswift/typographies/${resourceId}`,\n siteVersion,\n )\n break\n\n case APIResourceType.GlobalElement:\n resource = await fetchJson<GlobalElement>(\n `/api/makeswift/global-elements/${resourceId}`,\n siteVersion,\n )\n break\n\n case APIResourceType.LocalizedGlobalElement: {\n if (locale == null) throw new Error('Locale is required to fetch LocalizedGlobalElement')\n\n // If `getLocalizedResourceId` returns null, it means we have tried to fetch the resource,\n // but the resource is not available. If we haven't fetched it yet, it'll return undefined.\n if (getLocalizedResourceId(state, locale, resourceId) === null) {\n return null\n }\n\n resource = await fetchJson<LocalizedGlobalElement>(\n `/api/makeswift/localized-global-elements/${resourceId}/${locale}`,\n siteVersion,\n )\n\n dispatch(\n setLocalizedResourceId({\n locale,\n resourceId,\n localizedResourceId: resource?.id ?? null,\n }),\n )\n\n break\n }\n\n case APIResourceType.PagePathnameSlice: {\n const url = new URL(`/api/makeswift/page-pathname-slices/${resourceId}`, 'http://n')\n\n if (locale != null) url.searchParams.set('locale', locale)\n\n resource = await fetchJson<PagePathnameSlice>(url.pathname + url.search, siteVersion)\n break\n }\n\n case APIResourceType.Table:\n resource = await fetchJson<Table>(`/api/makeswift/tables/${resourceId}`, siteVersion)\n break\n\n default:\n resource = null\n }\n\n dispatch(apiResourceFulfilled(resourceType, resourceId, resource, locale))\n\n return resource as Extract<APIResource, { __typename: T }> | null\n }\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nexport type Store = ReduxStore<State, Action> & { dispatch: Dispatch }\n\n// FIXME: this middleware can be removed once we've upgraded the builder\n// to always provide the locale when dispatching resource actions\nfunction defaultLocaleMiddleware(\n defaultLocale: string | undefined,\n): Middleware<Dispatch, State, Dispatch> {\n return () => (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.CHANGE_API_RESOURCE:\n case ActionTypes.EVICT_API_RESOURCE:\n case ActionTypes.SET_LOCALIZED_RESOURCE_ID: {\n const { locale } = action.payload\n return next({\n ...action,\n payload: { ...action.payload, locale: locale ?? defaultLocale },\n } as Action)\n }\n }\n\n return next(action)\n }\n }\n}\n\nexport function configureStore({\n defaultLocale,\n serializedState,\n}: {\n defaultLocale: string | undefined\n serializedState?: SerializedState\n}): Store {\n const composeEnhancers = composeWithDevToolsDevelopmentOnly({\n name: `API client store (${new Date().toISOString()})`,\n serialize: true,\n stateSanitizer: (state: any) => serializeState(state),\n actionsDenylist: [\n ActionTypes.BUILDER_POINTER_MOVE,\n ActionTypes.HANDLE_POINTER_MOVE,\n ActionTypes.ELEMENT_FROM_POINT_CHANGE,\n ],\n })\n\n return createStore(\n reducer,\n {\n apiResources: APIResources.getInitialState(serializedState?.apiResources),\n localizedResourcesMap: LocalizedResourcesMap.getInitialState(\n serializedState?.localizedResourcesMap,\n ),\n },\n composeEnhancers(applyMiddleware(thunk, defaultLocaleMiddleware(defaultLocale))),\n )\n}\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,OAAO,WAAqD;AAE5D,SAAS,0CAA0C;AAEnD,SAAS,sBAAsB;AAE/B,YAAY,kBAAkB;AAC9B,YAAY,2BAA2B;AACvC,SAAsB,aAAa,sBAAsB,8BAA8B;AACvF;AAAA,EACE;AAAA,OAUK;AACP,SAAS,2BAA2B;AACpC,SAAS,uCAA6D;AAEtE,MAAM,UAAU,gBAAgB;AAAA,EAC9B,cAAc,aAAa;AAAA,EAC3B,uBAAuB,sBAAsB;AAC/C,CAAC;AASD,SAAS,uBACP,OACA,QACA,YAC2B;AAC3B,SAAO,sBAAsB;AAAA,IAC3B,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,kBACd,OACA,cACA,YACA,QACS;AACT,UAAQ,cAAc;AAAA,IACpB,KAAK,gBAAgB;AACnB,UAAI,UAAU,MAAM;AAClB,gBAAQ,MAAM,qBAAqB,YAAY,IAAI,UAAU,mBAAmB;AAChF,eAAO;AAAA,MACT;AAEA,YAAM,cAAc,uBAAuB,OAAO,QAAQ,UAAU;AACpE,aACE,eAAe,QACf,aAAa,kBAAkB,MAAM,cAAc,cAAc,aAAa,MAAM;AA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2B;AACjC,cAAQ,OAAO,MAAM;AAAA,QACnB,KAAK,YAAY;AAAA,QACjB,KAAK,YAAY;AAAA,QACjB,KAAK,YAAY,2BAA2B;AAC1C,gBAAM,EAAE,OAAO,IAAI,OAAO;AAC1B,iBAAO,KAAK;AAAA,YACV,GAAG;AAAA,YACH,SAAS,EAAE,GAAG,OAAO,SAAS,QAAQ,UAAU,cAAc;AAAA,UAChE,CAAW;AAAA,QACb;AAAA,MACF;AAEA,aAAO,KAAK,MAAM;AAAA,IACpB;AAAA,EACF;AACF;AAEO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AACF,GAGU;AACR,QAAM,mBAAmB,mCAAmC;AAAA,IAC1D,MAAM,sBAAqB,oBAAI,KAAK,GAAE,YAAY,CAAC;AAAA,IACnD,WAAW;AAAA,IACX,gBAAgB,CAAC,UAAe,eAAe,KAAK;AAAA,IACpD,iBAAiB;AAAA,MACf,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,YAAY;AAAA,IACd;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,cAAc,aAAa,gBAAgB,iBAAiB,YAAY;AAAA,MACxE,uBAAuB,sBAAsB;AAAA,QAC3C,iBAAiB;AAAA,MACnB;AAAA,IACF;AAAA,IACA,iBAAiB,gBAAgB,OAAO,wBAAwB,aAAa,CAAC,CAAC;AAAA,EACjF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/state/makeswift-api-client.ts"],"sourcesContent":["import {\n applyMiddleware,\n createStore,\n combineReducers,\n type Dispatch as ReduxDispatch,\n type Store as ReduxStore,\n type Middleware,\n} from 'redux'\nimport thunk, { type ThunkAction, type ThunkDispatch } from 'redux-thunk'\n\nimport { composeWithDevToolsDevelopmentOnly } from '@redux-devtools/extension'\n\nimport { serializeState } from '../utils/serializeState'\n\nimport * as APIResources from './modules/api-resources'\nimport * as LocalizedResourcesMap from './modules/localized-resources-map'\nimport { type Action, ActionTypes, apiResourceFulfilled, setLocalizedResourceId } from './actions'\nimport {\n APIResourceType,\n type APIResource,\n type Swatch,\n type File,\n type Typography,\n type GlobalElement,\n type PagePathnameSlice,\n type Table,\n type LocalizedGlobalElement,\n type APIResourceLocale,\n} from '../api'\nimport { MAKESWIFT_CACHE_TAG } from '../next/cache'\nimport { API_HANDLER_SITE_VERSION_HEADER, MakeswiftSiteVersion } from '../api/site-version'\n\nconst reducer = combineReducers({\n apiResources: APIResources.reducer,\n localizedResourcesMap: LocalizedResourcesMap.reducer,\n})\n\nexport type State = ReturnType<typeof reducer>\n\nexport type SerializedState = {\n apiResources: APIResources.SerializedState\n localizedResourcesMap: LocalizedResourcesMap.SerializedState\n}\n\nfunction getLocalizedResourceId(\n state: State,\n locale: string,\n resourceId: string,\n): string | undefined | null {\n return LocalizedResourcesMap.getLocalizedResourceId(\n state.localizedResourcesMap,\n locale,\n resourceId,\n )\n}\n\nexport function getHasAPIResource<T extends APIResourceType>(\n state: State,\n resourceType: APIResourceType,\n resourceId: string,\n locale?: APIResourceLocale<T>,\n): boolean {\n switch (resourceType) {\n case APIResourceType.LocalizedGlobalElement:\n if (locale == null) {\n console.error(`Attempt to access ${resourceType} ${resourceId} without a locale`)\n return false\n }\n\n const localizedId = getLocalizedResourceId(state, locale, resourceId)\n return (\n localizedId != null &&\n APIResources.getHasAPIResource(state.apiResources, resourceType, localizedId, locale)\n )\n\n default:\n return APIResources.getHasAPIResource(state.apiResources, resourceType, resourceId, locale)\n }\n}\n\nexport function getAPIResource<T extends APIResourceType>(\n state: State,\n resourceType: T,\n resourceId: string,\n locale?: APIResourceLocale<T>,\n): Extract<APIResource, { __typename: T }> | null {\n switch (resourceType) {\n case APIResourceType.LocalizedGlobalElement:\n if (locale == null) {\n console.error(`Attempt to access ${resourceType} ${resourceId} without a locale`)\n return null\n }\n\n const localizedId = getLocalizedResourceId(state, locale, resourceId)\n return localizedId != null\n ? APIResources.getAPIResource(state.apiResources, resourceType, localizedId, locale)\n : null\n\n default:\n return APIResources.getAPIResource(state.apiResources, resourceType, resourceId, locale)\n }\n}\n\ntype Thunk<ReturnType> = ThunkAction<ReturnType, State, unknown, Action>\n\nasync function fetchJson<T>(url: string, siteVersion: MakeswiftSiteVersion): Promise<T | null> {\n const response = await fetch(url, {\n headers: {\n 'Content-Type': 'application/json',\n [API_HANDLER_SITE_VERSION_HEADER]: siteVersion,\n },\n next: { tags: [MAKESWIFT_CACHE_TAG] },\n })\n\n if (response.status === 404) return null\n\n if (!response.ok) throw new Error(response.statusText)\n\n if (response.headers.get('content-type')?.includes('application/json') !== true) {\n throw new Error(\n `Expected JSON response from \"${url}\" but got \"${response.headers.get('content-type')}\"`,\n )\n }\n\n return response.json()\n}\n\nexport function fetchAPIResource<T extends APIResourceType>(\n resourceType: T,\n resourceId: string,\n siteVersion: MakeswiftSiteVersion,\n locale?: APIResourceLocale<T>,\n): Thunk<Promise<Extract<APIResource, { __typename: T }> | null>> {\n return async (dispatch, getState) => {\n const state = getState()\n\n if (getHasAPIResource(state, resourceType, resourceId, locale)) {\n return getAPIResource(state, resourceType, resourceId, locale)\n }\n\n let resource: APIResource | null\n\n switch (resourceType) {\n case APIResourceType.Swatch:\n resource = await fetchJson<Swatch>(`/api/makeswift/swatches/${resourceId}`, siteVersion)\n break\n\n case APIResourceType.File:\n resource = await fetchJson<File>(`/api/makeswift/files/${resourceId}`, siteVersion)\n break\n\n case APIResourceType.Typography:\n resource = await fetchJson<Typography>(\n `/api/makeswift/typographies/${resourceId}`,\n siteVersion,\n )\n break\n\n case APIResourceType.GlobalElement:\n resource = await fetchJson<GlobalElement>(\n `/api/makeswift/global-elements/${resourceId}`,\n siteVersion,\n )\n break\n\n case APIResourceType.LocalizedGlobalElement: {\n if (locale == null) throw new Error('Locale is required to fetch LocalizedGlobalElement')\n\n // If `getLocalizedResourceId` returns null, it means we have tried to fetch the resource,\n // but the resource is not available. If we haven't fetched it yet, it'll return undefined.\n if (getLocalizedResourceId(state, locale, resourceId) === null) {\n return null\n }\n\n resource = await fetchJson<LocalizedGlobalElement>(\n `/api/makeswift/localized-global-elements/${resourceId}/${locale}`,\n siteVersion,\n )\n\n dispatch(\n setLocalizedResourceId({\n locale,\n resourceId,\n localizedResourceId: resource?.id ?? null,\n }),\n )\n\n break\n }\n\n case APIResourceType.PagePathnameSlice: {\n const url = new URL(`/api/makeswift/page-pathname-slices/${resourceId}`, 'http://n')\n\n if (locale != null) url.searchParams.set('locale', locale)\n\n resource = await fetchJson<PagePathnameSlice>(url.pathname + url.search, siteVersion)\n break\n }\n\n case APIResourceType.Table:\n resource = await fetchJson<Table>(`/api/makeswift/tables/${resourceId}`, siteVersion)\n break\n\n default:\n resource = null\n }\n\n dispatch(apiResourceFulfilled(resourceType, resourceId, resource, locale))\n\n return resource as Extract<APIResource, { __typename: T }> | null\n }\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nexport type Store = ReduxStore<State, Action> & { dispatch: Dispatch }\n\n// FIXME: this middleware can be removed once we've upgraded the builder\n// to always provide the locale when dispatching resource actions\nfunction defaultLocaleMiddleware(\n defaultLocale: string | undefined,\n): Middleware<Dispatch, State, Dispatch> {\n return () => (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.CHANGE_API_RESOURCE:\n case ActionTypes.EVICT_API_RESOURCE:\n case ActionTypes.SET_LOCALIZED_RESOURCE_ID: {\n const { locale } = action.payload\n return next({\n ...action,\n payload: { ...action.payload, locale: locale ?? defaultLocale },\n } as Action)\n }\n }\n\n return next(action)\n }\n }\n}\n\nexport function configureStore({\n defaultLocale,\n serializedState,\n}: {\n defaultLocale: string | undefined\n serializedState?: SerializedState\n}): Store {\n const composeEnhancers = composeWithDevToolsDevelopmentOnly({\n name: `API client store (${new Date().toISOString()})`,\n serialize: true,\n stateSanitizer: (state: any) => serializeState(state),\n actionsDenylist: [\n ActionTypes.BUILDER_POINTER_MOVE,\n ActionTypes.HANDLE_POINTER_MOVE,\n ActionTypes.ELEMENT_FROM_POINT_CHANGE,\n ],\n })\n\n return createStore(\n reducer,\n {\n apiResources: APIResources.getInitialState(serializedState?.apiResources),\n localizedResourcesMap: LocalizedResourcesMap.getInitialState(\n serializedState?.localizedResourcesMap,\n ),\n },\n composeEnhancers(applyMiddleware(thunk, defaultLocaleMiddleware(defaultLocale))),\n )\n}\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,OAAO,WAAqD;AAE5D,SAAS,0CAA0C;AAEnD,SAAS,sBAAsB;AAE/B,YAAY,kBAAkB;AAC9B,YAAY,2BAA2B;AACvC,SAAsB,aAAa,sBAAsB,8BAA8B;AACvF;AAAA,EACE;AAAA,OAUK;AACP,SAAS,2BAA2B;AACpC,SAAS,uCAA6D;AAEtE,MAAM,UAAU,gBAAgB;AAAA,EAC9B,cAAc,aAAa;AAAA,EAC3B,uBAAuB,sBAAsB;AAC/C,CAAC;AASD,SAAS,uBACP,OACA,QACA,YAC2B;AAC3B,SAAO,sBAAsB;AAAA,IAC3B,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,kBACd,OACA,cACA,YACA,QACS;AACT,UAAQ,cAAc;AAAA,IACpB,KAAK,gBAAgB;AACnB,UAAI,UAAU,MAAM;AAClB,gBAAQ,MAAM,qBAAqB,YAAY,IAAI,UAAU,mBAAmB;AAChF,eAAO;AAAA,MACT;AAEA,YAAM,cAAc,uBAAuB,OAAO,QAAQ,UAAU;AACpE,aACE,eAAe,QACf,aAAa,kBAAkB,MAAM,cAAc,cAAc,aAAa,MAAM;AAAA,IAGxF;AACE,aAAO,aAAa,kBAAkB,MAAM,cAAc,cAAc,YAAY,MAAM;AAAA,EAC9F;AACF;AAEO,SAAS,eACd,OACA,cACA,YACA,QACgD;AAChD,UAAQ,cAAc;AAAA,IACpB,KAAK,gBAAgB;AACnB,UAAI,UAAU,MAAM;AAClB,gBAAQ,MAAM,qBAAqB,YAAY,IAAI,UAAU,mBAAmB;AAChF,eAA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