Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
395 commits
Select commit Hold shift + click to select a range
d17dfee
Fix show giftcard into the summary, remove manageAdyenGiftCard prop
acasazza Nov 4, 2025
0bfdde5
v4.28.4
acasazza Nov 4, 2025
28212ef
Unused variable
acasazza Nov 4, 2025
0121d52
v4.28.4
acasazza Nov 4, 2025
118093d
Fix duplicate addresses when pay with Adyen
acasazza Nov 5, 2025
bfe75bb
Fix show givex card details in the summary
acasazza Nov 6, 2025
e88d545
Fix duplicate save address
acasazza Nov 6, 2025
955828e
Fix currencies format
acasazza Nov 11, 2025
e4415e3
v4.28.5-beta.0
acasazza Nov 11, 2025
3734cfc
v4.28.5
acasazza Nov 12, 2025
8b6d149
Fix place unpaid orders when payment source is declined
acasazza Nov 25, 2025
98a43c9
v4.28.6-beta.6
acasazza Nov 25, 2025
b628cab
Fix place order
acasazza Nov 26, 2025
a55635d
v4.28.6-beta.7
acasazza Nov 26, 2025
21c0059
Fix place order button
acasazza Nov 26, 2025
9d022ab
v4.28.6-beta.8
acasazza Nov 26, 2025
ee9bf88
v4.28.6
acasazza Dec 1, 2025
e8e895d
Create new core package
acasazza Apr 16, 2024
3873f38
Add configuration and getPrices function
acasazza Apr 19, 2024
983b4e4
Add getPrices tests, biomejs, and global vitest config
acasazza Feb 6, 2025
79d21d7
Add new documentation folder
acasazza Feb 11, 2025
8c5cdd0
Add new getAccessToken function. Resolve #617
acasazza Mar 27, 2025
93c204f
Fix relative path for vitest
acasazza Apr 1, 2025
374b141
Add updatePrice function, and tests, remove package jwt-decode
acasazza Apr 22, 2025
2cea33a
fix conflicts
acasazza Dec 23, 2025
58a7534
Merge pull request #695 from commercelayer/v5/hooks/usePrices
acasazza Dec 23, 2025
923cb72
Export PriceUpdate type
acasazza Jan 20, 2026
1e08474
Update deps
acasazza Jan 20, 2026
76c424b
Implement SWR into usePrices hook
acasazza Jan 20, 2026
3661b85
Add comments and export. Close #700
acasazza Jan 20, 2026
7cf0b6f
Remove line spaces
acasazza Jan 21, 2026
2d2d1de
Fix tests and add react compiler to tsup
acasazza Jan 28, 2026
0cec58a
Merge pull request #701 from commercelayer/v5/hooks/useSWR
acasazza Jan 28, 2026
efc8154
Create new core package
acasazza Apr 16, 2024
8418a72
Add configuration and getPrices function
acasazza Apr 19, 2024
f821c32
Add getPrices tests, biomejs, and global vitest config
acasazza Feb 6, 2025
6747e79
Add new documentation folder
acasazza Feb 11, 2025
c7a8e81
Add new getAccessToken function. Resolve #617
acasazza Mar 27, 2025
379277c
Fix vite types env
acasazza Mar 27, 2025
ad94676
Fix relative path for vitest
acasazza Apr 1, 2025
1746640
Remove ts comment
acasazza Apr 1, 2025
bc2a091
Add retrievePrice function. Resolve #621
acasazza Apr 2, 2025
584ce6d
Add updatePrice function, and tests, remove package jwt-decode
acasazza Apr 22, 2025
0c3c74f
Add new hook usePrices and unit tests, update commercelayer/sdk to v7…
acasazza Dec 17, 2025
9728b10
Create new core package
acasazza Apr 16, 2024
0e457f0
Add configuration and getPrices function
acasazza Apr 19, 2024
c7e7e47
Add getPrices tests, biomejs, and global vitest config
acasazza Feb 6, 2025
ac58786
Add new documentation folder
acasazza Feb 11, 2025
3b0bf19
Add new getAccessToken function. Resolve #617
acasazza Mar 27, 2025
7d207f9
Fix relative path for vitest
acasazza Apr 1, 2025
4995800
Add updatePrice function, and tests, remove package jwt-decode
acasazza Apr 22, 2025
47e47d8
Add stripe connected account
acasazza Apr 9, 2025
d1312b4
Add new CKO flow library
acasazza May 14, 2025
ebf38ed
Fix show CKO payment error
acasazza May 22, 2025
5f19839
Fix place draft order
acasazza May 23, 2025
8a9683c
Fix avoid place order in draft
acasazza May 29, 2025
118aa59
Add Adyen subscriptions
acasazza May 30, 2025
437544d
Hide customer payments when the order contains a subscription
acasazza Jun 4, 2025
4d035d0
Reset Adyen stored payments when the order has a subscription
acasazza Jun 5, 2025
4a9b51e
Show all payment methods available
acasazza Jun 6, 2025
65c7368
Fix avoid place order in draft, and express payments by CKO
acasazza Jun 12, 2025
d02c797
Fix loading card info
acasazza Jun 16, 2025
0e92c5c
Fix loading card info
acasazza Jun 16, 2025
057931d
Update deps
acasazza Jun 20, 2025
b5b6b5f
Fix avoid place order in draft
acasazza Jun 20, 2025
17b189b
Fix draft order and showLoader flow
acasazza Jun 26, 2025
8a6ac5a
Fix post requests when a customer edit an address
acasazza Jul 11, 2025
a0f014d
Fix place order with declined transaction by CKO
acasazza Jul 17, 2025
df548ef
Fix place order with declined transaction by CKO
acasazza Jul 18, 2025
d6c9b4e
fix: update shipping, instead of billing address
malessani Jul 23, 2025
501e82a
fix: remove ref.current from dependencies array
malessani Jul 23, 2025
f0418d8
Fix duplicate addresses
acasazza Jul 31, 2025
852596e
Fix duplicate save addresses
acasazza Aug 4, 2025
06c2e91
Fix tax recalculations
acasazza Aug 7, 2025
5255c8a
Fix tax recalculations
acasazza Aug 20, 2025
1b8f26b
Remove delete customer_email
acasazza Aug 20, 2025
97b6e1c
Update deps
acasazza Aug 29, 2025
1560bc4
Fix cko express payment
acasazza Sep 10, 2025
cad4df8
feat: enable server side sorting for order list
pfferrari Sep 22, 2025
b2d0aec
Fix rebuilt shipments
acasazza Sep 29, 2025
f24f8b1
feat: enable sorting on order subscriptions
pfferrari Oct 3, 2025
b3e56b7
Fix save address input behaviour
acasazza Oct 6, 2025
edbf615
Fix ship to different address toggle
acasazza Oct 20, 2025
835009f
Fix ship to different address mode using customer address
acasazza Oct 21, 2025
6dc9427
Fix shipToDifferentAddress toggle
acasazza Oct 23, 2025
db6db62
Fix vulnerabilities
acasazza Oct 24, 2025
f404712
fix: refresh order when billing or shipping address is updated
malessani Oct 30, 2025
97aad12
Fix givex partially authorization flow
acasazza Nov 3, 2025
23e696f
v4.28.3-beta.0
acasazza Nov 3, 2025
04b9974
v4.28.4-beta.0
acasazza Nov 4, 2025
3cacbf4
Fix payment flow using givex card
acasazza Nov 4, 2025
92f4ac0
Fix show giftcard into the summary, remove manageAdyenGiftCard prop
acasazza Nov 4, 2025
d863cd6
Unused variable
acasazza Nov 4, 2025
175f1a6
v4.28.4
acasazza Nov 4, 2025
c1d6b06
Fix place unpaid orders when payment source is declined
acasazza Nov 25, 2025
f0f7016
Fix place order
acasazza Nov 26, 2025
539ac1d
Create new core package
acasazza Apr 16, 2024
96e071e
Add configuration and getPrices function
acasazza Apr 19, 2024
c38c6dd
Add getPrices tests, biomejs, and global vitest config
acasazza Feb 6, 2025
f679ed9
Add new documentation folder
acasazza Feb 11, 2025
48800b3
Add new getAccessToken function. Resolve #617
acasazza Mar 27, 2025
12183c2
Fix relative path for vitest
acasazza Apr 1, 2025
c19b84f
Add updatePrice function, and tests, remove package jwt-decode
acasazza Apr 22, 2025
195f200
Export PriceUpdate type
acasazza Jan 20, 2026
542674e
Update deps
acasazza Jan 20, 2026
4b5d657
Implement SWR into usePrices hook
acasazza Jan 20, 2026
7528093
Add comments and export. Close #700
acasazza Jan 20, 2026
8912c3a
Remove line spaces
acasazza Jan 21, 2026
de5664a
Fix tests and add react compiler to tsup
acasazza Jan 28, 2026
6507ed7
✨ feat(core,hooks): add SKU resource and useSkus hook
acasazza Mar 17, 2026
514598d
chore: update dependencies in core, hooks and root
acasazza Mar 17, 2026
692be97
fix(hooks): fix stale data returns, mutate type and React import issues
acasazza Mar 17, 2026
0bd3b67
test(hooks): add coverage for update without prior fetch branch
acasazza Mar 17, 2026
47441ab
💄 style(hooks): apply formatter
acasazza Mar 17, 2026
7a5f50b
Merge main into v5.0.0
acasazza Mar 26, 2026
9f318c6
🔀 chore: merge v5.0.0 into v5/skus/core-and-hooks
acasazza Mar 26, 2026
f5c93b4
✨ feat(SkusContainer): use useSkus hook, remove API calls from SkuRed…
acasazza Mar 26, 2026
2f6a267
⬆️ chore(react-components): upgrade to React 19, add react-compiler, …
acasazza Mar 26, 2026
41a3f70
✅ test(skus): add SkusContainer tests and fix clearSkus async error
acasazza Mar 26, 2026
2de483c
✨ feat(core,hooks): add SKU resource and useSkus hook
acasazza Mar 17, 2026
e39d614
chore: update dependencies in core, hooks and root
acasazza Mar 17, 2026
95f549a
fix(hooks): fix stale data returns, mutate type and React import issues
acasazza Mar 17, 2026
7bf4ea6
test(hooks): add coverage for update without prior fetch branch
acasazza Mar 17, 2026
f9688f5
💄 style(hooks): apply formatter
acasazza Mar 17, 2026
9404946
✨ feat(SkusContainer): use useSkus hook, remove API calls from SkuRed…
acasazza Mar 26, 2026
06617b5
⬆️ chore(react-components): upgrade to React 19, add react-compiler, …
acasazza Mar 26, 2026
11b698e
✅ test(skus): add SkusContainer tests and fix clearSkus async error
acasazza Mar 26, 2026
8e7949b
✨ feat(skus): migrate SkuListsContainer and AvailabilityContainer to …
acasazza Mar 26, 2026
2473b50
✅ test(react-components): add unit tests and improve coverage
acasazza Mar 27, 2026
a3184fc
🔀 chore: merge v5.0.0 into branch, resolve conflicts
acasazza Mar 27, 2026
08c1c93
fix: get build and test suite passing after v5.0.0 merge
acasazza Mar 30, 2026
6f14678
Merge pull request #731 from commercelayer/v5/feat/skus/migrate-conta…
acasazza Mar 31, 2026
ed647c2
🔀 chore: merge v5.0.0 into v5/skus/core-and-hooks, resolve conflicts
acasazza Mar 31, 2026
7950a69
chore: regenerate lockfile to match merged pnpm overrides
acasazza Mar 31, 2026
3091206
Merge pull request #720 from commercelayer/v5/skus/core-and-hooks
acasazza Mar 31, 2026
99541b5
📚 docs(document): add SKUs story, upgrade Storybook to v10, add MCP s…
acasazza Apr 7, 2026
f9c36c9
Merge pull request #735 from commercelayer/v5/docs/skus-story-storybo…
acasazza Apr 7, 2026
3cd160a
chore(document): upgrade storybook to latest
acasazza Apr 1, 2026
feed6f2
🐛 fix(HostedCart): refresh minicart URL when persistKey changes (#685)
acasazza Apr 8, 2026
dcdff92
📦 deps(react-components): bump @commercelayer/organization-config to …
acasazza Apr 8, 2026
8cc847f
♻️ refactor(HostedCart): clean imports and remove stale biome comment
acasazza Apr 9, 2026
ee615c8
✨ feat(MyIdentityLink): pass identity params to getOrganizationConfig…
acasazza Apr 9, 2026
6719d55
✨ feat(AddToCartButton): pass skuListId and skuId to getOrganizationC…
acasazza Apr 9, 2026
08c1769
chore: update pnpm-lock.yaml after bumping @commercelayer/organizatio…
acasazza Apr 9, 2026
0c59772
Merge pull request #741 from commercelayer/v5/fix/hosted-cart-pr740
acasazza Apr 9, 2026
e25391e
Remove lodash dependency (#743)
acasazza Apr 10, 2026
f1bc0a2
refactor(availability): remove dead reducer, export SkuAvailability, …
acasazza Apr 10, 2026
5b7b987
fix(document): add React import to storybook addon Tool component
acasazza Apr 10, 2026
782d898
fix(document): correct storybook addon-docs imports and tsconfig
acasazza Apr 10, 2026
50d2431
📚 docs + feat(skus): getting-started docs, SkuList context fix, SkuLi…
acasazza Apr 10, 2026
7a9e9f4
fix(MyAccountLink): add returnUrl prop to enable back-to-store and lo…
acasazza Apr 13, 2026
213d467
fix(HostedCart): prevent minicart glitch on first visit with no orderId
acasazza Apr 13, 2026
d4b4bab
refactor(MyAccountLink): use useEffect pattern like MyIdentityLink
acasazza Apr 13, 2026
c86677a
Merge pull request #747 from commercelayer/fix/my-account-link-hosted…
acasazza Apr 13, 2026
e93a987
✨ feat(core): expose InterceptorManager via getSdk and all core resou…
acasazza Apr 15, 2026
42c6403
fix(lint): apply biome formatting and add missing tests for 100% cove…
acasazza Apr 15, 2026
05ded45
feat: add interceptors prop to CommerceLayer and hook-based container…
acasazza Apr 16, 2026
cb6f988
test: update CommerceLayer specs to reflect removed endpoint from con…
acasazza Apr 16, 2026
cb14a7a
chore: apply Biome lint fixes to react-components changed files
acasazza Apr 17, 2026
041f1b5
Merge pull request #750 from commercelayer/feat/748-sdk-interceptors
acasazza Apr 17, 2026
8947a0d
✨ feat(prices): standalone Price with module-level batch store, depre…
acasazza Apr 23, 2026
e84de92
🔧 chore(ci): update GitHub Actions to latest versions (#754)
acasazza Apr 23, 2026
633a166
✨ feat(skus): standalone Sku and SkuList components, deprecate contai…
acasazza Apr 27, 2026
c699dd7
✨ feat(availability): standalone Availability component, deprecate Av…
acasazza Apr 30, 2026
cbad9b7
✨ feat(orders): extract order logic to core+hooks, slim OrderContaine…
acasazza May 4, 2026
de11293
🐛 fix(orders): restore missing effect body in useOrderState
acasazza May 5, 2026
700f9f3
✨ feat(orders): add standalone Order component and deprecate OrderCon…
May 7, 2026
b483075
chore: update dependencies
May 8, 2026
7c1c849
Merge pull request #766 from commercelayer/feat/order-standalone-comp…
acasazza May 8, 2026
019c303
feat(AddToCartButton): add loading state and tests
May 8, 2026
a4d6c88
fix: update context guard messages from OrderContainer to Order
May 8, 2026
9c4f89a
docs: add AddToCartButton stories and MDX documentation
May 8, 2026
f3a8ef0
docs(AddToCartButton): clarify dynamic order creation in MDX
May 8, 2026
ed5ea04
docs: improve Storybook Orders menu ordering
May 8, 2026
64c3596
docs: attach AddToCartButton MDX as component docs page
May 8, 2026
48aafaf
docs: add component field to Orders story metas
May 8, 2026
f0ad906
refactor(stories): rewrite AddToCartButton stories with latest changes
May 11, 2026
e797dad
docs: merge MDX into stories files for Orders, Prices, and SKUs
May 11, 2026
ab32559
refactor(stories): rewrite SkusContainer and SkuField stories with mo…
May 11, 2026
5e98ca8
docs(stories): add DocsPages to SkusContainer/SkuField, trim Skus ove…
May 11, 2026
a1f5c6e
fix(storybook): point react-docgen-typescript to component source
May 12, 2026
cc4ff36
fix(storybook): resolve @commercelayer/react-components to TS source …
May 12, 2026
09f99c1
fix(stories): replace ArgTypes component ref with meta context to fix…
May 12, 2026
2f8ac10
docs(stories): add DocsPages to Availability and AddToCartButton
May 12, 2026
778630d
📚 docs(stories): extract deprecated containers into own story files (…
acasazza May 20, 2026
0cd085a
feat: refactor CheckoutLink component, add stories & specs (#770)
acasazza May 21, 2026
a3399ac
♻️ refactor(HostedCart): fix hooks order, extract domain constant and…
acasazza May 22, 2026
dbbaf0c
✨ feat(stories): add HostedCart stories in document package (#774)
acasazza May 25, 2026
3149e3a
♻️ refactor(line-items): deprecate LineItemsContainer, add LineItems …
acasazza May 27, 2026
3a96c74
♻️ refactor(line-items): refactor child components and add 100% cover…
acasazza May 28, 2026
61bc454
♻️ refactor(gift_cards): standalone GiftCard, remove reducer, rapid-f…
acasazza May 29, 2026
8b737f2
♻️ refactor: customers and addresses domain (#784)
acasazza Jun 2, 2026
1c85518
♻️ refactor: addresses domain — standalone BillingAddress and Shippin…
acasazza Jun 2, 2026
8f572d6
♻️ refactor: shipments domain — standalone Shipments component and ho…
acasazza Jun 3, 2026
1124b57
🔧 chore: apply biome formatting and fix deprecated JSDoc
Jun 3, 2026
0e94e3f
✅ test: add 100% coverage specs for stock_transfers components
Jun 3, 2026
36a721d
✨ feat: in_stock_subscriptions — standalone component, hook, and core…
acasazza Jun 4, 2026
ce9bb5f
ci: update GitHub Actions to use latest versions of checkout, pnpm, a…
malessani Jun 4, 2026
76180db
♻️ refactor: replace jwt-decode with jwtDecode from @commercelayer/js…
Jun 5, 2026
a338307
🐛 fix: remove handleClick/onSubmit from useEffect deps to prevent inf…
Jun 5, 2026
bebe952
🔧 chore: add build:watch script to react-components
Jun 5, 2026
8d2b546
🔧 chore: add build:watch to core, hooks and root workspace
Jun 5, 2026
62113c3
🔒 fix(security): add overrides for high/critical CVEs on v5.0.0
Jun 8, 2026
21962c9
refactor: extract shared address form logic into reusable hooks
Jun 8, 2026
93eb485
fix: remove inline arrow wrappers in providerValues to prevent infini…
Jun 8, 2026
dd1164e
test: add real rapid-form integration test for BillingAddressForm val…
Jun 8, 2026
71116c3
fix: preserve all address fields when pre-filling from API and on use…
Jun 8, 2026
2978cc7
fix: dispatch input event in setValue and resetField so rapid-form ca…
Jun 8, 2026
a49883d
fix: call setValue when state is selected from AddressStateSelector d…
Jun 8, 2026
29d942a
fix: pre-fill state code when country is set for the first time in Ad…
Jun 8, 2026
a81faea
fix: read text input DOM value as fallback when country first detecte…
Jun 9, 2026
03f9adb
fix: expose address reducer values in BillingAddressFormContext/Shipp…
Jun 9, 2026
bed4be6
fix: resolve DTS build error TS4111 for billing/shipping address redu…
Jun 9, 2026
7d9e860
feat: add errorMode prop to BillingAddressForm and ShippingAddressForm
Jun 9, 2026
0cd9b39
test: add coverage tests for errorMode, AddressStateSelector shipping…
Jun 9, 2026
1b8fa9b
test: achieve 100% branch coverage on AddressStateSelector
Jun 9, 2026
5c0f4c9
fix: prevent infinite re-render loop in Shipments component
Jun 9, 2026
d24a1b8
fix: prevent infinite re-render loop in Shipment component
Jun 9, 2026
25a904d
fix: prevent infinite re-render loop in Shipment autoSelect flow
Jun 9, 2026
26ac678
fix: prevent infinite re-render loop in PaymentGateway
Jun 9, 2026
59f490a
fix: prevent infinite re-render loop in PaymentMethodsContainer
Jun 9, 2026
aad6827
fix: move fetchOrder call from useMemo to useEffect in useOrderState
Jun 9, 2026
3552944
feat: make PaymentMethod standalone, deprecate PaymentMethodsContainer
Jun 9, 2026
f3923c0
test: add PaymentMethodsContainer and PaymentMethod specs
Jun 9, 2026
2432677
test: add 100% coverage tests for PaymentMethod, PaymentMethodsContai…
Jun 9, 2026
b5cb599
chore: remove react-doctor workflow and fix pkg-pr-new build step
Jun 9, 2026
516f567
test: add 100% coverage for PlaceOrder, PrivacyAndTermsCheckbox, useP…
Jun 10, 2026
37a2f8a
fix: PlaceOrderButton stays disabled when errors clear but privacy/te…
Jun 10, 2026
5ee6a5b
fix: PlaceOrderButton stays disabled when no payment selected or erro…
Jun 10, 2026
9b150eb
fix: stabilize setPaymentRef and other callbacks in PaymentMethodsCon…
Jun 10, 2026
39ce2e6
fix: PlaceOrderButton must not enable when no payment method is selected
Jun 10, 2026
438079b
fix: AddressCountrySelector always shows pre-filled country
Jun 10, 2026
313f2fd
fix: revert unnecessary setValue empty call on country selector mount
Jun 10, 2026
8f61803
fix: normalize null value to empty string in BaseSelect
Jun 10, 2026
b333cd0
fix: preserve user selection in BaseSelect when parent oscillates bet…
Jun 10, 2026
4e1e1de
fix: keep BaseSelect uncontrolled with layout-effect sync
Jun 11, 2026
242e64a
fix: prevent duplicate payment source creation
Jul 1, 2026
eb3f472
chore: add typecheck script scoped to shipped src
Jul 2, 2026
2f87042
fix: add root build script so pre-commit hook resolves
Jul 2, 2026
0c8597e
fix: make core integration tests actually run against the test org
Jul 2, 2026
5b78b1a
refactor: continue standalone payment components work, drop examples app
Jul 2, 2026
2b43f4b
fix: keep rapid-form listeners wired to fields mounted after the form
Jul 13, 2026
5d2a234
fix: spread passthrough props on AddressStateSelector text-input branch
Jul 13, 2026
f6010fb
refactor: drop useFormWiring workaround now that rapid-form 4.0.3 wir…
Jul 14, 2026
b0117f5
build: replace tsup with tsdown and apply React Compiler to published…
Jul 15, 2026
26f8359
Merge pull request #799 from commercelayer/chore/migrate-tsup-to-tsdown
acasazza Jul 20, 2026
c459b57
chore(deps): update dependencies to latest minor/patch
Jul 20, 2026
1f443e6
Merge pull request #796 from commercelayer/refactor/payment-standalon…
acasazza Jul 20, 2026
04ca40b
chore: rename core -> core-components and hooks -> react-hooks-compon…
Jul 21, 2026
53b6413
Merge pull request #802 from commercelayer/chore/rename-core-hooks-pa…
acasazza Jul 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 13 additions & 0 deletions .github/hooks/hooks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 1,
"hooks": {
"postToolUse": [
{
"type": "command",
"bash": "node .github/hooks/scripts/biome-check.mjs",
"cwd": ".",
"timeoutSec": 60
}
]
}
}
34 changes: 34 additions & 0 deletions .github/hooks/scripts/biome-check.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env node

import { execSync } from "node:child_process"
import { createInterface } from "node:readline"

const SUPPORTED_EXTENSIONS = /\.(ts|tsx|js|jsx|json)$/
const FILE_TOOLS = new Set(["edit", "create"])

async function readStdin() {
return new Promise((resolve) => {
const rl = createInterface({ input: process.stdin, terminal: false })
const lines = []
rl.on("line", (line) => lines.push(line))
rl.on("close", () => resolve(lines.join("\n")))
})
}

const raw = await readStdin()
const input = JSON.parse(raw)

if (!FILE_TOOLS.has(input.toolName)) process.exit(0)

const toolArgs = JSON.parse(input.toolArgs)
const filePath = toolArgs.path

if (!filePath || !SUPPORTED_EXTENSIONS.test(filePath)) process.exit(0)

try {
execSync(`pnpm biome check "${filePath}"`, {
stdio: "inherit",
})
} catch {
process.exit(1)
}
16 changes: 6 additions & 10 deletions .github/workflows/gh-pages.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: Deploy to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
# Temporarily disabled - re-enable by adding push trigger back
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
Expand All @@ -25,17 +21,17 @@ jobs:

steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: pnpm 🧰
uses: pnpm/action-setup@v3
uses: pnpm/action-setup@v6
with:
version: 8
version: 10

- name: Node 🧰
uses: actions/setup-node@v3
uses: actions/setup-node@v6
with:
node-version: 'latest'
node-version: '20.x'
cache: "pnpm"

- name: Install 📦
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/pgk-pr-new.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@ jobs:

steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
persist-credentials: false

- name: pnpm 🧰
uses: pnpm/action-setup@v3
uses: pnpm/action-setup@v6
with:
version: 9.x
version: 10

- name: Node 🧰
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: 22.x

- name: Install 📦
run: pnpm install --frozen-lockfile

- name: Build elements 🛠
run: pnpm build
run: pnpm --filter @commercelayer/core-components --filter @commercelayer/react-hooks-components --filter @commercelayer/react-components build

- name: Publish 🚀 pkg.pr.new
run: |
npx pkg-pr-new publish './packages/react-components' --no-template
npx pkg-pr-new publish './packages/react-components' './packages/core-components' './packages/react-hooks-components' --no-template
6 changes: 3 additions & 3 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ jobs:

steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: pnpm 🧰
uses: pnpm/action-setup@v4
uses: pnpm/action-setup@v6
with:
version: 10

- name: Node 🧰
uses: actions/setup-node@v5
uses: actions/setup-node@v6
with:
node-version: 20.x
registry-url: https://registry.npmjs.org
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
uses: actions/checkout@v4

- name: Create a draft GitHub release 🎁
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.COMMERCELAYER_CI_TOKEN }}
draft: true
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,7 @@ dist
.DS_Store

# Storybook
storybook-static
storybook-static

# Blog articles
episode-*
5 changes: 1 addition & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm build
pnpm build && pnpm test
8 changes: 8 additions & 0 deletions .mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"mcpServers": {
"storybook": {
"command": "pnpm",
"args": ["--filter", "document", "run", "mcp"]
}
}
}
7 changes: 2 additions & 5 deletions .ncurc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
module.exports = {
reject: [
'pnpm',
'iframe-resizer'
]
}
reject: ["pnpm", "iframe-resizer"],
}
24 changes: 6 additions & 18 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"editor.formatOnSave": true,
"javascript.format.enable": true,
"eslint.workingDirectories": [
"packages/react-components",
"packages/docs",
],
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"css.validate": false,
"less.validate": false,
"scss.validate": false,
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
}
}
"source.fixAll.biome": "explicit",
"source.organizeImports.biome": "explicit"
},
"biome.configurationPath": "./biome.json"
}
13 changes: 13 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Agent skills

