@tallyui/core 3.7.1 → 3.8.0
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 +19 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/types/index.ts +1 -1
- package/src/types/traits/product.ts +20 -0
package/dist/index.d.ts
CHANGED
|
@@ -70,12 +70,25 @@ interface VariantSummary {
|
|
|
70
70
|
id: string;
|
|
71
71
|
/** Variant label, e.g. 'S / White'; undefined when the backend has none. */
|
|
72
72
|
title?: string;
|
|
73
|
+
/**
|
|
74
|
+
* The variant's value in each option group, keyed by group name. A group the variant accepts any value of
|
|
75
|
+
* (WooCommerce "Any …") has no key. Undefined when the backend gives the variant no option groups.
|
|
76
|
+
*/
|
|
77
|
+
options?: Record<string, string>;
|
|
73
78
|
sku?: string;
|
|
74
79
|
/** First non-empty of the backend's barcode fields. */
|
|
75
80
|
barcode?: string;
|
|
76
81
|
prices: ProductPrice[];
|
|
77
82
|
stock: StockLevel;
|
|
78
83
|
}
|
|
84
|
+
/** One option group a product's variants are chosen by, e.g. Size with S, M and L. */
|
|
85
|
+
interface VariantOptionGroup {
|
|
86
|
+
/** The backend's id for the group, when it has one that tells apart groups with the same name. */
|
|
87
|
+
id?: string;
|
|
88
|
+
name: string;
|
|
89
|
+
/** The group's values in the backend's order. */
|
|
90
|
+
values: string[];
|
|
91
|
+
}
|
|
79
92
|
/**
|
|
80
93
|
* Store-level facts a connector may need to interpret a raw document, for
|
|
81
94
|
* backends whose documents omit them (WooCommerce product prices carry no
|
|
@@ -114,6 +127,11 @@ interface ProductTraits<Doc = any> {
|
|
|
114
127
|
getStock: (doc: Doc) => StockLevel;
|
|
115
128
|
/** All purchasable variants, in id order (connectors store variants sorted by id). Optional: connectors without variant support omit it. */
|
|
116
129
|
getVariants?: (doc: Doc, context?: TraitContext) => VariantSummary[];
|
|
130
|
+
/**
|
|
131
|
+
* The option groups the product's variants are chosen by, in the backend's display order; [] when the product has
|
|
132
|
+
* none. Optional: connectors without it leave pickers to `getVariants` titles.
|
|
133
|
+
*/
|
|
134
|
+
getVariantOptions?: (doc: Doc) => VariantOptionGroup[];
|
|
117
135
|
/**
|
|
118
136
|
* The backend's tax class id for the variant `variantId`, or for the product (its default variant) when omitted.
|
|
119
137
|
* The id is a key of `StoreSettings.taxRatesPpm`; undefined means the default class. Optional: without it, every
|
|
@@ -1157,4 +1175,4 @@ declare namespace index {
|
|
|
1157
1175
|
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 };
|
|
1158
1176
|
}
|
|
1159
1177
|
|
|
1160
|
-
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 };
|
|
1178
|
+
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 VariantOptionGroup, 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
package/src/index.ts
CHANGED
package/src/types/index.ts
CHANGED
|
@@ -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, ProductCategory } from './traits/product';
|
|
21
|
+
export type { ProductTraits, TraitContext, VariantSummary, VariantOptionGroup, ProductCategory } from './traits/product';
|
|
22
22
|
|
|
23
23
|
export type { Money, ProductPrice, ResolvedPrice } from './money';
|
|
24
24
|
|
|
@@ -13,6 +13,11 @@ export interface VariantSummary {
|
|
|
13
13
|
id: string;
|
|
14
14
|
/** Variant label, e.g. 'S / White'; undefined when the backend has none. */
|
|
15
15
|
title?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The variant's value in each option group, keyed by group name. A group the variant accepts any value of
|
|
18
|
+
* (WooCommerce "Any …") has no key. Undefined when the backend gives the variant no option groups.
|
|
19
|
+
*/
|
|
20
|
+
options?: Record<string, string>;
|
|
16
21
|
sku?: string;
|
|
17
22
|
/** First non-empty of the backend's barcode fields. */
|
|
18
23
|
barcode?: string;
|
|
@@ -20,6 +25,15 @@ export interface VariantSummary {
|
|
|
20
25
|
stock: StockLevel;
|
|
21
26
|
}
|
|
22
27
|
|
|
28
|
+
/** One option group a product's variants are chosen by, e.g. Size with S, M and L. */
|
|
29
|
+
export interface VariantOptionGroup {
|
|
30
|
+
/** The backend's id for the group, when it has one that tells apart groups with the same name. */
|
|
31
|
+
id?: string;
|
|
32
|
+
name: string;
|
|
33
|
+
/** The group's values in the backend's order. */
|
|
34
|
+
values: string[];
|
|
35
|
+
}
|
|
36
|
+
|
|
23
37
|
/**
|
|
24
38
|
* Store-level facts a connector may need to interpret a raw document, for
|
|
25
39
|
* backends whose documents omit them (WooCommerce product prices carry no
|
|
@@ -64,6 +78,12 @@ export interface ProductTraits<Doc = any> {
|
|
|
64
78
|
/** All purchasable variants, in id order (connectors store variants sorted by id). Optional: connectors without variant support omit it. */
|
|
65
79
|
getVariants?: (doc: Doc, context?: TraitContext) => VariantSummary[];
|
|
66
80
|
|
|
81
|
+
/**
|
|
82
|
+
* The option groups the product's variants are chosen by, in the backend's display order; [] when the product has
|
|
83
|
+
* none. Optional: connectors without it leave pickers to `getVariants` titles.
|
|
84
|
+
*/
|
|
85
|
+
getVariantOptions?: (doc: Doc) => VariantOptionGroup[];
|
|
86
|
+
|
|
67
87
|
/**
|
|
68
88
|
* The backend's tax class id for the variant `variantId`, or for the product (its default variant) when omitted.
|
|
69
89
|
* The id is a key of `StoreSettings.taxRatesPpm`; undefined means the default class. Optional: without it, every
|