@juo/blocks 2.0.0-alpha.1 → 2.0.0-alpha.3
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/core.js +207 -18
- package/dist/services/subscription/adapter.d.ts.map +1 -1
- package/dist/services/subscription/index.d.ts +1 -0
- package/dist/services/subscription/index.d.ts.map +1 -1
- package/dist/services/subscription/paymentInstrument.d.ts +103 -0
- package/dist/services/subscription/paymentInstrument.d.ts.map +1 -0
- package/dist/services/subscription/paymentInstrument.test.d.ts +2 -0
- package/dist/services/subscription/paymentInstrument.test.d.ts.map +1 -0
- package/dist/services/subscription/store.d.ts.map +1 -1
- package/dist/services/subscription/types.d.ts +84 -5
- package/dist/services/subscription/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -1310,6 +1310,12 @@ const DISCOUNT_REJECTION_REASONS = [
|
|
|
1310
1310
|
function toAttributeArray(next) {
|
|
1311
1311
|
return Object.entries(next).map(([key, value]) => ({ key, value }));
|
|
1312
1312
|
}
|
|
1313
|
+
function toNonEmptyAttributeArray(next) {
|
|
1314
|
+
if (next == null) return [];
|
|
1315
|
+
return toAttributeArray(next).filter(
|
|
1316
|
+
({ key, value }) => key !== "" && value !== ""
|
|
1317
|
+
);
|
|
1318
|
+
}
|
|
1313
1319
|
function createMockSubscriptionAdapter(options = {}) {
|
|
1314
1320
|
const richBase = (id, itemId, renewalId) => ({
|
|
1315
1321
|
id,
|
|
@@ -1481,18 +1487,55 @@ function createMockSubscriptionAdapter(options = {}) {
|
|
|
1481
1487
|
{
|
|
1482
1488
|
...richBase("sub_paused", "item_paused", "ren_paused"),
|
|
1483
1489
|
status: "paused",
|
|
1484
|
-
pausePeriod: { start: "2025-11-01T00:00:00Z", end: "2026-01-01T00:00:00Z" }
|
|
1490
|
+
pausePeriod: { start: "2025-11-01T00:00:00Z", end: "2026-01-01T00:00:00Z" },
|
|
1491
|
+
// BLIK with a non-recurring alias — the shape that gates the
|
|
1492
|
+
// re-authorization prompt in RenewalSummary. Only the legacy-sourced
|
|
1493
|
+
// payment method can express this, so previews would otherwise never
|
|
1494
|
+
// exercise the branch.
|
|
1495
|
+
customerPaymentMethod: {
|
|
1496
|
+
id: "pm_blik",
|
|
1497
|
+
instrument: { type: "blik", label: "my-blik-alias" },
|
|
1498
|
+
active: true,
|
|
1499
|
+
isRecurring: false
|
|
1500
|
+
}
|
|
1485
1501
|
},
|
|
1486
1502
|
{
|
|
1487
1503
|
...richBase("sub_canceled", "item_canceled", "ren_canceled"),
|
|
1488
1504
|
status: "canceled",
|
|
1489
|
-
pausePeriod: null
|
|
1505
|
+
pausePeriod: null,
|
|
1506
|
+
// SEPA — identified by a masked IBAN rather than card digits.
|
|
1507
|
+
customerPaymentMethod: {
|
|
1508
|
+
id: "pm_sepa",
|
|
1509
|
+
instrument: {
|
|
1510
|
+
type: "sepa_direct_debit",
|
|
1511
|
+
consumerName: "Ada Lovelace",
|
|
1512
|
+
consumerBic: "ABCDEFGH",
|
|
1513
|
+
consumerAccount: "DE12****6789"
|
|
1514
|
+
},
|
|
1515
|
+
active: true,
|
|
1516
|
+
isRecurring: true
|
|
1517
|
+
}
|
|
1490
1518
|
},
|
|
1491
1519
|
{
|
|
1492
1520
|
...richBase("sub_failed", "item_failed", "ren_failed"),
|
|
1493
1521
|
status: "failed",
|
|
1494
1522
|
lastPaymentStatus: "failed",
|
|
1495
|
-
pausePeriod: null
|
|
1523
|
+
pausePeriod: null,
|
|
1524
|
+
// An expired card — pairs with the failed payment, and exercises
|
|
1525
|
+
// getPaymentInstrumentExpiry's isExpired branch.
|
|
1526
|
+
customerPaymentMethod: {
|
|
1527
|
+
id: "pm_expired_card",
|
|
1528
|
+
instrument: {
|
|
1529
|
+
type: "credit_card",
|
|
1530
|
+
brand: "mastercard",
|
|
1531
|
+
maskedNumber: "************5100",
|
|
1532
|
+
expiryMonth: 1,
|
|
1533
|
+
expiryYear: 2024,
|
|
1534
|
+
cardholderName: "Ada Lovelace"
|
|
1535
|
+
},
|
|
1536
|
+
active: true,
|
|
1537
|
+
isRecurring: true
|
|
1538
|
+
}
|
|
1496
1539
|
},
|
|
1497
1540
|
{
|
|
1498
1541
|
...richBase("sub_expired", "item_expired", "ren_expired"),
|
|
@@ -1588,8 +1631,11 @@ function createMockSubscriptionAdapter(options = {}) {
|
|
|
1588
1631
|
...variant && product && !product.hasOnlyDefaultVariant ? { variantTitle: variant.title } : {},
|
|
1589
1632
|
...(variant == null ? void 0 : variant.image) ? { variantImage: variant.image } : {},
|
|
1590
1633
|
variantAvailableForSale: true,
|
|
1591
|
-
|
|
1592
|
-
|
|
1634
|
+
// An explicit per-line billingPolicy wins; otherwise inherit the plan's.
|
|
1635
|
+
billingPolicy: item.billingPolicy ?? ((_f = subscription.items[0]) == null ? void 0 : _f.billingPolicy) ?? subscription.billingPolicy ?? null,
|
|
1636
|
+
deliveryPolicy: ((_g = subscription.items[0]) == null ? void 0 : _g.deliveryPolicy) ?? subscription.deliveryPolicy ?? null,
|
|
1637
|
+
...item.recurringCycleLimit != null ? { recurringCycleLimit: item.recurringCycleLimit } : {},
|
|
1638
|
+
...item.customAttributes != null ? { customAttributes: toAttributeArray(item.customAttributes) } : {}
|
|
1593
1639
|
});
|
|
1594
1640
|
subscription.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1595
1641
|
return { _tag: "Success", data: void 0 };
|
|
@@ -1617,6 +1663,9 @@ function createMockSubscriptionAdapter(options = {}) {
|
|
|
1617
1663
|
if (update.variantId !== void 0) item.variantId = update.variantId;
|
|
1618
1664
|
if (update.quantity !== void 0) item.quantity = update.quantity;
|
|
1619
1665
|
if (update.billingPolicy !== void 0) item.billingPolicy = update.billingPolicy;
|
|
1666
|
+
if (update.customAttributes !== void 0) {
|
|
1667
|
+
item.customAttributes = toAttributeArray(update.customAttributes);
|
|
1668
|
+
}
|
|
1620
1669
|
subscription.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1621
1670
|
return { _tag: "Success", data: void 0 };
|
|
1622
1671
|
},
|
|
@@ -1835,24 +1884,75 @@ function createMockSubscriptionAdapter(options = {}) {
|
|
|
1835
1884
|
}
|
|
1836
1885
|
};
|
|
1837
1886
|
}
|
|
1838
|
-
function
|
|
1839
|
-
|
|
1887
|
+
function mapV1Instrument(raw) {
|
|
1888
|
+
if (raw == null || typeof raw.type !== "string") return null;
|
|
1889
|
+
switch (raw.type) {
|
|
1890
|
+
case "credit-card":
|
|
1891
|
+
return {
|
|
1892
|
+
type: "credit_card",
|
|
1893
|
+
brand: raw.brand ?? "",
|
|
1894
|
+
maskedNumber: raw.maskedNumber ?? "",
|
|
1895
|
+
...raw.expiryMonth != null ? { expiryMonth: raw.expiryMonth } : {},
|
|
1896
|
+
...raw.expiryYear != null ? { expiryYear: raw.expiryYear } : {},
|
|
1897
|
+
...raw.cardholderName != null ? { cardholderName: raw.cardholderName } : {}
|
|
1898
|
+
};
|
|
1899
|
+
case "paypal":
|
|
1900
|
+
return { type: "paypal", paypalAccountEmail: raw.paypalAccountEmail ?? null };
|
|
1901
|
+
case "shop-pay":
|
|
1902
|
+
return {
|
|
1903
|
+
type: "shop_pay",
|
|
1904
|
+
maskedNumber: raw.maskedNumber ?? "",
|
|
1905
|
+
...raw.expiryMonth != null ? { expiryMonth: raw.expiryMonth } : {},
|
|
1906
|
+
...raw.expiryYear != null ? { expiryYear: raw.expiryYear } : {},
|
|
1907
|
+
...raw.cardholderName != null ? { cardholderName: raw.cardholderName } : {}
|
|
1908
|
+
};
|
|
1909
|
+
case "sepa-direct-debit":
|
|
1910
|
+
return {
|
|
1911
|
+
type: "sepa_direct_debit",
|
|
1912
|
+
consumerName: raw.consumerName ?? "",
|
|
1913
|
+
consumerBic: raw.consumerBic ?? null,
|
|
1914
|
+
consumerAccount: raw.maskedConsumerAccount ?? ""
|
|
1915
|
+
};
|
|
1916
|
+
case "blik":
|
|
1917
|
+
return { type: "blik" };
|
|
1918
|
+
case "mbway":
|
|
1919
|
+
return { type: "mbway", ...raw.phone != null ? { phone: raw.phone } : {} };
|
|
1920
|
+
case "bacs":
|
|
1921
|
+
return { type: "bacs", maskedNumber: raw.maskedNumber ?? "" };
|
|
1922
|
+
default:
|
|
1923
|
+
return null;
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
function mapV1BillingAddress(raw) {
|
|
1927
|
+
if (raw == null || typeof raw !== "object") return null;
|
|
1928
|
+
const address = {
|
|
1929
|
+
firstName: raw.firstName ?? null,
|
|
1930
|
+
lastName: raw.lastName ?? null,
|
|
1931
|
+
address1: raw.address1 ?? null,
|
|
1932
|
+
address2: raw.address2 ?? null,
|
|
1933
|
+
zip: raw.zip ?? null,
|
|
1934
|
+
city: raw.city ?? null,
|
|
1935
|
+
country: raw.country ?? null,
|
|
1936
|
+
countryCode: raw.countryCode ?? null,
|
|
1937
|
+
province: raw.province ?? null,
|
|
1938
|
+
provinceCode: raw.provinceCode ?? null,
|
|
1939
|
+
phone: raw.phone ?? null,
|
|
1940
|
+
company: raw.company ?? null
|
|
1941
|
+
};
|
|
1942
|
+
return Object.values(address).some((v3) => v3 != null) ? address : null;
|
|
1840
1943
|
}
|
|
1841
1944
|
function mapPaymentMethod(rawPm) {
|
|
1842
1945
|
if (!rawPm) return null;
|
|
1843
1946
|
if (typeof rawPm === "string") {
|
|
1844
1947
|
return { id: rawPm };
|
|
1845
1948
|
}
|
|
1949
|
+
const instrument = mapV1Instrument(rawPm.instrument);
|
|
1950
|
+
const billingAddress = mapV1BillingAddress(rawPm.billingAddress);
|
|
1846
1951
|
return {
|
|
1847
1952
|
id: rawPm.id ?? "",
|
|
1848
|
-
...
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
type: normalizeInstrumentType(rawPm.instrument.type)
|
|
1852
|
-
}
|
|
1853
|
-
} : {},
|
|
1854
|
-
...rawPm.active != null ? { active: rawPm.active } : {},
|
|
1855
|
-
...rawPm.isRecurring != null ? { isRecurring: rawPm.isRecurring } : {}
|
|
1953
|
+
...instrument != null ? { instrument } : {},
|
|
1954
|
+
// v1 is the ONLY customer-facing source of a billing address.
|
|
1955
|
+
...billingAddress != null ? { billingAddress } : {}
|
|
1856
1956
|
};
|
|
1857
1957
|
}
|
|
1858
1958
|
function mapSubscription(raw) {
|
|
@@ -1977,14 +2077,33 @@ function createApiSubscriptionAdapter(fetcher) {
|
|
|
1977
2077
|
return { _tag: "Failure", error: e };
|
|
1978
2078
|
}
|
|
1979
2079
|
},
|
|
2080
|
+
// Uses the legacy POST /customer/subscriptions/{id}/lines rather than
|
|
2081
|
+
// POST /customer/v1/subscriptions/{id}/items: only the legacy endpoint
|
|
2082
|
+
// accepts a per-line `billingPolicy`. It answers 204 with no body.
|
|
2083
|
+
// Behavioural differences vs the v1 route, both intentional here:
|
|
2084
|
+
// - it rejects membership subscriptions with 403 (v1 does not),
|
|
2085
|
+
// - it skips the availableForSale check (v1 enforces it), so callers are
|
|
2086
|
+
// responsible for only offering purchasable variants — which the
|
|
2087
|
+
// product picker already does.
|
|
1980
2088
|
async addItem({ subscriptionId, item }) {
|
|
1981
2089
|
try {
|
|
2090
|
+
const attributes = toNonEmptyAttributeArray(item.customAttributes);
|
|
2091
|
+
const body = {
|
|
2092
|
+
productVariantId: item.variantId,
|
|
2093
|
+
quantity: item.quantity,
|
|
2094
|
+
// `!= null` on purpose: null means "inherit"/"no limit", and the
|
|
2095
|
+
// endpoint rejects an explicit null on either field.
|
|
2096
|
+
...item.billingPolicy != null ? { billingPolicy: item.billingPolicy } : {},
|
|
2097
|
+
...item.recurringCycleLimit != null ? { renewalLimit: item.recurringCycleLimit } : {},
|
|
2098
|
+
...item.shippingMethodHandle != null ? { shippingMethodHandle: item.shippingMethodHandle } : {},
|
|
2099
|
+
...attributes.length > 0 ? { customAttributes: attributes } : {}
|
|
2100
|
+
};
|
|
1982
2101
|
const res = await fetcher(
|
|
1983
|
-
`/customer/
|
|
2102
|
+
`/customer/subscriptions/${subscriptionId}/lines`,
|
|
1984
2103
|
{
|
|
1985
2104
|
method: "POST",
|
|
1986
2105
|
headers: { "Content-Type": "application/json" },
|
|
1987
|
-
body: JSON.stringify(
|
|
2106
|
+
body: JSON.stringify(body)
|
|
1988
2107
|
}
|
|
1989
2108
|
);
|
|
1990
2109
|
if (!res.ok) return { _tag: "Failure", error: `HTTP ${res.status}` };
|
|
@@ -2011,7 +2130,11 @@ function createApiSubscriptionAdapter(fetcher) {
|
|
|
2011
2130
|
...update.variantId !== void 0 ? { productVariantId: update.variantId } : {},
|
|
2012
2131
|
...update.quantity !== void 0 ? { quantity: update.quantity } : {},
|
|
2013
2132
|
...update.billingPolicy !== void 0 ? { billingPolicy: update.billingPolicy } : {},
|
|
2014
|
-
...update.shippingMethodHandle !== void 0 ? { shippingMethodHandle: update.shippingMethodHandle } : {}
|
|
2133
|
+
...update.shippingMethodHandle !== void 0 ? { shippingMethodHandle: update.shippingMethodHandle } : {},
|
|
2134
|
+
// Record shape (not the array the add-line endpoint takes). Guarded on
|
|
2135
|
+
// `!== undefined` so `{}` — clear every customer-visible attribute —
|
|
2136
|
+
// reaches the endpoint instead of being dropped as falsy.
|
|
2137
|
+
...update.customAttributes !== void 0 ? { customAttributes: update.customAttributes } : {}
|
|
2015
2138
|
};
|
|
2016
2139
|
const res = await fetcher(
|
|
2017
2140
|
`/customer/subscriptions/${subscriptionId}/lines/${lineId}`,
|
|
@@ -3231,6 +3354,67 @@ function createSubscriptionService(adapter) {
|
|
|
3231
3354
|
};
|
|
3232
3355
|
return service;
|
|
3233
3356
|
}
|
|
3357
|
+
const PAYMENT_INSTRUMENT_TYPES = [
|
|
3358
|
+
"credit_card",
|
|
3359
|
+
"paypal",
|
|
3360
|
+
"shop_pay",
|
|
3361
|
+
"sepa_direct_debit",
|
|
3362
|
+
"blik",
|
|
3363
|
+
"mbway",
|
|
3364
|
+
"bacs"
|
|
3365
|
+
];
|
|
3366
|
+
const INSTRUMENT_TYPE_TO_NAME = {
|
|
3367
|
+
credit_card: null,
|
|
3368
|
+
paypal: "PayPal",
|
|
3369
|
+
blik: "BLIK",
|
|
3370
|
+
sepa_direct_debit: "SEPA",
|
|
3371
|
+
mbway: "MB WAY",
|
|
3372
|
+
shop_pay: "Shop Pay",
|
|
3373
|
+
bacs: "Bacs"
|
|
3374
|
+
};
|
|
3375
|
+
function getPaymentInstrumentName(instrument) {
|
|
3376
|
+
const name = INSTRUMENT_TYPE_TO_NAME[instrument.type] ?? null;
|
|
3377
|
+
if (name != null) return name;
|
|
3378
|
+
return instrument.type === "credit_card" ? instrument.brand || instrument.type : instrument.type;
|
|
3379
|
+
}
|
|
3380
|
+
function getPaymentInstrumentDigits(instrument) {
|
|
3381
|
+
switch (instrument.type) {
|
|
3382
|
+
case "credit_card":
|
|
3383
|
+
case "shop_pay":
|
|
3384
|
+
case "bacs":
|
|
3385
|
+
return instrument.maskedNumber.slice(-4) || null;
|
|
3386
|
+
case "sepa_direct_debit":
|
|
3387
|
+
return instrument.consumerAccount.slice(-4) || null;
|
|
3388
|
+
default:
|
|
3389
|
+
return null;
|
|
3390
|
+
}
|
|
3391
|
+
}
|
|
3392
|
+
function getPaymentInstrumentDetail(instrument) {
|
|
3393
|
+
switch (instrument.type) {
|
|
3394
|
+
case "paypal":
|
|
3395
|
+
return instrument.paypalAccountEmail ?? null;
|
|
3396
|
+
case "sepa_direct_debit":
|
|
3397
|
+
return instrument.consumerName ?? null;
|
|
3398
|
+
case "blik":
|
|
3399
|
+
return instrument.label ?? null;
|
|
3400
|
+
case "mbway":
|
|
3401
|
+
return instrument.phone ?? null;
|
|
3402
|
+
default:
|
|
3403
|
+
return null;
|
|
3404
|
+
}
|
|
3405
|
+
}
|
|
3406
|
+
function getPaymentInstrumentExpiry(instrument, now = /* @__PURE__ */ new Date()) {
|
|
3407
|
+
if (instrument.type !== "credit_card" && instrument.type !== "shop_pay") {
|
|
3408
|
+
return null;
|
|
3409
|
+
}
|
|
3410
|
+
const { expiryMonth: month, expiryYear: year } = instrument;
|
|
3411
|
+
if (month == null || year == null) return null;
|
|
3412
|
+
const nowYear = now.getFullYear();
|
|
3413
|
+
const nowMonth = now.getMonth() + 1;
|
|
3414
|
+
const expiresThisMonth = year === nowYear && month === nowMonth;
|
|
3415
|
+
const isExpired = year < nowYear || year === nowYear && month < nowMonth;
|
|
3416
|
+
return { month, year, isExpired, expiresThisMonth };
|
|
3417
|
+
}
|
|
3234
3418
|
function getDefaultBlockForAction(actionType, actionConfig, blockId) {
|
|
3235
3419
|
const blockName = `action:${actionType}`;
|
|
3236
3420
|
const definedBlocks = getDefinedBlocks();
|
|
@@ -4206,6 +4390,7 @@ export {
|
|
|
4206
4390
|
OrderServiceContext,
|
|
4207
4391
|
OverlayServiceContext,
|
|
4208
4392
|
P as PAGE_ROOT_SLOT,
|
|
4393
|
+
PAYMENT_INSTRUMENT_TYPES,
|
|
4209
4394
|
ProductServiceContext,
|
|
4210
4395
|
RouterServiceContext,
|
|
4211
4396
|
SchedulesServiceContext,
|
|
@@ -4282,6 +4467,10 @@ export {
|
|
|
4282
4467
|
getDefinedBlocks,
|
|
4283
4468
|
F as getDevtoolsBlockState,
|
|
4284
4469
|
getLayoutModeAdapter,
|
|
4470
|
+
getPaymentInstrumentDetail,
|
|
4471
|
+
getPaymentInstrumentDigits,
|
|
4472
|
+
getPaymentInstrumentExpiry,
|
|
4473
|
+
getPaymentInstrumentName,
|
|
4285
4474
|
gridV1Engine,
|
|
4286
4475
|
hasDefaultBlockForAction,
|
|
4287
4476
|
G as hasRenderedContent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/services/subscription/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,wBAAwB,EACxB,sBAAsB,EACtB,aAAa,EACb,SAAS,EACT,cA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OAAO,EAAE,UAAU,GAClB,mBAAmB,CA2hBrB"}
|
|
@@ -3,4 +3,5 @@ export { createMockSubscriptionAdapter, createApiSubscriptionAdapter } from './a
|
|
|
3
3
|
export { createSubscriptionService, SubscriptionServiceContext } from './subscriptionService';
|
|
4
4
|
export * from './types';
|
|
5
5
|
export * from './discountErrors';
|
|
6
|
+
export * from './paymentInstrument';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/subscription/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAC;AACrF,OAAO,EAAE,6BAA6B,EAAE,4BAA4B,EAAE,MAAM,WAAW,CAAC;AAExF,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAE9F,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/subscription/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAC;AACrF,OAAO,EAAE,6BAA6B,EAAE,4BAA4B,EAAE,MAAM,WAAW,CAAC;AAExF,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAE9F,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payment-instrument model + display helpers.
|
|
3
|
+
*
|
|
4
|
+
* ## Why a union, and why underscore tags
|
|
5
|
+
*
|
|
6
|
+
* The backend exposes payment instruments in two shapes:
|
|
7
|
+
*
|
|
8
|
+
* - the **legacy** subscription endpoints (`/customer/subscriptions`, and its
|
|
9
|
+
* list form) via `processInstrument` — underscore tags (`credit_card`), and
|
|
10
|
+
* the only shape carrying `active` / `isRecurring` / `provider` and the BLIK
|
|
11
|
+
* `label`. This is the authoritative source.
|
|
12
|
+
* - the **v1** `?expand=paymentMethod` shape via `serializePaymentMethod` —
|
|
13
|
+
* hyphen tags (`credit-card`), adds `cardholderName` / shop-pay expiry /
|
|
14
|
+
* `lastDigits`, but cannot express `active`, `isRecurring`, `provider`, or
|
|
15
|
+
* the BLIK `label` at all. Adapters normalise it into this union and treat
|
|
16
|
+
* the missing fields as unknown.
|
|
17
|
+
*
|
|
18
|
+
* Underscore is the canonical tag here because the shared icon map
|
|
19
|
+
* (`paymentMethodIcons` in `@juo/customer-ui`) is keyed that way.
|
|
20
|
+
*/
|
|
21
|
+
/** Instrument types, in the canonical underscore form. */
|
|
22
|
+
export declare const PAYMENT_INSTRUMENT_TYPES: readonly ["credit_card", "paypal", "shop_pay", "sepa_direct_debit", "blik", "mbway", "bacs"];
|
|
23
|
+
export type PaymentInstrumentType = (typeof PAYMENT_INSTRUMENT_TYPES)[number];
|
|
24
|
+
/**
|
|
25
|
+
* A payment instrument. Fields are required only where BOTH backend shapes
|
|
26
|
+
* guarantee them; anything either source may omit is optional.
|
|
27
|
+
*/
|
|
28
|
+
export type SubscriptionPaymentInstrument = {
|
|
29
|
+
type: "credit_card";
|
|
30
|
+
brand: string;
|
|
31
|
+
maskedNumber: string;
|
|
32
|
+
expiryMonth?: number;
|
|
33
|
+
expiryYear?: number;
|
|
34
|
+
/** v1 only — the legacy shape drops the cardholder name. */
|
|
35
|
+
cardholderName?: string;
|
|
36
|
+
} | {
|
|
37
|
+
type: "paypal";
|
|
38
|
+
paypalAccountEmail?: string | null;
|
|
39
|
+
} | {
|
|
40
|
+
type: "shop_pay";
|
|
41
|
+
maskedNumber: string;
|
|
42
|
+
/** v1 only. */
|
|
43
|
+
expiryMonth?: number;
|
|
44
|
+
/** v1 only. */
|
|
45
|
+
expiryYear?: number;
|
|
46
|
+
/** v1 only. */
|
|
47
|
+
cardholderName?: string;
|
|
48
|
+
} | {
|
|
49
|
+
type: "sepa_direct_debit";
|
|
50
|
+
/** Account holder. Optional: the legacy contract does not guarantee it. */
|
|
51
|
+
consumerName?: string;
|
|
52
|
+
consumerBic?: string | null;
|
|
53
|
+
/** Masked IBAN. v1 calls this `maskedConsumerAccount` on the wire. */
|
|
54
|
+
consumerAccount: string;
|
|
55
|
+
} | {
|
|
56
|
+
type: "blik";
|
|
57
|
+
/**
|
|
58
|
+
* Alias label. Legacy only — omitted for an inactive alias, and the v1
|
|
59
|
+
* shape never carries it.
|
|
60
|
+
*/
|
|
61
|
+
label?: string;
|
|
62
|
+
} | {
|
|
63
|
+
type: "mbway";
|
|
64
|
+
phone?: string;
|
|
65
|
+
} | {
|
|
66
|
+
type: "bacs";
|
|
67
|
+
maskedNumber: string;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Human-readable instrument name: the card brand for cards (which is the
|
|
71
|
+
* meaningful identifier there), the scheme name otherwise.
|
|
72
|
+
*/
|
|
73
|
+
export declare function getPaymentInstrumentName(instrument: SubscriptionPaymentInstrument): string;
|
|
74
|
+
/**
|
|
75
|
+
* Last four identifying digits, for instruments that have a number to mask.
|
|
76
|
+
* `null` when the instrument is not identified by digits (PayPal, BLIK, MB WAY)
|
|
77
|
+
* — use `getPaymentInstrumentDetail` for those.
|
|
78
|
+
*/
|
|
79
|
+
export declare function getPaymentInstrumentDigits(instrument: SubscriptionPaymentInstrument): string | null;
|
|
80
|
+
/**
|
|
81
|
+
* Secondary identifying detail, for instruments where digits are not the
|
|
82
|
+
* identifier: the PayPal account, the SEPA account holder, the BLIK alias
|
|
83
|
+
* label, the MB WAY phone. `null` when there is nothing extra to show.
|
|
84
|
+
*/
|
|
85
|
+
export declare function getPaymentInstrumentDetail(instrument: SubscriptionPaymentInstrument): string | null;
|
|
86
|
+
export interface PaymentInstrumentExpiry {
|
|
87
|
+
month: number;
|
|
88
|
+
year: number;
|
|
89
|
+
/** True once the expiry month has fully passed. */
|
|
90
|
+
isExpired: boolean;
|
|
91
|
+
/** True during the expiry month itself — the last chance to update. */
|
|
92
|
+
expiresThisMonth: boolean;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Card expiry, for "your card is expiring" prompts. `null` when the instrument
|
|
96
|
+
* has no expiry or the source did not supply one (the legacy shape omits
|
|
97
|
+
* shop-pay expiry, so absence is not proof the card has none).
|
|
98
|
+
*
|
|
99
|
+
* A card is valid through the END of its expiry month, which is why this
|
|
100
|
+
* compares month boundaries rather than exact dates.
|
|
101
|
+
*/
|
|
102
|
+
export declare function getPaymentInstrumentExpiry(instrument: SubscriptionPaymentInstrument, now?: Date): PaymentInstrumentExpiry | null;
|
|
103
|
+
//# sourceMappingURL=paymentInstrument.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paymentInstrument.d.ts","sourceRoot":"","sources":["../../../src/services/subscription/paymentInstrument.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,0DAA0D;AAC1D,eAAO,MAAM,wBAAwB,8FAQ3B,CAAC;AAEX,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GACrC;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GACD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GACtD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,eAA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services/subscription/paymentInstrument.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/services/subscription/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACd,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAC1C,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC3D,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,uBAAuB,CAAC;IACrD,OAAO,CACL,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC,CAAC;IACnB,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACpE,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnE,cAAc,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5E,MAAM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AAC,CAAC;IACpE,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnE,cAAc,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5E,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACjE,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACtE;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,mBAAmB,GAC3B,iBAAiB,CA0GnB"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ReadonlySignal, Signal } from '@preact/signals-core';
|
|
2
2
|
import { PaginatedList, PriceWithCurrency, Result } from '../../utils';
|
|
3
3
|
import { ApplyDiscountError, RemoveDiscountError } from './discountErrors';
|
|
4
|
+
import { SubscriptionPaymentInstrument } from './paymentInstrument';
|
|
5
|
+
export type { SubscriptionPaymentInstrument };
|
|
4
6
|
export interface SubscriptionItem {
|
|
5
7
|
id: string;
|
|
6
8
|
productId: string;
|
|
@@ -37,12 +39,51 @@ export interface SubscriptionItem {
|
|
|
37
39
|
export interface PostableSubscriptionItem {
|
|
38
40
|
variantId: string;
|
|
39
41
|
quantity: number;
|
|
42
|
+
/**
|
|
43
|
+
* Per-line billing frequency for the added line. Omit (or pass null) to
|
|
44
|
+
* inherit the plan's frequency. Note there is no `deliveryPolicy`
|
|
45
|
+
* counterpart — no add-line endpoint accepts one; delivery follows billing.
|
|
46
|
+
*
|
|
47
|
+
* Nullable so a `SubscriptionItem` read off an existing subscription can be
|
|
48
|
+
* passed straight back in (see `SubscriptionStore.addItem`).
|
|
49
|
+
*/
|
|
50
|
+
billingPolicy?: SellingPlanInterval | null;
|
|
51
|
+
/**
|
|
52
|
+
* Removes the line after this many billing cycles. Maps to `renewalLimit` on
|
|
53
|
+
* the wire. Null/omitted means no limit.
|
|
54
|
+
*/
|
|
55
|
+
recurringCycleLimit?: number | null;
|
|
56
|
+
/**
|
|
57
|
+
* Shipping method to reconcile onto the subscription after the line is added.
|
|
58
|
+
* The add-line endpoint validates shipping and answers 409 when the current
|
|
59
|
+
* delivery method stops being available for the new line set.
|
|
60
|
+
*/
|
|
61
|
+
shippingMethodHandle?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Customer-editable custom attributes for the new line. Sent to the add-line
|
|
64
|
+
* endpoint as a `{key, value}` array. Entries with an empty key or an empty
|
|
65
|
+
* value are dropped — the endpoint declares both with minLength 1 and would
|
|
66
|
+
* reject the whole add with a 400.
|
|
67
|
+
* Internal (`_`-prefixed) / reserved keys must not be included: the add-line
|
|
68
|
+
* endpoint does not validate them, so they would land as real attributes.
|
|
69
|
+
* Max 50 keys.
|
|
70
|
+
*/
|
|
71
|
+
customAttributes?: Record<string, string>;
|
|
40
72
|
}
|
|
41
73
|
export interface UpdateSubscriptionItem {
|
|
42
74
|
variantId?: string;
|
|
43
75
|
quantity?: number;
|
|
44
76
|
billingPolicy?: SellingPlanInterval;
|
|
45
77
|
shippingMethodHandle?: string;
|
|
78
|
+
/**
|
|
79
|
+
* The complete desired set of customer-visible custom attributes for the line.
|
|
80
|
+
* REPLACES the current set: keys present are set, customer-visible keys omitted
|
|
81
|
+
* are removed. Internal (`_`-prefixed) / reserved keys are preserved
|
|
82
|
+
* server-side and must not be sent (the endpoint answers 400). Send `{}` to
|
|
83
|
+
* clear. Same semantics as `updateItemAttributes`, which stays available for
|
|
84
|
+
* attribute-only edits.
|
|
85
|
+
*/
|
|
86
|
+
customAttributes?: Record<string, string>;
|
|
46
87
|
}
|
|
47
88
|
export interface UpdateBoxItem {
|
|
48
89
|
variantId: string;
|
|
@@ -94,16 +135,54 @@ export interface SubscriptionDeliveryAnchor {
|
|
|
94
135
|
export interface SubscriptionDeliveryPolicy extends SellingPlanInterval {
|
|
95
136
|
anchors?: SubscriptionDeliveryAnchor[];
|
|
96
137
|
}
|
|
97
|
-
export interface SubscriptionPaymentInstrument {
|
|
98
|
-
type: string;
|
|
99
|
-
brand?: string;
|
|
100
|
-
maskedNumber?: string;
|
|
101
|
-
}
|
|
102
138
|
export interface SubscriptionPaymentMethod {
|
|
103
139
|
id: string;
|
|
104
140
|
instrument?: SubscriptionPaymentInstrument | null;
|
|
141
|
+
/**
|
|
142
|
+
* False once the payment method has been revoked. Legacy-sourced only — the
|
|
143
|
+
* v1 `expand=paymentMethod` shape cannot express it, so `undefined` means
|
|
144
|
+
* "unknown", NOT "inactive". Treat undefined as active.
|
|
145
|
+
*/
|
|
105
146
|
active?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* False for a BLIK alias that is not authorized for recurring charges, which
|
|
149
|
+
* gates the re-authorization prompt (see RenewalSummary). Legacy-sourced only
|
|
150
|
+
* — `undefined` means "unknown", so do not treat it as "not recurring".
|
|
151
|
+
*/
|
|
106
152
|
isRecurring?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Billing address for the payment method.
|
|
155
|
+
*
|
|
156
|
+
* v1-ONLY: `expand=paymentMethod` is the single customer-facing source. The
|
|
157
|
+
* legacy subscription and payment-method routes compute it server-side but
|
|
158
|
+
* their response schemas do not declare it, so Fastify strips it before it
|
|
159
|
+
* reaches the client. Consequently a host that overrides the whole payment
|
|
160
|
+
* method with legacy data (as the customer portal's enrichment adapter does)
|
|
161
|
+
* will not see it — see the note on that adapter.
|
|
162
|
+
*/
|
|
163
|
+
billingAddress?: SubscriptionBillingAddress | null;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* A payment method's billing address. Separate from `SubscriptionDeliveryAddress`
|
|
167
|
+
* because the v1 address resource carries more fields (company, phone, and both
|
|
168
|
+
* resolved display names and codes for country/province) and sends `null` rather
|
|
169
|
+
* than omitting empty values.
|
|
170
|
+
*/
|
|
171
|
+
export interface SubscriptionBillingAddress {
|
|
172
|
+
firstName?: string | null;
|
|
173
|
+
lastName?: string | null;
|
|
174
|
+
address1?: string | null;
|
|
175
|
+
address2?: string | null;
|
|
176
|
+
zip?: string | null;
|
|
177
|
+
city?: string | null;
|
|
178
|
+
/** Resolved display name, e.g. "Germany" — v1 resolves this server-side. */
|
|
179
|
+
country?: string | null;
|
|
180
|
+
countryCode?: string | null;
|
|
181
|
+
/** Resolved display name, e.g. "Bavaria". */
|
|
182
|
+
province?: string | null;
|
|
183
|
+
provinceCode?: string | null;
|
|
184
|
+
phone?: string | null;
|
|
185
|
+
company?: string | null;
|
|
107
186
|
}
|
|
108
187
|
export interface SubscriptionDeliveryAddress {
|
|
109
188
|
firstName?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/subscription/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/subscription/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAEzE,YAAY,EAAE,6BAA6B,EAAE,CAAC;AAE9C,MAAM,WAAW,gBA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