@cogenta/commerce 0.2.0 → 0.4.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/admin/permissions.d.ts +8 -0
- package/dist/admin/permissions.d.ts.map +1 -1
- package/dist/admin/permissions.js +1 -0
- package/dist/admin/permissions.js.map +1 -1
- package/dist/admin/router.d.ts +47 -5
- package/dist/admin/router.d.ts.map +1 -1
- package/dist/admin/router.js +942 -24
- package/dist/admin/router.js.map +1 -1
- package/dist/cart/store.d.ts +23 -0
- package/dist/cart/store.d.ts.map +1 -1
- package/dist/cart/store.js +49 -2
- package/dist/cart/store.js.map +1 -1
- package/dist/catalog/csv.d.ts +29 -0
- package/dist/catalog/csv.d.ts.map +1 -0
- package/dist/catalog/csv.js +396 -0
- package/dist/catalog/csv.js.map +1 -0
- package/dist/catalog/store.d.ts +24 -4
- package/dist/catalog/store.d.ts.map +1 -1
- package/dist/catalog/store.js +238 -11
- package/dist/catalog/store.js.map +1 -1
- package/dist/catalog/types.d.ts +92 -0
- package/dist/catalog/types.d.ts.map +1 -1
- package/dist/catalog/types.js +20 -0
- package/dist/catalog/types.js.map +1 -1
- package/dist/coupon/store.d.ts +63 -5
- package/dist/coupon/store.d.ts.map +1 -1
- package/dist/coupon/store.js +140 -7
- package/dist/coupon/store.js.map +1 -1
- package/dist/customer/store.d.ts +17 -0
- package/dist/customer/store.d.ts.map +1 -1
- package/dist/customer/store.js +26 -0
- package/dist/customer/store.js.map +1 -1
- package/dist/index.d.ts +18 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/invoice/credit-note.d.ts +45 -0
- package/dist/invoice/credit-note.d.ts.map +1 -0
- package/dist/invoice/credit-note.js +109 -0
- package/dist/invoice/credit-note.js.map +1 -0
- package/dist/invoice/sequence.d.ts +21 -0
- package/dist/invoice/sequence.d.ts.map +1 -0
- package/dist/invoice/sequence.js +64 -0
- package/dist/invoice/sequence.js.map +1 -0
- package/dist/invoice/store.d.ts +23 -1
- package/dist/invoice/store.d.ts.map +1 -1
- package/dist/invoice/store.js +23 -56
- package/dist/invoice/store.js.map +1 -1
- package/dist/order/csv.d.ts +24 -0
- package/dist/order/csv.d.ts.map +1 -0
- package/dist/order/csv.js +42 -0
- package/dist/order/csv.js.map +1 -0
- package/dist/order/notify.d.ts +65 -0
- package/dist/order/notify.d.ts.map +1 -0
- package/dist/order/notify.js +180 -0
- package/dist/order/notify.js.map +1 -0
- package/dist/order/store.d.ts +58 -1
- package/dist/order/store.d.ts.map +1 -1
- package/dist/order/store.js +145 -10
- package/dist/order/store.js.map +1 -1
- package/dist/order/types.d.ts +35 -1
- package/dist/order/types.d.ts.map +1 -1
- package/dist/order/types.js +2 -0
- package/dist/order/types.js.map +1 -1
- package/dist/payment/paypal.d.ts +9 -0
- package/dist/payment/paypal.d.ts.map +1 -0
- package/dist/payment/paypal.js +583 -0
- package/dist/payment/paypal.js.map +1 -0
- package/dist/payment/registry.d.ts +15 -6
- package/dist/payment/registry.d.ts.map +1 -1
- package/dist/payment/registry.js +17 -6
- package/dist/payment/registry.js.map +1 -1
- package/dist/payment/types.d.ts +6 -0
- package/dist/payment/types.d.ts.map +1 -1
- package/dist/shipping/store.d.ts +29 -3
- package/dist/shipping/store.d.ts.map +1 -1
- package/dist/shipping/store.js +68 -4
- package/dist/shipping/store.js.map +1 -1
- package/dist/subscription/renewal-notifier.d.ts +17 -0
- package/dist/subscription/renewal-notifier.d.ts.map +1 -0
- package/dist/subscription/renewal-notifier.js +33 -0
- package/dist/subscription/renewal-notifier.js.map +1 -0
- package/dist/subscription/store.d.ts +126 -3
- package/dist/subscription/store.d.ts.map +1 -1
- package/dist/subscription/store.js +348 -8
- package/dist/subscription/store.js.map +1 -1
- package/dist/tables.d.ts +17 -0
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +273 -0
- package/dist/tables.js.map +1 -1
- package/dist/tax/store.d.ts +20 -0
- package/dist/tax/store.d.ts.map +1 -1
- package/dist/tax/store.js +51 -7
- package/dist/tax/store.js.map +1 -1
- package/package.json +3 -2
package/dist/catalog/types.js
CHANGED
|
@@ -2,4 +2,24 @@
|
|
|
2
2
|
* a product is its content entry (contract A), which has a real editorial
|
|
3
3
|
* workflow. The commercial record only has to say whether it can be bought. */
|
|
4
4
|
export const PRODUCT_STATUSES = ['active', 'archived'];
|
|
5
|
+
/** Why a stock movement happened. `manual` covers a correction typed directly
|
|
6
|
+
* into the admin — anything that is not a sale, a restock or a stock take. */
|
|
7
|
+
export const STOCK_MOVEMENT_REASONS = ['sale', 'restock', 'stock_take', 'manual'];
|
|
8
|
+
/**
|
|
9
|
+
* Whether a variant's promotion (fiche 51 task 5) applies right now.
|
|
10
|
+
*
|
|
11
|
+
* `compareAtPriceMinor` is what makes a promotion exist at all — a schedule
|
|
12
|
+
* with no "was" price to show has nothing to display. An open start or end
|
|
13
|
+
* means "always", not "never": a sale with only an end date is already
|
|
14
|
+
* running, and one with only a start date has no announced finish.
|
|
15
|
+
*/
|
|
16
|
+
export function isOnSale(variant, now = new Date()) {
|
|
17
|
+
if (variant.compareAtPriceMinor === null)
|
|
18
|
+
return false;
|
|
19
|
+
if (variant.saleStartsAt !== null && now < new Date(variant.saleStartsAt))
|
|
20
|
+
return false;
|
|
21
|
+
if (variant.saleEndsAt !== null && now > new Date(variant.saleEndsAt))
|
|
22
|
+
return false;
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
5
25
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/catalog/types.ts"],"names":[],"mappings":"AAAA;;+EAE+E;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/catalog/types.ts"],"names":[],"mappings":"AAAA;;+EAE+E;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAU,CAAA;AAwI/D;8EAC8E;AAC9E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,CAAU,CAAA;AAkD1F;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CACtB,OAA6E,EAC7E,GAAG,GAAS,IAAI,IAAI,EAAE;IAEtB,IAAI,OAAO,CAAC,mBAAmB,KAAK,IAAI;QAAE,OAAO,KAAK,CAAA;IACtD,IAAI,OAAO,CAAC,YAAY,KAAK,IAAI,IAAI,GAAG,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;QAAE,OAAO,KAAK,CAAA;IACvF,IAAI,OAAO,CAAC,UAAU,KAAK,IAAI,IAAI,GAAG,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;QAAE,OAAO,KAAK,CAAA;IACnF,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/dist/coupon/store.d.ts
CHANGED
|
@@ -23,6 +23,10 @@ export interface Coupon {
|
|
|
23
23
|
/** Null is unlimited. Zero is exhausted — never a synonym for unlimited. */
|
|
24
24
|
readonly maxRedemptions: number | null;
|
|
25
25
|
readonly redemptions: number;
|
|
26
|
+
/** Null is unlimited. Per customer, on top of (never instead of) `maxRedemptions`. */
|
|
27
|
+
readonly maxRedemptionsPerCustomer: number | null;
|
|
28
|
+
/** Commerce product ids this coupon applies to. Empty means unrestricted — every product qualifies. */
|
|
29
|
+
readonly restrictedProductIds: readonly string[];
|
|
26
30
|
readonly active: boolean;
|
|
27
31
|
readonly createdAt: string;
|
|
28
32
|
}
|
|
@@ -35,6 +39,9 @@ export interface CreateCouponInput {
|
|
|
35
39
|
readonly startsAt?: string | null;
|
|
36
40
|
readonly endsAt?: string | null;
|
|
37
41
|
readonly maxRedemptions?: number | null;
|
|
42
|
+
readonly maxRedemptionsPerCustomer?: number | null;
|
|
43
|
+
/** Commerce product ids to restrict this coupon to. Omitted or empty means unrestricted. */
|
|
44
|
+
readonly restrictedProductIds?: readonly string[];
|
|
38
45
|
readonly active?: boolean;
|
|
39
46
|
}
|
|
40
47
|
/**
|
|
@@ -65,26 +72,77 @@ export type CouponCheck = {
|
|
|
65
72
|
} | {
|
|
66
73
|
readonly kind: 'wrong_currency';
|
|
67
74
|
readonly currency: string;
|
|
75
|
+
}
|
|
76
|
+
/** Fiche 53 task 2: this customer already used it `maxRedemptionsPerCustomer` times. */
|
|
77
|
+
| {
|
|
78
|
+
readonly kind: 'customer_exhausted';
|
|
79
|
+
readonly maxRedemptionsPerCustomer: number;
|
|
80
|
+
}
|
|
81
|
+
/** Fiche 53 task 2: restricted to products, none of which are in this basket. */
|
|
82
|
+
| {
|
|
83
|
+
readonly kind: 'not_applicable';
|
|
84
|
+
readonly restrictedProductIds: readonly string[];
|
|
68
85
|
};
|
|
86
|
+
/** What `check()` needs to know about the basket beyond its subtotal and currency. */
|
|
87
|
+
export interface CouponCheckContext {
|
|
88
|
+
readonly customerId?: string | null;
|
|
89
|
+
/** Commerce product ids in the basket — checked against `restrictedProductIds`. */
|
|
90
|
+
readonly productIds?: readonly string[];
|
|
91
|
+
}
|
|
69
92
|
export interface CouponStore {
|
|
70
93
|
create(input: CreateCouponInput): Promise<Coupon>;
|
|
71
94
|
read(code: string): Promise<Coupon | null>;
|
|
72
95
|
deactivate(code: string): Promise<void>;
|
|
73
96
|
list(): Promise<readonly Coupon[]>;
|
|
74
|
-
/**
|
|
75
|
-
|
|
97
|
+
/**
|
|
98
|
+
* Checks without consuming. Safe to call on every cart recalculation.
|
|
99
|
+
*
|
|
100
|
+
* The per-customer and product-restriction checks here are informational,
|
|
101
|
+
* exactly like the global `exhausted` check already was: a clear message
|
|
102
|
+
* now, not authoritative. `redeem()` is what actually enforces both,
|
|
103
|
+
* atomically, so a race between two checks and one redemption can never
|
|
104
|
+
* hand out more than the limits allow.
|
|
105
|
+
*/
|
|
106
|
+
check(code: string, subtotalMinor: number, currency: string, context?: CouponCheckContext): Promise<CouponCheck>;
|
|
76
107
|
/**
|
|
77
108
|
* Consumes one redemption for an order, atomically.
|
|
78
109
|
*
|
|
79
|
-
* The count is claimed with `update … set redemptions = redemptions
|
|
80
|
-
* where code = ? and (max_redemptions is null or redemptions < max)`,
|
|
81
|
-
* `rowsAffected` decides. Two shoppers spending the last redemption of a
|
|
110
|
+
* The global count is claimed with `update … set redemptions = redemptions
|
|
111
|
+
* + 1 where code = ? and (max_redemptions is null or redemptions < max)`,
|
|
112
|
+
* and `rowsAffected` decides. Two shoppers spending the last redemption of a
|
|
82
113
|
* one-shot code at the same instant get one success and one refusal, not two
|
|
83
114
|
* discounts — the same guard shape as stock, for the same reason.
|
|
115
|
+
*
|
|
116
|
+
* When the coupon also has `maxRedemptionsPerCustomer`, the per-customer
|
|
117
|
+
* counter (`cogenta_commerce_coupon_customer_redemptions`) is claimed the
|
|
118
|
+
* same way, inside the same transaction: exceeding it throws internally and
|
|
119
|
+
* unwinds the whole transaction, including the global counter claimed a
|
|
120
|
+
* moment before — a customer who loses the per-customer race must not
|
|
121
|
+
* silently burn a global redemption they were refused.
|
|
84
122
|
*/
|
|
85
123
|
redeem(code: string, orderId: string, customerId: string | null, tx?: SqlExecutor): Promise<boolean>;
|
|
86
124
|
/** Gives a redemption back when an order is cancelled before payment. */
|
|
87
125
|
release(orderId: string, tx?: SqlExecutor): Promise<void>;
|
|
126
|
+
/** Aggregate figures for the coupons screen (fiche 53 task 6) — read-only, no new data. */
|
|
127
|
+
metrics(): Promise<CouponMetrics>;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Usage, revenue and discount given, across every coupon — aggregation only,
|
|
131
|
+
* over `couponRedemptions`/`orders`, never a second ledger.
|
|
132
|
+
*/
|
|
133
|
+
export interface CouponMetrics {
|
|
134
|
+
readonly activeCoupons: number;
|
|
135
|
+
readonly totalRedemptions: number;
|
|
136
|
+
/** Sum of `orders.discount_minor` for orders that redeemed a coupon, grouped by currency. */
|
|
137
|
+
readonly discountGivenMinor: readonly {
|
|
138
|
+
readonly currency: string;
|
|
139
|
+
readonly amountMinor: number;
|
|
140
|
+
}[];
|
|
141
|
+
/** Sum of `orders.total_minor` for orders that redeemed a coupon, grouped by currency. */
|
|
142
|
+
readonly revenueMinor: readonly {
|
|
143
|
+
readonly currency: string;
|
|
144
|
+
readonly amountMinor: number;
|
|
145
|
+
}[];
|
|
88
146
|
}
|
|
89
147
|
/** Upper case, trimmed. A coupon typed in lower case is the same coupon. */
|
|
90
148
|
export declare function normaliseCode(code: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/coupon/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EAGnB,KAAK,WAAW,EAEjB,MAAM,eAAe,CAAA;AAKtB;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,YAAI,YAAY,EAAE,OAAO,EAAE,eAAe,CAAU,CAAA;AAC7E,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAEtD,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,iFAAiF;IACjF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,4EAA4E;IAC5E,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IACtC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IA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AM,EAAE,EAAE,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACzD,2FAA2F;IAC3F,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC,CAAA;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;IACjC,6FAA6F;IAC7F,QAAQ,CAAC,kBAAkB,EAAE,SAAS;QACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;QACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;KAC7B,EAAE,CAAA;IACH,0FAA0F;IAC1F,QAAQ,CAAC,YAAY,EAAE,SAAS;QAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAC9F;AAsCD,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,cAAc,EAAE,GAAG,GAAE,MAAM,MAAiB,GAAG,WAAW,CAwS/F;AAUD;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GACpB;IAAE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAA;CAAE,CAOpE"}
|
package/dist/coupon/store.js
CHANGED
|
@@ -13,6 +13,7 @@ import { TABLES } from '../tables.js';
|
|
|
13
13
|
* dispute with a customer.
|
|
14
14
|
*/
|
|
15
15
|
export const COUPON_KINDS = ['percentage', 'fixed', 'free_shipping'];
|
|
16
|
+
/** `restrictedProductIds` is filled in separately (`hydrate`) — a coupon row alone never carries it. */
|
|
16
17
|
function decode(row) {
|
|
17
18
|
return {
|
|
18
19
|
code: toText(row.code, 'coupon.code'),
|
|
@@ -24,6 +25,7 @@ function decode(row) {
|
|
|
24
25
|
endsAt: toNullableText(row.ends_at),
|
|
25
26
|
maxRedemptions: toNullableInt(row.max_redemptions, 'coupon.max_redemptions'),
|
|
26
27
|
redemptions: toInt(row.redemptions, 'coupon.redemptions'),
|
|
28
|
+
maxRedemptionsPerCustomer: toNullableInt(row.max_redemptions_per_customer, 'coupon.max_redemptions_per_customer'),
|
|
27
29
|
active: toBool(row.active),
|
|
28
30
|
createdAt: toText(row.created_at, 'coupon.created_at'),
|
|
29
31
|
};
|
|
@@ -36,10 +38,29 @@ export function createCouponStore(db, now = Date.now) {
|
|
|
36
38
|
const d = db.dialect;
|
|
37
39
|
const table = identifier(TABLES.coupons, d);
|
|
38
40
|
const redemptions = identifier(TABLES.couponRedemptions, d);
|
|
41
|
+
const restrictions = identifier(TABLES.couponRestrictions, d);
|
|
42
|
+
const customerRedemptions = identifier(TABLES.couponCustomerRedemptions, d);
|
|
43
|
+
const orders = identifier(TABLES.orders, d);
|
|
44
|
+
async function restrictedProductIdsFor(code) {
|
|
45
|
+
const result = await db.query(sql `select product_id from ${restrictions} where code = ${code} order by created_at asc`);
|
|
46
|
+
return result.rows.map((row) => toText(row.product_id, 'coupon_restriction.product_id'));
|
|
47
|
+
}
|
|
48
|
+
async function hydrate(row) {
|
|
49
|
+
const coupon = decode(row);
|
|
50
|
+
return { ...coupon, restrictedProductIds: await restrictedProductIdsFor(coupon.code) };
|
|
51
|
+
}
|
|
39
52
|
async function read(code) {
|
|
40
53
|
const result = await db.query(sql `select * from ${table} where code = ${normaliseCode(code)}`);
|
|
41
54
|
const row = result.rows[0];
|
|
42
|
-
return row === undefined ? null :
|
|
55
|
+
return row === undefined ? null : await hydrate(row);
|
|
56
|
+
}
|
|
57
|
+
/** The coupon's own per-customer cap, read on the executor `redeem()` is running against — never a second, possibly-stale copy. */
|
|
58
|
+
async function capFor(executor, normalisedCode) {
|
|
59
|
+
const result = await executor.query(sql `select max_redemptions_per_customer from ${table} where code = ${normalisedCode}`);
|
|
60
|
+
const row = result.rows[0];
|
|
61
|
+
return row === undefined
|
|
62
|
+
? null
|
|
63
|
+
: toNullableInt(row.max_redemptions_per_customer, 'coupon.max_redemptions_per_customer');
|
|
43
64
|
}
|
|
44
65
|
return {
|
|
45
66
|
create: async (input) => {
|
|
@@ -78,15 +99,29 @@ export function createCouponStore(db, now = Date.now) {
|
|
|
78
99
|
hint: 'Deactivate the existing one, or choose another code.',
|
|
79
100
|
});
|
|
80
101
|
}
|
|
102
|
+
if (input.maxRedemptionsPerCustomer !== undefined &&
|
|
103
|
+
input.maxRedemptionsPerCustomer !== null &&
|
|
104
|
+
(!Number.isInteger(input.maxRedemptionsPerCustomer) || input.maxRedemptionsPerCustomer < 1)) {
|
|
105
|
+
throw new CogentaError({
|
|
106
|
+
code: 'COMMERCE_COUPON_INVALID',
|
|
107
|
+
message: `A per-customer usage limit must be a whole number of at least 1, got ${String(input.maxRedemptionsPerCustomer)}.`,
|
|
108
|
+
hint: 'Leave it unset for no per-customer limit.',
|
|
109
|
+
});
|
|
110
|
+
}
|
|
81
111
|
await db.query(sql `
|
|
82
112
|
insert into ${table} (code, kind, value, currency, min_subtotal_minor, starts_at, ends_at,
|
|
83
|
-
max_redemptions, redemptions, active, created_at)
|
|
113
|
+
max_redemptions, redemptions, max_redemptions_per_customer, active, created_at)
|
|
84
114
|
values (${code}, ${input.kind}, ${input.value ?? 0},
|
|
85
115
|
${input.currency === undefined || input.currency === null ? null : assertCurrency(input.currency)},
|
|
86
116
|
${assertMinor(input.minSubtotalMinor ?? 0, 'A coupon minimum')},
|
|
87
117
|
${input.startsAt ?? null}, ${input.endsAt ?? null},
|
|
88
|
-
${input.maxRedemptions ?? null}, ${0},
|
|
118
|
+
${input.maxRedemptions ?? null}, ${0}, ${input.maxRedemptionsPerCustomer ?? null},
|
|
89
119
|
${fromBool(input.active ?? true, d)}, ${new Date(now()).toISOString()})`);
|
|
120
|
+
for (const productId of input.restrictedProductIds ?? []) {
|
|
121
|
+
await db.query(sql `
|
|
122
|
+
insert into ${restrictions} (id, code, product_id, created_at)
|
|
123
|
+
values (${newId(now)}, ${code}, ${productId}, ${new Date(now()).toISOString()})`);
|
|
124
|
+
}
|
|
90
125
|
const created = await read(code);
|
|
91
126
|
if (created === null) {
|
|
92
127
|
throw new CogentaError({
|
|
@@ -103,9 +138,9 @@ export function createCouponStore(db, now = Date.now) {
|
|
|
103
138
|
},
|
|
104
139
|
list: async () => {
|
|
105
140
|
const result = await db.query(sql `select * from ${table} order by created_at desc`);
|
|
106
|
-
return result.rows.map(
|
|
141
|
+
return Promise.all(result.rows.map(hydrate));
|
|
107
142
|
},
|
|
108
|
-
check: async (code, subtotalMinor, currency) => {
|
|
143
|
+
check: async (code, subtotalMinor, currency, context) => {
|
|
109
144
|
const coupon = await read(code);
|
|
110
145
|
if (coupon === null)
|
|
111
146
|
return { kind: 'unknown' };
|
|
@@ -127,6 +162,24 @@ export function createCouponStore(db, now = Date.now) {
|
|
|
127
162
|
if (coupon.currency !== null && coupon.currency !== currency) {
|
|
128
163
|
return { kind: 'wrong_currency', currency: coupon.currency };
|
|
129
164
|
}
|
|
165
|
+
if (coupon.restrictedProductIds.length > 0 &&
|
|
166
|
+
!(context?.productIds ?? []).some((id) => coupon.restrictedProductIds.includes(id))) {
|
|
167
|
+
return { kind: 'not_applicable', restrictedProductIds: coupon.restrictedProductIds };
|
|
168
|
+
}
|
|
169
|
+
if (coupon.maxRedemptionsPerCustomer !== null &&
|
|
170
|
+
context?.customerId !== undefined &&
|
|
171
|
+
context.customerId !== null) {
|
|
172
|
+
const used = await db.query(sql `select count from ${customerRedemptions} where code = ${coupon.code} and customer_id = ${context.customerId}`);
|
|
173
|
+
const count = used.rows[0] === undefined
|
|
174
|
+
? 0
|
|
175
|
+
: toInt(used.rows[0].count, 'coupon_customer_redemption.count');
|
|
176
|
+
if (count >= coupon.maxRedemptionsPerCustomer) {
|
|
177
|
+
return {
|
|
178
|
+
kind: 'customer_exhausted',
|
|
179
|
+
maxRedemptionsPerCustomer: coupon.maxRedemptionsPerCustomer,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}
|
|
130
183
|
return { kind: 'ok', coupon };
|
|
131
184
|
},
|
|
132
185
|
redeem: async (code, orderId, customerId, tx) => {
|
|
@@ -139,32 +192,112 @@ export function createCouponStore(db, now = Date.now) {
|
|
|
139
192
|
and (max_redemptions is null or redemptions < max_redemptions)`);
|
|
140
193
|
if (claimed.rowsAffected === 0)
|
|
141
194
|
return false;
|
|
195
|
+
// The per-customer cap, claimed with the same guarded-`UPDATE` shape
|
|
196
|
+
// as the global counter above — atomic per row on all three dialects,
|
|
197
|
+
// never a `count(*)` race. `insert` claims the customer's first
|
|
198
|
+
// redemption; a unique-key collision on the retry means a row
|
|
199
|
+
// already exists, so the guarded `UPDATE` claims the next one.
|
|
200
|
+
if (customerId !== null) {
|
|
201
|
+
const cap = await capFor(executor, normalised);
|
|
202
|
+
if (cap !== null) {
|
|
203
|
+
const at = new Date(now()).toISOString();
|
|
204
|
+
const inserted = await executor
|
|
205
|
+
.query(sql `
|
|
206
|
+
insert into ${customerRedemptions} (code, customer_id, count, created_at, updated_at)
|
|
207
|
+
values (${normalised}, ${customerId}, ${1}, ${at}, ${at})`)
|
|
208
|
+
.then(() => true)
|
|
209
|
+
.catch(() => false);
|
|
210
|
+
if (!inserted) {
|
|
211
|
+
const bumped = await executor.query(sql `
|
|
212
|
+
update ${customerRedemptions} set count = count + 1, updated_at = ${at}
|
|
213
|
+
where code = ${normalised} and customer_id = ${customerId} and count < ${cap}`);
|
|
214
|
+
if (bumped.rowsAffected === 0) {
|
|
215
|
+
// The customer's own cap is exhausted. Throwing here unwinds
|
|
216
|
+
// the whole transaction, including the global counter claimed
|
|
217
|
+
// a moment ago — a customer refused on their own limit must
|
|
218
|
+
// never silently burn a global redemption meant for someone
|
|
219
|
+
// else.
|
|
220
|
+
throw new CustomerCapExceeded();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
else if (cap < 1) {
|
|
224
|
+
// A cap below 1 was already refused at creation, but a first
|
|
225
|
+
// insert always "succeeds" at count = 1 — undo it rather than
|
|
226
|
+
// leave a redemption on record for a limit of zero.
|
|
227
|
+
await executor.query(sql `delete from ${customerRedemptions} where code = ${normalised} and customer_id = ${customerId}`);
|
|
228
|
+
throw new CustomerCapExceeded();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
142
232
|
await executor.query(sql `
|
|
143
233
|
insert into ${redemptions} (id, code, order_id, customer_id, at)
|
|
144
234
|
values (${newId(now)}, ${normalised}, ${orderId}, ${customerId}, ${new Date(now()).toISOString()})`);
|
|
145
235
|
return true;
|
|
146
236
|
};
|
|
147
|
-
|
|
237
|
+
try {
|
|
238
|
+
return tx === undefined ? await db.transaction(run, { immediate: true }) : await run(tx);
|
|
239
|
+
}
|
|
240
|
+
catch (error) {
|
|
241
|
+
if (error instanceof CustomerCapExceeded)
|
|
242
|
+
return false;
|
|
243
|
+
throw error;
|
|
244
|
+
}
|
|
148
245
|
},
|
|
149
246
|
release: async (orderId, tx) => {
|
|
150
247
|
const run = async (executor) => {
|
|
151
|
-
const found = await executor.query(sql `select code from ${redemptions} where order_id = ${orderId}`);
|
|
248
|
+
const found = await executor.query(sql `select code, customer_id from ${redemptions} where order_id = ${orderId}`);
|
|
152
249
|
const row = found.rows[0];
|
|
153
250
|
if (row === undefined)
|
|
154
251
|
return;
|
|
155
252
|
const code = toText(row.code, 'coupon_redemption.code');
|
|
253
|
+
const customerId = toNullableText(row.customer_id);
|
|
156
254
|
await executor.query(sql `delete from ${redemptions} where order_id = ${orderId}`);
|
|
157
255
|
// `redemptions > 0` guards against ever writing a negative count, which
|
|
158
256
|
// would silently hand out extra redemptions of a one-shot code.
|
|
159
257
|
await executor.query(sql `update ${table} set redemptions = redemptions - 1 where code = ${code} and redemptions > 0`);
|
|
258
|
+
if (customerId !== null) {
|
|
259
|
+
await executor.query(sql `
|
|
260
|
+
update ${customerRedemptions} set count = count - 1, updated_at = ${new Date(now()).toISOString()}
|
|
261
|
+
where code = ${code} and customer_id = ${customerId} and count > 0`);
|
|
262
|
+
}
|
|
160
263
|
};
|
|
161
264
|
if (tx === undefined)
|
|
162
265
|
await db.transaction(run, { immediate: true });
|
|
163
266
|
else
|
|
164
267
|
await run(tx);
|
|
165
268
|
},
|
|
269
|
+
metrics: async () => {
|
|
270
|
+
const active = await db.query(sql `select count(*) as n from ${table} where active = ${fromBool(true, d)}`);
|
|
271
|
+
const total = await db.query(sql `select count(*) as n from ${redemptions}`);
|
|
272
|
+
const sums = await db.query(sql `
|
|
273
|
+
select o.currency as currency,
|
|
274
|
+
sum(o.discount_minor) as discount,
|
|
275
|
+
sum(o.total_minor) as revenue
|
|
276
|
+
from ${orders} o
|
|
277
|
+
inner join ${redemptions} r on r.order_id = o.id
|
|
278
|
+
group by o.currency`);
|
|
279
|
+
return {
|
|
280
|
+
activeCoupons: toInt(active.rows[0]?.n ?? 0, 'coupon_metrics.active'),
|
|
281
|
+
totalRedemptions: toInt(total.rows[0]?.n ?? 0, 'coupon_metrics.total'),
|
|
282
|
+
discountGivenMinor: sums.rows.map((row) => ({
|
|
283
|
+
currency: toText(row.currency, 'coupon_metrics.currency'),
|
|
284
|
+
amountMinor: toInt(row.discount, 'coupon_metrics.discount'),
|
|
285
|
+
})),
|
|
286
|
+
revenueMinor: sums.rows.map((row) => ({
|
|
287
|
+
currency: toText(row.currency, 'coupon_metrics.currency'),
|
|
288
|
+
amountMinor: toInt(row.revenue, 'coupon_metrics.revenue'),
|
|
289
|
+
})),
|
|
290
|
+
};
|
|
291
|
+
},
|
|
166
292
|
};
|
|
167
293
|
}
|
|
294
|
+
/** Internal. Unwinds a redemption transaction when a customer's own cap is exhausted. */
|
|
295
|
+
class CustomerCapExceeded extends Error {
|
|
296
|
+
constructor() {
|
|
297
|
+
super('This customer has already used this coupon the maximum number of times.');
|
|
298
|
+
this.name = 'CustomerCapExceeded';
|
|
299
|
+
}
|
|
300
|
+
}
|
|
168
301
|
/**
|
|
169
302
|
* What a coupon takes off a subtotal, and whether it makes shipping free.
|
|
170
303
|
*
|
package/dist/coupon/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/coupon/store.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,UAAU,EACV,KAAK,EAEL,GAAG,GACJ,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAC3F,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,YAAY,EAAE,OAAO,EAAE,eAAe,CAAU,CAAA;AAwF7E,SAAS,MAAM,CAAC,GAAc;IAC5B,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC;QACrC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,aAAa,CAAe;QACnD,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC;QACvC,QAAQ,EAAE,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC;QACtC,gBAAgB,EAAE,KAAK,CAAC,GAAG,CAAC,kBAAkB,EAAE,2BAA2B,CAAC;QAC5E,QAAQ,EAAE,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC;QACvC,MAAM,EAAE,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC;QACnC,cAAc,EAAE,aAAa,CAAC,GAAG,CAAC,eAAe,EAAE,wBAAwB,CAAC;QAC5E,WAAW,EAAE,K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,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,wBAAwB,CAAC;iBAC1D,CAAC,CAAC;aACJ,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,yFAAyF;AACzF,MAAM,mBAAoB,SAAQ,KAAK;IACrC;QACE,KAAK,CAAC,yEAAyE,CAAC,CAAA;QAChF,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;IACnC,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACzB,MAAc,EACd,aAAqB;IAErB,IAAI,MAAM,CAAC,IAAI,KAAK,eAAe;QAAE,OAAO,EAAE,aAAa,EAAE,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAA;IAEpF,MAAM,GAAG,GACP,MAAM,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,gBAAgB,CAAC,aAAa,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAA;IAE7F,OAAO,EAAE,aAAa,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAA;AAC7E,CAAC"}
|
package/dist/customer/store.d.ts
CHANGED
|
@@ -26,6 +26,23 @@ export interface CustomerStore {
|
|
|
26
26
|
readonly search?: string;
|
|
27
27
|
readonly limit?: number;
|
|
28
28
|
}): Promise<readonly Customer[]>;
|
|
29
|
+
/**
|
|
30
|
+
* GDPR erasure of the customer record itself (fiche 52 task 3): the email
|
|
31
|
+
* is overwritten with a unique, unreachable placeholder and the name is
|
|
32
|
+
* cleared. Idempotent — anonymising twice is a no-op the second time, not
|
|
33
|
+
* an error.
|
|
34
|
+
*
|
|
35
|
+
* Deliberately narrow: this touches only `cogenta_commerce_customers`.
|
|
36
|
+
* Every order this customer placed keeps its own copied `email` field
|
|
37
|
+
* (`OrderLine`/`Order` already never join back to the customer for their
|
|
38
|
+
* historical figures — see `order/store.ts`'s own comment on why a line
|
|
39
|
+
* copies rather than joins) — a paid invoice is a financial record most
|
|
40
|
+
* jurisdictions require to be *retained*, not erased, which is exactly the
|
|
41
|
+
* "legitimate interest" carve-out GDPR itself names. Erasing the person's
|
|
42
|
+
* own identifying record while keeping the accounting trail intact is the
|
|
43
|
+
* correct scope for "anonymise a customer", not a shortcut.
|
|
44
|
+
*/
|
|
45
|
+
anonymize(id: string): Promise<Customer>;
|
|
29
46
|
}
|
|
30
47
|
/**
|
|
31
48
|
* Lower-cased and trimmed, and that is all.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/customer/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,cAAc,EAA0B,MAAM,eAAe,CAAA;AAIzF;;;;;;;;GAQG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,aAAa;IAC5B,0FAA0F;IAC1F,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC9D,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAA;IAC1C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAA;IACpD,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GA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AQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KACxB,GAAG,OAAO,CAAC,SAAS,QAAQ,EAAE,CAAC,CAAA;IAChC;;;;;;;;;;;;;;;OAeG;IACH,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;CACzC;AAsBD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,cAAc,EAClB,GAAG,GAAE,MAAM,MAAiB,GAC3B,aAAa,CAuHf"}
|
package/dist/customer/store.js
CHANGED
|
@@ -98,6 +98,32 @@ export function createCustomerStore(db, now = Date.now) {
|
|
|
98
98
|
order by created_at desc`);
|
|
99
99
|
return result.rows.slice(0, options?.limit ?? 100).map(decode);
|
|
100
100
|
},
|
|
101
|
+
anonymize: async (id) => {
|
|
102
|
+
const existing = await read(id);
|
|
103
|
+
if (existing === null) {
|
|
104
|
+
throw new CogentaError({
|
|
105
|
+
code: 'COMMERCE_CUSTOMER_NOT_FOUND',
|
|
106
|
+
message: 'This customer does not exist.',
|
|
107
|
+
hint: 'It may already have been removed.',
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
// The id is folded in so the placeholder stays unique under the
|
|
111
|
+
// table's own `email` unique constraint — anonymising two different
|
|
112
|
+
// customers must not collide them into one row.
|
|
113
|
+
const placeholder = `anon-${id}@deleted.invalid`;
|
|
114
|
+
await db.query(sql `
|
|
115
|
+
update ${table} set email = ${placeholder}, name = ${null}, user_id = ${null}, updated_at = ${stamp()}
|
|
116
|
+
where id = ${id}`);
|
|
117
|
+
const anonymised = await read(id);
|
|
118
|
+
if (anonymised === null) {
|
|
119
|
+
throw new CogentaError({
|
|
120
|
+
code: 'COMMERCE_CUSTOMER_NOT_FOUND',
|
|
121
|
+
message: 'This customer disappeared while it was being anonymised.',
|
|
122
|
+
hint: 'Refresh the customer list.',
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return anonymised;
|
|
126
|
+
},
|
|
101
127
|
};
|
|
102
128
|
}
|
|
103
129
|
//# sourceMappingURL=store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/customer/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/customer/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AA0DrC,SAAS,MAAM,CAAC,GAAgB;IAC9B,OAAO;QACL,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,aAAa,CAAC;QACjC,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,gBAAgB,CAAC;QAC1C,IAAI,EAAE,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC;QAC9B,MAAM,EAAE,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC;QACnC,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,qBAAqB,CAAC;QACxD,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,qBAAqB,CAAC;KACzD,CAAA;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAA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AY,CAAC;oBACrB,IAAI,EAAE,6BAA6B;oBACnC,OAAO,EAAE,+BAA+B;oBACxC,IAAI,EAAE,mCAAmC;iBAC1C,CAAC,CAAA;YACJ,CAAC;YACD,gEAAgE;YAChE,oEAAoE;YACpE,gDAAgD;YAChD,MAAM,WAAW,GAAG,QAAQ,EAAE,kBAAkB,CAAA;YAChD,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,CAAA;iBACP,KAAK,gBAAgB,WAAW,YAAY,IAAI,eAAe,IAAI,kBAAkB,KAAK,EAAE;qBACxF,EAAE,EAAE,CAAC,CAAA;YACpB,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,CAAA;YACjC,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;gBACxB,MAAM,IAAI,YAAY,CAAC;oBACrB,IAAI,EAAE,6BAA6B;oBACnC,OAAO,EAAE,0DAA0D;oBACnE,IAAI,EAAE,4BAA4B;iBACnC,CAAC,CAAA;YACJ,CAAC;YACD,OAAO,UAAU,CAAA;QACnB,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,26 +3,35 @@ export { COMMERCE_ANONYMOUS, COMMERCE_PERMISSIONS, createCommercePermissions, DE
|
|
|
3
3
|
export type { CommerceAdminRouter, CommerceAdminRouterOptions, CommerceRequest, CommerceResponse, } from './admin/router.js';
|
|
4
4
|
export { createCommerceAdminRouter } from './admin/router.js';
|
|
5
5
|
export type { Cart, CartLine, CartStatus, CartStore, CartStoreDependencies, OpenCartInput, PricedCart, } from './cart/store.js';
|
|
6
|
-
export { CART_STATUSES, CART_TTL_MS, couponRefusal, createCartStore } from './cart/store.js';
|
|
6
|
+
export { CART_STATUSES, CART_TTL_MS, couponRefusal, createCartStore, DEFAULT_CART_ABANDON_MS, } from './cart/store.js';
|
|
7
7
|
export type { Totals, TotalsInput, TotalsLine, TotalsLineInput } from './cart/totals.js';
|
|
8
8
|
export { computeTotals } from './cart/totals.js';
|
|
9
|
+
export type { ProductImportIssue, ProductImportOutcomeKind, ProductImportPreview, ProductImportResult, ProductImportRowOutcome, } from './catalog/csv.js';
|
|
10
|
+
export { applyProductsImport, exportProductsCsv, previewProductsImport } from './catalog/csv.js';
|
|
9
11
|
export type { CatalogStore, ProductListOptions, StockOutcome } from './catalog/store.js';
|
|
10
12
|
export { createCatalogStore } from './catalog/store.js';
|
|
11
|
-
export type { ContentRef, CreateProductInput, CreateVariantInput, Product, ProductStatus, StockRequest, StockShortfall, UpdateProductInput, UpdateVariantInput, Variant, } from './catalog/types.js';
|
|
12
|
-
export { PRODUCT_STATUSES } from './catalog/types.js';
|
|
13
|
-
export type { Coupon, CouponCheck, CouponKind, CouponStore, CreateCouponInput, } from './coupon/store.js';
|
|
13
|
+
export type { ContentRef, CreateProductInput, CreateVariantInput, Product, ProductStatus, ProductTerm, StockMovement, StockMovementOptions, StockMovementReason, StockRequest, StockShortfall, UpdateProductInput, UpdateVariantInput, Variant, } from './catalog/types.js';
|
|
14
|
+
export { isOnSale, PRODUCT_STATUSES, STOCK_MOVEMENT_REASONS } from './catalog/types.js';
|
|
15
|
+
export type { Coupon, CouponCheck, CouponCheckContext, CouponKind, CouponMetrics, CouponStore, CreateCouponInput, } from './coupon/store.js';
|
|
14
16
|
export { COUPON_KINDS, createCouponStore, discountFor, normaliseCode, } from './coupon/store.js';
|
|
15
17
|
export type { Customer, CustomerStore } from './customer/store.js';
|
|
16
18
|
export { createCustomerStore, normaliseEmail } from './customer/store.js';
|
|
19
|
+
export type { CreditNote, CreditNoteStore, CreditNoteStoreDependencies, IssueCreditNoteInput, } from './invoice/credit-note.js';
|
|
20
|
+
export { createCreditNoteStore } from './invoice/credit-note.js';
|
|
17
21
|
export type { PdfInvoiceDocument, PdfLine } from './invoice/pdf.js';
|
|
18
22
|
export { renderInvoicePdf } from './invoice/pdf.js';
|
|
23
|
+
export { claimSequenceNumber, formatSequenceNumber } from './invoice/sequence.js';
|
|
19
24
|
export type { Invoice, InvoiceDocument, InvoiceStore, InvoiceStoreDependencies, IssueInvoiceInput, SellerDetails, } from './invoice/store.js';
|
|
20
25
|
export { createInvoiceStore, formatInvoiceNumber, pdfDocumentFor } from './invoice/store.js';
|
|
21
26
|
export type { Money } from './money.js';
|
|
22
27
|
export { applyBasisPoints, assertCurrency, assertMinor, assertSameCurrency, distribute, formatMoney, minorUnitExponent, normaliseCurrency, } from './money.js';
|
|
23
|
-
export type {
|
|
28
|
+
export type { OrderExportRow } from './order/csv.js';
|
|
29
|
+
export { ordersToCsv } from './order/csv.js';
|
|
30
|
+
export type { OrderEmailKind, OrderEmailQueue, OrderEmailQueueDependencies, OrderEmailRecord, OrderEmailStatus, } from './order/notify.js';
|
|
31
|
+
export { buildConfirmationMessage, buildShipmentMessage, createOrderEmailQueue, MAX_ATTEMPTS as ORDER_EMAIL_MAX_ATTEMPTS, ORDER_EMAIL_KINDS, } from './order/notify.js';
|
|
32
|
+
export type { OrderListOptions, OrderStore, OrderStoreDependencies, PlaceManualOrderInput, PlaceManualOrderLineInput, PlaceOrderInput, PlaceOrderOutcome, } from './order/store.js';
|
|
24
33
|
export { createOrderStore, referenceFrom } from './order/store.js';
|
|
25
|
-
export type { Order, OrderEvent, OrderEventKind, OrderLine, OrderStatus } from './order/types.js';
|
|
34
|
+
export type { Order, OrderEvent, OrderEventKind, OrderLine, OrderStatus, OrderTracking, ShippingAddress, } from './order/types.js';
|
|
26
35
|
export { assertTransition, canTransition, holdsStock, ORDER_EVENT_KINDS, ORDER_STATUSES, } from './order/types.js';
|
|
27
36
|
export { createManualPaymentGateway, manualPaymentDriver, transferReference, } from './payment/manual.js';
|
|
28
37
|
export type { PaymentRegistryOptions } from './payment/registry.js';
|
|
@@ -34,8 +43,9 @@ export type { DriverRefundRequest, DriverRefundResult, PaymentConfig, PaymentDri
|
|
|
34
43
|
export { PAYMENT_STATUSES } from './payment/types.js';
|
|
35
44
|
export type { CarrierRateProvider, CreateShippingMethodInput, ShipmentBasis, ShippingKind, ShippingMethod, ShippingQuote, ShippingStore, ShippingStoreOptions, } from './shipping/store.js';
|
|
36
45
|
export { createShippingStore, SHIPPING_KINDS, storedRate } from './shipping/store.js';
|
|
37
|
-
export
|
|
38
|
-
export {
|
|
46
|
+
export { createEmailRenewalNotifier } from './subscription/renewal-notifier.js';
|
|
47
|
+
export type { BillingRunResult, ChangePlanOptions, ChangePlanResult, CreateSubscriptionInput, DunningRunResult, DunningState, IntervalUnit, RenewalNoticeInput, RenewalNotifier, SendRenewalNoticesResult, Subscription, SubscriptionCycle, SubscriptionMetrics, SubscriptionStatus, SubscriptionStore, SubscriptionStoreDependencies, SubscriptionStoreOptions, } from './subscription/store.js';
|
|
48
|
+
export { advancePeriod, createSubscriptionStore, DEFAULT_DUNNING_SCHEDULE_DAYS, DEFAULT_RENEWAL_NOTICE_DAYS, INTERVAL_UNITS, SUBSCRIPTION_STATUSES, } from './subscription/store.js';
|
|
39
49
|
export { ensureCommerceTables, TABLES } from './tables.js';
|
|
40
50
|
export type { CreateTaxRuleInput, TaxOutcome, TaxRule, TaxStore, TaxZone, } from './tax/store.js';
|
|
41
51
|
export { createTaxStore, taxFor } from './tax/store.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,wBAAwB,CAAA;AAC/B,YAAY,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,eAAe,EACf,gBAAgB,GACjB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAC7D,YAAY,EACV,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,SAA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