platform-types 1.10.846 → 1.10.848
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/cjs/socket.js +7 -9
- package/dist/customer.d.ts +4 -3
- package/dist/messaging.d.ts +61 -0
- package/dist/messaging.js +18 -0
- package/dist/order.d.ts +16 -2
- package/dist/presupuesto.d.ts +4 -1
- package/dist/serviceOrder.d.ts +7 -0
- package/dist/socket.js +7 -9
- 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/cjs/socket.js
CHANGED
|
@@ -316,15 +316,13 @@ exports.SOCKET_ACTIONS = [
|
|
|
316
316
|
'loyalty',
|
|
317
317
|
'orders',
|
|
318
318
|
/**
|
|
319
|
-
* BE →
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
* structurally (by shape, not by `action` name) before the customer's copy
|
|
327
|
-
* goes out.
|
|
319
|
+
* BE → the store's OPERATOR sockets only, on every presupuesto write:
|
|
320
|
+
* create, revise (both rows), a status transition (send/approve/reject/
|
|
321
|
+
* expire), and conversion to an order. Carries the full `Presupuesto` row,
|
|
322
|
+
* `items[].cost` included. ⚠️ Never the row's customer: drafts, the staff
|
|
323
|
+
* `approval.approvedBy` and the operator's `rejection.reason` must not reach
|
|
324
|
+
* a storefront socket — a customer-facing quote view owes its own
|
|
325
|
+
* allow-listed copy.
|
|
328
326
|
*
|
|
329
327
|
* ⚠️ Never a fiscal frame — a `Presupuesto` is never sent to ARCA and never
|
|
330
328
|
* carries an `Invoice`. See the contract's own doc comment
|
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
|
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/presupuesto.d.ts
CHANGED
|
@@ -53,7 +53,10 @@ declare global {
|
|
|
53
53
|
/** Recorded once `status` moves to `approved`. */
|
|
54
54
|
interface PresupuestoApproval {
|
|
55
55
|
approvedAt: number;
|
|
56
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* userId of the operator who recorded it. A customer self-approval would
|
|
58
|
+
* record the customerId here, but no writer offers one yet.
|
|
59
|
+
*/
|
|
57
60
|
approvedBy: string;
|
|
58
61
|
}
|
|
59
62
|
/** Recorded once `status` moves to `rejected`. */
|
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;
|
package/dist/socket.js
CHANGED
|
@@ -313,15 +313,13 @@ export const SOCKET_ACTIONS = [
|
|
|
313
313
|
'loyalty',
|
|
314
314
|
'orders',
|
|
315
315
|
/**
|
|
316
|
-
* BE →
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
* structurally (by shape, not by `action` name) before the customer's copy
|
|
324
|
-
* goes out.
|
|
316
|
+
* BE → the store's OPERATOR sockets only, on every presupuesto write:
|
|
317
|
+
* create, revise (both rows), a status transition (send/approve/reject/
|
|
318
|
+
* expire), and conversion to an order. Carries the full `Presupuesto` row,
|
|
319
|
+
* `items[].cost` included. ⚠️ Never the row's customer: drafts, the staff
|
|
320
|
+
* `approval.approvedBy` and the operator's `rejection.reason` must not reach
|
|
321
|
+
* a storefront socket — a customer-facing quote view owes its own
|
|
322
|
+
* allow-listed copy.
|
|
325
323
|
*
|
|
326
324
|
* ⚠️ Never a fiscal frame — a `Presupuesto` is never sent to ARCA and never
|
|
327
325
|
* carries an `Invoice`. See the contract's own doc comment
|