@growupsell/commerce 1.0.0-alpha.2 → 1.0.0-alpha.4
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/{checkout-CwpFl6qt.d.ts → checkout-DDNMdKbR.d.ts} +27 -3
- package/dist/{chunk-AI2CWQ22.js → chunk-BORVKACK.js} +12 -4
- package/dist/chunk-BORVKACK.js.map +1 -0
- package/dist/{chunk-DHBRITDW.js → chunk-SFAKVAKI.js} +69 -16
- package/dist/chunk-SFAKVAKI.js.map +1 -0
- package/dist/{client-D4JNDM6j.d.ts → client-RzekAHeO.d.ts} +2 -9
- package/dist/http/index.d.ts +2 -2
- package/dist/http/index.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/rules/index.d.ts +1 -1
- package/dist/{sku-C3SGyRqT.d.ts → sku-ViHXTvEw.d.ts} +1 -1
- package/dist/stores/index.d.ts +8 -1
- package/dist/stores/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-AI2CWQ22.js.map +0 -1
- package/dist/chunk-DHBRITDW.js.map +0 -1
|
@@ -180,6 +180,7 @@ interface ProductBlock {
|
|
|
180
180
|
* stored here: compute them with `discountPercent()` from `@growupsell/commerce/rules`, so
|
|
181
181
|
* every app uses the same rule.
|
|
182
182
|
*/
|
|
183
|
+
|
|
183
184
|
/** One option of a variant group, e.g. "128 GB" in "Storage". */
|
|
184
185
|
interface VariantOption {
|
|
185
186
|
id: number;
|
|
@@ -225,8 +226,10 @@ interface ProductListItem {
|
|
|
225
226
|
unit: string | null;
|
|
226
227
|
variantGroups: VariantGroup[];
|
|
227
228
|
selectedVariantIds: number[];
|
|
229
|
+
/** The product's description (HTML), for list views; null when empty. */
|
|
230
|
+
description: string | null;
|
|
228
231
|
/** `none` for stocked goods; custom modes are made to order. */
|
|
229
|
-
fulfillmentMode:
|
|
232
|
+
fulfillmentMode: FulfillmentMode;
|
|
230
233
|
hasDigitalDelivery: boolean;
|
|
231
234
|
/** Advance payment required for made-to-order products. */
|
|
232
235
|
advanceAmount: number | null;
|
|
@@ -300,7 +303,7 @@ interface ProductDetail {
|
|
|
300
303
|
policies: ProductPolicies | null;
|
|
301
304
|
availableForSubscription: boolean;
|
|
302
305
|
hasDigitalDelivery: boolean;
|
|
303
|
-
fulfillmentMode:
|
|
306
|
+
fulfillmentMode: FulfillmentMode;
|
|
304
307
|
advanceAmount: number | null;
|
|
305
308
|
}
|
|
306
309
|
/** A product as listed by `products.list()` (home sliders, product pickers). */
|
|
@@ -308,6 +311,13 @@ interface ProductOverview {
|
|
|
308
311
|
id: number;
|
|
309
312
|
name: string;
|
|
310
313
|
slug: string;
|
|
314
|
+
/** HTML, written with the editor the product detail's `descriptionFormat` names; null when empty. */
|
|
315
|
+
description: string | null;
|
|
316
|
+
/**
|
|
317
|
+
* `none` for stocked goods; custom modes are made to order and never out of stock (pass it to
|
|
318
|
+
* `purchaseLimit()` with a SKU's `stockQty` for the stock badge).
|
|
319
|
+
*/
|
|
320
|
+
fulfillmentMode: FulfillmentMode;
|
|
311
321
|
categoryName: string | null;
|
|
312
322
|
images: ProductImage[];
|
|
313
323
|
variantGroups: VariantGroup[];
|
|
@@ -316,6 +326,20 @@ interface ProductOverview {
|
|
|
316
326
|
priceFrom: number | null;
|
|
317
327
|
unit: string | null;
|
|
318
328
|
}
|
|
329
|
+
/**
|
|
330
|
+
* Order of `products.list()`. The backend orders this list by id only (no creation date), so
|
|
331
|
+
* `newest` is the highest id first. Without `sort` the backend's default applies: `oldest`.
|
|
332
|
+
*/
|
|
333
|
+
type ProductListSort = 'newest' | 'oldest' | 'name-a-z' | 'name-z-a';
|
|
334
|
+
interface ProductListOptions {
|
|
335
|
+
ids?: readonly number[];
|
|
336
|
+
/** Includes sub-categories. */
|
|
337
|
+
categoryIds?: readonly number[];
|
|
338
|
+
sort?: ProductListSort;
|
|
339
|
+
/** Default 20. */
|
|
340
|
+
limit?: number;
|
|
341
|
+
offset?: number;
|
|
342
|
+
}
|
|
319
343
|
interface ProductFilterConfig {
|
|
320
344
|
/** Price range across the business's products. */
|
|
321
345
|
price: {
|
|
@@ -557,4 +581,4 @@ interface AdvanceOrder {
|
|
|
557
581
|
payment: PendingPayment;
|
|
558
582
|
}
|
|
559
583
|
|
|
560
|
-
export type { AdvanceOrder as A, Brand as B, Cart as C, DeliveryChargeType as D,
|
|
584
|
+
export type { AdvanceOrder as A, Brand as B, Cart as C, DeliveryChargeType as D, ProductSectionItem as E, FulfillmentMode as F, GiftCard as G, ProductSectionItemTarget as H, ProductSku as I, ProductSort as J, ProductSpecificationGroup as K, PromoCode as L, ReviewEligibility as M, ReviewListItem as N, Offer as O, Page as P, ReviewReply as Q, Review as R, ReviewSummary as S, RewardPointSettings as T, SearchSuggestion as U, SpecificationScope as V, TaxDetails as W, VariantGroup as X, VariantOption as Y, AppliedOffer as a, AppliedPromoCode as b, CartLine as c, CartTotals as d, CatalogSettings as e, Category as f, CategoryTree as g, CheckoutSettings as h, CustomerProfile as i, DeliveryEstimate as j, OfferScope as k, OrderType as l, PaymentMethodType as m, PendingPayment as n, PlaceOrderResult as o, ProductBlock as p, ProductDetail as q, ProductFilterConfig as r, ProductImage as s, ProductListItem as t, ProductListOptions as u, ProductListSort as v, ProductOverview as w, ProductPolicies as x, ProductSearchOptions as y, ProductSection as z };
|
|
@@ -197,8 +197,6 @@ function toBusiness(wire) {
|
|
|
197
197
|
name: wire.name ?? null,
|
|
198
198
|
description: wire.description ?? null,
|
|
199
199
|
legalName: wire.legal_name ?? null,
|
|
200
|
-
gstNumber: wire.gst_number ?? null,
|
|
201
|
-
panNumber: wire.pan_number ?? null,
|
|
202
200
|
isTemplate: wire.is_template ?? false,
|
|
203
201
|
category: wire.category ? { id: wire.category.id, name: wire.category.name, type: wire.category.type } : null,
|
|
204
202
|
legalForm: wire.legal_forms ? { id: wire.legal_forms.id, name: wire.legal_forms.name } : null,
|
|
@@ -913,6 +911,12 @@ var SORT = {
|
|
|
913
911
|
popularity: "popularity",
|
|
914
912
|
category: "category"
|
|
915
913
|
};
|
|
914
|
+
var LIST_ORDERING = {
|
|
915
|
+
newest: "-id",
|
|
916
|
+
oldest: "id",
|
|
917
|
+
"name-a-z": "name",
|
|
918
|
+
"name-z-a": "-name"
|
|
919
|
+
};
|
|
916
920
|
var PUBLIC10 = { business: "required", anonymous: true };
|
|
917
921
|
function createProductsApi(request) {
|
|
918
922
|
return {
|
|
@@ -954,6 +958,7 @@ function createProductsApi(request) {
|
|
|
954
958
|
status: "available",
|
|
955
959
|
ids: options.ids,
|
|
956
960
|
category_ids: options.categoryIds,
|
|
961
|
+
ordering: options.sort ? LIST_ORDERING[options.sort] : void 0,
|
|
957
962
|
limit,
|
|
958
963
|
offset
|
|
959
964
|
}
|
|
@@ -1060,7 +1065,8 @@ function toProductListItem(wire) {
|
|
|
1060
1065
|
unit: text(wire.unit),
|
|
1061
1066
|
variantGroups: (wire.variant ?? []).map(toVariantGroup),
|
|
1062
1067
|
selectedVariantIds: wire.selected_variants,
|
|
1063
|
-
|
|
1068
|
+
description: text(wire.description),
|
|
1069
|
+
fulfillmentMode: text(wire.fulfillment_mode) ?? "none",
|
|
1064
1070
|
hasDigitalDelivery: wire.has_digital_delivery,
|
|
1065
1071
|
advanceAmount: amount(wire.advance_amount)
|
|
1066
1072
|
};
|
|
@@ -1113,6 +1119,8 @@ function toProductOverview(wire) {
|
|
|
1113
1119
|
id: wire.id,
|
|
1114
1120
|
name: wire.name,
|
|
1115
1121
|
slug: wire.url_slug,
|
|
1122
|
+
description: text(wire.description),
|
|
1123
|
+
fulfillmentMode: wire.fulfillment_mode ?? "none",
|
|
1116
1124
|
categoryName: text(wire.category_name),
|
|
1117
1125
|
images: liveImages(wire.images).map(toImage),
|
|
1118
1126
|
variantGroups: (wire.variant ?? []).map(toVariantGroup),
|
|
@@ -2879,4 +2887,4 @@ export {
|
|
|
2879
2887
|
GrowupsellApiError,
|
|
2880
2888
|
createClient
|
|
2881
2889
|
};
|
|
2882
|
-
//# sourceMappingURL=chunk-
|
|
2890
|
+
//# sourceMappingURL=chunk-BORVKACK.js.map
|