Skip to content

Commit e66c2d9

Browse files
committed
Add merchant block documentation infrastructure
Infrastructure for generating and maintaining merchant block documentation: GENERATOR ENHANCEMENTS: - Enhanced @generate-merchant-block-docs.js with contextual guidance system - Add source-code verification workflow for 100% accuracy - Implement automated update detection tracking boilerplate changes - Add enhanced property descriptions with WHEN/WHY context - Add common configurations with real-world scenarios - Add important notes extraction for requirements/warnings ENRICHMENT SYSTEM: - Create comprehensive enrichment system in _dropin-enrichments/merchant-blocks/ - Add descriptions.json with verified merchant-friendly descriptions - Add complete workflow documentation (README, QUICK-REFERENCE) - Add implementation documentation (ENHANCEMENTS-SUMMARY, etc.) VERIFICATION TOOLS: - Add @verify-block-configs-source-code.js for config validation - Add @verify-merchant-block-descriptions.js for description checking - Add @check-for-updates.js for boilerplate change detection SIDEBAR & NAVIGATION: - Organize commerce blocks into B2C and B2B categories - Sort B2B blocks alphabetically for better navigation - Make Quick start section collapsed by default B2C BLOCK ENHANCEMENTS: - Update all 33 existing B2C merchant blocks with enhanced descriptions - Add section metadata tables with varied examples - Add contextual property guidance - Add important notes where applicable CLEANUP & FIXES: - Consolidate personalization/product-recommendations pages - Fix broken links across documentation - Move incomplete company-switcher docs to _drafts/ - Add targeted-block.mdx for Personalization feature All changes verified against boilerplate b2b-suite-release1 branch.
1 parent 036e1a0 commit e66c2d9

File tree

59 files changed

+16456
-1248
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+16456
-1248
lines changed

