@discount-depot/hydrogen 0.1.4 → 0.1.5
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 +20 -1
- package/dist/buy-x-get-y-data.d.ts +1 -0
- package/dist/buy-x-get-y-data.js +1 -0
- package/dist/cart-goal-data.d.ts +1 -0
- package/dist/cart-goal-data.js +1 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.js +1 -0
- package/dist/volume.d.ts +1 -0
- package/dist/volume.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -334,4 +334,23 @@ automatic session integration.
|
|
|
334
334
|
Version 0.1.3 fixes Oxygen runtime compatibility by using manual redirects and
|
|
335
335
|
rejecting non-success responses. Customer credentials are never forwarded across
|
|
336
336
|
redirects. The regression suite includes real workerd fetch tests for guest and
|
|
337
|
-
logged-in PDP/batch requests.
|
|
337
|
+
logged-in PDP/batch requests.
|
|
338
|
+
|
|
339
|
+
## Multi-currency previews (unreleased)
|
|
340
|
+
|
|
341
|
+
The backend can estimate monetary rules in the shopper's currency using a shared,
|
|
342
|
+
cached median of Shopify base/contextual variant price ratios. This is an estimate,
|
|
343
|
+
not Shopify's `presentmentCurrencyRate`. Fixed discounts, volume spend thresholds,
|
|
344
|
+
Cart Goal targets and BXGY fixed rewards/minimum spend use that factor. Percentage
|
|
345
|
+
values and quantity thresholds remain unchanged. Invalid or unavailable estimates
|
|
346
|
+
retain the existing cross-currency fallbacks.
|
|
347
|
+
|
|
348
|
+
The backend returns `estimated: true` as metadata on evaluated offers; all four
|
|
349
|
+
components display the offer without an additional estimate notice. No rate is
|
|
350
|
+
accepted from the browser, and no additional per-card request is needed. Existing
|
|
351
|
+
country/market/customer eligibility still applies. Keep the storefront country and
|
|
352
|
+
cart buyer identity synchronized. Shopify's actual cart amounts remain authoritative.
|
|
353
|
+
|
|
354
|
+
Deploy the matching backend and publish a new package version to distribute this
|
|
355
|
+
feature. Registry 0.1.4 alone does not preserve the estimate metadata. This development
|
|
356
|
+
storefront applies the matching patch using `patch-package` until that release.
|
package/dist/buy-x-get-y-data.js
CHANGED
|
@@ -72,6 +72,7 @@ export function normalizeBuyXGetY(value, currency, allowCartActions = false) {
|
|
|
72
72
|
offers.push({
|
|
73
73
|
id: offer.id,
|
|
74
74
|
eligible: true,
|
|
75
|
+
...(offer.estimated === true ? { estimated: true } : {}),
|
|
75
76
|
discountType: 'AUTOMATIC',
|
|
76
77
|
currencyCode: currency,
|
|
77
78
|
title: offer.title,
|
package/dist/cart-goal-data.d.ts
CHANGED
package/dist/cart-goal-data.js
CHANGED
package/dist/server.d.ts
CHANGED
package/dist/server.js
CHANGED
|
@@ -217,6 +217,7 @@ function normalizeDiscount(result, input, batch = false) {
|
|
|
217
217
|
}
|
|
218
218
|
return {
|
|
219
219
|
eligible: true,
|
|
220
|
+
...('estimated' in result && result.estimated === true ? { estimated: true } : {}),
|
|
220
221
|
originalPrice: input.price,
|
|
221
222
|
...(!batch && 'countdown' in result
|
|
222
223
|
? { countdown: normalizeCountdown(result.countdown) } : {}),
|
package/dist/volume.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type DepotCountdown } from './countdown-data.js';
|
|
2
2
|
/** Public, evaluated preview data; never send raw database rules to the browser. */
|
|
3
3
|
export interface DepotVolumeTable {
|
|
4
|
+
estimated?: boolean;
|
|
4
5
|
eligible: true;
|
|
5
6
|
discountType: 'AUTOMATIC' | 'CODE';
|
|
6
7
|
discountCode?: string;
|
package/dist/volume.js
CHANGED
|
@@ -69,6 +69,7 @@ export function normalizeVolumeTable(value, price) {
|
|
|
69
69
|
}
|
|
70
70
|
return {
|
|
71
71
|
eligible: true,
|
|
72
|
+
...(table.estimated === true ? { estimated: true } : {}),
|
|
72
73
|
discountType: table.discountType,
|
|
73
74
|
...(table.discountType === 'CODE' ? { discountCode: table.showDiscountCode === false ? undefined : table.discountCode, showDiscountCode: table.showDiscountCode !== false } : {}),
|
|
74
75
|
currencyCode: price.currencyCode,
|