@shop-on/theme-runtime 0.6.0 → 0.7.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/dist/index.d.ts CHANGED
@@ -12,7 +12,7 @@ import { isDefaultSingleVariant } from "./product-variants/is-default-single-var
12
12
  import { isVariantSelectable } from "./product-variants/is-variant-selectable.js";
13
13
  import { ResolvedVariant, resolveSelectedVariant } from "./product-variants/resolve-selected-variant.js";
14
14
  import { selectionKey } from "./product-variants/selection-key.js";
15
- import { ArticleSchemaSource, BlockInstance, BreadcrumbSchemaSource, ProductSchemaSource, SectionGroupConfig, TemplateJSON, TemplateSeoSource, WebsiteSchemaSource } from "./template-types.js";
15
+ import { ArticleSchemaSource, BlockInstance, BreadcrumbSchemaSource, OrganizationSchemaSource, ProductSchemaSource, ReturnPolicySchemaSource, SectionGroupConfig, TemplateJSON, TemplateSeoSource, WebsiteSchemaSource } from "./template-types.js";
16
16
  import { staleVariantFlag } from "./product-variants/stale-variant.js";
17
17
  import { SwatchSource, isSwatchOption, swatchSource } from "./product-variants/swatch-source.js";
18
18
  import { VariantPriceRange, variantPriceRange } from "./product-variants/variant-price-range.js";
@@ -22,4 +22,4 @@ import { isOnSale, savePercent } from "./sale.js";
22
22
  import { BuildSeoHeadArgs, SEO_DESCRIPTION_MAX_LENGTH, SeoHead, buildSeoHead, canonicalPath, isNarrowedListing, truncateSeoDescription } from "./seo.js";
23
23
  import { stripPostAuthParams } from "./strip-handoff-url.js";
24
24
  import { thumbhashDataUrl } from "./thumbhash.js";
