@godaddy/gd-commerce-storefront 0.1.0 → 0.1.1

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/README.md CHANGED
@@ -82,7 +82,7 @@ A connection failure leaves the surrounding application and its state mounted. C
82
82
  </CommerceStorefront>
83
83
  ```
84
84
 
85
- The stylesheet includes all required utilities and scopes them to the package's surfaces. The build removes CSS layer wrappers in their declared order, so the exported CSS can pass through a host Tailwind v3 PostCSS pipeline without `@tailwind` directives. Import it directly; consumers do not need to copy or rewrite the CSS. It does not add a global reset or require dependency scanning by a host Tailwind build. The `theme` prop reaches the drawer even though it is portalled into `document.body`. Keep text, controls and focus indicators accessible when changing colors. Utility class names and internal markup are not a customization API.
85
+ The stylesheet includes all required utilities and scopes them to the package's surfaces. The build removes CSS layer wrappers in their declared order, so the exported CSS can pass through a host Tailwind v3 PostCSS pipeline without `@tailwind` directives. Import it directly; consumers do not need to copy or rewrite the CSS. It does not add a global reset or require dependency scanning by a host Tailwind build. The `theme` prop reaches the drawer even though it is portalled into `document.body`. Surfaces pair `--commerce-surface` with `--commerce-text`; muted text and borders adapt to that pair. Descendants inherit the surface text and body font instead of global heading styles. Keep text, controls and focus indicators accessible when changing colors. Utility class names and internal markup are not a customization API.
86
86
 
87
87
  The first release uses English UI text and `en-US` currency formatting. Catalog title and description are configurable. Full localization and arbitrary component slots are outside this initial API.
88
88
 
package/dist/index.d.ts CHANGED
@@ -199,7 +199,6 @@ interface SKUGroupAttribute {
199
199
  type SKUGroupSKU = SKU;
200
200
  interface SKUGroup {
201
201
  id?: string | null;
202
- status?: string | null;
203
202
  name?: string | null;
204
203
  label?: string | null;
205
204
  description?: string | null;
package/dist/index.js CHANGED
@@ -939,8 +939,8 @@ function ProductDetailsContent({ productId }) {
939
939
  headers: { "X-Commerce-Scope": config.cartScope }
940
940
  })
941
941
  });
942
+ const productNotFound = product.isError && product.error instanceof ApiError && product.error.status === 404;
942
943
  const group = product.data?.skuGroup;
943
- const productUnavailable = group?.status != null && group.status !== "ACTIVE";
944
944
  const attributes = getProductAttributes(group);
945
945
  const skuOptions = getLabeledSkuOptions(group);
946
946
  const explicitSku = skuOptions.find((sku) => sku.id === params.get("sku"));
@@ -985,7 +985,7 @@ function ProductDetailsContent({ productId }) {
985
985
  role: "status",
986
986
  children: "Loading product…"
987
987
  });
988
- if (product.isError) return /* @__PURE__ */ jsxs("div", {
988
+ if (product.isError && !productNotFound) return /* @__PURE__ */ jsxs("div", {
989
989
  role: "alert",
990
990
  children: [
991
991
  /* @__PURE__ */ jsx("h1", {
@@ -1004,7 +1004,7 @@ function ProductDetailsContent({ productId }) {
1004
1004
  })
1005
1005
  ]
1006
1006
  });
1007
- if (!group) return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
1007
+ if (productNotFound || !group) return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
1008
1008
  className: "text-2xl font-semibold",
1009
1009
  children: "Product not found"
1010
1010
  }), /* @__PURE__ */ jsx(Link, {
@@ -1154,25 +1154,19 @@ function ProductDetailsContent({ productId }) {
1154
1154
  value: Number.isNaN(quantity) ? "" : quantity,
1155
1155
  onChange: (event) => setQuantity(event.target.valueAsNumber)
1156
1156
  })] }),
1157
- productUnavailable ? /* @__PURE__ */ jsx("p", {
1158
- className: "text-sm",
1159
- children: "This product is no longer available."
1160
- }) : /* @__PURE__ */ jsx(AddToCartButton, {
1157
+ /* @__PURE__ */ jsx(AddToCartButton, {
1161
1158
  sku: selectedSku,
1162
1159
  name,
1163
1160
  quantity
1164
1161
  })
1165
1162
  ] }),
1166
- !selectedSku && (productUnavailable ? /* @__PURE__ */ jsx("p", {
1167
- className: "text-sm",
1168
- children: "This product is no longer available."
1169
- }) : /* @__PURE__ */ jsx("button", {
1163
+ !selectedSku && /* @__PURE__ */ jsx("button", {
1170
1164
  type: "button",
1171
1165
  className: `${buttonClass} w-full`,
1172
1166
  disabled: true,
1173
1167
  "aria-describedby": !complete ? `${fieldId}-variant-guidance` : void 0,
1174
1168
  children: "Add to cart"
1175
- }))
1169
+ })
1176
1170
  ]
1177
1171
  })
1178
1172
  ]
package/dist/styles.css CHANGED
@@ -32,12 +32,6 @@
32
32
  --color-red-700: oklch(50.5% 0.213 27.518);
33
33
  --color-red-800: oklch(44.4% 0.177 26.899);
34
34
  --color-amber-800: oklch(47.3% 0.137 46.201);
35
- --color-neutral-100: oklch(97% 0 0);
36
- --color-neutral-200: oklch(92.2% 0 0);
37
- --color-neutral-300: oklch(87% 0 0);
38
- --color-neutral-400: oklch(70.8% 0 0);
39
- --color-neutral-600: oklch(43.9% 0 0);
40
- --color-neutral-700: oklch(37.1% 0 0);
41
35
  --color-neutral-950: oklch(14.5% 0 0);
42
36
  --spacing: 0.25rem;
43
37
  --container-lg: 32rem;
@@ -71,9 +65,14 @@
71
65
  }
72
66
  .commerce-storefront {
73
67
  color: var(--commerce-text, #171717);
68
+ background-color: var(--commerce-surface, #fff);
74
69
  font-family: inherit;
75
70
  line-height: 1.5;
76
71
  }
72
+ .commerce-storefront :where(*) {
73
+ color: inherit;
74
+ font-family: inherit;
75
+ }
77
76
  .commerce-storefront *, .commerce-storefront *::before, .commerce-storefront *::after {
78
77
  box-sizing: border-box;
79
78
  border-width: 0;
@@ -109,6 +108,7 @@
109
108
  }
110
109
  .commerce-inline {
111
110
  display: inline-block;
111
+ background-color: transparent;
112
112
  }
113
113
  .commerce-sr-only {
114
114
  position: absolute;
@@ -347,7 +347,12 @@
347
347
  }
348
348
  .commerce-storefront .divide-neutral-200 {
349
349
  :where(& > :not(:last-child)) {
350
- border-color: var(--color-neutral-200);
350
+ border-color: var(--commerce-text, #171717);
351
+ @supports (color: color-mix(in lab, red, red)) {
352
+ & {
353
+ border-color: color-mix(in srgb, var(--commerce-text, #171717) 15%, var(--commerce-surface, #fff));
354
+ }
355
+ }
351
356
  }
352
357
  }
353
358
  .commerce-storefront .overflow-hidden {
@@ -385,13 +390,28 @@
385
390
  border-bottom-width: 1px;
386
391
  }
387
392
  .commerce-storefront .border-neutral-200 {
388
- border-color: var(--color-neutral-200);
393
+ border-color: var(--commerce-text, #171717);
394
+ @supports (color: color-mix(in lab, red, red)) {
395
+ & {
396
+ border-color: color-mix(in srgb, var(--commerce-text, #171717) 15%, var(--commerce-surface, #fff));
397
+ }
398
+ }
389
399
  }
390
400
  .commerce-storefront .border-neutral-300 {
391
- border-color: var(--color-neutral-300);
401
+ border-color: var(--commerce-text, #171717);
402
+ @supports (color: color-mix(in lab, red, red)) {
403
+ & {
404
+ border-color: color-mix(in srgb, var(--commerce-text, #171717) 25%, var(--commerce-surface, #fff));
405
+ }
406
+ }
392
407
  }
393
408
  .commerce-storefront .border-neutral-400 {
394
- border-color: var(--color-neutral-400);
409
+ border-color: var(--commerce-text, #171717);
410
+ @supports (color: color-mix(in lab, red, red)) {
411
+ & {
412
+ border-color: color-mix(in srgb, var(--commerce-text, #171717) 55%, var(--commerce-surface, #fff));
413
+ }
414
+ }
395
415
  }
396
416
  .commerce-storefront .border-neutral-900 {
397
417
  border-color: var(--commerce-text, #171717);
@@ -403,7 +423,12 @@
403
423
  background-color: var(--commerce-accent, #171717);
404
424
  }
405
425
  .commerce-storefront .bg-neutral-100 {
406
- background-color: var(--color-neutral-100);
426
+ background-color: var(--commerce-text, #171717);
427
+ @supports (color: color-mix(in lab, red, red)) {
428
+ & {
429
+ background-color: color-mix(in srgb, var(--commerce-text, #171717) 5%, var(--commerce-surface, #fff));
430
+ }
431
+ }
407
432
  }
408
433
  .commerce-storefront .bg-neutral-950\/40 {
409
434
  background-color: color-mix(in srgb, oklch(14.5% 0 0) 40%, transparent);
@@ -544,7 +569,12 @@
544
569
  color: inherit;
545
570
  }
546
571
  .commerce-storefront .text-neutral-600 {
547
- color: var(--color-neutral-600);
572
+ color: var(--commerce-text, #171717);
573
+ @supports (color: color-mix(in lab, red, red)) {
574
+ & {
575
+ color: color-mix(in srgb, var(--commerce-text, #171717) 75%, var(--commerce-surface, #fff));
576
+ }
577
+ }
548
578
  }
549
579
  .commerce-storefront .text-neutral-900 {
550
580
  color: var(--commerce-text, #171717);
@@ -613,29 +643,54 @@
613
643
  }
614
644
  .commerce-storefront .disabled\:bg-neutral-100 {
615
645
  &:disabled {
616
- background-color: var(--color-neutral-100);
646
+ background-color: var(--commerce-text, #171717);
647
+ @supports (color: color-mix(in lab, red, red)) {
648
+ & {
649
+ background-color: color-mix(in srgb, var(--commerce-text, #171717) 5%, var(--commerce-surface, #fff));
650
+ }
651
+ }
617
652
  }
618
653
  }
619
654
  .commerce-storefront .disabled\:bg-neutral-200 {
620
655
  &:disabled {
621
- background-color: var(--color-neutral-200);
656
+ background-color: var(--commerce-text, #171717);
657
+ @supports (color: color-mix(in lab, red, red)) {
658
+ & {
659
+ background-color: color-mix(in srgb, var(--commerce-text, #171717) 15%, var(--commerce-surface, #fff));
660
+ }
661
+ }
622
662
  }
623
663
  }
624
664
  .commerce-storefront .disabled\:text-neutral-600 {
625
665
  &:disabled {
626
- color: var(--color-neutral-600);
666
+ color: var(--commerce-text, #171717);
667
+ @supports (color: color-mix(in lab, red, red)) {
668
+ & {
669
+ color: color-mix(in srgb, var(--commerce-text, #171717) 75%, var(--commerce-surface, #fff));
670
+ }
671
+ }
627
672
  }
628
673
  }
629
674
  .commerce-storefront .disabled\:text-neutral-700 {
630
675
  &:disabled {
631
- color: var(--color-neutral-700);
676
+ color: var(--commerce-text, #171717);
677
+ @supports (color: color-mix(in lab, red, red)) {
678
+ & {
679
+ color: color-mix(in srgb, var(--commerce-text, #171717) 85%, var(--commerce-surface, #fff));
680
+ }
681
+ }
632
682
  }
633
683
  }
634
684
  .commerce-storefront .disabled\:hover\:bg-neutral-200 {
635
685
  &:disabled {
636
686
  &:hover {
637
687
  @media (hover: hover) {
638
- background-color: var(--color-neutral-200);
688
+ background-color: var(--commerce-text, #171717);
689
+ @supports (color: color-mix(in lab, red, red)) {
690
+ & {
691
+ background-color: color-mix(in srgb, var(--commerce-text, #171717) 15%, var(--commerce-surface, #fff));
692
+ }
693
+ }
639
694
  }
640
695
  }
641
696
  }
@@ -31,6 +31,8 @@ Server implementations can use GoDaddy Commerce APIs or their existing integrati
31
31
 
32
32
  `/checkout` is required only when checkout is enabled. `/discounts` is needed if the host uses `applyDiscount`. The standard catalog/detail/cart flow uses the other routes. All product/cart IDs in request paths are encoded.
33
33
 
34
+ The companion `@godaddy/gd-commerce-server` returns 404 from product details when the group is missing or excluded by the catalog's ACTIVE filter, including direct links to inactive products.
35
+
34
36
  ## Configuration
35
37
 
36
38
  `cartScope` is a nonempty opaque identifier for the effective store/channel/currency binding. It is not a secret. Rotate it when that binding changes so a saved cart cannot cross stores or currencies. `currencyCode` is a three-letter uppercase ISO 4217 code, for example `USD`. Money integers use that currency's smallest unit: USD 1234 is $12.34; JPY 1234 is ¥1,234. The cart shows the draft-order subtotal and the message “Shipping, taxes, and discounts are calculated at checkout.” The message has the stable `commerce-cart-checkout-adjustments-note` class so a host can hide it without changing the component.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@godaddy/gd-commerce-storefront",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Opinionated React storefront templates for GoDaddy Commerce",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -23,14 +23,6 @@
23
23
  "./styles.css": "./dist/styles.css",
24
24
  "./package.json": "./package.json"
25
25
  },
26
- "scripts": {
27
- "build": "tsdown && node scripts/build-css.mjs",
28
- "typecheck": "tsc --noEmit",
29
- "test": "vitest run",
30
- "lint": "biome check src",
31
- "lint:fix": "biome check --write src",
32
- "prepublishOnly": "pnpm build"
33
- },
34
26
  "peerDependencies": {
35
27
  "@tanstack/react-query": "^5.0.0",
36
28
  "react": "^18.2.0 || ^19.0.0",
@@ -69,5 +61,12 @@
69
61
  "type": "git",
70
62
  "url": "git+https://github.com/godaddy/javascript.git",
71
63
  "directory": "packages/commerce-storefront"
64
+ },
65
+ "scripts": {
66
+ "build": "tsdown && node scripts/build-css.mjs",
67
+ "typecheck": "tsc --noEmit",
68
+ "test": "vitest run",
69
+ "lint": "biome check src",
70
+ "lint:fix": "biome check --write src"
72
71
  }
73
- }
72
+ }