@occluze/tether 0.6.8 → 0.7.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 +28 -28
- package/dist/esm/astro.js +2 -2
- package/dist/esm/chunks/account-CXMA5RPZ.js +1 -0
- package/dist/esm/chunks/account-pages-IZO7FEOZ.js +1 -0
- package/dist/esm/chunks/analytics-PG5FPRDN.js +1 -0
- package/dist/esm/chunks/chunk-4HD4J5JC.js +1 -0
- package/dist/esm/chunks/chunk-6TFMLT4A.js +4 -0
- package/dist/esm/chunks/chunk-BBVUVPMO.js +1 -0
- package/dist/esm/chunks/chunk-E5YO6274.js +1 -0
- package/dist/esm/chunks/chunk-EW5SYO6L.js +1 -0
- package/dist/esm/chunks/chunk-HJY2JSNB.js +1 -0
- package/dist/esm/chunks/chunk-MQYB6BH4.js +1 -0
- package/dist/esm/chunks/chunk-N3V45JPS.js +1 -0
- package/dist/esm/chunks/chunk-RPMBCAGS.js +1 -0
- package/dist/esm/chunks/chunk-VFNHIGCS.js +1 -0
- package/dist/esm/chunks/chunk-WT7RGGJU.js +1 -0
- package/dist/esm/chunks/chunk-YN6LEBEN.js +1 -0
- package/dist/esm/chunks/chunk-Z6HS3H7K.js +1 -0
- package/dist/esm/chunks/diagnose-XCEBQKBO.js +14 -0
- package/dist/esm/chunks/extras-4HU3VSBQ.js +1 -0
- package/dist/esm/chunks/markets-ui-M4IQ62CT.js +1 -0
- package/dist/esm/chunks/search-A5DS2IOS.js +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/server.js +2 -2
- package/dist/presets/barba.esm.js +19 -23
- package/dist/tether.account-pages.js +332 -367
- package/dist/tether.account-pages.min.js +1 -1
- package/dist/tether.account.js +253 -492
- package/dist/tether.account.min.js +1 -1
- package/dist/tether.analytics.js +82 -89
- package/dist/tether.analytics.min.js +1 -1
- package/dist/tether.diagnose.js +52 -34
- package/dist/tether.diagnose.min.js +2 -2
- package/dist/tether.extras.js +42 -37
- package/dist/tether.extras.min.js +1 -1
- package/dist/tether.js +1361 -935
- package/dist/tether.markets.js +89 -91
- package/dist/tether.markets.min.js +1 -1
- package/dist/tether.min.js +0 -0
- package/dist/tether.min.js.map +4 -4
- package/dist/tether.search.js +60 -69
- package/dist/tether.search.min.js +1 -1
- package/dist/types/server/src/shared/account-orders.d.ts +44 -0
- package/dist/types/server/src/shared/account-routes.d.ts +153 -0
- package/dist/types/server/src/shared/api-versions.d.ts +13 -0
- package/dist/types/server/src/shared/cart-id.d.ts +2 -0
- package/dist/types/server/src/shared/error-message.d.ts +2 -0
- package/dist/types/server/src/shared/json.d.ts +25 -0
- package/dist/types/server/src/shared/market-codes.d.ts +16 -0
- package/dist/types/src/account/addresses-view.d.ts +5 -0
- package/dist/types/src/account/answers.d.ts +40 -0
- package/dist/types/src/account/markup.d.ts +19 -0
- package/dist/types/src/account/operations.d.ts +41 -0
- package/dist/types/src/account/order-lines.d.ts +13 -0
- package/dist/types/src/account/order-list.d.ts +12 -0
- package/dist/types/src/account/order-page.d.ts +6 -0
- package/dist/types/src/account/page-answers.d.ts +182 -0
- package/dist/types/src/account/page-events.d.ts +2 -0
- package/dist/types/src/account/server-client.d.ts +60 -0
- package/dist/types/src/account/subscriptions-view.d.ts +2 -0
- package/dist/types/src/account-api.d.ts +18 -0
- package/dist/types/src/account-marks.d.ts +15 -0
- package/dist/types/src/account-pages.d.ts +8 -0
- package/dist/types/src/account.d.ts +64 -0
- package/dist/types/src/amounts.d.ts +12 -0
- package/dist/types/src/analytics-shopify.d.ts +41 -0
- package/dist/types/src/analytics.d.ts +2 -0
- package/dist/types/src/api-version.d.ts +28 -0
- package/dist/types/src/astro.d.ts +42 -0
- package/dist/types/src/cart/cart-shape.d.ts +43 -0
- package/dist/types/src/cart/checkout.d.ts +16 -0
- package/dist/types/src/cart/drawer.d.ts +18 -0
- package/dist/types/src/cart/mutations.d.ts +85 -0
- package/dist/types/src/cart/render.d.ts +17 -0
- package/dist/types/src/cart/store.d.ts +185 -0
- package/dist/types/src/cart.d.ts +106 -0
- package/dist/types/src/client.d.ts +134 -0
- package/dist/types/src/collection.d.ts +25 -0
- package/dist/types/src/config-sections.d.ts +40 -0
- package/dist/types/src/config.d.ts +190 -0
- package/dist/types/src/controls/cart-controls.d.ts +2 -0
- package/dist/types/src/controls/discount.d.ts +2 -0
- package/dist/types/src/controls/extras.d.ts +5 -0
- package/dist/types/src/controls/navigation.d.ts +12 -0
- package/dist/types/src/diagnose-markup.d.ts +19 -0
- package/dist/types/src/diagnose.d.ts +60 -0
- package/dist/types/src/dom.d.ts +75 -0
- package/dist/types/src/extras.d.ts +21 -0
- package/dist/types/src/fragments.d.ts +158 -0
- package/dist/types/src/globals.d.ts +15 -0
- package/dist/types/src/images.d.ts +20 -0
- package/dist/types/src/index.d.ts +167 -0
- package/dist/types/src/initial.d.ts +56 -0
- package/dist/types/src/lazy.d.ts +28 -0
- package/dist/types/src/loader.d.ts +84 -0
- package/dist/types/src/market-codes.d.ts +6 -0
- package/dist/types/src/markets-ui.d.ts +32 -0
- package/dist/types/src/markets.d.ts +72 -0
- package/dist/types/src/markup.d.ts +131 -0
- package/dist/types/src/mounting.d.ts +46 -0
- package/dist/types/src/page-market.d.ts +27 -0
- package/dist/types/src/presets/barba.d.ts +56 -0
- package/dist/types/src/product-events.d.ts +2 -0
- package/dist/types/src/product-render.d.ts +17 -0
- package/dist/types/src/product-shape.d.ts +90 -0
- package/dist/types/src/product-state.d.ts +110 -0
- package/dist/types/src/product.d.ts +66 -0
- package/dist/types/src/repeaters.d.ts +16 -0
- package/dist/types/src/search.d.ts +33 -0
- package/dist/types/src/selling-plans.d.ts +64 -0
- package/dist/types/src/server.d.ts +88 -0
- package/dist/types/src/shopify-values.d.ts +46 -0
- package/dist/types/src/status.d.ts +33 -0
- package/dist/types/src/storage.d.ts +12 -0
- package/dist/types/src/store-html.d.ts +39 -0
- package/dist/types/src/storefront/catalog.d.ts +38 -0
- package/dist/types/src/storefront/json-ld.d.ts +20 -0
- package/dist/types/src/variant-render.d.ts +14 -0
- package/package.json +24 -24
- package/dist/esm/chunks/account-C3NP6HFB.js +0 -1
- package/dist/esm/chunks/account-pages-WLK374FO.js +0 -1
- package/dist/esm/chunks/analytics-G3SAWMNL.js +0 -1
- package/dist/esm/chunks/chunk-27PJJZGC.js +0 -1
- package/dist/esm/chunks/chunk-2FSXS55U.js +0 -1
- package/dist/esm/chunks/chunk-FCSWQDVV.js +0 -1
- package/dist/esm/chunks/chunk-FOMSMIAM.js +0 -1
- package/dist/esm/chunks/chunk-GZJTCLLW.js +0 -1
- package/dist/esm/chunks/chunk-HEQILZVR.js +0 -1
- package/dist/esm/chunks/chunk-JOOEXYF3.js +0 -4
- package/dist/esm/chunks/chunk-MPTQYLSM.js +0 -1
- package/dist/esm/chunks/chunk-NEHZ37TU.js +0 -3
- package/dist/esm/chunks/chunk-V74KGEJF.js +0 -1
- package/dist/esm/chunks/chunk-VT4CDUJJ.js +0 -1
- package/dist/esm/chunks/chunk-YJLWX2HK.js +0 -1
- package/dist/esm/chunks/diagnose-6VVGZNTY.js +0 -14
- package/dist/esm/chunks/extras-GJVRDFM3.js +0 -1
- package/dist/esm/chunks/markets-ui-UNB4PTA7.js +0 -1
- package/dist/esm/chunks/search-OU75RNQL.js +0 -1
- package/src/account/addresses-view.js +0 -92
- package/src/account/browser-session.js +0 -359
- package/src/account/markup.js +0 -48
- package/src/account/operations.js +0 -180
- package/src/account/order-lines.js +0 -96
- package/src/account/order-list.js +0 -91
- package/src/account/order-page.js +0 -192
- package/src/account/page-events.js +0 -288
- package/src/account/server-client.js +0 -172
- package/src/account/shared.js +0 -111
- package/src/account/shopify-auth.js +0 -150
- package/src/account/subscriptions-view.js +0 -158
- package/src/account-api.js +0 -118
- package/src/account-links.js +0 -35
- package/src/account-pages.js +0 -89
- package/src/account.js +0 -342
- package/src/amounts.js +0 -36
- package/src/analytics-shopify.js +0 -241
- package/src/analytics.js +0 -352
- package/src/api-version.js +0 -85
- package/src/astro.js +0 -266
- package/src/cart/checkout.js +0 -97
- package/src/cart/drawer.js +0 -138
- package/src/cart/mutations.js +0 -234
- package/src/cart/render.js +0 -294
- package/src/cart/store.js +0 -326
- package/src/cart.js +0 -391
- package/src/client.js +0 -267
- package/src/collection.js +0 -183
- package/src/config.js +0 -349
- package/src/controls/cart-controls.js +0 -155
- package/src/controls/discount.js +0 -96
- package/src/controls/extras.js +0 -63
- package/src/controls/navigation.js +0 -83
- package/src/diagnose-markup.js +0 -333
- package/src/diagnose.js +0 -295
- package/src/dom.js +0 -287
- package/src/extras.js +0 -145
- package/src/fragments.js +0 -237
- package/src/images.js +0 -104
- package/src/index.js +0 -353
- package/src/initial.js +0 -87
- package/src/lazy-iife.js +0 -116
- package/src/lazy.js +0 -39
- package/src/loader.js +0 -337
- package/src/market-codes.js +0 -35
- package/src/markets-ui.js +0 -204
- package/src/markets.js +0 -334
- package/src/markup.js +0 -64
- package/src/mounting.js +0 -277
- package/src/page-market.js +0 -116
- package/src/parts/account-pages.js +0 -6
- package/src/parts/account.js +0 -6
- package/src/parts/analytics.js +0 -6
- package/src/parts/diagnose.js +0 -6
- package/src/parts/extras.js +0 -6
- package/src/parts/markets.js +0 -6
- package/src/parts/search.js +0 -6
- package/src/presets/barba.js +0 -190
- package/src/product-events.js +0 -130
- package/src/product-render.js +0 -257
- package/src/product-state.js +0 -318
- package/src/product.js +0 -344
- package/src/repeaters.js +0 -173
- package/src/search.js +0 -323
- package/src/selling-plans.js +0 -154
- package/src/server.js +0 -215
- package/src/shopify-values.js +0 -89
- package/src/status.js +0 -126
- package/src/store-html.js +0 -0
- package/src/storefront/catalog.js +0 -199
- package/src/storefront/json-ld.js +0 -167
- package/src/variant-render.js +0 -165
- package/types/astro.d.ts +0 -28
- package/types/barba.d.ts +0 -16
- package/types/index.d.ts +0 -577
- package/types/server.d.ts +0 -182
package/types/server.d.ts
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import type { ShopifyProduct, ShopifyVariant, Money, TetherError, SellingPlanHelpers, TetherConfig } from './index.js';
|
|
2
|
-
export type { ShopifyProduct, ShopifyVariant, ShopifyCart, ShopifyCartLine, Money } from './index.js';
|
|
3
|
-
|
|
4
|
-
export interface StorefrontOptions extends Partial<
|
|
5
|
-
Pick<
|
|
6
|
-
TetherConfig,
|
|
7
|
-
| 'apiVersion'
|
|
8
|
-
| 'country'
|
|
9
|
-
| 'language'
|
|
10
|
-
| 'locale'
|
|
11
|
-
| 'productPath'
|
|
12
|
-
| 'maxAge'
|
|
13
|
-
| 'lowStock'
|
|
14
|
-
| 'defaultPurchase'
|
|
15
|
-
| 'metafields'
|
|
16
|
-
| 'imagesFirst'
|
|
17
|
-
| 'variantsFirst'
|
|
18
|
-
| 'sellingPlanGroupsFirst'
|
|
19
|
-
| 'sellingPlansFirst'
|
|
20
|
-
| 'retries'
|
|
21
|
-
>
|
|
22
|
-
> {
|
|
23
|
-
/** your-store.myshopify.com (or pass import.meta.env with PUBLIC_SHOPIFY_DOMAIN). */
|
|
24
|
-
domain?: string;
|
|
25
|
-
/** Public Storefront API token (or PUBLIC_SHOPIFY_STOREFRONT_TOKEN in import.meta.env). */
|
|
26
|
-
token?: string;
|
|
27
|
-
/** Your site's address, e.g. https://shop.example: product URLs in jsonLd() without passing url. */
|
|
28
|
-
siteUrl?: string;
|
|
29
|
-
/** Products per request for allProducts() (default 25). */
|
|
30
|
-
pageSize?: number;
|
|
31
|
-
/** Custom fetch (tests, caching). */
|
|
32
|
-
fetch?: typeof fetch;
|
|
33
|
-
PUBLIC_SHOPIFY_DOMAIN?: string;
|
|
34
|
-
PUBLIC_SHOPIFY_STOREFRONT_TOKEN?: string;
|
|
35
|
-
/** Astro's import.meta.env carries these too; ignored. */
|
|
36
|
-
MODE?: string;
|
|
37
|
-
BASE_URL?: string;
|
|
38
|
-
PROD?: boolean;
|
|
39
|
-
DEV?: boolean;
|
|
40
|
-
SSR?: boolean;
|
|
41
|
-
SITE?: string;
|
|
42
|
-
ASSETS_PREFIX?: string;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface ShopifyCollection {
|
|
46
|
-
id: string;
|
|
47
|
-
handle: string;
|
|
48
|
-
title: string;
|
|
49
|
-
description: string;
|
|
50
|
-
descriptionHtml: string;
|
|
51
|
-
image?: { url: string; altText?: string | null } | null;
|
|
52
|
-
seo?: { title?: string | null; description?: string | null };
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface ProductQuery {
|
|
56
|
-
collection?: string;
|
|
57
|
-
/** A Shopify search query; null or '' = every product (e.g. searchParams.get('q')). */
|
|
58
|
-
query?: string | null;
|
|
59
|
-
first?: number;
|
|
60
|
-
after?: string | null;
|
|
61
|
-
sortKey?: string;
|
|
62
|
-
reverse?: boolean;
|
|
63
|
-
filters?: unknown[];
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export interface Storefront {
|
|
67
|
-
readonly config: Required<Pick<StorefrontOptions, 'domain' | 'token'>> & StorefrontOptions;
|
|
68
|
-
query<T = any>(query: string, variables?: Record<string, unknown>, opts?: { context?: boolean }): Promise<T>;
|
|
69
|
-
/** By handle, numeric id, gid or product URL. null when it doesn't exist. */
|
|
70
|
-
getProduct(handleOrId: string | number | null | undefined): Promise<ShopifyProduct | null>;
|
|
71
|
-
getProducts(opts?: ProductQuery): Promise<{
|
|
72
|
-
collection: ShopifyCollection | null;
|
|
73
|
-
products: ShopifyProduct[];
|
|
74
|
-
pageInfo: { hasNextPage: boolean; endCursor: string | null };
|
|
75
|
-
}>;
|
|
76
|
-
/** Every product (of a collection or a search query), page by page. For getStaticPaths(). */
|
|
77
|
-
allProducts(opts?: Omit<ProductQuery, 'first' | 'after'>): Promise<ShopifyProduct[]>;
|
|
78
|
-
getCollection(
|
|
79
|
-
handle: string,
|
|
80
|
-
opts?: Omit<ProductQuery, 'collection'>,
|
|
81
|
-
): Promise<
|
|
82
|
-
| (ShopifyCollection & { products: ShopifyProduct[]; pageInfo: { hasNextPage: boolean; endCursor: string | null } })
|
|
83
|
-
| null
|
|
84
|
-
>;
|
|
85
|
-
allCollections(): Promise<ShopifyCollection[]>;
|
|
86
|
-
/** By handle, id or product (runs in parallel with getProduct when you pass the handle). */
|
|
87
|
-
getRecommendations(
|
|
88
|
-
product: string | number | Pick<ShopifyProduct, 'id'>,
|
|
89
|
-
intent?: 'RELATED' | 'COMPLEMENTARY',
|
|
90
|
-
): Promise<ShopifyProduct[]>;
|
|
91
|
-
/**
|
|
92
|
-
* A <script type="application/json" data-tether-hydrate> tag: the browser script renders these
|
|
93
|
-
* products without its own request, then refreshes prices and stock once in the background.
|
|
94
|
-
* Astro: <Fragment set:html={shop.hydrate(product)} />
|
|
95
|
-
*/
|
|
96
|
-
hydrate(
|
|
97
|
-
products: ShopifyProduct | ShopifyProduct[],
|
|
98
|
-
opts?: {
|
|
99
|
-
/** For lists: without descriptions and variant images, about 40% smaller. */
|
|
100
|
-
card?: boolean;
|
|
101
|
-
/** Images a card keeps (default 2: the main one and a hover image). */
|
|
102
|
-
images?: number;
|
|
103
|
-
},
|
|
104
|
-
): string;
|
|
105
|
-
formatMoney(money: Money | null | undefined, locale?: string): string;
|
|
106
|
-
/** 30 -> '30%' (nl, en) / '30 %' (de, fr), the way Tether shows savings. '' for 0. */
|
|
107
|
-
formatPercent(n: number, locale?: string): string;
|
|
108
|
-
productUrl(handle: string, opts?: { productPath?: string; id?: string }): string;
|
|
109
|
-
/** Shopify CDN image at a size. Use the element's max-width value, so the browser keeps the image. */
|
|
110
|
-
imageUrl(url: string | null | undefined, size?: ImageSize): string;
|
|
111
|
-
/**
|
|
112
|
-
* What Tether shows first for this product (variant, price, purchase mode, tether-show conditions),
|
|
113
|
-
* so the server renders the same and nothing flashes. Pass Astro.url.searchParams.get('variant') in SSR.
|
|
114
|
-
*/
|
|
115
|
-
initialState(product: ShopifyProduct, opts?: InitialOptions): InitialState;
|
|
116
|
-
initialState(product: ShopifyProduct | null | undefined, opts?: InitialOptions): InitialState | null;
|
|
117
|
-
/** schema.org Product / ProductGroup data for search engines, as a <script type="application/ld+json"> tag. */
|
|
118
|
-
jsonLd(product: ShopifyProduct | null, opts?: { url?: string; brand?: string }): string;
|
|
119
|
-
jsonLdData(product: ShopifyProduct | null, opts?: { url?: string; brand?: string }): Record<string, unknown> | null;
|
|
120
|
-
plans: SellingPlanHelpers;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export interface InitialState {
|
|
124
|
-
variant: ShopifyVariant;
|
|
125
|
-
/** option name -> value of that variant: is-selected on those buttons. */
|
|
126
|
-
selected: Record<string, string>;
|
|
127
|
-
purchase: 'one-time' | 'subscription';
|
|
128
|
-
plan: { id: string; name: string } | null;
|
|
129
|
-
plans: { id: string; name: string; price: Money; savings: number; selected: boolean; available: boolean }[];
|
|
130
|
-
savings: number;
|
|
131
|
-
/** The price Tether shows first (the plan price for products that require a subscription). */
|
|
132
|
-
price: Money;
|
|
133
|
-
/** Set only when on sale. */
|
|
134
|
-
compareAtPrice: Money | null;
|
|
135
|
-
available: boolean;
|
|
136
|
-
/** tether-show conditions: hidden={!state.show['out-of-stock']}. */
|
|
137
|
-
show: Record<
|
|
138
|
-
| 'in-stock'
|
|
139
|
-
| 'out-of-stock'
|
|
140
|
-
| 'backorder'
|
|
141
|
-
| 'on-sale'
|
|
142
|
-
| 'not-on-sale'
|
|
143
|
-
| 'has-variants'
|
|
144
|
-
| 'single-variant'
|
|
145
|
-
| 'low-stock'
|
|
146
|
-
| 'subscription-available'
|
|
147
|
-
| 'subscription-unavailable'
|
|
148
|
-
| 'subscription-only'
|
|
149
|
-
| 'one-time-available'
|
|
150
|
-
| 'subscription-selected'
|
|
151
|
-
| 'one-time-selected'
|
|
152
|
-
| 'plenty-in-stock'
|
|
153
|
-
| 'has-savings',
|
|
154
|
-
boolean
|
|
155
|
-
>;
|
|
156
|
-
/** true for option values without an available variant: class is-unavailable. */
|
|
157
|
-
isUnavailable(optionName: string, value: string): boolean;
|
|
158
|
-
}
|
|
159
|
-
export interface InitialOptions {
|
|
160
|
-
variant?: string | null;
|
|
161
|
-
sellingPlan?: string | null;
|
|
162
|
-
defaultPurchase?: 'one-time' | 'subscription';
|
|
163
|
-
}
|
|
164
|
-
export declare function initialState(product: ShopifyProduct, opts?: InitialOptions): InitialState;
|
|
165
|
-
export declare function initialState(
|
|
166
|
-
product: ShopifyProduct | null | undefined,
|
|
167
|
-
opts?: InitialOptions,
|
|
168
|
-
): InitialState | null;
|
|
169
|
-
|
|
170
|
-
export interface ImageSize {
|
|
171
|
-
width?: number;
|
|
172
|
-
height?: number;
|
|
173
|
-
crop?: 'center' | 'top' | 'bottom' | 'left' | 'right';
|
|
174
|
-
}
|
|
175
|
-
export declare function imageUrl(url: string | null | undefined, size?: ImageSize): string;
|
|
176
|
-
export declare function createStorefront(options?: StorefrontOptions): Storefront;
|
|
177
|
-
export declare function formatMoney(money: Money | null | undefined, locale?: string): string;
|
|
178
|
-
export declare function productUrl(handle: string, opts?: { productPath?: string; id?: string }): string;
|
|
179
|
-
export declare function productKey(raw: string | number): string | null;
|
|
180
|
-
export declare function withContext(query: string, ctx?: { country?: string; language?: string }): string;
|
|
181
|
-
export declare const plans: SellingPlanHelpers;
|
|
182
|
-
export { TetherError };
|