sinfactura-types 1.6.29 → 1.6.31

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/basket.d.ts CHANGED
@@ -24,6 +24,14 @@ declare global {
24
24
  ivaType: number;
25
25
  cost: number;
26
26
  price: number;
27
+ listId?: number;
28
+ currency?: string;
29
+ currencyValue?: number;
30
+ currencyValueAt?: number;
31
+ priceSource?: 'percent' | 'amount';
32
+ appliedMinQty?: number;
33
+ promoApplied?: boolean;
34
+ basePrice?: number;
27
35
  }
28
36
  }
29
37
  export {};
@@ -30,5 +30,42 @@ declare global {
30
30
  value: number;
31
31
  source?: string;
32
32
  }
33
+ type FxProvider = "ambito" | "dolarapi" | "bluelytics" | "bcra";
34
+ interface PlatformFxSource {
35
+ /** Stable identifier — referenced by `Store.fxAutoUpdate.bindings[].sourceId`. */
36
+ id: string;
37
+ isoCode: string;
38
+ variant: CurrencyVariant;
39
+ provider: FxProvider;
40
+ }
41
+ interface PlatformFxSourceWithStatus extends PlatformFxSource {
42
+ enabled: boolean;
43
+ /** EventBridge cron expression (`minute hour day month weekday`). */
44
+ cron: string;
45
+ /** Optional override for the provider's source URL. */
46
+ sourceUrl?: string;
47
+ /** Unix ms of the last successful fetch. Undefined if never succeeded. */
48
+ lastSuccessAt?: number;
49
+ /** Unix ms of the last failed fetch. Undefined if no failures yet. */
50
+ lastFailureAt?: number;
51
+ /** Short reason for the most recent failure (truncated to 256 chars). */
52
+ lastFailureReason?: string;
53
+ /** Consecutive-failure streak; resets on first success. Drives failover (>=3) + alerts. */
54
+ consecutiveFailures?: number;
55
+ /** Sibling source id to attempt when `consecutiveFailures` crosses the failover threshold. */
56
+ fallbackSourceId?: string;
57
+ /** Server-derived: `now - lastSuccessAt > maxStaleness`. Added by the SUPER GET handler. */
58
+ isStale: boolean;
59
+ }
60
+ interface PlatformFxSourcesRow {
61
+ enabled: boolean;
62
+ sources: PlatformFxSourceWithStatus[];
63
+ maxStaleness: {
64
+ default: number;
65
+ } & Record<string, number>;
66
+ updatedAt: number;
67
+ /** `true` once an explicit row is persisted; `false` when the handler is returning DEFAULT_FX_SOURCES. */
68
+ persisted?: boolean;
69
+ }
33
70
  }
34
71
  export {};