### Issue tracker

Issues live in GitHub Issues at `commercelayer/commercelayer-react-components`. See `docs/agents/issue-tracker.md`.

### Triage labels

Default five-role vocabulary (`needs-triage`, `needs-info`, `ready-for-agent`, `ready-for-human`, `wontfix`). See `docs/agents/triage-labels.md`.

### Domain docs

Single-context repo: one `CONTEXT.md` + `docs/adr/` at the root. See `docs/agents/domain.md`.
36 changes: 36 additions & 0 deletions CONTEXT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# React Components — Payment

This context covers the React components and state that let a storefront select a payment method and attach a payment source to an order during checkout.

## Language

**Payment Method**:
A selectable payment option on an order (a configured gateway option, e.g. "Stripe"). Backed by the `payment_method` resource.
_Avoid_: gateway (as a synonym), payment type

**Payment Source**:
The concrete payment instrument record attached to a single order (e.g. `stripe_payment`, `adyen_payment`, `wire_transfer`). Created per order from the selected Payment Method.
_Avoid_: payment, card, token

**Customer Payment Source**:
A Payment Source saved to a Customer for reuse across orders (a stored card). Selected via the order's `_customer_payment_source_id`.
_Avoid_: saved card (informal), wallet

**Payment Gateway**:
In this codebase, the React component that wires a specific gateway's UI/SDK and drives Payment Source creation for that gateway (e.g. `StripeGateway`, `AdyenGateway`).
_Avoid_: using "gateway" to mean the Payment Method

