@joy-loyalty/hydrogen 0.2.1 → 0.4.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.
@@ -0,0 +1,377 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createElement, useEffect, useRef, useState } from 'react';
3
+ import { loadWidgetCore } from '../lib/core-loader.js';
4
+ import { WidgetCorePreloadLinks } from '../lib/core-preload-links.js';
5
+ import { ensureClient, useJoyProviderCart } from '../lib/JoyProvider.js';
6
+ import { normalizePointsCartSnapshot, normalizePointsProductSnapshot } from '../lib/points-calculator-snapshot.js';
7
+ import { safeNavigationUrl } from '../lib/safe-navigation-url.js';
8
+ import { DEFAULT_TOKEN_ROUTE, getJoyToken } from '../lib/token.js';
9
+ import { resolveActiveTranslation, resolveContentLocale } from '../render-adapter.js';
10
+ const PLACEHOLDER_MIN_HEIGHT = 24;
11
+ const UPDATE_DEBOUNCE_MS = 50;
12
+ const PLACEHOLDER_RELEASE_FALLBACK_MS = 1500;
13
+ const WIDGET_TAG = 'joy-loyalty-widget';
14
+ const OPEN_HASH = 'joy-open';
15
+ const isContext = (value) => value === 'product' || value === 'cart';
16
+ class StageError extends Error {
17
+ stage;
18
+ detail;
19
+ constructor(stage, detail) {
20
+ super(stage);
21
+ this.stage = stage;
22
+ this.detail = detail;
23
+ }
24
+ }
25
+ async function guarded(stage, run) {
26
+ try {
27
+ return await run();
28
+ }
29
+ catch (error) {
30
+ throw new StageError(stage, error);
31
+ }
32
+ }
33
+ function resolveCart(cart) {
34
+ try {
35
+ return typeof cart === 'function' ? cart() : cart;
36
+ }
37
+ catch {
38
+ return undefined;
39
+ }
40
+ }
41
+ function resolveCustomerKey(initialData) {
42
+ const shopifyId = initialData?.shopifyCustomer?.id;
43
+ if (shopifyId)
44
+ return `s:${shopifyId}`;
45
+ const joyId = initialData?.customer?.id;
46
+ return joyId ? `j:${joyId}` : null;
47
+ }
48
+ function flattenTranslation(blobTranslation, locale) {
49
+ return { ...resolveActiveTranslation(blobTranslation), ...resolveActiveTranslation(blobTranslation, locale) };
50
+ }
51
+ function createMemberClient(options) {
52
+ const { apiUrl, tokenRoute, locale, shopDomain } = options;
53
+ const client = ensureClient(apiUrl, tokenRoute ?? DEFAULT_TOKEN_ROUTE, locale, shopDomain);
54
+ const withToken = async (run) => {
55
+ const token = await getJoyToken(tokenRoute ? { tokenRoute } : {});
56
+ if (!token)
57
+ throw Object.assign(new Error('Joy token unavailable'), { code: 'TOKEN_UNAVAILABLE' });
58
+ client.setToken(token);
59
+ return run();
60
+ };
61
+ return { joinProgram: (joinFrom) => withToken(() => client.joinProgram(joinFrom)) };
62
+ }
63
+ function cartContentKey(cart) {
64
+ try {
65
+ if (!cart)
66
+ return 'null';
67
+ const c = cart;
68
+ if (c.id == null && c.updatedAt == null && c.totalQuantity == null && c.cost == null)
69
+ return JSON.stringify(cart);
70
+ const lines = (Array.isArray(c.lines?.nodes) ? c.lines.nodes : []).map(line => line ? [line.id, line.merchandise?.id, line.quantity, line.cost?.subtotalAmount?.amount, line.cost?.totalAmount?.amount].join(':') : '');
71
+ const codes = (Array.isArray(c.discountCodes) ? c.discountCodes : []).map(d => `${d?.code}:${d?.applicable}`);
72
+ return [c.id, c.updatedAt, c.totalQuantity, c.cost?.totalAmount?.amount, codes.join(','), lines.join(',')].join('|');
73
+ }
74
+ catch {
75
+ return cart;
76
+ }
77
+ }
78
+ function hasOptimisticLine(cart) {
79
+ const nodes = cart?.lines?.nodes;
80
+ return Array.isArray(nodes) && nodes.some(line => line?.isOptimistic === true);
81
+ }
82
+ function pointCalculatorConfig(blob) {
83
+ const b = blob;
84
+ return b?.pointCalculator || b?.placeOrder?.productPointsCalculator || b?.settings?.pointCalculator || {};
85
+ }
86
+ function resolveIsLoggedIn(data, host) {
87
+ const hostSignal = host.isLoggedIn ?? (host.customerTags !== undefined || host.isB2B !== undefined ? true : undefined);
88
+ return !!(data?.shopifyCustomer?.id || data?.customer) || hostSignal === true;
89
+ }
90
+ export function JoyPointsCalculator({ apiUrl, shopDomain, tokenRoute, assetUrl, initialData, context, product, selectedVariant, quantity, sellingPlanId, cart, customerTags, isB2B, isLoggedIn: isLoggedInProp, align, loginUrl, onNavigate, onJoinClick, className }) {
91
+ const providerCart = useJoyProviderCart();
92
+ const effectiveCart = cart ?? providerCart;
93
+ const productRef = useRef(product);
94
+ productRef.current = product;
95
+ const variantRef = useRef(selectedVariant);
96
+ variantRef.current = selectedVariant;
97
+ const quantityRef = useRef(quantity);
98
+ quantityRef.current = quantity;
99
+ const sellingPlanRef = useRef(sellingPlanId);
100
+ sellingPlanRef.current = sellingPlanId;
101
+ const cartRef = useRef(effectiveCart);
102
+ cartRef.current = effectiveCart;
103
+ const customerTagsRef = useRef(customerTags);
104
+ customerTagsRef.current = customerTags;
105
+ const isB2BRef = useRef(isB2B);
106
+ isB2BRef.current = isB2B;
107
+ const isLoggedInRef = useRef(isLoggedInProp);
108
+ isLoggedInRef.current = isLoggedInProp;
109
+ const onNavigateRef = useRef(onNavigate);
110
+ onNavigateRef.current = onNavigate;
111
+ const onJoinClickRef = useRef(onJoinClick);
112
+ onJoinClickRef.current = onJoinClick;
113
+ const loginUrlRef = useRef(loginUrl);
114
+ loginUrlRef.current = loginUrl;
115
+ const initialDataRef = useRef(initialData);
116
+ initialDataRef.current = initialData;
117
+ const alignRef = useRef(align);
118
+ alignRef.current = align;
119
+ const handleRef = useRef(null);
120
+ const hostRef = useRef(null);
121
+ const updateWarnedRef = useRef(false);
122
+ const [reserved, setReserved] = useState(true);
123
+ const [collapsed, setCollapsed] = useState(false);
124
+ const customerKey = resolveCustomerKey(initialData);
125
+ const hasCustomer = Boolean(initialData?.customer);
126
+ const locale = initialData?.locale;
127
+ const hasInitialData = Boolean(initialData);
128
+ const validContext = isContext(context);
129
+ const isCollapsed = collapsed || !hasInitialData || !validContext;
130
+ useEffect(() => {
131
+ if (!hasInitialData)
132
+ return;
133
+ if (!validContext) {
134
+ console.warn(`[joy] JoyPointsCalculator: context must be "product" or "cart" (got ${JSON.stringify(context)}), rendering nothing`);
135
+ return;
136
+ }
137
+ setCollapsed(false);
138
+ setReserved(true);
139
+ let disposed = false;
140
+ let handle = null;
141
+ let releaseObserver = null;
142
+ let releaseTimer;
143
+ const warned = new Set();
144
+ const warnOnce = (message, detail) => {
145
+ if (warned.has(message))
146
+ return;
147
+ warned.add(message);
148
+ console.warn(`[joy] JoyPointsCalculator: ${message}`, ...(detail === undefined ? [] : [detail]));
149
+ };
150
+ const disposeHandle = () => {
151
+ const current = handle;
152
+ handle = null;
153
+ if (handleRef.current === current)
154
+ handleRef.current = null;
155
+ if (!current)
156
+ return;
157
+ try {
158
+ current.dispose();
159
+ }
160
+ catch (error) {
161
+ warnOnce('dispose failed', error);
162
+ }
163
+ };
164
+ const fail = (message, detail) => {
165
+ if (disposed)
166
+ return;
167
+ disposeHandle();
168
+ warnOnce(message, detail);
169
+ setCollapsed(true);
170
+ };
171
+ const hostHook = (name, run) => {
172
+ try {
173
+ const result = run();
174
+ if (result && typeof result.then === 'function') {
175
+ return result.then(undefined, error => warnOnce(`${name} failed`, error));
176
+ }
177
+ return result;
178
+ }
179
+ catch (error) {
180
+ warnOnce(`${name} failed`, error);
181
+ return undefined;
182
+ }
183
+ };
184
+ const getSnapshot = () => {
185
+ try {
186
+ const blob = initialDataRef.current?.blob;
187
+ const localePrimary = !blob?.collectionDefaultTitles;
188
+ if (context === 'product') {
189
+ const currentProduct = productRef.current;
190
+ const currentVariant = variantRef.current;
191
+ if (!currentProduct || !currentVariant)
192
+ return null;
193
+ const normalized = normalizePointsProductSnapshot({
194
+ product: currentProduct,
195
+ selectedVariant: currentVariant,
196
+ quantity: quantityRef.current,
197
+ sellingPlanId: sellingPlanRef.current,
198
+ localePrimary
199
+ });
200
+ if (!normalized)
201
+ warnOnce('the product or selected variant could not be read (missing or non-numeric id, or no price), hiding');
202
+ return normalized?.snapshot ?? null;
203
+ }
204
+ const currentCart = resolveCart(cartRef.current);
205
+ if (!currentCart)
206
+ return null;
207
+ const normalized = normalizePointsCartSnapshot(currentCart, { localePrimary });
208
+ if (!normalized)
209
+ warnOnce('the cart could not be read (no lines list, or a line without a product / variant id), hiding');
210
+ if (normalized && !normalized.cartStateKnown) {
211
+ warnOnce('the cart money or discounts are unknown (a line without cost.subtotalAmount, or an applicable ' +
212
+ 'discount code but no cart-level allocations: select Cart.discountAllocations, or ' +
213
+ 'CartLine.joyAllDiscounts on 2026-07+), hiding');
214
+ return null;
215
+ }
216
+ return normalized?.snapshot ?? null;
217
+ }
218
+ catch (error) {
219
+ warnOnce('reading the page snapshot failed', error);
220
+ return null;
221
+ }
222
+ };
223
+ const run = async () => {
224
+ const data = initialDataRef.current;
225
+ if (!data)
226
+ return;
227
+ const loadOptions = {
228
+ core: data.core,
229
+ preloadLazy: ['pointsCalculator'],
230
+ ...(assetUrl ? { assetUrl } : {})
231
+ };
232
+ const loaded = await guarded('widget core load failed', () => loadWidgetCore(loadOptions));
233
+ if (disposed)
234
+ return;
235
+ if (!loaded.loaded)
236
+ throw new StageError('widget core load failed', loaded);
237
+ const loadPointsCalculatorCore = loaded.coreExports?.loadPointsCalculatorCore;
238
+ if (typeof loadPointsCalculatorCore !== 'function') {
239
+ throw new StageError('the widget core has no points-calculator surface (older CDN core), rendering nothing', undefined);
240
+ }
241
+ const surface = await guarded('loading the points-calculator core failed', () => loadPointsCalculatorCore());
242
+ if (disposed)
243
+ return;
244
+ const mount = surface?.mountPointsCalculatorCore;
245
+ if (typeof mount !== 'function') {
246
+ throw new StageError('the points-calculator core has no mountPointsCalculatorCore, rendering nothing', undefined);
247
+ }
248
+ const options = await guarded('setting up the mount failed', () => {
249
+ const blob = data.blob;
250
+ const blobTranslation = blob?.translation;
251
+ const loggedIn = () => resolveIsLoggedIn(initialDataRef.current, {
252
+ isLoggedIn: isLoggedInRef.current,
253
+ customerTags: customerTagsRef.current,
254
+ isB2B: isB2BRef.current
255
+ });
256
+ return {
257
+ source: {
258
+ blob,
259
+ customer: data.customer ?? null,
260
+ customerKey: resolveCustomerKey(data),
261
+ translation: flattenTranslation(blobTranslation, data.locale),
262
+ locale: resolveContentLocale(data.locale, blobTranslation),
263
+ loginUrl: pointCalculatorConfig(blob).callActionLink ||
264
+ loginUrlRef.current ||
265
+ data.login_url ||
266
+ '/account/login',
267
+ get isLoggedIn() {
268
+ return loggedIn();
269
+ },
270
+ get customerTags() {
271
+ return loggedIn() ? customerTagsRef.current : undefined;
272
+ },
273
+ get isB2B() {
274
+ return loggedIn() ? isB2BRef.current : undefined;
275
+ }
276
+ },
277
+ context,
278
+ ...(alignRef.current ? { align: alignRef.current } : {}),
279
+ getSnapshot,
280
+ client: data.customer ? createMemberClient({ apiUrl, tokenRoute, locale: data.locale, shopDomain }) : null,
281
+ hooks: {
282
+ navigate: (url) => {
283
+ hostHook('navigate', () => {
284
+ const target = safeNavigationUrl(url);
285
+ if (onNavigateRef.current && target?.origin === window.location.origin) {
286
+ return onNavigateRef.current(`${target.pathname}${target.search}${target.hash}`);
287
+ }
288
+ return window.location.assign(target?.href ?? '/');
289
+ });
290
+ },
291
+ openWidget: () => hostHook('openWidget', () => {
292
+ if (!document.querySelector(WIDGET_TAG))
293
+ return false;
294
+ if (window.location.hash === `#${OPEN_HASH}`) {
295
+ window.dispatchEvent(new HashChangeEvent('hashchange'));
296
+ return true;
297
+ }
298
+ window.location.hash = OPEN_HASH;
299
+ return true;
300
+ }) === true,
301
+ reload: () => {
302
+ hostHook('reload', () => window.location.reload());
303
+ },
304
+ onJoinClick: (action) => hostHook('onJoinClick', () => onJoinClickRef.current?.(action))
305
+ }
306
+ };
307
+ });
308
+ if (disposed)
309
+ return;
310
+ const host = hostRef.current;
311
+ if (!host)
312
+ return;
313
+ const created = await guarded('mount failed', () => mount(host, options));
314
+ handle = created ?? null;
315
+ if (disposed) {
316
+ disposeHandle();
317
+ return;
318
+ }
319
+ handleRef.current = handle;
320
+ if (host.childNodes.length > 0)
321
+ return setReserved(false);
322
+ releaseObserver = new MutationObserver(() => {
323
+ if (host.childNodes.length === 0)
324
+ return;
325
+ releaseObserver?.disconnect();
326
+ setReserved(false);
327
+ });
328
+ releaseObserver.observe(host, { childList: true });
329
+ releaseTimer = setTimeout(() => {
330
+ releaseObserver?.disconnect();
331
+ setReserved(false);
332
+ }, PLACEHOLDER_RELEASE_FALLBACK_MS);
333
+ };
334
+ void run()
335
+ .catch(error => {
336
+ if (error instanceof StageError)
337
+ fail(error.stage, error.detail);
338
+ else
339
+ fail('unexpected failure', error);
340
+ })
341
+ .catch(() => { });
342
+ return () => {
343
+ disposed = true;
344
+ releaseObserver?.disconnect();
345
+ clearTimeout(releaseTimer);
346
+ disposeHandle();
347
+ };
348
+ }, [apiUrl, shopDomain, tokenRoute, assetUrl, customerKey, hasCustomer, locale, hasInitialData, context]);
349
+ const cartKey = context === 'cart' ? cartContentKey(resolveCart(effectiveCart)) : undefined;
350
+ const customerTagsKey = customerTags?.join('\u0000');
351
+ const loggedInNow = resolveIsLoggedIn(initialData, { isLoggedIn: isLoggedInProp, customerTags, isB2B });
352
+ useEffect(() => {
353
+ if (!handleRef.current)
354
+ return;
355
+ const timer = setTimeout(() => {
356
+ const current = handleRef.current;
357
+ if (!current)
358
+ return;
359
+ if (context === 'cart' && hasOptimisticLine(resolveCart(cartRef.current)))
360
+ return;
361
+ Promise.resolve()
362
+ .then(() => current.update())
363
+ .catch(error => {
364
+ if (updateWarnedRef.current)
365
+ return;
366
+ updateWarnedRef.current = true;
367
+ console.warn('[joy] JoyPointsCalculator: update failed', error);
368
+ });
369
+ }, UPDATE_DEBOUNCE_MS);
370
+ return () => clearTimeout(timer);
371
+ }, [product?.id, selectedVariant?.id, quantity, sellingPlanId, cartKey, customerTagsKey, isB2B, loggedInNow]);
372
+ return (_jsxs("div", { className: className, hidden: isCollapsed, style: isCollapsed ? { display: 'none' } : undefined, children: [_jsx(WidgetCorePreloadLinks, { core: initialData?.core, assetUrl: assetUrl, lazy: ['pointsCalculator'] }), createElement('div', {
373
+ ref: hostRef,
374
+ 'data-joy-points-calculator': '',
375
+ style: reserved && !isCollapsed ? { minHeight: PLACEHOLDER_MIN_HEIGHT } : undefined
376
+ })] }));
377
+ }
@@ -0,0 +1,7 @@
1
+ export declare const JOY_POINTS_PRODUCT_FRAGMENT = "#graphql\n fragment JoyPointsProduct on Product {\n id\n title\n tags\n vendor\n productType\n priceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n }\n collections(first: 20) {\n nodes {\n id\n title\n }\n pageInfo {\n hasNextPage\n }\n }\n }\n";
2
+ export declare const JOY_POINTS_VARIANT_FRAGMENT = "#graphql\n fragment JoyPointsVariant on ProductVariant {\n id\n price {\n amount\n currencyCode\n }\n compareAtPrice {\n amount\n currencyCode\n }\n }\n";
3
+ export declare const JOY_POINTS_VARIANT_SELLING_PLANS_FRAGMENT = "#graphql\n fragment JoyPointsVariantSellingPlans on ProductVariant {\n sellingPlanAllocations(first: 10) {\n nodes {\n sellingPlan {\n id\n }\n checkoutChargeAmount {\n amount\n currencyCode\n }\n priceAdjustments {\n price {\n amount\n currencyCode\n }\n }\n }\n }\n }\n";
4
+ export declare const JOY_POINTS_CART_LINE_FRAGMENT = "#graphql\n fragment JoyPointsCartLine on CartLine {\n id\n quantity\n cost {\n totalAmount {\n amount\n currencyCode\n }\n subtotalAmount {\n amount\n currencyCode\n }\n compareAtAmountPerQuantity {\n amount\n currencyCode\n }\n }\n discountAllocations {\n targetType\n discountedAmount {\n amount\n currencyCode\n }\n ... on CartCodeDiscountAllocation {\n code\n }\n }\n merchandise {\n ... on ProductVariant {\n id\n price {\n amount\n currencyCode\n }\n compareAtPrice {\n amount\n currencyCode\n }\n product {\n id\n title\n tags\n vendor\n productType\n priceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n }\n collections(first: 20) {\n nodes {\n id\n title\n }\n pageInfo {\n hasNextPage\n }\n }\n }\n }\n }\n }\n";
5
+ export declare const JOY_POINTS_CART_LINE_SELLING_PLAN_FRAGMENT = "#graphql\n fragment JoyPointsCartLineSellingPlan on CartLine {\n sellingPlanAllocation {\n sellingPlan {\n id\n }\n }\n }\n";
6
+ export declare const JOY_POINTS_CUSTOMER_FRAGMENT = "#graphql\n fragment JoyPointsCustomer on Customer {\n tags\n companyContacts(first: 1) {\n nodes {\n id\n }\n }\n }\n";
7
+ export declare const JOY_POINTS_CUSTOMER_ACCOUNT_QUERY = "#graphql\n query JoyPointsCustomer {\n customer {\n ...JoyPointsCustomer\n }\n }\n #graphql\n fragment JoyPointsCustomer on Customer {\n tags\n companyContacts(first: 1) {\n nodes {\n id\n }\n }\n }\n\n";
@@ -0,0 +1,150 @@
1
+ export const JOY_POINTS_PRODUCT_FRAGMENT = `#graphql
2
+ fragment JoyPointsProduct on Product {
3
+ id
4
+ title
5
+ tags
6
+ vendor
7
+ productType
8
+ priceRange {
9
+ minVariantPrice {
10
+ amount
11
+ currencyCode
12
+ }
13
+ }
14
+ collections(first: 20) {
15
+ nodes {
16
+ id
17
+ title
18
+ }
19
+ pageInfo {
20
+ hasNextPage
21
+ }
22
+ }
23
+ }
24
+ `;
25
+ export const JOY_POINTS_VARIANT_FRAGMENT = `#graphql
26
+ fragment JoyPointsVariant on ProductVariant {
27
+ id
28
+ price {
29
+ amount
30
+ currencyCode
31
+ }
32
+ compareAtPrice {
33
+ amount
34
+ currencyCode
35
+ }
36
+ }
37
+ `;
38
+ export const JOY_POINTS_VARIANT_SELLING_PLANS_FRAGMENT = `#graphql
39
+ fragment JoyPointsVariantSellingPlans on ProductVariant {
40
+ sellingPlanAllocations(first: 10) {
41
+ nodes {
42
+ sellingPlan {
43
+ id
44
+ }
45
+ checkoutChargeAmount {
46
+ amount
47
+ currencyCode
48
+ }
49
+ priceAdjustments {
50
+ price {
51
+ amount
52
+ currencyCode
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
58
+ `;
59
+ export const JOY_POINTS_CART_LINE_FRAGMENT = `#graphql
60
+ fragment JoyPointsCartLine on CartLine {
61
+ id
62
+ quantity
63
+ cost {
64
+ totalAmount {
65
+ amount
66
+ currencyCode
67
+ }
68
+ subtotalAmount {
69
+ amount
70
+ currencyCode
71
+ }
72
+ compareAtAmountPerQuantity {
73
+ amount
74
+ currencyCode
75
+ }
76
+ }
77
+ discountAllocations {
78
+ targetType
79
+ discountedAmount {
80
+ amount
81
+ currencyCode
82
+ }
83
+ ... on CartCodeDiscountAllocation {
84
+ code
85
+ }
86
+ }
87
+ merchandise {
88
+ ... on ProductVariant {
89
+ id
90
+ price {
91
+ amount
92
+ currencyCode
93
+ }
94
+ compareAtPrice {
95
+ amount
96
+ currencyCode
97
+ }
98
+ product {
99
+ id
100
+ title
101
+ tags
102
+ vendor
103
+ productType
104
+ priceRange {
105
+ minVariantPrice {
106
+ amount
107
+ currencyCode
108
+ }
109
+ }
110
+ collections(first: 20) {
111
+ nodes {
112
+ id
113
+ title
114
+ }
115
+ pageInfo {
116
+ hasNextPage
117
+ }
118
+ }
119
+ }
120
+ }
121
+ }
122
+ }
123
+ `;
124
+ export const JOY_POINTS_CART_LINE_SELLING_PLAN_FRAGMENT = `#graphql
125
+ fragment JoyPointsCartLineSellingPlan on CartLine {
126
+ sellingPlanAllocation {
127
+ sellingPlan {
128
+ id
129
+ }
130
+ }
131
+ }
132
+ `;
133
+ export const JOY_POINTS_CUSTOMER_FRAGMENT = `#graphql
134
+ fragment JoyPointsCustomer on Customer {
135
+ tags
136
+ companyContacts(first: 1) {
137
+ nodes {
138
+ id
139
+ }
140
+ }
141
+ }
142
+ `;
143
+ export const JOY_POINTS_CUSTOMER_ACCOUNT_QUERY = `#graphql
144
+ query JoyPointsCustomer {
145
+ customer {
146
+ ...JoyPointsCustomer
147
+ }
148
+ }
149
+ ${JOY_POINTS_CUSTOMER_FRAGMENT}
150
+ `;
@@ -0,0 +1,19 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { HydrogenCartFetcher, StorefrontCart } from '../hydrogen-cart-port.js';
3
+ import type { JoyInitialDataResult } from '../server/get-joy-initial-data.js';
4
+ export interface JoyRedeemCartProps {
5
+ apiUrl: string;
6
+ shopDomain: string;
7
+ tokenRoute?: string;
8
+ assetUrl?: string;
9
+ initialData: JoyInitialDataResult | null | undefined;
10
+ loginUrl?: string;
11
+ onNavigate?: (url: string) => void;
12
+ className?: string;
13
+ cart?: StorefrontCart | (() => StorefrontCart | null | undefined);
14
+ cartFetcher?: HydrogenCartFetcher;
15
+ cartRevalidate?: () => void;
16
+ cartRoute?: string;
17
+ onCartUpdated?: (cart: StorefrontCart) => void;
18
+ }
19
+ export declare function JoyRedeemCart({ apiUrl, shopDomain, tokenRoute, assetUrl, initialData, loginUrl, onNavigate, className, cart, cartFetcher, cartRevalidate, cartRoute, onCartUpdated }: JoyRedeemCartProps): ReactNode;