From 32e96f1e9856ef819751723ca85a6d6ce21b97ec Mon Sep 17 00:00:00 2001 From: Daniel Kift Date: Thu, 8 Oct 2026 10:22:28 +0100 Subject: [PATCH 1/3] Organize Web components and add explicit checkout import --- platforms/web/README.md | 37 ++++-- platforms/web/dependency-cruiser.config.mjs | 2 +- platforms/web/package.json | 26 ++-- platforms/web/package.snapshot.json | 5 +- platforms/web/sample/README.md | 2 +- platforms/web/sample/main.ts | 2 +- platforms/web/sample/tsconfig.json | 3 +- platforms/web/sample/vite.config.ts | 11 +- platforms/web/scripts/npm-package.test.ts | 122 ++++++++++++++++++ platforms/web/scripts/tsconfig.json | 10 ++ .../shopify-checkout}/browser-capabilities.ts | 0 .../shopify-checkout}/checkout-events.ts | 4 +- .../checkout-protocol.test.ts | 6 +- .../shopify-checkout}/checkout-window.test.ts | 8 +- .../shopify-checkout}/checkout.types.ts | 6 +- .../shopify-checkout/register.ts} | 2 +- .../shopify-checkout/shopify-checkout.css} | 0 .../shopify-checkout.test.ts} | 10 +- .../shopify-checkout/shopify-checkout.ts} | 20 +-- platforms/web/src/index.ts | 21 ++- platforms/web/test/e2e/README.md | 2 +- platforms/web/test/e2e/fixtures/host.html | 2 +- platforms/web/test/e2e/server.mjs | 14 +- platforms/web/vite.config.ts | 12 +- platforms/web/vitest.package.config.ts | 11 ++ scripts/test/changed_file_filters_test.rb | 2 +- 26 files changed, 268 insertions(+), 72 deletions(-) create mode 100644 platforms/web/scripts/npm-package.test.ts create mode 100644 platforms/web/scripts/tsconfig.json rename platforms/web/src/{ => components/shopify-checkout}/browser-capabilities.ts (100%) rename platforms/web/src/{ => components/shopify-checkout}/checkout-events.ts (94%) rename platforms/web/src/{ => components/shopify-checkout}/checkout-protocol.test.ts (99%) rename platforms/web/src/{ => components/shopify-checkout}/checkout-window.test.ts (99%) rename platforms/web/src/{ => components/shopify-checkout}/checkout.types.ts (97%) rename platforms/web/src/{checkout-web-component.ts => components/shopify-checkout/register.ts} (75%) rename platforms/web/src/{checkout.css => components/shopify-checkout/shopify-checkout.css} (100%) rename platforms/web/src/{checkout.test.ts => components/shopify-checkout/shopify-checkout.test.ts} (98%) rename platforms/web/src/{checkout.ts => components/shopify-checkout/shopify-checkout.ts} (98%) create mode 100644 platforms/web/vitest.package.config.ts diff --git a/platforms/web/README.md b/platforms/web/README.md index a7f4b4443..d2f2e15b9 100644 --- a/platforms/web/README.md +++ b/platforms/web/README.md @@ -86,13 +86,18 @@ Once the first stable `4.0.0` ships, the standard `pnpm add @shopify/checkout-ki ## Basic Usage -Import the package once anywhere in your application. The import has a side -effect — it registers `` with `customElements`: +Import the component once anywhere in your application. This entry registers +only `` with `customElements`: ```ts -import '@shopify/checkout-kit'; +import '@shopify/checkout-kit/shopify-checkout'; ``` +Components use separate entry points within the same npm package. Import only +the components you need. The existing root import (`@shopify/checkout-kit`) +continues to register `` for compatibility; it will not +automatically register additional components. + Then render the element anywhere in your HTML and call `open()` to present checkout: @@ -106,7 +111,7 @@ checkout: