@salesforce/b2c-cli 2.3.1 → 2.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.
- package/bin/dev.js +8 -8
- package/bin/run.js +5 -7
- package/content/guidance/b2c/b2c-business-manager-extensions/SKILL.md +361 -0
- package/content/guidance/b2c/b2c-business-manager-extensions/references/EXTENSIONS-XML.md +458 -0
- package/content/guidance/b2c/b2c-controllers/SKILL.md +301 -0
- package/content/guidance/b2c/b2c-controllers/references/CLASSIC-PATTERNS.md +335 -0
- package/content/guidance/b2c/b2c-controllers/references/SFRA-PATTERNS.md +400 -0
- package/content/guidance/b2c/b2c-custom-api-development/SKILL.md +281 -0
- package/content/guidance/b2c/b2c-custom-api-development/references/CONTRACT.md +142 -0
- package/content/guidance/b2c/b2c-custom-api-development/references/IMPLEMENTATION.md +153 -0
- package/content/guidance/b2c/b2c-custom-api-development/references/TESTING.md +118 -0
- package/content/guidance/b2c/b2c-custom-caches/SKILL.md +279 -0
- package/content/guidance/b2c/b2c-custom-job-steps/SKILL.md +520 -0
- package/content/guidance/b2c/b2c-custom-job-steps/references/CHUNK-ORIENTED.md +377 -0
- package/content/guidance/b2c/b2c-custom-job-steps/references/JOBS-XML.md +212 -0
- package/content/guidance/b2c/b2c-custom-job-steps/references/STEPTYPES-JSON.md +373 -0
- package/content/guidance/b2c/b2c-custom-job-steps/references/TASK-ORIENTED.md +344 -0
- package/content/guidance/b2c/b2c-custom-objects/SKILL.md +327 -0
- package/content/guidance/b2c/b2c-custom-objects/references/OCAPI-SEARCH.md +298 -0
- package/content/guidance/b2c/b2c-forms/SKILL.md +242 -0
- package/content/guidance/b2c/b2c-forms/references/FORM-XML.md +409 -0
- package/content/guidance/b2c/b2c-hooks/SKILL.md +500 -0
- package/content/guidance/b2c/b2c-hooks/references/OCAPI-SCAPI-HOOKS.md +403 -0
- package/content/guidance/b2c/b2c-hooks/references/ORDER-HOOK-LIFECYCLE.md +169 -0
- package/content/guidance/b2c/b2c-hooks/references/SYSTEM-HOOKS.md +433 -0
- package/content/guidance/b2c/b2c-isml/SKILL.md +320 -0
- package/content/guidance/b2c/b2c-isml/references/EXPRESSIONS.md +366 -0
- package/content/guidance/b2c/b2c-isml/references/TAGS.md +443 -0
- package/content/guidance/b2c/b2c-localization/SKILL.md +344 -0
- package/content/guidance/b2c/b2c-localization/references/PATTERNS.md +407 -0
- package/content/guidance/b2c/b2c-logging/SKILL.md +352 -0
- package/content/guidance/b2c/b2c-logging/references/LOG-FILES.md +282 -0
- package/content/guidance/b2c/b2c-metadata/SKILL.md +406 -0
- package/content/guidance/b2c/b2c-metadata/references/SYSTEM-OBJECTS.md +320 -0
- package/content/guidance/b2c/b2c-metadata/references/XML-EXAMPLES.md +366 -0
- package/content/guidance/b2c/b2c-onboarding/SKILL.md +154 -0
- package/content/guidance/b2c/b2c-ordering/SKILL.md +391 -0
- package/content/guidance/b2c/b2c-page-designer/SKILL.md +410 -0
- package/content/guidance/b2c/b2c-page-designer/references/ATTRIBUTE-TYPES.md +436 -0
- package/content/guidance/b2c/b2c-page-designer/references/META-DEFINITIONS.md +340 -0
- package/content/guidance/b2c/b2c-querying-data/SKILL.md +289 -0
- package/content/guidance/b2c/b2c-querying-data/references/PERFORMANCE-APIS.md +74 -0
- package/content/guidance/b2c/b2c-scapi-admin/SKILL.md +53 -0
- package/content/guidance/b2c/b2c-scapi-admin/references/CLIENT-EXAMPLES.md +440 -0
- package/content/guidance/b2c/b2c-scapi-admin/references/INTEGRATION-PATTERNS.md +518 -0
- package/content/guidance/b2c/b2c-scapi-admin/references/OAUTH-SCOPES.md +337 -0
- package/content/guidance/b2c/b2c-scapi-shopper/SKILL.md +56 -0
- package/content/guidance/b2c/b2c-scapi-shopper/references/CHECKOUT-FLOW.md +466 -0
- package/content/guidance/b2c/b2c-scapi-shopper/references/CLIENT-EXAMPLES.md +351 -0
- package/content/guidance/b2c/b2c-scapi-shopper/references/COMMON-PATTERNS.md +390 -0
- package/content/guidance/b2c/b2c-scapi-shopper/references/SCOPES.md +290 -0
- package/content/guidance/b2c/b2c-slas-auth-patterns/SKILL.md +420 -0
- package/content/guidance/b2c/b2c-slas-auth-patterns/references/PASSKEYS.md +126 -0
- package/content/guidance/b2c/b2c-slas-auth-patterns/references/SESSION-BRIDGE.md +267 -0
- package/content/guidance/b2c/b2c-slas-auth-patterns/references/TOKEN-LIFECYCLE.md +367 -0
- package/content/guidance/b2c/b2c-webservices/SKILL.md +318 -0
- package/content/guidance/b2c/b2c-webservices/references/FTP-SERVICES.md +524 -0
- package/content/guidance/b2c/b2c-webservices/references/HTTP-SERVICES.md +578 -0
- package/content/guidance/b2c/b2c-webservices/references/SERVICES-XML.md +351 -0
- package/content/guidance/b2c/b2c-webservices/references/SOAP-SERVICES.md +587 -0
- package/content/guidance/b2c-cli/b2c-am/SKILL.md +277 -0
- package/content/guidance/b2c-cli/b2c-bm-users-roles/SKILL.md +210 -0
- package/content/guidance/b2c-cli/b2c-cap/SKILL.md +131 -0
- package/content/guidance/b2c-cli/b2c-cip/SKILL.md +116 -0
- package/content/guidance/b2c-cli/b2c-cip/references/KNOWN_TABLES.md +105 -0
- package/content/guidance/b2c-cli/b2c-cip/references/SALES_ANALYSIS.md +50 -0
- package/content/guidance/b2c-cli/b2c-cip/references/STARTER_QUERIES.md +147 -0
- package/content/guidance/b2c-cli/b2c-code/SKILL.md +146 -0
- package/content/guidance/b2c-cli/b2c-config/SKILL.md +462 -0
- package/content/guidance/b2c-cli/b2c-content/SKILL.md +176 -0
- package/content/guidance/b2c-cli/b2c-debug/SKILL.md +138 -0
- package/content/guidance/b2c-cli/b2c-docs/SKILL.md +301 -0
- package/content/guidance/b2c-cli/b2c-ecdn/SKILL.md +135 -0
- package/content/guidance/b2c-cli/b2c-ecdn/references/ADVANCED.md +97 -0
- package/content/guidance/b2c-cli/b2c-ecdn/references/SECURITY.md +75 -0
- package/content/guidance/b2c-cli/b2c-import-set-migrations/SKILL.md +265 -0
- package/content/guidance/b2c-cli/b2c-job/SKILL.md +64 -0
- package/content/guidance/b2c-cli/b2c-job/references/EXPORT.md +121 -0
- package/content/guidance/b2c-cli/b2c-job/references/IMPORT.md +55 -0
- package/content/guidance/b2c-cli/b2c-job/references/RUN-AND-MONITOR.md +119 -0
- package/content/guidance/b2c-cli/b2c-logs/SKILL.md +249 -0
- package/content/guidance/b2c-cli/b2c-metrics/SKILL.md +315 -0
- package/content/guidance/b2c-cli/b2c-mrt/SKILL.md +207 -0
- package/content/guidance/b2c-cli/b2c-mrt/references/BUNDLE-COMMANDS.md +203 -0
- package/content/guidance/b2c-cli/b2c-mrt/references/ENVIRONMENT-COMMANDS.md +218 -0
- package/content/guidance/b2c-cli/b2c-mrt/references/PROJECT-COMMANDS.md +154 -0
- package/content/guidance/b2c-cli/b2c-sandbox/SKILL.md +112 -0
- package/content/guidance/b2c-cli/b2c-scapi-custom/SKILL.md +126 -0
- package/content/guidance/b2c-cli/b2c-scapi-schemas/SKILL.md +66 -0
- package/content/guidance/b2c-cli/b2c-scapi-schemas/references/CLI-EXAMPLES.md +108 -0
- package/content/guidance/b2c-cli/b2c-site-import-export/SKILL.md +57 -0
- package/content/guidance/b2c-cli/b2c-site-import-export/references/IMPORT-OPTIONS.md +118 -0
- package/content/guidance/b2c-cli/b2c-site-import-export/references/METADATA-XML.md +381 -0
- package/content/guidance/b2c-cli/b2c-site-import-export/references/WORKFLOWS.md +182 -0
- package/content/guidance/b2c-cli/b2c-sites/SKILL.md +112 -0
- package/content/guidance/b2c-cli/b2c-slas/SKILL.md +182 -0
- package/content/guidance/b2c-cli/b2c-webdav/SKILL.md +186 -0
- package/content/guidance/b2c-ops/b2c-checkout-triage/SKILL.md +68 -0
- package/content/guidance/b2c-ops/b2c-job-health/SKILL.md +75 -0
- package/content/guidance/b2c-ops/b2c-job-health/references/job-logs.md +21 -0
- package/content/guidance/b2c-ops/b2c-order-failure-triage/SKILL.md +66 -0
- package/content/guidance/b2c-ops/b2c-order-failure-triage/references/order-evidence.md +87 -0
- package/content/guidance/b2c-ops/b2c-production-triage/SKILL.md +87 -0
- package/content/guidance/b2c-ops/b2c-production-triage/references/escalation.md +57 -0
- package/content/guidance/index.json +1949 -0
- package/content/guidance/storefront-next/sfnext-accessibility/SKILL.md +103 -0
- package/content/guidance/storefront-next/sfnext-accessibility/references/checklist.md +64 -0
- package/content/guidance/storefront-next/sfnext-analytics-consent/SKILL.md +91 -0
- package/content/guidance/storefront-next/sfnext-analytics-consent/references/CUSTOM-ADAPTER.md +49 -0
- package/content/guidance/storefront-next/sfnext-authentication/SKILL.md +127 -0
- package/content/guidance/storefront-next/sfnext-authentication/references/COOKIES.md +39 -0
- package/content/guidance/storefront-next/sfnext-authentication/references/LOGIN-FLOWS.md +59 -0
- package/content/guidance/storefront-next/sfnext-commerce-features/SKILL.md +67 -0
- package/content/guidance/storefront-next/sfnext-commerce-features/references/FEATURE-PREREQUISITES.md +37 -0
- package/content/guidance/storefront-next/sfnext-components/SKILL.md +153 -0
- package/content/guidance/storefront-next/sfnext-components/references/COMPONENT-AUTHORING.md +118 -0
- package/content/guidance/storefront-next/sfnext-components/references/SHAPE-TOKENS.md +51 -0
- package/content/guidance/storefront-next/sfnext-components/references/STORYBOOK.md +54 -0
- package/content/guidance/storefront-next/sfnext-components/references/TOKEN-SYSTEM.md +53 -0
- package/content/guidance/storefront-next/sfnext-components/references/TROUBLESHOOTING.md +19 -0
- package/content/guidance/storefront-next/sfnext-configuration/SKILL.md +163 -0
- package/content/guidance/storefront-next/sfnext-configuration/references/ENV-VARIABLES.md +55 -0
- package/content/guidance/storefront-next/sfnext-configuration/references/MULTI-SITE-URLS.md +137 -0
- package/content/guidance/storefront-next/sfnext-data-fetching/SKILL.md +140 -0
- package/content/guidance/storefront-next/sfnext-data-fetching/references/ACTIONS.md +53 -0
- package/content/guidance/storefront-next/sfnext-data-fetching/references/API-CLIENTS.md +34 -0
- package/content/guidance/storefront-next/sfnext-data-fetching/references/LOADERS.md +73 -0
- package/content/guidance/storefront-next/sfnext-data-fetching/references/SCAPI-FETCHER.md +39 -0
- package/content/guidance/storefront-next/sfnext-deployment/SKILL.md +127 -0
- package/content/guidance/storefront-next/sfnext-deployment/references/MRT-DEPLOYMENT.md +59 -0
- package/content/guidance/storefront-next/sfnext-extensions/SKILL.md +118 -0
- package/content/guidance/storefront-next/sfnext-extensions/references/ACTION-HOOKS.md +57 -0
- package/content/guidance/storefront-next/sfnext-extensions/references/BASE-AUDIT.md +68 -0
- package/content/guidance/storefront-next/sfnext-extensions/references/CLI-AND-INSTALL.md +58 -0
- package/content/guidance/storefront-next/sfnext-extensions/references/EXTENSION-EXAMPLES.md +79 -0
- package/content/guidance/storefront-next/sfnext-hybrid-storefronts/SKILL.md +93 -0
- package/content/guidance/storefront-next/sfnext-hybrid-storefronts/references/HYBRID-PROXY-CONFIG.md +86 -0
- package/content/guidance/storefront-next/sfnext-i18n/SKILL.md +152 -0
- package/content/guidance/storefront-next/sfnext-i18n/references/locale-config.md +35 -0
- package/content/guidance/storefront-next/sfnext-overview/SKILL.md +101 -0
- package/content/guidance/storefront-next/sfnext-page-designer/SKILL.md +202 -0
- package/content/guidance/storefront-next/sfnext-page-designer/references/BUSINESS-MANAGER.md +46 -0
- package/content/guidance/storefront-next/sfnext-page-designer/references/COMPONENT-REGISTRY.md +111 -0
- package/content/guidance/storefront-next/sfnext-page-designer/references/DECORATOR-PATTERNS.md +168 -0
- package/content/guidance/storefront-next/sfnext-page-designer/references/REVIEW-CHECKLIST.md +83 -0
- package/content/guidance/storefront-next/sfnext-page-designer/references/TROUBLESHOOTING.md +35 -0
- package/content/guidance/storefront-next/sfnext-performance/SKILL.md +102 -0
- package/content/guidance/storefront-next/sfnext-performance/references/PERFORMANCE-REVIEW-CHECKLIST.md +85 -0
- package/content/guidance/storefront-next/sfnext-performance/references/SUSPENSE-AND-STREAMING.md +58 -0
- package/content/guidance/storefront-next/sfnext-project-setup/SKILL.md +147 -0
- package/content/guidance/storefront-next/sfnext-project-setup/references/PROJECT-STRUCTURE.md +61 -0
- package/content/guidance/storefront-next/sfnext-project-setup/references/SCRIPTS.md +47 -0
- package/content/guidance/storefront-next/sfnext-project-setup/references/SFNEXT-CLI.md +63 -0
- package/content/guidance/storefront-next/sfnext-quality-gates/SKILL.md +70 -0
- package/content/guidance/storefront-next/sfnext-quality-gates/references/lint-and-budgets.md +39 -0
- package/content/guidance/storefront-next/sfnext-revalidation/SKILL.md +121 -0
- package/content/guidance/storefront-next/sfnext-revalidation/references/POLICIES-AND-TAGS.md +55 -0
- package/content/guidance/storefront-next/sfnext-routing/SKILL.md +123 -0
- package/content/guidance/storefront-next/sfnext-routing/references/ROUTE-CONVENTIONS.md +65 -0
- package/content/guidance/storefront-next/sfnext-routing/references/URLS-AND-SEO-ROUTES.md +22 -0
- package/content/guidance/storefront-next/sfnext-scapi/SKILL.md +126 -0
- package/content/guidance/storefront-next/sfnext-scapi/references/WORKED-EXAMPLE.md +39 -0
- package/content/guidance/storefront-next/sfnext-security/SKILL.md +129 -0
- package/content/guidance/storefront-next/sfnext-security/references/COOKIE-DOMAIN.md +39 -0
- package/content/guidance/storefront-next/sfnext-security/references/TURNSTILE.md +43 -0
- package/content/guidance/storefront-next/sfnext-seo/SKILL.md +95 -0
- package/content/guidance/storefront-next/sfnext-seo/references/MULTI-DOMAIN-BASE-PATH.md +17 -0
- package/content/guidance/storefront-next/sfnext-seo/references/SEO-ROUTES.md +31 -0
- package/content/guidance/storefront-next/sfnext-state-management/SKILL.md +114 -0
- package/content/guidance/storefront-next/sfnext-state-management/references/PATTERNS.md +45 -0
- package/content/guidance/storefront-next/sfnext-testing/SKILL.md +151 -0
- package/content/guidance/storefront-next/sfnext-testing/references/E2E.md +38 -0
- package/content/guidance/storefront-next/sfnext-testing/references/STORYBOOK-PATTERNS.md +97 -0
- package/content/guidance/storefront-next/sfnext-testing/references/UNIT-AND-ROUTE-TESTS.md +60 -0
- package/content/guidance/storefront-next/sfnext-theming/SKILL.md +104 -0
- package/content/guidance/storefront-next/sfnext-theming/references/REBRAND-CHECKLIST.md +29 -0
- package/dist/commands/cap/install.d.ts +1 -0
- package/dist/commands/cap/list.d.ts +1 -0
- package/dist/commands/cap/pull.d.ts +1 -0
- package/dist/commands/cap/tasks.d.ts +1 -0
- package/dist/commands/cap/uninstall.d.ts +1 -0
- package/dist/commands/cip/describe.d.ts +1 -0
- package/dist/commands/cip/query.d.ts +1 -0
- package/dist/commands/cip/report/bot-traffic-share.d.ts +1 -0
- package/dist/commands/cip/report/checkout-funnel-dropoff.d.ts +1 -0
- package/dist/commands/cip/report/controller-error-rate-trend.d.ts +1 -0
- package/dist/commands/cip/report/controller-health-scorecard.d.ts +1 -0
- package/dist/commands/cip/report/customer-registration-trends.d.ts +1 -0
- package/dist/commands/cip/report/discount-depth-breakdown.d.ts +1 -0
- package/dist/commands/cip/report/inventory-stockout-by-location.d.ts +1 -0
- package/dist/commands/cip/report/new-vs-returning-buyer-revenue.d.ts +1 -0
- package/dist/commands/cip/report/ocapi-client-usage.d.ts +1 -0
- package/dist/commands/cip/report/ocapi-requests.d.ts +1 -0
- package/dist/commands/cip/report/payment-method-performance.d.ts +1 -0
- package/dist/commands/cip/report/product-co-purchase-analysis.d.ts +1 -0
- package/dist/commands/cip/report/promotion-discount-analysis.d.ts +1 -0
- package/dist/commands/cip/report/promotion-roi-leaderboard.d.ts +1 -0
- package/dist/commands/cip/report/recommender-effectiveness.d.ts +1 -0
- package/dist/commands/cip/report/remote-include-performance.d.ts +1 -0
- package/dist/commands/cip/report/revenue-by-channel.d.ts +1 -0
- package/dist/commands/cip/report/sales-analytics.d.ts +1 -0
- package/dist/commands/cip/report/sales-summary.d.ts +1 -0
- package/dist/commands/cip/report/scapi-cache-hit-ratio.d.ts +1 -0
- package/dist/commands/cip/report/scapi-error-rate-by-status.d.ts +1 -0
- package/dist/commands/cip/report/scapi-latency-distribution.d.ts +1 -0
- package/dist/commands/cip/report/scapi-traffic-latency.d.ts +1 -0
- package/dist/commands/cip/report/search-query-performance.d.ts +1 -0
- package/dist/commands/cip/report/top-referrers.d.ts +1 -0
- package/dist/commands/cip/report/top-selling-products.d.ts +1 -0
- package/dist/commands/cip/report/zero-result-searches.d.ts +1 -0
- package/dist/commands/cip/tables.d.ts +1 -0
- package/dist/commands/code/activate.d.ts +1 -0
- package/dist/commands/code/delete.d.ts +1 -0
- package/dist/commands/code/deploy.d.ts +1 -0
- package/dist/commands/code/download.d.ts +1 -0
- package/dist/commands/code/watch.d.ts +1 -0
- package/dist/commands/commands/search.d.ts +35 -0
- package/dist/commands/commands/search.js +85 -0
- package/dist/commands/commands/search.js.map +1 -0
- package/dist/commands/content/export.d.ts +1 -0
- package/dist/commands/content/list.d.ts +1 -0
- package/dist/commands/content/validate.d.ts +1 -0
- package/dist/commands/debug/cli.d.ts +1 -0
- package/dist/commands/debug/index.d.ts +1 -0
- package/dist/commands/docs/cache.d.ts +1 -0
- package/dist/commands/docs/download.d.ts +1 -0
- package/dist/commands/docs/read.d.ts +1 -0
- package/dist/commands/docs/schema.d.ts +1 -0
- package/dist/commands/docs/search.d.ts +1 -0
- package/dist/commands/docs/skill.d.ts +41 -0
- package/dist/commands/docs/skill.js +183 -0
- package/dist/commands/docs/skill.js.map +1 -0
- package/dist/commands/ecdn/cache/purge.d.ts +1 -0
- package/dist/commands/ecdn/certificates/add.d.ts +1 -0
- package/dist/commands/ecdn/certificates/delete.d.ts +1 -0
- package/dist/commands/ecdn/certificates/list.d.ts +1 -0
- package/dist/commands/ecdn/certificates/update.d.ts +1 -0
- package/dist/commands/ecdn/certificates/validate.d.ts +1 -0
- package/dist/commands/ecdn/cipher-suites/get.d.ts +1 -0
- package/dist/commands/ecdn/cipher-suites/update.d.ts +1 -0
- package/dist/commands/ecdn/firewall/create.d.ts +1 -0
- package/dist/commands/ecdn/firewall/delete.d.ts +1 -0
- package/dist/commands/ecdn/firewall/get.d.ts +1 -0
- package/dist/commands/ecdn/firewall/list.d.ts +1 -0
- package/dist/commands/ecdn/firewall/reorder.d.ts +1 -0
- package/dist/commands/ecdn/firewall/update.d.ts +1 -0
- package/dist/commands/ecdn/logpush/jobs/create.d.ts +1 -0
- package/dist/commands/ecdn/logpush/jobs/delete.d.ts +1 -0
- package/dist/commands/ecdn/logpush/jobs/get.d.ts +1 -0
- package/dist/commands/ecdn/logpush/jobs/list.d.ts +1 -0
- package/dist/commands/ecdn/logpush/jobs/update.d.ts +1 -0
- package/dist/commands/ecdn/logpush/ownership.d.ts +1 -0
- package/dist/commands/ecdn/mrt-rules/create.d.ts +1 -0
- package/dist/commands/ecdn/mrt-rules/delete.d.ts +1 -0
- package/dist/commands/ecdn/mrt-rules/get.d.ts +1 -0
- package/dist/commands/ecdn/mrt-rules/rules/delete.d.ts +1 -0
- package/dist/commands/ecdn/mrt-rules/rules/update.d.ts +1 -0
- package/dist/commands/ecdn/mrt-rules/update.d.ts +1 -0
- package/dist/commands/ecdn/mtls/create.d.ts +1 -0
- package/dist/commands/ecdn/mtls/delete.d.ts +1 -0
- package/dist/commands/ecdn/mtls/get.d.ts +1 -0
- package/dist/commands/ecdn/mtls/issue.d.ts +1 -0
- package/dist/commands/ecdn/mtls/list.d.ts +1 -0
- package/dist/commands/ecdn/mtls/setup.d.ts +1 -0
- package/dist/commands/ecdn/origin-headers/delete.d.ts +1 -0
- package/dist/commands/ecdn/origin-headers/get.d.ts +1 -0
- package/dist/commands/ecdn/origin-headers/set.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/notifications/create.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/notifications/delete.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/notifications/list.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/policies/create.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/policies/delete.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/policies/get.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/policies/list.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/policies/update.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/scripts/get.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/scripts/list.d.ts +1 -0
- package/dist/commands/ecdn/rate-limit/create.d.ts +1 -0
- package/dist/commands/ecdn/rate-limit/delete.d.ts +1 -0
- package/dist/commands/ecdn/rate-limit/get.d.ts +1 -0
- package/dist/commands/ecdn/rate-limit/list.d.ts +1 -0
- package/dist/commands/ecdn/rate-limit/update.d.ts +1 -0
- package/dist/commands/ecdn/security/get.d.ts +1 -0
- package/dist/commands/ecdn/security/update.d.ts +1 -0
- package/dist/commands/ecdn/speed/get.d.ts +1 -0
- package/dist/commands/ecdn/speed/update.d.ts +1 -0
- package/dist/commands/ecdn/waf/groups/list.d.ts +1 -0
- package/dist/commands/ecdn/waf/groups/update.d.ts +1 -0
- package/dist/commands/ecdn/waf/managed-rules/list.d.ts +1 -0
- package/dist/commands/ecdn/waf/managed-rules/update.d.ts +1 -0
- package/dist/commands/ecdn/waf/migrate.d.ts +1 -0
- package/dist/commands/ecdn/waf/owasp/get.d.ts +1 -0
- package/dist/commands/ecdn/waf/owasp/update.d.ts +1 -0
- package/dist/commands/ecdn/waf/rules/get.d.ts +1 -0
- package/dist/commands/ecdn/waf/rules/list.d.ts +1 -0
- package/dist/commands/ecdn/waf/rules/update.d.ts +1 -0
- package/dist/commands/ecdn/waf/rulesets/list.d.ts +1 -0
- package/dist/commands/ecdn/waf/rulesets/update.d.ts +1 -0
- package/dist/commands/ecdn/zones/create.d.ts +1 -0
- package/dist/commands/ecdn/zones/list.d.ts +1 -0
- package/dist/commands/job/execution/delete.d.ts +1 -0
- package/dist/commands/job/export.d.ts +1 -0
- package/dist/commands/job/import-set.d.ts +1 -0
- package/dist/commands/job/import.d.ts +1 -0
- package/dist/commands/job/log.d.ts +1 -0
- package/dist/commands/job/run.d.ts +1 -0
- package/dist/commands/job/search.d.ts +1 -0
- package/dist/commands/job/wait.d.ts +1 -0
- package/dist/commands/logs/get.d.ts +1 -0
- package/dist/commands/logs/list.d.ts +1 -0
- package/dist/commands/logs/tail.d.ts +1 -0
- package/dist/commands/metrics/controller.d.ts +1 -0
- package/dist/commands/metrics/ecdn.d.ts +1 -0
- package/dist/commands/metrics/mrt.d.ts +1 -0
- package/dist/commands/metrics/ocapi.d.ts +1 -0
- package/dist/commands/metrics/overall.d.ts +1 -0
- package/dist/commands/metrics/sales.d.ts +1 -0
- package/dist/commands/metrics/scapi-hooks.d.ts +1 -0
- package/dist/commands/metrics/scapi.d.ts +1 -0
- package/dist/commands/metrics/third-party.d.ts +1 -0
- package/dist/commands/mrt/bundle/delete.d.ts +1 -0
- package/dist/commands/mrt/bundle/deploy.d.ts +1 -0
- package/dist/commands/mrt/bundle/download.d.ts +1 -0
- package/dist/commands/mrt/bundle/history.d.ts +1 -0
- package/dist/commands/mrt/bundle/list.d.ts +1 -0
- package/dist/commands/mrt/bundle/save.d.ts +1 -0
- package/dist/commands/mrt/bundle/upload-v2.d.ts +1 -0
- package/dist/commands/mrt/env/access-control/list.d.ts +1 -0
- package/dist/commands/mrt/env/b2c.d.ts +1 -0
- package/dist/commands/mrt/env/clone.d.ts +1 -0
- package/dist/commands/mrt/env/create.d.ts +1 -0
- package/dist/commands/mrt/env/delete.d.ts +1 -0
- package/dist/commands/mrt/env/get.d.ts +1 -0
- package/dist/commands/mrt/env/invalidate.d.ts +1 -0
- package/dist/commands/mrt/env/list.d.ts +1 -0
- package/dist/commands/mrt/env/redirect/clone.d.ts +1 -0
- package/dist/commands/mrt/env/redirect/create.d.ts +1 -0
- package/dist/commands/mrt/env/redirect/delete.d.ts +1 -0
- package/dist/commands/mrt/env/redirect/list.d.ts +1 -0
- package/dist/commands/mrt/env/update.d.ts +1 -0
- package/dist/commands/mrt/env/var/delete.d.ts +1 -0
- package/dist/commands/mrt/env/var/list.d.ts +1 -0
- package/dist/commands/mrt/env/var/push.d.ts +1 -0
- package/dist/commands/mrt/env/var/set.d.ts +1 -0
- package/dist/commands/mrt/org/b2c.d.ts +1 -0
- package/dist/commands/mrt/org/cert/create.d.ts +1 -0
- package/dist/commands/mrt/org/cert/delete.d.ts +1 -0
- package/dist/commands/mrt/org/cert/get.d.ts +1 -0
- package/dist/commands/mrt/org/cert/list.d.ts +1 -0
- package/dist/commands/mrt/org/cert/restart-validation.d.ts +1 -0
- package/dist/commands/mrt/org/list.d.ts +1 -0
- package/dist/commands/mrt/org/member/add.d.ts +1 -0
- package/dist/commands/mrt/org/member/get.d.ts +1 -0
- package/dist/commands/mrt/org/member/list.d.ts +1 -0
- package/dist/commands/mrt/org/member/remove.d.ts +1 -0
- package/dist/commands/mrt/org/member/update.d.ts +1 -0
- package/dist/commands/mrt/project/create.d.ts +1 -0
- package/dist/commands/mrt/project/delete.d.ts +1 -0
- package/dist/commands/mrt/project/get.d.ts +1 -0
- package/dist/commands/mrt/project/list.d.ts +1 -0
- package/dist/commands/mrt/project/member/add.d.ts +1 -0
- package/dist/commands/mrt/project/member/get.d.ts +1 -0
- package/dist/commands/mrt/project/member/list.d.ts +1 -0
- package/dist/commands/mrt/project/member/remove.d.ts +1 -0
- package/dist/commands/mrt/project/member/update.d.ts +1 -0
- package/dist/commands/mrt/project/notification/delete.d.ts +1 -0
- package/dist/commands/mrt/project/notification/get.d.ts +1 -0
- package/dist/commands/mrt/project/update.d.ts +1 -0
- package/dist/commands/mrt/save-credentials.d.ts +1 -0
- package/dist/commands/mrt/tail-logs.d.ts +1 -0
- package/dist/commands/mrt/user/api-key.d.ts +1 -0
- package/dist/commands/mrt/user/email-prefs.d.ts +1 -0
- package/dist/commands/mrt/user/profile.d.ts +1 -0
- package/dist/commands/scaffold/init.js +2 -1
- package/dist/commands/scaffold/init.js.map +1 -1
- package/dist/commands/scapi/custom/status.d.ts +1 -0
- package/dist/commands/scapi/schemas/get.d.ts +1 -0
- package/dist/commands/scapi/schemas/list.d.ts +1 -0
- package/dist/commands/setup/ide/tsserver-plugin.d.ts +1 -0
- package/dist/commands/setup/ide/vscode-types.d.ts +1 -0
- package/dist/commands/setup/index.js +4 -3
- package/dist/commands/setup/index.js.map +1 -1
- package/dist/commands/setup/inspect.d.ts +1 -0
- package/dist/commands/setup/inspect.js +17 -2
- package/dist/commands/setup/inspect.js.map +1 -1
- package/dist/commands/setup/instance/create.d.ts +1 -0
- package/dist/commands/setup/instance/list.d.ts +1 -0
- package/dist/commands/setup/instance/remove.d.ts +1 -0
- package/dist/commands/setup/instance/set-active.d.ts +1 -0
- package/dist/commands/setup/openshell.d.ts +1 -0
- package/dist/commands/setup/skills.d.ts +1 -0
- package/dist/commands/slas/client/create.d.ts +1 -0
- package/dist/commands/slas/client/delete.d.ts +1 -0
- package/dist/commands/slas/client/get.d.ts +1 -0
- package/dist/commands/slas/client/list.d.ts +1 -0
- package/dist/commands/slas/client/open.d.ts +1 -0
- package/dist/commands/slas/client/update.d.ts +1 -0
- package/dist/commands/slas/token.d.ts +1 -0
- package/dist/commands/slas/token.js +2 -1
- package/dist/commands/slas/token.js.map +1 -1
- package/dist/commands/webdav/get.d.ts +1 -0
- package/dist/commands/webdav/rm.d.ts +1 -0
- package/dist/help.d.ts +25 -0
- package/dist/help.js +96 -0
- package/dist/help.js.map +1 -0
- package/dist/lib/scaffold/generate-helper.js +3 -2
- package/dist/lib/scaffold/generate-helper.js.map +1 -1
- package/dist/lib/skills.d.ts +19 -0
- package/dist/lib/skills.js +75 -0
- package/dist/lib/skills.js.map +1 -0
- package/dist/utils/cip/command.d.ts +1 -0
- package/dist/utils/ecdn/zone-command.d.ts +1 -0
- package/dist/utils/slas/client.d.ts +1 -0
- package/oclif.manifest.json +21814 -18473
- package/package.json +11 -5
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
# System Hooks Reference
|
|
2
|
+
|
|
3
|
+
System hooks provide extension points for core B2C Commerce functionality like order calculation, payment processing, and order management.
|
|
4
|
+
|
|
5
|
+
## Calculate Hooks
|
|
6
|
+
|
|
7
|
+
Calculate hooks control basket and order calculation logic.
|
|
8
|
+
|
|
9
|
+
### Extension Points
|
|
10
|
+
|
|
11
|
+
| Extension Point | Function | Purpose |
|
|
12
|
+
|-----------------|----------|---------|
|
|
13
|
+
| `dw.order.calculate` | `calculate(lineItemCtnr)` | Full calculation |
|
|
14
|
+
| `dw.order.calculateShipping` | `calculateShipping(lineItemCtnr)` | Shipping only |
|
|
15
|
+
| `dw.order.calculateTax` | `calculateTax(lineItemCtnr)` | Tax only |
|
|
16
|
+
|
|
17
|
+
### Registration
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"hooks": [
|
|
22
|
+
{"name": "dw.order.calculate", "script": "./calculate.js"},
|
|
23
|
+
{"name": "dw.order.calculateShipping", "script": "./calculate.js"},
|
|
24
|
+
{"name": "dw.order.calculateTax", "script": "./calculate.js"}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### SFRA Implementation
|
|
30
|
+
|
|
31
|
+
SFRA registers all three extension points to
|
|
32
|
+
`app_storefront_base/cartridge/scripts/hooks/cart/calculate.js`. Do not call `TaxMgr.applyTax()` from
|
|
33
|
+
inside `calculateTax` — `applyTax` belongs in `dw.order.calculate` and dispatches to
|
|
34
|
+
`dw.order.calculateTax` itself.
|
|
35
|
+
|
|
36
|
+
```javascript
|
|
37
|
+
// calculate.js
|
|
38
|
+
var Status = require('dw/system/Status');
|
|
39
|
+
var ShippingMgr = require('dw/order/ShippingMgr');
|
|
40
|
+
var TaxMgr = require('dw/order/TaxMgr');
|
|
41
|
+
var collections = require('*/cartridge/scripts/util/collections');
|
|
42
|
+
|
|
43
|
+
exports.calculateShipping = function(basket) {
|
|
44
|
+
ShippingMgr.applyShippingCost(basket);
|
|
45
|
+
return new Status(Status.OK);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
exports.calculateTax = function(basket) {
|
|
49
|
+
var basketCalculationHelpers = require('*/cartridge/scripts/helpers/basketCalculationHelpers');
|
|
50
|
+
var taxes = basketCalculationHelpers.calculateTaxes(basket);
|
|
51
|
+
var taxesMap = {};
|
|
52
|
+
|
|
53
|
+
taxes.taxes.forEach(function (item) {
|
|
54
|
+
taxesMap[item.uuid] = { value: item.value, amount: item.amount };
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
var lineItems = basket.getAllLineItems();
|
|
58
|
+
|
|
59
|
+
collections.forEach(lineItems, function (lineItem) {
|
|
60
|
+
var tax = taxesMap[lineItem.UUID];
|
|
61
|
+
|
|
62
|
+
if (tax) {
|
|
63
|
+
if (tax.amount) {
|
|
64
|
+
lineItem.updateTaxAmount(tax.value);
|
|
65
|
+
} else {
|
|
66
|
+
lineItem.updateTax(tax.value);
|
|
67
|
+
}
|
|
68
|
+
} else if (lineItem.taxClassID === TaxMgr.customRateTaxClassID) {
|
|
69
|
+
lineItem.updateTax(lineItem.taxRate);
|
|
70
|
+
} else {
|
|
71
|
+
lineItem.updateTax(null);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Order-level price adjustments, including order-level shipping price adjustments
|
|
76
|
+
if (!basket.getPriceAdjustments().empty || !basket.getShippingPriceAdjustments().empty) {
|
|
77
|
+
if (collections.first(basket.getPriceAdjustments(), function (priceAdjustment) {
|
|
78
|
+
return taxesMap[priceAdjustment.UUID] === null;
|
|
79
|
+
}) || collections.first(basket.getShippingPriceAdjustments(), function (shippingPriceAdjustment) {
|
|
80
|
+
return taxesMap[shippingPriceAdjustment.UUID] === null;
|
|
81
|
+
})) {
|
|
82
|
+
basket.updateOrderLevelPriceAdjustmentTax();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (taxes.custom) {
|
|
87
|
+
Object.keys(taxes.custom).forEach(function (key) {
|
|
88
|
+
basket.custom[key] = taxes.custom[key];
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return new Status(Status.OK);
|
|
93
|
+
};
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### SCAPI Consideration
|
|
97
|
+
|
|
98
|
+
**Important**: Do not use transactions in calculate hooks when supporting SCAPI:
|
|
99
|
+
|
|
100
|
+
```javascript
|
|
101
|
+
exports.calculate = function(lineItemCtnr) {
|
|
102
|
+
// DON'T do this - breaks SCAPI
|
|
103
|
+
// Transaction.wrap(function() { ... });
|
|
104
|
+
|
|
105
|
+
// DO this instead - SCAPI manages transactions
|
|
106
|
+
calculatePrices(lineItemCtnr);
|
|
107
|
+
return new Status(Status.OK);
|
|
108
|
+
};
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Check if running under SCAPI:
|
|
112
|
+
|
|
113
|
+
```javascript
|
|
114
|
+
exports.calculate = function(lineItemCtnr) {
|
|
115
|
+
if (request.isSCAPI()) {
|
|
116
|
+
// SCAPI path - no transactions
|
|
117
|
+
} else {
|
|
118
|
+
// Controller path - may use transactions
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Payment Hooks
|
|
124
|
+
|
|
125
|
+
Payment hooks handle authorization, capture, and refund operations.
|
|
126
|
+
|
|
127
|
+
### Extension Points
|
|
128
|
+
|
|
129
|
+
| Extension Point | Function | When Called |
|
|
130
|
+
|-----------------|----------|-------------|
|
|
131
|
+
| `dw.order.payment.authorize` | `authorize(order, instrument)` | Initial authorization |
|
|
132
|
+
| `dw.order.payment.authorizeCreditCard` | `authorizeCreditCard(order, instrument, cvn)` | Credit card auth |
|
|
133
|
+
| `dw.order.payment.validateAuthorization` | `validateAuthorization(order)` | Check auth validity |
|
|
134
|
+
| `dw.order.payment.reauthorize` | `reauthorize(order)` | Re-authorize if expired |
|
|
135
|
+
| `dw.order.payment.capture` | `capture(invoice)` | Capture payment |
|
|
136
|
+
| `dw.order.payment.refund` | `refund(invoice)` | Refund payment |
|
|
137
|
+
| `dw.order.payment.releaseAuthorization` | `releaseAuthorization(order)` | Release auth hold |
|
|
138
|
+
|
|
139
|
+
### Authorization Flow
|
|
140
|
+
|
|
141
|
+
The Shopper Orders payment-instrument `POST`/`PATCH` invokes these hooks inside platform request
|
|
142
|
+
processing. Do not add a nested `Transaction.wrap` around order-PI mutations in that path.
|
|
143
|
+
|
|
144
|
+
The `paymentDetails` argument depends on the request:
|
|
145
|
+
|
|
146
|
+
- With a customer payment-instrument ID, Commerce copies the matching customer PI for authorization;
|
|
147
|
+
request amount and CVN are still propagated.
|
|
148
|
+
- Otherwise Commerce populates the authorization details from request payment-card, bank-account, or
|
|
149
|
+
other payment data.
|
|
150
|
+
|
|
151
|
+
Do not assume `paymentDetails` is the same object instance as the persistent PI already on `order`.
|
|
152
|
+
Resolve the persistent PI when the integration stored provider state there.
|
|
153
|
+
|
|
154
|
+
```javascript
|
|
155
|
+
// payment.js
|
|
156
|
+
var Status = require('dw/system/Status');
|
|
157
|
+
var Transaction = require('dw/system/Transaction');
|
|
158
|
+
|
|
159
|
+
exports.authorize = function(order, paymentDetails) {
|
|
160
|
+
var paymentInstrument = resolvePersistentPaymentInstrument(order, paymentDetails);
|
|
161
|
+
var paymentMethod = paymentInstrument.paymentMethod;
|
|
162
|
+
|
|
163
|
+
// Call payment processor
|
|
164
|
+
var result = callPaymentProcessor(order, paymentInstrument);
|
|
165
|
+
|
|
166
|
+
if (result.success) {
|
|
167
|
+
// SCAPI order-PI authorization already runs in a platform transaction.
|
|
168
|
+
paymentInstrument.paymentTransaction.setTransactionID(result.transactionId);
|
|
169
|
+
paymentInstrument.paymentTransaction.custom.authCode = result.authCode;
|
|
170
|
+
paymentInstrument.paymentTransaction.custom.authTimestamp = new Date();
|
|
171
|
+
return new Status(Status.OK);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return new Status(Status.ERROR, 'AUTHORIZATION_FAILED', result.errorMessage);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
exports.validateAuthorization = function(order) {
|
|
178
|
+
var validPayments = 0;
|
|
179
|
+
var instruments = order.paymentInstruments.iterator();
|
|
180
|
+
|
|
181
|
+
while (instruments.hasNext()) {
|
|
182
|
+
var pi = instruments.next();
|
|
183
|
+
var authTimestamp = pi.paymentTransaction.custom.authTimestamp;
|
|
184
|
+
|
|
185
|
+
// Check if auth is still valid (e.g., within 7 days)
|
|
186
|
+
if (authTimestamp) {
|
|
187
|
+
var authAge = Date.now() - authTimestamp.getTime();
|
|
188
|
+
var sevenDays = 7 * 24 * 60 * 60 * 1000;
|
|
189
|
+
|
|
190
|
+
if (authAge < sevenDays) {
|
|
191
|
+
validPayments++;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return validPayments > 0 ? new Status(Status.OK) : new Status(Status.ERROR);
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
exports.reauthorize = function(order) {
|
|
200
|
+
var instruments = order.paymentInstruments.iterator();
|
|
201
|
+
|
|
202
|
+
while (instruments.hasNext()) {
|
|
203
|
+
var pi = instruments.next();
|
|
204
|
+
var result = callPaymentProcessor(order, pi);
|
|
205
|
+
|
|
206
|
+
if (!result.success) {
|
|
207
|
+
return new Status(Status.ERROR, 'REAUTH_FAILED');
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
Transaction.wrap(function() {
|
|
211
|
+
pi.paymentTransaction.custom.authTimestamp = new Date();
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return new Status(Status.OK);
|
|
216
|
+
};
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Capture Flow
|
|
220
|
+
|
|
221
|
+
```javascript
|
|
222
|
+
exports.capture = function(invoice) {
|
|
223
|
+
var order = invoice.order;
|
|
224
|
+
var amount = invoice.grandTotal.grossPrice;
|
|
225
|
+
|
|
226
|
+
// Find payment instrument for this invoice
|
|
227
|
+
var paymentInstrument = findPaymentInstrument(order, invoice);
|
|
228
|
+
if (!paymentInstrument) {
|
|
229
|
+
return new Status(Status.ERROR, 'NO_PAYMENT_INSTRUMENT');
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Call payment processor to capture
|
|
233
|
+
var result = capturePayment(paymentInstrument, amount);
|
|
234
|
+
|
|
235
|
+
if (result.success) {
|
|
236
|
+
Transaction.wrap(function() {
|
|
237
|
+
invoice.addCaptureTransaction(paymentInstrument, amount);
|
|
238
|
+
});
|
|
239
|
+
return new Status(Status.OK);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return new Status(Status.ERROR, 'CAPTURE_FAILED', result.errorMessage);
|
|
243
|
+
};
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Refund Flow
|
|
247
|
+
|
|
248
|
+
```javascript
|
|
249
|
+
exports.refund = function(invoice) {
|
|
250
|
+
var order = invoice.order;
|
|
251
|
+
var amount = invoice.grandTotal.grossPrice;
|
|
252
|
+
|
|
253
|
+
var paymentInstrument = findPaymentInstrument(order, invoice);
|
|
254
|
+
if (!paymentInstrument) {
|
|
255
|
+
return new Status(Status.ERROR, 'NO_PAYMENT_INSTRUMENT');
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
var result = refundPayment(paymentInstrument, amount);
|
|
259
|
+
|
|
260
|
+
if (result.success) {
|
|
261
|
+
Transaction.wrap(function() {
|
|
262
|
+
invoice.addRefundTransaction(paymentInstrument, amount);
|
|
263
|
+
});
|
|
264
|
+
return new Status(Status.OK);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
return new Status(Status.ERROR, 'REFUND_FAILED', result.errorMessage);
|
|
268
|
+
};
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Order Hooks
|
|
272
|
+
|
|
273
|
+
### Order Number Generation
|
|
274
|
+
|
|
275
|
+
```javascript
|
|
276
|
+
// orders.js
|
|
277
|
+
var OrderMgr = require('dw/order/OrderMgr');
|
|
278
|
+
var Site = require('dw/system/Site');
|
|
279
|
+
|
|
280
|
+
exports.createOrderNo = function() {
|
|
281
|
+
// Get sequential number
|
|
282
|
+
var seqNo = OrderMgr.createOrderSequenceNo();
|
|
283
|
+
|
|
284
|
+
// Add site prefix
|
|
285
|
+
var siteId = Site.current.ID;
|
|
286
|
+
|
|
287
|
+
// Format: SITE-YYYYMMDD-00001
|
|
288
|
+
var date = new Date();
|
|
289
|
+
var dateStr = date.getFullYear().toString() +
|
|
290
|
+
('0' + (date.getMonth() + 1)).slice(-2) +
|
|
291
|
+
('0' + date.getDate()).slice(-2);
|
|
292
|
+
|
|
293
|
+
return siteId + '-' + dateStr + '-' + seqNo;
|
|
294
|
+
};
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Registration:
|
|
298
|
+
|
|
299
|
+
```json
|
|
300
|
+
{
|
|
301
|
+
"hooks": [
|
|
302
|
+
{"name": "dw.order.createOrderNo", "script": "./orders.js"}
|
|
303
|
+
]
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
**Note**: Maximum order number length is 50 characters.
|
|
308
|
+
|
|
309
|
+
## Checkout Hooks
|
|
310
|
+
|
|
311
|
+
| Extension Point | Function | Purpose |
|
|
312
|
+
| ---------------------------------- | ------------------------------------------- | -------------------------------------- |
|
|
313
|
+
| `dw.order.populateCustomerDetails` | `populateCustomerDetails(basket, customer)` | Populate customer data onto the basket |
|
|
314
|
+
|
|
315
|
+
> **Note**: `dw.order.hooks` is the _package_ holding the hook interfaces — it is never part of the
|
|
316
|
+
> extension point name. There is no `dw.order.hooks.validateOrder` system hook; order validation for
|
|
317
|
+
> OCAPI/SCAPI order requests is `dw.ocapi.shop.order.validateOrder`, documented in
|
|
318
|
+
> [OCAPI/SCAPI Hooks](./OCAPI-SCAPI-HOOKS.md).
|
|
319
|
+
|
|
320
|
+
## Return Hooks
|
|
321
|
+
|
|
322
|
+
> **Inactive by default.** Return and shipping order hooks are order post-processing APIs and
|
|
323
|
+
> **throw an exception if accessed**. Activation requires approval from Product Management.
|
|
324
|
+
|
|
325
|
+
| Extension Point | Function | Purpose |
|
|
326
|
+
| ------------------------------------ | ---------------------------------------------------------- | ---------------------------- |
|
|
327
|
+
| `dw.order.return.createReturn` | `createReturn(returnWO: ReturnWO)` | Create the return record |
|
|
328
|
+
| `dw.order.return.addReturnItem` | `addReturnItem(retrn: Return, returnItemWO: ReturnItemWO)` | Add an item to a return |
|
|
329
|
+
| `dw.order.return.changeStatus` | `changeStatus(retrn: Return, returnWO: ReturnWO)` | Handle return status changes |
|
|
330
|
+
| `dw.order.return.afterStatusChange` | `afterStatusChange(retrn: Return)` | React after a status change |
|
|
331
|
+
| `dw.order.return.notifyStatusChange` | `notifyStatusChange(retrn: Return)` | Notify on status change |
|
|
332
|
+
|
|
333
|
+
## Shipping Order Hooks
|
|
334
|
+
|
|
335
|
+
> **Inactive by default.** Same order post-processing restriction as [Return Hooks](#return-hooks).
|
|
336
|
+
|
|
337
|
+
| Extension Point | Function | Purpose |
|
|
338
|
+
| ---------------------------------------------------- | ------------------------------------------------------------------------------ | ------------------------------------ |
|
|
339
|
+
| `dw.order.shippingorder.prepareCreateShippingOrders` | `prepareCreateShippingOrders(order: Order)` | Prepare shipping order creation |
|
|
340
|
+
| `dw.order.shippingorder.createShippingOrders` | `createShippingOrders(order: Order)` | Create shipping orders for an order |
|
|
341
|
+
| `dw.order.shippingorder.resolveShippingOrder` | `resolveShippingOrder(shippingOrderWO: ShippingOrderWO)` | Resolve the target shipping order |
|
|
342
|
+
| `dw.order.shippingorder.changeStatus` | `changeStatus(shippingOrder: ShippingOrder, shippingOrderWO: ShippingOrderWO)` | Handle shipping order status changes |
|
|
343
|
+
| `dw.order.shippingorder.afterStatusChange` | `afterStatusChange(shippingOrder: ShippingOrder)` | React after a status change |
|
|
344
|
+
| `dw.order.shippingorder.notifyStatusChange` | `notifyStatusChange(shippingOrder: ShippingOrder)` | Notify on status change |
|
|
345
|
+
| `dw.order.shippingorder.updateShippingOrderItem` | `updateShippingOrderItem(shippingOrder: ShippingOrder, itemWO: ShippingOrderItemWO)` | Update a shipping order item |
|
|
346
|
+
| `dw.order.shippingorder.setShippingOrderShipped` | `setShippingOrderShipped(shippingOrderWO: ShippingOrderWO)` | Mark a shipping order shipped |
|
|
347
|
+
| `dw.order.shippingorder.setShippingOrderCancelled` | `setShippingOrderCancelled(shippingOrderWO: ShippingOrderWO)` | Mark a shipping order cancelled |
|
|
348
|
+
| `dw.order.shippingorder.setShippingOrderWarehouse` | `setShippingOrderWarehouse(shippingOrderWO: ShippingOrderWO)` | Set the warehouse |
|
|
349
|
+
|
|
350
|
+
## Basket Merge Hooks
|
|
351
|
+
|
|
352
|
+
| Extension Point | Function | Purpose |
|
|
353
|
+
| ---------------------- | ------------------------------------ | ------------------------- |
|
|
354
|
+
| `dw.order.mergeBasket` | `mergeBasket(source, currentBasket)` | Custom basket merge logic |
|
|
355
|
+
|
|
356
|
+
## Request Hooks
|
|
357
|
+
|
|
358
|
+
| Extension Point | Function | Purpose |
|
|
359
|
+
|-----------------|----------|---------|
|
|
360
|
+
| `dw.system.request.onRequest` | `onRequest()` | Called at request start |
|
|
361
|
+
| `dw.system.request.onSession` | `onSession()` | Called when session starts |
|
|
362
|
+
|
|
363
|
+
## Custom Extension Points
|
|
364
|
+
|
|
365
|
+
Create your own extension points for application-specific logic:
|
|
366
|
+
|
|
367
|
+
```javascript
|
|
368
|
+
// In your controller/script
|
|
369
|
+
var HookMgr = require('dw/system/HookMgr');
|
|
370
|
+
|
|
371
|
+
function processLoyalty(customer, order) {
|
|
372
|
+
if (HookMgr.hasHook('app.loyalty.processOrder')) {
|
|
373
|
+
return HookMgr.callHook('app.loyalty.processOrder', 'processOrder', customer, order);
|
|
374
|
+
}
|
|
375
|
+
return null;
|
|
376
|
+
}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
Register implementation:
|
|
380
|
+
|
|
381
|
+
```json
|
|
382
|
+
{
|
|
383
|
+
"hooks": [
|
|
384
|
+
{"name": "app.loyalty.processOrder", "script": "./loyalty.js"}
|
|
385
|
+
]
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
```javascript
|
|
390
|
+
// loyalty.js
|
|
391
|
+
var Status = require('dw/system/Status');
|
|
392
|
+
|
|
393
|
+
exports.processOrder = function(customer, order) {
|
|
394
|
+
var points = calculateLoyaltyPoints(order);
|
|
395
|
+
awardPoints(customer, points);
|
|
396
|
+
return new Status(Status.OK);
|
|
397
|
+
};
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
Custom hooks execute all registered implementations regardless of return values.
|
|
401
|
+
|
|
402
|
+
## Hook Execution Order
|
|
403
|
+
|
|
404
|
+
When multiple cartridges register the same hook:
|
|
405
|
+
1. Hooks execute in cartridge path order
|
|
406
|
+
2. First hook to return a value stops execution (for system hooks)
|
|
407
|
+
3. Custom hooks execute all implementations
|
|
408
|
+
|
|
409
|
+
## Best Practices
|
|
410
|
+
|
|
411
|
+
### Calculate Hooks
|
|
412
|
+
|
|
413
|
+
- Keep calculations fast - runs frequently
|
|
414
|
+
- Avoid external service calls during calculation
|
|
415
|
+
- Use caching for expensive lookups
|
|
416
|
+
- Don't use transactions under SCAPI
|
|
417
|
+
|
|
418
|
+
### Payment Hooks
|
|
419
|
+
|
|
420
|
+
- Always handle partial failures
|
|
421
|
+
- Log provider transaction IDs and order numbers for debugging, but no payment tokens or PII
|
|
422
|
+
- Implement idempotency where possible
|
|
423
|
+
- Store auth timestamps for validation
|
|
424
|
+
- Return `Status.OK` only for successful authorization and `Status.ERROR` for failure
|
|
425
|
+
- Let order-PI `afterPATCH` return `undefined` on success so default coverage-based placement runs
|
|
426
|
+
|
|
427
|
+
### General
|
|
428
|
+
|
|
429
|
+
- Return appropriate Status objects
|
|
430
|
+
- Handle exceptions gracefully
|
|
431
|
+
- Use `Transaction.wrap()` only when the caller does not already provide a transaction; do not nest it
|
|
432
|
+
in SCAPI calculate, order `afterPOST`, or order-PI authorization hooks
|
|
433
|
+
- Log errors with context for debugging
|