@salesforce/b2c-dx-mcp 3.2.1 → 3.4.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.
Files changed (333) hide show
  1. package/bin/run.js +5 -9
  2. package/content/guidance/b2c/b2c-hooks/references/ORDER-HOOK-LIFECYCLE.md +1 -1
  3. package/content/guidance/b2c/b2c-onboarding/SKILL.md +4 -4
  4. package/content/guidance/b2c/b2c-ordering/SKILL.md +2 -2
  5. package/content/guidance/b2c/b2c-querying-data/SKILL.md +2 -2
  6. package/content/guidance/b2c/b2c-scapi-admin/SKILL.md +3 -3
  7. package/content/guidance/b2c/b2c-scapi-admin/references/CLIENT-EXAMPLES.md +4 -4
  8. package/content/guidance/b2c/b2c-scapi-shopper/SKILL.md +6 -6
  9. package/content/guidance/b2c/b2c-scapi-shopper/references/CLIENT-EXAMPLES.md +8 -9
  10. package/content/guidance/b2c-cli/b2c-cip/SKILL.md +3 -3
  11. package/content/guidance/b2c-cli/b2c-cip/references/SALES_ANALYSIS.md +1 -1
  12. package/content/guidance/b2c-cli/b2c-config/SKILL.md +54 -25
  13. package/content/guidance/b2c-cli/b2c-content/SKILL.md +1 -1
  14. package/content/guidance/b2c-cli/b2c-debug/SKILL.md +1 -1
  15. package/content/guidance/b2c-cli/b2c-docs/SKILL.md +23 -2
  16. package/content/guidance/b2c-cli/b2c-ecdn/SKILL.md +2 -0
  17. package/content/guidance/b2c-cli/b2c-ecdn/references/ADVANCED.md +1 -1
  18. package/content/guidance/b2c-cli/b2c-job/SKILL.md +9 -3
  19. package/content/guidance/b2c-cli/b2c-job/references/IMPORT.md +1 -1
  20. package/content/guidance/b2c-cli/b2c-job/references/RUN-AND-MONITOR.md +35 -6
  21. package/content/guidance/b2c-cli/b2c-metrics/SKILL.md +1 -1
  22. package/content/guidance/b2c-cli/b2c-mrt/SKILL.md +3 -3
  23. package/content/guidance/b2c-cli/b2c-scapi-custom/SKILL.md +1 -1
  24. package/content/guidance/b2c-cli/b2c-scapi-schemas/SKILL.md +6 -2
  25. package/content/guidance/b2c-cli/b2c-site-import-export/SKILL.md +1 -1
  26. package/content/guidance/b2c-cli/b2c-sites/SKILL.md +1 -1
  27. package/content/guidance/b2c-cli/b2c-slas/SKILL.md +1 -1
  28. package/content/guidance/b2c-ops/b2c-checkout-triage/SKILL.md +2 -2
  29. package/content/guidance/b2c-ops/b2c-edge-traffic-triage/SKILL.md +69 -0
  30. package/content/guidance/b2c-ops/b2c-job-health/SKILL.md +13 -8
  31. package/content/guidance/b2c-ops/b2c-order-failure-triage/SKILL.md +1 -1
  32. package/content/guidance/b2c-ops/b2c-order-failure-triage/references/order-evidence.md +2 -2
  33. package/content/guidance/b2c-ops/b2c-production-triage/SKILL.md +5 -4
  34. package/content/guidance/index.json +981 -259
  35. package/content/guidance/mcp/{cip → b2c-mcp-cip}/SKILL.md +10 -8
  36. package/content/guidance/mcp/{b2c-config → b2c-mcp-config}/SKILL.md +10 -9
  37. package/content/guidance/mcp/{debugger → b2c-mcp-debugger}/SKILL.md +9 -8
  38. package/content/guidance/mcp/b2c-mcp-scapi/SKILL.md +98 -0
  39. package/content/guidance/mcp/b2c-mcp-scapi/references/authentication.md +34 -0
  40. package/content/guidance/mcp/b2c-mcp-scapi/references/compose-verify.md +25 -0
  41. package/content/guidance/mcp/b2c-mcp-scapi/references/confirmation.md +30 -0
  42. package/content/guidance/mcp/b2c-mcp-scapi/references/discover.md +94 -0
  43. package/content/guidance/mcp/b2c-mcp-scapi/references/jobs.md +72 -0
  44. package/content/guidance/mcp/b2c-mcp-scapi/references/workflows.md +28 -0
  45. package/content/guidance/mcp/{server → b2c-mcp-server}/SKILL.md +52 -25
  46. package/content/guidance/storefront-next/sfnext-accessibility/SKILL.md +103 -0
  47. package/content/guidance/storefront-next/sfnext-accessibility/references/checklist.md +64 -0
  48. package/content/guidance/storefront-next/sfnext-analytics-consent/SKILL.md +91 -0
  49. package/content/guidance/storefront-next/sfnext-analytics-consent/references/CUSTOM-ADAPTER.md +49 -0
  50. package/content/guidance/storefront-next/sfnext-authentication/SKILL.md +86 -79
  51. package/content/guidance/storefront-next/sfnext-authentication/references/COOKIES.md +39 -0
  52. package/content/guidance/storefront-next/sfnext-authentication/references/LOGIN-FLOWS.md +59 -0
  53. package/content/guidance/storefront-next/sfnext-commerce-features/SKILL.md +67 -0
  54. package/content/guidance/storefront-next/sfnext-commerce-features/references/FEATURE-PREREQUISITES.md +37 -0
  55. package/content/guidance/storefront-next/sfnext-components/SKILL.md +98 -136
  56. package/content/guidance/storefront-next/sfnext-components/references/COMPONENT-AUTHORING.md +118 -0
  57. package/content/guidance/storefront-next/sfnext-components/references/SHAPE-TOKENS.md +51 -0
  58. package/content/guidance/storefront-next/sfnext-components/references/STORYBOOK.md +54 -0
  59. package/content/guidance/storefront-next/sfnext-components/references/TOKEN-SYSTEM.md +53 -0
  60. package/content/guidance/storefront-next/sfnext-components/references/TROUBLESHOOTING.md +19 -0
  61. package/content/guidance/storefront-next/sfnext-configuration/SKILL.md +116 -113
  62. package/content/guidance/storefront-next/sfnext-configuration/references/ENV-VARIABLES.md +55 -0
  63. package/content/guidance/storefront-next/sfnext-configuration/references/MULTI-SITE-URLS.md +137 -0
  64. package/content/guidance/storefront-next/sfnext-data-fetching/SKILL.md +100 -150
  65. package/content/guidance/storefront-next/sfnext-data-fetching/references/ACTIONS.md +53 -0
  66. package/content/guidance/storefront-next/sfnext-data-fetching/references/API-CLIENTS.md +34 -0
  67. package/content/guidance/storefront-next/sfnext-data-fetching/references/LOADERS.md +73 -0
  68. package/content/guidance/storefront-next/sfnext-data-fetching/references/SCAPI-FETCHER.md +23 -77
  69. package/content/guidance/storefront-next/sfnext-deployment/SKILL.md +83 -97
  70. package/content/guidance/storefront-next/sfnext-deployment/references/MRT-DEPLOYMENT.md +37 -68
  71. package/content/guidance/storefront-next/sfnext-extensions/SKILL.md +73 -97
  72. package/content/guidance/storefront-next/sfnext-extensions/references/ACTION-HOOKS.md +57 -0
  73. package/content/guidance/storefront-next/sfnext-extensions/references/BASE-AUDIT.md +47 -44
  74. package/content/guidance/storefront-next/sfnext-extensions/references/CLI-AND-INSTALL.md +58 -0
  75. package/content/guidance/storefront-next/sfnext-extensions/references/EXTENSION-EXAMPLES.md +49 -86
  76. package/content/guidance/storefront-next/sfnext-hybrid-storefronts/SKILL.md +59 -114
  77. package/content/guidance/storefront-next/sfnext-hybrid-storefronts/references/HYBRID-PROXY-CONFIG.md +53 -90
  78. package/content/guidance/storefront-next/sfnext-i18n/SKILL.md +96 -131
  79. package/content/guidance/storefront-next/sfnext-i18n/references/locale-config.md +35 -0
  80. package/content/guidance/storefront-next/sfnext-overview/SKILL.md +101 -0
  81. package/content/guidance/storefront-next/sfnext-page-designer/SKILL.md +152 -131
  82. package/content/guidance/storefront-next/sfnext-page-designer/references/BUSINESS-MANAGER.md +46 -0
  83. package/content/guidance/storefront-next/sfnext-page-designer/references/COMPONENT-REGISTRY.md +86 -53
  84. package/content/guidance/storefront-next/sfnext-page-designer/references/DECORATOR-PATTERNS.md +119 -131
  85. package/content/guidance/storefront-next/sfnext-page-designer/references/REVIEW-CHECKLIST.md +83 -0
  86. package/content/guidance/storefront-next/sfnext-page-designer/references/TROUBLESHOOTING.md +35 -0
  87. package/content/guidance/storefront-next/sfnext-performance/SKILL.md +75 -105
  88. package/content/guidance/storefront-next/sfnext-performance/references/PERFORMANCE-REVIEW-CHECKLIST.md +85 -0
  89. package/content/guidance/storefront-next/sfnext-performance/references/SUSPENSE-AND-STREAMING.md +58 -0
  90. package/content/guidance/storefront-next/sfnext-project-setup/SKILL.md +103 -116
  91. package/content/guidance/storefront-next/sfnext-project-setup/references/PROJECT-STRUCTURE.md +61 -99
  92. package/content/guidance/storefront-next/sfnext-project-setup/references/SCRIPTS.md +47 -0
  93. package/content/guidance/storefront-next/sfnext-project-setup/references/SFNEXT-CLI.md +63 -0
  94. package/content/guidance/storefront-next/sfnext-quality-gates/SKILL.md +70 -0
  95. package/content/guidance/storefront-next/sfnext-quality-gates/references/lint-and-budgets.md +39 -0
  96. package/content/guidance/storefront-next/sfnext-revalidation/SKILL.md +121 -0
  97. package/content/guidance/storefront-next/sfnext-revalidation/references/POLICIES-AND-TAGS.md +55 -0
  98. package/content/guidance/storefront-next/sfnext-routing/SKILL.md +86 -143
  99. package/content/guidance/storefront-next/sfnext-routing/references/ROUTE-CONVENTIONS.md +51 -51
  100. package/content/guidance/storefront-next/sfnext-routing/references/URLS-AND-SEO-ROUTES.md +22 -0
  101. package/content/guidance/storefront-next/sfnext-scapi/SKILL.md +126 -0
  102. package/content/guidance/storefront-next/sfnext-scapi/references/WORKED-EXAMPLE.md +39 -0
  103. package/content/guidance/storefront-next/sfnext-security/SKILL.md +129 -0
  104. package/content/guidance/storefront-next/sfnext-security/references/COOKIE-DOMAIN.md +39 -0
  105. package/content/guidance/storefront-next/sfnext-security/references/TURNSTILE.md +43 -0
  106. package/content/guidance/storefront-next/sfnext-seo/SKILL.md +95 -0
  107. package/content/guidance/storefront-next/sfnext-seo/references/MULTI-DOMAIN-BASE-PATH.md +17 -0
  108. package/content/guidance/storefront-next/sfnext-seo/references/SEO-ROUTES.md +31 -0
  109. package/content/guidance/storefront-next/sfnext-state-management/SKILL.md +80 -89
  110. package/content/guidance/storefront-next/sfnext-state-management/references/PATTERNS.md +45 -0
  111. package/content/guidance/storefront-next/sfnext-testing/SKILL.md +105 -138
  112. package/content/guidance/storefront-next/sfnext-testing/references/E2E.md +38 -0
  113. package/content/guidance/storefront-next/sfnext-testing/references/STORYBOOK-PATTERNS.md +73 -94
  114. package/content/guidance/storefront-next/sfnext-testing/references/UNIT-AND-ROUTE-TESTS.md +60 -0
  115. package/content/guidance/storefront-next/sfnext-theming/SKILL.md +104 -0
  116. package/content/guidance/storefront-next/sfnext-theming/references/REBRAND-CHECKLIST.md +29 -0
  117. package/dist/commands/mcp.d.ts +8 -2
  118. package/dist/commands/mcp.js +54 -20
  119. package/dist/guidance.d.ts +4 -1
  120. package/dist/guidance.js +23 -5
  121. package/dist/registry.d.ts +2 -1
  122. package/dist/registry.js +3 -3
  123. package/dist/server.d.ts +10 -0
  124. package/dist/server.js +21 -0
  125. package/dist/skill-references.js +5 -5
  126. package/dist/tools/cartridges/index.js +1 -0
  127. package/dist/tools/cip/index.js +6 -3
  128. package/dist/tools/diagnostics/debug-capture-at-breakpoint.js +1 -1
  129. package/dist/tools/diagnostics/debug-set-breakpoints.js +1 -1
  130. package/dist/tools/diagnostics/debug-start-session.js +1 -1
  131. package/dist/tools/docs/docs-read.js +4 -2
  132. package/dist/tools/docs/docs-search.js +10 -8
  133. package/dist/tools/docs/topics.d.ts +5 -0
  134. package/dist/tools/docs/topics.js +5 -0
  135. package/dist/tools/scapi/index.d.ts +4 -1
  136. package/dist/tools/scapi/index.js +4 -2
  137. package/dist/tools/scapi/scapi-code.d.ts +2 -2
  138. package/dist/tools/scapi/scapi-code.js +106 -81
  139. package/dist/tools/scapi/scapi-schemas-list.js +93 -56
  140. package/dist/utils/types.d.ts +6 -0
  141. package/node_modules/@salesforce/b2c-agent-plugins/CHANGELOG.md +32 -0
  142. package/node_modules/@salesforce/b2c-agent-plugins/README.md +5 -0
  143. package/node_modules/@salesforce/b2c-agent-plugins/b2c/.codex-plugin/plugin.json +1 -1
  144. package/node_modules/@salesforce/b2c-agent-plugins/b2c/plugin.json +1 -1
  145. package/node_modules/@salesforce/b2c-agent-plugins/b2c/skills/b2c-hooks/references/ORDER-HOOK-LIFECYCLE.md +1 -1
  146. package/node_modules/@salesforce/b2c-agent-plugins/b2c/skills/b2c-onboarding/SKILL.md +4 -4
  147. package/node_modules/@salesforce/b2c-agent-plugins/b2c/skills/b2c-ordering/SKILL.md +2 -2
  148. package/node_modules/@salesforce/b2c-agent-plugins/b2c/skills/b2c-querying-data/SKILL.md +2 -2
  149. package/node_modules/@salesforce/b2c-agent-plugins/b2c/skills/b2c-scapi-admin/SKILL.md +3 -3
  150. package/node_modules/@salesforce/b2c-agent-plugins/b2c/skills/b2c-scapi-admin/references/CLIENT-EXAMPLES.md +4 -4
  151. package/node_modules/@salesforce/b2c-agent-plugins/b2c/skills/b2c-scapi-shopper/SKILL.md +6 -6
  152. package/node_modules/@salesforce/b2c-agent-plugins/b2c/skills/b2c-scapi-shopper/references/CLIENT-EXAMPLES.md +8 -9
  153. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/.codex-plugin/plugin.json +1 -1
  154. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/plugin.json +1 -1
  155. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-cip/SKILL.md +3 -3
  156. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-cip/references/SALES_ANALYSIS.md +1 -1
  157. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-config/SKILL.md +54 -25
  158. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-content/SKILL.md +1 -1
  159. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-debug/SKILL.md +1 -1
  160. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-docs/SKILL.md +23 -2
  161. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-ecdn/SKILL.md +2 -0
  162. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-ecdn/references/ADVANCED.md +1 -1
  163. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-job/SKILL.md +9 -3
  164. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-job/references/IMPORT.md +1 -1
  165. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-job/references/RUN-AND-MONITOR.md +35 -6
  166. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-metrics/SKILL.md +1 -1
  167. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-mrt/SKILL.md +3 -3
  168. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-scapi-custom/SKILL.md +1 -1
  169. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-scapi-schemas/SKILL.md +6 -2
  170. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-site-import-export/SKILL.md +1 -1
  171. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-sites/SKILL.md +1 -1
  172. package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-slas/SKILL.md +1 -1
  173. package/node_modules/@salesforce/b2c-agent-plugins/b2c-ops/.codex-plugin/plugin.json +4 -3
  174. package/node_modules/@salesforce/b2c-agent-plugins/b2c-ops/README.md +1 -0
  175. package/node_modules/@salesforce/b2c-agent-plugins/b2c-ops/plugin.json +4 -3
  176. package/node_modules/@salesforce/b2c-agent-plugins/b2c-ops/skills/b2c-checkout-triage/SKILL.md +2 -2
  177. package/node_modules/@salesforce/b2c-agent-plugins/b2c-ops/skills/b2c-edge-traffic-triage/SKILL.md +69 -0
  178. package/node_modules/@salesforce/b2c-agent-plugins/b2c-ops/skills/b2c-job-health/SKILL.md +13 -8
  179. package/node_modules/@salesforce/b2c-agent-plugins/b2c-ops/skills/b2c-order-failure-triage/SKILL.md +1 -1
  180. package/node_modules/@salesforce/b2c-agent-plugins/b2c-ops/skills/b2c-order-failure-triage/references/order-evidence.md +2 -2
  181. package/node_modules/@salesforce/b2c-agent-plugins/b2c-ops/skills/b2c-production-triage/SKILL.md +5 -4
  182. package/node_modules/@salesforce/b2c-agent-plugins/figma-to-sfnext-pagedesigner/README.md +4 -4
  183. package/node_modules/@salesforce/b2c-agent-plugins/figma-to-sfnext-pagedesigner/skills/figma-to-sfnext-pagedesigner/SKILL.md +76 -73
  184. package/node_modules/@salesforce/b2c-agent-plugins/figma-to-sfnext-pagedesigner/skills/figma-to-sfnext-pagedesigner/evals/trigger-evals.json +12 -10
  185. package/node_modules/@salesforce/b2c-agent-plugins/figma-to-sfnext-pagedesigner/skills/figma-to-sfnext-pagedesigner/references/PAGE-DESIGNER-SFN.md +49 -74
  186. package/node_modules/@salesforce/b2c-agent-plugins/package.json +1 -1
  187. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/.codex-plugin/plugin.json +9 -6
  188. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/README.md +43 -22
  189. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/plugin.json +9 -6
  190. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-accessibility/SKILL.md +103 -0
  191. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-accessibility/evals/trigger-evals.json +5 -0
  192. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-accessibility/references/checklist.md +64 -0
  193. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-analytics-consent/SKILL.md +91 -0
  194. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-analytics-consent/evals/trigger-evals.json +5 -0
  195. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-analytics-consent/references/CUSTOM-ADAPTER.md +49 -0
  196. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-authentication/SKILL.md +86 -79
  197. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-authentication/evals/trigger-evals.json +5 -0
  198. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-authentication/references/COOKIES.md +39 -0
  199. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-authentication/references/LOGIN-FLOWS.md +59 -0
  200. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-commerce-features/SKILL.md +67 -0
  201. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-commerce-features/evals/trigger-evals.json +5 -0
  202. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-commerce-features/references/FEATURE-PREREQUISITES.md +37 -0
  203. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-components/SKILL.md +98 -136
  204. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-components/evals/trigger-evals.json +5 -0
  205. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-components/references/COMPONENT-AUTHORING.md +118 -0
  206. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-components/references/SHAPE-TOKENS.md +51 -0
  207. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-components/references/STORYBOOK.md +54 -0
  208. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-components/references/TOKEN-SYSTEM.md +53 -0
  209. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-components/references/TROUBLESHOOTING.md +19 -0
  210. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-configuration/SKILL.md +116 -113
  211. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-configuration/evals/trigger-evals.json +5 -0
  212. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-configuration/references/ENV-VARIABLES.md +55 -0
  213. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-configuration/references/MULTI-SITE-URLS.md +137 -0
  214. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-data-fetching/SKILL.md +100 -150
  215. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-data-fetching/evals/trigger-evals.json +5 -0
  216. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-data-fetching/references/ACTIONS.md +53 -0
  217. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-data-fetching/references/API-CLIENTS.md +34 -0
  218. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-data-fetching/references/LOADERS.md +73 -0
  219. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-data-fetching/references/SCAPI-FETCHER.md +23 -77
  220. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-deployment/SKILL.md +83 -97
  221. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-deployment/evals/trigger-evals.json +5 -0
  222. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-deployment/references/MRT-DEPLOYMENT.md +37 -68
  223. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-extensions/SKILL.md +73 -97
  224. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-extensions/evals/trigger-evals.json +5 -0
  225. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-extensions/references/ACTION-HOOKS.md +57 -0
  226. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-extensions/references/BASE-AUDIT.md +47 -44
  227. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-extensions/references/CLI-AND-INSTALL.md +58 -0
  228. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-extensions/references/EXTENSION-EXAMPLES.md +49 -86
  229. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-hybrid-storefronts/SKILL.md +59 -114
  230. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-hybrid-storefronts/evals/trigger-evals.json +5 -0
  231. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-hybrid-storefronts/references/HYBRID-PROXY-CONFIG.md +53 -90
  232. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-i18n/SKILL.md +96 -131
  233. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-i18n/evals/trigger-evals.json +5 -0
  234. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-i18n/references/locale-config.md +35 -0
  235. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-overview/SKILL.md +101 -0
  236. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-overview/evals/trigger-evals.json +5 -0
  237. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-page-designer/SKILL.md +152 -131
  238. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-page-designer/evals/trigger-evals.json +5 -0
  239. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-page-designer/references/BUSINESS-MANAGER.md +46 -0
  240. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-page-designer/references/COMPONENT-REGISTRY.md +86 -53
  241. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-page-designer/references/DECORATOR-PATTERNS.md +119 -131
  242. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-page-designer/references/REVIEW-CHECKLIST.md +83 -0
  243. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-page-designer/references/TROUBLESHOOTING.md +35 -0
  244. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-performance/SKILL.md +75 -105
  245. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-performance/evals/trigger-evals.json +5 -0
  246. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-performance/references/PERFORMANCE-REVIEW-CHECKLIST.md +85 -0
  247. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-performance/references/SUSPENSE-AND-STREAMING.md +58 -0
  248. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-project-setup/SKILL.md +103 -116
  249. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-project-setup/evals/trigger-evals.json +5 -0
  250. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-project-setup/references/PROJECT-STRUCTURE.md +61 -99
  251. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-project-setup/references/SCRIPTS.md +47 -0
  252. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-project-setup/references/SFNEXT-CLI.md +63 -0
  253. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-quality-gates/SKILL.md +70 -0
  254. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-quality-gates/evals/trigger-evals.json +5 -0
  255. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-quality-gates/references/lint-and-budgets.md +39 -0
  256. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-revalidation/SKILL.md +121 -0
  257. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-revalidation/evals/trigger-evals.json +5 -0
  258. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-revalidation/references/POLICIES-AND-TAGS.md +55 -0
  259. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-routing/SKILL.md +86 -143
  260. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-routing/evals/trigger-evals.json +5 -0
  261. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-routing/references/ROUTE-CONVENTIONS.md +51 -51
  262. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-routing/references/URLS-AND-SEO-ROUTES.md +22 -0
  263. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-scapi/SKILL.md +126 -0
  264. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-scapi/evals/trigger-evals.json +5 -0
  265. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-scapi/references/WORKED-EXAMPLE.md +39 -0
  266. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-security/SKILL.md +129 -0
  267. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-security/evals/trigger-evals.json +5 -0
  268. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-security/references/COOKIE-DOMAIN.md +39 -0
  269. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-security/references/TURNSTILE.md +43 -0
  270. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-seo/SKILL.md +95 -0
  271. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-seo/evals/trigger-evals.json +5 -0
  272. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-seo/references/MULTI-DOMAIN-BASE-PATH.md +17 -0
  273. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-seo/references/SEO-ROUTES.md +31 -0
  274. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-state-management/SKILL.md +80 -89
  275. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-state-management/evals/trigger-evals.json +5 -0
  276. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-state-management/references/PATTERNS.md +45 -0
  277. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-testing/SKILL.md +105 -138
  278. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-testing/evals/trigger-evals.json +5 -0
  279. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-testing/references/E2E.md +38 -0
  280. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-testing/references/STORYBOOK-PATTERNS.md +73 -94
  281. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-testing/references/UNIT-AND-ROUTE-TESTS.md +60 -0
  282. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-theming/SKILL.md +104 -0
  283. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-theming/evals/trigger-evals.json +5 -0
  284. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-theming/references/REBRAND-CHECKLIST.md +29 -0
  285. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next-figma/skills/sfnext-create-figma-kit/SKILL.md +3 -3
  286. package/oclif.manifest.json +21 -4
  287. package/package.json +4 -4
  288. package/content/guidance/mcp/scapi/SKILL.md +0 -203
  289. package/content/guidance/mcp/scapi/references/jobs.md +0 -30
  290. package/content/guidance/storefront-next/sfnext-create-component/SKILL.md +0 -195
  291. package/content/guidance/storefront-next/sfnext-create-component/references/COMPONENT-AUTHORING.md +0 -206
  292. package/content/guidance/storefront-next/sfnext-create-component/references/PROJECT-STRUCTURE.md +0 -43
  293. package/content/guidance/storefront-next/sfnext-create-component/references/TOKEN-SYSTEM.md +0 -130
  294. package/content/guidance/storefront-next/sfnext-create-component/references/TROUBLESHOOTING.md +0 -34
  295. package/content/guidance/storefront-next/sfnext-create-vertical/SKILL.md +0 -135
  296. package/content/guidance/storefront-next/sfnext-create-vertical/references/COMPONENT-AUTHORING.md +0 -206
  297. package/content/guidance/storefront-next/sfnext-create-vertical/references/PROJECT-STRUCTURE.md +0 -43
  298. package/content/guidance/storefront-next/sfnext-create-vertical/references/TOKEN-SYSTEM.md +0 -130
  299. package/content/guidance/storefront-next/sfnext-create-vertical/references/TROUBLESHOOTING.md +0 -34
  300. package/content/guidance/storefront-next/sfnext-custom-apis/SKILL.md +0 -221
  301. package/content/guidance/storefront-next/sfnext-custom-apis/references/WORKFLOW-EXAMPLES.md +0 -294
  302. package/content/guidance/storefront-next/sfnext-data-fetching/references/LOADER-PATTERNS.md +0 -102
  303. package/content/guidance/storefront-next/sfnext-project-setup/references/ENV-VARIABLES.md +0 -82
  304. package/content/guidance/storefront-next/sfnext-scapi-management/SKILL.md +0 -203
  305. package/content/guidance/storefront-next/sfnext-scapi-management/references/CLI-COMMANDS.md +0 -122
  306. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-component/SKILL.md +0 -195
  307. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-component/evals/trigger-evals.json +0 -12
  308. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-component/references/COMPONENT-AUTHORING.md +0 -206
  309. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-component/references/PROJECT-STRUCTURE.md +0 -43
  310. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-component/references/TOKEN-SYSTEM.md +0 -130
  311. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-component/references/TROUBLESHOOTING.md +0 -34
  312. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-vertical/SKILL.md +0 -135
  313. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-vertical/evals/trigger-evals.json +0 -12
  314. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-vertical/references/COMPONENT-AUTHORING.md +0 -206
  315. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-vertical/references/PROJECT-STRUCTURE.md +0 -43
  316. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-vertical/references/TOKEN-SYSTEM.md +0 -130
  317. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-vertical/references/TROUBLESHOOTING.md +0 -34
  318. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-custom-apis/SKILL.md +0 -221
  319. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-custom-apis/evals/trigger-evals.json +0 -12
  320. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-custom-apis/references/WORKFLOW-EXAMPLES.md +0 -294
  321. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-data-fetching/references/LOADER-PATTERNS.md +0 -102
  322. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-project-setup/references/ENV-VARIABLES.md +0 -82
  323. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-scapi-management/SKILL.md +0 -203
  324. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-scapi-management/evals/trigger-evals.json +0 -12
  325. package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-scapi-management/references/CLI-COMMANDS.md +0 -122
  326. /package/content/guidance/mcp/{scapi → b2c-mcp-scapi}/references/custom-apis.md +0 -0
  327. /package/content/guidance/mcp/{scapi → b2c-mcp-scapi}/references/custom-properties.md +0 -0
  328. /package/content/guidance/mcp/{scapi → b2c-mcp-scapi}/references/products.md +0 -0
  329. /package/content/guidance/mcp/{scapi → b2c-mcp-scapi}/references/promotions.md +0 -0
  330. /package/content/guidance/mcp/{scapi → b2c-mcp-scapi}/references/saving.md +0 -0
  331. /package/content/guidance/mcp/{scapi → b2c-mcp-scapi}/references/snippets.md +0 -0
  332. /package/content/guidance/mcp/{scapi → b2c-mcp-scapi}/references/tokens.md +0 -0
  333. /package/content/guidance/mcp/{server → b2c-mcp-server}/references/files.md +0 -0
