@salesforce/b2c-cli 2.3.1 → 2.5.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 +481 -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 +137 -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 +70 -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 +148 -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 +70 -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-edge-traffic-triage/SKILL.md +69 -0
- package/content/guidance/b2c-ops/b2c-job-health/SKILL.md +80 -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 +88 -0
- package/content/guidance/b2c-ops/b2c-production-triage/references/escalation.md +57 -0
- package/content/guidance/index.json +1969 -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/run.js +1 -1
- package/dist/commands/job/run.js.map +1 -1
- 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 +9 -0
- package/dist/commands/scapi/schemas/get.js +51 -19
- package/dist/commands/scapi/schemas/get.js.map +1 -1
- package/dist/commands/scapi/schemas/list.d.ts +6 -0
- package/dist/commands/scapi/schemas/list.js +28 -18
- package/dist/commands/scapi/schemas/list.js.map +1 -1
- package/dist/commands/setup/get.d.ts +36 -0
- package/dist/commands/setup/get.js +67 -0
- package/dist/commands/setup/get.js.map +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 +15 -4
- package/dist/commands/setup/inspect.js.map +1 -1
- package/dist/commands/setup/instance/create.d.ts +9 -0
- package/dist/commands/setup/instance/create.js +22 -6
- package/dist/commands/setup/instance/create.js.map +1 -1
- package/dist/commands/setup/instance/list.d.ts +1 -0
- package/dist/commands/setup/instance/list.js +3 -4
- package/dist/commands/setup/instance/list.js.map +1 -1
- package/dist/commands/setup/instance/remove.d.ts +1 -0
- package/dist/commands/setup/instance/remove.js +5 -5
- package/dist/commands/setup/instance/remove.js.map +1 -1
- package/dist/commands/setup/instance/set-active.d.ts +6 -0
- package/dist/commands/setup/instance/set-active.js +20 -5
- package/dist/commands/setup/instance/set-active.js.map +1 -1
- package/dist/commands/setup/openshell.d.ts +1 -0
- package/dist/commands/setup/set.d.ts +37 -0
- package/dist/commands/setup/set.js +87 -0
- package/dist/commands/setup/set.js.map +1 -0
- package/dist/commands/setup/skills.d.ts +1 -0
- package/dist/commands/setup/unset.d.ts +37 -0
- package/dist/commands/setup/unset.js +55 -0
- package/dist/commands/setup/unset.js.map +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/setup/config-field-command.d.ts +25 -0
- package/dist/utils/setup/config-field-command.js +41 -0
- package/dist/utils/setup/config-field-command.js.map +1 -0
- package/dist/utils/slas/client.d.ts +1 -0
- package/oclif.manifest.json +20802 -16968
- package/package.json +11 -5
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
# Common Patterns Reference
|
|
2
|
+
|
|
3
|
+
Error handling, pagination, field selection, and other common patterns for Shopper APIs.
|
|
4
|
+
|
|
5
|
+
## Response Optimization
|
|
6
|
+
|
|
7
|
+
### Field Selection with `select`
|
|
8
|
+
|
|
9
|
+
Use the `select` parameter to return only needed fields:
|
|
10
|
+
|
|
11
|
+
```javascript
|
|
12
|
+
// Basic selection
|
|
13
|
+
GET /products/{id}?select=(id,name,price)
|
|
14
|
+
|
|
15
|
+
// Nested selection
|
|
16
|
+
GET /products/{id}?select=(id,name,images.(link,alt),price)
|
|
17
|
+
|
|
18
|
+
// Array selection
|
|
19
|
+
GET /product-search?q=shirt&select=(hits.(productId,productName,price))
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Example:**
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
// Without select - returns full product object (~5KB)
|
|
26
|
+
const fullProduct = await fetch(
|
|
27
|
+
`${baseUrl}/products/25518823M?siteId=${siteId}`,
|
|
28
|
+
{ headers: { 'Authorization': `Bearer ${token}` } }
|
|
29
|
+
).then(r => r.json());
|
|
30
|
+
|
|
31
|
+
// With select - returns only needed fields (~500 bytes)
|
|
32
|
+
const miniProduct = await fetch(
|
|
33
|
+
`${baseUrl}/products/25518823M?siteId=${siteId}&select=(id,name,price,primaryCategoryId)`,
|
|
34
|
+
{ headers: { 'Authorization': `Bearer ${token}` } }
|
|
35
|
+
).then(r => r.json());
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Using `expand` Parameter
|
|
39
|
+
|
|
40
|
+
Expand related data inline. Use carefully as it impacts caching.
|
|
41
|
+
|
|
42
|
+
```javascript
|
|
43
|
+
// Single expansion
|
|
44
|
+
GET /products/{id}?expand=images
|
|
45
|
+
|
|
46
|
+
// Multiple expansions
|
|
47
|
+
GET /products/{id}?expand=availability,images,prices,variations
|
|
48
|
+
|
|
49
|
+
// Expansion with selection
|
|
50
|
+
GET /products/{id}?expand=images&select=(id,name,images)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Cache Impact by Expansion:**
|
|
54
|
+
|
|
55
|
+
| Expansion | Cache TTL | Recommendation |
|
|
56
|
+
|-----------|-----------|----------------|
|
|
57
|
+
| `images` | Long | Safe to expand |
|
|
58
|
+
| `prices` | Medium | Usually safe |
|
|
59
|
+
| `availability` | 60 seconds | Consider separate request |
|
|
60
|
+
| `variations` | Long | Can be large response |
|
|
61
|
+
| `promotions` | Short | Separate request recommended |
|
|
62
|
+
|
|
63
|
+
### Compression
|
|
64
|
+
|
|
65
|
+
Always enable HTTP compression:
|
|
66
|
+
|
|
67
|
+
```javascript
|
|
68
|
+
const response = await fetch(url, {
|
|
69
|
+
headers: {
|
|
70
|
+
'Authorization': `Bearer ${token}`,
|
|
71
|
+
'Accept-Encoding': 'gzip, deflate'
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Pagination
|
|
77
|
+
|
|
78
|
+
### Offset-Based Pagination
|
|
79
|
+
|
|
80
|
+
Most search and list endpoints use offset pagination:
|
|
81
|
+
|
|
82
|
+
```javascript
|
|
83
|
+
// First page
|
|
84
|
+
GET /product-search?q=shirt&offset=0&limit=25
|
|
85
|
+
|
|
86
|
+
// Second page
|
|
87
|
+
GET /product-search?q=shirt&offset=25&limit=25
|
|
88
|
+
|
|
89
|
+
// Third page
|
|
90
|
+
GET /product-search?q=shirt&offset=50&limit=25
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Example implementation:**
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
async function searchProducts(query, page = 0, pageSize = 25) {
|
|
97
|
+
const response = await fetch(
|
|
98
|
+
`${baseUrl}/product-search?siteId=${siteId}&q=${encodeURIComponent(query)}&offset=${page * pageSize}&limit=${pageSize}`,
|
|
99
|
+
{ headers: { 'Authorization': `Bearer ${token}` } }
|
|
100
|
+
).then(r => r.json());
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
products: response.hits,
|
|
104
|
+
total: response.total,
|
|
105
|
+
hasMore: (page * pageSize) + response.hits.length < response.total,
|
|
106
|
+
currentPage: page,
|
|
107
|
+
totalPages: Math.ceil(response.total / pageSize)
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Response Metadata
|
|
113
|
+
|
|
114
|
+
Search responses include pagination info:
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"limit": 25,
|
|
119
|
+
"offset": 0,
|
|
120
|
+
"total": 156,
|
|
121
|
+
"hits": [...]
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Error Handling
|
|
126
|
+
|
|
127
|
+
### Error Response Format
|
|
128
|
+
|
|
129
|
+
SCAPI returns errors in RFC 9457 format:
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/invalid-request",
|
|
134
|
+
"title": "Invalid Request",
|
|
135
|
+
"detail": "The product ID '12345' was not found.",
|
|
136
|
+
"instance": "/product/shopper-products/v1/organizations/f_ecom_zzbc_001/products/12345"
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Common HTTP Status Codes
|
|
141
|
+
|
|
142
|
+
| Status | Meaning | Action |
|
|
143
|
+
|--------|---------|--------|
|
|
144
|
+
| 200 | Success | Process response |
|
|
145
|
+
| 400 | Bad Request | Check request parameters |
|
|
146
|
+
| 401 | Unauthorized | Refresh token |
|
|
147
|
+
| 403 | Forbidden | Check scopes |
|
|
148
|
+
| 404 | Not Found | Resource doesn't exist |
|
|
149
|
+
| 429 | Rate Limited | Implement backoff |
|
|
150
|
+
| 500 | Server Error | Retry with backoff |
|
|
151
|
+
| 504 | Timeout | Request took > 10 seconds |
|
|
152
|
+
|
|
153
|
+
### Error Handling Pattern
|
|
154
|
+
|
|
155
|
+
```javascript
|
|
156
|
+
async function callShopperAPI(url, options = {}) {
|
|
157
|
+
const response = await fetch(url, {
|
|
158
|
+
...options,
|
|
159
|
+
headers: {
|
|
160
|
+
'Authorization': `Bearer ${token}`,
|
|
161
|
+
'Content-Type': 'application/json',
|
|
162
|
+
...options.headers
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
if (!response.ok) {
|
|
167
|
+
const error = await response.json();
|
|
168
|
+
|
|
169
|
+
switch (response.status) {
|
|
170
|
+
case 401:
|
|
171
|
+
// Token expired - refresh and retry
|
|
172
|
+
await refreshToken();
|
|
173
|
+
return callShopperAPI(url, options);
|
|
174
|
+
|
|
175
|
+
case 429:
|
|
176
|
+
// Rate limited - exponential backoff
|
|
177
|
+
const retryAfter = response.headers.get('Retry-After') || 1;
|
|
178
|
+
await sleep(retryAfter * 1000);
|
|
179
|
+
return callShopperAPI(url, options);
|
|
180
|
+
|
|
181
|
+
case 404:
|
|
182
|
+
// Resource not found
|
|
183
|
+
return null;
|
|
184
|
+
|
|
185
|
+
default:
|
|
186
|
+
throw new ShopperAPIError(error.title, error.detail, response.status);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return response.json();
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
class ShopperAPIError extends Error {
|
|
194
|
+
constructor(title, detail, status) {
|
|
195
|
+
super(`${title}: ${detail}`);
|
|
196
|
+
this.name = 'ShopperAPIError';
|
|
197
|
+
this.status = status;
|
|
198
|
+
this.title = title;
|
|
199
|
+
this.detail = detail;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Retry with Exponential Backoff
|
|
205
|
+
|
|
206
|
+
```javascript
|
|
207
|
+
async function fetchWithRetry(url, options, maxRetries = 3) {
|
|
208
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
209
|
+
try {
|
|
210
|
+
const response = await fetch(url, options);
|
|
211
|
+
|
|
212
|
+
if (response.status === 429 || response.status >= 500) {
|
|
213
|
+
const delay = Math.pow(2, attempt) * 1000; // 1s, 2s, 4s
|
|
214
|
+
await sleep(delay);
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return response;
|
|
219
|
+
} catch (error) {
|
|
220
|
+
if (attempt === maxRetries - 1) throw error;
|
|
221
|
+
const delay = Math.pow(2, attempt) * 1000;
|
|
222
|
+
await sleep(delay);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function sleep(ms) {
|
|
228
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## URL Encoding
|
|
233
|
+
|
|
234
|
+
### Special Characters
|
|
235
|
+
|
|
236
|
+
Double-encode special characters in path parameters:
|
|
237
|
+
|
|
238
|
+
```javascript
|
|
239
|
+
// Product ID with special characters
|
|
240
|
+
const productId = 'PROD/123+456';
|
|
241
|
+
const encodedId = encodeURIComponent(encodeURIComponent(productId));
|
|
242
|
+
// Result: PROD%252F123%252B456
|
|
243
|
+
|
|
244
|
+
const url = `${baseUrl}/products/${encodedId}?siteId=${siteId}`;
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Query Parameters
|
|
248
|
+
|
|
249
|
+
Single-encode query parameter values:
|
|
250
|
+
|
|
251
|
+
```javascript
|
|
252
|
+
const searchQuery = 'men\'s shirts & accessories';
|
|
253
|
+
const url = `${baseUrl}/product-search?q=${encodeURIComponent(searchQuery)}&siteId=${siteId}`;
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Caching Strategies
|
|
257
|
+
|
|
258
|
+
### Client-Side Caching
|
|
259
|
+
|
|
260
|
+
Implement client-side caching for frequently accessed data:
|
|
261
|
+
|
|
262
|
+
```javascript
|
|
263
|
+
const cache = new Map();
|
|
264
|
+
const CACHE_TTL = {
|
|
265
|
+
products: 5 * 60 * 1000, // 5 minutes
|
|
266
|
+
categories: 15 * 60 * 1000, // 15 minutes
|
|
267
|
+
search: 2 * 60 * 1000 // 2 minutes
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
async function getProduct(productId) {
|
|
271
|
+
const cacheKey = `product:${productId}`;
|
|
272
|
+
const cached = cache.get(cacheKey);
|
|
273
|
+
|
|
274
|
+
if (cached && Date.now() - cached.timestamp < CACHE_TTL.products) {
|
|
275
|
+
return cached.data;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const product = await fetch(
|
|
279
|
+
`${baseUrl}/products/${productId}?siteId=${siteId}`,
|
|
280
|
+
{ headers: { 'Authorization': `Bearer ${token}` } }
|
|
281
|
+
).then(r => r.json());
|
|
282
|
+
|
|
283
|
+
cache.set(cacheKey, { data: product, timestamp: Date.now() });
|
|
284
|
+
return product;
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### CDN Cache Headers
|
|
289
|
+
|
|
290
|
+
Shopper APIs return cache headers. Respect them for upstream caching:
|
|
291
|
+
|
|
292
|
+
```javascript
|
|
293
|
+
const response = await fetch(url, options);
|
|
294
|
+
const cacheControl = response.headers.get('Cache-Control');
|
|
295
|
+
const etag = response.headers.get('ETag');
|
|
296
|
+
|
|
297
|
+
// Use ETag for conditional requests
|
|
298
|
+
const conditionalResponse = await fetch(url, {
|
|
299
|
+
...options,
|
|
300
|
+
headers: {
|
|
301
|
+
...options.headers,
|
|
302
|
+
'If-None-Match': etag
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
if (conditionalResponse.status === 304) {
|
|
307
|
+
// Use cached version
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## Request Batching
|
|
312
|
+
|
|
313
|
+
### Multiple Products
|
|
314
|
+
|
|
315
|
+
Fetch multiple products in one request:
|
|
316
|
+
|
|
317
|
+
```javascript
|
|
318
|
+
// Instead of multiple calls
|
|
319
|
+
const product1 = await getProduct('prod1');
|
|
320
|
+
const product2 = await getProduct('prod2');
|
|
321
|
+
const product3 = await getProduct('prod3');
|
|
322
|
+
|
|
323
|
+
// Use batch endpoint
|
|
324
|
+
const products = await fetch(
|
|
325
|
+
`${baseUrl}/products?ids=prod1,prod2,prod3&siteId=${siteId}`,
|
|
326
|
+
{ headers: { 'Authorization': `Bearer ${token}` } }
|
|
327
|
+
).then(r => r.json());
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### Parallel Requests
|
|
331
|
+
|
|
332
|
+
Use Promise.all for independent requests:
|
|
333
|
+
|
|
334
|
+
```javascript
|
|
335
|
+
const [products, categories, promotions] = await Promise.all([
|
|
336
|
+
fetch(`${baseUrl}/product-search?q=shirt&siteId=${siteId}`, options).then(r => r.json()),
|
|
337
|
+
fetch(`${baseUrl}/categories/root?siteId=${siteId}`, options).then(r => r.json()),
|
|
338
|
+
fetch(`${baseUrl}/promotions?siteId=${siteId}`, options).then(r => r.json())
|
|
339
|
+
]);
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
## Debugging Requests
|
|
343
|
+
|
|
344
|
+
### Include Correlation ID
|
|
345
|
+
|
|
346
|
+
```javascript
|
|
347
|
+
const correlationId = crypto.randomUUID();
|
|
348
|
+
|
|
349
|
+
const response = await fetch(url, {
|
|
350
|
+
headers: {
|
|
351
|
+
'Authorization': `Bearer ${token}`,
|
|
352
|
+
'correlation-id': correlationId
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
console.log(`Request ${correlationId} - Status: ${response.status}`);
|
|
357
|
+
// Search Log Center: externalID:({correlationId})
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### Verbose Logging
|
|
361
|
+
|
|
362
|
+
Enable for debugging only (not production):
|
|
363
|
+
|
|
364
|
+
```javascript
|
|
365
|
+
const response = await fetch(url, {
|
|
366
|
+
headers: {
|
|
367
|
+
'Authorization': `Bearer ${token}`,
|
|
368
|
+
'sfdc_verbose': 'true'
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
// Check scapi.verbose category in Log Center
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### Log Request/Response
|
|
376
|
+
|
|
377
|
+
```javascript
|
|
378
|
+
async function debugFetch(url, options) {
|
|
379
|
+
const startTime = Date.now();
|
|
380
|
+
console.log(`[API] ${options.method || 'GET'} ${url}`);
|
|
381
|
+
|
|
382
|
+
const response = await fetch(url, options);
|
|
383
|
+
const duration = Date.now() - startTime;
|
|
384
|
+
|
|
385
|
+
console.log(`[API] ${response.status} ${response.statusText} (${duration}ms)`);
|
|
386
|
+
console.log(`[API] correlation-id: ${response.headers.get('sfdc_correlation_id')}`);
|
|
387
|
+
|
|
388
|
+
return response;
|
|
389
|
+
}
|
|
390
|
+
```
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
# Shopper API Scopes Reference
|
|
2
|
+
|
|
3
|
+
Complete reference for OAuth scopes used with SLAS (Shopper Login and API Access Service).
|
|
4
|
+
|
|
5
|
+
## Scope Overview
|
|
6
|
+
|
|
7
|
+
Scopes define what APIs and operations a SLAS client can access. Configure scopes when creating SLAS clients:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Create client with specific scopes
|
|
11
|
+
b2c slas client create \
|
|
12
|
+
--tenant-id zzte_053 \
|
|
13
|
+
--channels RefArchGlobal \
|
|
14
|
+
--scopes "sfcc.shopper-products,sfcc.shopper-baskets-orders.rw" \
|
|
15
|
+
--redirect-uri http://localhost:3000/callback
|
|
16
|
+
|
|
17
|
+
# Create client with default scopes (recommended for shopping apps)
|
|
18
|
+
b2c slas client create \
|
|
19
|
+
--tenant-id zzte_053 \
|
|
20
|
+
--channels RefArchGlobal \
|
|
21
|
+
--default-scopes \
|
|
22
|
+
--redirect-uri http://localhost:3000/callback
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Scope Categories
|
|
26
|
+
|
|
27
|
+
### Product APIs
|
|
28
|
+
|
|
29
|
+
| Scope | API | Access |
|
|
30
|
+
|-------|-----|--------|
|
|
31
|
+
| `sfcc.shopper-products` | Shopper Products | Read products, prices, images |
|
|
32
|
+
| `sfcc.shopper-categories` | Shopper Products | Read categories |
|
|
33
|
+
|
|
34
|
+
### Search APIs
|
|
35
|
+
|
|
36
|
+
| Scope | API | Access |
|
|
37
|
+
|-------|-----|--------|
|
|
38
|
+
| `sfcc.shopper-product-search` | Shopper Search | Product search and suggestions |
|
|
39
|
+
| `sfcc.shopper-discovery-search` | Shopper Discovery Search | AI-powered search (Einstein) |
|
|
40
|
+
|
|
41
|
+
### Checkout APIs
|
|
42
|
+
|
|
43
|
+
| Scope | API | Access |
|
|
44
|
+
|-------|-----|--------|
|
|
45
|
+
| `sfcc.shopper-baskets-orders` | Shopper Baskets, Orders | Read baskets and orders |
|
|
46
|
+
| `sfcc.shopper-baskets-orders.rw` | Shopper Baskets, Orders | Create/update/delete baskets, create orders |
|
|
47
|
+
|
|
48
|
+
### Customer APIs
|
|
49
|
+
|
|
50
|
+
| Scope | API | Access |
|
|
51
|
+
|-------|-----|--------|
|
|
52
|
+
| `sfcc.shopper-customers.login` | Shopper Customers | Log in shoppers |
|
|
53
|
+
| `sfcc.shopper-customers.register` | Shopper Customers | Register new shoppers |
|
|
54
|
+
| `sfcc.shopper-myaccount` | Shopper Customers | Read account info |
|
|
55
|
+
| `sfcc.shopper-myaccount.rw` | Shopper Customers | Update account info |
|
|
56
|
+
| `sfcc.shopper-myaccount.addresses` | Shopper Customers | Read addresses |
|
|
57
|
+
| `sfcc.shopper-myaccount.addresses.rw` | Shopper Customers | Manage addresses |
|
|
58
|
+
| `sfcc.shopper-myaccount.baskets` | Shopper Customers | Read saved baskets |
|
|
59
|
+
| `sfcc.shopper-myaccount.orders` | Shopper Customers | Read order history |
|
|
60
|
+
| `sfcc.shopper-myaccount.paymentinstruments` | Shopper Customers | Read payment methods |
|
|
61
|
+
| `sfcc.shopper-myaccount.paymentinstruments.rw` | Shopper Customers | Manage payment methods |
|
|
62
|
+
| `sfcc.shopper-myaccount.productlists` | Shopper Customers | Read wishlists |
|
|
63
|
+
| `sfcc.shopper-myaccount.productlists.rw` | Shopper Customers | Manage wishlists |
|
|
64
|
+
|
|
65
|
+
### Pricing APIs
|
|
66
|
+
|
|
67
|
+
| Scope | API | Access |
|
|
68
|
+
|-------|-----|--------|
|
|
69
|
+
| `sfcc.shopper-promotions` | Shopper Promotions | Read promotions |
|
|
70
|
+
| `sfcc.shopper-gift-certificates` | Shopper Gift Certificates | Read/redeem gift certificates |
|
|
71
|
+
|
|
72
|
+
### Store APIs
|
|
73
|
+
|
|
74
|
+
| Scope | API | Access |
|
|
75
|
+
|-------|-----|--------|
|
|
76
|
+
| `sfcc.shopper-stores` | Shopper Stores | Search and read stores |
|
|
77
|
+
|
|
78
|
+
### Context APIs
|
|
79
|
+
|
|
80
|
+
| Scope | API | Access |
|
|
81
|
+
|-------|-----|--------|
|
|
82
|
+
| `sfcc.shopper-context` | Shopper Context | Read shopper context |
|
|
83
|
+
| `sfcc.shopper-context.rw` | Shopper Context | Read/write shopper context |
|
|
84
|
+
|
|
85
|
+
### Configuration APIs
|
|
86
|
+
|
|
87
|
+
| Scope | API | Access |
|
|
88
|
+
|-------|-----|--------|
|
|
89
|
+
| `sfcc.shopper-configurations` | Shopper Configurations | Read site configurations |
|
|
90
|
+
|
|
91
|
+
### Product Lists APIs
|
|
92
|
+
|
|
93
|
+
| Scope | API | Access |
|
|
94
|
+
|-------|-----|--------|
|
|
95
|
+
| `sfcc.shopper-productlists` | Shopper Product Lists | Read product lists |
|
|
96
|
+
|
|
97
|
+
## Special Scopes
|
|
98
|
+
|
|
99
|
+
### Authentication Scopes
|
|
100
|
+
|
|
101
|
+
| Scope | Purpose |
|
|
102
|
+
|-------|---------|
|
|
103
|
+
| `sfcc.pwdless_login` | Enable passwordless email login (OTP) |
|
|
104
|
+
| `sfcc.session_bridge` | Enable session bridging between PWA and SFRA |
|
|
105
|
+
|
|
106
|
+
### Trusted Agent/System Scopes
|
|
107
|
+
|
|
108
|
+
| Scope | Purpose |
|
|
109
|
+
|-------|---------|
|
|
110
|
+
| `sfcc.ta_ext_on_behalf_of` | Trusted agent - act on behalf of shoppers |
|
|
111
|
+
| `sfcc.ts_ext_on_behalf_of` | Trusted system - backend service integration |
|
|
112
|
+
|
|
113
|
+
### AI Agent Scope
|
|
114
|
+
|
|
115
|
+
| Scope | Purpose |
|
|
116
|
+
|-------|---------|
|
|
117
|
+
| `sfcc.shopper-mcpagent` | MCP (Model Context Protocol) agent access |
|
|
118
|
+
|
|
119
|
+
### Custom Scopes
|
|
120
|
+
|
|
121
|
+
Custom APIs define their own scopes with `c_` prefix:
|
|
122
|
+
|
|
123
|
+
| Scope Pattern | Purpose |
|
|
124
|
+
|---------------|---------|
|
|
125
|
+
| `c_my_custom_scope` | Custom API endpoint access |
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Create client with custom scope for Custom API
|
|
129
|
+
b2c slas client create \
|
|
130
|
+
--tenant-id zzte_053 \
|
|
131
|
+
--channels RefArchGlobal \
|
|
132
|
+
--default-scopes \
|
|
133
|
+
--scopes "c_loyalty,c_rewards" \
|
|
134
|
+
--redirect-uri http://localhost:3000/callback
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Default Scopes
|
|
138
|
+
|
|
139
|
+
> Default scopes change over time - verify current defaults in the [Authorization Scopes Catalog](https://developer.salesforce.com/docs/commerce/commerce-api/guide/auth-z-scope-catalog) or via `b2c docs read commerce-api/auth-z-scope-catalog` before implementation.
|
|
140
|
+
|
|
141
|
+
When using `--default-scopes`, these scopes are automatically included:
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
sfcc.shopper-myaccount
|
|
145
|
+
sfcc.shopper-myaccount.rw
|
|
146
|
+
sfcc.shopper-myaccount.baskets
|
|
147
|
+
sfcc.shopper-myaccount.addresses
|
|
148
|
+
sfcc.shopper-myaccount.addresses.rw
|
|
149
|
+
sfcc.shopper-myaccount.paymentinstruments
|
|
150
|
+
sfcc.shopper-myaccount.paymentinstruments.rw
|
|
151
|
+
sfcc.shopper-myaccount.orders
|
|
152
|
+
sfcc.shopper-myaccount.productlists
|
|
153
|
+
sfcc.shopper-myaccount.productlists.rw
|
|
154
|
+
sfcc.shopper-products
|
|
155
|
+
sfcc.shopper-productlists
|
|
156
|
+
sfcc.shopper-promotions
|
|
157
|
+
sfcc.shopper-customers.login
|
|
158
|
+
sfcc.shopper-customers.register
|
|
159
|
+
sfcc.shopper-stores
|
|
160
|
+
sfcc.shopper-baskets-orders
|
|
161
|
+
sfcc.shopper-baskets-orders.rw
|
|
162
|
+
sfcc.shopper-gift-certificates
|
|
163
|
+
sfcc.shopper-product-search
|
|
164
|
+
sfcc.shopper-discovery-search
|
|
165
|
+
sfcc.shopper-categories
|
|
166
|
+
sfcc.shopper-configurations
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Recommended Scope Sets
|
|
170
|
+
|
|
171
|
+
### Basic Shopping App (PWA Kit)
|
|
172
|
+
|
|
173
|
+
Minimum scopes for a typical shopping experience:
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
sfcc.shopper-baskets-orders.rw
|
|
177
|
+
sfcc.shopper-categories
|
|
178
|
+
sfcc.shopper-customers.login
|
|
179
|
+
sfcc.shopper-customers.register
|
|
180
|
+
sfcc.shopper-gift-certificates
|
|
181
|
+
sfcc.shopper-myaccount.rw
|
|
182
|
+
sfcc.shopper-product-search
|
|
183
|
+
sfcc.shopper-productlists
|
|
184
|
+
sfcc.shopper-products
|
|
185
|
+
sfcc.shopper-promotions
|
|
186
|
+
sfcc.shopper-stores
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Read-Only Catalog Browser
|
|
190
|
+
|
|
191
|
+
For content/catalog browsing without checkout:
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
sfcc.shopper-products
|
|
195
|
+
sfcc.shopper-categories
|
|
196
|
+
sfcc.shopper-product-search
|
|
197
|
+
sfcc.shopper-promotions
|
|
198
|
+
sfcc.shopper-stores
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Guest Checkout Only
|
|
202
|
+
|
|
203
|
+
For sites without customer registration:
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
sfcc.shopper-products
|
|
207
|
+
sfcc.shopper-categories
|
|
208
|
+
sfcc.shopper-product-search
|
|
209
|
+
sfcc.shopper-baskets-orders.rw
|
|
210
|
+
sfcc.shopper-promotions
|
|
211
|
+
sfcc.shopper-gift-certificates
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Full Customer Experience
|
|
215
|
+
|
|
216
|
+
Complete scope set for registered customer features:
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
sfcc.shopper-products
|
|
220
|
+
sfcc.shopper-categories
|
|
221
|
+
sfcc.shopper-product-search
|
|
222
|
+
sfcc.shopper-baskets-orders.rw
|
|
223
|
+
sfcc.shopper-customers.login
|
|
224
|
+
sfcc.shopper-customers.register
|
|
225
|
+
sfcc.shopper-myaccount.rw
|
|
226
|
+
sfcc.shopper-myaccount.addresses.rw
|
|
227
|
+
sfcc.shopper-myaccount.paymentinstruments.rw
|
|
228
|
+
sfcc.shopper-myaccount.productlists.rw
|
|
229
|
+
sfcc.shopper-promotions
|
|
230
|
+
sfcc.shopper-gift-certificates
|
|
231
|
+
sfcc.shopper-stores
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Best Practices
|
|
235
|
+
|
|
236
|
+
### Minimize Scope Set
|
|
237
|
+
|
|
238
|
+
Only include scopes your application actually needs:
|
|
239
|
+
- Smaller scope set = smaller token = faster cookie/header transmission
|
|
240
|
+
- Reduces attack surface if token is compromised
|
|
241
|
+
- Easier to audit API access
|
|
242
|
+
|
|
243
|
+
### Avoid Redundant Scopes
|
|
244
|
+
|
|
245
|
+
Don't include both read and read/write scopes:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# Bad - redundant
|
|
249
|
+
--scopes "sfcc.shopper-myaccount,sfcc.shopper-myaccount.rw"
|
|
250
|
+
|
|
251
|
+
# Good - just use the .rw scope
|
|
252
|
+
--scopes "sfcc.shopper-myaccount.rw"
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Separate Clients for Different Purposes
|
|
256
|
+
|
|
257
|
+
Create dedicated clients for different use cases:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
# Client for storefront (shopper-facing)
|
|
261
|
+
b2c slas client create storefront-client \
|
|
262
|
+
--tenant-id zzte_053 \
|
|
263
|
+
--channels RefArchGlobal \
|
|
264
|
+
--scopes "sfcc.shopper-products,sfcc.shopper-baskets-orders.rw" \
|
|
265
|
+
--redirect-uri https://store.example.com/callback
|
|
266
|
+
|
|
267
|
+
# Client for mobile app (may need different scopes)
|
|
268
|
+
b2c slas client create mobile-client \
|
|
269
|
+
--tenant-id zzte_053 \
|
|
270
|
+
--channels RefArchGlobal \
|
|
271
|
+
--scopes "sfcc.shopper-products,sfcc.shopper-baskets-orders.rw,sfcc.shopper-stores" \
|
|
272
|
+
--redirect-uri myapp://callback
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Don't Mix Admin and Shopper Scopes
|
|
276
|
+
|
|
277
|
+
Shopper scopes (SLAS) and Admin scopes (Account Manager) cannot be combined in the same client or token. Use separate authentication for admin operations.
|
|
278
|
+
|
|
279
|
+
## Verifying Token Scopes
|
|
280
|
+
|
|
281
|
+
Check what scopes are in your access token:
|
|
282
|
+
|
|
283
|
+
```javascript
|
|
284
|
+
// Decode JWT payload (base64)
|
|
285
|
+
const tokenParts = accessToken.split('.');
|
|
286
|
+
const payload = JSON.parse(atob(tokenParts[1]));
|
|
287
|
+
|
|
288
|
+
console.log('Token scopes:', payload.scope);
|
|
289
|
+
// Output: "sfcc.shopper-products sfcc.shopper-baskets-orders.rw ..."
|
|
290
|
+
```
|