25
- export { ArticleSchemaSource, BlockInstance, BreadcrumbSchemaSource, BuildSeoHeadArgs, Embed, EmbedKind, type LinkedMetafieldRef, type LinkedMetaobject, type LinkedMetaobjectField, Money, type OptionAvailability, PlayerEmbed, type ProductForVariantState, type ProductOption, type ProductOptionValue, ProductSchemaSource, type ProductVariant, type ResolvedVariant, SEO_DESCRIPTION_MAX_LENGTH, SectionGroupConfig, type SelectedOption, SeoHead, type SwatchSource, type SwatchVariant, TemplateJSON, TemplateSeoSource, type VariantPriceRange, type VariantState, WebsiteSchemaSource, buildAvailabilityIndex, buildSeoHead, buildVariantState, canonicalPath, currencySymbol, defaultPriceMaxBound, embedBackgroundSrc, escapeForScriptTag, findClosestVariant, formatMoney, formatMoneyWithCurrency, initials, isDefaultSingleVariant, isNarrowedListing, isOnSale, isSwatchOption, isVariantSelectable, pageCursor, parseEmbedUrl, productHref, resolveSelectedVariant, savePercent, selectionKey, staleVariantFlag, stripPostAuthParams, swatchSource, thumbhashDataUrl, truncateSeoDescription, variantPriceRange };
25
+ export { ArticleSchemaSource, BlockInstance, BreadcrumbSchemaSource, BuildSeoHeadArgs, Embed, EmbedKind, type LinkedMetafieldRef, type LinkedMetaobject, type LinkedMetaobjectField, Money, type OptionAvailability, OrganizationSchemaSource, PlayerEmbed, type ProductForVariantState, type ProductOption, type ProductOptionValue, ProductSchemaSource, type ProductVariant, type ResolvedVariant, ReturnPolicySchemaSource, SEO_DESCRIPTION_MAX_LENGTH, SectionGroupConfig, type SelectedOption, SeoHead, type SwatchSource, type SwatchVariant, TemplateJSON, TemplateSeoSource, type VariantPriceRange, type VariantState, WebsiteSchemaSource, buildAvailabilityIndex, buildSeoHead, buildVariantState, canonicalPath, currencySymbol, defaultPriceMaxBound, embedBackgroundSrc, escapeForScriptTag, findClosestVariant, formatMoney, formatMoneyWithCurrency, initials, isDefaultSingleVariant, isNarrowedListing, isOnSale, isSwatchOption, isVariantSelectable, pageCursor, parseEmbedUrl, productHref, resolveSelectedVariant, savePercent, selectionKey, staleVariantFlag, stripPostAuthParams, swatchSource, thumbhashDataUrl, truncateSeoDescription, variantPriceRange };
@@ -61,6 +61,9 @@ export interface ProductSchemaSource {
61
61
  description: string;
62
62
  images: string[];
63
63
  sku: string | null;
64
+ /** The default variant's GTIN (EAN/UPC), only when its barcode passes the
65
+ * GS1 check digit. Absent or null emits no `gtin`. */
66
+ gtin?: string | null;
64
67
  vendor: string | null;
65
68
  price: number;
66
69
  currency: string;
@@ -82,6 +85,40 @@ export interface ProductSchemaSource {
82
85
  high: number;
83
86
  offerCount: number;
84
87
  };
88
+ /** The shop's saved return policy, as it applies to THIS product (a
89
+ * final-sale product reads `NotPermitted`). Absent until the merchant saves
90
+ * one under Settings → Returns. */
91
+ returnPolicy?: ReturnPolicySchemaSource;
92
+ }
93
+ /** Schema.org MerchantReturnPolicy source — rides `<ProductJsonLd>`'s offer and
94
+ * `<OrganizationJsonLd>`. Built by `@shop-on/theme-server/structured-data` from
95
+ * the merchant's saved policy; never from the column defaults an unconfigured
96
+ * shop reads back, which are no promise the merchant made. */
97
+ export interface ReturnPolicySchemaSource {
98
+ /** ISO 3166-1 alpha-2 — Google requires `applicableCountry`. */
99
+ country: string;
100
+ category: "FiniteReturnWindow" | "UnlimitedWindow" | "NotPermitted";
101
+ /** Set for `FiniteReturnWindow` only. */
102
+ days?: number;
103
+ /** Who pays to send it back. Absent for `NotPermitted`. */
104
+ fees?: "FreeReturn" | "ReturnFeesCustomerResponsibility" | "ReturnShippingFees";
105
+ /** Set for `ReturnShippingFees` only. */
106
+ shippingFee?: {
107
+ amount: number;
108
+ currency: string;
109
+ };
110
+ /** Percent of the price withheld, when the merchant set one above zero. */
111
+ restockingFeePercent?: number;
112
+ /** Absolute URL of the shop's written refund policy, when it has one. */
113
+ url?: string;
114
+ }
115
+ /** Schema.org Organization source — feeds `<OrganizationJsonLd>` on the
116
+ * homepage: who sells here, their logo, and their return policy. */
117
+ export interface OrganizationSchemaSource {
118
+ name: string;
119
+ url: string;
120
+ logo?: string;
121
+ returnPolicy?: ReturnPolicySchemaSource;
85
122
  }
86
123
  /** Schema.org BreadcrumbList source — feeds `<BreadcrumbJsonLd>`. Items are
87
124
  * ordered root→current and the component assigns the 1-based `position`. URLs
@@ -131,6 +168,8 @@ export interface TemplateJSON {
131
168
  breadcrumbSchema?: BreadcrumbSchemaSource;
132
169
  /** Set by `getHomeTemplate` so the homepage can render `<WebsiteJsonLd>`. */
133
170
  websiteSchema?: WebsiteSchemaSource;
171
+ /** Set by `getHomeTemplate` so the homepage can render `<OrganizationJsonLd>`. */
172
+ organizationSchema?: OrganizationSchemaSource;
134
173
  /** Search-console ownership proofs, set by `getHomeTemplate`. Homepage only:
135
174
  * Google's and Bing's meta-tag verification methods both look at the site
136
175
  * root, so carrying these site-wide would be two dead tags per page. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shop-on/theme-runtime",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "license": "SEE LICENSE IN dist/LICENSE.md",
5
5
  "files": [
6
6
  "dist"
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "thumbhash": "0.1.1",
39
- "@shop-on/theme-contract": "0.6.0"
39
+ "@shop-on/theme-contract": "0.7.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "26.6.5",