@decocms/start 1.6.0 → 1.6.2
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/package.json +1 -1
- package/src/cms/resolve.ts +4 -0
- package/src/sdk/setupApps.ts +16 -7
package/package.json
CHANGED
package/src/cms/resolve.ts
CHANGED
|
@@ -1506,7 +1506,11 @@ export async function resolveDeferredSection(
|
|
|
1506
1506
|
ensureInitialized();
|
|
1507
1507
|
|
|
1508
1508
|
const ctx: MatcherContext = { ...matcherCtx, path: pagePath };
|
|
1509
|
+
// Recover routeParams from the page match so nested `requestToParam`
|
|
1510
|
+
// resolvers (e.g. `:slug` on PDPs) return the right value.
|
|
1511
|
+
const match = findPageByPath(pagePath);
|
|
1509
1512
|
const rctx: ResolveContext = {
|
|
1513
|
+
routeParams: match?.params,
|
|
1510
1514
|
matcherCtx: ctx,
|
|
1511
1515
|
memo: new Map(),
|
|
1512
1516
|
depth: 0,
|
package/src/sdk/setupApps.ts
CHANGED
|
@@ -209,19 +209,28 @@ export async function setupApps(
|
|
|
209
209
|
registerAppCommerceHandlers(appWithHandlers.handlers);
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
// 2. Flatten manifest modules → individual invoke handlers
|
|
213
|
-
//
|
|
214
|
-
//
|
|
212
|
+
// 2. Flatten manifest modules → individual invoke handlers.
|
|
213
|
+
//
|
|
214
|
+
// Convention (mirrors legacy deco-cx/apps):
|
|
215
|
+
// - `default` export is registered at the moduleKey itself.
|
|
216
|
+
// shopify/loaders/ProductList.ts (default) → key "shopify/loaders/ProductList"
|
|
217
|
+
// - Named function exports are registered at `${moduleKey}/${fnName}`.
|
|
218
|
+
// vtex/actions/checkout.ts ({ getOrCreateCart, addItemsToCart })
|
|
219
|
+
// → keys "vtex/actions/checkout/getOrCreateCart", ".../addItemsToCart"
|
|
220
|
+
// - Each key also gets a `.ts` sibling for callers that include the
|
|
221
|
+
// extension (admin invoke path, some __resolveType producers).
|
|
215
222
|
for (const category of ["loaders", "actions"] as const) {
|
|
216
223
|
const modules = app.manifest[category];
|
|
217
224
|
if (!modules) continue;
|
|
218
225
|
|
|
219
226
|
for (const [moduleKey, moduleExports] of Object.entries(modules)) {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
)) {
|
|
227
|
+
const exports = moduleExports as Record<string, unknown>;
|
|
228
|
+
|
|
229
|
+
for (const [fnName, fn] of Object.entries(exports)) {
|
|
223
230
|
if (typeof fn !== "function") continue;
|
|
224
|
-
const key =
|
|
231
|
+
const key = fnName === "default"
|
|
232
|
+
? moduleKey
|
|
233
|
+
: `${moduleKey}/${fnName}`;
|
|
225
234
|
const handler = (props: any, req: Request) =>
|
|
226
235
|
(fn as Function)(props, req);
|
|
227
236
|
registerInvokeHandlers({
|