SPLIT-VERIFICATION-CHECKLIST.md

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
# Merchant Blocks Split Verification Checklist
2+
3+
## Original Commit Details
4+
- **Branch**: `feature/merchant-block-enhancements`
5+
- **Backup Tag**: `merchant-blocks-backup-2025-12-07`
6+
- **Commit SHA**: `2562764b`
7+
- **Patch File**: `merchant-blocks-complete.patch`
8+
- **Total Files Changed**: 84 files
9+
- **Total Changes**: +7,098 insertions, -1,220 deletions
10+
11+
## File Categories and Destinations
12+
13+
### Infrastructure (→ releases/b2b-nov-release)
14+
**Scripts (8 files)**:
15+
- [ ] scripts/@check-for-updates.js (NEW)
16+
- [ ] scripts/@generate-merchant-block-docs.js (MODIFIED)
17+
- [ ] scripts/@generate-merchant-block-docs.js.bak (NEW)
18+
- [ ] scripts/@verify-block-configs-source-code.js (NEW)
19+
- [ ] scripts/@verify-merchant-block-descriptions.js (NEW)
20+
21+
**Enrichments (13 files)**:
22+
- [ ] _dropin-enrichments/merchant-blocks/AUTOMATED-UPDATE-WORKFLOW.md (NEW)
23+
- [ ] _dropin-enrichments/merchant-blocks/ENHANCEMENTS-SUMMARY.md (NEW)
24+
- [ ] _dropin-enrichments/merchant-blocks/EXPANDED-ENHANCEMENTS-REPORT.md (NEW)
25+
- [ ] _dropin-enrichments/merchant-blocks/IMPLEMENTATION-SUMMARY.md (NEW)
26+
- [ ] _dropin-enrichments/merchant-blocks/INTEGRATION-CONFIRMATION.md (NEW)
27+
- [ ] _dropin-enrichments/merchant-blocks/MERCHANT-INFORMATION-GAPS.md (NEW)
28+
- [ ] _dropin-enrichments/merchant-blocks/QUICK-REFERENCE.md (NEW)
29+
- [ ] _dropin-enrichments/merchant-blocks/README.md (NEW)
30+
- [ ] _dropin-enrichments/merchant-blocks/SYSTEM-DIAGRAM.md (NEW)
31+
- [ ] _dropin-enrichments/merchant-blocks/descriptions.json (NEW)
32+
33+
**Configuration & Sidebar (2 files)**:
34+
- [ ] astro.config.mjs (MODIFIED)
35+
- [ ] package.json (MODIFIED)
36+
37+
**Link Fixes (3 files)**:
38+
- [ ] src/content/docs/get-started/architecture.mdx (MODIFIED)
39+
- [ ] src/content/docs/releases/changelog.mdx (MODIFIED)
40+
- [ ] src/content/docs/releases/index.mdx (MODIFIED)
41+
42+
**Cleanup (3 files)**:
43+
- [ ] src/content/docs/merchants/commerce-blocks/personalization.mdx (DELETED)
44+
- [ ] src/content/docs/merchants/commerce-blocks/product-recommendations.mdx (DELETED)
45+
- [ ] src/content/docs/dropins-b2b/company-switcher/ (MOVED to _drafts/)
46+
47+
**B2C Block Enhancements (33 files)**:
48+
- [ ] src/content/docs/merchants/blocks/commerce-account-header.mdx (MODIFIED)
49+
- [ ] src/content/docs/merchants/blocks/commerce-account-sidebar.mdx (MODIFIED)
50+
- [ ] src/content/docs/merchants/blocks/commerce-addresses.mdx (MODIFIED)
51+
- [ ] src/content/docs/merchants/blocks/commerce-cart.mdx (MODIFIED)
52+
- [ ] src/content/docs/merchants/blocks/commerce-checkout.mdx (MODIFIED)
53+
- [ ] src/content/docs/merchants/blocks/commerce-confirm-account.mdx (MODIFIED)
54+
- [ ] src/content/docs/merchants/blocks/commerce-create-account.mdx (MODIFIED)
55+
- [ ] src/content/docs/merchants/blocks/commerce-create-password.mdx (MODIFIED)
56+
- [ ] src/content/docs/merchants/blocks/commerce-create-return.mdx (MODIFIED)
57+
- [ ] src/content/docs/merchants/blocks/commerce-customer-details.mdx (MODIFIED)
58+
- [ ] src/content/docs/merchants/blocks/commerce-customer-information.mdx (MODIFIED)
59+
- [ ] src/content/docs/merchants/blocks/commerce-forgot-password.mdx (MODIFIED)
60+
- [ ] src/content/docs/merchants/blocks/commerce-gift-options.mdx (MODIFIED)
61+
- [ ] src/content/docs/merchants/blocks/commerce-login.mdx (MODIFIED)
62+
- [ ] src/content/docs/merchants/blocks/commerce-mini-cart.mdx (MODIFIED)
63+
- [ ] src/content/docs/merchants/blocks/commerce-order-cost-summary.mdx (MODIFIED)
64+
- [ ] src/content/docs/merchants/blocks/commerce-order-header.mdx (MODIFIED)
65+
- [ ] src/content/docs/merchants/blocks/commerce-order-product-list.mdx (MODIFIED)
66+
- [ ] src/content/docs/merchants/blocks/commerce-order-returns.mdx (MODIFIED)
67+
- [ ] src/content/docs/merchants/blocks/commerce-order-status.mdx (MODIFIED)
68+
- [ ] src/content/docs/merchants/blocks/commerce-orders-list.mdx (MODIFIED)
69+
- [ ] src/content/docs/merchants/blocks/commerce-return-header.mdx (MODIFIED)
70+
- [ ] src/content/docs/merchants/blocks/commerce-returns-list.mdx (MODIFIED)
71+
- [ ] src/content/docs/merchants/blocks/commerce-search-order.mdx (MODIFIED)
72+
- [ ] src/content/docs/merchants/blocks/commerce-shipping-status.mdx (MODIFIED)
73+
- [ ] src/content/docs/merchants/blocks/commerce-wishlist.mdx (MODIFIED)
74+
- [ ] src/content/docs/merchants/blocks/product-details.mdx (MODIFIED)
75+
- [ ] src/content/docs/merchants/blocks/product-list-page.mdx (MODIFIED)
76+
- [ ] src/content/docs/merchants/blocks/product-recommendations.mdx (MODIFIED)
77+
- [ ] src/content/docs/merchants/blocks/targeted-block.mdx (NEW)
78+
- [ ] src/content/docs/merchants/commerce-blocks/index.mdx (MODIFIED)
79+
80+
**TOTAL INFRASTRUCTURE**: 57 files
81+
82+
---
83+
84+
### Company Management (→ feature/merchant-blocks-company-management)
85+
- [ ] src/content/docs/merchants/blocks/commerce-company-accept-invitation.mdx (NEW)
86+
- [ ] src/content/docs/merchants/blocks/commerce-company-create.mdx (NEW)
87+
- [ ] src/content/docs/merchants/blocks/commerce-company-credit.mdx (NEW)
88+
- [ ] src/content/docs/merchants/blocks/commerce-company-profile.mdx (NEW)
89+
- [ ] src/content/docs/merchants/blocks/commerce-company-roles-permissions.mdx (NEW)
90+
- [ ] src/content/docs/merchants/blocks/commerce-company-structure.mdx (NEW)
91+
- [ ] src/content/docs/merchants/blocks/commerce-company-users.mdx (NEW)
92+
93+
**TOTAL**: 7 files
94+
95+
---
96+
97+
### Purchase Order (→ feature/merchant-blocks-purchase-order)
98+
- [ ] src/content/docs/merchants/blocks/commerce-b2b-po-approval-flow.mdx (NEW)
99+
- [ ] src/content/docs/merchants/blocks/commerce-b2b-po-approval-rule-details.mdx (NEW)
100+
- [ ] src/content/docs/merchants/blocks/commerce-b2b-po-approval-rule-form.mdx (NEW)
101+
- [ ] src/content/docs/merchants/blocks/commerce-b2b-po-approval-rules-list.mdx (NEW)
102+
- [ ] src/content/docs/merchants/blocks/commerce-b2b-po-checkout-success.mdx (NEW)
103+
- [ ] src/content/docs/merchants/blocks/commerce-b2b-po-comment-form.mdx (NEW)
104+
- [ ] src/content/docs/merchants/blocks/commerce-b2b-po-comments-list.mdx (NEW)
105+
- [ ] src/content/docs/merchants/blocks/commerce-b2b-po-company-purchase-orders.mdx (NEW)
106+
- [ ] src/content/docs/merchants/blocks/commerce-b2b-po-customer-purchase-orders.mdx (NEW)
107+
- [ ] src/content/docs/merchants/blocks/commerce-b2b-po-header.mdx (NEW)
108+
- [ ] src/content/docs/merchants/blocks/commerce-b2b-po-history-log.mdx (NEW)
109+
- [ ] src/content/docs/merchants/blocks/commerce-b2b-po-require-approval-purchase-orders.mdx (NEW)
110+
- [ ] src/content/docs/merchants/blocks/commerce-b2b-po-status.mdx (NEW)
111+
112+
**TOTAL**: 13 files
113+
114+
---
115+
116+
### Quote Management (→ feature/merchant-blocks-quote-management)
117+
- [ ] src/content/docs/merchants/blocks/commerce-b2b-negotiable-quote-template.mdx (NEW)
118+
- [ ] src/content/docs/merchants/blocks/commerce-b2b-negotiable-quote.mdx (NEW)
119+
- [ ] src/content/docs/merchants/blocks/commerce-b2b-quote-checkout.mdx (NEW)
120+
121+
**TOTAL**: 3 files
122+
123+
---
124+
125+
### Requisition List (→ feature/merchant-blocks-requisition-list)
126+
- [ ] src/content/docs/merchants/blocks/commerce-b2b-requisition-list-view.mdx (NEW)
127+
- [ ] src/content/docs/merchants/blocks/commerce-b2b-requisition-list.mdx (NEW)
128+
129+
**TOTAL**: 2 files
130+
131+
---
132+
133+
### Checkout & Account (→ feature/merchant-blocks-checkout-account)
134+
- [ ] src/content/docs/merchants/blocks/commerce-checkout-success.mdx (NEW)
135+
- [ ] src/content/docs/merchants/blocks/commerce-account-nav.mdx (NEW)
136+
- [ ] src/content/docs/merchants/blocks/commerce-customer-company.mdx (NEW)
137+
138+
**TOTAL**: 3 files
139+
140+
---
141+
142+
## Verification Steps
143+
144+
### After Infrastructure Commit
145+
- [ ] Verify releases/b2b-nov-release has all 57 infrastructure files
146+
- [ ] Run build and confirm it passes
147+
- [ ] Check git log shows proper commit message
148+
- [ ] Verify total insertions: ~5,000+ lines
149+
150+
### After Each Feature Branch
151+
- [ ] Verify feature branch has correct file count
152+
- [ ] Run build and confirm it passes
153+
- [ ] Check sidebar shows new blocks
154+
- [ ] Verify content matches backup tag
155+
156+
### Final Verification
157+
- [ ] Sum all new branches = 84 total files
158+
- [ ] Compare line counts: should total +7,098 insertions
159+
- [ ] Test patch can be reapplied if needed: `git apply --check merchant-blocks-complete.patch`
160+
- [ ] All 5 PRs created and pointing to releases/b2b-nov-release
161+
- [ ] b2b-documentation preview branch has everything
162+
163+
### Recovery Commands (if needed)
164+
```bash
165+
# Restore from tag
166+
git checkout merchant-blocks-backup-2025-12-07
167+
168+
# Apply patch file
169+
git apply merchant-blocks-complete.patch
170+
171+
# View backup
172+
git show merchant-blocks-backup-2025-12-07
173+
```
174+
175+
## Sign-off
176+
- [ ] All files accounted for
177+
- [ ] All builds passing
178+
- [ ] All PRs created
179+
- [ ] Backup can be deleted
180+

