@tanqory/theme-kit 0.1.0 → 2.0.0-alpha.17
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/LICENSE +21 -0
- package/README.md +125 -10
- package/dist/abi/canvas-live.d.ts +67 -0
- package/dist/abi/canvas-live.js +154 -0
- package/dist/abi/cart.d.ts +59 -0
- package/dist/abi/cart.js +387 -0
- package/dist/abi/convert.d.ts +344 -0
- package/dist/abi/convert.js +1278 -0
- package/dist/abi/data-api.d.ts +15 -0
- package/dist/abi/data-api.js +209 -0
- package/dist/abi/jcs.d.ts +6 -0
- package/dist/abi/jcs.js +28 -0
- package/dist/abi/labels.d.ts +3 -0
- package/dist/abi/labels.js +34 -0
- package/dist/abi/page-data.d.ts +256 -0
- package/dist/abi/page-data.js +678 -0
- package/dist/abi/page.d.ts +28 -0
- package/dist/abi/page.js +57 -0
- package/dist/abi/referrals.d.ts +23 -0
- package/dist/abi/referrals.js +89 -0
- package/dist/abi/rewards.d.ts +27 -0
- package/dist/abi/rewards.js +82 -0
- package/dist/abi/seo.d.ts +47 -0
- package/dist/abi/seo.js +68 -0
- package/dist/abi/shell.d.ts +23 -0
- package/dist/abi/shell.js +10 -0
- package/dist/abi/state-pack.d.ts +17 -0
- package/dist/abi/state-pack.js +43 -0
- package/dist/abi/wire.d.ts +38 -0
- package/dist/abi/wire.js +84 -0
- package/dist/build.d.ts +116 -0
- package/dist/build.js +310 -0
- package/dist/client.d.ts +19 -0
- package/dist/client.js +87 -0
- package/dist/contract.d.ts +6 -0
- package/dist/contract.js +6 -0
- package/dist/headless/ai.d.ts +132 -0
- package/dist/headless/ai.js +99 -0
- package/dist/headless/hooks.d.ts +276 -0
- package/dist/headless/hooks.js +540 -0
- package/dist/headless/i18n.d.ts +13 -0
- package/dist/headless/i18n.js +45 -0
- package/dist/headless/index.d.ts +37 -0
- package/dist/headless/index.js +38 -0
- package/dist/headless/money.d.ts +25 -0
- package/dist/headless/money.js +61 -0
- package/dist/headless/page.d.ts +43 -0
- package/dist/headless/page.js +53 -0
- package/dist/headless/platform.d.ts +55 -0
- package/dist/headless/platform.js +77 -0
- package/dist/headless/primitives/cart.d.ts +90 -0
- package/dist/headless/primitives/cart.js +153 -0
- package/dist/headless/primitives/collection.d.ts +68 -0
- package/dist/headless/primitives/collection.js +80 -0
- package/dist/headless/primitives/product.d.ts +101 -0
- package/dist/headless/primitives/product.js +117 -0
- package/dist/headless/primitives/storefront.d.ts +106 -0
- package/dist/headless/primitives/storefront.js +186 -0
- package/dist/headless/primitives/util.d.ts +19 -0
- package/dist/headless/primitives/util.js +42 -0
- package/dist/headless/strings.d.ts +9 -0
- package/dist/headless/strings.js +190 -0
- package/dist/headless/structured-data.d.ts +31 -0
- package/dist/headless/structured-data.js +57 -0
- package/dist/headless/theme.d.ts +99 -0
- package/dist/headless/theme.js +54 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +18 -553
- package/dist/runtime/data/StoreProvider.d.ts +84 -0
- package/dist/runtime/data/StoreProvider.js +373 -0
- package/dist/runtime/data/handle.d.ts +14 -0
- package/dist/runtime/data/handle.js +16 -0
- package/dist/runtime/data/routes.d.ts +87 -0
- package/dist/runtime/data/routes.js +158 -0
- package/dist/runtime/data/to-ui.d.ts +281 -0
- package/dist/runtime/data/to-ui.js +977 -0
- package/dist/runtime/entries/register.d.ts +9 -0
- package/dist/runtime/entries/register.js +9 -0
- package/dist/runtime/entries/sections.d.ts +16 -0
- package/dist/runtime/entries/sections.js +19 -0
- package/dist/{types → runtime/kit}/SectionTree.d.ts +2 -1
- package/dist/runtime/kit/SectionTree.js +100 -0
- package/dist/runtime/kit/analytics.d.ts +63 -0
- package/dist/runtime/kit/analytics.js +250 -0
- package/dist/runtime/kit/cart.d.ts +215 -0
- package/dist/runtime/kit/cart.js +545 -0
- package/dist/{types → runtime/kit}/composition.d.ts +1 -1
- package/dist/runtime/kit/composition.js +3 -0
- package/dist/{types → runtime/kit}/config.d.ts +2 -2
- package/dist/runtime/kit/config.js +6 -0
- package/dist/runtime/kit/consent.d.ts +29 -0
- package/dist/runtime/kit/consent.js +159 -0
- package/dist/runtime/kit/contract/content.d.ts +199 -0
- package/dist/runtime/kit/contract/content.js +106 -0
- package/dist/runtime/kit/contract/field-types.d.ts +337 -0
- package/dist/runtime/kit/contract/field-types.js +206 -0
- package/dist/runtime/kit/contract/groups.d.ts +230 -0
- package/dist/runtime/kit/contract/groups.js +402 -0
- package/dist/runtime/kit/contract/index.d.ts +33 -0
- package/dist/runtime/kit/contract/index.js +33 -0
- package/dist/runtime/kit/contract/transform.d.ts +82 -0
- package/dist/runtime/kit/contract/transform.js +133 -0
- package/dist/runtime/kit/contract/validate.d.ts +75 -0
- package/dist/runtime/kit/contract/validate.js +480 -0
- package/dist/runtime/kit/data.d.ts +720 -0
- package/dist/runtime/kit/data.js +1117 -0
- package/dist/{types → runtime/kit}/defineSection.d.ts +1 -1
- package/dist/runtime/kit/defineSection.js +10 -0
- package/dist/{types → runtime/kit}/dynamic-source.d.ts +40 -18
- package/dist/runtime/kit/dynamic-source.js +294 -0
- package/dist/runtime/kit/index.d.ts +24 -0
- package/dist/runtime/kit/index.js +24 -0
- package/dist/{types → runtime/kit}/jsx-to-json.d.ts +1 -1
- package/dist/runtime/kit/jsx-to-json.js +28 -0
- package/dist/{types → runtime/kit}/mount.d.ts +25 -4
- package/dist/runtime/kit/mount.js +124 -0
- package/dist/{types → runtime/kit}/registry.d.ts +1 -1
- package/dist/runtime/kit/registry.js +12 -0
- package/dist/{types → runtime/kit}/ssg.d.ts +9 -3
- package/dist/runtime/kit/ssg.js +56 -0
- package/dist/runtime/kit/storefront.d.ts +639 -0
- package/dist/runtime/kit/storefront.js +723 -0
- package/dist/{types → runtime/kit}/theme-context.d.ts +8 -2
- package/dist/runtime/kit/theme-context.js +25 -0
- package/dist/runtime/kit/types.d.ts +147 -0
- package/dist/runtime/kit/types.js +1 -0
- package/dist/runtime/platform/TrackingPixels.d.ts +14 -0
- package/dist/runtime/platform/TrackingPixels.js +63 -0
- package/dist/runtime/platform/environment.d.ts +68 -0
- package/dist/runtime/platform/environment.js +85 -0
- package/dist/runtime/platform/locale.d.ts +27 -0
- package/dist/runtime/platform/locale.js +42 -0
- package/dist/runtime/platform/route-analytics.d.ts +15 -0
- package/dist/runtime/platform/route-analytics.js +72 -0
- package/dist/runtime/platform/safe-href.d.ts +25 -0
- package/dist/runtime/platform/safe-href.js +69 -0
- package/dist/runtime/platform/safe-values.d.ts +37 -0
- package/dist/runtime/platform/safe-values.js +140 -0
- package/dist/runtime/render/SectionRenderer.d.ts +4 -0
- package/dist/runtime/render/SectionRenderer.js +166 -0
- package/dist/runtime/render/listing-query.d.ts +52 -0
- package/dist/runtime/render/listing-query.js +122 -0
- package/dist/runtime/render/localized-copy.d.ts +86 -0
- package/dist/runtime/render/localized-copy.js +129 -0
- package/dist/runtime/render/product-listing.d.ts +11 -0
- package/dist/runtime/render/product-listing.js +243 -0
- package/dist/runtime/render/section-actions.d.ts +66 -0
- package/dist/runtime/render/section-actions.js +202 -0
- package/dist/runtime/render/starter.d.ts +11 -0
- package/dist/runtime/render/starter.js +81 -0
- package/dist/runtime/seo/head.d.ts +115 -0
- package/dist/runtime/seo/head.js +281 -0
- package/dist/runtime/seo/structured-data.d.ts +83 -0
- package/dist/runtime/seo/structured-data.js +252 -0
- package/dist/runtime/shell/PageShell.d.ts +18 -0
- package/dist/runtime/shell/PageShell.js +113 -0
- package/dist/runtime/shell/RuntimeBridge.d.ts +14 -0
- package/dist/runtime/shell/RuntimeBridge.js +93 -0
- package/dist/runtime/shell/overlay-state.d.ts +31 -0
- package/dist/runtime/shell/overlay-state.js +59 -0
- package/dist/runtime/shell/preview-mode.d.ts +2 -0
- package/dist/runtime/shell/preview-mode.js +11 -0
- package/dist/runtime/shell/spa-router.d.ts +14 -0
- package/dist/runtime/shell/spa-router.js +76 -0
- package/dist/runtime/shell/url-redirects.d.ts +6 -0
- package/dist/runtime/shell/url-redirects.js +37 -0
- package/dist/runtime/slots.d.ts +74 -0
- package/dist/runtime/slots.js +16 -0
- package/dist/runtime.d.ts +34 -0
- package/dist/runtime.js +40 -0
- package/dist/sdk/app-block.d.ts +29 -0
- package/dist/sdk/app-block.js +22 -0
- package/dist/sdk/index.d.ts +26 -0
- package/dist/sdk/index.js +26 -0
- package/dist/sdk/referrals.d.ts +62 -0
- package/dist/sdk/referrals.js +20 -0
- package/dist/sdk/rewards.d.ts +85 -0
- package/dist/sdk/rewards.js +29 -0
- package/dist/sdk/runtime-context.d.ts +202 -0
- package/dist/sdk/runtime-context.js +73 -0
- package/dist/sdk/schema.d.ts +206 -0
- package/dist/sdk/schema.js +121 -0
- package/dist/sdk/server-render.d.ts +8 -0
- package/dist/sdk/server-render.js +12 -0
- package/dist/sdk/store-lookup.d.ts +27 -0
- package/dist/sdk/store-lookup.js +29 -0
- package/dist/sdk/store.d.ts +149 -0
- package/dist/sdk/store.js +5 -0
- package/dist/sdk/sx.d.ts +40 -0
- package/dist/sdk/sx.js +112 -0
- package/dist/sdk/theme.d.ts +191 -0
- package/dist/sdk/theme.js +10 -0
- package/dist/sdk/types.d.ts +757 -0
- package/dist/sdk/types.js +7 -0
- package/dist/server.d.ts +111 -0
- package/dist/server.js +533 -0
- package/docs/headless-api.md +220 -0
- package/package.json +76 -22
- package/dist/index.js.map +0 -1
- package/dist/ssg-BZ5FYTw7.js +0 -1802
- package/dist/ssg-BZ5FYTw7.js.map +0 -1
- package/dist/ssg.js +0 -8
- package/dist/ssg.js.map +0 -1
- package/dist/types/cart.d.ts +0 -86
- package/dist/types/data.d.ts +0 -357
- package/dist/types/editor.d.ts +0 -5
- package/dist/types/index.d.ts +0 -20
- package/dist/types/preview-bridge.d.ts +0 -9
- package/dist/types/storefront.d.ts +0 -333
- package/dist/types/types.d.ts +0 -44
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme ABI v2 domain records → the shapes Nova's sections already read (`lib/tanqory/data.tsx`,
|
|
3
|
+
* `lib/tanqory/storefront.ts`). Pure functions, no I/O, no module state: the same code maps a
|
|
4
|
+
* server `ctx.data` result and a browser `/_tq/data/*` answer, so SSR and hydration agree.
|
|
5
|
+
*
|
|
6
|
+
* Where the ABI carries less than Nova's v1 data layer did (no cookie-banner config, no digital
|
|
7
|
+
* wallets), the Nova field is left absent and the section's own "not
|
|
8
|
+
* available" branch renders — never a fixture, never a guess. `Shop.socialLinks` and
|
|
9
|
+
* `paymentSettings.acceptedCardBrands` (storefront-query rev 2.20) map when the store has them.
|
|
10
|
+
*
|
|
11
|
+
* Opt-in ABI members (storefront-query rev 2.19): `Collection.filters` (facets) and
|
|
12
|
+
* `Product.collections` (the breadcrumb's collection) map when the platform sent them.
|
|
13
|
+
* Stock levels (storefront-query rev 2.21, capability `data:inventory`): `ProductVariant.quantityAvailable`
|
|
14
|
+
* (0–999, 999 = "999 or more") is present only when the merchant shows stock levels and the variant is
|
|
15
|
+
* tracked and stops selling at zero. It maps to `inventoryQuantity` under `DENY`; absent stays absent.
|
|
16
|
+
* See MISMATCHES.md for each field that has no ABI source.
|
|
17
|
+
*/
|
|
18
|
+
import type { Filter as AbiFilter, Article as AbiArticle, Blog as AbiBlog, Cart as AbiCart, Collection as AbiCollection, Image as AbiImage, Menu as AbiMenu, Page as AbiPage, Policy as AbiPolicy, Product as AbiProduct, Shop as AbiShop, SearchResult as AbiSearchResult } from '@tanqory/theme-abi';
|
|
19
|
+
import type { Collection, ImageRef, Page, Product, ProductMedia, ProductRating, ProductReview, SellingPlanGroup } from '../runtime/kit/data.js';
|
|
20
|
+
import type { ShopLoyalty, ShopReferrals } from '../sdk/types.js';
|
|
21
|
+
import type { Article, ArticleComments, Blog, Filter, Menu, SearchResults, Shop, ShopAddress, ShopLocation, ShopPolicy, ShopPopup } from '../runtime/kit/storefront.js';
|
|
22
|
+
export declare function image(i: AbiImage | null | undefined): ImageRef | null;
|
|
23
|
+
/** Plain text of an HTML body, for the surfaces that show text only (cards, meta description). */
|
|
24
|
+
export declare function plainText(html: string | null | undefined): string;
|
|
25
|
+
export declare function product(p: AbiProduct): Product;
|
|
26
|
+
/**
|
|
27
|
+
* Published reviews asked for on the product route and by `fetchProduct` (`reviewsFirst`, storefront-query rev 2.38 /
|
|
28
|
+
* theme-abi alpha.19): the most a product document carries, so the section pages them without another call.
|
|
29
|
+
*/
|
|
30
|
+
export declare const REVIEWS_FIRST = 50;
|
|
31
|
+
/**
|
|
32
|
+
* storefront-query rev 2.45 (O4): the storefront-readable metafields of a product, collection, page, article or the
|
|
33
|
+
* shop — `"namespace.key" → {type, value}` as the platform stores it — as the display strings a section setting
|
|
34
|
+
* bound to a dynamic source shows. Read as unknown: the ABI types older than rev 2.45 carry `metafields` on Product
|
|
35
|
+
* only, and a malformed entry must not break a page. Absent ⇒ no member, so a resource without metafields converts
|
|
36
|
+
* exactly as before.
|
|
37
|
+
*/
|
|
38
|
+
export declare function metafieldsOf(raw: unknown): {
|
|
39
|
+
metafields?: Record<string, string | null>;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* One metafield → the text a theme shows. The platform sends `{type, value}`; an older answer may send the bare
|
|
43
|
+
* value. Text, number, boolean, url, date and color values are their own string; `rich_text` is the HTML or the
|
|
44
|
+
* rich-text JSON tree's text; a file / image reference is its URL (a string, or an object's `url`); a measurement
|
|
45
|
+
* (`dimension`, `weight`, `volume`) is "value unit"; money is "amount currency"; `rating` its value; a `list.*` value
|
|
46
|
+
* joins its items with ", "; a product / collection / page / article / metaobject reference (`{id, handle}`) is its
|
|
47
|
+
* handle, a list of them the handles joined with ",". Anything else (an object with none of these) is null — never
|
|
48
|
+
* "[object Object]".
|
|
49
|
+
*/
|
|
50
|
+
export declare function metafieldText(entry: unknown): string | null;
|
|
51
|
+
/**
|
|
52
|
+
* `Product.rating` (storefront-query rev 2.38, theme-abi alpha.19, NEW-PROD-10): the aggregate over the product's
|
|
53
|
+
* PUBLISHED reviews — the mean (1–5), how many, and counts of 5, 4, 3, 2, 1 stars. The platform sends it only for a
|
|
54
|
+
* product with at least one published review; absent or not whole ⇒ absent, never an invented 0. Read as unknown:
|
|
55
|
+
* the kit builds against older ABI types.
|
|
56
|
+
*/
|
|
57
|
+
export declare function productRating(raw: unknown): {
|
|
58
|
+
rating?: ProductRating;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* `Product.reviews` (storefront-query rev 2.38): the connection of published reviews the product route asked for with
|
|
62
|
+
* `reviewsFirst`. Whole entries only (a display name, a body, a 1–5 rating, a second-precision date); an entry that
|
|
63
|
+
* is not whole is left out, and `totalCount` says how many the platform holds. Absent ⇒ absent (not asked for, or
|
|
64
|
+
* an older region).
|
|
65
|
+
*/
|
|
66
|
+
export declare function productReviews(raw: unknown): {
|
|
67
|
+
reviews?: {
|
|
68
|
+
nodes: ProductReview[];
|
|
69
|
+
totalCount: number;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* `Product.sellingPlanGroups` (storefront-query rev 2.39, theme-abi alpha.20, NEW-SUB-1): the product's selling plan
|
|
74
|
+
* groups with their SUBSCRIPTION plans. A plan must be whole (an id, a name, a known interval, a whole interval count;
|
|
75
|
+
* a discount with a known type and a positive decimal value, a percentage at most 100) or it is left out; a group
|
|
76
|
+
* left with no plan is left out; none left ⇒ no member. Read as unknown: the kit builds against older ABI types.
|
|
77
|
+
*/
|
|
78
|
+
export declare function productSellingPlanGroups(raw: unknown): {
|
|
79
|
+
sellingPlanGroups?: SellingPlanGroup[];
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* `Product.media` (storefront-query rev 2.34, theme-abi alpha.17, QA NEW-PROD-2): the gallery in the merchant's order
|
|
83
|
+
* with each HOSTED video. The platform sends it only when the product has a video; images-only products have none and
|
|
84
|
+
* the gallery stays `images`. An item that is not whole (an image without a URL, a video without an https mp4 / webm /
|
|
85
|
+
* quicktime source) is left out; no video left ⇒ no `media`. Read as unknown: the kit builds against older ABI types.
|
|
86
|
+
*/
|
|
87
|
+
export declare function productMedia(raw: unknown): {
|
|
88
|
+
media?: ProductMedia[];
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* `Product.automaticDiscounts` (storefront-query rev 2.31, QA D8): the store's unconditional automatic discounts on
|
|
92
|
+
* this product. Each entry must be whole (a title, a known type, a positive value — a percentage at most 100 — and
|
|
93
|
+
* ISO dates with the end after the start) or it is left out: a guessed discount is worse than none.
|
|
94
|
+
*/
|
|
95
|
+
export declare function productAutomaticDiscounts(raw: unknown): {
|
|
96
|
+
automaticDiscounts?: Array<{
|
|
97
|
+
id: string;
|
|
98
|
+
title: string;
|
|
99
|
+
valueType: 'percentage' | 'fixed';
|
|
100
|
+
value: number;
|
|
101
|
+
startsAt: string;
|
|
102
|
+
endsAt?: string;
|
|
103
|
+
}>;
|
|
104
|
+
};
|
|
105
|
+
export declare function filters(list: readonly AbiFilter[] | undefined): Filter[];
|
|
106
|
+
/** The listing's filter objects (`{productVendor}`, `{available}`, `{price: {min, max}}`, `{variantOption: {name, value}}`, `{productMetafield | variantMetafield: {namespace, key, value}}`, …) → ABI `filters`. Unknown shapes are dropped. */
|
|
107
|
+
export declare function abiFilters(list: readonly Record<string, unknown>[] | undefined): {
|
|
108
|
+
key: string;
|
|
109
|
+
value: string;
|
|
110
|
+
}[];
|
|
111
|
+
export declare function collection(c: AbiCollection): Collection;
|
|
112
|
+
export declare function page(p: AbiPage): Page;
|
|
113
|
+
export declare function article(a: AbiArticle): Article;
|
|
114
|
+
/**
|
|
115
|
+
* `Article.comments` (storefront-query rev 2.44, NEW-OS-26): the article's comments when its blog accepts them —
|
|
116
|
+
* `moderated` (a new comment waits for the merchant), `count` (published comments) and, on the article route and
|
|
117
|
+
* `content.article` only, `nodes` (the newest published, at most 50). Whole entries only (an id, a display name, a body,
|
|
118
|
+
* a second-precision date); an entry that is not whole is left out. Absent or not whole ⇒ absent: the blog takes no
|
|
119
|
+
* comments (or the region is older), so the theme shows neither a list nor a form. Read as unknown: the kit builds
|
|
120
|
+
* against older ABI types.
|
|
121
|
+
*/
|
|
122
|
+
export declare function articleComments(raw: unknown): {
|
|
123
|
+
comments?: ArticleComments;
|
|
124
|
+
};
|
|
125
|
+
export declare function blog(b: AbiBlog): Blog;
|
|
126
|
+
export declare function menu(m: AbiMenu): Menu;
|
|
127
|
+
export declare function policy(p: AbiPolicy): ShopPolicy;
|
|
128
|
+
export declare function shop(s: AbiShop, policies?: readonly AbiPolicy[], country?: string): Shop;
|
|
129
|
+
/**
|
|
130
|
+
* Settings › Preferences › Spam protection (A4, storefront-query rev 2.44 `shop.spamProtection`): the store's two
|
|
131
|
+
* Cloudflare Turnstile switches and the platform's public widget site key. Read as unknown so the kit builds against an
|
|
132
|
+
* ABI without the member. Kept only whole: two booleans and a site key of 1–128 `[A-Za-z0-9_-]`; anything else is
|
|
133
|
+
* no member, so the theme renders no widget (today's behaviour).
|
|
134
|
+
*/
|
|
135
|
+
export declare function spamProtection(raw: unknown): NonNullable<Shop['spamProtection']> | null;
|
|
136
|
+
/**
|
|
137
|
+
* Settings › Brand fonts (`Shop.brand.fonts`, NEW-OS-12): the merchant's family names in priority order —
|
|
138
|
+
* a theme maps `[0]` → headings, `[1]` → body (`Shop.brand.fonts` in runtime/kit/storefront.ts). Carried by
|
|
139
|
+
* storefront-query rev 2.42 (`shop.brand.fonts`, at most 6) and theme-abi `Shop.brand.fonts`; read as unknown so the
|
|
140
|
+
* kit still builds against an ABI without the member: trimmed, non-empty, at most 100 characters, no control
|
|
141
|
+
* character, first occurrence only, at most 10. [] when none, so a store without brand fonts keeps the shop it had.
|
|
142
|
+
*/
|
|
143
|
+
export declare function brandFonts(raw: unknown): string[];
|
|
144
|
+
/**
|
|
145
|
+
* rev 2.48 `Shop.loyalty` → the program as any shopper may read it: a name, the earn rates (positive, one per
|
|
146
|
+
* currency), the pending days, the tier basis; each tier, way to earn and reward only when whole (a known kind, a name,
|
|
147
|
+
* counts in range), in the platform's order. Null when absent or unusable — never a guessed rate.
|
|
148
|
+
*/
|
|
149
|
+
export declare function shopLoyalty(raw: unknown): ShopLoyalty | null;
|
|
150
|
+
/** rev 2.48 `Shop.referrals` → the friend offer and the advocate reward, both whole; null otherwise. */
|
|
151
|
+
export declare function shopReferrals(raw: unknown): ShopReferrals | null;
|
|
152
|
+
/**
|
|
153
|
+
* rev 2.34 `PostalAddress` (`Shop.contact.address`, `ShopLocation.address`) → each member that is a non-empty string
|
|
154
|
+
* of at most 255 characters with no control character; `countryCode` only when two upper-case letters. Null when none.
|
|
155
|
+
*/
|
|
156
|
+
export declare function shopAddress(raw: unknown): ShopAddress | null;
|
|
157
|
+
/** rev 2.34 `Shop.locations` → whole entries only (an id, a name, an address), in the platform's order, at most 50. */
|
|
158
|
+
export declare function shopLocations(raw: unknown): ShopLocation[];
|
|
159
|
+
/**
|
|
160
|
+
* rev 2.37 `Shop.popups` → whole pop-ups only (an id, a known kind and trigger, a trigger value that fits it, a
|
|
161
|
+
* frequency, at least one known page, a language, a heading and a button label), in the platform's order, at most 20.
|
|
162
|
+
* Text is plain and trimmed; a link only on an announcement and only when it is a store path or https; an image only
|
|
163
|
+
* when https. Anything else is dropped, never guessed.
|
|
164
|
+
*/
|
|
165
|
+
export declare function shopPopups(raw: unknown): ShopPopup[];
|
|
166
|
+
/** One `{{amount…}}` token (the merchant's currency-format patterns). */
|
|
167
|
+
export declare const MONEY_FORMAT_TOKEN: RegExp;
|
|
168
|
+
/**
|
|
169
|
+
* rev 2.31 `Shop.moneyFormat` → the patterns a theme may format base-currency amounts with, each only when it is a
|
|
170
|
+
* string of at most 50 characters holding an amount token. Null when neither is usable: a pattern the theme cannot
|
|
171
|
+
* read must never replace the price.
|
|
172
|
+
*/
|
|
173
|
+
export declare function shopMoneyFormat(raw: unknown): {
|
|
174
|
+
withCurrency?: string;
|
|
175
|
+
withoutCurrency?: string;
|
|
176
|
+
} | null;
|
|
177
|
+
/** D-7 `Shop.contact` → the shop's public email / phone, each only when set. */
|
|
178
|
+
export declare function shopContact(raw: unknown): {
|
|
179
|
+
email?: string;
|
|
180
|
+
phone?: string;
|
|
181
|
+
};
|
|
182
|
+
/** D-2 `Shop.cookieBanner` → the banner config Nova renders. Null when absent or not an object (old data = today's banner). */
|
|
183
|
+
export declare function cookieBanner(raw: unknown): NonNullable<Shop['consentBanner']> | null;
|
|
184
|
+
/** D-6 `Shop.policyLinks` → the store's published policies (title + site path). Null when absent. */
|
|
185
|
+
export declare function policyLinks(raw: unknown): ShopPolicy[] | null;
|
|
186
|
+
/**
|
|
187
|
+
* D-5 `Shop.freeShipping` → the lowest "free over" threshold for the shopper's country, or null when the
|
|
188
|
+
* country's zone has none (or the platform sent nothing). The amount is already in the market's currency.
|
|
189
|
+
*/
|
|
190
|
+
export declare function freeShippingFor(raw: unknown, country: string): {
|
|
191
|
+
amount: string;
|
|
192
|
+
currencyCode: string;
|
|
193
|
+
} | null;
|
|
194
|
+
/**
|
|
195
|
+
* `Shop.seo` (the home page's title, meta description and social image — an optional ABI field the
|
|
196
|
+
* platform may not send yet), read defensively: trimmed non-empty text, an absolute `https:` image
|
|
197
|
+
* URL, positive integer sizes. Anything else is "not set". Null when nothing is set.
|
|
198
|
+
*/
|
|
199
|
+
export declare function shopSeo(raw: unknown): NonNullable<Shop['seo']> | null;
|
|
200
|
+
/**
|
|
201
|
+
* `Shop.socialLinks` → Nova's: only absolute `https:` URLs with a network slug, one link per network
|
|
202
|
+
* (the first wins). Anything else is dropped — a footer link must never point somewhere unsafe.
|
|
203
|
+
*/
|
|
204
|
+
export declare function socialLinks(list: AbiShop['socialLinks']): {
|
|
205
|
+
platform: string;
|
|
206
|
+
url: string;
|
|
207
|
+
}[];
|
|
208
|
+
export declare function searchResults(r: AbiSearchResult): SearchResults;
|
|
209
|
+
/**
|
|
210
|
+
* The cart-level amount taken off between the subtotal and the total.
|
|
211
|
+
*
|
|
212
|
+
* The ABI cart has no discount allocations, only `cost.subtotalAmount`, `cost.totalTaxAmount` and
|
|
213
|
+
* `cost.totalAmount`. Before checkout those are related by
|
|
214
|
+
* `total = subtotal − cart discount + tax`, so the discount is what reconciles the three figures
|
|
215
|
+
* the summary prints. Without it the cart showed "Subtotal $64.00 · Tax $0.00 · Estimated total
|
|
216
|
+
* $60.80" with nothing explaining the $3.20.
|
|
217
|
+
*
|
|
218
|
+
* Computed in minor units at the subtotal's own precision (never `toFixed(2)` — JPY has none, KWD
|
|
219
|
+
* three). Null when nothing was taken off, when the figures are not one currency, or when an
|
|
220
|
+
* amount is not a number: a guessed discount is worse than none.
|
|
221
|
+
*/
|
|
222
|
+
export declare function cartDiscount(c: AbiCart): {
|
|
223
|
+
amount: string;
|
|
224
|
+
currencyCode: string;
|
|
225
|
+
} | null;
|
|
226
|
+
/**
|
|
227
|
+
* The ABI line's `sellingPlanAllocation` (theme-abi alpha.20, NEW-SUB-2) → the runtime line's: the plan's id and
|
|
228
|
+
* name, the per-delivery unit price the line is priced at and the one-time unit it was discounted from. Anything not
|
|
229
|
+
* whole maps to nothing: the line then shows as one-time, which is what it was charged as when the host sent no plan.
|
|
230
|
+
*/
|
|
231
|
+
export declare function cartLineSellingPlan(raw: unknown): {
|
|
232
|
+
sellingPlanAllocation?: {
|
|
233
|
+
sellingPlanId: string;
|
|
234
|
+
sellingPlanName: string;
|
|
235
|
+
perDeliveryPrice: {
|
|
236
|
+
amount: string;
|
|
237
|
+
currencyCode: string;
|
|
238
|
+
};
|
|
239
|
+
compareAtPrice: {
|
|
240
|
+
amount: string;
|
|
241
|
+
currencyCode: string;
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
/** The ABI cart → the lines/totals CartProvider renders (lib/tanqory/cart.tsx CartState fields). */
|
|
246
|
+
export declare function cartState(c: AbiCart): {
|
|
247
|
+
discountAllocations?: Array<{
|
|
248
|
+
title: string | null;
|
|
249
|
+
code: string | null;
|
|
250
|
+
amount: {
|
|
251
|
+
amount: string;
|
|
252
|
+
currencyCode: string;
|
|
253
|
+
};
|
|
254
|
+
}>;
|
|
255
|
+
id: string;
|
|
256
|
+
version: number;
|
|
257
|
+
lines: {
|
|
258
|
+
sellingPlanAllocation?: {
|
|
259
|
+
sellingPlanId: string;
|
|
260
|
+
sellingPlanName: string;
|
|
261
|
+
perDeliveryPrice: {
|
|
262
|
+
amount: string;
|
|
263
|
+
currencyCode: string;
|
|
264
|
+
};
|
|
265
|
+
compareAtPrice: {
|
|
266
|
+
amount: string;
|
|
267
|
+
currencyCode: string;
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
productHandle: string;
|
|
271
|
+
attributes: {
|
|
272
|
+
key: string;
|
|
273
|
+
value: string;
|
|
274
|
+
}[];
|
|
275
|
+
discountAllocations?: Array<{
|
|
276
|
+
title: string | null;
|
|
277
|
+
code: string | null;
|
|
278
|
+
amount: {
|
|
279
|
+
amount: string;
|
|
280
|
+
currencyCode: string;
|
|
281
|
+
};
|
|
282
|
+
}>;
|
|
283
|
+
lineTotal?: import("@tanqory/theme-abi").Money | undefined;
|
|
284
|
+
lineSubtotal: import("@tanqory/theme-abi").Money;
|
|
285
|
+
availableForSale?: boolean | undefined;
|
|
286
|
+
compareAtPrice?: import("@tanqory/theme-abi").Money | undefined;
|
|
287
|
+
image: ImageRef | null;
|
|
288
|
+
price: import("@tanqory/theme-abi").Money;
|
|
289
|
+
selectedOptions: {
|
|
290
|
+
name: string;
|
|
291
|
+
value: string;
|
|
292
|
+
}[];
|
|
293
|
+
variantTitle?: string | undefined;
|
|
294
|
+
id: string;
|
|
295
|
+
variantId: string;
|
|
296
|
+
quantity: number;
|
|
297
|
+
title: string;
|
|
298
|
+
}[];
|
|
299
|
+
subtotal: import("@tanqory/theme-abi").Money;
|
|
300
|
+
total: import("@tanqory/theme-abi").Money;
|
|
301
|
+
tax: import("@tanqory/theme-abi").Money | null;
|
|
302
|
+
note: string | null;
|
|
303
|
+
totalQuantity: number;
|
|
304
|
+
checkoutUrl: string;
|
|
305
|
+
discountCodes: {
|
|
306
|
+
code: string;
|
|
307
|
+
applicable: boolean;
|
|
308
|
+
}[];
|
|
309
|
+
discountAmount: {
|
|
310
|
+
amount: string;
|
|
311
|
+
currencyCode: string;
|
|
312
|
+
} | null;
|
|
313
|
+
};
|
|
314
|
+
/**
|
|
315
|
+
* A line's own discounts by name, when the host sends them beside the ABI line (storefront-edge reads store-api's
|
|
316
|
+
* `CartLine.discountAllocations`, line-level only; not yet in the Theme ABI `CartLine`, so read as unknown). Same rules
|
|
317
|
+
* as the cart's: a name (title or code) and an amount in the cart's currency, else the whole list is dropped.
|
|
318
|
+
*/
|
|
319
|
+
export declare function cartLineDiscountAllocations(l: unknown, currency: string | undefined): {
|
|
320
|
+
discountAllocations?: Array<{
|
|
321
|
+
title: string | null;
|
|
322
|
+
code: string | null;
|
|
323
|
+
amount: {
|
|
324
|
+
amount: string;
|
|
325
|
+
currencyCode: string;
|
|
326
|
+
};
|
|
327
|
+
}>;
|
|
328
|
+
};
|
|
329
|
+
/**
|
|
330
|
+
* The cart's order-level discounts by name, when the host sends them beside the ABI cart (storefront-edge reads
|
|
331
|
+
* store-api's `Cart.discountAllocations`; not yet in the Theme ABI `Cart`, so read as unknown). Each entry needs a
|
|
332
|
+
* name (a title or a code) and an amount in the cart's currency; anything else drops the whole list rather than
|
|
333
|
+
* show a partial one.
|
|
334
|
+
*/
|
|
335
|
+
export declare function cartDiscountAllocations(c: AbiCart): {
|
|
336
|
+
discountAllocations?: Array<{
|
|
337
|
+
title: string | null;
|
|
338
|
+
code: string | null;
|
|
339
|
+
amount: {
|
|
340
|
+
amount: string;
|
|
341
|
+
currencyCode: string;
|
|
342
|
+
};
|
|
343
|
+
}>;
|
|
344
|
+
};
|