## Relationships

- An **Order** has at most one **Payment Method** and one **Payment Source**
- A **Payment Source** is created from the selected **Payment Method**
- A **Customer Payment Source** belongs to a **Customer**; selecting one sets the **Order**'s Payment Source

## Example dialogue

> **Dev:** "When the shopper picks Stripe, do we create the **Payment Source** in the `StripePayment` component?"
> **Domain expert:** "No — Stripe has no dedicated creation component. The `StripeGateway`/`PaymentGateway` effect creates the **Payment Source** once the **Payment Method** is selected. Adyen and Braintree, by contrast, create it inside their own components."

## Flagged ambiguities

- "set payment source" was used to mean both the async operation that creates/attaches a Payment Source *and* the reducer action that stores it in state — resolved: the operation is `setPaymentSource(...)`, the reducer action is `dispatch({ type: "setPaymentSource" })`.
62 changes: 42 additions & 20 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,63 @@
{
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
"$schema": "https://biomejs.dev/schemas/2.4.15/schema.json",
"vcs": {
"enabled": false,
"enabled": true,
"clientKind": "git",
"useIgnoreFile": false
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": false,
"includes": ["**"]
"ignoreUnknown": true,
"includes": [
"**",
"!dist",
"!coverage",
"!*.min.js",
"!**/mocks/resources/orders/customer-orders-full.ts"
]
},
"formatter": {
"enabled": true,
"indentStyle": "space"
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 100
},
"assist": {
"enabled": true,
"actions": {
"source": {
"organizeImports": "on"
}
}
},
"assist": { "actions": { "source": { "organizeImports": "on" } } },
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"noParameterAssign": "error",
"useAsConstAssertion": "error",
"useDefaultParameterLast": "error",
"useEnumInitializers": "error",
"useSelfClosingElements": "error",
"useSingleVarDeclarator": "error",
"noUnusedTemplateLiteral": "error",
"useNumberNamespace": "error",
"noInferrableTypes": "error",
"noUselessElse": "error"
}
"recommended": true
}
},
"javascript": {
"formatter": {
"quoteStyle": "double",
"trailingCommas": "es5",
"semicolons": "asNeeded"
}
},
"json": {
"formatter": {
"enabled": true,
"trailingCommas": "none"
},
"linter": {
"enabled": true
}
},
"css": {
"formatter": {
"enabled": true,
"quoteStyle": "double"
},
"linter": {
"enabled": true
}
}
}
19 changes: 19 additions & 0 deletions docs/adr/0001-coalesce-payment-source-requests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Coalesce concurrent payment-source requests

