platform-types 1.10.857 → 1.10.858
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/auditEnvelope.d.ts +1 -1
- package/dist/cjs/messaging.js +4 -1
- package/dist/messaging.d.ts +84 -5
- package/dist/messaging.js +3 -0
- package/package.json +1 -1
package/dist/auditEnvelope.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare global {
|
|
2
|
-
type EntityAuditEntity = 'PLAN' | 'STORE' | 'PAYMENT' | 'ORDER' | 'MERCADOPAGO' | 'INVOICE' | 'SUBSCRIPTION' | 'USER' | 'CUSTOMER' | 'INTEGRATION' | 'PLATFORM';
|
|
2
|
+
type EntityAuditEntity = 'PLAN' | 'STORE' | 'PAYMENT' | 'ORDER' | 'MERCADOPAGO' | 'INVOICE' | 'SUBSCRIPTION' | 'USER' | 'CUSTOMER' | 'INTEGRATION' | 'PLATFORM' | 'MSG_PACK';
|
|
3
3
|
/** Existing business fields with independently projected public metadata. */
|
|
4
4
|
interface EntityAuditHttpEntry {
|
|
5
5
|
entity: EntityAuditEntity;
|
package/dist/cjs/messaging.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* modification, or distribution is strictly prohibited.
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.STORE_MESSAGE_SKIP_REASONS = exports.STORE_MESSAGE_STATUSES = exports.MESSAGE_DELIVERY_STAMPS = exports.MESSAGE_LEDGER_KINDS = exports.MESSAGE_CREDITS_PER_CHANNEL = exports.MESSAGE_ALLOWANCE_UNLIMITED = exports.SMS_FALLBACK_CREDITS = exports.WHATSAPP_MESSAGE_CREDITS = exports.MESSAGE_LEDGER_OPERATOR_ONLY_FIELDS = void 0;
|
|
11
|
+
exports.STORE_MESSAGE_SKIP_REASONS = exports.STORE_MESSAGE_STATUSES = exports.MESSAGE_DELIVERY_STAMPS = exports.MESSAGE_PACK_CURRENCY = exports.MESSAGE_LEDGER_KINDS = exports.MESSAGE_CREDITS_PER_CHANNEL = exports.MESSAGE_ALLOWANCE_UNLIMITED = exports.SMS_FALLBACK_CREDITS = exports.WHATSAPP_MESSAGE_CREDITS = exports.MESSAGE_LEDGER_OPERATOR_ONLY_FIELDS = void 0;
|
|
12
12
|
/**
|
|
13
13
|
* Fields a store's own ledger read drops from an `adjustment` entry: it is a
|
|
14
14
|
* platform operator act, and its `actor`, `reason` and `refId` (the
|
|
@@ -41,7 +41,10 @@ exports.MESSAGE_LEDGER_KINDS = [
|
|
|
41
41
|
'allowance-grant',
|
|
42
42
|
'purchase',
|
|
43
43
|
'adjustment',
|
|
44
|
+
'reversal',
|
|
44
45
|
];
|
|
46
|
+
/** `MessagePack.currency` — the only one a pack is sold in. */
|
|
47
|
+
exports.MESSAGE_PACK_CURRENCY = 'ARS';
|
|
45
48
|
exports.MESSAGE_DELIVERY_STAMPS = [
|
|
46
49
|
'delivered',
|
|
47
50
|
'read',
|
package/dist/messaging.d.ts
CHANGED
|
@@ -14,8 +14,12 @@ declare global {
|
|
|
14
14
|
* - `adjustment` — a MANAGER/SUPERVISOR correction of the bought balance,
|
|
15
15
|
* either sign, with `actor` and `reason` — operator-only, with its `refId`:
|
|
16
16
|
* the store's own ledger read drops them (`MESSAGE_LEDGER_OPERATOR_ONLY_FIELDS`).
|
|
17
|
+
* - `reversal` — a pack payment refunded or charged back: the credits its
|
|
18
|
+
* `purchase` added are taken back (`credits` < 0, `refId` the provider
|
|
19
|
+
* payment id). Credits already spent are not refused: the bought balance
|
|
20
|
+
* goes below zero by the rest, and only this kind can take it there.
|
|
17
21
|
*/
|
|
18
|
-
type MessageLedgerKind = 'debit' | 'refund' | 'allowance-grant' | 'purchase' | 'adjustment';
|
|
22
|
+
type MessageLedgerKind = 'debit' | 'refund' | 'allowance-grant' | 'purchase' | 'adjustment' | 'reversal';
|
|
19
23
|
/**
|
|
20
24
|
* How a debited message ended, stamped on its `debit` entry by the sending
|
|
21
25
|
* pipeline — the ONE field written after the entry lands. Absent means
|
|
@@ -51,7 +55,7 @@ declare global {
|
|
|
51
55
|
/** The allowance period (`YYYY-MM`, Buenos Aires) the entry was written in. */
|
|
52
56
|
period: string;
|
|
53
57
|
createdAt: number;
|
|
54
|
-
/** The reservation a `debit`/`refund` belongs to, the purchase id,
|
|
58
|
+
/** The reservation a `debit`/`refund` belongs to, the purchase id, the adjustment id, or a `reversal`'s payment id. */
|
|
55
59
|
refId?: string;
|
|
56
60
|
/** `debit` and `refund` only. */
|
|
57
61
|
noticeType?: StoreMessageNotice;
|
|
@@ -71,7 +75,12 @@ declare global {
|
|
|
71
75
|
}
|
|
72
76
|
/** The store's credits right now, the period already rolled forward when it has ended. */
|
|
73
77
|
interface MessageBalanceView {
|
|
74
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* Bought credits. Below zero only after a pack payment was reversed when
|
|
80
|
+
* its credits were already spent (`reversal`): then nothing more is
|
|
81
|
+
* spent from it until a purchase brings it back up, and `available`
|
|
82
|
+
* counts it as `0`.
|
|
83
|
+
*/
|
|
75
84
|
balance: number;
|
|
76
85
|
/** The current allowance period (`YYYY-MM`, Buenos Aires). */
|
|
77
86
|
period: string;
|
|
@@ -80,7 +89,7 @@ declare global {
|
|
|
80
89
|
allowanceUsed: number;
|
|
81
90
|
/** `max(0, allowanceLimit - allowanceUsed)`; `-1` when unlimited. */
|
|
82
91
|
allowanceLeft: number;
|
|
83
|
-
/** `allowanceLeft + balance` — what the next messages can spend; `-1` when unlimited. */
|
|
92
|
+
/** `allowanceLeft + max(0, balance)` — what the next messages can spend; `-1` when unlimited. */
|
|
84
93
|
available: number;
|
|
85
94
|
}
|
|
86
95
|
/** One page of the ledger, newest first. `cursor` present only when more may follow. */
|
|
@@ -209,6 +218,74 @@ declare global {
|
|
|
209
218
|
serviceOrderId?: string;
|
|
210
219
|
messageNotices: MessageNoticeListItem[];
|
|
211
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* One message pack of the platform catalogue (`MSG_PACK` / `PACK00n`), as a
|
|
223
|
+
* MANAGER reads it on `GET /platform/billing/message-packs`. Prices are the
|
|
224
|
+
* operator's: a reprice is a `PATCH`, never a release. A pack already paid
|
|
225
|
+
* keeps the credits it was bought with — the checkout freezes them.
|
|
226
|
+
*/
|
|
227
|
+
interface MessagePack {
|
|
228
|
+
/** `PACK001`, `PACK002`, … — minted on create, never reused. */
|
|
229
|
+
packId: string;
|
|
230
|
+
name: string;
|
|
231
|
+
/** Whole credits the pack adds to the bought balance, 1–1 000 000. */
|
|
232
|
+
credits: number;
|
|
233
|
+
/** The price in centavos, at least 1 (MercadoPago refuses a zero price). */
|
|
234
|
+
priceCents: number;
|
|
235
|
+
currency: MessagePackCurrency;
|
|
236
|
+
/** An inactive pack is not listed to stores and cannot be checked out. */
|
|
237
|
+
active: boolean;
|
|
238
|
+
/** Ascending order on the store's list. */
|
|
239
|
+
displayOrder: number;
|
|
240
|
+
createdAt: number;
|
|
241
|
+
updatedAt: number;
|
|
242
|
+
}
|
|
243
|
+
/** The only currency a pack is sold in. */
|
|
244
|
+
type MessagePackCurrency = 'ARS';
|
|
245
|
+
/** A pack as a STORE reads it (`GET /message-credits?mode=packs`): active packs only, no bookkeeping. */
|
|
246
|
+
interface StoreMessagePack {
|
|
247
|
+
packId: string;
|
|
248
|
+
name: string;
|
|
249
|
+
credits: number;
|
|
250
|
+
priceCents: number;
|
|
251
|
+
currency: MessagePackCurrency;
|
|
252
|
+
displayOrder: number;
|
|
253
|
+
}
|
|
254
|
+
/** `POST /platform/billing/message-packs` (managerToken). */
|
|
255
|
+
interface MessagePackCreateRequest {
|
|
256
|
+
name: string;
|
|
257
|
+
credits: number;
|
|
258
|
+
priceCents: number;
|
|
259
|
+
/** Defaults to `ARS`, the only value accepted. */
|
|
260
|
+
currency?: MessagePackCurrency;
|
|
261
|
+
/** Defaults to `true`. */
|
|
262
|
+
active?: boolean;
|
|
263
|
+
/** Defaults to `0`. */
|
|
264
|
+
displayOrder?: number;
|
|
265
|
+
/** 10–500 characters, no personal data — lands on the permanent `AUDIT#MSG_PACK#` row. */
|
|
266
|
+
reason: string;
|
|
267
|
+
}
|
|
268
|
+
/** `PATCH /platform/billing/message-packs/{packId}` (managerToken): at least one field besides `reason`. */
|
|
269
|
+
interface MessagePackUpdateRequest {
|
|
270
|
+
name?: string;
|
|
271
|
+
credits?: number;
|
|
272
|
+
priceCents?: number;
|
|
273
|
+
active?: boolean;
|
|
274
|
+
displayOrder?: number;
|
|
275
|
+
/** 10–500 characters, no personal data — lands on the permanent `AUDIT#MSG_PACK#` row. */
|
|
276
|
+
reason: string;
|
|
277
|
+
}
|
|
278
|
+
/** `POST /subscription/message-packs/checkout` (adminToken). */
|
|
279
|
+
interface MessagePackCheckoutRequest {
|
|
280
|
+
packId: string;
|
|
281
|
+
successUrl: string;
|
|
282
|
+
cancelUrl: string;
|
|
283
|
+
}
|
|
284
|
+
/** The MercadoPago Checkout the store pays the pack on; redirect to `initPoint`. */
|
|
285
|
+
interface MessagePackCheckoutResult {
|
|
286
|
+
initPoint: string;
|
|
287
|
+
preferenceId: string;
|
|
288
|
+
}
|
|
212
289
|
interface MessageCreditAdjustmentResult {
|
|
213
290
|
storeId: string;
|
|
214
291
|
/** The `adjustment` ledger entry. */
|
|
@@ -241,7 +318,9 @@ export declare const MESSAGE_CREDITS_PER_CHANNEL: {
|
|
|
241
318
|
readonly whatsapp: 1;
|
|
242
319
|
readonly sms: 3;
|
|
243
320
|
};
|
|
244
|
-
export declare const MESSAGE_LEDGER_KINDS: readonly ["debit", "refund", "allowance-grant", "purchase", "adjustment"];
|
|
321
|
+
export declare const MESSAGE_LEDGER_KINDS: readonly ["debit", "refund", "allowance-grant", "purchase", "adjustment", "reversal"];
|
|
322
|
+
/** `MessagePack.currency` — the only one a pack is sold in. */
|
|
323
|
+
export declare const MESSAGE_PACK_CURRENCY: "ARS";
|
|
245
324
|
export declare const MESSAGE_DELIVERY_STAMPS: readonly ["delivered", "read", "failed"];
|
|
246
325
|
export declare const STORE_MESSAGE_STATUSES: readonly ["queued", "sending", "sent", "delivered", "read", "failed", "undelivered", "skipped"];
|
|
247
326
|
export declare const STORE_MESSAGE_SKIP_REASONS: readonly ["switched-off", "no-consent", "no-phone", "no-credits", "not-configured", "messaging-disabled"];
|
package/dist/messaging.js
CHANGED
|
@@ -38,7 +38,10 @@ export const MESSAGE_LEDGER_KINDS = [
|
|
|
38
38
|
'allowance-grant',
|
|
39
39
|
'purchase',
|
|
40
40
|
'adjustment',
|
|
41
|
+
'reversal',
|
|
41
42
|
];
|
|
43
|
+
/** `MessagePack.currency` — the only one a pack is sold in. */
|
|
44
|
+
export const MESSAGE_PACK_CURRENCY = 'ARS';
|
|
42
45
|
export const MESSAGE_DELIVERY_STAMPS = [
|
|
43
46
|
'delivered',
|
|
44
47
|
'read',
|