@juo/blocks 2.0.0-alpha.2 → 2.0.0-alpha.4
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 +340 -18
- package/dist/services/customer/adapter.d.ts +2 -1
- package/dist/services/customer/adapter.d.ts.map +1 -1
- package/dist/services/customer/customerService.d.ts.map +1 -1
- package/dist/services/customer/customerService.test.d.ts +2 -0
- package/dist/services/customer/customerService.test.d.ts.map +1 -0
- package/dist/services/customer/index.d.ts +1 -1
- package/dist/services/customer/index.d.ts.map +1 -1
- package/dist/services/customer/types.d.ts +16 -0
- package/dist/services/customer/types.d.ts.map +1 -1
- package/dist/services/product/adapter.d.ts +42 -0
- package/dist/services/product/adapter.d.ts.map +1 -1
- package/dist/services/product/index.d.ts +1 -1
- package/dist/services/product/index.d.ts.map +1 -1
- 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 +112 -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 +93 -10
- package/dist/services/subscription/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -273,15 +273,140 @@ function createCustomerService(options) {
|
|
|
273
273
|
const result = await options.adapter.getCurrent();
|
|
274
274
|
if (result._tag === "Success") current.value = result.data;
|
|
275
275
|
return result;
|
|
276
|
+
},
|
|
277
|
+
createPaymentMethod(params) {
|
|
278
|
+
return options.adapter.createPaymentMethod(params);
|
|
276
279
|
}
|
|
277
280
|
};
|
|
278
281
|
}
|
|
279
282
|
const CustomerServiceContext = createContext("services/customer");
|
|
283
|
+
const PAYMENT_INSTRUMENT_TYPES = [
|
|
284
|
+
"credit_card",
|
|
285
|
+
"paypal",
|
|
286
|
+
"shop_pay",
|
|
287
|
+
"sepa_direct_debit",
|
|
288
|
+
"blik",
|
|
289
|
+
"mbway",
|
|
290
|
+
"bacs"
|
|
291
|
+
];
|
|
292
|
+
const INSTRUMENT_TYPE_TO_NAME = {
|
|
293
|
+
credit_card: null,
|
|
294
|
+
paypal: "PayPal",
|
|
295
|
+
blik: "BLIK",
|
|
296
|
+
sepa_direct_debit: "SEPA",
|
|
297
|
+
mbway: "MB WAY",
|
|
298
|
+
shop_pay: "Shop Pay",
|
|
299
|
+
bacs: "Bacs"
|
|
300
|
+
};
|
|
301
|
+
function getPaymentInstrumentName(instrument) {
|
|
302
|
+
const name = INSTRUMENT_TYPE_TO_NAME[instrument.type] ?? null;
|
|
303
|
+
if (name != null) return name;
|
|
304
|
+
return instrument.type === "credit_card" ? instrument.brand || instrument.type : instrument.type;
|
|
305
|
+
}
|
|
306
|
+
function getPaymentInstrumentDigits(instrument) {
|
|
307
|
+
switch (instrument.type) {
|
|
308
|
+
case "credit_card":
|
|
309
|
+
case "shop_pay":
|
|
310
|
+
case "bacs":
|
|
311
|
+
return instrument.maskedNumber.slice(-4) || null;
|
|
312
|
+
case "sepa_direct_debit":
|
|
313
|
+
return instrument.consumerAccount.slice(-4) || null;
|
|
314
|
+
default:
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
function getPaymentInstrumentDetail(instrument) {
|
|
319
|
+
switch (instrument.type) {
|
|
320
|
+
case "paypal":
|
|
321
|
+
return instrument.paypalAccountEmail ?? null;
|
|
322
|
+
case "sepa_direct_debit":
|
|
323
|
+
return instrument.consumerName ?? null;
|
|
324
|
+
case "blik":
|
|
325
|
+
return instrument.label ?? null;
|
|
326
|
+
case "mbway":
|
|
327
|
+
return instrument.phone ?? null;
|
|
328
|
+
default:
|
|
329
|
+
return null;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
function getPaymentInstrumentExpiry(instrument, now = /* @__PURE__ */ new Date()) {
|
|
333
|
+
if (instrument.type !== "credit_card" && instrument.type !== "shop_pay") {
|
|
334
|
+
return null;
|
|
335
|
+
}
|
|
336
|
+
const { expiryMonth: month, expiryYear: year } = instrument;
|
|
337
|
+
if (month == null || year == null) return null;
|
|
338
|
+
const nowYear = now.getFullYear();
|
|
339
|
+
const nowMonth = now.getMonth() + 1;
|
|
340
|
+
const expiresThisMonth = year === nowYear && month === nowMonth;
|
|
341
|
+
const isExpired = year < nowYear || year === nowYear && month < nowMonth;
|
|
342
|
+
return { month, year, isExpired, expiresThisMonth };
|
|
343
|
+
}
|
|
344
|
+
function serializeV1PaymentInstrument(raw) {
|
|
345
|
+
if (raw == null || typeof raw !== "object") return null;
|
|
346
|
+
const r2 = raw;
|
|
347
|
+
if (typeof r2.type !== "string") return null;
|
|
348
|
+
switch (r2.type) {
|
|
349
|
+
case "credit-card":
|
|
350
|
+
return {
|
|
351
|
+
type: "credit_card",
|
|
352
|
+
brand: r2.brand ?? "",
|
|
353
|
+
maskedNumber: r2.maskedNumber ?? "",
|
|
354
|
+
...r2.expiryMonth != null ? { expiryMonth: r2.expiryMonth } : {},
|
|
355
|
+
...r2.expiryYear != null ? { expiryYear: r2.expiryYear } : {},
|
|
356
|
+
...r2.cardholderName != null ? { cardholderName: r2.cardholderName } : {}
|
|
357
|
+
};
|
|
358
|
+
case "paypal":
|
|
359
|
+
return { type: "paypal", paypalAccountEmail: r2.paypalAccountEmail ?? null };
|
|
360
|
+
case "shop-pay":
|
|
361
|
+
return {
|
|
362
|
+
type: "shop_pay",
|
|
363
|
+
maskedNumber: r2.maskedNumber ?? "",
|
|
364
|
+
...r2.expiryMonth != null ? { expiryMonth: r2.expiryMonth } : {},
|
|
365
|
+
...r2.expiryYear != null ? { expiryYear: r2.expiryYear } : {},
|
|
366
|
+
...r2.cardholderName != null ? { cardholderName: r2.cardholderName } : {}
|
|
367
|
+
};
|
|
368
|
+
case "sepa-direct-debit":
|
|
369
|
+
return {
|
|
370
|
+
type: "sepa_direct_debit",
|
|
371
|
+
consumerName: r2.consumerName ?? "",
|
|
372
|
+
consumerBic: r2.consumerBic ?? null,
|
|
373
|
+
consumerAccount: r2.maskedConsumerAccount ?? ""
|
|
374
|
+
};
|
|
375
|
+
case "blik":
|
|
376
|
+
return { type: "blik" };
|
|
377
|
+
case "mbway":
|
|
378
|
+
return { type: "mbway", ...r2.phone != null ? { phone: r2.phone } : {} };
|
|
379
|
+
case "bacs":
|
|
380
|
+
return { type: "bacs", maskedNumber: r2.maskedNumber ?? "" };
|
|
381
|
+
default:
|
|
382
|
+
return null;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
280
385
|
function createMockCustomerAdapter() {
|
|
281
386
|
const customer = { id: "customer-1", name: "Customer 1" };
|
|
282
387
|
return {
|
|
283
388
|
async getCurrent() {
|
|
284
389
|
return { _tag: "Success", data: customer };
|
|
390
|
+
},
|
|
391
|
+
async createPaymentMethod(params) {
|
|
392
|
+
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
393
|
+
if (params.provider === "shopify") {
|
|
394
|
+
return {
|
|
395
|
+
_tag: "Success",
|
|
396
|
+
data: {
|
|
397
|
+
kind: "email_sent",
|
|
398
|
+
paymentMethodId: "pm_mock_1",
|
|
399
|
+
instrument: { type: "credit_card", brand: "visa", maskedNumber: "•••• 4242" }
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
if (params.provider === "mollie") {
|
|
404
|
+
return {
|
|
405
|
+
_tag: "Success",
|
|
406
|
+
data: { kind: "redirect", redirectUrl: params.returnUrl }
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
return { _tag: "Failure", error: new Error(`Payment provider "${params.provider}" is not supported`) };
|
|
285
410
|
}
|
|
286
411
|
};
|
|
287
412
|
}
|
|
@@ -300,6 +425,41 @@ function createApiCustomerAdapter(fetcher) {
|
|
|
300
425
|
} catch (e) {
|
|
301
426
|
return { _tag: "Failure", error: e };
|
|
302
427
|
}
|
|
428
|
+
},
|
|
429
|
+
async createPaymentMethod(params) {
|
|
430
|
+
try {
|
|
431
|
+
if (params.provider === "shopify") {
|
|
432
|
+
const res = await fetcher("/customer/v1/payment-methods", {
|
|
433
|
+
method: "POST"
|
|
434
|
+
});
|
|
435
|
+
if (!res.ok) return { _tag: "Failure", error: `HTTP ${res.status}` };
|
|
436
|
+
const body = await res.json();
|
|
437
|
+
return {
|
|
438
|
+
_tag: "Success",
|
|
439
|
+
data: {
|
|
440
|
+
kind: "email_sent",
|
|
441
|
+
paymentMethodId: body.id,
|
|
442
|
+
instrument: serializeV1PaymentInstrument(body.instrument) ?? void 0
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
if (params.provider === "mollie") {
|
|
447
|
+
const res = await fetcher("/customer/payment-methods", {
|
|
448
|
+
method: "POST",
|
|
449
|
+
headers: { "Content-Type": "application/json" },
|
|
450
|
+
body: JSON.stringify({ redirectUrl: params.returnUrl })
|
|
451
|
+
});
|
|
452
|
+
if (!res.ok) return { _tag: "Failure", error: `HTTP ${res.status}` };
|
|
453
|
+
const body = await res.json();
|
|
454
|
+
return {
|
|
455
|
+
_tag: "Success",
|
|
456
|
+
data: { kind: "redirect", redirectUrl: body.redirectUrl }
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
return { _tag: "Failure", error: new Error(`Payment provider "${params.provider}" is not supported`) };
|
|
460
|
+
} catch (e) {
|
|
461
|
+
return { _tag: "Failure", error: e };
|
|
462
|
+
}
|
|
303
463
|
}
|
|
304
464
|
};
|
|
305
465
|
}
|
|
@@ -1064,6 +1224,13 @@ function mapVariant(variant, currencyCode) {
|
|
|
1064
1224
|
} : {}
|
|
1065
1225
|
};
|
|
1066
1226
|
}
|
|
1227
|
+
const IDENTIFIER = String.raw`[a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*`;
|
|
1228
|
+
const VALUE = String.raw`(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|${IDENTIFIER})`;
|
|
1229
|
+
const TERM = String.raw`(?:NOT\s+|-)?${IDENTIFIER}:(?:>=|<=|>|<)?${VALUE}`;
|
|
1230
|
+
const FILTER_QUERY = new RegExp(String.raw`^${TERM}(?:\s+(?:AND|OR)\s+${TERM})*$`);
|
|
1231
|
+
function isFilterQuery(query) {
|
|
1232
|
+
return FILTER_QUERY.test(query);
|
|
1233
|
+
}
|
|
1067
1234
|
function mapProduct(product, currencyCode) {
|
|
1068
1235
|
return {
|
|
1069
1236
|
id: product.id,
|
|
@@ -1116,7 +1283,11 @@ function createApiProductAdapter(fetcher, opts = { currencyCode: "USD" }) {
|
|
|
1116
1283
|
try {
|
|
1117
1284
|
const params = new URLSearchParams();
|
|
1118
1285
|
if (opts2 == null ? void 0 : opts2.query) {
|
|
1119
|
-
|
|
1286
|
+
const trimmed = opts2.query.trim();
|
|
1287
|
+
params.set(
|
|
1288
|
+
"query",
|
|
1289
|
+
isFilterQuery(trimmed) ? trimmed : `"${trimmed.replace(/"/g, '\\"')}"`
|
|
1290
|
+
);
|
|
1120
1291
|
}
|
|
1121
1292
|
if (opts2 == null ? void 0 : opts2.pagination) {
|
|
1122
1293
|
if ("after" in opts2.pagination)
|
|
@@ -1310,6 +1481,12 @@ const DISCOUNT_REJECTION_REASONS = [
|
|
|
1310
1481
|
function toAttributeArray(next) {
|
|
1311
1482
|
return Object.entries(next).map(([key, value]) => ({ key, value }));
|
|
1312
1483
|
}
|
|
1484
|
+
function toNonEmptyAttributeArray(next) {
|
|
1485
|
+
if (next == null) return [];
|
|
1486
|
+
return toAttributeArray(next).filter(
|
|
1487
|
+
({ key, value }) => key !== "" && value !== ""
|
|
1488
|
+
);
|
|
1489
|
+
}
|
|
1313
1490
|
function createMockSubscriptionAdapter(options = {}) {
|
|
1314
1491
|
const richBase = (id, itemId, renewalId) => ({
|
|
1315
1492
|
id,
|
|
@@ -1373,7 +1550,24 @@ function createMockSubscriptionAdapter(options = {}) {
|
|
|
1373
1550
|
renewal: { id: renewalId, isInActiveProcessState: false },
|
|
1374
1551
|
lastPaymentStatus: "succeeded",
|
|
1375
1552
|
pausePeriod: null,
|
|
1376
|
-
isEditable: true
|
|
1553
|
+
isEditable: true,
|
|
1554
|
+
// Shaped like the v1 mapping produces it: one option slot filled, no
|
|
1555
|
+
// presentmentTitle (v1 has no such field). Previews would otherwise render
|
|
1556
|
+
// ContractSelect's address / method rows as "-".
|
|
1557
|
+
deliveryMethod: {
|
|
1558
|
+
address: {
|
|
1559
|
+
firstName: "Ada",
|
|
1560
|
+
lastName: "Lovelace",
|
|
1561
|
+
address1: "Wilcza 12/4",
|
|
1562
|
+
zip: "00-538",
|
|
1563
|
+
city: "Warsaw",
|
|
1564
|
+
country: "Poland",
|
|
1565
|
+
countryCode: "PL"
|
|
1566
|
+
},
|
|
1567
|
+
shippingOption: { title: "Standard shipping" },
|
|
1568
|
+
pickupOption: null,
|
|
1569
|
+
localDeliveryOption: null
|
|
1570
|
+
}
|
|
1377
1571
|
});
|
|
1378
1572
|
const mockSubscriptions = [
|
|
1379
1573
|
{
|
|
@@ -1442,6 +1636,20 @@ function createMockSubscriptionAdapter(options = {}) {
|
|
|
1442
1636
|
lastPaymentStatus: "succeeded",
|
|
1443
1637
|
pausePeriod: null,
|
|
1444
1638
|
isEditable: true,
|
|
1639
|
+
deliveryMethod: {
|
|
1640
|
+
address: {
|
|
1641
|
+
firstName: "Ada",
|
|
1642
|
+
lastName: "Lovelace",
|
|
1643
|
+
address1: "Wilcza 12/4",
|
|
1644
|
+
zip: "00-538",
|
|
1645
|
+
city: "Warsaw",
|
|
1646
|
+
country: "Poland",
|
|
1647
|
+
countryCode: "PL"
|
|
1648
|
+
},
|
|
1649
|
+
shippingOption: { title: "DHL Express" },
|
|
1650
|
+
pickupOption: null,
|
|
1651
|
+
localDeliveryOption: null
|
|
1652
|
+
},
|
|
1445
1653
|
customAttributes: [
|
|
1446
1654
|
{ key: "subscription_tier", value: "premium" },
|
|
1447
1655
|
{ key: "gift_message", value: "Enjoy your skincare routine!" }
|
|
@@ -1473,6 +1681,14 @@ function createMockSubscriptionAdapter(options = {}) {
|
|
|
1473
1681
|
frequency: "2 WEEK",
|
|
1474
1682
|
createdAt: "2024-09-15T00:00:00Z",
|
|
1475
1683
|
updatedAt: "2024-10-10T00:00:00Z",
|
|
1684
|
+
// Pickup, with no address — the other branch of the option coalescing in
|
|
1685
|
+
// ContractSelect's delivery-method label.
|
|
1686
|
+
deliveryMethod: {
|
|
1687
|
+
address: null,
|
|
1688
|
+
shippingOption: null,
|
|
1689
|
+
pickupOption: { title: "Pickup in store" },
|
|
1690
|
+
localDeliveryOption: null
|
|
1691
|
+
},
|
|
1476
1692
|
customAttributes: []
|
|
1477
1693
|
},
|
|
1478
1694
|
// Per-status fixtures: groundwork for the deferred editor preview picker
|
|
@@ -1481,18 +1697,55 @@ function createMockSubscriptionAdapter(options = {}) {
|
|
|
1481
1697
|
{
|
|
1482
1698
|
...richBase("sub_paused", "item_paused", "ren_paused"),
|
|
1483
1699
|
status: "paused",
|
|
1484
|
-
pausePeriod: { start: "2025-11-01T00:00:00Z", end: "2026-01-01T00:00:00Z" }
|
|
1700
|
+
pausePeriod: { start: "2025-11-01T00:00:00Z", end: "2026-01-01T00:00:00Z" },
|
|
1701
|
+
// BLIK with a non-recurring alias — the shape that gates the
|
|
1702
|
+
// re-authorization prompt in RenewalSummary. Only the legacy-sourced
|
|
1703
|
+
// payment method can express this, so previews would otherwise never
|
|
1704
|
+
// exercise the branch.
|
|
1705
|
+
customerPaymentMethod: {
|
|
1706
|
+
id: "pm_blik",
|
|
1707
|
+
instrument: { type: "blik", label: "my-blik-alias" },
|
|
1708
|
+
active: true,
|
|
1709
|
+
isRecurring: false
|
|
1710
|
+
}
|
|
1485
1711
|
},
|
|
1486
1712
|
{
|
|
1487
1713
|
...richBase("sub_canceled", "item_canceled", "ren_canceled"),
|
|
1488
1714
|
status: "canceled",
|
|
1489
|
-
pausePeriod: null
|
|
1715
|
+
pausePeriod: null,
|
|
1716
|
+
// SEPA — identified by a masked IBAN rather than card digits.
|
|
1717
|
+
customerPaymentMethod: {
|
|
1718
|
+
id: "pm_sepa",
|
|
1719
|
+
instrument: {
|
|
1720
|
+
type: "sepa_direct_debit",
|
|
1721
|
+
consumerName: "Ada Lovelace",
|
|
1722
|
+
consumerBic: "ABCDEFGH",
|
|
1723
|
+
consumerAccount: "DE12****6789"
|
|
1724
|
+
},
|
|
1725
|
+
active: true,
|
|
1726
|
+
isRecurring: true
|
|
1727
|
+
}
|
|
1490
1728
|
},
|
|
1491
1729
|
{
|
|
1492
1730
|
...richBase("sub_failed", "item_failed", "ren_failed"),
|
|
1493
1731
|
status: "failed",
|
|
1494
1732
|
lastPaymentStatus: "failed",
|
|
1495
|
-
pausePeriod: null
|
|
1733
|
+
pausePeriod: null,
|
|
1734
|
+
// An expired card — pairs with the failed payment, and exercises
|
|
1735
|
+
// getPaymentInstrumentExpiry's isExpired branch.
|
|
1736
|
+
customerPaymentMethod: {
|
|
1737
|
+
id: "pm_expired_card",
|
|
1738
|
+
instrument: {
|
|
1739
|
+
type: "credit_card",
|
|
1740
|
+
brand: "mastercard",
|
|
1741
|
+
maskedNumber: "************5100",
|
|
1742
|
+
expiryMonth: 1,
|
|
1743
|
+
expiryYear: 2024,
|
|
1744
|
+
cardholderName: "Ada Lovelace"
|
|
1745
|
+
},
|
|
1746
|
+
active: true,
|
|
1747
|
+
isRecurring: true
|
|
1748
|
+
}
|
|
1496
1749
|
},
|
|
1497
1750
|
{
|
|
1498
1751
|
...richBase("sub_expired", "item_expired", "ren_expired"),
|
|
@@ -1591,7 +1844,8 @@ function createMockSubscriptionAdapter(options = {}) {
|
|
|
1591
1844
|
// An explicit per-line billingPolicy wins; otherwise inherit the plan's.
|
|
1592
1845
|
billingPolicy: item.billingPolicy ?? ((_f = subscription.items[0]) == null ? void 0 : _f.billingPolicy) ?? subscription.billingPolicy ?? null,
|
|
1593
1846
|
deliveryPolicy: ((_g = subscription.items[0]) == null ? void 0 : _g.deliveryPolicy) ?? subscription.deliveryPolicy ?? null,
|
|
1594
|
-
...item.recurringCycleLimit != null ? { recurringCycleLimit: item.recurringCycleLimit } : {}
|
|
1847
|
+
...item.recurringCycleLimit != null ? { recurringCycleLimit: item.recurringCycleLimit } : {},
|
|
1848
|
+
...item.customAttributes != null ? { customAttributes: toAttributeArray(item.customAttributes) } : {}
|
|
1595
1849
|
});
|
|
1596
1850
|
subscription.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1597
1851
|
return { _tag: "Success", data: void 0 };
|
|
@@ -1619,6 +1873,9 @@ function createMockSubscriptionAdapter(options = {}) {
|
|
|
1619
1873
|
if (update.variantId !== void 0) item.variantId = update.variantId;
|
|
1620
1874
|
if (update.quantity !== void 0) item.quantity = update.quantity;
|
|
1621
1875
|
if (update.billingPolicy !== void 0) item.billingPolicy = update.billingPolicy;
|
|
1876
|
+
if (update.customAttributes !== void 0) {
|
|
1877
|
+
item.customAttributes = toAttributeArray(update.customAttributes);
|
|
1878
|
+
}
|
|
1622
1879
|
subscription.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1623
1880
|
return { _tag: "Success", data: void 0 };
|
|
1624
1881
|
},
|
|
@@ -1837,24 +2094,74 @@ function createMockSubscriptionAdapter(options = {}) {
|
|
|
1837
2094
|
}
|
|
1838
2095
|
};
|
|
1839
2096
|
}
|
|
1840
|
-
function
|
|
1841
|
-
return
|
|
2097
|
+
function mapV1Instrument(raw) {
|
|
2098
|
+
return serializeV1PaymentInstrument(raw);
|
|
2099
|
+
}
|
|
2100
|
+
function mapV1BillingAddress(raw) {
|
|
2101
|
+
if (raw == null || typeof raw !== "object") return null;
|
|
2102
|
+
const address = {
|
|
2103
|
+
firstName: raw.firstName ?? null,
|
|
2104
|
+
lastName: raw.lastName ?? null,
|
|
2105
|
+
address1: raw.address1 ?? null,
|
|
2106
|
+
address2: raw.address2 ?? null,
|
|
2107
|
+
zip: raw.zip ?? null,
|
|
2108
|
+
city: raw.city ?? null,
|
|
2109
|
+
country: raw.country ?? null,
|
|
2110
|
+
countryCode: raw.countryCode ?? null,
|
|
2111
|
+
province: raw.province ?? null,
|
|
2112
|
+
provinceCode: raw.provinceCode ?? null,
|
|
2113
|
+
phone: raw.phone ?? null,
|
|
2114
|
+
company: raw.company ?? null
|
|
2115
|
+
};
|
|
2116
|
+
return Object.values(address).some((v3) => v3 != null) ? address : null;
|
|
2117
|
+
}
|
|
2118
|
+
function mapV1DeliveryAddress(raw) {
|
|
2119
|
+
if (raw == null || typeof raw !== "object") return null;
|
|
2120
|
+
const address = {
|
|
2121
|
+
...raw.firstName != null ? { firstName: raw.firstName } : {},
|
|
2122
|
+
...raw.lastName != null ? { lastName: raw.lastName } : {},
|
|
2123
|
+
...raw.address1 != null ? { address1: raw.address1 } : {},
|
|
2124
|
+
...raw.address2 != null ? { address2: raw.address2 } : {},
|
|
2125
|
+
...raw.zip != null ? { zip: raw.zip } : {},
|
|
2126
|
+
...raw.city != null ? { city: raw.city } : {},
|
|
2127
|
+
...raw.country != null ? { country: raw.country } : {},
|
|
2128
|
+
...raw.countryCode != null ? { countryCode: raw.countryCode } : {},
|
|
2129
|
+
...raw.province != null ? { province: raw.province } : {},
|
|
2130
|
+
...raw.provinceCode != null ? { provinceCode: raw.provinceCode } : {},
|
|
2131
|
+
...raw.phone != null ? { phone: raw.phone } : {},
|
|
2132
|
+
...raw.company != null ? { company: raw.company } : {}
|
|
2133
|
+
};
|
|
2134
|
+
return Object.keys(address).length > 0 ? address : null;
|
|
2135
|
+
}
|
|
2136
|
+
function mapV1DeliveryMethod(raw) {
|
|
2137
|
+
const address = mapV1DeliveryAddress(raw == null ? void 0 : raw.deliveryAddress);
|
|
2138
|
+
const method = raw == null ? void 0 : raw.deliveryMethod;
|
|
2139
|
+
if (address == null && (method == null || typeof method !== "object")) {
|
|
2140
|
+
return null;
|
|
2141
|
+
}
|
|
2142
|
+
const option = method != null && typeof method === "object" ? {
|
|
2143
|
+
...method.title != null ? { title: method.title } : {},
|
|
2144
|
+
...method.description != null ? { description: method.description } : {}
|
|
2145
|
+
} : null;
|
|
2146
|
+
return {
|
|
2147
|
+
address,
|
|
2148
|
+
shippingOption: (method == null ? void 0 : method.type) === "shipping" ? option : null,
|
|
2149
|
+
pickupOption: (method == null ? void 0 : method.type) === "pickup" ? option : null,
|
|
2150
|
+
localDeliveryOption: (method == null ? void 0 : method.type) === "local-delivery" ? option : null
|
|
2151
|
+
};
|
|
1842
2152
|
}
|
|
1843
2153
|
function mapPaymentMethod(rawPm) {
|
|
1844
2154
|
if (!rawPm) return null;
|
|
1845
2155
|
if (typeof rawPm === "string") {
|
|
1846
2156
|
return { id: rawPm };
|
|
1847
2157
|
}
|
|
2158
|
+
const instrument = mapV1Instrument(rawPm.instrument);
|
|
2159
|
+
const billingAddress = mapV1BillingAddress(rawPm.billingAddress);
|
|
1848
2160
|
return {
|
|
1849
2161
|
id: rawPm.id ?? "",
|
|
1850
|
-
...
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
type: normalizeInstrumentType(rawPm.instrument.type)
|
|
1854
|
-
}
|
|
1855
|
-
} : {},
|
|
1856
|
-
...rawPm.active != null ? { active: rawPm.active } : {},
|
|
1857
|
-
...rawPm.isRecurring != null ? { isRecurring: rawPm.isRecurring } : {}
|
|
2162
|
+
...instrument != null ? { instrument } : {},
|
|
2163
|
+
// v1 is the ONLY customer-facing source of a billing address.
|
|
2164
|
+
...billingAddress != null ? { billingAddress } : {}
|
|
1858
2165
|
};
|
|
1859
2166
|
}
|
|
1860
2167
|
function mapSubscription(raw) {
|
|
@@ -1908,6 +2215,8 @@ function mapSubscription(raw) {
|
|
|
1908
2215
|
// Map customerPaymentMethod — expanded to an object (id + instrument) via the
|
|
1909
2216
|
// adapter's ?expand=paymentMethod request; mapPaymentMethod tolerates a bare id too.
|
|
1910
2217
|
customerPaymentMethod: mapPaymentMethod(raw.paymentMethod),
|
|
2218
|
+
// v1 returns deliveryAddress + deliveryMethod on every read, no expand needed.
|
|
2219
|
+
deliveryMethod: mapV1DeliveryMethod(raw),
|
|
1911
2220
|
frequency,
|
|
1912
2221
|
createdAt: raw.createdAt,
|
|
1913
2222
|
updatedAt: raw.updatedAt,
|
|
@@ -1989,6 +2298,7 @@ function createApiSubscriptionAdapter(fetcher) {
|
|
|
1989
2298
|
// product picker already does.
|
|
1990
2299
|
async addItem({ subscriptionId, item }) {
|
|
1991
2300
|
try {
|
|
2301
|
+
const attributes = toNonEmptyAttributeArray(item.customAttributes);
|
|
1992
2302
|
const body = {
|
|
1993
2303
|
productVariantId: item.variantId,
|
|
1994
2304
|
quantity: item.quantity,
|
|
@@ -1996,7 +2306,8 @@ function createApiSubscriptionAdapter(fetcher) {
|
|
|
1996
2306
|
// endpoint rejects an explicit null on either field.
|
|
1997
2307
|
...item.billingPolicy != null ? { billingPolicy: item.billingPolicy } : {},
|
|
1998
2308
|
...item.recurringCycleLimit != null ? { renewalLimit: item.recurringCycleLimit } : {},
|
|
1999
|
-
...item.shippingMethodHandle != null ? { shippingMethodHandle: item.shippingMethodHandle } : {}
|
|
2309
|
+
...item.shippingMethodHandle != null ? { shippingMethodHandle: item.shippingMethodHandle } : {},
|
|
2310
|
+
...attributes.length > 0 ? { customAttributes: attributes } : {}
|
|
2000
2311
|
};
|
|
2001
2312
|
const res = await fetcher(
|
|
2002
2313
|
`/customer/subscriptions/${subscriptionId}/lines`,
|
|
@@ -2030,7 +2341,11 @@ function createApiSubscriptionAdapter(fetcher) {
|
|
|
2030
2341
|
...update.variantId !== void 0 ? { productVariantId: update.variantId } : {},
|
|
2031
2342
|
...update.quantity !== void 0 ? { quantity: update.quantity } : {},
|
|
2032
2343
|
...update.billingPolicy !== void 0 ? { billingPolicy: update.billingPolicy } : {},
|
|
2033
|
-
...update.shippingMethodHandle !== void 0 ? { shippingMethodHandle: update.shippingMethodHandle } : {}
|
|
2344
|
+
...update.shippingMethodHandle !== void 0 ? { shippingMethodHandle: update.shippingMethodHandle } : {},
|
|
2345
|
+
// Record shape (not the array the add-line endpoint takes). Guarded on
|
|
2346
|
+
// `!== undefined` so `{}` — clear every customer-visible attribute —
|
|
2347
|
+
// reaches the endpoint instead of being dropped as falsy.
|
|
2348
|
+
...update.customAttributes !== void 0 ? { customAttributes: update.customAttributes } : {}
|
|
2034
2349
|
};
|
|
2035
2350
|
const res = await fetcher(
|
|
2036
2351
|
`/customer/subscriptions/${subscriptionId}/lines/${lineId}`,
|
|
@@ -4225,6 +4540,7 @@ export {
|
|
|
4225
4540
|
OrderServiceContext,
|
|
4226
4541
|
OverlayServiceContext,
|
|
4227
4542
|
P as PAGE_ROOT_SLOT,
|
|
4543
|
+
PAYMENT_INSTRUMENT_TYPES,
|
|
4228
4544
|
ProductServiceContext,
|
|
4229
4545
|
RouterServiceContext,
|
|
4230
4546
|
SchedulesServiceContext,
|
|
@@ -4301,6 +4617,10 @@ export {
|
|
|
4301
4617
|
getDefinedBlocks,
|
|
4302
4618
|
F as getDevtoolsBlockState,
|
|
4303
4619
|
getLayoutModeAdapter,
|
|
4620
|
+
getPaymentInstrumentDetail,
|
|
4621
|
+
getPaymentInstrumentDigits,
|
|
4622
|
+
getPaymentInstrumentExpiry,
|
|
4623
|
+
getPaymentInstrumentName,
|
|
4304
4624
|
gridV1Engine,
|
|
4305
4625
|
hasDefaultBlockForAction,
|
|
4306
4626
|
G as hasRenderedContent,
|
|
@@ -4308,6 +4628,7 @@ export {
|
|
|
4308
4628
|
i as injectContext,
|
|
4309
4629
|
insertRectRelative,
|
|
4310
4630
|
H as isEditorPreview,
|
|
4631
|
+
isFilterQuery,
|
|
4311
4632
|
b as isStubDefinition,
|
|
4312
4633
|
t2 as layoutScopeSelector,
|
|
4313
4634
|
I as layoutSystemEnabled,
|
|
@@ -4325,6 +4646,7 @@ export {
|
|
|
4325
4646
|
resetBreakpoint,
|
|
4326
4647
|
r as resolveLayout,
|
|
4327
4648
|
k as serializeBlocks,
|
|
4649
|
+
serializeV1PaymentInstrument,
|
|
4328
4650
|
setActiveSurfaceContext,
|
|
4329
4651
|
K as setDevtoolsBlockProp,
|
|
4330
4652
|
setLayoutCommandDispatcher,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Customer } from './types';
|
|
1
|
+
import { Customer, CreatePaymentMethodParams, CreatePaymentMethodOutcome } from './types';
|
|
2
2
|
import { ApiFetcher, Result } from '../../utils';
|
|
3
3
|
export interface CustomerAdapter {
|
|
4
4
|
getCurrent(): Promise<Result<Customer | null>>;
|
|
5
|
+
createPaymentMethod(params: CreatePaymentMethodParams): Promise<Result<CreatePaymentMethodOutcome>>;
|
|
5
6
|
}
|
|
6
7
|
export declare function createMockCustomerAdapter(): CustomerAdapter;
|
|
7
8
|
export declare function createApiCustomerAdapter(fetcher: ApiFetcher): CustomerAdapter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/services/customer/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/services/customer/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAC/F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGtD,MAAM,WAAW,eAAe;IAC9B,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC;IAC/C,mBAAmB,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC,CAAC;CACrG;AAED,wBAAgB,yBAAyB,IAAI,eAAe,CA2B3D;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,UAAU,GAAG,eAAe,CA4D7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customerService.d.ts","sourceRoot":"","sources":["../../../src/services/customer/customerService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,SAAS,CAAC;AAEzD,KAAK,4BAA4B,GAAG;IAClC,OAAO,EAAE,eAAe,CAAC;IACzB;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,MAAM,CAAC;CACnC,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,4BAA4B,GACpC,eAAe,
|
|
1
|
+
{"version":3,"file":"customerService.d.ts","sourceRoot":"","sources":["../../../src/services/customer/customerService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,SAAS,CAAC;AAEzD,KAAK,4BAA4B,GAAG;IAClC,OAAO,EAAE,eAAe,CAAC;IACzB;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,MAAM,CAAC;CACnC,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,4BAA4B,GACpC,eAAe,CAgBjB;AAED,eAAO,MAAM,sBAAsB;;CACkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customerService.test.d.ts","sourceRoot":"","sources":["../../../src/services/customer/customerService.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { type CustomerService, type Customer } from './types';
|
|
1
|
+
export { type CustomerService, type Customer, type CreatePaymentMethodParams, type CreatePaymentMethodOutcome } from './types';
|
|
2
2
|
export { createCustomerService, CustomerServiceContext, } from './customerService';
|
|
3
3
|
export { type CustomerAdapter, createMockCustomerAdapter, createApiCustomerAdapter, } from './adapter';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/customer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/customer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,KAAK,yBAAyB,EAAE,KAAK,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAC/H,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,eAAe,EACpB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,WAAW,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Signal } from '@preact/signals-core';
|
|
2
2
|
import { Result } from '../../utils';
|
|
3
|
+
import { SubscriptionPaymentInstrument } from '../subscription/paymentInstrument';
|
|
3
4
|
/** Signed-in customer identity for blocks such as Header (name / email display). */
|
|
4
5
|
export type Customer = {
|
|
5
6
|
id: string;
|
|
@@ -7,9 +8,24 @@ export type Customer = {
|
|
|
7
8
|
email?: string;
|
|
8
9
|
metadata?: Record<string, unknown>;
|
|
9
10
|
};
|
|
11
|
+
export type CreatePaymentMethodParams = {
|
|
12
|
+
provider: "shopify";
|
|
13
|
+
} | {
|
|
14
|
+
provider: "mollie" | "stripe";
|
|
15
|
+
returnUrl: string;
|
|
16
|
+
};
|
|
17
|
+
export type CreatePaymentMethodOutcome = {
|
|
18
|
+
kind: "email_sent";
|
|
19
|
+
paymentMethodId: string;
|
|
20
|
+
instrument?: SubscriptionPaymentInstrument;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "redirect";
|
|
23
|
+
redirectUrl: string;
|
|
24
|
+
};
|
|
10
25
|
export type CustomerService = {
|
|
11
26
|
current: Signal<Customer | null>;
|
|
12
27
|
getCurrent(): Promise<Result<Customer | null>>;
|
|
28
|
+
createPaymentMethod(params: CreatePaymentMethodParams): Promise<Result<CreatePaymentMethodOutcome>>;
|
|
13
29
|
accountOrdersUrl: Signal<string>;
|
|
14
30
|
};
|
|
15
31
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/customer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/customer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAEvF,oFAAoF;AACpF,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GACjC;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,GACvB;IAAE,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzD,MAAM,MAAM,0BAA0B,GAClC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,eAAe,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,6BAA6B,CAAA;CAAE,GAC3F;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IACjC,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC;IAC/C,mBAAmB,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC,CAAC;IACpG,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;CAClC,CAAC"}
|
|
@@ -7,6 +7,36 @@ import { AvailableProduct, Box, Product, WithVariants } from './types';
|
|
|
7
7
|
export interface ProductAdapter {
|
|
8
8
|
getById(id: string): Promise<WithVariants<Product> | null>;
|
|
9
9
|
getByVariantId(variantId: string): Promise<WithVariants<Product> | null>;
|
|
10
|
+
/**
|
|
11
|
+
* Search products.
|
|
12
|
+
*
|
|
13
|
+
* `query` accepts either plain text (full-text search) or field:value filter
|
|
14
|
+
* syntax parsed by the backend grammar. Detection is automatic:
|
|
15
|
+
*
|
|
16
|
+
* - Plain text (`"coffee beans"`): wrapped in double quotes by the adapter
|
|
17
|
+
* and sent as a full-text search term.
|
|
18
|
+
* - Filter syntax (`"collections.handle:featured"`, `"id:abc OR id:def"`,
|
|
19
|
+
* `"status:active"`): passed through unquoted so the backend parses it
|
|
20
|
+
* into structured filters.
|
|
21
|
+
*
|
|
22
|
+
* Detection is anchored: the *entire* query must be a filter expression —
|
|
23
|
+
* `field:value` terms, optionally negated with `-`/`NOT` and joined by
|
|
24
|
+
* `AND`/`OR`. Plain text that merely contains a colon (`"size:large shoes"`)
|
|
25
|
+
* is treated as text, not as a filter on an unknown `size` field.
|
|
26
|
+
*
|
|
27
|
+
* Values containing anything other than letters, digits and dots must be
|
|
28
|
+
* quoted by the caller — `collections.handle:"summer-sale"`, not
|
|
29
|
+
* `collections.handle:summer-sale`, since the grammar's identifier rule
|
|
30
|
+
* excludes hyphens. An unquoted value falls back to full-text search.
|
|
31
|
+
*
|
|
32
|
+
* A single-token query like `"time:10"` is genuinely ambiguous and is read
|
|
33
|
+
* as a filter. Pass free text through a search box only if that is
|
|
34
|
+
* acceptable.
|
|
35
|
+
*
|
|
36
|
+
* Filterable fields depend on the endpoint. Unknown fields produce a 400
|
|
37
|
+
* `INVALID_QUERY_FIELDS`; malformed syntax produces a 400
|
|
38
|
+
* `INVALID_SEARCH_QUERY`.
|
|
39
|
+
*/
|
|
10
40
|
search(opts?: {
|
|
11
41
|
query?: string;
|
|
12
42
|
pagination?: {
|
|
@@ -39,6 +69,18 @@ export interface ProductAdapter {
|
|
|
39
69
|
}): Promise<Box | null>;
|
|
40
70
|
}
|
|
41
71
|
export declare function createMockProductAdapter(): ProductAdapter;
|
|
72
|
+
/**
|
|
73
|
+
* Whether `query` is a complete field:value filter expression rather than
|
|
74
|
+
* plain text.
|
|
75
|
+
*
|
|
76
|
+
* The match is anchored: the *whole* string must be a filter expression.
|
|
77
|
+
* Plain text that merely contains a colon (`"size:large shoes"`) is not a
|
|
78
|
+
* filter query and is sent as full-text search, which is what the caller
|
|
79
|
+
* meant and what the backend can actually parse.
|
|
80
|
+
*
|
|
81
|
+
* Parenthesised groups are not recognised and fall back to full-text search.
|
|
82
|
+
*/
|
|
83
|
+
export declare function isFilterQuery(query: string): boolean;
|
|
42
84
|
export declare function createApiProductAdapter(fetcher: ApiFetcher, opts?: {
|
|
43
85
|
currencyCode: string;
|
|
44
86
|
}): ProductAdapter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/services/product/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO,EAAkB,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5F;;;GAGG;AACH,MAAM,WAA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AM,CAAC;QACX,IAAI,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAC;QACzC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;QACvB,UAAU,CAAC,EAAE;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,GAAG;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC;KACrD,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAEhC,MAAM,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;CACrD;AAED,wBAAgB,wBAAwB,IAAI,cAAc,CAmRzD;AAwDD;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpD;AAwBD,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,UAAU,EACnB,IAAI,GAAE;IAAE,YAAY,EAAE,MAAM,CAAA;CAA4B,GACvD,cAAc,CAmKhB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { ProductAdapter } from './adapter';
|
|
2
|
-
export { createMockProductAdapter, createApiProductAdapter } from './adapter';
|
|
2
|
+
export { createMockProductAdapter, createApiProductAdapter, isFilterQuery, } from './adapter';
|
|
3
3
|
export { createProductService, ProductServiceContext } from './productService';
|
|
4
4
|
export * from './types';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/product/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/product/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,aAAa,GACd,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE/E,cAAc,SAAS,CAAC"}
|
|
@@ -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,
|
|
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,EAIZ,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,wBAAwB,EACxB,sBAAsB,EACtB,aAAa,EACb,SAAS,EACT,cAAc,EACd,aAAa,EAEd,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAE9E;;;;;;;OAOG;IACH,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IAE5C,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC;IAE1D,YAAY,CAAC,MAAM,EAAE;QACnB,cAAc,EAAE,MAAM,CAAC;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AE,GACnB;QACE,IAAI,EAAE,OAAO,CAAC;QACd,KAAK,EACD,SAAS,GACT,SAAS,GACT,wBAAwB,GACxB,oBAAoB,CAAC;KAC1B,CAAC;IACN;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,gBAAgB,GAAG,SAAS,CAAC,CAAC;CACrE;AA8BD,wBAAgB,6BAA6B,CAC3C,OAAO,GAAE,8BAAmC,GAC3C,mBAAmB,CAurBrB;AAkOD,wBAAgB,4BAA4B,CAC1C,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,112 @@
|
|
|
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
|
+
/**
|
|
104
|
+
* Maps a v1 payment-instrument wire shape (hyphen tags, `maskedConsumerAccount`)
|
|
105
|
+
* to the canonical `SubscriptionPaymentInstrument` union.
|
|
106
|
+
*
|
|
107
|
+
* Input is `unknown` because blocks/core must not depend on SDK types; the
|
|
108
|
+
* function narrows internally by tag. Returns `null` for unrecognised or
|
|
109
|
+
* absent instruments.
|
|
110
|
+
*/
|
|
111
|
+
export declare function serializeV1PaymentInstrument(raw: unknown): SubscriptionPaymentInstrument | null;
|
|
112
|
+
//# sourceMappingURL=paymentInstrument.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paymentInstrument.d.ts","sourceRoot":"","sources":["../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AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,6BAA6B,GACxC,MAAM,CAQR;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,6BAA6B,GACxC,MAAM,GAAG,IAAI,CAWf;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,6BAA6B,GACxC,MAAM,GAAG,IAAI,CAaf;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,SAAS,EAAE,OAAO,CAAC;IACnB,uEAAuE;IACvE,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,6BAA6B,EACzC,GAAG,GAAE,IAAiB,GACrB,uBAAuB,GAAG,IAAI,CAahC;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,OAAO,GACX,6BAA6B,GAAG,IAAI,CAwCtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paymentInstrument.test.d.ts","sourceRoot":"","sources":["../../../src/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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AiB,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;
|
|
@@ -57,12 +59,31 @@ export interface PostableSubscriptionItem {
|
|
|
57
59
|
* delivery method stops being available for the new line set.
|
|
58
60
|
*/
|
|
59
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>;
|
|
60
72
|
}
|
|
61
73
|
export interface UpdateSubscriptionItem {
|
|
62
74
|
variantId?: string;
|
|
63
75
|
quantity?: number;
|
|
64
76
|
billingPolicy?: SellingPlanInterval;
|
|
65
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>;
|
|
66
87
|
}
|
|
67
88
|
export interface UpdateBoxItem {
|
|
68
89
|
variantId: string;
|
|
@@ -114,17 +135,60 @@ export interface SubscriptionDeliveryAnchor {
|
|
|
114
135
|
export interface SubscriptionDeliveryPolicy extends SellingPlanInterval {
|
|
115
136
|
anchors?: SubscriptionDeliveryAnchor[];
|
|
116
137
|
}
|
|
117
|
-
export interface SubscriptionPaymentInstrument {
|
|
118
|
-
type: string;
|
|
119
|
-
brand?: string;
|
|
120
|
-
maskedNumber?: string;
|
|
121
|
-
}
|
|
122
138
|
export interface SubscriptionPaymentMethod {
|
|
123
139
|
id: string;
|
|
124
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
|
+
*/
|
|
125
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
|
+
*/
|
|
126
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;
|
|
127
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* A subscription's delivery address. Fields are optional and never null: both
|
|
189
|
+
* sources may omit any of them, and the adapters normalise a null to absent so
|
|
190
|
+
* consumers can test one field rather than each key.
|
|
191
|
+
*/
|
|
128
192
|
export interface SubscriptionDeliveryAddress {
|
|
129
193
|
firstName?: string;
|
|
130
194
|
lastName?: string;
|
|
@@ -132,18 +196,36 @@ export interface SubscriptionDeliveryAddress {
|
|
|
132
196
|
address2?: string;
|
|
133
197
|
zip?: string;
|
|
134
198
|
city?: string;
|
|
199
|
+
/** Resolved display name, e.g. "Germany". v1-sourced only. */
|
|
200
|
+
country?: string;
|
|
135
201
|
countryCode?: string;
|
|
202
|
+
/** Resolved display name, e.g. "Bavaria". */
|
|
136
203
|
province?: string;
|
|
204
|
+
/** v1-sourced only — the legacy address has no province code. */
|
|
205
|
+
provinceCode?: string;
|
|
206
|
+
phone?: string;
|
|
207
|
+
company?: string;
|
|
137
208
|
}
|
|
138
209
|
export interface SubscriptionDeliveryOption {
|
|
139
210
|
title?: string;
|
|
211
|
+
/**
|
|
212
|
+
* Customer-facing title where it differs from the internal one. Legacy-sourced
|
|
213
|
+
* only — v1 carries a single `title`, so consumers must read
|
|
214
|
+
* `presentmentTitle ?? title`.
|
|
215
|
+
*/
|
|
140
216
|
presentmentTitle?: string;
|
|
141
217
|
description?: string;
|
|
142
218
|
}
|
|
143
219
|
/**
|
|
144
|
-
* Delivery method for a subscription
|
|
145
|
-
*
|
|
146
|
-
*
|
|
220
|
+
* Delivery method for a subscription: the address plus whichever of the three
|
|
221
|
+
* option slots applies (exactly one — shipping, pickup, or local delivery).
|
|
222
|
+
*
|
|
223
|
+
* The real adapter maps this from the v1 subscription resource's `deliveryAddress`
|
|
224
|
+
* and `deliveryMethod`, both returned by default (no `expand` needed), so it is
|
|
225
|
+
* populated by every read — `search` and `getById` alike. `null` means the
|
|
226
|
+
* subscription genuinely has no delivery method; `undefined` means the host's
|
|
227
|
+
* adapter does not supply one. Used by ContractSelect to show the delivery
|
|
228
|
+
* address and method.
|
|
147
229
|
*/
|
|
148
230
|
export interface SubscriptionDeliveryMethod {
|
|
149
231
|
address?: SubscriptionDeliveryAddress | null;
|
|
@@ -197,8 +279,9 @@ export interface Subscription {
|
|
|
197
279
|
*/
|
|
198
280
|
serial?: string;
|
|
199
281
|
/**
|
|
200
|
-
* Delivery address + shipping/pickup option. Populated by the
|
|
201
|
-
*
|
|
282
|
+
* Delivery address + shipping/pickup/local-delivery option. Populated by the
|
|
283
|
+
* real adapter from the v1 subscription resource (`deliveryAddress` +
|
|
284
|
+
* `deliveryMethod`). Used by ContractSelect.
|
|
202
285
|
*/
|
|
203
286
|
deliveryMethod?: SubscriptionDeliveryMethod | null;
|
|
204
287
|
}
|
|
@@ -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,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