## Context

`setPaymentSource` (in `PaymentMethodReducer.ts`) is a plain async function driven by React effects — notably the `PaymentGateway` effect, which fires it fire-and-forget from a 23-dependency effect. Before the first `create`/`update`/`updateOrder` request resolves, both `paymentSource` (context state) and `order.payment_source` are still null, so any dependency change re-runs the effect and fires a **second** request. On the Stripe / single-payment-method / new-source flow this produced two `stripe_payments.create` calls and two payment source records.

## Decision

De-duplicate genuinely-concurrent calls with a module-level `Map<string, Promise>` keyed by `` `${order.id}:${paymentResource}:${customerPaymentSourceId ?? paymentSourceId ?? 'create'}` ``. The first call stores its in-flight promise; concurrent calls with the same key return that same promise; the entry is deleted in a `finally` once it settles. This coalesces duplicates within a burst without permanently memoizing, so a later legitimate re-create still runs. It backs up the narrower in-flight `useRef` guard in the `PaymentGateway` effect and protects every gateway, not just Stripe.

## Considered options

- **Effect-only `useRef` guard** — kept as the first line of defense, but too narrow: only protects the `PaymentGateway` caller, not other gateways or future callers.
- **Idempotency check against `order.payment_source`** — unreliable: the order is stale until `getOrder` refreshes after the first request.
- **Hashing `attributes` into the key** — rejected as fragile; attributes are effectively constant for a given order + resource + path within a burst.

## Consequences

The reducer module now holds mutable global state, which reads as surprising for an otherwise-stateless function — this ADR is the "why." The key deliberately separates the create, update/retrieve, and saved-source (`updateOrder`) paths so coalescing never merges semantically different operations.
Loading
Loading