platform-types 1.10.847 → 1.10.849
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/cjs/messaging.js +19 -1
- package/dist/customer.d.ts +128 -3
- package/dist/messaging.d.ts +61 -0
- package/dist/messaging.js +18 -0
- package/dist/order.d.ts +16 -2
- package/dist/serviceOrder.d.ts +7 -0
- package/package.json +1 -1
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.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_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
|
|
@@ -47,3 +47,21 @@ exports.MESSAGE_DELIVERY_STAMPS = [
|
|
|
47
47
|
'read',
|
|
48
48
|
'failed',
|
|
49
49
|
];
|
|
50
|
+
exports.STORE_MESSAGE_STATUSES = [
|
|
51
|
+
'queued',
|
|
52
|
+
'sending',
|
|
53
|
+
'sent',
|
|
54
|
+
'delivered',
|
|
55
|
+
'read',
|
|
56
|
+
'failed',
|
|
57
|
+
'undelivered',
|
|
58
|
+
'skipped',
|
|
59
|
+
];
|
|
60
|
+
exports.STORE_MESSAGE_SKIP_REASONS = [
|
|
61
|
+
'switched-off',
|
|
62
|
+
'no-consent',
|
|
63
|
+
'no-phone',
|
|
64
|
+
'no-credits',
|
|
65
|
+
'not-configured',
|
|
66
|
+
'messaging-disabled',
|
|
67
|
+
];
|
package/dist/customer.d.ts
CHANGED
|
@@ -102,10 +102,11 @@ declare global {
|
|
|
102
102
|
* `back-office` (staff, `POST /customers`), `storefront-post-purchase` (the
|
|
103
103
|
* one-tap offer after an order is placed — the signed-in banner through web
|
|
104
104
|
* `POST /user` with `whatsappOptInOrigin: 'post-purchase'`, or a guest's
|
|
105
|
-
* `POST /orders/status/whatsapp-opt-in`)
|
|
106
|
-
* shopper's own profile toggle, web `POST /user`)
|
|
105
|
+
* `POST /orders/status/whatsapp-opt-in`), `storefront-profile` (the
|
|
106
|
+
* shopper's own profile toggle, web `POST /user`) and `whatsapp-reply` (a
|
|
107
|
+
* withdrawal only: the customer answered «BAJA» to a store notice).
|
|
107
108
|
*/
|
|
108
|
-
type WhatsappNoticeSource = 'back-office' | 'storefront-post-purchase' | 'storefront-profile';
|
|
109
|
+
type WhatsappNoticeSource = 'back-office' | 'storefront-post-purchase' | 'storefront-profile' | 'whatsapp-reply';
|
|
109
110
|
/**
|
|
110
111
|
* Provenance of one transactional WhatsApp grant or withdrawal.
|
|
111
112
|
* Server-written only. Carries NO phone number and NO IP, unlike
|
|
@@ -1256,6 +1257,88 @@ declare global {
|
|
|
1256
1257
|
productId: string;
|
|
1257
1258
|
lastOrderedAt: number;
|
|
1258
1259
|
}
|
|
1260
|
+
/**
|
|
1261
|
+
* One entry of `CustomerDataExport.serviceOrders`: a service ticket as the
|
|
1262
|
+
* customer was told about it — an ALLOW-LIST of the `ServiceOrder` row, never
|
|
1263
|
+
* the row itself. The diagnosis, the work logs, the parts and their cost, the
|
|
1264
|
+
* technician, the operator status notes and who moved each status, the quote's
|
|
1265
|
+
* approver/rejecter and rejection note, the hold, the deposits and the
|
|
1266
|
+
* pictures are the workshop's own record and are NOT here.
|
|
1267
|
+
*/
|
|
1268
|
+
interface CustomerDataExportServiceOrder {
|
|
1269
|
+
serviceOrderId: string;
|
|
1270
|
+
ticketNumber: string;
|
|
1271
|
+
serviceType: ServiceType;
|
|
1272
|
+
status: ServiceStatus;
|
|
1273
|
+
/** The status timeline, oldest first: each status and when it was entered, nothing else. */
|
|
1274
|
+
statusHistory: {
|
|
1275
|
+
status: ServiceStatus;
|
|
1276
|
+
timestamp: number;
|
|
1277
|
+
}[];
|
|
1278
|
+
/** The equipment as received. Absent when the ticket recorded none (or an erasure removed it). */
|
|
1279
|
+
equipment?: {
|
|
1280
|
+
type?: string;
|
|
1281
|
+
brand?: string;
|
|
1282
|
+
model?: string;
|
|
1283
|
+
serialNumber?: string;
|
|
1284
|
+
accessories?: string[];
|
|
1285
|
+
condition?: string;
|
|
1286
|
+
reportedIssue?: string;
|
|
1287
|
+
};
|
|
1288
|
+
/** Every quote version, oldest first — the customer-facing fields only. */
|
|
1289
|
+
quote?: {
|
|
1290
|
+
quoteId: string;
|
|
1291
|
+
version: number;
|
|
1292
|
+
status: ServiceQuoteStatus;
|
|
1293
|
+
amount: number;
|
|
1294
|
+
currency?: string;
|
|
1295
|
+
quotedAt?: number;
|
|
1296
|
+
expiresAt?: number;
|
|
1297
|
+
/** When and through which channel the customer approved — never who recorded it. */
|
|
1298
|
+
approval?: {
|
|
1299
|
+
at: number;
|
|
1300
|
+
channel: ServiceQuoteChannel;
|
|
1301
|
+
};
|
|
1302
|
+
/** When and why the customer declined — never the operator's note or who recorded it. */
|
|
1303
|
+
rejection?: {
|
|
1304
|
+
at: number;
|
|
1305
|
+
reason: ServiceQuoteRejectionReason;
|
|
1306
|
+
};
|
|
1307
|
+
}[];
|
|
1308
|
+
total?: number;
|
|
1309
|
+
currency: string;
|
|
1310
|
+
createdAt: number;
|
|
1311
|
+
promisedAt?: number;
|
|
1312
|
+
readyAt?: number;
|
|
1313
|
+
deliveredAt?: number;
|
|
1314
|
+
/** `true` on a ticket the store soft-deleted; absent on a live one. */
|
|
1315
|
+
disabled?: boolean;
|
|
1316
|
+
}
|
|
1317
|
+
/**
|
|
1318
|
+
* `CustomerDataExport.loyalty`: the subject's points account and ledger. Never
|
|
1319
|
+
* the acting user (`createdBy`) of a ledger row — a third party's id.
|
|
1320
|
+
*/
|
|
1321
|
+
interface CustomerDataExportLoyalty {
|
|
1322
|
+
/** Absent when nothing ever credited or debited the customer (no account row exists). */
|
|
1323
|
+
account?: {
|
|
1324
|
+
balance: number;
|
|
1325
|
+
lifetimePoints: number;
|
|
1326
|
+
tierId?: string;
|
|
1327
|
+
updatedAt: number;
|
|
1328
|
+
};
|
|
1329
|
+
/** The ledger, newest first. */
|
|
1330
|
+
transactions: {
|
|
1331
|
+
transactionId: string;
|
|
1332
|
+
kind: LoyaltyTransactionKind;
|
|
1333
|
+
/** Signed, as written: an `earn` positive, a `redeem` negative, an `adjust` either. */
|
|
1334
|
+
points: number;
|
|
1335
|
+
currency: string;
|
|
1336
|
+
createdAt: number;
|
|
1337
|
+
orderId?: string;
|
|
1338
|
+
couponCode?: string;
|
|
1339
|
+
rewardId?: string;
|
|
1340
|
+
}[];
|
|
1341
|
+
}
|
|
1259
1342
|
/**
|
|
1260
1343
|
* Supported customer, CRM, order, invoice, ledger and directly customer-linked
|
|
1261
1344
|
* payment collections, assembled for the SUBJECT
|
|
@@ -1363,6 +1446,20 @@ declare global {
|
|
|
1363
1446
|
* storefront quote requests).
|
|
1364
1447
|
*/
|
|
1365
1448
|
quoteRequests?: QuoteRequest[];
|
|
1449
|
+
/**
|
|
1450
|
+
* The subject's service tickets, newest first, on BOTH surfaces: live and
|
|
1451
|
+
* soft-deleted (`disabled: true`), under their own id plus any merged-away id
|
|
1452
|
+
* folded into them (the same folded ids, and the same cap, as the financial
|
|
1453
|
+
* collections). At most 200 live and 200 soft-deleted per id. Absent when
|
|
1454
|
+
* there is none (and from servers predating this section).
|
|
1455
|
+
*/
|
|
1456
|
+
serviceOrders?: CustomerDataExportServiceOrder[];
|
|
1457
|
+
/**
|
|
1458
|
+
* The subject's loyalty account and points ledger (at most 1,000 rows), on
|
|
1459
|
+
* BOTH surfaces, under their OWN id only. Absent when there is neither an
|
|
1460
|
+
* account nor a ledger row (and from servers predating this section).
|
|
1461
|
+
*/
|
|
1462
|
+
loyalty?: CustomerDataExportLoyalty;
|
|
1366
1463
|
/**
|
|
1367
1464
|
* Per COLLECTION, and honest: `true` means the read stopped before the
|
|
1368
1465
|
* end of a partition, folded financial IDs were omitted at the cap, or whole
|
|
@@ -1398,6 +1495,15 @@ declare global {
|
|
|
1398
1495
|
* past the per-export request cap, may be missing.
|
|
1399
1496
|
*/
|
|
1400
1497
|
quoteRequests?: boolean;
|
|
1498
|
+
/**
|
|
1499
|
+
* Present when `serviceOrders` is, or when merged-away ids were cut at the
|
|
1500
|
+
* folded-id cap — then `true`: a ticket under an omitted id, past the
|
|
1501
|
+
* per-id cap or the read budget, or cut by the response-byte bound, may be
|
|
1502
|
+
* missing.
|
|
1503
|
+
*/
|
|
1504
|
+
serviceOrders?: boolean;
|
|
1505
|
+
/** Present exactly when `loyalty` is: `true` when ledger rows past the cap, or the byte bound, are missing. */
|
|
1506
|
+
loyalty?: boolean;
|
|
1401
1507
|
};
|
|
1402
1508
|
}
|
|
1403
1509
|
/**
|
|
@@ -1736,6 +1842,25 @@ declare global {
|
|
|
1736
1842
|
* (`CUSTOMER_ANONYMIZE_CREDIT_NOTE_MARKER_INCOMPLETE`).
|
|
1737
1843
|
*/
|
|
1738
1844
|
creditNoteMarkerEraseComplete?: boolean;
|
|
1845
|
+
/**
|
|
1846
|
+
* `SERVICE#` tickets of this customer, live and soft-deleted, whose
|
|
1847
|
+
* customer-describing free text this erasure took off: `equipment`'s
|
|
1848
|
+
* `serialNumber`, `reportedIssue`, `condition` and `accessories` REMOVEd, and
|
|
1849
|
+
* `search` rebuilt without the serial and the customer's name. The ticket's
|
|
1850
|
+
* operational and fiscal skeleton is kept. Both wires carry it: it counts the
|
|
1851
|
+
* subject's own rows. A re-issue counts only the tickets an earlier pass did
|
|
1852
|
+
* not reach. Optional only so the field is additive.
|
|
1853
|
+
*/
|
|
1854
|
+
serviceOrdersScrubbed?: number;
|
|
1855
|
+
/**
|
|
1856
|
+
* `false` when those tickets could not be read or written to the end, so a
|
|
1857
|
+
* serial or a reported fault may remain. Re-issuing the erasure re-runs the
|
|
1858
|
+
* step (it reads at most 1,000 of the subject's tickets, so past that a
|
|
1859
|
+
* re-issue cannot finish it); BOTH erasure handlers write a deduped `ERROR` row
|
|
1860
|
+
* (`CUSTOMER_ANONYMIZE_SERVICE_ORDERS_INCOMPLETE`). Only a measured `true` is
|
|
1861
|
+
* a finished step.
|
|
1862
|
+
*/
|
|
1863
|
+
serviceOrderScrubComplete?: boolean;
|
|
1739
1864
|
/**
|
|
1740
1865
|
* Storefront quote requests the subject sent signed in
|
|
1741
1866
|
* (`QUOTEREQUEST#{storeId}`), DELETED by this erasure — the whole row goes:
|
package/dist/messaging.d.ts
CHANGED
|
@@ -144,6 +144,65 @@ declare global {
|
|
|
144
144
|
*/
|
|
145
145
|
adjustmentId: string;
|
|
146
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Where one store-paid customer notice stands (`MSG#{storeId}` row):
|
|
149
|
+
* - `queued` — decided to send, credits reserved, handed to the sender.
|
|
150
|
+
* - `sending` — the sender claimed it; the provider call is in flight, or
|
|
151
|
+
* its outcome is unknown (the provider may have accepted it — it is never
|
|
152
|
+
* sent again).
|
|
153
|
+
* - `sent` — the provider accepted it.
|
|
154
|
+
* - `delivered` / `read` — reported by the provider.
|
|
155
|
+
* - `failed` — the provider refused it or reported it failed; its credits
|
|
156
|
+
* were refunded.
|
|
157
|
+
* - `undelivered` — the provider reported it could not be delivered; its
|
|
158
|
+
* credits were refunded.
|
|
159
|
+
* - `skipped` — never sent, see `StoreMessageSkipReason`.
|
|
160
|
+
*/
|
|
161
|
+
type StoreMessageStatus = 'queued' | 'sending' | 'sent' | 'delivered' | 'read' | 'failed' | 'undelivered' | 'skipped';
|
|
162
|
+
/**
|
|
163
|
+
* Why a notice was not sent:
|
|
164
|
+
* - `switched-off` — the store's switch for this notice is off.
|
|
165
|
+
* - `no-consent` — the customer has not opted in to WhatsApp notices (or
|
|
166
|
+
* the order has no live customer).
|
|
167
|
+
* - `no-phone` — no usable number (see `MessageNoticeListItem`).
|
|
168
|
+
* - `no-credits` — the store's credits could not cover it.
|
|
169
|
+
* - `not-configured` — the platform has no approved template for it yet.
|
|
170
|
+
* - `messaging-disabled` — the `tenantMessagingEnabled` platform global is
|
|
171
|
+
* off. Decided, never stored: no notice row is written for it.
|
|
172
|
+
*/
|
|
173
|
+
type StoreMessageSkipReason = 'switched-off' | 'no-consent' | 'no-phone' | 'no-credits' | 'not-configured' | 'messaging-disabled';
|
|
174
|
+
/**
|
|
175
|
+
* One customer notice of an order or a service order — `Order.messageNotices`
|
|
176
|
+
* (operator point read) and `ServiceOrder.messageNotices`. Operator-only: no
|
|
177
|
+
* storefront read or customer socket carries it. Oldest first.
|
|
178
|
+
*/
|
|
179
|
+
interface MessageNoticeListItem {
|
|
180
|
+
/** Stable per notice occurrence; a frame replaces the item with the same id. */
|
|
181
|
+
noticeId: string;
|
|
182
|
+
notice: StoreMessageNotice;
|
|
183
|
+
/** What happened to the order: `ready`, `delivered`, `status:<to>`, `quote-sent`, `hold-set`, `hold-cleared`. */
|
|
184
|
+
event: string;
|
|
185
|
+
/** The channel it went out (or would have gone out) on. Absent on a skipped notice. */
|
|
186
|
+
channel?: MessageCreditChannel;
|
|
187
|
+
status: StoreMessageStatus;
|
|
188
|
+
/** Present exactly when `status` is `skipped`. */
|
|
189
|
+
skipReason?: StoreMessageSkipReason;
|
|
190
|
+
/** `true` once the WhatsApp leg failed and the SMS fallback took over. */
|
|
191
|
+
fellBackToSms?: boolean;
|
|
192
|
+
/** When the notice was decided. */
|
|
193
|
+
ts: number;
|
|
194
|
+
updatedAt: number;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* The `orders` / `services` frame the notice pipeline sends (operator audience
|
|
198
|
+
* only) whenever a notice of that entity moves: the entity's id and its WHOLE
|
|
199
|
+
* current list, never a delta — merge it onto the cached row.
|
|
200
|
+
*/
|
|
201
|
+
interface MessageNoticesFrameData {
|
|
202
|
+
orderId?: string;
|
|
203
|
+
serviceOrderId?: string;
|
|
204
|
+
messageNotices: MessageNoticeListItem[];
|
|
205
|
+
}
|
|
147
206
|
interface MessageCreditAdjustmentResult {
|
|
148
207
|
storeId: string;
|
|
149
208
|
/** The `adjustment` ledger entry. */
|
|
@@ -178,3 +237,5 @@ export declare const MESSAGE_CREDITS_PER_CHANNEL: {
|
|
|
178
237
|
};
|
|
179
238
|
export declare const MESSAGE_LEDGER_KINDS: readonly ["debit", "refund", "allowance-grant", "purchase", "adjustment"];
|
|
180
239
|
export declare const MESSAGE_DELIVERY_STAMPS: readonly ["delivered", "read", "failed"];
|
|
240
|
+
export declare const STORE_MESSAGE_STATUSES: readonly ["queued", "sending", "sent", "delivered", "read", "failed", "undelivered", "skipped"];
|
|
241
|
+
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
|
@@ -44,3 +44,21 @@ export const MESSAGE_DELIVERY_STAMPS = [
|
|
|
44
44
|
'read',
|
|
45
45
|
'failed',
|
|
46
46
|
];
|
|
47
|
+
export const STORE_MESSAGE_STATUSES = [
|
|
48
|
+
'queued',
|
|
49
|
+
'sending',
|
|
50
|
+
'sent',
|
|
51
|
+
'delivered',
|
|
52
|
+
'read',
|
|
53
|
+
'failed',
|
|
54
|
+
'undelivered',
|
|
55
|
+
'skipped',
|
|
56
|
+
];
|
|
57
|
+
export const STORE_MESSAGE_SKIP_REASONS = [
|
|
58
|
+
'switched-off',
|
|
59
|
+
'no-consent',
|
|
60
|
+
'no-phone',
|
|
61
|
+
'no-credits',
|
|
62
|
+
'not-configured',
|
|
63
|
+
'messaging-disabled',
|
|
64
|
+
];
|
package/dist/order.d.ts
CHANGED
|
@@ -443,7 +443,10 @@ declare global {
|
|
|
443
443
|
tracking?: OrderShipmentTracking;
|
|
444
444
|
/** ≤ 500 chars, operator-only. */
|
|
445
445
|
note?: string;
|
|
446
|
-
/**
|
|
446
|
+
/**
|
|
447
|
+
* Accepted and IGNORED: a completing shipment owes the store's `orderShipped`
|
|
448
|
+
* notice, which the store's settings decide (`docs/NOTIFICATIONS.md` § Store notices).
|
|
449
|
+
*/
|
|
447
450
|
sendSms?: boolean;
|
|
448
451
|
}
|
|
449
452
|
/**
|
|
@@ -2025,6 +2028,14 @@ declare global {
|
|
|
2025
2028
|
* on a list branch, the storefront read or any socket frame.
|
|
2026
2029
|
*/
|
|
2027
2030
|
cancellation?: OrderCancellability;
|
|
2031
|
+
/**
|
|
2032
|
+
* The order's store-paid customer notices (WhatsApp / SMS), oldest first,
|
|
2033
|
+
* read from the `MSG#` partition — never stored on the ORDER row, and a
|
|
2034
|
+
* body echoing it is stripped. Present only while the
|
|
2035
|
+
* `tenantMessagingEnabled` platform global is on. Kept live by the
|
|
2036
|
+
* operator `orders` frame `MessageNoticesFrameData`.
|
|
2037
|
+
*/
|
|
2038
|
+
messageNotices?: MessageNoticeListItem[];
|
|
2028
2039
|
}
|
|
2029
2040
|
/**
|
|
2030
2041
|
* `POST /orders { mode: 'tender' }` — ring one or more tender legs against an
|
|
@@ -2419,7 +2430,10 @@ declare global {
|
|
|
2419
2430
|
* stored. Required alongside {@link lines}, which is refused without it.
|
|
2420
2431
|
*/
|
|
2421
2432
|
counterSale?: boolean;
|
|
2422
|
-
/**
|
|
2433
|
+
/**
|
|
2434
|
+
* Accepted and IGNORED, never stored: the store's `orderReady` notice is
|
|
2435
|
+
* decided by the store's settings (`docs/NOTIFICATIONS.md` § Store notices).
|
|
2436
|
+
*/
|
|
2423
2437
|
sendSms?: boolean;
|
|
2424
2438
|
/** Persist `deliveryAddress` as the customer's default. Directive only, never stored. */
|
|
2425
2439
|
saveAsDefault?: boolean;
|
package/dist/serviceOrder.d.ts
CHANGED
|
@@ -918,6 +918,13 @@ declare global {
|
|
|
918
918
|
* write response over a previously-read derivation.
|
|
919
919
|
*/
|
|
920
920
|
slaStatus?: ServiceSlaStatus;
|
|
921
|
+
/**
|
|
922
|
+
* The ticket's store-paid customer notices (WhatsApp / SMS), oldest first —
|
|
923
|
+
* the point read only, read from the `MSG#` partition and never persisted.
|
|
924
|
+
* Present only while the `tenantMessagingEnabled` platform global is on.
|
|
925
|
+
* Kept live by the operator `services` frame `MessageNoticesFrameData`.
|
|
926
|
+
*/
|
|
927
|
+
messageNotices?: MessageNoticeListItem[];
|
|
921
928
|
technicianId?: string;
|
|
922
929
|
/** Unix ms the order was assigned. */
|
|
923
930
|
assignedAt?: number;
|