@tallyui/core 3.4.0 → 3.5.1

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 CHANGED
@@ -59,6 +59,11 @@ interface StockLevel {
59
59
  quantity?: number;
60
60
  }
61
61
 
62
+ /** A flat product category: `id` is the backend's id as a string (unique per backend), `name` its label. */
63
+ interface ProductCategory {
64
+ id: string;
65
+ name: string;
66
+ }
62
67
  /** One purchasable variant of a product, in backend-neutral terms. */
63
68
  interface VariantSummary {
64
69
  /** Backend variant id; the id sent in order lines. */
@@ -150,6 +155,11 @@ interface ProductTraits<Doc = any> {
150
155
  getBarcode: (doc: Doc) => string | undefined;
151
156
  /** Categories as simple label strings */
152
157
  getCategoryNames: (doc: Doc) => string[];
158
+ /**
159
+ * The product's categories as `{ id, name }`, in the document's order, without entries that have no name.
160
+ * Optional: without it, the pos category helpers use `getCategoryNames` with each name as its id.
161
+ */
162
+ getCategories?: (doc: Doc) => ProductCategory[];
153
163
  /** The connector-specific unique ID (as string for consistency) */
154
164
  getId: (doc: Doc) => string;
155
165
  }
@@ -1146,4 +1156,4 @@ declare namespace index {
1146
1156
  export { type index_CalculateTaxesInput as CalculateTaxesInput, type index_CalculateTaxesResult as CalculateTaxesResult, type index_ItemizedTax as ItemizedTax, index_NO_SHIPPING_TAX as NO_SHIPPING_TAX, index_STANDARD_TAX_CLASS as STANDARD_TAX_CLASS, type index_WooTaxRate as WooTaxRate, index_addNumberPrecision as addNumberPrecision, index_calculateTaxes as calculateTaxes, index_filterTaxRates as filterTaxRates, index_getRoundingPrecision as getRoundingPrecision, index_normalizeTaxClass as normalizeTaxClass, index_removeNumberPrecision as removeNumberPrecision, index_resolveInheritedShippingTaxClass as resolveInheritedShippingTaxClass, index_roundHalfDown as roundHalfDown, index_roundHalfUp as roundHalfUp, index_roundTaxTotal as roundTaxTotal, index_sumItemizedTaxes as sumItemizedTaxes, index_sumTaxes as sumTaxes, index_taxClassFromWire as taxClassFromWire, index_taxClassToWire as taxClassToWire };
1147
1157
  }
1148
1158
 
1149
- export { type AuthField, type CatalogueReconcileAdapter, type CatalogueReconcileEntry, type CollectionSync, CommandWarning, type ConnectorAuth, ConnectorProvider, type ConnectorProviderProps, type ConnectorSchemas, type ConnectorTraits, ConnectorUnauthorizedError, type Customer, type CustomerInput, CustomerServiceError, type CustomerTraits, type ErrorKind, type FingerprintReconcileAdapter, type IdReconcileAdapter, type KeyedReconcileFeedOptions, type Money, type ProductPrice, type ProductTraits, type ReconcileFeed, type ReconcileFeedEntry, type ReconcileFetchEntry, type RemoteIdEntry, type ReplicationAdapter, type ResolvedPrice, STOCK_LEVELS_LAST_PASS, type ServerCapabilities, SignInError, type SignInErrorCode, type SignInResult, type StockLevel, type StockReconcileAdapter, type StockStatus, type StoreSettings, type StoreSettingsChoice, type StoreSettingsChoices, StoreSettingsError, type StoreSettingsErrorCode, type SyncContext, type SyncNotice, type TallyConnector, type TaxRounding, type TraitContext, type VariantSummary, combinePullAdapters, compareIds, createReconcileFeed, currencySymbol, customerTraits, errorKind, findVariantByCode, formatMoney, getProductStock, isRxdbRemoteVersionMismatch, knownWarnings, minorUnitDigits, moneyFromDecimalString, moneyFromMajor, moneyToMajor, parseInfoCapabilities, parseLineTax, parseTaxRounding, resolveCapabilities, resolvePrice, resolvePriceRange, useConnector, useCustomerTraits, useProductStock, useProductTraits, useStockOverlaid, useStockOverlayAsOf, useTraitContext, withStockOverlay, index as woocommerceTax };
1159
+ export { type AuthField, type CatalogueReconcileAdapter, type CatalogueReconcileEntry, type CollectionSync, CommandWarning, type ConnectorAuth, ConnectorProvider, type ConnectorProviderProps, type ConnectorSchemas, type ConnectorTraits, ConnectorUnauthorizedError, type Customer, type CustomerInput, CustomerServiceError, type CustomerTraits, type ErrorKind, type FingerprintReconcileAdapter, type IdReconcileAdapter, type KeyedReconcileFeedOptions, type Money, type ProductCategory, type ProductPrice, type ProductTraits, type ReconcileFeed, type ReconcileFeedEntry, type ReconcileFetchEntry, type RemoteIdEntry, type ReplicationAdapter, type ResolvedPrice, STOCK_LEVELS_LAST_PASS, type ServerCapabilities, SignInError, type SignInErrorCode, type SignInResult, type StockLevel, type StockReconcileAdapter, type StockStatus, type StoreSettings, type StoreSettingsChoice, type StoreSettingsChoices, StoreSettingsError, type StoreSettingsErrorCode, type SyncContext, type SyncNotice, type TallyConnector, type TaxRounding, type TraitContext, type VariantSummary, combinePullAdapters, compareIds, createReconcileFeed, currencySymbol, customerTraits, errorKind, findVariantByCode, formatMoney, getProductStock, isRxdbRemoteVersionMismatch, knownWarnings, minorUnitDigits, moneyFromDecimalString, moneyFromMajor, moneyToMajor, parseInfoCapabilities, parseLineTax, parseTaxRounding, resolveCapabilities, resolvePrice, resolvePriceRange, useConnector, useCustomerTraits, useProductStock, useProductTraits, useStockOverlaid, useStockOverlayAsOf, useTraitContext, withStockOverlay, index as woocommerceTax };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tallyui/core",
3
- "version": "3.4.0",
3
+ "version": "3.5.1",
4
4
  "type": "module",
5
5
  "description": "Core interfaces, traits, and context providers for Tally UI",
6
6
  "main": "./dist/index.js",
package/src/index.ts CHANGED
@@ -15,6 +15,7 @@ export type {
15
15
  ProductTraits,
16
16
  TraitContext,
17
17
  VariantSummary,
18
+ ProductCategory,
18
19
  CustomerTraits,
19
20
  Money,
20
21
  ProductPrice,
@@ -18,7 +18,7 @@ export type { FingerprintReconcileAdapter, IdReconcileAdapter, StockReconcileAda
18
18
  export type { StoreSettings, StoreSettingsChoice } from './store-settings';
19
19
  export { customerTraits, CustomerServiceError, type Customer, type CustomerInput } from './customers';
20
20
 
21
- export type { ProductTraits, TraitContext, VariantSummary } from './traits/product';
21
+ export type { ProductTraits, TraitContext, VariantSummary, ProductCategory } from './traits/product';
22
22
 
23
23
  export type { Money, ProductPrice, ResolvedPrice } from './money';
24
24
 
@@ -1,6 +1,12 @@
1
1
  import type { ProductPrice } from '../money';
2
2
  import type { StockLevel } from '../stock';
3
3
 
4
+ /** A flat product category: `id` is the backend's id as a string (unique per backend), `name` its label. */
5
+ export interface ProductCategory {
6
+ id: string;
7
+ name: string;
8
+ }
9
+
4
10
  /** One purchasable variant of a product, in backend-neutral terms. */
5
11
  export interface VariantSummary {
6
12
  /** Backend variant id; the id sent in order lines. */
@@ -116,6 +122,12 @@ export interface ProductTraits<Doc = any> {
116
122
  /** Categories as simple label strings */
117
123
  getCategoryNames: (doc: Doc) => string[];
118
124
 
125
+ /**
126
+ * The product's categories as `{ id, name }`, in the document's order, without entries that have no name.
127
+ * Optional: without it, the pos category helpers use `getCategoryNames` with each name as its id.
128
+ */
129
+ getCategories?: (doc: Doc) => ProductCategory[];
130
+
119
131
  /** The connector-specific unique ID (as string for consistency) */
120
132
  getId: (doc: Doc) => string;
121
133
  }