@@ -39,7 +39,15 @@ declare global {
39
39
  paymentMethod: number;
40
40
  phone: string;
41
41
  photoURL: string;
42
+ photoData?: string;
43
+ removePhotoURL?: string;
42
44
  postalCode: string;
45
+ /**
46
+ * FK to PriceList.id (NOT a positional ordinal). Picks which PriceSlot /
47
+ * materialized priceN applies to this customer. Legacy values 1..4 already
48
+ * equal the seeded list ids, so the migration is value-preserving; getPrice
49
+ * resolves by id, not by `price${ordinal}`. (#1780 / types#88)
50
+ */
43
51
  priceList: number;
44
52
  province: string;
45
53
  salt?: string;
package/dist/index.d.ts CHANGED
@@ -19,6 +19,7 @@ export * from "./mercadopago";
19
19
  export * from "./notification";
20
20
  export * from "./order";
21
21
  export * from "./payment";
22
+ export * from "./pricing";
22
23
  export * from "./print";
23
24
  export * from "./product";
24
25
  export * from "./return";
package/dist/index.js CHANGED
@@ -19,6 +19,7 @@ export * from "./mercadopago";
19
19
  export * from "./notification";
20
20
  export * from "./order";
21
21
  export * from "./payment";
22
+ export * from "./pricing";
22
23
  export * from "./print";
23
24
  export * from "./product";
24
25
  export * from "./return";
package/dist/invoice.d.ts CHANGED
@@ -48,6 +48,11 @@ declare global {
48
48
  quantity: number;
49
49
  iva: number;
50
50
  neto: number;
51
+ unitPrice?: number;
52
+ listId?: number;
53
+ appliedMinQty?: number;
54
+ promoApplied?: boolean;
55
+ basePrice?: number;
51
56
  }
52
57
  interface InvoiceWithCustomer extends Invoice {
53
58
  customer: Customer;
@@ -62,5 +62,67 @@ declare global {
62
62
  externalPosId?: string;
63
63
  operatingMode: "PDV" | "STANDALONE";
64
64
  }
65
+ type MpHookResult = 'config-missing' | 'test-event' | 'orphan' | 'duplicate' | 'not-approved' | 'item-saved' | 'error';
66
+ interface MpHookLogEntry {
67
+ hookId: string;
68
+ rawBodyB64?: string;
69
+ rawBodyLen?: number;
70
+ headers?: Record<string, string>;
71
+ path?: string;
72
+ resource?: string;
73
+ queryStringParameters?: Record<string, string> | null;
74
+ signatureValid?: boolean;
75
+ signatureV1Prefix?: string;
76
+ expectedPrefix?: string;
77
+ signatureReason?: string;
78
+ paymentId?: string;
79
+ userId?: string;
80
+ storeId?: string;
81
+ result: MpHookResult;
82
+ errorMessage?: string;
83
+ processingMs?: number;
84
+ createdAt: number;
85
+ ts?: number;
86
+ requestId?: string;
87
+ ttl?: number;
88
+ }
89
+ type MpIpnOutcome = 'polled-online' | 'no-online-tenants' | 'no-online-mp-tenants' | 'not-payment-topic' | 'none' | 'error';
90
+ interface MpIpnLogEntry {
91
+ ipnId: string;
92
+ topic: string;
93
+ resourceId: string;
94
+ rawBodyB64?: string;
95
+ rawBodyLen?: number;
96
+ headers?: Record<string, string>;
97
+ path?: string;
98
+ resource?: string;
99
+ queryStringParameters?: Record<string, string> | null;
100
+ processingMs?: number;
101
+ createdAt: number;
102
+ ttl?: number;
103
+ errorMessage?: string;
104
+ outcome?: MpIpnOutcome;
105
+ tenantsScanned?: number;
106
+ tenantsPolled?: number;
107
+ tenantsFailed?: number;
108
+ }
109
+ type MpMovementType = 'transfer_in' | 'qr_in' | 'transfer_out' | 'fee' | 'refund' | 'other';
110
+ interface MpMovementLogEntry {
111
+ operationId: string;
112
+ source: 'transfer';
113
+ amount: number;
114
+ currency: string;
115
+ type: MpMovementType;
116
+ date: number;
117
+ description: string;
118
+ sourceChannel?: string;
119
+ payerName?: string;
120
+ cuit?: string;
121
+ email?: string;
122
+ raw?: unknown;
123
+ createdAt: number;
124
+ processedAt: number;
125
+ ttl?: number;
126
+ }
65
127
  }
66
128
  export {};
@@ -0,0 +1,72 @@
1
+ declare global {
2
+ /**
3
+ * ADR-0013 self-describing money stamp — STRICT (frozen rate required).
4
+ * Used ONLY on the new pricing-authoring shapes (PriceSlot[absolute] /
5
+ * PriceBreak / PricePromo). An optional frozen rate would reopen the
6
+ * live-rate hole (#1542). `currency` is bare `string` (catalogId) for parity
7
+ * with `Product.currency` — do NOT half-narrow to `CatalogId` while the
8
+ * entity stamps stay `string`. Do NOT retrofit this onto SupplierInvoice /
9
+ * SupplierAccount (optional-currency by design — would break supplier writes).
10
+ */
11
+ interface CurrencyStamp {
12
+ currency: string;
13
+ currencyValue: number;
14
+ currencyValueAt: number;
15
+ }
16
+ /**
17
+ * A named, extensible price list. Split OUT of the shared `Method` blob
18
+ * (`Method` is reused by 7 unrelated Store arrays — don't leak pricing into
19
+ * paymentMethods / ivaTypes). A structural SUPERSET of `Method` (keeps
20
+ * id / name / value? / removable? / editable?) so `store.priceLists:
21
+ * Method[] → PriceList[]` is type-compatible. `id` is the stable FK target
22
+ * for `Customer.priceList` + `PriceSlot.listId`.
23
+ */
24
+ interface PriceList {
25
+ id: number;
26
+ name: string;
27
+ value?: number;
28
+ removable?: boolean;
29
+ editable?: boolean;
30
+ order?: number;
31
+ defaultCurrency?: string;
32
+ tierGated?: boolean;
33
+ }
34
+ /**
35
+ * Quantity break within a slot. Resolution: highest `minQty <= qty` wins.
36
+ * Stored sorted ascending by `minQty`; no two breaks share a `minQty`
37
+ * (BE-validated). Open-ended top tier (no `maxQty` — ranges derive from the
38
+ * next break's `minQty`).
39
+ */
40
+ interface PriceBreak extends CurrencyStamp {
41
+ minQty: number;
42
+ amount: number;
43
+ }
44
+ /** Time-limited promo override. `amount` is absolute. */
45
+ interface PricePromo extends CurrencyStamp {
46
+ from?: number;
47
+ until: number;
48
+ amount: number;
49
+ }
50
+ /**
51
+ * One price list's pricing for a product. Discriminated union — kills the
52
+ * `{}`, both-set and neither-set invalid states; the `kind:'absolute' ⇒
53
+ * stamp` invariant rides the discriminant. `listId` is an FK to
54
+ * `PriceList.id`.
55
+ */
56
+ type PriceSlot = {
57
+ kind: 'percent';
58
+ listId: number;
59
+ percent: number;
60
+ breaks?: PriceBreak[];
61
+ promo?: PricePromo;
62
+ visibleOnStorefront?: boolean;
63
+ } | ({
64
+ kind: 'absolute';
65
+ listId: number;
66
+ amount: number;
67
+ breaks?: PriceBreak[];
68
+ promo?: PricePromo;
69
+ visibleOnStorefront?: boolean;
70
+ } & CurrencyStamp);
71
+ }
72
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/dist/product.d.ts CHANGED
@@ -43,10 +43,11 @@ declare global {
43
43
  isNew: boolean;
44
44
  isService: boolean;
45
45
  cost: number;
46
- price1: number;
47
- price2: number;
48
- price3: number;
49
- price4: number;
46
+ prices?: PriceSlot[];
47
+ price1?: number;
48
+ price2?: number;
49
+ price3?: number;
50
+ price4?: number;
50
51
  }
51
52
  }
