@makeswift/runtime 0.26.4-canary.0 → 0.26.4-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/client.js +10 -3
- package/dist/cjs/api/client.js.map +1 -1
- package/dist/cjs/api-handler/handlers/manifest.js +1 -1
- package/dist/cjs/client/index.js +3 -3
- package/dist/cjs/next/components/framework-provider/index.js +1 -1
- package/dist/cjs/next/components/framework-provider/index.js.map +1 -1
- package/dist/cjs/runtimes/react/components/RuntimeProvider.js +4 -3
- package/dist/cjs/runtimes/react/components/RuntimeProvider.js.map +1 -1
- package/dist/cjs/runtimes/react/components/framework-context.js +3 -13
- package/dist/cjs/runtimes/react/components/framework-context.js.map +1 -1
- package/dist/cjs/runtimes/react/host-api-client.js +2 -1
- package/dist/cjs/runtimes/react/host-api-client.js.map +1 -1
- package/dist/cjs/state/actions/internal/read-only-actions.js +15 -1
- package/dist/cjs/state/actions/internal/read-only-actions.js.map +1 -1
- package/dist/cjs/state/makeswift-api-client.js +32 -18
- package/dist/cjs/state/makeswift-api-client.js.map +1 -1
- package/dist/cjs/state/modules/locale.js +53 -0
- package/dist/cjs/state/modules/locale.js.map +1 -0
- package/dist/cjs/state/modules/site-version.js +50 -0
- package/dist/cjs/state/modules/site-version.js.map +1 -0
- package/dist/cjs/unstable-framework-support/index.js +2 -4
- package/dist/cjs/unstable-framework-support/index.js.map +1 -1
- package/dist/esm/api/client.js +10 -3
- package/dist/esm/api/client.js.map +1 -1
- package/dist/esm/api-handler/handlers/manifest.js +1 -1
- package/dist/esm/client/index.js +3 -3
- package/dist/esm/next/components/framework-provider/index.js +2 -5
- package/dist/esm/next/components/framework-provider/index.js.map +1 -1
- package/dist/esm/runtimes/react/components/RuntimeProvider.js +4 -3
- package/dist/esm/runtimes/react/components/RuntimeProvider.js.map +1 -1
- package/dist/esm/runtimes/react/components/framework-context.js +2 -14
- package/dist/esm/runtimes/react/components/framework-context.js.map +1 -1
- package/dist/esm/runtimes/react/host-api-client.js +2 -1
- package/dist/esm/runtimes/react/host-api-client.js.map +1 -1
- package/dist/esm/state/actions/internal/read-only-actions.js +13 -1
- package/dist/esm/state/actions/internal/read-only-actions.js.map +1 -1
- package/dist/esm/state/makeswift-api-client.js +32 -18
- package/dist/esm/state/makeswift-api-client.js.map +1 -1
- package/dist/esm/state/modules/locale.js +27 -0
- package/dist/esm/state/modules/locale.js.map +1 -0
- package/dist/esm/state/modules/site-version.js +24 -0
- package/dist/esm/state/modules/site-version.js.map +1 -0
- package/dist/esm/unstable-framework-support/index.js +2 -4
- package/dist/esm/unstable-framework-support/index.js.map +1 -1
- package/dist/types/api/client.d.ts +3 -1
- package/dist/types/api/client.d.ts.map +1 -1
- package/dist/types/next/components/framework-provider/index.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/RuntimeProvider.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/framework-context.d.ts +2 -4
- package/dist/types/runtimes/react/components/framework-context.d.ts.map +1 -1
- package/dist/types/runtimes/react/host-api-client.d.ts.map +1 -1
- package/dist/types/state/actions/index.d.ts +2 -0
- package/dist/types/state/actions/index.d.ts.map +1 -1
- package/dist/types/state/actions/internal/index.d.ts +2 -0
- package/dist/types/state/actions/internal/index.d.ts.map +1 -1
- package/dist/types/state/actions/internal/read-only-actions.d.ts +13 -1
- package/dist/types/state/actions/internal/read-only-actions.d.ts.map +1 -1
- package/dist/types/state/makeswift-api-client.d.ts +11 -2
- package/dist/types/state/makeswift-api-client.d.ts.map +1 -1
- package/dist/types/state/modules/locale.d.ts +6 -0
- package/dist/types/state/modules/locale.d.ts.map +1 -0
- package/dist/types/state/modules/site-version.d.ts +7 -0
- package/dist/types/state/modules/site-version.d.ts.map +1 -0
- package/dist/types/unstable-framework-support/index.d.ts +1 -1
- package/dist/types/unstable-framework-support/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -2,6 +2,9 @@ import {
|
|
|
2
2
|
configureStore as configureReduxStore,
|
|
3
3
|
combineReducers
|
|
4
4
|
} from "@reduxjs/toolkit";
|
|
5
|
+
import { ApiHandlerHeaders, serializeSiteVersion } from "../api/site-version";
|
|
6
|
+
import * as SiteVersionState from "./modules/site-version";
|
|
7
|
+
import * as LocaleState from "./modules/locale";
|
|
5
8
|
import * as APIResources from "./modules/api-resources";
|
|
6
9
|
import * as LocalizedResourcesMap from "./modules/localized-resources-map";
|
|
7
10
|
import { ActionTypes } from "./actions";
|
|
@@ -12,6 +15,8 @@ import {
|
|
|
12
15
|
APIResourceType
|
|
13
16
|
} from "../api";
|
|
14
17
|
const reducer = combineReducers({
|
|
18
|
+
siteVersion: SiteVersionState.reducer,
|
|
19
|
+
locale: LocaleState.reducer,
|
|
15
20
|
apiResources: APIResources.reducer,
|
|
16
21
|
localizedResourcesMap: LocalizedResourcesMap.reducer
|
|
17
22
|
});
|
|
@@ -49,10 +54,11 @@ function getAPIResource(state, resourceType, resourceId, locale) {
|
|
|
49
54
|
}
|
|
50
55
|
}
|
|
51
56
|
function fetchAPIResource(resourceType, resourceId, fetch, locale) {
|
|
52
|
-
const
|
|
57
|
+
const fetchVersioned = async (url, version) => {
|
|
53
58
|
const response = await fetch(url, {
|
|
54
59
|
headers: {
|
|
55
|
-
"Content-Type": "application/json"
|
|
60
|
+
"Content-Type": "application/json",
|
|
61
|
+
...version != null ? { [ApiHandlerHeaders.SiteVersion]: serializeSiteVersion(version) } : {}
|
|
56
62
|
}
|
|
57
63
|
});
|
|
58
64
|
if (response.status === 404)
|
|
@@ -68,22 +74,29 @@ function fetchAPIResource(resourceType, resourceId, fetch, locale) {
|
|
|
68
74
|
};
|
|
69
75
|
return async (dispatch, getState) => {
|
|
70
76
|
const state = getState();
|
|
77
|
+
const version = SiteVersionState.getSiteVersion(state.siteVersion);
|
|
71
78
|
if (getHasAPIResource(state, resourceType, resourceId, locale)) {
|
|
72
79
|
return getAPIResource(state, resourceType, resourceId, locale);
|
|
73
80
|
}
|
|
74
81
|
let resource;
|
|
75
82
|
switch (resourceType) {
|
|
76
83
|
case APIResourceType.Swatch:
|
|
77
|
-
resource = await
|
|
84
|
+
resource = await fetchVersioned(`/api/makeswift/swatches/${resourceId}`, version);
|
|
78
85
|
break;
|
|
79
86
|
case APIResourceType.File:
|
|
80
|
-
resource = await
|
|
87
|
+
resource = await fetchVersioned(`/api/makeswift/files/${resourceId}`, version);
|
|
81
88
|
break;
|
|
82
89
|
case APIResourceType.Typography:
|
|
83
|
-
resource = await
|
|
90
|
+
resource = await fetchVersioned(
|
|
91
|
+
`/api/makeswift/typographies/${resourceId}`,
|
|
92
|
+
version
|
|
93
|
+
);
|
|
84
94
|
break;
|
|
85
95
|
case APIResourceType.GlobalElement:
|
|
86
|
-
resource = await
|
|
96
|
+
resource = await fetchVersioned(
|
|
97
|
+
`/api/makeswift/global-elements/${resourceId}`,
|
|
98
|
+
version
|
|
99
|
+
);
|
|
87
100
|
break;
|
|
88
101
|
case APIResourceType.LocalizedGlobalElement: {
|
|
89
102
|
if (locale == null)
|
|
@@ -91,8 +104,9 @@ function fetchAPIResource(resourceType, resourceId, fetch, locale) {
|
|
|
91
104
|
if (getLocalizedResourceId(state, locale, resourceId) === null) {
|
|
92
105
|
return null;
|
|
93
106
|
}
|
|
94
|
-
resource = await
|
|
95
|
-
`/api/makeswift/localized-global-elements/${resourceId}/${locale}
|
|
107
|
+
resource = await fetchVersioned(
|
|
108
|
+
`/api/makeswift/localized-global-elements/${resourceId}/${locale}`,
|
|
109
|
+
version
|
|
96
110
|
);
|
|
97
111
|
dispatch(
|
|
98
112
|
setLocalizedResourceId({
|
|
@@ -107,11 +121,11 @@ function fetchAPIResource(resourceType, resourceId, fetch, locale) {
|
|
|
107
121
|
const url = new URL(`/api/makeswift/page-pathname-slices/${resourceId}`, "http://n");
|
|
108
122
|
if (locale != null)
|
|
109
123
|
url.searchParams.set("locale", locale);
|
|
110
|
-
resource = await
|
|
124
|
+
resource = await fetchVersioned(url.pathname + url.search, version);
|
|
111
125
|
break;
|
|
112
126
|
}
|
|
113
127
|
case APIResourceType.Table:
|
|
114
|
-
resource = await
|
|
128
|
+
resource = await fetchVersioned(`/api/makeswift/tables/${resourceId}`, version);
|
|
115
129
|
break;
|
|
116
130
|
default:
|
|
117
131
|
resource = null;
|
|
@@ -120,8 +134,8 @@ function fetchAPIResource(resourceType, resourceId, fetch, locale) {
|
|
|
120
134
|
return resource;
|
|
121
135
|
};
|
|
122
136
|
}
|
|
123
|
-
function defaultLocaleMiddleware(
|
|
124
|
-
return actionMiddleware(() => (next) => {
|
|
137
|
+
function defaultLocaleMiddleware() {
|
|
138
|
+
return actionMiddleware(({ getState }) => (next) => {
|
|
125
139
|
return (action) => {
|
|
126
140
|
switch (action.type) {
|
|
127
141
|
case ActionTypes.CHANGE_API_RESOURCE:
|
|
@@ -130,7 +144,10 @@ function defaultLocaleMiddleware(defaultLocale) {
|
|
|
130
144
|
const { locale } = action.payload;
|
|
131
145
|
return next({
|
|
132
146
|
...action,
|
|
133
|
-
payload: {
|
|
147
|
+
payload: {
|
|
148
|
+
...action.payload,
|
|
149
|
+
locale: locale ?? LocaleState.getLocale(getState().locale)
|
|
150
|
+
}
|
|
134
151
|
});
|
|
135
152
|
}
|
|
136
153
|
}
|
|
@@ -138,10 +155,7 @@ function defaultLocaleMiddleware(defaultLocale) {
|
|
|
138
155
|
};
|
|
139
156
|
});
|
|
140
157
|
}
|
|
141
|
-
function configureStore({
|
|
142
|
-
defaultLocale,
|
|
143
|
-
serializedState
|
|
144
|
-
}) {
|
|
158
|
+
function configureStore({ serializedState }) {
|
|
145
159
|
return configureReduxStore({
|
|
146
160
|
reducer,
|
|
147
161
|
preloadedState: {
|
|
@@ -150,7 +164,7 @@ function configureStore({
|
|
|
150
164
|
serializedState?.localizedResourcesMap
|
|
151
165
|
)
|
|
152
166
|
},
|
|
153
|
-
middleware: (getDefaultMiddleware) => getDefaultMiddleware(middlewareOptions).concat(defaultLocaleMiddleware(
|
|
167
|
+
middleware: (getDefaultMiddleware) => getDefaultMiddleware(middlewareOptions).concat(defaultLocaleMiddleware()),
|
|
154
168
|
devTools: devToolsConfig({
|
|
155
169
|
name: `API client store (${(/* @__PURE__ */ new Date()).toISOString()})`,
|
|
156
170
|
actionsDenylist: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/state/makeswift-api-client.ts"],"sourcesContent":["import {\n configureStore as configureReduxStore,\n combineReducers,\n type ThunkAction,\n type ThunkMiddleware,\n type ThunkDispatch,\n UnknownAction,\n} from '@reduxjs/toolkit'\n\nimport * as APIResources from './modules/api-resources'\nimport * as LocalizedResourcesMap from './modules/localized-resources-map'\nimport { type Action, ActionTypes } from './actions'\nimport { apiResourceFulfilled } from './actions/internal/read-only-actions'\nimport { setLocalizedResourceId } from './host-api'\nimport { actionMiddleware, middlewareOptions, devToolsConfig } from './toolkit'\n\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'\n\nconst reducer = combineReducers({\n apiResources: APIResources.reducer,\n localizedResourcesMap: LocalizedResourcesMap.reducer,\n})\n\nexport type State = ReturnType<typeof reducer>\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\nexport type HttpFetch = (url: string | URL, init?: RequestInit) => Promise<Response>\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\nexport function fetchAPIResource<T extends APIResourceType>(\n resourceType: T,\n resourceId: string,\n fetch: HttpFetch,\n locale?: APIResourceLocale<T>,\n): Thunk<Promise<Extract<APIResource, { __typename: T }> | null>> {\n const fetchJson = async <T>(url: string): Promise<T | null> => {\n const response = await fetch(url, {\n headers: {\n 'Content-Type': 'application/json',\n },\n })\n\n if (response.status === 404) return null\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\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}`)\n break\n\n case APIResourceType.File:\n resource = await fetchJson<File>(`/api/makeswift/files/${resourceId}`)\n break\n\n case APIResourceType.Typography:\n resource = await fetchJson<Typography>(`/api/makeswift/typographies/${resourceId}`)\n break\n\n case APIResourceType.GlobalElement:\n resource = await fetchJson<GlobalElement>(`/api/makeswift/global-elements/${resourceId}`)\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 )\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)\n break\n }\n\n case APIResourceType.Table:\n resource = await fetchJson<Table>(`/api/makeswift/tables/${resourceId}`)\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\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): ThunkMiddleware<State, UnknownAction> {\n return actionMiddleware(() => next => {\n return (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}) {\n return configureReduxStore({\n reducer,\n preloadedState: {\n apiResources: APIResources.getInitialState(serializedState?.apiResources),\n localizedResourcesMap: LocalizedResourcesMap.getInitialState(\n serializedState?.localizedResourcesMap,\n ),\n },\n\n middleware: getDefaultMiddleware =>\n getDefaultMiddleware(middlewareOptions).concat(defaultLocaleMiddleware(defaultLocale)),\n\n devTools: devToolsConfig({\n name: `API client store (${new Date().toISOString()})`,\n actionsDenylist: [\n ActionTypes.BUILDER_POINTER_MOVE,\n ActionTypes.HANDLE_POINTER_MOVE,\n ActionTypes.ELEMENT_FROM_POINT_CHANGE,\n ],\n }),\n })\n}\n\nexport type Store = ReturnType<typeof configureStore>\n"],"mappings":"AAAA;AAAA,EACE,kBAAkB;AAAA,EAClB;AAAA,OAKK;AAEP,YAAY,kBAAkB;AAC9B,YAAY,2BAA2B;AACvC,SAAsB,mBAAmB;AACzC,SAAS,4BAA4B;AACrC,SAAS,8BAA8B;AACvC,SAAS,kBAAkB,mBAAmB,sBAAsB;AAEpE;AAAA,EACE;AAAA,OAUK;AAEP,MAAM,UAAU,gBAAgB;AAAA,EAC9B,cAAc,aAAa;AAAA,EAC3B,uBAAuB,sBAAsB;AAC/C,CAAC;AAWD,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,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G,OAAO,SAAS,QAAQ,UAAU,cAAc;AAAA,UAChE,CAAW;AAAA,QACb;AAAA,MACF;AAEA,aAAO,KAAK,MAAM;AAAA,IACpB;AAAA,EACF,CAAC;AACH;AAEO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AACF,GAGG;AACD,SAAO,oBAAoB;AAAA,IACzB;AAAA,IACA,gBAAgB;AAAA,MACd,cAAc,aAAa,gBAAgB,iBAAiB,YAAY;AAAA,MACxE,uBAAuB,sBAAsB;AAAA,QAC3C,iBAAiB;AAAA,MACnB;AAAA,IACF;AAAA,IAEA,YAAY,0BACV,qBAAqB,iBAAiB,EAAE,OAAO,wBAAwB,aAAa,CAAC;AAAA,IAEvF,UAAU,eAAe;AAAA,MACvB,MAAM,sBAAqB,oBAAI,KAAK,GAAE,YAAY,CAAC;AAAA,MACnD,iBAAiB;AAAA,QACf,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,YAAY;AAAA,MACd;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/state/makeswift-api-client.ts"],"sourcesContent":["import {\n configureStore as configureReduxStore,\n combineReducers,\n type ThunkAction,\n type ThunkMiddleware,\n type ThunkDispatch,\n UnknownAction,\n} from '@reduxjs/toolkit'\n\nimport { type SiteVersion, ApiHandlerHeaders, serializeSiteVersion } from '../api/site-version'\n\nimport * as SiteVersionState from './modules/site-version'\nimport * as LocaleState from './modules/locale'\nimport * as APIResources from './modules/api-resources'\nimport * as LocalizedResourcesMap from './modules/localized-resources-map'\n\nimport { type Action, ActionTypes } from './actions'\nimport { apiResourceFulfilled } from './actions/internal/read-only-actions'\nimport { setLocalizedResourceId } from './host-api'\nimport { actionMiddleware, middlewareOptions, devToolsConfig } from './toolkit'\n\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'\n\nconst reducer = combineReducers({\n siteVersion: SiteVersionState.reducer,\n locale: LocaleState.reducer,\n apiResources: APIResources.reducer,\n localizedResourcesMap: LocalizedResourcesMap.reducer,\n})\n\nexport type State = ReturnType<typeof reducer>\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\nexport type HttpFetch = (url: string | URL, init?: RequestInit) => Promise<Response>\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\nexport function fetchAPIResource<T extends APIResourceType>(\n resourceType: T,\n resourceId: string,\n fetch: HttpFetch,\n locale?: APIResourceLocale<T>,\n): Thunk<Promise<Extract<APIResource, { __typename: T }> | null>> {\n const fetchVersioned = async <T>(url: string, version: SiteVersion | null): Promise<T | null> => {\n const response = await fetch(url, {\n headers: {\n 'Content-Type': 'application/json',\n ...(version != null\n ? { [ApiHandlerHeaders.SiteVersion]: serializeSiteVersion(version) }\n : {}),\n },\n })\n\n if (response.status === 404) return null\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\n return async (dispatch, getState) => {\n const state = getState()\n const version = SiteVersionState.getSiteVersion(state.siteVersion)\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 fetchVersioned<Swatch>(`/api/makeswift/swatches/${resourceId}`, version)\n break\n\n case APIResourceType.File:\n resource = await fetchVersioned<File>(`/api/makeswift/files/${resourceId}`, version)\n break\n\n case APIResourceType.Typography:\n resource = await fetchVersioned<Typography>(\n `/api/makeswift/typographies/${resourceId}`,\n version,\n )\n break\n\n case APIResourceType.GlobalElement:\n resource = await fetchVersioned<GlobalElement>(\n `/api/makeswift/global-elements/${resourceId}`,\n version,\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 fetchVersioned<LocalizedGlobalElement>(\n `/api/makeswift/localized-global-elements/${resourceId}/${locale}`,\n version,\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 fetchVersioned<PagePathnameSlice>(url.pathname + url.search, version)\n break\n }\n\n case APIResourceType.Table:\n resource = await fetchVersioned<Table>(`/api/makeswift/tables/${resourceId}`, version)\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\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(): ThunkMiddleware<State, UnknownAction> {\n return actionMiddleware(({ getState }) => next => {\n return (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: {\n ...action.payload,\n locale: locale ?? LocaleState.getLocale(getState().locale),\n },\n } as Action)\n }\n }\n\n return next(action)\n }\n })\n}\n\nexport function configureStore({ serializedState }: { serializedState?: SerializedState }) {\n return configureReduxStore({\n reducer,\n preloadedState: {\n apiResources: APIResources.getInitialState(serializedState?.apiResources),\n localizedResourcesMap: LocalizedResourcesMap.getInitialState(\n serializedState?.localizedResourcesMap,\n ),\n },\n\n middleware: getDefaultMiddleware =>\n getDefaultMiddleware(middlewareOptions).concat(defaultLocaleMiddleware()),\n\n devTools: devToolsConfig({\n name: `API client store (${new Date().toISOString()})`,\n actionsDenylist: [\n ActionTypes.BUILDER_POINTER_MOVE,\n ActionTypes.HANDLE_POINTER_MOVE,\n ActionTypes.ELEMENT_FROM_POINT_CHANGE,\n ],\n }),\n })\n}\n\nexport type Store = ReturnType<typeof configureStore>\n"],"mappings":"AAAA;AAAA,EACE,kBAAkB;AAAA,EAClB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;AAEA,aAAO,KAAK,MAAM;AAAA,IACpB;AAAA,EACF,CAAC;AACH;AAEO,SAAS,eAAe,EAAE,gBAAgB,GAA0C;AACzF,SAAO,oBAAoB;AAAA,IACzB;AAAA,IACA,gBAAgB;AAAA,MACd,cAAc,aAAa,gBAAgB,iBAAiB,YAAY;AAAA,MACxE,uBAAuB,sBAAsB;AAAA,QAC3C,iBAAiB;AAAA,MACnB;AAAA,IACF;AAAA,IAEA,YAAY,0BACV,qBAAqB,iBAAiB,EAAE,OAAO,wBAAwB,CAAC;AAAA,IAE1E,UAAU,eAAe;AAAA,MACvB,MAAM,sBAAqB,oBAAI,KAAK,GAAE,YAAY,CAAC;AAAA,MACnD,iBAAiB;AAAA,QACf,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,YAAY;AAAA,MACd;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { isKnownAction } from "../actions";
|
|
2
|
+
import { SharedActionTypes } from "../shared-api";
|
|
3
|
+
import { ReadOnlyActionTypes } from "../actions/internal/read-only-actions";
|
|
4
|
+
function getInitialState(locale = null) {
|
|
5
|
+
return locale;
|
|
6
|
+
}
|
|
7
|
+
function getLocale(state) {
|
|
8
|
+
return state;
|
|
9
|
+
}
|
|
10
|
+
function reducer(state = getInitialState(), action) {
|
|
11
|
+
if (!isKnownAction(action))
|
|
12
|
+
return state;
|
|
13
|
+
switch (action.type) {
|
|
14
|
+
case SharedActionTypes.SET_LOCALE:
|
|
15
|
+
return action.payload.locale;
|
|
16
|
+
case ReadOnlyActionTypes.RESET_LOCALE_STATE:
|
|
17
|
+
return getInitialState();
|
|
18
|
+
default:
|
|
19
|
+
return state;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
getInitialState,
|
|
24
|
+
getLocale,
|
|
25
|
+
reducer
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=locale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/state/modules/locale.ts"],"sourcesContent":["import { type Action, type UnknownAction, isKnownAction } from '../actions'\nimport { SharedActionTypes } from '../shared-api'\nimport { ReadOnlyActionTypes } from '../actions/internal/read-only-actions'\n\nexport type State = string | null\n\nexport function getInitialState(locale: string | null = null): State {\n return locale\n}\n\nexport function getLocale(state: State): string | null {\n return state\n}\n\nexport function reducer(state = getInitialState(), action: Action | UnknownAction): State {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case SharedActionTypes.SET_LOCALE:\n return action.payload.locale\n\n case ReadOnlyActionTypes.RESET_LOCALE_STATE:\n return getInitialState()\n\n default:\n return state\n }\n}\n"],"mappings":"AAAA,SAA0C,qBAAqB;AAC/D,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AAI7B,SAAS,gBAAgB,SAAwB,MAAa;AACnE,SAAO;AACT;AAEO,SAAS,UAAU,OAA6B;AACrD,SAAO;AACT;AAEO,SAAS,QAAQ,QAAQ,gBAAgB,GAAG,QAAuC;AACxF,MAAI,CAAC,cAAc,MAAM;AAAG,WAAO;AAEnC,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,kBAAkB;AACrB,aAAO,OAAO,QAAQ;AAAA,IAExB,KAAK,oBAAoB;AACvB,aAAO,gBAAgB;AAAA,IAEzB;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { isKnownAction } from "../actions";
|
|
2
|
+
import { ReadOnlyActionTypes } from "../actions/internal/read-only-actions";
|
|
3
|
+
function getInitialState(siteVersion = null) {
|
|
4
|
+
return siteVersion;
|
|
5
|
+
}
|
|
6
|
+
function getSiteVersion(state) {
|
|
7
|
+
return state;
|
|
8
|
+
}
|
|
9
|
+
function reducer(state = getInitialState(), action) {
|
|
10
|
+
if (!isKnownAction(action))
|
|
11
|
+
return state;
|
|
12
|
+
switch (action.type) {
|
|
13
|
+
case ReadOnlyActionTypes.SET_SITE_VERSION:
|
|
14
|
+
return action.payload;
|
|
15
|
+
default:
|
|
16
|
+
return state;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
getInitialState,
|
|
21
|
+
getSiteVersion,
|
|
22
|
+
reducer
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=site-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/state/modules/site-version.ts"],"sourcesContent":["import { type SiteVersion } from '../../api/site-version'\nimport { type Action, type UnknownAction, isKnownAction } from '../actions'\nimport { ReadOnlyActionTypes } from '../actions/internal/read-only-actions'\n\nexport type State = SiteVersion | null\n\nexport function getInitialState(siteVersion: SiteVersion | null = null): State {\n return siteVersion\n}\n\nexport function getSiteVersion(state: State): SiteVersion | null {\n return state\n}\n\nexport function reducer(state = getInitialState(), action: Action | UnknownAction): State {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case ReadOnlyActionTypes.SET_SITE_VERSION:\n return action.payload\n\n default:\n return state\n }\n}\n"],"mappings":"AACA,SAA0C,qBAAqB;AAC/D,SAAS,2BAA2B;AAI7B,SAAS,gBAAgB,cAAkC,MAAa;AAC7E,SAAO;AACT;AAEO,SAAS,eAAe,OAAkC;AAC/D,SAAO;AACT;AAEO,SAAS,QAAQ,QAAQ,gBAAgB,GAAG,QAAuC;AACxF,MAAI,CAAC,cAAc,MAAM;AAAG,WAAO;AAEnC,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,oBAAoB;AACvB,aAAO,OAAO;AAAA,IAEhB;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
|
|
@@ -13,8 +13,7 @@ import {
|
|
|
13
13
|
FrameworkContext,
|
|
14
14
|
DefaultHead,
|
|
15
15
|
DefaultHeadSnippet,
|
|
16
|
-
DefaultImage
|
|
17
|
-
versionedFetch
|
|
16
|
+
DefaultImage
|
|
18
17
|
} from "../runtimes/react/components/framework-context";
|
|
19
18
|
import { MakeswiftComponent } from "../runtimes/react/components/MakeswiftComponent";
|
|
20
19
|
import { Page } from "../runtimes/react/components/page";
|
|
@@ -53,7 +52,6 @@ export {
|
|
|
53
52
|
secondsUntilSiteVersionExpiration,
|
|
54
53
|
serializeSiteVersion,
|
|
55
54
|
styleTagHtml,
|
|
56
|
-
toApiRequest
|
|
57
|
-
versionedFetch
|
|
55
|
+
toApiRequest
|
|
58
56
|
};
|
|
59
57
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/unstable-framework-support/index.ts"],"sourcesContent":["export {\n type SiteVersion,\n serializeSiteVersion,\n deserializeSiteVersion,\n secondsUntilSiteVersionExpiration,\n} from '../api/site-version'\n\nexport { type ApiHandlerUserConfig, createApiHandler } from '../api-handler'\nexport { SET_COOKIE_HEADER, cookieSettingOptions } from '../api-handler/cookies'\nexport { REDIRECT_SEARCH_PARAM, redirectLiveHandler } from '../api-handler/handlers/redirect-live'\nexport { toApiRequest, pipeResponseTo } from '../api-handler/node-request-response'\nexport { MAKESWIFT_SITE_VERSION_COOKIE, SearchParams } from '../api-handler/preview'\n\nexport { MakeswiftClient } from '../client'\n\nexport {\n FrameworkContext,\n DefaultHead,\n DefaultHeadSnippet,\n DefaultImage,\n
|
|
1
|
+
{"version":3,"sources":["../../../src/unstable-framework-support/index.ts"],"sourcesContent":["export {\n type SiteVersion,\n serializeSiteVersion,\n deserializeSiteVersion,\n secondsUntilSiteVersionExpiration,\n} from '../api/site-version'\n\nexport { type ApiHandlerUserConfig, createApiHandler } from '../api-handler'\nexport { SET_COOKIE_HEADER, cookieSettingOptions } from '../api-handler/cookies'\nexport { REDIRECT_SEARCH_PARAM, redirectLiveHandler } from '../api-handler/handlers/redirect-live'\nexport { toApiRequest, pipeResponseTo } from '../api-handler/node-request-response'\nexport { MAKESWIFT_SITE_VERSION_COOKIE, SearchParams } from '../api-handler/preview'\n\nexport { MakeswiftClient } from '../client'\n\nexport {\n FrameworkContext,\n DefaultHead,\n DefaultHeadSnippet,\n DefaultImage,\n} from '../runtimes/react/components/framework-context'\n\nexport { MakeswiftComponent } from '../runtimes/react/components/MakeswiftComponent'\nexport { Page } from '../runtimes/react/components/page'\nexport { RuntimeProvider } from '../runtimes/react/components/RuntimeProvider'\nexport { Slot } from '../runtimes/react/components/Slot'\n\nexport {\n createRootStyleCache,\n RootStyleRegistry,\n styleTagHtml,\n StyleTagSSR,\n type RootStyleProps,\n} from '../runtimes/react/root-style-registry'\n\nexport { ReactRuntime } from '../runtimes/react/react-runtime'\n"],"mappings":"AAAA;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAoC,wBAAwB;AAC5D,SAAS,mBAAmB,4BAA4B;AACxD,SAAS,uBAAuB,2BAA2B;AAC3D,SAAS,cAAc,sBAAsB;AAC7C,SAAS,+BAA+B,oBAAoB;AAE5D,SAAS,uBAAuB;AAEhC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,0BAA0B;AACnC,SAAS,YAAY;AACrB,SAAS,uBAAuB;AAChC,SAAS,YAAY;AAErB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP,SAAS,oBAAoB;","names":[]}
|
|
@@ -2,6 +2,7 @@ import { type FetchableValue } from '@makeswift/controls';
|
|
|
2
2
|
import * as MakeswiftApiClient from '../state/makeswift-api-client';
|
|
3
3
|
import { APIResourceType, File, GlobalElement, LocalizedGlobalElement, Page, PagePathnameSlice, Site, Snippet, Swatch, Table, Typography } from './types';
|
|
4
4
|
import { GraphQLClient } from './graphql/client';
|
|
5
|
+
import { SiteVersion } from './site-version';
|
|
5
6
|
export type CacheData = MakeswiftApiClient.SerializedState;
|
|
6
7
|
export declare const CacheData: {
|
|
7
8
|
empty(): CacheData;
|
|
@@ -30,11 +31,12 @@ export declare class MakeswiftHostApiClient {
|
|
|
30
31
|
makeswiftApiClient: MakeswiftApiClient.Store;
|
|
31
32
|
subscribe: MakeswiftApiClient.Store['subscribe'];
|
|
32
33
|
fetch: MakeswiftApiClient.HttpFetch;
|
|
33
|
-
constructor({ uri, fetch, cacheData, locale, }: {
|
|
34
|
+
constructor({ uri, fetch, cacheData, locale, siteVersion, }: {
|
|
34
35
|
uri: string;
|
|
35
36
|
fetch: MakeswiftApiClient.HttpFetch;
|
|
36
37
|
cacheData?: CacheData;
|
|
37
38
|
locale?: string;
|
|
39
|
+
siteVersion: SiteVersion | null;
|
|
38
40
|
});
|
|
39
41
|
readSwatch(swatchId: string): Swatch | null;
|
|
40
42
|
fetchSwatch(swatchId: string): Promise<Swatch | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEzD,OAAO,KAAK,kBAAkB,MAAM,+BAA+B,CAAA;AAKnE,OAAO,EACL,eAAe,EACf,IAAI,EACJ,aAAa,EACb,sBAAsB,EACtB,IAAI,EACJ,iBAAiB,EACjB,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,UAAU,EACX,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAMhD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,MAAM,MAAM,SAAS,GAAG,kBAAkB,CAAC,eAAe,CAAA;AAE1D,eAAO,MAAM,SAAS;aACX,SAAS;CAMnB,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,sBAAsB;IACjC,aAAa,EAAE,aAAa,CAAA;IAC5B,kBAAk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OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI;IAQlC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAMlD,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAOrE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAQrC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAQrC,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI;CAO/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/framework-provider/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAW,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/framework-provider/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAW,MAAM,OAAO,CAAA;AAWvD,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,gBAAgB,GACjB,EAAE,iBAAiB,CAAC;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,2CAanD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeProvider.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/components/RuntimeProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAiB,MAAM,OAAO,CAAA;AAIhD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAQ5D,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,OAAO,EACP,WAAW,EACX,SAAuC,EACvC,SAAuC,EACvC,MAAkB,GACnB,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,OAAO,EAAE,gBAAgB,CAAA;IACzB,WAAW,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAA;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,
|
|
1
|
+
{"version":3,"file":"RuntimeProvider.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/components/RuntimeProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAiB,MAAM,OAAO,CAAA;AAIhD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAQ5D,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,OAAO,EACP,WAAW,EACX,SAAuC,EACvC,SAAuC,EACvC,MAAkB,GACnB,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,OAAO,EAAE,gBAAgB,CAAA;IACzB,WAAW,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAA;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,2CA6BA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type ReactNode, type PropsWithChildren, type CSSProperties, type ComponentPropsWithoutRef, type MouseEvent, type ForwardRefExoticComponent, type RefAttributes } from 'react';
|
|
2
2
|
import { type LinkData } from '@makeswift/prop-controllers';
|
|
3
|
-
import { type Snippet } from '../../../client';
|
|
4
3
|
import { type HttpFetch } from '../../../state/makeswift-api-client';
|
|
5
|
-
import { type
|
|
4
|
+
import { type Snippet } from '../../../client';
|
|
6
5
|
import { BaseHeadSnippet } from './page/HeadSnippet';
|
|
7
6
|
type HeadComponent = (props: {
|
|
8
7
|
children: ReactNode;
|
|
@@ -30,13 +29,12 @@ export type FrameworkContext = {
|
|
|
30
29
|
HeadSnippet: HeadSnippet;
|
|
31
30
|
Image: ImageComponent;
|
|
32
31
|
Link: LinkComponent;
|
|
33
|
-
|
|
32
|
+
fetch: HttpFetch;
|
|
34
33
|
};
|
|
35
34
|
export declare const DefaultHead: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
|
|
36
35
|
export declare const DefaultHeadSnippet: typeof BaseHeadSnippet;
|
|
37
36
|
export declare const DefaultImage: ImageComponent;
|
|
38
37
|
export declare const DefaultLink: LinkComponent;
|
|
39
|
-
export declare const versionedFetch: FrameworkContext['versionedFetch'];
|
|
40
38
|
export declare const FrameworkContext: import("react").Context<FrameworkContext>;
|
|
41
39
|
export {};
|
|
42
40
|
//# sourceMappingURL=framework-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework-context.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/components/framework-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EACf,KAAK,yBAAyB,EAC9B,KAAK,aAAa,EAEnB,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAE3D,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"framework-context.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/components/framework-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EACf,KAAK,yBAAyB,EAC9B,KAAK,aAAa,EAEnB,MAAM,OAAO,CAAA;AAEd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a,CAAA;IACnB,KAAK,EAAE,SAAS,CAAA;CACjB,CAAA;AAGD,eAAO,MAAM,WAAW,GAAI,cAAc,iBAAiB,4CAAoB,CAAA;AAE/E,eAAO,MAAM,kBAAkB,wBAAkB,CAAA;AAEjD,eAAO,MAAM,YAAY,EAAE,cAe1B,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,aAEzB,CAAA;AAED,eAAO,MAAM,gBAAgB,2CAM3B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-api-client.d.ts","sourceRoot":"","sources":["../../../../src/runtimes/react/host-api-client.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAA6B,MAAM,OAAO,CAAA;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"host-api-client.d.ts","sourceRoot":"","sources":["../../../../src/runtimes/react/host-api-client.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAA6B,MAAM,OAAO,CAAA;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAgBzD,wBAAgB,yBAAyB,IAAI,sBAAsB,CAElE;AAED,wBAAgB,8BAA8B,CAAC,EAC7C,MAAM,EACN,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,sBAAsB,CAAA;IAC9B,QAAQ,EAAE,SAAS,CAAA;CACpB,2CAEA"}
|
|
@@ -23,6 +23,8 @@ export declare const ActionTypes: {
|
|
|
23
23
|
readonly UNREGISTER_REACT_COMPONENT: "UNREGISTER_REACT_COMPONENT";
|
|
24
24
|
readonly SET_IS_IN_BUILDER: "SET_IS_IN_BUILDER";
|
|
25
25
|
readonly SET_IS_READ_ONLY: "SET_IS_READ_ONLY";
|
|
26
|
+
readonly SET_SITE_VERSION: "SET_SITE_VERSION";
|
|
27
|
+
readonly RESET_LOCALE_STATE: "RESET_LOCALE_STATE";
|
|
26
28
|
readonly MAKESWIFT_CONNECTION_CHECK: "MAKESWIFT_CONNECTION_CHECK";
|
|
27
29
|
readonly MOUNT_COMPONENT: "MOUNT_COMPONENT";
|
|
28
30
|
readonly UNMOUNT_COMPONENT: "UNMOUNT_COMPONENT";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/state/actions/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,wBAAwB,CAAA;AAC/E,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,aAAa,CAAA;AAE9D,OAAO,EAAE,KAAK,cAAc,EAAuB,MAAM,YAAY,CAAA;AAErE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA;AAEpD,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/state/actions/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,wBAAwB,CAAA;AAC/E,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,aAAa,CAAA;AAE9D,OAAO,EAAE,KAAK,cAAc,EAAuB,MAAM,YAAY,CAAA;AAErE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA;AAEpD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAId,CAAA;AAEV,MAAM,MAAM,MAAM,GAAG,UAAU,GAAG,aAAa,GAAG,cAAc,CAAA;AAEhE,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,MAAM,CAE/D"}
|
|
@@ -20,6 +20,8 @@ export declare const InternalActionTypes: {
|
|
|
20
20
|
readonly UNREGISTER_REACT_COMPONENT: "UNREGISTER_REACT_COMPONENT";
|
|
21
21
|
readonly SET_IS_IN_BUILDER: "SET_IS_IN_BUILDER";
|
|
22
22
|
readonly SET_IS_READ_ONLY: "SET_IS_READ_ONLY";
|
|
23
|
+
readonly SET_SITE_VERSION: "SET_SITE_VERSION";
|
|
24
|
+
readonly RESET_LOCALE_STATE: "RESET_LOCALE_STATE";
|
|
23
25
|
};
|
|
24
26
|
export type InternalAction = ReadOnlyAction | ReadWriteAction;
|
|
25
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/state/actions/internal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAuB,MAAM,qBAAqB,CAAA;AAC9E,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,sBAAsB,CAAA;AAEjF,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/state/actions/internal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAuB,MAAM,qBAAqB,CAAA;AAC9E,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,sBAAsB,CAAA;AAEjF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;CAGtB,CAAA;AAEV,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,eAAe,CAAA"}
|
|
@@ -2,6 +2,7 @@ import { type ThunkAction } from '@reduxjs/toolkit';
|
|
|
2
2
|
import { ControlInstance } from '@makeswift/controls';
|
|
3
3
|
import { ElementImperativeHandle } from '../../../runtimes/react/element-imperative-handle';
|
|
4
4
|
import { type APIResource, APIResourceType, APIResourceLocale } from '../../../api/types';
|
|
5
|
+
import { type SiteVersion } from '../../../api/site-version';
|
|
5
6
|
import { type Descriptor as PropControllerDescriptor } from '../../../prop-controllers/descriptors';
|
|
6
7
|
import { type ComponentMeta } from '../../modules/components-meta';
|
|
7
8
|
import { type PropControllersHandle } from '../../modules/prop-controller-handles';
|
|
@@ -24,6 +25,8 @@ export declare const ReadOnlyActionTypes: {
|
|
|
24
25
|
readonly UNREGISTER_REACT_COMPONENT: "UNREGISTER_REACT_COMPONENT";
|
|
25
26
|
readonly SET_IS_IN_BUILDER: "SET_IS_IN_BUILDER";
|
|
26
27
|
readonly SET_IS_READ_ONLY: "SET_IS_READ_ONLY";
|
|
28
|
+
readonly SET_SITE_VERSION: "SET_SITE_VERSION";
|
|
29
|
+
readonly RESET_LOCALE_STATE: "RESET_LOCALE_STATE";
|
|
27
30
|
};
|
|
28
31
|
type APIResourceFulfilledAction = {
|
|
29
32
|
type: typeof ReadOnlyActionTypes.API_RESOURCE_FULFILLED;
|
|
@@ -127,7 +130,14 @@ type SetIsReadOnlyAction = {
|
|
|
127
130
|
type: typeof ReadOnlyActionTypes.SET_IS_READ_ONLY;
|
|
128
131
|
payload: boolean;
|
|
129
132
|
};
|
|
130
|
-
|
|
133
|
+
type SetSiteVersionAction = {
|
|
134
|
+
type: typeof ReadOnlyActionTypes.SET_SITE_VERSION;
|
|
135
|
+
payload: SiteVersion | null;
|
|
136
|
+
};
|
|
137
|
+
type ResetLocaleStateAction = {
|
|
138
|
+
type: typeof ReadOnlyActionTypes.RESET_LOCALE_STATE;
|
|
139
|
+
};
|
|
140
|
+
export type ReadOnlyAction = APIResourceFulfilledAction | CreateElementTreeAction | DeleteElementTreeAction | RegisterComponentAction | UnregisterComponentAction | RegisterComponentHandleAction | UnregisterComponentHandleAction | RegisterPropControllersHandleAction | UnregisterPropControllersHandleAction | RegisterPropControllersAction | UnregisterPropControllersAction | RegisterReactComponentAction | UnregisterReactComponentAction | SetIsInBuilderAction | SetIsReadOnlyAction | SetSiteVersionAction | ResetLocaleStateAction;
|
|
131
141
|
export declare function apiResourceFulfilled<T extends APIResourceType>(resourceType: T, resourceId: string, resource: APIResource | null, locale?: APIResourceLocale<T>): APIResourceFulfilledAction;
|
|
132
142
|
export declare function createElementTree(payload: CreateElementTreeAction['payload']): CreateElementTreeAction;
|
|
133
143
|
export declare function deleteElementTree(payload: DeleteElementTreeAction['payload']): DeleteElementTreeAction;
|
|
@@ -143,5 +153,7 @@ export declare function unregisterPropControllers(documentKey: string, elementKe
|
|
|
143
153
|
export declare function registerReactComponentEffect(type: string, component: ComponentType): ThunkAction<() => void, unknown, unknown, ReadOnlyAction>;
|
|
144
154
|
export declare function setIsInBuilder(isInBuilder: boolean): SetIsInBuilderAction;
|
|
145
155
|
export declare function setIsReadOnly(isReadOnly: boolean): SetIsReadOnlyAction;
|
|
156
|
+
export declare function setSiteVersion(siteVersion: SiteVersion | null): SetSiteVersionAction;
|
|
157
|
+
export declare function resetLocaleState(): ResetLocaleStateAction;
|
|
146
158
|
export {};
|
|
147
159
|
//# sourceMappingURL=read-only-actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-only-actions.d.ts","sourceRoot":"","sources":["../../../../../src/state/actions/internal/read-only-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAA;AAE3F,OAAO,EAAE,KAAK,WAAW,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACzF,OAAO,EAAE,KAAK,UAAU,IAAI,wBAAwB,EAAE,MAAM,uCAAuC,CAAA;AAEnG,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAClE,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAClF,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,gCAAgC,CAAA;AAEhF,OAAO,EAAE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BAAsB,CAEzD"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { type ThunkAction, type ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';
|
|
2
|
+
import * as SiteVersionState from './modules/site-version';
|
|
3
|
+
import * as LocaleState from './modules/locale';
|
|
2
4
|
import * as APIResources from './modules/api-resources';
|
|
3
5
|
import * as LocalizedResourcesMap from './modules/localized-resources-map';
|
|
4
6
|
import { type Action } from './actions';
|
|
5
7
|
import { APIResourceType, type APIResource, type APIResourceLocale } from '../api';
|
|
6
8
|
declare const reducer: import("@reduxjs/toolkit").Reducer<{
|
|
9
|
+
siteVersion: SiteVersionState.State;
|
|
10
|
+
locale: LocaleState.State;
|
|
7
11
|
apiResources: APIResources.State;
|
|
8
12
|
localizedResourcesMap: Map<string, Map<string, string | null>>;
|
|
9
13
|
}, Action | UnknownAction, Partial<{
|
|
14
|
+
siteVersion: SiteVersionState.State | undefined;
|
|
15
|
+
locale: LocaleState.State | undefined;
|
|
10
16
|
apiResources: APIResources.State | undefined;
|
|
11
17
|
localizedResourcesMap: Map<string, Map<string, string | null>> | undefined;
|
|
12
18
|
}>>;
|
|
@@ -25,14 +31,17 @@ type Thunk<ReturnType> = ThunkAction<ReturnType, State, unknown, Action>;
|
|
|
25
31
|
export declare function fetchAPIResource<T extends APIResourceType>(resourceType: T, resourceId: string, fetch: HttpFetch, locale?: APIResourceLocale<T>): Thunk<Promise<Extract<APIResource, {
|
|
26
32
|
__typename: T;
|
|
27
33
|
}> | null>>;
|
|
28
|
-
export declare function configureStore({
|
|
29
|
-
defaultLocale: string | undefined;
|
|
34
|
+
export declare function configureStore({ serializedState }: {
|
|
30
35
|
serializedState?: SerializedState;
|
|
31
36
|
}): import("@reduxjs/toolkit").EnhancedStore<{
|
|
37
|
+
siteVersion: SiteVersionState.State;
|
|
38
|
+
locale: LocaleState.State;
|
|
32
39
|
apiResources: APIResources.State;
|
|
33
40
|
localizedResourcesMap: Map<string, Map<string, string | null>>;
|
|
34
41
|
}, Action | UnknownAction, import("@reduxjs/toolkit").Tuple<[import("@reduxjs/toolkit").StoreEnhancer<{
|
|
35
42
|
dispatch: ThunkDispatch<{
|
|
43
|
+
siteVersion: SiteVersionState.State;
|
|
44
|
+
locale: LocaleState.State;
|
|
36
45
|
apiResources: APIResources.State;
|
|
37
46
|
localizedResourcesMap: Map<string, Map<string, string | null>>;
|
|
38
47
|
}, undefined, UnknownAction>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeswift-api-client.d.ts","sourceRoot":"","sources":["../../../src/state/makeswift-api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAClB,aAAa,EACd,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"makeswift-api-client.d.ts","sourceRoot":"","sources":["../../../src/state/makeswift-api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAClB,aAAa,EACd,MAAM,kBAAkB,CAAA;AAIzB,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,YAAY,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,qBAAqB,MAAM,mCAAmC,CAAA;AAE1E,OAAO,EAAE,KAAK,MAAM,EAAe,MAAM,WAAW,CAAA;AAKpD,OAAO,EACL,eAAe,EACf,KAAK,WAAW,EAQhB,KAAK,iBAAiB,EACvB,MAAM,QAAQ,CAAA;AAEf,QAAA,MAAM,OAAO;;;;;;;;;;GAKX,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAA;AAC9C,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;AAC5D,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAA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AAc,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Action, type UnknownAction } from '../actions';
|
|
2
|
+
export type State = string | null;
|
|
3
|
+
export declare function getInitialState(locale?: string | null): State;
|
|
4
|
+
export declare function getLocale(state: State): string | null;
|
|
5
|
+
export declare function reducer(state: State | undefined, action: Action | UnknownAction): State;
|
|
6
|
+
//# sourceMappingURL=locale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../../../../src/state/modules/locale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAiB,MAAM,YAAY,CAAA;AAI3E,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,IAAI,CAAA;AAEjC,wBAAgB,eAAe,CAAC,MAAM,GAAE,MAAM,GAAG,IAAW,GAAG,KAAK,CAEnE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAErD;AAED,wBAAgB,OAAO,CAAC,KAAK,mBAAoB,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,KAAK,CAaxF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type SiteVersion } from '../../api/site-version';
|
|
2
|
+
import { type Action, type UnknownAction } from '../actions';
|
|
3
|
+
export type State = SiteVersion | null;
|
|
4
|
+
export declare function getInitialState(siteVersion?: SiteVersion | null): State;
|
|
5
|
+
export declare function getSiteVersion(state: State): SiteVersion | null;
|
|
6
|
+
export declare function reducer(state: State | undefined, action: Action | UnknownAction): State;
|
|
7
|
+
//# sourceMappingURL=site-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-version.d.ts","sourceRoot":"","sources":["../../../../src/state/modules/site-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAiB,MAAM,YAAY,CAAA;AAG3E,MAAM,MAAM,KAAK,GAAG,WAAW,GAAG,IAAI,CAAA;AAEtC,wBAAgB,eAAe,CAAC,WAAW,GAAE,WAAW,GAAG,IAAW,GAAG,KAAK,CAE7E;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,GAAG,IAAI,CAE/D;AAED,wBAAgB,OAAO,CAAC,KAAK,mBAAoB,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,KAAK,CAUxF"}
|
|
@@ -5,7 +5,7 @@ export { REDIRECT_SEARCH_PARAM, redirectLiveHandler } from '../api-handler/handl
|
|
|
5
5
|
export { toApiRequest, pipeResponseTo } from '../api-handler/node-request-response';
|
|
6
6
|
export { MAKESWIFT_SITE_VERSION_COOKIE, SearchParams } from '../api-handler/preview';
|
|
7
7
|
export { MakeswiftClient } from '../client';
|
|
8
|
-
export { FrameworkContext, DefaultHead, DefaultHeadSnippet, DefaultImage,
|
|
8
|
+
export { FrameworkContext, DefaultHead, DefaultHeadSnippet, DefaultImage, } from '../runtimes/react/components/framework-context';
|
|
9
9
|
export { MakeswiftComponent } from '../runtimes/react/components/MakeswiftComponent';
|
|
10
10
|
export { Page } from '../runtimes/react/components/page';
|
|
11
11
|
export { RuntimeProvider } from '../runtimes/react/components/RuntimeProvider';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/unstable-framework-support/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,KAAK,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAC5E,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAChF,OAAO,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