@decocms/start 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/skills/deco-api-call-dedup/SKILL.md +443 -0
- package/.cursor/skills/deco-apps-architecture/SKILL.md +255 -0
- package/.cursor/skills/deco-apps-architecture/app-pattern.md +288 -0
- package/.cursor/skills/deco-apps-architecture/commerce-types.md +239 -0
- package/.cursor/skills/deco-apps-architecture/new-app-guide.md +268 -0
- package/.cursor/skills/deco-apps-architecture/scripts-codegen.md +148 -0
- package/.cursor/skills/deco-apps-architecture/shared-utils.md +181 -0
- package/.cursor/skills/deco-apps-architecture/vtex-deep-structure.md +253 -0
- package/.cursor/skills/deco-apps-architecture/website-app.md +169 -0
- package/.cursor/skills/deco-apps-vtex-porting/SKILL.md +189 -0
- package/.cursor/skills/deco-apps-vtex-porting/adaptation-patterns.md +335 -0
- package/.cursor/skills/deco-apps-vtex-porting/commerce-porting.md +155 -0
- package/.cursor/skills/deco-apps-vtex-porting/cookie-auth-patterns.md +148 -0
- package/.cursor/skills/deco-apps-vtex-porting/structure-map.md +234 -0
- package/.cursor/skills/deco-apps-vtex-porting/transform-mapping.md +99 -0
- package/.cursor/skills/deco-apps-vtex-porting/website-porting.md +194 -0
- package/.cursor/skills/deco-apps-vtex-review/SKILL.md +234 -0
- package/.cursor/skills/deco-async-rendering-architecture/SKILL.md +270 -0
- package/.cursor/skills/deco-async-rendering-site-guide/SKILL.md +417 -0
- package/.cursor/skills/deco-cms-layout-caching/SKILL.md +293 -0
- package/.cursor/skills/deco-cms-route-config/SKILL.md +388 -0
- package/.cursor/skills/deco-core-architecture/SKILL.md +185 -0
- package/.cursor/skills/deco-core-architecture/blocks.md +196 -0
- package/.cursor/skills/deco-core-architecture/deco-vs-deco-start.md +191 -0
- package/.cursor/skills/deco-core-architecture/engine.md +220 -0
- package/.cursor/skills/deco-core-architecture/hooks-components.md +157 -0
- package/.cursor/skills/deco-core-architecture/plugins-clients.md +136 -0
- package/.cursor/skills/deco-core-architecture/runtime.md +116 -0
- package/.cursor/skills/deco-core-architecture/site-usage.md +165 -0
- package/.cursor/skills/deco-e2e-testing/SKILL.md +372 -0
- package/.cursor/skills/deco-e2e-testing/discovery.md +337 -0
- package/.cursor/skills/deco-e2e-testing/scripts/scaffold.sh +81 -0
- package/.cursor/skills/deco-e2e-testing/selectors.md +175 -0
- package/.cursor/skills/deco-e2e-testing/templates/package.json +18 -0
- package/.cursor/skills/deco-e2e-testing/templates/playwright.config.ts +65 -0
- package/.cursor/skills/deco-e2e-testing/templates/scripts/baseline.ts +279 -0
- package/.cursor/skills/deco-e2e-testing/templates/scripts/run-e2e.ts +194 -0
- package/.cursor/skills/deco-e2e-testing/templates/specs/ecommerce-flow.spec.ts +612 -0
- package/.cursor/skills/deco-e2e-testing/templates/tsconfig.json +12 -0
- package/.cursor/skills/deco-e2e-testing/templates/utils/metrics-collector.ts +918 -0
- package/.cursor/skills/deco-e2e-testing/troubleshooting.md +602 -0
- package/.cursor/skills/deco-edge-caching/SKILL.md +316 -0
- package/.cursor/skills/deco-full-analysis/SKILL.md +898 -0
- package/.cursor/skills/deco-full-analysis/checklists/asset-optimization.md +251 -0
- package/.cursor/skills/deco-full-analysis/checklists/bug-fix.md +189 -0
- package/.cursor/skills/deco-full-analysis/checklists/cache-strategy.md +144 -0
- package/.cursor/skills/deco-full-analysis/checklists/dependency-update.md +150 -0
- package/.cursor/skills/deco-full-analysis/checklists/hydration-fix.md +191 -0
- package/.cursor/skills/deco-full-analysis/checklists/image-optimization.md +180 -0
- package/.cursor/skills/deco-full-analysis/checklists/loader-optimization.md +165 -0
- package/.cursor/skills/deco-full-analysis/checklists/seo-fix.md +183 -0
- package/.cursor/skills/deco-full-analysis/checklists/site-cleanup.md +281 -0
- package/.cursor/skills/deco-full-analysis/discovery.md +548 -0
- package/.cursor/skills/deco-incident-debugging/SKILL.md +378 -0
- package/.cursor/skills/deco-incident-debugging/headless-mode.md +510 -0
- package/.cursor/skills/deco-incident-debugging/learnings-index.md +227 -0
- package/.cursor/skills/deco-incident-debugging/triage-workflow.md +312 -0
- package/.cursor/skills/deco-islands-migration/SKILL.md +251 -0
- package/.cursor/skills/deco-loader-n-plus-1-detector/SKILL.md +275 -0
- package/.cursor/skills/deco-performance-audit/SKILL.md +530 -0
- package/.cursor/skills/deco-performance-audit/tools-reference.md +428 -0
- package/.cursor/skills/deco-performance-audit/workflow.md +457 -0
- package/.cursor/skills/deco-server-functions-invoke/SKILL.md +92 -0
- package/.cursor/skills/deco-server-functions-invoke/architecture.md +166 -0
- package/.cursor/skills/deco-server-functions-invoke/generator.md +122 -0
- package/.cursor/skills/deco-server-functions-invoke/problem.md +98 -0
- package/.cursor/skills/deco-server-functions-invoke/troubleshooting.md +110 -0
- package/.cursor/skills/deco-site-deployment/SKILL.md +396 -0
- package/.cursor/skills/deco-site-memory-debugging/SKILL.md +121 -0
- package/.cursor/skills/deco-site-memory-debugging/cdp-connection.md +222 -0
- package/.cursor/skills/deco-site-memory-debugging/memory-analysis.md +362 -0
- package/.cursor/skills/deco-site-patterns/SKILL.md +124 -0
- package/.cursor/skills/deco-site-patterns/app-composition.md +337 -0
- package/.cursor/skills/deco-site-patterns/client-patterns.md +341 -0
- package/.cursor/skills/deco-site-patterns/cms-wiring.md +230 -0
- package/.cursor/skills/deco-site-patterns/section-patterns.md +340 -0
- package/.cursor/skills/deco-site-scaling-tuning/SKILL.md +240 -0
- package/.cursor/skills/deco-site-scaling-tuning/analysis-scripts.md +267 -0
- package/.cursor/skills/deco-start-architecture/SKILL.md +218 -0
- package/.cursor/skills/deco-start-architecture/admin-protocol.md +156 -0
- package/.cursor/skills/deco-start-architecture/cms-resolution.md +201 -0
- package/.cursor/skills/deco-start-architecture/code-quality.md +158 -0
- package/.cursor/skills/deco-start-architecture/gap-analysis.md +129 -0
- package/.cursor/skills/deco-start-architecture/sdk-utilities.md +197 -0
- package/.cursor/skills/deco-start-architecture/worker-entry-caching.md +154 -0
- package/.cursor/skills/deco-startup-analysis/SKILL.md +248 -0
- package/.cursor/skills/deco-storefront-test-checklist/SKILL.md +369 -0
- package/.cursor/skills/deco-tanstack-hydration-fixes/SKILL.md +468 -0
- package/.cursor/skills/deco-tanstack-navigation/SKILL.md +681 -0
- package/.cursor/skills/deco-tanstack-search/SKILL.md +411 -0
- package/.cursor/skills/deco-tanstack-storefront-patterns/SKILL.md +1013 -0
- package/.cursor/skills/deco-to-tanstack-migration/SKILL.md +518 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/codemod-commands.md +174 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/commerce/README.md +78 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/deco-framework/README.md +128 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/gotchas.md +719 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/imports/README.md +70 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/platform-hooks/README.md +154 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/signals/README.md +220 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/vite-config/README.md +78 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/package-json.md +55 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/root-route.md +110 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/router.md +96 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/setup-ts.md +167 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/vite-config.md +122 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/worker-entry.md +67 -0
- package/.cursor/skills/deco-typescript-fixes/SKILL.md +178 -0
- package/.cursor/skills/deco-typescript-fixes/common-fixes.md +330 -0
- package/.cursor/skills/deco-typescript-fixes/strategy.md +148 -0
- package/.cursor/skills/deco-variant-selection-perf/SKILL.md +272 -0
- package/.cursor/skills/deco-vtex-fetch-cache/SKILL.md +225 -0
- package/.cursor/skills/find-skills/SKILL.md +133 -0
- package/.cursor/skills/incident-report/SKILL.md +179 -0
- package/.cursor/skills/incident-report/references/5-whys.md +75 -0
- package/.cursor/skills/incident-report/templates/client-report.md +187 -0
- package/.cursor/skills/incident-report/templates/internal-report.md +206 -0
- package/.cursor/skills/template-skill/SKILL.md +38 -0
- package/.github/workflows/release.yml +32 -0
- package/.releaserc.json +25 -0
- package/CLAUDE.md +135 -0
- package/GAP_ANALYSIS.md +224 -0
- package/GAP_ANALYSIS_V2.md +1013 -0
- package/biome.json +39 -0
- package/knip.json +5 -0
- package/package.json +87 -0
- package/scripts/generate-blocks.ts +69 -0
- package/scripts/generate-invoke.ts +378 -0
- package/scripts/generate-schema.ts +657 -0
- package/src/admin/cors.ts +29 -0
- package/src/admin/decofile.ts +72 -0
- package/src/admin/index.ts +24 -0
- package/src/admin/invoke.ts +163 -0
- package/src/admin/liveControls.ts +29 -0
- package/src/admin/meta.ts +70 -0
- package/src/admin/render.ts +205 -0
- package/src/admin/schema.ts +686 -0
- package/src/admin/setup.ts +44 -0
- package/src/cms/index.ts +59 -0
- package/src/cms/loader.ts +180 -0
- package/src/cms/registry.ts +162 -0
- package/src/cms/resolve.ts +1005 -0
- package/src/cms/sectionLoaders.ts +294 -0
- package/src/hooks/DecoPageRenderer.tsx +444 -0
- package/src/hooks/LazySection.tsx +109 -0
- package/src/hooks/LiveControls.tsx +108 -0
- package/src/hooks/SectionErrorFallback.tsx +85 -0
- package/src/hooks/index.ts +8 -0
- package/src/index.ts +5 -0
- package/src/matchers/builtins.ts +184 -0
- package/src/matchers/posthog.ts +154 -0
- package/src/middleware/decoState.ts +55 -0
- package/src/middleware/healthMetrics.ts +131 -0
- package/src/middleware/index.ts +80 -0
- package/src/middleware/liveness.ts +21 -0
- package/src/middleware/observability.ts +205 -0
- package/src/routes/adminRoutes.ts +83 -0
- package/src/routes/cmsRoute.ts +302 -0
- package/src/routes/components.tsx +34 -0
- package/src/routes/index.ts +15 -0
- package/src/sdk/analytics.ts +72 -0
- package/src/sdk/cacheHeaders.ts +268 -0
- package/src/sdk/cachedLoader.ts +206 -0
- package/src/sdk/clx.ts +3 -0
- package/src/sdk/cookie.ts +39 -0
- package/src/sdk/createInvoke.ts +57 -0
- package/src/sdk/csp.ts +59 -0
- package/src/sdk/env.ts +27 -0
- package/src/sdk/index.ts +63 -0
- package/src/sdk/instrumentedFetch.ts +137 -0
- package/src/sdk/invoke.ts +133 -0
- package/src/sdk/mergeCacheControl.ts +150 -0
- package/src/sdk/redirects.ts +217 -0
- package/src/sdk/requestContext.ts +184 -0
- package/src/sdk/serverTimings.ts +68 -0
- package/src/sdk/signal.ts +41 -0
- package/src/sdk/sitemap.ts +143 -0
- package/src/sdk/urlUtils.ts +117 -0
- package/src/sdk/useDevice.ts +82 -0
- package/src/sdk/useId.ts +7 -0
- package/src/sdk/useScript.ts +101 -0
- package/src/sdk/workerEntry.ts +703 -0
- package/src/sdk/wrapCaughtErrors.ts +107 -0
- package/src/types/index.ts +39 -0
- package/src/types/widgets.ts +13 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# Structure Map: deco-cx/apps → apps-start
|
|
2
|
+
|
|
3
|
+
File-by-file mapping showing what exists, what's missing, and what needs improvement.
|
|
4
|
+
|
|
5
|
+
## Legend
|
|
6
|
+
|
|
7
|
+
- ✅ Ported and verified
|
|
8
|
+
- ⚠️ Ported but needs review/improvements
|
|
9
|
+
- ❌ Missing — needs to be created
|
|
10
|
+
- 🔀 Consolidated into another file
|
|
11
|
+
- ➖ Not needed in TanStack (platform-specific)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Root Files
|
|
16
|
+
|
|
17
|
+
| Original (apps/vtex/) | apps-start (vtex/) | Status |
|
|
18
|
+
|----------------------|-------------------|--------|
|
|
19
|
+
| `mod.ts` | `index.ts` + `client.ts` (configureVtex) | ⚠️ mod.ts creates 7 typed clients; apps-start has vtexFetch only |
|
|
20
|
+
| `manifest.gen.ts` | `package.json` exports | ✅ Different approach, OK |
|
|
21
|
+
| `runtime.ts` | Not needed | ➖ No invoke proxy in TanStack |
|
|
22
|
+
| `middleware.ts` | `middleware.ts` | ⚠️ Simplified version, missing full segment bag |
|
|
23
|
+
| `README.md` | `README.md` | ✅ |
|
|
24
|
+
|
|
25
|
+
## Actions
|
|
26
|
+
|
|
27
|
+
### Cart (Original: 16 files → apps-start: 1 file `checkout.ts`)
|
|
28
|
+
|
|
29
|
+
| Original | apps-start | Status |
|
|
30
|
+
|----------|-----------|--------|
|
|
31
|
+
| `actions/cart/addItems.ts` | `actions/checkout.ts` → `addItems()` | ✅ |
|
|
32
|
+
| `actions/cart/updateItems.ts` | `actions/checkout.ts` → `updateItems()` | ✅ |
|
|
33
|
+
| `actions/cart/removeItems.ts` | `actions/checkout.ts` → `removeAllItems()` | ✅ |
|
|
34
|
+
| `actions/cart/updateCoupons.ts` | `actions/checkout.ts` → `updateCoupons()` | ✅ |
|
|
35
|
+
| `actions/cart/updateAttachment.ts` | `actions/checkout.ts` → `sendAttachment()` | ✅ |
|
|
36
|
+
| `actions/cart/updateItemAttachment.ts` | `actions/checkout.ts` → `updateItemAttachment()` | ✅ |
|
|
37
|
+
| `actions/cart/removeItemAttachment.ts` | `actions/checkout.ts` → `removeItemAttachment()` | ✅ |
|
|
38
|
+
| `actions/cart/updateItemPrice.ts` | `actions/checkout.ts` → `changePrice()` | ✅ |
|
|
39
|
+
| `actions/cart/updateProfile.ts` | `actions/checkout.ts` → `ignoreProfileData()` | ✅ |
|
|
40
|
+
| `actions/cart/updateUser.ts` | `actions/checkout.ts` → `removeAllPersonalData()` | ✅ |
|
|
41
|
+
| `actions/cart/addOfferings.ts` | `actions/checkout.ts` → `addOfferings()` | ⚠️ Verify logic matches |
|
|
42
|
+
| `actions/cart/removeOffering.ts` | `actions/checkout.ts` → `removeOffering()` | ⚠️ Verify logic matches |
|
|
43
|
+
| `actions/cart/getInstallment.ts` | `actions/checkout.ts` → `getInstallments()` | ⚠️ Verify logic matches |
|
|
44
|
+
| `actions/cart/updateGifts.ts` | `actions/checkout.ts` → `updateGifts()` | ⚠️ Verify logic matches |
|
|
45
|
+
| `actions/cart/clearOrderformMessages.ts` | `actions/checkout.ts` → `clearMessages()` | ✅ |
|
|
46
|
+
| `actions/cart/simulation.ts` | `actions/checkout.ts` → `simulation()` | ⚠️ Verify |
|
|
47
|
+
|
|
48
|
+
### Authentication (Original: 8 files → apps-start: 1 file `auth.ts`)
|
|
49
|
+
|
|
50
|
+
| Original | apps-start | Status |
|
|
51
|
+
|----------|-----------|--------|
|
|
52
|
+
| `actions/authentication/startAuthentication.ts` | `actions/auth.ts` → `startAuthentication()` | ✅ |
|
|
53
|
+
| `actions/authentication/classicSignIn.ts` | `actions/auth.ts` → `classicSignIn()` | ✅ |
|
|
54
|
+
| `actions/authentication/accessKeySignIn.ts` | `actions/auth.ts` → `accessKeySignIn()` | ✅ |
|
|
55
|
+
| `actions/authentication/sendEmailVerification.ts` | `actions/auth.ts` → `sendEmailVerification()` | ✅ |
|
|
56
|
+
| `actions/authentication/recoveryPassword.ts` | `actions/auth.ts` → `recoveryPassword()` | ✅ |
|
|
57
|
+
| `actions/authentication/resetPassword.ts` | `actions/auth.ts` → `resetPassword()` | ✅ |
|
|
58
|
+
| `actions/authentication/refreshToken.ts` | `actions/auth.ts` → `refreshToken()` | ⚠️ Verify |
|
|
59
|
+
| `actions/authentication/logout.ts` | `actions/auth.ts` → `logout()` | ✅ |
|
|
60
|
+
|
|
61
|
+
### Other Actions (Original: 13 files → apps-start: 9 files)
|
|
62
|
+
|
|
63
|
+
| Original | apps-start | Status |
|
|
64
|
+
|----------|-----------|--------|
|
|
65
|
+
| `actions/session/createSession.ts` | `actions/session.ts` | ✅ |
|
|
66
|
+
| `actions/session/editSession.ts` | `actions/session.ts` | ✅ |
|
|
67
|
+
| `actions/session/deleteSession.ts` | `actions/session.ts` | ✅ |
|
|
68
|
+
| `actions/address/create.ts` | `actions/address.ts` | ✅ |
|
|
69
|
+
| `actions/address/update.ts` | `actions/address.ts` | ✅ |
|
|
70
|
+
| `actions/address/delete.ts` | `actions/address.ts` | ✅ |
|
|
71
|
+
| `actions/newsletter/subscribe.ts` | `actions/newsletter.ts` | ✅ |
|
|
72
|
+
| `actions/newsletter/updateNewsletterOptIn.ts` | `actions/newsletter.ts` | ✅ |
|
|
73
|
+
| `actions/wishlist/addItem.ts` | `actions/wishlist.ts` | ✅ |
|
|
74
|
+
| `actions/wishlist/removeItem.ts` | `actions/wishlist.ts` | ✅ |
|
|
75
|
+
| `actions/orders/cancel.ts` | `actions/orders.ts` | ✅ |
|
|
76
|
+
| `actions/profile/updateProfile.ts` | `actions/profile.ts` | ✅ |
|
|
77
|
+
| `actions/review/submit.ts` | `actions/misc.ts` → `submitReview()` | ✅ |
|
|
78
|
+
| `actions/payment/deletePaymentToken.ts` | `actions/misc.ts` → `deletePaymentToken()` | ✅ |
|
|
79
|
+
| `actions/notifyme.ts` | `actions/misc.ts` → `notifyMe()` | ✅ |
|
|
80
|
+
| `actions/trigger.ts` | `actions/trigger.ts` | ✅ |
|
|
81
|
+
| `actions/masterdata/createDocument.ts` | `actions/masterData.ts` | ⚠️ Verify completeness |
|
|
82
|
+
| `actions/masterdata/updateDocument.ts` | `actions/masterData.ts` | ⚠️ Verify completeness |
|
|
83
|
+
| `actions/analytics/sendEvent.ts` | `actions/misc.ts` → `sendEvent()` | ✅ |
|
|
84
|
+
|
|
85
|
+
## Loaders
|
|
86
|
+
|
|
87
|
+
### Intelligent Search (Original: 6 files → apps-start: `search.ts` + inline-loaders)
|
|
88
|
+
|
|
89
|
+
| Original | apps-start | Status |
|
|
90
|
+
|----------|-----------|--------|
|
|
91
|
+
| `loaders/intelligentSearch/productDetailsPage.ts` | `inline-loaders/productDetailsPage.ts` | ✅ |
|
|
92
|
+
| `loaders/intelligentSearch/productListingPage.ts` | `inline-loaders/productListingPage.ts` | ✅ |
|
|
93
|
+
| `loaders/intelligentSearch/productList.ts` | `inline-loaders/productList.ts` | ✅ |
|
|
94
|
+
| `loaders/intelligentSearch/suggestions.ts` | `inline-loaders/suggestions.ts` | ✅ |
|
|
95
|
+
| `loaders/intelligentSearch/topsearches.ts` | `loaders/search.ts` → `getTopSearches()` | ✅ |
|
|
96
|
+
| `loaders/intelligentSearch/productSearchValidator.ts` | ❌ Missing | ❌ |
|
|
97
|
+
|
|
98
|
+
### Legacy Catalog (Original: 7 files → apps-start: `legacy.ts` + `catalog.ts`)
|
|
99
|
+
|
|
100
|
+
| Original | apps-start | Status |
|
|
101
|
+
|----------|-----------|--------|
|
|
102
|
+
| `loaders/legacy/productDetailsPage.ts` | `loaders/legacy.ts` | ✅ |
|
|
103
|
+
| `loaders/legacy/productListingPage.ts` | `loaders/legacy.ts` | ✅ |
|
|
104
|
+
| `loaders/legacy/productList.ts` | `loaders/legacy.ts` | ✅ |
|
|
105
|
+
| `loaders/legacy/suggestions.ts` | `loaders/legacy.ts` → `legacySuggestions()` | ✅ |
|
|
106
|
+
| `loaders/legacy/relatedProductsLoader.ts` | `inline-loaders/relatedProducts.ts` + `loaders/catalog.ts` | ✅ |
|
|
107
|
+
| `loaders/legacy/brands.ts` | `loaders/brands.ts` | ✅ |
|
|
108
|
+
| `loaders/legacy/pageType.ts` | `loaders/pageType.ts` | ✅ |
|
|
109
|
+
|
|
110
|
+
### Other Loaders
|
|
111
|
+
|
|
112
|
+
| Original | apps-start | Status |
|
|
113
|
+
|----------|-----------|--------|
|
|
114
|
+
| `loaders/cart.ts` | `loaders/cart.ts` | ✅ |
|
|
115
|
+
| `loaders/user.ts` | `loaders/user.ts` | ✅ |
|
|
116
|
+
| `loaders/wishlist.ts` | `loaders/wishlist.ts` | ✅ |
|
|
117
|
+
| `loaders/navbar.ts` | `loaders/navbar.ts` | ✅ |
|
|
118
|
+
| `loaders/proxy.ts` | `utils/proxy.ts` | ⚠️ Different location |
|
|
119
|
+
| `loaders/config.ts` | `client.ts` (getVtexConfig) | 🔀 |
|
|
120
|
+
| `loaders/categories/tree.ts` | `loaders/catalog.ts` → `getCategoryTree()` | ✅ |
|
|
121
|
+
| `loaders/collections/list.ts` | `loaders/collections.ts` | ✅ |
|
|
122
|
+
| `loaders/logistics/getSalesChannelById.ts` | `loaders/logistics.ts` | ⚠️ Verify |
|
|
123
|
+
| `loaders/logistics/listPickupPoints.ts` | `loaders/logistics.ts` | ⚠️ Verify |
|
|
124
|
+
| `loaders/logistics/listPickupPointsByLocation.ts` | `loaders/logistics.ts` | ⚠️ Verify |
|
|
125
|
+
| `loaders/logistics/listSalesChannelById.ts` | `loaders/logistics.ts` | ⚠️ Verify |
|
|
126
|
+
| `loaders/logistics/listStockByStore.ts` | `loaders/logistics.ts` | ⚠️ Verify |
|
|
127
|
+
| `loaders/orders/getById.ts` | `loaders/orders.ts` | ⚠️ Verify |
|
|
128
|
+
| `loaders/orders/list.ts` | `loaders/orders.ts` | ⚠️ Verify |
|
|
129
|
+
| `loaders/orders/orderplaced.ts` | `loaders/orders.ts` | ⚠️ Verify |
|
|
130
|
+
| `loaders/payment/paymentSystems.ts` | `loaders/payment.ts` | ⚠️ Verify |
|
|
131
|
+
| `loaders/payment/userPayments.ts` | `loaders/payment.ts` | ⚠️ Verify |
|
|
132
|
+
| `loaders/profile/getCurrentProfile.ts` | `loaders/profile.ts` | ⚠️ Verify |
|
|
133
|
+
| `loaders/profile/getProfileByEmail.ts` | `loaders/profile.ts` | ⚠️ Verify |
|
|
134
|
+
| `loaders/session/getSession.ts` | `loaders/session.ts` | ⚠️ Verify |
|
|
135
|
+
| `loaders/session/getUserSessions.ts` | `loaders/session.ts` | ⚠️ Verify |
|
|
136
|
+
| `loaders/address/getAddressByPostalCode.ts` | `loaders/address.ts` | ⚠️ Verify |
|
|
137
|
+
| `loaders/address/getUserAddresses.ts` | `loaders/address.ts` | ⚠️ Verify |
|
|
138
|
+
| `loaders/masterdata/searchDocuments.ts` | ❌ Missing | ❌ |
|
|
139
|
+
| `loaders/options/productIdByTerm.ts` | ❌ Missing | ❌ |
|
|
140
|
+
| `loaders/promotion/getPromotionById.ts` | `loaders/promotion.ts` | ⚠️ Verify |
|
|
141
|
+
| `loaders/workflow/product.ts` | `loaders/workflow.ts` | ✅ |
|
|
142
|
+
| `loaders/workflow/products.ts` | `loaders/workflow.ts` | ✅ |
|
|
143
|
+
| `loaders/paths/PDPDefaultPath.ts` | ❌ Missing (storefront handles routing) | ➖ |
|
|
144
|
+
| `loaders/paths/PLPDefaultPath.ts` | ❌ Missing (storefront handles routing) | ➖ |
|
|
145
|
+
| `loaders/product/extend.ts` | ❌ Missing | ❌ |
|
|
146
|
+
| `loaders/product/extensions/*` (4 files) | ❌ Missing (extensions are framework-specific) | ➖ |
|
|
147
|
+
| `loaders/product/wishlist.ts` | ❌ Missing | ❌ |
|
|
148
|
+
|
|
149
|
+
## Utils
|
|
150
|
+
|
|
151
|
+
| Original | apps-start | Status |
|
|
152
|
+
|----------|-----------|--------|
|
|
153
|
+
| `utils/transform.ts` | `utils/transform.ts` | ✅ Ported and verified |
|
|
154
|
+
| `utils/types.ts` | `utils/types.ts` | ✅ |
|
|
155
|
+
| `utils/client.ts` | `client.ts` (vtexFetch, etc.) | ⚠️ Different approach — no typed Proxy |
|
|
156
|
+
| `utils/fetchVTEX.ts` | Part of `client.ts` | 🔀 URL sanitization may be missing |
|
|
157
|
+
| `utils/cookies.ts` | `utils/cookies.ts` | ✅ |
|
|
158
|
+
| `utils/vtexId.ts` | `utils/vtexId.ts` | ✅ |
|
|
159
|
+
| `utils/orderForm.ts` | Part of `loaders/cart.ts` + `hooks/useCart.ts` | ⚠️ Split across files |
|
|
160
|
+
| `utils/segment.ts` | `utils/segment.ts` | ⚠️ Simplified, missing full serialization |
|
|
161
|
+
| `utils/intelligentSearch.ts` | `utils/intelligentSearch.ts` | ✅ |
|
|
162
|
+
| `utils/legacy.ts` | `utils/legacy.ts` | ⚠️ Verify completeness |
|
|
163
|
+
| `utils/similars.ts` | `utils/similars.ts` | ✅ |
|
|
164
|
+
| `utils/batch.ts` | `utils/batch.ts` | ⚠️ Verify |
|
|
165
|
+
| `utils/cacheBySegment.ts` | ❌ Missing (caching handled differently) | ➖ |
|
|
166
|
+
| `utils/resourceRange.ts` | ❌ Missing | ❌ |
|
|
167
|
+
| `utils/slugify.ts` | `utils/slugify.ts` | ✅ |
|
|
168
|
+
| `utils/pickAndOmit.ts` | `utils/pickAndOmit.ts` | ✅ |
|
|
169
|
+
| `utils/extensions/simulation.ts` | `utils/enrichment.ts` | 🔀 |
|
|
170
|
+
| `utils/login/getLoginCookies.ts` | Part of `actions/auth.ts` | 🔀 |
|
|
171
|
+
| `utils/login/setLoginCookies.ts` | Part of `actions/auth.ts` | 🔀 |
|
|
172
|
+
| `utils/openapi/*.gen.ts` (12 files) | Not needed (no OpenAPI codegen) | ➖ |
|
|
173
|
+
|
|
174
|
+
## Hooks
|
|
175
|
+
|
|
176
|
+
| Original | apps-start | Status |
|
|
177
|
+
|----------|-----------|--------|
|
|
178
|
+
| `hooks/context.ts` | Not needed (react-query manages state) | ➖ |
|
|
179
|
+
| `hooks/useCart.ts` | `hooks/useCart.ts` | ✅ React Query version |
|
|
180
|
+
| `hooks/useUser.ts` | `hooks/useUser.ts` | ✅ |
|
|
181
|
+
| `hooks/useWishlist.ts` | `hooks/useWishlist.ts` | ✅ |
|
|
182
|
+
| `hooks/useAutocomplete.ts` | ❌ Missing | ❌ Should add |
|
|
183
|
+
|
|
184
|
+
## Other
|
|
185
|
+
|
|
186
|
+
| Original | apps-start | Status |
|
|
187
|
+
|----------|-----------|--------|
|
|
188
|
+
| `handlers/sitemap.ts` | `utils/sitemap.ts` | ⚠️ Different location |
|
|
189
|
+
| `sections/Analytics/Vtex.tsx` | ❌ Missing (storefront handles analytics) | ➖ |
|
|
190
|
+
| `components/VTEXPortalDataLayerCompatibility.tsx` | ❌ Not needed | ➖ |
|
|
191
|
+
| `workflows/events.ts` | Not applicable | ➖ |
|
|
192
|
+
| `workflows/product/index.ts` | Not applicable | ➖ |
|
|
193
|
+
| `preview/Preview.tsx` | Not applicable | ➖ |
|
|
194
|
+
|
|
195
|
+
## Commerce Module
|
|
196
|
+
|
|
197
|
+
| Original (apps/commerce/) | apps-start (commerce/) | Status |
|
|
198
|
+
|--------------------------|----------------------|--------|
|
|
199
|
+
| `types.ts` (786 lines) | `types/commerce.ts` | ✅ Same types |
|
|
200
|
+
| `mod.ts` | Not applicable | ➖ |
|
|
201
|
+
| `utils/canonical.ts` | `utils/canonical.ts` | ✅ |
|
|
202
|
+
| `utils/constants.ts` | `utils/constants.ts` | ✅ |
|
|
203
|
+
| `utils/filters.ts` | `utils/filters.ts` | ✅ |
|
|
204
|
+
| `utils/productToAnalyticsItem.ts` | `utils/productToAnalyticsItem.ts` | ✅ |
|
|
205
|
+
| `utils/stateByZip.ts` | `utils/stateByZip.ts` | ✅ |
|
|
206
|
+
| `loaders/extensions/*` | ❌ Missing (framework-specific) | ➖ |
|
|
207
|
+
| `sections/Seo/*` | ❌ Not needed (storefront handles SEO) | ➖ |
|
|
208
|
+
| **SDK (NEW in apps-start)** | | |
|
|
209
|
+
| N/A (was in site sdk/) | `sdk/useOffer.ts` | ✅ |
|
|
210
|
+
| N/A | `sdk/useVariantPossibilities.ts` | ✅ |
|
|
211
|
+
| N/A | `sdk/formatPrice.ts` | ✅ |
|
|
212
|
+
| N/A | `sdk/url.ts` (relative) | ✅ |
|
|
213
|
+
| N/A | `sdk/analytics.ts` | ✅ |
|
|
214
|
+
| N/A | `components/Image.tsx` | ✅ |
|
|
215
|
+
| N/A | `components/JsonLd.tsx` | ✅ |
|
|
216
|
+
|
|
217
|
+
## Shared Utils
|
|
218
|
+
|
|
219
|
+
| Original (apps/utils/) | apps-start | Status |
|
|
220
|
+
|------------------------|-----------|--------|
|
|
221
|
+
| `http.ts` (createHttpClient) | Not needed (vtexFetch replaces it) | ➖ |
|
|
222
|
+
| `graphql.ts` (createGraphqlClient) | `client.ts` → vtexIOGraphQL | 🔀 |
|
|
223
|
+
| `fetch.ts` (fetchSafe, retry) | `client.ts` → vtexFetch (no retry) | ⚠️ Missing retry logic |
|
|
224
|
+
| `cookie.ts` (proxySetCookie) | `client.ts` → vtexFetchWithCookies | 🔀 Different approach |
|
|
225
|
+
| `normalize.ts` (removeDirtyCookies) | ❌ Missing | ⚠️ Should add URL sanitization |
|
|
226
|
+
|
|
227
|
+
## Priority Missing Items
|
|
228
|
+
|
|
229
|
+
1. **`utils/fetchVTEX.ts` URL sanitization** — original sanitizes UTM params, `ft` param. apps-start doesn't
|
|
230
|
+
2. **Retry logic** — original uses cockatiel ExponentialBackoff. apps-start has no retry
|
|
231
|
+
3. **`hooks/useAutocomplete.ts`** — client-side autocomplete hook
|
|
232
|
+
4. **`loaders/masterdata/searchDocuments.ts`** — MasterData search
|
|
233
|
+
5. **`loaders/product/extend.ts`** — Product enrichment loader
|
|
234
|
+
6. **Segment cookie serialization** — original has stable serialization for cache hits
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# transform.ts — VTEX → schema.org Mapping Reference
|
|
2
|
+
|
|
3
|
+
Complete field-by-field mapping from VTEX API types to schema.org commerce types.
|
|
4
|
+
|
|
5
|
+
## toProduct() — VTEX → schema.org Product
|
|
6
|
+
|
|
7
|
+
| VTEX Field | schema.org Field | Notes |
|
|
8
|
+
|-----------|-----------------|-------|
|
|
9
|
+
| `sku.itemId` | `productID`, `sku` | SKU identifier |
|
|
10
|
+
| `sku.name` | `name` | SKU name |
|
|
11
|
+
| `sku.complementName` | `alternateName` | |
|
|
12
|
+
| `product.description` | `description` | |
|
|
13
|
+
| `product.brand` | `brand.name` | Wrapped in Brand object |
|
|
14
|
+
| `product.brandId` | `brand.@id` | |
|
|
15
|
+
| `product.brandImageUrl` | `brand.logo` | |
|
|
16
|
+
| `sku.ean` | `gtin` | |
|
|
17
|
+
| `product.releaseDate` | `releaseDate` | |
|
|
18
|
+
| `product.categories[0]` | `category` | Split by `/`, joined with `>` |
|
|
19
|
+
| `product.productId` | `inProductGroupWithID` | |
|
|
20
|
+
| `product.productReference` | `isVariantOf.model` | |
|
|
21
|
+
|
|
22
|
+
## buildOffer() — VTEX Seller → schema.org Offer
|
|
23
|
+
|
|
24
|
+
| VTEX Field | schema.org Field | Notes |
|
|
25
|
+
|-----------|-----------------|-------|
|
|
26
|
+
| `sellerId` | `seller` | **MUST be ID, not name** |
|
|
27
|
+
| `sellerName` | `sellerName` | Display name |
|
|
28
|
+
| `sellerDefault` | `identifier: "default"` | Only when true |
|
|
29
|
+
| `commertialOffer.spotPrice ?? Price` | `price` | Spot price preferred |
|
|
30
|
+
| `commertialOffer.PriceValidUntil` | `priceValidUntil` | |
|
|
31
|
+
| `commertialOffer.AvailableQuantity` | `inventoryLevel.value` | |
|
|
32
|
+
| `commertialOffer.AvailableQuantity > 0` | `availability` | InStock / OutOfStock |
|
|
33
|
+
| `commertialOffer.GiftSkuIds` | `giftSkuIds` | |
|
|
34
|
+
| `commertialOffer.teasers` | `teasers` | |
|
|
35
|
+
|
|
36
|
+
## priceSpecification — Prices and Installments
|
|
37
|
+
|
|
38
|
+
| VTEX Field | priceType | Notes |
|
|
39
|
+
|-----------|-----------|-------|
|
|
40
|
+
| `ListPrice` | `https://schema.org/ListPrice` | Original price |
|
|
41
|
+
| `Price` | `https://schema.org/SalePrice` | Sale price |
|
|
42
|
+
| `PriceWithoutDiscount` | `https://schema.org/SRP` | Suggested retail |
|
|
43
|
+
| `Installments[]` | `https://schema.org/Installment` | Each installment option |
|
|
44
|
+
|
|
45
|
+
### Installment Mapping
|
|
46
|
+
|
|
47
|
+
| VTEX Installment | UnitPriceSpecification |
|
|
48
|
+
|-----------------|----------------------|
|
|
49
|
+
| `PaymentSystemName` | `name` |
|
|
50
|
+
| `Name` | `description` |
|
|
51
|
+
| `NumberOfInstallments` | `billingDuration` |
|
|
52
|
+
| `Value` | `billingIncrement` |
|
|
53
|
+
| `TotalValuePlusInterestRate` | `price` |
|
|
54
|
+
|
|
55
|
+
## Images
|
|
56
|
+
|
|
57
|
+
| VTEX Field | schema.org ImageObject |
|
|
58
|
+
|-----------|----------------------|
|
|
59
|
+
| `imageUrl` | `url` |
|
|
60
|
+
| `imageText` or `imageLabel` | `alternateName` |
|
|
61
|
+
| `imageLabel` | `name` |
|
|
62
|
+
| (fixed) | `encodingFormat: "image"` |
|
|
63
|
+
|
|
64
|
+
## isVariantOf — ProductGroup
|
|
65
|
+
|
|
66
|
+
| VTEX Field | schema.org ProductGroup |
|
|
67
|
+
|-----------|----------------------|
|
|
68
|
+
| `product.productId` | `productGroupID` |
|
|
69
|
+
| `product.items` → each via `toProduct(level=1)` | `hasVariant` |
|
|
70
|
+
| `/{linkText}/p` | `url` |
|
|
71
|
+
| `product.productName` | `name` |
|
|
72
|
+
| `product.productReference` | `model` |
|
|
73
|
+
|
|
74
|
+
`level` prevents infinite recursion: `level=0` includes `isVariantOf`, `level=1` sets it to `undefined`.
|
|
75
|
+
|
|
76
|
+
## Breadcrumbs
|
|
77
|
+
|
|
78
|
+
| Source | ListItem |
|
|
79
|
+
|--------|----------|
|
|
80
|
+
| `categories[0]` split by `/` | Each segment → `name`, `position`, `item` (URL) |
|
|
81
|
+
| `productName` | Last item → URL = `/{linkText}/p` |
|
|
82
|
+
|
|
83
|
+
## isLegacyProduct Detection
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
product.origin !== "intelligent-search" → Legacy (uses toOfferLegacy)
|
|
87
|
+
product.origin === "intelligent-search" → IS (uses toOffer)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Both `toOffer` and `toOfferLegacy` call `buildOffer()` internally, ensuring `seller: sellerId`.
|
|
91
|
+
|
|
92
|
+
## additionalProperty Sources
|
|
93
|
+
|
|
94
|
+
- SKU variations (SPECIFICATION)
|
|
95
|
+
- Product categories (CATEGORY)
|
|
96
|
+
- Product clusters (CLUSTER)
|
|
97
|
+
- Reference IDs (ReferenceID)
|
|
98
|
+
- Estimated date arrival
|
|
99
|
+
- Modal type
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Website Module Porting
|
|
2
|
+
|
|
3
|
+
How the `website/` app from `deco-cx/apps` maps to `@decocms/start` and the storefront.
|
|
4
|
+
|
|
5
|
+
## Architecture Split
|
|
6
|
+
|
|
7
|
+
The original `website/` app is a monolith handling routing, SEO, analytics, images, themes, A/B testing, matchers, and more. In TanStack, these responsibilities are split across three layers:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
Original (apps/website/) TanStack Split
|
|
11
|
+
════════════════════════ ══════════════
|
|
12
|
+
handlers/router.ts → TanStack Router (file-based routing)
|
|
13
|
+
handlers/proxy.ts → @decocms/start/sdk/workerEntry (Cloudflare Worker)
|
|
14
|
+
handlers/redirect.ts → @decocms/start/sdk/redirects
|
|
15
|
+
handlers/sitemap.ts → @decocms/start/sdk/sitemap
|
|
16
|
+
handlers/fresh.ts → Not needed (TanStack replaces Fresh)
|
|
17
|
+
|
|
18
|
+
loaders/pages.ts → @decocms/start/cms/loader (loadBlocks)
|
|
19
|
+
loaders/fonts/* → Storefront CSS (Tailwind/Vite handles fonts)
|
|
20
|
+
loaders/image/* → Storefront component (Image.tsx)
|
|
21
|
+
loaders/redirects.ts → @decocms/start/sdk/redirects
|
|
22
|
+
loaders/secret.ts → process.env / Cloudflare secrets
|
|
23
|
+
loaders/asset.ts → Vite handles static assets
|
|
24
|
+
loaders/environment.ts → process.env
|
|
25
|
+
|
|
26
|
+
components/Analytics.tsx → Storefront: ~/components/Analytics.tsx
|
|
27
|
+
components/Image.tsx → Storefront: ~/components/ui/Image.tsx
|
|
28
|
+
components/Video.tsx → Storefront: ~/components/ui/Video.tsx
|
|
29
|
+
components/Theme.tsx → Storefront: ~/components/ui/Theme.tsx
|
|
30
|
+
components/_seo/* → Storefront: ~/components/Seo.tsx
|
|
31
|
+
components/Events.tsx → @decocms/apps/commerce/sdk/analytics
|
|
32
|
+
components/Clickhouse.tsx → Not needed (different observability)
|
|
33
|
+
|
|
34
|
+
sections/Analytics/* → Storefront sections
|
|
35
|
+
sections/Rendering/* → @decocms/start/hooks/LazySection
|
|
36
|
+
sections/Seo/* → Storefront sections
|
|
37
|
+
|
|
38
|
+
flags/audience.ts → @decocms/start/matchers/builtins
|
|
39
|
+
matchers/* → @decocms/start/matchers/*
|
|
40
|
+
mod.ts → @decocms/start (the framework package itself)
|
|
41
|
+
types.ts → @decocms/start/types
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## What @decocms/start Provides
|
|
45
|
+
|
|
46
|
+
The `deco-start` package (`@decocms/start`) IS the TanStack equivalent of `website/`:
|
|
47
|
+
|
|
48
|
+
| Capability | website/ | @decocms/start |
|
|
49
|
+
|-----------|----------|----------------|
|
|
50
|
+
| CMS page resolution | `handlers/router.ts` | `cms/loader.ts` (loadBlocks) |
|
|
51
|
+
| Section rendering | Fresh island hydration | `hooks/DecoPageRenderer.tsx` |
|
|
52
|
+
| Lazy loading | Fresh partials | `hooks/LazySection.tsx` |
|
|
53
|
+
| Live editing | Fresh middleware | `hooks/LiveControls.tsx` |
|
|
54
|
+
| Admin protocol | N/A (Deco runtime) | `admin/` (meta, decofile, invoke, render) |
|
|
55
|
+
| Schema generation | `@deco/deco/scripts/bundle` | `scripts/generate-schema.ts` |
|
|
56
|
+
| Worker entry | N/A | `sdk/workerEntry.ts` (createDecoWorkerEntry) |
|
|
57
|
+
| Edge caching | N/A | `sdk/cacheHeaders.ts`, `sdk/mergeCacheControl.ts` |
|
|
58
|
+
| Redirects | `handlers/redirect.ts` | `sdk/redirects.ts` |
|
|
59
|
+
| Sitemap | `handlers/sitemap.ts` | `sdk/sitemap.ts` |
|
|
60
|
+
| Matchers | `matchers/*` | `matchers/builtins.ts`, `matchers/posthog.ts` |
|
|
61
|
+
| Script injection | `@deco/deco/hooks` (useScript) | `sdk/useScript.ts` |
|
|
62
|
+
| Signals | `@preact/signals` | `sdk/signal.ts` (TanStack Store wrapper) |
|
|
63
|
+
| CSS class helper | N/A | `sdk/clx.ts` |
|
|
64
|
+
| Cookie utilities | `../utils/cookie.ts` | `sdk/cookie.ts` |
|
|
65
|
+
| Analytics | `components/Events.tsx` | `sdk/analytics.ts` |
|
|
66
|
+
| ID generation | N/A | `sdk/useId.ts` |
|
|
67
|
+
| CSP | N/A | `sdk/csp.ts` |
|
|
68
|
+
| Server timings | N/A | `sdk/serverTimings.ts` |
|
|
69
|
+
| Observability | N/A | `middleware/observability.ts` |
|
|
70
|
+
|
|
71
|
+
## What the Storefront Provides
|
|
72
|
+
|
|
73
|
+
Each site creates these locally (NOT in a shared package):
|
|
74
|
+
|
|
75
|
+
### Routing
|
|
76
|
+
```
|
|
77
|
+
src/routes/
|
|
78
|
+
├── __root.tsx # Root layout (html, head, body)
|
|
79
|
+
├── index.tsx # Homepage
|
|
80
|
+
├── $.tsx # Catch-all (CMS pages, PDP, PLP)
|
|
81
|
+
└── deco/ # Admin API routes
|
|
82
|
+
├── meta.ts
|
|
83
|
+
├── decofile.ts
|
|
84
|
+
└── render.ts
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Components (from website/)
|
|
88
|
+
```
|
|
89
|
+
src/components/
|
|
90
|
+
├── ui/
|
|
91
|
+
│ ├── Image.tsx # From website/components/Image.tsx
|
|
92
|
+
│ ├── Video.tsx # From website/components/Video.tsx
|
|
93
|
+
│ └── Theme.tsx # From website/components/Theme.tsx (usually a stub)
|
|
94
|
+
├── Seo.tsx # From website/components/_seo/*
|
|
95
|
+
└── Analytics.tsx # From website/components/Analytics.tsx
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Setup (from website/mod.ts)
|
|
99
|
+
```typescript
|
|
100
|
+
// src/setup.ts — registers everything
|
|
101
|
+
import { setMetaData, setInvokeLoaders, setRenderShell } from "@decocms/start/admin";
|
|
102
|
+
import { setBlocks } from "@decocms/start/cms";
|
|
103
|
+
import metaData from "./meta.gen.json";
|
|
104
|
+
import blocks from "./.deco/blocks/index.ts";
|
|
105
|
+
|
|
106
|
+
// Register CMS blocks
|
|
107
|
+
setBlocks(blocks);
|
|
108
|
+
|
|
109
|
+
// Register schema for admin
|
|
110
|
+
setMetaData(metaData);
|
|
111
|
+
|
|
112
|
+
// Register loaders for admin invoke
|
|
113
|
+
setInvokeLoaders({
|
|
114
|
+
"vtex/loaders/productDetailsPage": (props) => vtexProductDetailsPage(props),
|
|
115
|
+
// ...
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Configure preview shell
|
|
119
|
+
setRenderShell({
|
|
120
|
+
css: appCss,
|
|
121
|
+
fonts: ["https://fonts.googleapis.com/css2?family=..."],
|
|
122
|
+
theme: "light",
|
|
123
|
+
bodyClass: "bg-base-100 text-base-content",
|
|
124
|
+
lang: "pt-BR",
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Proxy Handler → Worker Entry
|
|
129
|
+
|
|
130
|
+
The original `handlers/proxy.ts` is a reverse proxy for VTEX checkout/API. In TanStack, this lives in the Cloudflare Worker entry:
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
// src/worker-entry.ts
|
|
134
|
+
import { createDecoWorkerEntry } from "@decocms/start/sdk/workerEntry";
|
|
135
|
+
|
|
136
|
+
export default createDecoWorkerEntry(serverEntry, {
|
|
137
|
+
admin: { handleMeta, handleDecofileRead, handleRender, corsHeaders },
|
|
138
|
+
// VTEX proxy paths are configured here or in route handlers
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
VTEX checkout proxy (`/checkout/*`, `/api/*`) can be handled:
|
|
143
|
+
1. As TanStack route handlers (`src/routes/api/$.ts`)
|
|
144
|
+
2. In the Worker entry before TanStack handles the request
|
|
145
|
+
3. Via Cloudflare Workers routes in `wrangler.jsonc`
|
|
146
|
+
|
|
147
|
+
## Matchers → Storefront + @decocms/start
|
|
148
|
+
|
|
149
|
+
Original matchers (device, cookie, date, etc.) are used for audience targeting. In TanStack:
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
// @decocms/start/matchers/builtins.ts provides:
|
|
153
|
+
// - device detection
|
|
154
|
+
// - cookie matching
|
|
155
|
+
// - random percentage
|
|
156
|
+
// etc.
|
|
157
|
+
|
|
158
|
+
// Storefront can extend with custom matchers
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## SEO
|
|
162
|
+
|
|
163
|
+
Original: `sections/Seo/*` + `components/_seo/*` provide SEO meta tags via Deco sections.
|
|
164
|
+
|
|
165
|
+
TanStack: Each route handles its own SEO via TanStack Router's `meta` or a local `<Seo>` component:
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
// src/routes/$.tsx (catch-all)
|
|
169
|
+
export const Route = createFileRoute("/$")({
|
|
170
|
+
component: CatchAllPage,
|
|
171
|
+
head: ({ loaderData }) => ({
|
|
172
|
+
meta: [
|
|
173
|
+
{ title: loaderData?.seo?.title },
|
|
174
|
+
{ name: "description", content: loaderData?.seo?.description },
|
|
175
|
+
],
|
|
176
|
+
}),
|
|
177
|
+
});
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Summary: What to Port Where
|
|
181
|
+
|
|
182
|
+
| Original website/ file | Goes to | Layer |
|
|
183
|
+
|------------------------|---------|-------|
|
|
184
|
+
| `mod.ts` Props | `src/setup.ts` | Storefront |
|
|
185
|
+
| `handlers/router.ts` | TanStack file routing | Storefront |
|
|
186
|
+
| `handlers/proxy.ts` | Worker entry / route handlers | Storefront |
|
|
187
|
+
| `handlers/sitemap.ts` | `@decocms/start/sdk/sitemap` | Framework |
|
|
188
|
+
| `handlers/redirect.ts` | `@decocms/start/sdk/redirects` | Framework |
|
|
189
|
+
| `loaders/pages.ts` | `@decocms/start/cms/loader` | Framework |
|
|
190
|
+
| `matchers/*` | `@decocms/start/matchers/*` | Framework |
|
|
191
|
+
| `components/Image.tsx` | `~/components/ui/Image.tsx` | Storefront |
|
|
192
|
+
| `components/_seo/*` | `~/components/Seo.tsx` | Storefront |
|
|
193
|
+
| `sections/*` | `~/sections/*` | Storefront |
|
|
194
|
+
| `flags/*` | `@decocms/start/matchers/*` | Framework |
|