52
53
  export {};
package/dist/store.d.ts CHANGED
@@ -154,7 +154,7 @@ declare global {
154
154
  cashInMethods: Method[];
155
155
  cashOutMethods: Method[];
156
156
  debitMethods: Method[];
157
- priceLists: Method[];
157
+ priceLists: PriceList[];
158
158
  accountMethods: Method[];
159
159
  deliveryMethods: Method[];
160
160
  paymentMethods: Method[];
@@ -63,7 +63,7 @@ declare global {
63
63
  * every existing plan in `FEATURE_MATRIX` must then declare the new key
64
64
  * (TypeScript enforces this via `Record<FeatureKey, Entitlement>`).
65
65
  */
66
- type FeatureKey = 'maxOrdersMonth' | 'maxInvoicesMonth' | 'maxProducts' | 'maxUsers' | 'maxCustomers' | 'maxStores' | 'afipInvoicing' | 'paymentIntegrations' | 'suppliers' | 'cashManagement' | 'multiStore' | 'importExport' | 'advancedReports' | 'customBranding' | 'apiAccess' | 'prioritySupport' | 'whatsappCommerce' | 'aiFeatures' | 'mobileApp' | 'customDomain';
66
+ type FeatureKey = 'maxOrdersMonth' | 'maxInvoicesMonth' | 'maxProducts' | 'maxUsers' | 'maxCustomers' | 'maxStores' | 'priceListsMax' | 'afipInvoicing' | 'paymentIntegrations' | 'suppliers' | 'cashManagement' | 'multiStore' | 'importExport' | 'advancedReports' | 'customBranding' | 'apiAccess' | 'prioritySupport' | 'whatsappCommerce' | 'aiFeatures' | 'mobileApp' | 'customDomain' | 'advancedPricing';
67
67
  /** Full feature matrix — every tier declares every feature. */
68
68
  type FeatureMatrix = Record<PlanTier, Record<FeatureKey, Entitlement>>;
69
69
  /** Resolved entitlements for a specific tenant (matrix + overrides applied). */
@@ -5,6 +5,8 @@ declare global {
5
5
  supplierId: string;
6
6
  createdAt: number;
7
7
  photoURL: string;
8
+ photoData?: string;
9
+ removePhotoURL?: string;
8
10
  company: string;
9
11
  cuit: string;
10
12
  razonSocial: string;
package/dist/user.d.ts CHANGED
@@ -10,6 +10,8 @@ declare global {
10
10
  password?: string;
11
11
  roles: string;
12
12
  photoURL: string;
13
+ photoData?: string;
14
+ removePhotoURL?: string;
13
15
  disabled: boolean;
14
16
  search: string;
15
17
  accessToken: string;
@@ -74,12 +74,18 @@ declare global {
74
74
  order_id: string;
75
75
  reason: string;
76
76
  }
77
+ interface PriceListChange {
78
+ list_id: number;
79
+ from: number;
80
+ to: number;
81
+ }
77
82
  interface ProductPriceChangedEvent extends UserActivityEventBase {
78
83
  event: 'Product Price Changed';
79
84
  product_id: string;
80
85
  from_price: number;
81
86
  to_price: number;
82
87
  currency: string;
88
+ changes?: PriceListChange[];
83
89
  }
84
90
  interface CustomerCreatedEvent extends UserActivityEventBase {
85
91
  event: 'Customer Created';
@@ -396,3 +402,11 @@ declare global {
396
402
  */
397
403
  export declare const UI_ONLY_USER_ACTIVITY_VARIANTS: readonly ["Audit Trail Viewed", "Report Viewed", "Customer PII Viewed", "Cash Drawer UI Opened", "Cash Drawer UI Closed", "Export Initiated", "Impersonation UI Started", "Impersonation UI Ended", "Payment Viewed", "Invoice Viewed", "Customer Detail Viewed", "Supplier Account Viewed", "Search Performed", "Action Denied", "Two-Factor Challenge Shown", "Two-Factor Code Validation Failed", "Two-Factor Enrollment Started", "Two-Factor Recovery Codes Revealed", "Two-Factor Reset Initiated"];
398
404
  export type UiOnlyUserActivityVariant = (typeof UI_ONLY_USER_ACTIVITY_VARIANTS)[number];
405
+ /**
406
+ * Valid per-entity timeline entity types for the user-activity audit feed.
407
+ * MUST stay in sync with the BE `VALID_ENTITY_TYPES` const in
408
+ * `sinfactura/api/stacks/lambdas/userActivity/_get.ts` (api#1258), which Zod-
409
+ * enums the `entityType` query param. The api should import this union to
410
+ * derive that const so the two can't drift (separate api follow-up).
411
+ */
412
+ export type UserActivityEntityType = 'order' | 'invoice' | 'supplier_invoice' | 'payment' | 'account' | 'customer' | 'supplier' | 'product' | 'user' | 'target_store' | 'brand' | 'category' | 'cash' | 'ticket' | 'report' | 'notification';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.6.29",
3
+ "version": "1.6.31",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",