src/content/docs/dropins-b2b/company-switcher/containers/company-switcher.mdx renamed to _drafts/company-switcher-wip/containers/company-switcher.mdx

File renamed without changes.

src/content/docs/dropins-b2b/company-switcher/containers/index.mdx renamed to _drafts/company-switcher-wip/containers/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Containers are pre-built UI components that combine functionality, state managem
2525

2626
| Container | Description |
2727
| --------- | ----------- |
28-
| [CompanySwitcher](/dropins-b2b/company-switcher/containers/company-switcher/) | *****************************************************************. |
28+
| [CompanySwitcher](/dropins-b2b/company-switcher/containers/company-switcher/) | Dropdown selector that displays all companies the user belongs to and handles context switching between companies. |
2929

3030

3131
</TableWrapper>
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
title: Company Switcher
3+
description: Enable seamless company context switching for users who belong to multiple companies in Adobe Commerce B2B storefronts.
4+
sidebar:
5+
order: 1
6+
---
7+
8+
import { Aside } from '@astrojs/starlight/components';
9+
import TableWrapper from '@components/TableWrapper.astro';
10+
11+
The **Company Switcher** drop-in enables B2B users who belong to multiple companies to seamlessly switch between company contexts without logging out. When a user switches companies, all company-specific data (pricing, catalogs, orders, quotes, purchase orders) updates automatically to reflect the selected company's permissions and settings.
12+
13+
<div style="background-color: var(--sl-color-blue-low); border-left: 4px solid var(--sl-color-blue); padding: 0.75rem 1rem; border-radius: 0.25rem; margin: 1rem 0;">
14+
<strong>Version: 1.0.5</strong>
15+
</div>
16+
17+
## What it solves
18+
19+
In B2B scenarios, a single user often belongs to multiple companies - for example, a purchasing manager who buys for multiple franchise locations, or a consultant working with several client companies. Without the Company Switcher, these users would need to:
20+
21+
- Log out and log back in to access each company
22+
- Maintain separate accounts for each company
23+
- Manually track which account is associated with which company
24+
25+
The Company Switcher eliminates these friction points by providing a simple dropdown selector that instantly switches the user's context between all their associated companies.
26+
27+
## Key functionality
28+
29+
The Company Switcher provides:
30+
31+
- **One-click company switching** - Users select from a dropdown of all companies they belong to
32+
- **Automatic data isolation** - All displayed data (orders, quotes, catalogs, pricing) updates to match the selected company
33+
- **Session persistence** - The selected company remains active across page navigation and browser sessions
34+
- **Real-time updates** - Other drop-ins automatically refresh when company context changes via event system
35+
- **GraphQL header management** - Automatically injects correct company context headers into all Commerce API calls
36+
- **Permission enforcement** - User permissions update to match their role in the selected company
37+
38+
## Who should use this
39+
40+
The Company Switcher is essential for B2B storefronts where:
41+
42+
- Users belong to multiple companies
43+
- Different companies have different catalogs, pricing, or approval workflows
44+
- Users need to place orders or manage quotes for multiple organizations
45+
- Company-specific data must remain strictly separated
46+
47+
<Aside type="note">
48+
The Company Switcher requires Adobe Commerce B2B module and the Company feature to be enabled in your Commerce backend.
49+
</Aside>
50+
51+
## Commerce integration
52+
53+
The Company Switcher integrates with these Adobe Commerce B2B features:
54+
55+
- **Company Accounts** - Retrieves list of companies associated with current user
56+
- **Company Structure** - Respects user roles and permissions within each company
57+
- **Shared Catalogs** - Displays company-specific product catalogs
58+
- **Custom Pricing** - Shows negotiated pricing for selected company
59+
- **Purchase Orders** - Enforces company-specific approval rules
60+
- **Negotiable Quotes** - Manages quotes within company context
61+
- **Requisition Lists** - Maintains separate lists per company
62+
63+
## Supported features
64+
65+
<TableWrapper nowrap={[0]}>
66+
67+
| Feature | Status |
68+
|---------|--------|
69+
| Multi-company user access | Supported |
70+
| Company context switching | Supported |
71+
| Company context retrieval | Supported |
72+
| Automatic GraphQL header management | Supported |
73+
| Customer group header management | Supported |
74+
| Real-time context change events | Supported |
75+
| Data isolation across companies | Supported |
76+
| Permission-based access control | Supported |
77+
| Session persistence | Supported |
78+
| GraphQL API integration | Supported |
79+
80+
</TableWrapper>
81+
82+
## How it works
83+
84+
1. **User logs in** - Commerce backend returns all companies the user belongs to
85+
2. **Switcher displays** - Dropdown shows list of available companies
86+
3. **User selects company** - Click changes active company context
87+
4. **Event fires** - `companyContext/changed` event notifies all drop-ins
88+
5. **Drop-ins refresh** - Cart, Orders, Quotes, and other drop-ins reload with new company data
89+
6. **Context persists** - Selected company remains active until user switches again
90+
91+
## Getting started
92+
93+
The topics in this section will help you understand how to customize and use the Company Switcher effectively within your storefront.
94+
95+
### [Quick Start](/dropins-b2b/company-switcher/quick-start/)
96+
97+
Provides quick reference information and getting started guide for the Company Switcher drop-in. This topic covers package details, import paths, and basic usage examples to help you integrate Company Switcher functionality into your site.
98+
99+
### [Initialization](/dropins-b2b/company-switcher/initialization/)
100+
101+
Configure the Company Switcher drop-in with endpoint URLs, authentication settings, and fetch options required for Commerce integration.
102+
103+
### [Containers](/dropins-b2b/company-switcher/containers/)
104+
105+
The Company Switcher provides the CompanySwitcher container - a dropdown selector that displays available companies and handles context switching.
106+
107+
### [Functions](/dropins-b2b/company-switcher/functions/)
108+
109+
API functions enable retrieving the user's companies, getting the current company context, and programmatically switching between companies.
110+
111+
### [Events](/dropins-b2b/company-switcher/events/)
112+
113+
The Company Switcher emits `companyContext/changed` events when users switch companies, allowing other drop-ins to refresh their data automatically.
114+
115+
### [Slots](/dropins-b2b/company-switcher/slots/)
116+
117+
Customize the company switcher UI by replacing the dropdown selector, company list items, or empty state with your own components.
118+
119+
### [Dictionary](/dropins-b2b/company-switcher/dictionary/)
120+
121+
Internationalization keys for labels, placeholders, and messages displayed in the company switcher interface.
122+
123+
### [Styles](/dropins-b2b/company-switcher/styles/)
124+
125+
Design tokens for customizing the visual appearance of the company switcher dropdown, including colors, spacing, and typography.
126+

0 commit comments

Comments
 (0)