sinfactura-types 1.6.8 → 1.6.11
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/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/store.d.ts +1 -7
- package/dist/storefrontEvent.d.ts +99 -0
- package/dist/storefrontEvent.js +16 -0
- package/dist/userActivity.d.ts +102 -0
- package/dist/userActivity.js +19 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -21,8 +21,10 @@ export * from "./product";
|
|
|
21
21
|
export * from "./return";
|
|
22
22
|
export * from "./stock";
|
|
23
23
|
export * from "./store";
|
|
24
|
+
export * from "./storefrontEvent";
|
|
24
25
|
export * from "./subscription";
|
|
25
26
|
export * from "./supplier";
|
|
26
27
|
export * from "./user";
|
|
28
|
+
export * from "./userActivity";
|
|
27
29
|
export * from "./whatsapp";
|
|
28
30
|
export * from "./provinces";
|
package/dist/index.js
CHANGED
|
@@ -21,8 +21,10 @@ export * from "./product";
|
|
|
21
21
|
export * from "./return";
|
|
22
22
|
export * from "./stock";
|
|
23
23
|
export * from "./store";
|
|
24
|
+
export * from "./storefrontEvent";
|
|
24
25
|
export * from "./subscription";
|
|
25
26
|
export * from "./supplier";
|
|
26
27
|
export * from "./user";
|
|
28
|
+
export * from "./userActivity";
|
|
27
29
|
export * from "./whatsapp";
|
|
28
30
|
export * from "./provinces";
|
package/dist/store.d.ts
CHANGED
|
@@ -119,13 +119,6 @@ declare global {
|
|
|
119
119
|
priceDecimals: 0 | 1 | 2 | 3;
|
|
120
120
|
stock: boolean;
|
|
121
121
|
changePrice: boolean;
|
|
122
|
-
/**
|
|
123
|
-
* @deprecated since app#1539 — alias of `displayCurrency`. Kept
|
|
124
|
-
* during the migration so unmigrated readers stay correct.
|
|
125
|
-
* Removed once every FE read-site has switched to
|
|
126
|
-
* `displayCurrency`.
|
|
127
|
-
*/
|
|
128
|
-
currency: string;
|
|
129
122
|
/**
|
|
130
123
|
* Back-office display currency (catalogId). The single currency
|
|
131
124
|
* the operator's screens are framed in — distinct from the
|
|
@@ -152,6 +145,7 @@ declare global {
|
|
|
152
145
|
photoData?: string;
|
|
153
146
|
newPhotoURL?: string;
|
|
154
147
|
removePhotoURL?: string;
|
|
148
|
+
mercadopagoUserId?: string;
|
|
155
149
|
currencies: StoreCurrencySubscription[];
|
|
156
150
|
cashInMethods: Method[];
|
|
157
151
|
cashOutMethods: Method[];
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface StorefrontEventBase {
|
|
3
|
+
anonymous_id: string;
|
|
4
|
+
customer_id?: string;
|
|
5
|
+
tenant_store_id: string;
|
|
6
|
+
schema_version: 1;
|
|
7
|
+
event_id: string;
|
|
8
|
+
screen_type: 'desktop' | 'mobile';
|
|
9
|
+
app_version: number;
|
|
10
|
+
ts: string;
|
|
11
|
+
}
|
|
12
|
+
interface ProductViewedEvent extends StorefrontEventBase {
|
|
13
|
+
event: 'Product Viewed';
|
|
14
|
+
product_id: string;
|
|
15
|
+
product_name: string;
|
|
16
|
+
price: number;
|
|
17
|
+
currency: string;
|
|
18
|
+
}
|
|
19
|
+
interface ProductListViewedEvent extends StorefrontEventBase {
|
|
20
|
+
event: 'Product List Viewed';
|
|
21
|
+
list_name: string;
|
|
22
|
+
products: Array<{
|
|
23
|
+
product_id: string;
|
|
24
|
+
product_name: string;
|
|
25
|
+
price: number;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
28
|
+
interface CartItemAddedEvent extends StorefrontEventBase {
|
|
29
|
+
event: 'Cart Item Added';
|
|
30
|
+
product_id: string;
|
|
31
|
+
product_name: string;
|
|
32
|
+
quantity: number;
|
|
33
|
+
price: number;
|
|
34
|
+
currency: string;
|
|
35
|
+
}
|
|
36
|
+
interface CartItemRemovedEvent extends StorefrontEventBase {
|
|
37
|
+
event: 'Cart Item Removed';
|
|
38
|
+
product_id: string;
|
|
39
|
+
product_name: string;
|
|
40
|
+
quantity: number;
|
|
41
|
+
}
|
|
42
|
+
interface CartViewedEvent extends StorefrontEventBase {
|
|
43
|
+
event: 'Cart Viewed';
|
|
44
|
+
cart_total: number;
|
|
45
|
+
items_count: number;
|
|
46
|
+
currency: string;
|
|
47
|
+
}
|
|
48
|
+
interface SearchSubmittedEvent extends StorefrontEventBase {
|
|
49
|
+
event: 'Search Submitted';
|
|
50
|
+
query: string;
|
|
51
|
+
results_count: number;
|
|
52
|
+
}
|
|
53
|
+
interface CheckoutStartedEvent extends StorefrontEventBase {
|
|
54
|
+
event: 'Checkout Started';
|
|
55
|
+
cart_total: number;
|
|
56
|
+
items_count: number;
|
|
57
|
+
currency: string;
|
|
58
|
+
}
|
|
59
|
+
interface CheckoutStepCompletedEvent extends StorefrontEventBase {
|
|
60
|
+
event: 'Checkout Step Completed';
|
|
61
|
+
step: number;
|
|
62
|
+
step_name: string;
|
|
63
|
+
}
|
|
64
|
+
interface PaymentInfoEnteredEvent extends StorefrontEventBase {
|
|
65
|
+
event: 'Payment Info Entered';
|
|
66
|
+
payment_type: string;
|
|
67
|
+
}
|
|
68
|
+
interface OrderCompletedEvent extends StorefrontEventBase {
|
|
69
|
+
event: 'Order Completed';
|
|
70
|
+
transaction_id: string;
|
|
71
|
+
revenue: number;
|
|
72
|
+
currency: string;
|
|
73
|
+
items_count: number;
|
|
74
|
+
}
|
|
75
|
+
interface CustomerLoggedInEvent extends StorefrontEventBase {
|
|
76
|
+
event: 'Customer Logged In';
|
|
77
|
+
method: 'email' | 'google' | 'facebook';
|
|
78
|
+
}
|
|
79
|
+
interface CustomerSignedUpEvent extends StorefrontEventBase {
|
|
80
|
+
event: 'Customer Signed Up';
|
|
81
|
+
method: 'email' | 'google' | 'facebook';
|
|
82
|
+
}
|
|
83
|
+
interface CustomerLoggedOutEvent extends StorefrontEventBase {
|
|
84
|
+
event: 'Customer Logged Out';
|
|
85
|
+
}
|
|
86
|
+
interface CustomerIdentifiedEvent extends StorefrontEventBase {
|
|
87
|
+
event: 'Customer Identified';
|
|
88
|
+
customer_id: string;
|
|
89
|
+
}
|
|
90
|
+
type StorefrontEvent = ProductViewedEvent | ProductListViewedEvent | CartItemAddedEvent | CartItemRemovedEvent | CartViewedEvent | SearchSubmittedEvent | CheckoutStartedEvent | CheckoutStepCompletedEvent | PaymentInfoEnteredEvent | OrderCompletedEvent | CustomerLoggedInEvent | CustomerSignedUpEvent | CustomerLoggedOutEvent | CustomerIdentifiedEvent;
|
|
91
|
+
interface IdentityLink {
|
|
92
|
+
tenant_store_id: string;
|
|
93
|
+
anonymous_id: string;
|
|
94
|
+
customer_id: string;
|
|
95
|
+
linked_at: string;
|
|
96
|
+
link_event_id: string;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Typed storefront events pipeline (types#69, api#1239/#1240,
|
|
2
|
+
// storefront#425/#429, app#1638). Schema-validated discriminated union
|
|
3
|
+
// emitted by `sinfactura/storefront` (via the `track()` wrapper in
|
|
4
|
+
// `src/utils/track.ts`), validated and persisted by `sinfactura/api`
|
|
5
|
+
// (Zod mirror in `stacks/helpers/storefrontEvents/schema.ts`), rendered
|
|
6
|
+
// by `sinfactura/app` (typed activity feed in `<ActivityFeed>`).
|
|
7
|
+
//
|
|
8
|
+
// Naming follows Segment Spec: Title Case Object + Past-Tense Action
|
|
9
|
+
// for event names; snake_case for properties so the GA4 / Segment
|
|
10
|
+
// vocabulary on the wire maps without translation.
|
|
11
|
+
//
|
|
12
|
+
// 14 variants — the 4 storefront-only events (`Page Viewed`,
|
|
13
|
+
// `Favorite Toggled`, `Whatsapp Clicked`, `Error Captured`) currently
|
|
14
|
+
// emitted by storefront are NOT in this taxonomy yet; they ride the
|
|
15
|
+
// legacy `Log` path and are tracked for a follow-up types release.
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface UserActivityEventBase {
|
|
3
|
+
tenant_store_id: string;
|
|
4
|
+
user_id: string;
|
|
5
|
+
actor_role: 'USER' | 'ADMIN' | 'SUPERVISOR' | 'MANAGER';
|
|
6
|
+
actor_full_name: string;
|
|
7
|
+
actor_ip?: string;
|
|
8
|
+
event_id: string;
|
|
9
|
+
schema_version: 1;
|
|
10
|
+
ts: string;
|
|
11
|
+
}
|
|
12
|
+
interface UserLoggedInEvent extends UserActivityEventBase {
|
|
13
|
+
event: 'User Logged In';
|
|
14
|
+
method: 'password' | 'totp' | 'refresh';
|
|
15
|
+
}
|
|
16
|
+
interface UserLoggedOutEvent extends UserActivityEventBase {
|
|
17
|
+
event: 'User Logged Out';
|
|
18
|
+
}
|
|
19
|
+
interface UserPasswordChangedEvent extends UserActivityEventBase {
|
|
20
|
+
event: 'User Password Changed';
|
|
21
|
+
target_user_id: string;
|
|
22
|
+
}
|
|
23
|
+
interface UserSuspendedEvent extends UserActivityEventBase {
|
|
24
|
+
event: 'User Suspended';
|
|
25
|
+
target_user_id: string;
|
|
26
|
+
reason: string;
|
|
27
|
+
}
|
|
28
|
+
interface StorePaletteChangedEvent extends UserActivityEventBase {
|
|
29
|
+
event: 'Store Palette Changed';
|
|
30
|
+
before: Record<string, unknown>;
|
|
31
|
+
after: Record<string, unknown>;
|
|
32
|
+
}
|
|
33
|
+
interface StoreSettingsUpdatedEvent extends UserActivityEventBase {
|
|
34
|
+
event: 'Store Settings Updated';
|
|
35
|
+
section: string;
|
|
36
|
+
before: Record<string, unknown>;
|
|
37
|
+
after: Record<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
interface PlanChangedEvent extends UserActivityEventBase {
|
|
40
|
+
event: 'Plan Changed';
|
|
41
|
+
from_tier: string;
|
|
42
|
+
to_tier: string;
|
|
43
|
+
}
|
|
44
|
+
interface InvoiceCreatedEvent extends UserActivityEventBase {
|
|
45
|
+
event: 'Invoice Created';
|
|
46
|
+
invoice_id: string;
|
|
47
|
+
total: number;
|
|
48
|
+
currency: string;
|
|
49
|
+
type: string;
|
|
50
|
+
}
|
|
51
|
+
interface OrderCreatedEvent extends UserActivityEventBase {
|
|
52
|
+
event: 'Order Created';
|
|
53
|
+
order_id: string;
|
|
54
|
+
total: number;
|
|
55
|
+
currency: string;
|
|
56
|
+
}
|
|
57
|
+
interface OrderCancelledEvent extends UserActivityEventBase {
|
|
58
|
+
event: 'Order Cancelled';
|
|
59
|
+
order_id: string;
|
|
60
|
+
reason: string;
|
|
61
|
+
}
|
|
62
|
+
interface ProductPriceChangedEvent extends UserActivityEventBase {
|
|
63
|
+
event: 'Product Price Changed';
|
|
64
|
+
product_id: string;
|
|
65
|
+
from_price: number;
|
|
66
|
+
to_price: number;
|
|
67
|
+
currency: string;
|
|
68
|
+
}
|
|
69
|
+
interface CustomerCreatedEvent extends UserActivityEventBase {
|
|
70
|
+
event: 'Customer Created';
|
|
71
|
+
customer_id: string;
|
|
72
|
+
}
|
|
73
|
+
interface CustomerEditedEvent extends UserActivityEventBase {
|
|
74
|
+
event: 'Customer Edited';
|
|
75
|
+
customer_id: string;
|
|
76
|
+
fields_changed: string[];
|
|
77
|
+
}
|
|
78
|
+
interface CashDrawerOpenedEvent extends UserActivityEventBase {
|
|
79
|
+
event: 'Cash Drawer Opened';
|
|
80
|
+
cash_id: string;
|
|
81
|
+
opening_balance: number;
|
|
82
|
+
currency: string;
|
|
83
|
+
}
|
|
84
|
+
interface CashDrawerClosedEvent extends UserActivityEventBase {
|
|
85
|
+
event: 'Cash Drawer Closed';
|
|
86
|
+
cash_id: string;
|
|
87
|
+
final_balance: number;
|
|
88
|
+
discrepancy: number;
|
|
89
|
+
currency: string;
|
|
90
|
+
}
|
|
91
|
+
interface TenantImpersonatedEvent extends UserActivityEventBase {
|
|
92
|
+
event: 'Tenant Impersonated';
|
|
93
|
+
target_store_id: string;
|
|
94
|
+
reason: string;
|
|
95
|
+
}
|
|
96
|
+
interface SecretRotatedEvent extends UserActivityEventBase {
|
|
97
|
+
event: 'Secret Rotated';
|
|
98
|
+
secret_name: string;
|
|
99
|
+
}
|
|
100
|
+
type UserActivityEvent = UserLoggedInEvent | UserLoggedOutEvent | UserPasswordChangedEvent | UserSuspendedEvent | StorePaletteChangedEvent | StoreSettingsUpdatedEvent | PlanChangedEvent | InvoiceCreatedEvent | OrderCreatedEvent | OrderCancelledEvent | ProductPriceChangedEvent | CustomerCreatedEvent | CustomerEditedEvent | CashDrawerOpenedEvent | CashDrawerClosedEvent | TenantImpersonatedEvent | SecretRotatedEvent;
|
|
101
|
+
}
|
|
102
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Typed user activity audit pipeline (types#70, api#1244).
|
|
2
|
+
//
|
|
3
|
+
// Actor-centric audit trail companion to the entity-centric `AUDIT#{entity}#{entityId}`
|
|
4
|
+
// rows authored in `sinfactura/api/stacks/services/audit.ts`. Schema mirrored in
|
|
5
|
+
// `sinfactura/api/stacks/helpers/userActivity/schema.ts`; emitted via the
|
|
6
|
+
// `recordUserActivity` synchronous helper at the end of mutating REST handlers.
|
|
7
|
+
//
|
|
8
|
+
// Naming follows the same convention as `StorefrontEvent` (types#69): Title Case
|
|
9
|
+
// Object + Past-Tense Action for event names, snake_case for properties.
|
|
10
|
+
//
|
|
11
|
+
// Distinct from `StorefrontEvent` (types#69):
|
|
12
|
+
// - Subject: internal staff (USER/ADMIN/SUPERVISOR/MANAGER), never anonymous
|
|
13
|
+
// - Retention: 90d hot + multi-year archive (vs 30d hot + 90d archive)
|
|
14
|
+
// - Erasure: append-only / anti-erasure per Ley 25.326 audit-trail exemption
|
|
15
|
+
// - Ingest: synchronous REST-handler helper (WS ingest explicitly disallowed)
|
|
16
|
+
//
|
|
17
|
+
// 17 variants — covers the Phase 1 MVP wire-ins in api#1244 plus the rest of
|
|
18
|
+
// the canonical taxonomy. Add new variants here as Phase 2/3 ships coverage.
|
|
19
|
+
export {};
|