@@ -1,221 +0,0 @@
1
- ---
2
- name: sfnext-custom-apis
3
- description: End-to-end workflow for consuming custom SCAPI endpoints from a Storefront Next project — adding them as typed clients via `b2c sfnext scapi add custom`, discovering their schema, and calling them from loaders/actions/useScapiFetcher. Use this skill whenever the user wants to call a custom API from their Storefront Next app, gets a 404 or 401 when calling a custom endpoint from their sfnext loader, needs to add a custom API as a typed client in their storefront, asks about the full workflow from custom API cartridge to sfnext consumption, or says 'custom API in storefront next'. Also use when they ask how createApiClients exposes custom API methods or how to use useScapiFetcher with a custom endpoint. NOT for writing the custom API cartridge files (schema.yaml/script.js) from scratch — see b2c:b2c-custom-api-development. NOT for just checking registration status — see b2c-cli:b2c-scapi-custom.
4
- ---
5
-
6
- # Custom APIs in Storefront Next
7
-
8
- This skill covers the end-to-end workflow for implementing and consuming custom SCAPI endpoints from a Storefront Next project.
9
-
10
- ## Overview
11
-
12
- Custom APIs let you define your own REST endpoints on B2C Commerce. In a Storefront Next project, you call these from loaders and actions just like standard SCAPI clients — with full type safety.
13
-
14
- ### End-to-End Workflow
15
-
16
- ```
17
- Create custom API → Deploy & register → Add typed client → Discover schema → Call from loader
18
- (cartridge) (b2c code deploy) (sfnext scapi add) (scapi schemas) (createApiClients)
19
- ```
20
-
21
- ## Step 1: Create the Custom API
22
-
23
- A custom API consists of three files in a cartridge:
24
-
25
- ```
26
- my-cartridge/cartridge/rest-apis/my-loyalty-api/
27
- ├── schema.yaml # OpenAPI 3.0 schema (endpoints, params, responses)
28
- ├── api.json # API metadata (version, security scheme)
29
- └── script.js # Implementation (controller script)
30
- ```
31
-
32
- For full details on writing these files, see the `b2c:b2c-custom-api-development` skill.
33
-
34
- **Key choices that affect the client:**
35
-
36
- | Choice | Impact |
37
- |--------|--------|
38
- | Directory name (`my-loyalty-api`) | Becomes the API name for `scapi add` |
39
- | `type` in api.json (`shopper` or `admin`) | Determines auth scheme and whether `siteId` is required |
40
- | Paths in schema.yaml | Become the methods on the typed client |
41
-
42
- ## Step 2: Deploy and Register
43
-
44
- Deploy the cartridge and verify the custom API is registered:
45
-
46
- ```bash
47
- # deploy the cartridge
48
- b2c code deploy ./my-cartridge --activate
49
-
50
- # verify registration
51
- b2c scapi custom status
52
- ```
53
-
54
- A successful registration shows `status: active` for your endpoints. If you see `not_registered`, debug with:
55
-
56
- ```bash
57
- b2c scapi custom status --status not_registered --columns type,apiName,endpointPath,errorReason
58
- ```
59
-
60
- See `b2c-cli:b2c-scapi-custom` for full diagnostics.
61
-
62
- ## Step 3: Add as Typed Client
63
-
64
- Once registered, add the custom API to your Storefront Next project:
65
-
66
- ```bash
67
- b2c sfnext scapi add custom my-loyalty-api v1
68
- ```
69
-
70
- This generates typed client code. The client becomes available as:
71
-
72
- ```typescript
73
- const clients = createApiClients(context);
74
- clients.myLoyaltyApi.getPoints({...});
75
- ```
76
-
77
- ## Step 4: Discover the API Shape
78
-
79
- Use schema browsing to understand your custom API's endpoints and response types:
80
-
81
- ```bash
82
- # list endpoints
83
- b2c scapi schemas get custom my-loyalty-api v1 --list-paths
84
-
85
- # expand a specific endpoint
86
- b2c scapi schemas get custom my-loyalty-api v1 \
87
- --expand-paths /loyalty/points/{customerId}
88
- ```
89
-
90
- This shows you the exact parameter names and response shape to use in your loader.
91
-
92
- ## Step 5: Call from Loaders and Actions
93
-
94
- ### Calling from a Loader (Shopper API)
95
-
96
- ```typescript
97
- import { createApiClients } from '@/lib/api-clients';
98
-
99
- export function loader({ params, context }: LoaderFunctionArgs) {
100
- const clients = createApiClients(context);
101
- return {
102
- loyaltyPoints: clients.myLoyaltyApi.getPoints({
103
- params: {
104
- path: { customerId: params.customerId },
105
- query: { siteId: context.siteId }
106
- }
107
- }).then(({ data }) => data),
108
- };
109
- }
110
- ```
111
-
112
- ### Calling from an Action (Mutation)
113
-
114
- ```typescript
115
- import { data } from 'react-router';
116
- import { createApiClients } from '@/lib/api-clients';
117
-
118
- export async function action({ request, context }: ActionFunctionArgs) {
119
- const formData = await request.formData();
120
- const clients = createApiClients(context);
121
-
122
- try {
123
- await clients.myLoyaltyApi.redeemPoints({
124
- params: {
125
- path: { customerId: formData.get('customerId') as string },
126
- query: { siteId: context.siteId },
127
- body: { points: Number(formData.get('points')) }
128
- }
129
- });
130
- return data({ success: true });
131
- } catch (error) {
132
- return data({ success: false, error: error.message }, { status: 400 });
133
- }
134
- }
135
- ```
136
-
137
- ### Using useScapiFetcher (Interactive)
138
-
139
- For on-demand fetching triggered by user interactions:
140
-
141
- ```typescript
142
- import { useScapiFetcher } from '@/hooks/use-scapi-fetcher';
143
-
144
- export function useLoyaltyPoints(customerId: string) {
145
- const parameters = useMemo(
146
- () => ({
147
- params: {
148
- path: { customerId },
149
- query: { siteId: getSiteId() }
150
- }
151
- }),
152
- [customerId]
153
- );
154
-
155
- const fetcher = useScapiFetcher(
156
- 'myLoyaltyApi',
157
- 'getPoints',
158
- parameters
159
- );
160
-
161
- return {
162
- points: fetcher.data,
163
- isLoading: fetcher.state === 'loading',
164
- refresh: () => fetcher.load(),
165
- };
166
- }
167
- ```
168
-
169
- ## Step 6: Debug Issues
170
-
171
- | Issue | Cause | Solution |
172
- |-------|-------|----------|
173
- | Client property not available | Forgot `sfnext scapi add` | Run `b2c sfnext scapi add custom <name> <version>` |
174
- | 404 from custom endpoint | API not registered | Check `b2c scapi custom status`; redeploy with `--activate` |
175
- | 401 Unauthorized | Wrong security scheme | Shopper APIs use ShopperToken; Admin APIs use BearerToken |
176
- | Missing `siteId` error | Shopper custom APIs require siteId | Always include `siteId` in query params for Shopper APIs |
177
- | Schema returns empty | API not yet registered | Deploy and activate the cartridge first, then browse schemas |
178
- | Types outdated after schema change | Stale generated types | Re-run `b2c sfnext scapi add custom <name> <version> --force` |
179
-
180
- ## Custom API Client Naming
181
-
182
- The API directory name maps to a camelCase property on `createApiClients()`:
183
-
184
- | Directory Name | Client Property | Example Call |
185
- |---------------|-----------------|-------------|
186
- | `my-loyalty-api` | `clients.myLoyaltyApi` | `clients.myLoyaltyApi.getPoints({...})` |
187
- | `order-status` | `clients.orderStatus` | `clients.orderStatus.getStatus({...})` |
188
- | `inventory-check` | `clients.inventoryCheck` | `clients.inventoryCheck.checkStock({...})` |
189
-
190
- ## Shopper vs Admin Custom APIs
191
-
192
- | Aspect | Shopper API | Admin API |
193
- |--------|-------------|-----------|
194
- | Auth scheme | ShopperToken (SLAS) | BearerToken (Account Manager) |
195
- | Requires `siteId` | Yes | No |
196
- | Called from | Storefront loaders/actions | Admin tools, batch jobs |
197
- | Typical use | Customer-facing features | Back-office operations |
198
-
199
- Most Storefront Next custom APIs are **Shopper** type since they serve storefront pages.
200
-
201
- ## Common Pitfalls
202
-
203
- | Pitfall | Problem | Solution |
204
- |---------|---------|----------|
205
- | Using admin auth for a shopper endpoint | 401 errors in storefront context | Set `type: "shopper"` in api.json |
206
- | Forgetting to redeploy after schema changes | Stale endpoints | Redeploy cartridge and re-add client with `--force` |
207
- | Not including `siteId` for shopper APIs | Request rejected | Always pass `siteId` in query params |
208
- | Calling custom API before registration completes | Intermittent 404s | Wait for `status: active` in `b2c scapi custom status` |
209
-
210
- ## Related Skills
211
-
212
- - `storefront-next:sfnext-scapi-management` - Managing typed clients (add/remove/list)
213
- - `storefront-next:sfnext-data-fetching` - Loader/action/useScapiFetcher patterns
214
- - `b2c:b2c-custom-api-development` - Creating the custom API cartridge (schema + script + mapping)
215
- - `b2c-cli:b2c-scapi-custom` - Checking custom API registration status
216
- - `b2c-cli:b2c-scapi-schemas` - Schema discovery commands
217
- - `b2c-cli:b2c-code` - Deploying and activating code versions
218
-
219
- ## Reference Documentation
220
-
221
- - [Workflow Examples](references/WORKFLOW-EXAMPLES.md) - Complete end-to-end worked examples
@@ -1,294 +0,0 @@
1
- # Workflow Examples
2
-
3
- Complete end-to-end examples showing the full lifecycle from custom API creation through calling from a Storefront Next storefront.
4
-
5
- ## Example 1: Shopper Custom API — Loyalty Points
6
-
7
- A customer-facing API that retrieves and redeems loyalty points.
8
-
9
- ### Cartridge Structure
10
-
11
- ```
12
- loyalty-cartridge/cartridge/rest-apis/loyalty-points/
13
- ├── schema.yaml
14
- ├── api.json
15
- └── script.js
16
- ```
17
-
18
- ### schema.yaml
19
-
20
- ```yaml
21
- openapi: "3.0.0"
22
- info:
23
- title: Loyalty Points API
24
- version: "v1"
25
- paths:
26
- /points/{customerId}:
27
- get:
28
- operationId: getPoints
29
- parameters:
30
- - name: customerId
31
- in: path
32
- required: true
33
- schema:
34
- type: string
35
- - name: siteId
36
- in: query
37
- required: true
38
- schema:
39
- type: string
40
- responses:
41
- "200":
42
- description: Customer loyalty points
43
- content:
44
- application/json:
45
- schema:
46
- $ref: "#/components/schemas/LoyaltyBalance"
47
- /points/{customerId}/redeem:
48
- post:
49
- operationId: redeemPoints
50
- parameters:
51
- - name: customerId
52
- in: path
53
- required: true
54
- schema:
55
- type: string
56
- - name: siteId
57
- in: query
58
- required: true
59
- schema:
60
- type: string
61
- requestBody:
62
- required: true
63
- content:
64
- application/json:
65
- schema:
66
- $ref: "#/components/schemas/RedeemRequest"
67
- responses:
68
- "200":
69
- description: Redemption result
70
- content:
71
- application/json:
72
- schema:
73
- $ref: "#/components/schemas/RedeemResult"
74
- components:
75
- schemas:
76
- LoyaltyBalance:
77
- type: object
78
- properties:
79
- customerId:
80
- type: string
81
- points:
82
- type: integer
83
- tier:
84
- type: string
85
- enum: [bronze, silver, gold, platinum]
86
- lastUpdated:
87
- type: string
88
- format: date-time
89
- RedeemRequest:
90
- type: object
91
- required: [points]
92
- properties:
93
- points:
94
- type: integer
95
- minimum: 1
96
- RedeemResult:
97
- type: object
98
- properties:
99
- success:
100
- type: boolean
101
- remainingPoints:
102
- type: integer
103
- transactionId:
104
- type: string
105
- ```
106
-
107
- ### api.json
108
-
109
- ```json
110
- {
111
- "type": "shopper",
112
- "version": "v1"
113
- }
114
- ```
115
-
116
- ### Deploy and Register
117
-
118
- ```bash
119
- # deploy the cartridge
120
- b2c code deploy ./loyalty-cartridge --activate
121
-
122
- # verify registration
123
- b2c scapi custom status --api-name loyalty-points
124
- ```
125
-
126
- ### Add to Storefront Next Project
127
-
128
- ```bash
129
- b2c sfnext scapi add custom loyalty-points v1
130
- ```
131
-
132
- ### Discover and Use
133
-
134
- ```bash
135
- # check endpoints
136
- b2c scapi schemas get custom loyalty-points v1 --list-paths
137
-
138
- # inspect response shape
139
- b2c scapi schemas get custom loyalty-points v1 \
140
- --expand-paths /points/{customerId} \
141
- --expand-schemas LoyaltyBalance
142
- ```
143
-
144
- ### Storefront Code
145
-
146
- ```typescript
147
- // src/routes/_app.account.loyalty.tsx
148
- import { createApiClients } from '@/lib/api-clients';
149
- import { createPage } from '@/lib/create-page';
150
-
151
- interface LoyaltyPageData {
152
- balance: Promise<LoyaltyBalance>;
153
- }
154
-
155
- export function loader({ context }: LoaderFunctionArgs): LoyaltyPageData {
156
- const clients = createApiClients(context);
157
- const customerId = context.session.customerId;
158
-
159
- return {
160
- balance: clients.loyaltyPoints.getPoints({
161
- params: {
162
- path: { customerId },
163
- query: { siteId: context.siteId }
164
- }
165
- }).then(({ data }) => data),
166
- };
167
- }
168
-
169
- export default createPage<LoyaltyPageData>(({ data }) => (
170
- <div className="space-y-4">
171
- <h1 className="text-2xl font-bold">Loyalty Points</h1>
172
- <Suspense fallback={<Skeleton className="h-24" />}>
173
- <Await resolve={data.balance}>
174
- {(balance) => (
175
- <div className="rounded-lg border p-6">
176
- <p className="text-4xl font-bold">{balance.points}</p>
177
- <p className="text-muted-foreground">
178
- {balance.tier} tier
179
- </p>
180
- </div>
181
- )}
182
- </Await>
183
- </Suspense>
184
- </div>
185
- ));
186
- ```
187
-
188
- ---
189
-
190
- ## Example 2: Admin Custom API — Inventory Check
191
-
192
- An admin API for back-office inventory operations. Admin APIs use BearerToken auth and do not require `siteId`.
193
-
194
- ### Key Differences from Shopper APIs
195
-
196
- | Aspect | This Example | Example 1 (Shopper) |
197
- |--------|-------------|---------------------|
198
- | api.json `type` | `"admin"` | `"shopper"` |
199
- | Auth | BearerToken (Account Manager) | ShopperToken (SLAS) |
200
- | `siteId` param | Not required | Required |
201
- | Typical caller | Admin tools, cron jobs | Storefront loaders |
202
-
203
- ### api.json
204
-
205
- ```json
206
- {
207
- "type": "admin",
208
- "version": "v1"
209
- }
210
- ```
211
-
212
- ### Usage in Storefront Context
213
-
214
- Admin APIs are typically NOT called from storefront loaders (since storefronts use shopper auth). If you need admin-level data in a storefront, consider:
215
-
216
- 1. Using a shopper API that exposes the same data with appropriate access controls
217
- 2. Pre-computing results and storing them in a custom object accessible via shopper APIs
218
-
219
- ---
220
-
221
- ## Example 3: useScapiFetcher with Custom API
222
-
223
- Interactive pattern for fetching custom API data after page load (e.g., showing loyalty points in a modal that opens on click).
224
-
225
- ```typescript
226
- // src/hooks/use-loyalty-points.ts
227
- import { useScapiFetcher } from '@/hooks/use-scapi-fetcher';
228
- import { useMemo, useCallback } from 'react';
229
-
230
- export function useLoyaltyPoints(customerId: string | undefined) {
231
- const parameters = useMemo(
232
- () => customerId ? {
233
- params: {
234
- path: { customerId },
235
- query: { siteId: getSiteId() }
236
- }
237
- } : null,
238
- [customerId]
239
- );
240
-
241
- const fetcher = useScapiFetcher(
242
- 'loyaltyPoints',
243
- 'getPoints',
244
- parameters
245
- );
246
-
247
- const refresh = useCallback(async () => {
248
- if (parameters) {
249
- await fetcher.load();
250
- }
251
- }, [fetcher, parameters]);
252
-
253
- return {
254
- points: fetcher.data?.points ?? 0,
255
- tier: fetcher.data?.tier ?? 'bronze',
256
- isLoading: fetcher.state === 'loading',
257
- refresh,
258
- };
259
- }
260
- ```
261
-
262
- ```typescript
263
- // src/components/loyalty-badge.tsx
264
- import { useLoyaltyPoints } from '@/hooks/use-loyalty-points';
265
-
266
- export function LoyaltyBadge({ customerId }: { customerId: string }) {
267
- const { points, tier, isLoading, refresh } = useLoyaltyPoints(customerId);
268
-
269
- useEffect(() => {
270
- refresh();
271
- }, [refresh]);
272
-
273
- if (isLoading) return <Skeleton className="h-6 w-16" />;
274
-
275
- return (
276
- <Badge variant={tier === 'platinum' ? 'default' : 'secondary'}>
277
- {points} pts
278
- </Badge>
279
- );
280
- }
281
- ```
282
-
283
- ### How It Works
284
-
285
- ```
286
- LoyaltyBadge renders
287
- → useLoyaltyPoints calls useScapiFetcher('loyaltyPoints', 'getPoints', params)
288
- → fetcher.load() sends GET to /resource/api/client/{encoded-params}
289
- → Resource route runs ON SERVER
290
- → createApiClients(context).loyaltyPoints.getPoints({...}) calls SCAPI
291
- → JSON response returned to component
292
- ```
293
-
294
- The custom API call happens server-side even though it's triggered from a client component.
@@ -1,102 +0,0 @@
1
- # Loader Patterns Reference
2
-
3
- ## Data Flow
4
-
5
- ### Initial Page Load (SSR)
6
-
7
- ```
8
- Browser request → MRT Server
9
- ↓
10
- loader() runs on server
11
- ↓
12
- SCAPI requests on MRT
13
- ↓
14
- HTML response streamed → Browser
15
- ```
16
-
17
- ### Subsequent Navigation (SPA)
18
-
19
- ```
20
- User clicks link → React Router intercepts
21
- ↓
22
- Browser fetches from server
23
- ↓
24
- MRT Server runs same loader()
25
- ↓
26
- SCAPI requests on MRT
27
- ↓
28
- JSON response → Browser
29
- ↓
30
- React updates DOM
31
- ```
32
-
33
- The loader code is identical for SSR and SPA navigation — only the response format differs (HTML vs JSON).
34
-
35
- ## Decision Tree: Which Pattern to Use
36
-
37
- ```
38
- Need data for page render?
39
- ├── Critical for SEO / above-the-fold?
40
- │ └── Use awaited data (async loader with await)
41
- ├── Non-critical / below-the-fold?
42
- │ └── Use deferred data (sync loader, return promises)
43
- └── Mix of both?
44
- └── Use mixed strategy (await critical, stream rest)
45
-
46
- Need to handle mutations?
47
- └── Use action function
48
-
49
- Need data after page load (user interaction)?
50
- └── Use useScapiFetcher
51
- ```
52
-
53
- ## Pattern: Multiple API Calls with Dependencies
54
-
55
- When one API call depends on another's result:
56
-
57
- ```typescript
58
- export async function loader({ params, context }: LoaderFunctionArgs) {
59
- const clients = createApiClients(context);
60
-
61
- // First call — must resolve before dependent calls
62
- const category = await clients.shopperProducts.getCategory({
63
- params: { path: { id: params.categoryId } }
64
- }).then(({ data }) => data);
65
-
66
- // Dependent calls — can run in parallel with each other
67
- return {
68
- category,
69
- products: clients.shopperSearch.productSearch({
70
- params: { query: { refine: `cgid=${category.id}` } }
71
- }).then(({ data }) => data),
72
- refinements: clients.shopperSearch.getSearchSuggestions({
73
- params: { query: { q: category.name } }
74
- }).then(({ data }) => data),
75
- };
76
- }
77
- ```
78
-
79
- ## Pattern: Conditional Data Loading
80
-
81
- ```typescript
82
- export function loader({ params, context }: LoaderFunctionArgs) {
83
- const clients = createApiClients(context);
84
- const auth = getAuth(context);
85
-
86
- const base = {
87
- product: clients.shopperProducts.getProduct({
88
- params: { path: { id: params.productId } }
89
- }).then(({ data }) => data),
90
- };
91
-
92
- // Only fetch wishlist for registered users
93
- if (auth.userType === 'registered') {
94
- return {
95
- ...base,
96
- wishlist: clients.shopperCustomers.getWishlist({...}).then(({ data }) => data),
97
- };
98
- }
99
-
100
- return base;
101
- }
102
- ```
@@ -1,82 +0,0 @@
1
- # Environment Variables Reference
2
-
3
- ## Naming Convention
4
-
5
- Environment variables use the `PUBLIC__` prefix with double underscore (`__`) separators to map to configuration paths:
6
-
7
- ```bash
8
- # Pattern: PUBLIC__app__{path}__{to}__{property}=value
9
- PUBLIC__app__commerce__api__clientId=abc123
10
- # Maps to: config.app.commerce.api.clientId
11
- # Accessed as: getConfig(context).commerce.api.clientId
12
- ```
13
-
14
- ## Rules
15
-
16
- 1. **`PUBLIC__` prefix** — Exposed to browser (client-safe values only)
17
- 2. **No prefix** — Server-only secrets (never sent to client)
18
- 3. **`__` separator** — Navigates nested config paths
19
- 4. **Case-insensitive** — All casings work (normalized to match `config.server.ts`)
20
- 5. **Auto-parsing** — Strings, numbers, booleans, JSON arrays/objects parsed automatically
21
- 6. **Validation** — Paths must exist in `config.server.ts` (prevents typos)
22
- 7. **Depth limit** — Maximum 10 levels deep (use JSON for deeper nesting)
23
- 8. **Path precedence** — More specific paths override less specific ones
24
- 9. **Protected paths** — `app__engagement` cannot be overridden via environment variables
25
- 10. **MRT limits** — Variable names max 512 characters, total `PUBLIC__` values max 32KB
26
-
27
- ## Required Variables
28
-
29
- | Variable | Description |
30
- |----------|-------------|
31
- | `PUBLIC__app__commerce__api__clientId` | SLAS client ID |
32
- | `PUBLIC__app__commerce__api__organizationId` | Commerce Cloud organization ID |
33
- | `PUBLIC__app__commerce__api__siteId` | Default site ID |
34
- | `PUBLIC__app__commerce__api__shortCode` | API short code |
35
- | `PUBLIC__app__defaultSiteId` | Default site ID for routing |
36
- | `PUBLIC__app__commerce__sites` | JSON array of site configurations |
37
-
38
- ## Server-Only Variables
39
-
40
- ```bash
41
- # Server-only secrets (no PUBLIC__ prefix)
42
- COMMERCE_API_SLAS_SECRET=your-slas-secret
43
- ```
44
-
45
- Access server-only secrets via `process.env` directly — never add them to the config system.
46
-
47
- ## Multi-Site Configuration
48
-
49
- The `commerce.sites` array defines site configurations:
50
-
51
- ```bash
52
- PUBLIC__app__commerce__sites='[
53
- {
54
- "id": "RefArchGlobal",
55
- "defaultLocale": "en-US",
56
- "defaultCurrency": "USD",
57
- "supportedLocales": [
58
- {"id": "en-US", "preferredCurrency": "USD"},
59
- {"id": "de-DE", "preferredCurrency": "EUR"}
60
- ],
61
- "supportedCurrencies": ["USD", "EUR"]
62
- }
63
- ]'
64
- ```
65
-
66
- ## Setting Complex Values
67
-
68
- ```bash
69
- # Individual variables
70
- PUBLIC__app__myFeature__option1=value1
71
- PUBLIC__app__myFeature__option2=value2
72
-
73
- # Or as a single JSON value
74
- PUBLIC__app__myFeature='{"option1":"value1","option2":"value2"}'
75
- ```
76
-
77
- ## Security Guidelines
78
-
79
- | Prefix | Visibility | Use For |
80
- |--------|-----------|---------|
81
- | `PUBLIC__` | Browser + Server | Client IDs, site IDs, feature flags |
82
- | (none) | Server only | API secrets, private keys, credentials |