sinfactura-types 1.10.199 → 1.10.201
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/socket.js +34 -0
- package/dist/marketing.d.ts +51 -0
- package/dist/socket.d.ts +1 -1
- package/dist/socket.js +34 -0
- package/package.json +1 -1
package/dist/cjs/socket.js
CHANGED
|
@@ -61,6 +61,17 @@ exports.SOCKET_ACTIONS = [
|
|
|
61
61
|
'brands',
|
|
62
62
|
'cash',
|
|
63
63
|
'categories',
|
|
64
|
+
/**
|
|
65
|
+
* A marketing campaign created, updated, scheduled or cancelled.
|
|
66
|
+
* Operator-only — `wsPostStore(..., { audience: 'operator' })`.
|
|
67
|
+
*
|
|
68
|
+
* `Campaign` carries no `customerId`, so the customer leg of
|
|
69
|
+
* `'operator-and-customer'` would be a no-op query rather than a leak —
|
|
70
|
+
* but state the audience explicitly anyway: the safety here is a property
|
|
71
|
+
* of today's shape, not of the broadcast call, and a later field would
|
|
72
|
+
* silently turn a no-op into a fan-out.
|
|
73
|
+
*/
|
|
74
|
+
'campaigns',
|
|
64
75
|
'customers',
|
|
65
76
|
/**
|
|
66
77
|
* A delivery created, or an event appended to its timeline. Operator-only —
|
|
@@ -75,10 +86,33 @@ exports.SOCKET_ACTIONS = [
|
|
|
75
86
|
'literals',
|
|
76
87
|
'orders',
|
|
77
88
|
'products',
|
|
89
|
+
/**
|
|
90
|
+
* A promotion created, updated or retired. Operator-only —
|
|
91
|
+
* `wsPostStore(..., { audience: 'operator' })`. Carries no discount
|
|
92
|
+
* mechanics: `couponCode` links to the `Coupon` that holds them, so a
|
|
93
|
+
* customer-visible offer still reaches the storefront through its own
|
|
94
|
+
* surface rather than this operator frame.
|
|
95
|
+
*/
|
|
96
|
+
'promotions',
|
|
97
|
+
/**
|
|
98
|
+
* A customer segment created, updated or deleted. Operator-only —
|
|
99
|
+
* `wsPostStore(..., { audience: 'operator' })`, NEVER
|
|
100
|
+
* `'operator-and-customer'`: `SegmentCriteria` describes how customers are
|
|
101
|
+
* TARGETED, and broadcasting that to a customer socket would disclose the
|
|
102
|
+
* store's targeting rules to the people being targeted.
|
|
103
|
+
*/
|
|
104
|
+
'segments',
|
|
78
105
|
// BE → all store users when a return (devolución) commits. Distinct from
|
|
79
106
|
// `orders` — carries the committed `Return` row itself (stock/account/credit-note
|
|
80
107
|
// effects), not just the order's bumped `updatedAt`.
|
|
81
108
|
'returns',
|
|
109
|
+
/**
|
|
110
|
+
* A message template created, updated or deleted. Operator-only —
|
|
111
|
+
* `wsPostStore(..., { audience: 'operator' })`. A template is authoring
|
|
112
|
+
* content, never a sent message: nothing here implies a customer received
|
|
113
|
+
* anything.
|
|
114
|
+
*/
|
|
115
|
+
'templates',
|
|
82
116
|
// BE → all store users on any service-order mutation. Operator-only by
|
|
83
117
|
// construction: a `ServiceOrder` carries internal diagnosis notes, per-part
|
|
84
118
|
// `unitCost`, work logs and technician ids, and `scrubForCustomer` strips
|
package/dist/marketing.d.ts
CHANGED
|
@@ -36,6 +36,57 @@ declare global {
|
|
|
36
36
|
createdAt: number;
|
|
37
37
|
updatedAt?: number;
|
|
38
38
|
}
|
|
39
|
+
type SegmentOperator = 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'within' | 'olderThan' | 'includes';
|
|
40
|
+
/**
|
|
41
|
+
* What a segment rule may target. Closed deliberately: an open `string`
|
|
42
|
+
* would be the same unversioned escape hatch as an untyped criteria object,
|
|
43
|
+
* just spread across three fields — a typo'd field name would compile, store,
|
|
44
|
+
* and silently match zero customers forever.
|
|
45
|
+
*
|
|
46
|
+
* ⚠️ Limited to what is queryable on `Customer` TODAY. No product or order
|
|
47
|
+
* predicates ("bought category X"), because no domain logic exists to
|
|
48
|
+
* evaluate them — a v1 boundary, not an oversight.
|
|
49
|
+
*
|
|
50
|
+
* ⚠️ RFM (`recency` / `frequency` / `monetary`) is deliberately ABSENT. It
|
|
51
|
+
* has no evaluator, and reserving a word costs nothing to defer while
|
|
52
|
+
* shipping it costs a stored segment whose meaning is undefined until
|
|
53
|
+
* somebody picks semantics — at which point every stored row silently
|
|
54
|
+
* changes meaning. Adding a member is a patch bump; un-defining one is not.
|
|
55
|
+
*/
|
|
56
|
+
type SegmentField = 'balance' | 'creditLimit' | 'lastBuy' | 'disabled' | 'marketing.adds' | 'marketing.email' | 'marketing.phone' | 'marketing.sms' | 'marketing.whatsapp';
|
|
57
|
+
/**
|
|
58
|
+
* ⚠️ The type cannot express which operators suit which field — `disabled`
|
|
59
|
+
* with `gt` compiles. The handler validates the pairing; the type only bounds
|
|
60
|
+
* the vocabulary.
|
|
61
|
+
*/
|
|
62
|
+
interface SegmentRule {
|
|
63
|
+
field: SegmentField;
|
|
64
|
+
operator: SegmentOperator;
|
|
65
|
+
value: string | number | boolean;
|
|
66
|
+
}
|
|
67
|
+
interface SegmentCriteria {
|
|
68
|
+
matchMode: 'all' | 'any';
|
|
69
|
+
rules: SegmentRule[];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A saved, dynamic customer set a campaign targets.
|
|
73
|
+
*
|
|
74
|
+
* ⚠️ **A segment is a TARGETING filter, never a consent decision.** The rule
|
|
75
|
+
* vocabulary can express `marketing.email eq false`, so a segment CAN name
|
|
76
|
+
* customers who have refused a channel. The send pipeline must filter on live
|
|
77
|
+
* consent independently of the segment, and must never treat segment
|
|
78
|
+
* membership as permission to send. A campaign that mails a segment because
|
|
79
|
+
* the segment said so is how a refusal becomes a delivered email.
|
|
80
|
+
*/
|
|
81
|
+
interface Segment {
|
|
82
|
+
storeId: string;
|
|
83
|
+
segmentId: string;
|
|
84
|
+
name: string;
|
|
85
|
+
criteria: SegmentCriteria;
|
|
86
|
+
status: 'active' | 'archived';
|
|
87
|
+
createdAt: number;
|
|
88
|
+
updatedAt?: number;
|
|
89
|
+
}
|
|
39
90
|
/**
|
|
40
91
|
* A marketing wrapper around a coupon that already exists.
|
|
41
92
|
*
|
package/dist/socket.d.ts
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* A client must ignore actions it does not own rather than assume it
|
|
27
27
|
* receives all of them.
|
|
28
28
|
*/
|
|
29
|
-
export declare const SOCKET_ACTIONS: readonly ["account", "appointments", "attendance", "baskets", "cart", "brands", "cash", "categories", "customers", "deliveries", "globals", "invoices", "literals", "orders", "products", "returns", "services", "service-templates", "shifts", "stores", "suppliers", "supplier-invoice", "support", "surveys", "users", "favorites", "webhooks", "account-delete", "baskets-delete", "cart-delete", "log-delete", "notifications", "support-message", "whatsapp-message", "payment_received", "payment_linked", "payment_unlinked", "mercadopago", "mercadopago_dynamic_qr_created", "mercadopago_static_qr_created", "mp_hook_log_appended", "mp_ipn_log_appended", "stripe", "subscription", "caea", "print", "print-order", "print-invoice", "print-product", "print-tag", "print_job_failed", "request_printers", "printers_changed", "agent_status_changed", "print_rules_changed", "printers_active", "agent_command", "maintenance", "currency_auto_updated", "drain_progress", "integration_event_appended", "userActivityRecorded", "mercadolibre_settlement_period", "customDomain", "purchaseOrders"];
|
|
29
|
+
export declare const SOCKET_ACTIONS: readonly ["account", "appointments", "attendance", "baskets", "cart", "brands", "cash", "categories", "campaigns", "customers", "deliveries", "globals", "invoices", "literals", "orders", "products", "promotions", "segments", "returns", "templates", "services", "service-templates", "shifts", "stores", "suppliers", "supplier-invoice", "support", "surveys", "users", "favorites", "webhooks", "account-delete", "baskets-delete", "cart-delete", "log-delete", "notifications", "support-message", "whatsapp-message", "payment_received", "payment_linked", "payment_unlinked", "mercadopago", "mercadopago_dynamic_qr_created", "mercadopago_static_qr_created", "mp_hook_log_appended", "mp_ipn_log_appended", "stripe", "subscription", "caea", "print", "print-order", "print-invoice", "print-product", "print-tag", "print_job_failed", "request_printers", "printers_changed", "agent_status_changed", "print_rules_changed", "printers_active", "agent_command", "maintenance", "currency_auto_updated", "drain_progress", "integration_event_appended", "userActivityRecorded", "mercadolibre_settlement_period", "customDomain", "purchaseOrders"];
|
|
30
30
|
/** Union of every server→client data-frame action. */
|
|
31
31
|
export type SocketAction = (typeof SOCKET_ACTIONS)[number];
|
|
32
32
|
/**
|
package/dist/socket.js
CHANGED
|
@@ -58,6 +58,17 @@ export const SOCKET_ACTIONS = [
|
|
|
58
58
|
'brands',
|
|
59
59
|
'cash',
|
|
60
60
|
'categories',
|
|
61
|
+
/**
|
|
62
|
+
* A marketing campaign created, updated, scheduled or cancelled.
|
|
63
|
+
* Operator-only — `wsPostStore(..., { audience: 'operator' })`.
|
|
64
|
+
*
|
|
65
|
+
* `Campaign` carries no `customerId`, so the customer leg of
|
|
66
|
+
* `'operator-and-customer'` would be a no-op query rather than a leak —
|
|
67
|
+
* but state the audience explicitly anyway: the safety here is a property
|
|
68
|
+
* of today's shape, not of the broadcast call, and a later field would
|
|
69
|
+
* silently turn a no-op into a fan-out.
|
|
70
|
+
*/
|
|
71
|
+
'campaigns',
|
|
61
72
|
'customers',
|
|
62
73
|
/**
|
|
63
74
|
* A delivery created, or an event appended to its timeline. Operator-only —
|
|
@@ -72,10 +83,33 @@ export const SOCKET_ACTIONS = [
|
|
|
72
83
|
'literals',
|
|
73
84
|
'orders',
|
|
74
85
|
'products',
|
|
86
|
+
/**
|
|
87
|
+
* A promotion created, updated or retired. Operator-only —
|
|
88
|
+
* `wsPostStore(..., { audience: 'operator' })`. Carries no discount
|
|
89
|
+
* mechanics: `couponCode` links to the `Coupon` that holds them, so a
|
|
90
|
+
* customer-visible offer still reaches the storefront through its own
|
|
91
|
+
* surface rather than this operator frame.
|
|
92
|
+
*/
|
|
93
|
+
'promotions',
|
|
94
|
+
/**
|
|
95
|
+
* A customer segment created, updated or deleted. Operator-only —
|
|
96
|
+
* `wsPostStore(..., { audience: 'operator' })`, NEVER
|
|
97
|
+
* `'operator-and-customer'`: `SegmentCriteria` describes how customers are
|
|
98
|
+
* TARGETED, and broadcasting that to a customer socket would disclose the
|
|
99
|
+
* store's targeting rules to the people being targeted.
|
|
100
|
+
*/
|
|
101
|
+
'segments',
|
|
75
102
|
// BE → all store users when a return (devolución) commits. Distinct from
|
|
76
103
|
// `orders` — carries the committed `Return` row itself (stock/account/credit-note
|
|
77
104
|
// effects), not just the order's bumped `updatedAt`.
|
|
78
105
|
'returns',
|
|
106
|
+
/**
|
|
107
|
+
* A message template created, updated or deleted. Operator-only —
|
|
108
|
+
* `wsPostStore(..., { audience: 'operator' })`. A template is authoring
|
|
109
|
+
* content, never a sent message: nothing here implies a customer received
|
|
110
|
+
* anything.
|
|
111
|
+
*/
|
|
112
|
+
'templates',
|
|
79
113
|
// BE → all store users on any service-order mutation. Operator-only by
|
|
80
114
|
// construction: a `ServiceOrder` carries internal diagnosis notes, per-part
|
|
81
115
|
// `unitCost`, work logs and technician ids, and `scrubForCustomer` strips
|