rerobe-js-orm 4.8.8 → 4.9.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/lib/constants/marketplace-constants.d.ts +52 -0
- package/lib/constants/marketplace-constants.js +82 -0
- package/lib/constants/product-constants.d.ts +6 -0
- package/lib/constants/product-constants.js +43 -1
- package/lib/constants/tax-constants.d.ts +19 -0
- package/lib/constants/tax-constants.js +70 -0
- package/lib/factories/Product/RetailProductFactory.d.ts +102 -0
- package/lib/factories/Product/RetailProductFactory.js +260 -0
- package/lib/form-states/Product/ProductFormState.d.ts +9 -0
- package/lib/form-states/Product/ProductFormState.js +46 -0
- package/lib/helpers/MarketplaceProductHelpers.d.ts +181 -0
- package/lib/helpers/MarketplaceProductHelpers.js +555 -0
- package/lib/helpers/OrderHelpers.d.ts +5 -2
- package/lib/helpers/OrderHelpers.js +18 -4
- package/lib/helpers/PricingHelpers.d.ts +29 -0
- package/lib/helpers/PricingHelpers.js +215 -0
- package/lib/helpers/ProductInventoryHelpers.d.ts +31 -0
- package/lib/helpers/ProductInventoryHelpers.js +66 -0
- package/lib/helpers/ProductSkuHelpers.d.ts +13 -0
- package/lib/helpers/ProductSkuHelpers.js +70 -0
- package/lib/helpers/TaxHelpers.d.ts +15 -0
- package/lib/helpers/TaxHelpers.js +76 -0
- package/lib/helpers/marketplace/CommissionPolicy.d.ts +20 -0
- package/lib/helpers/marketplace/CommissionPolicy.js +9 -0
- package/lib/helpers/marketplace/CommissionPolicyRegistry.d.ts +4 -0
- package/lib/helpers/marketplace/CommissionPolicyRegistry.js +21 -0
- package/lib/helpers/marketplace/EvenPerSellerStripeFeePolicy.d.ts +5 -0
- package/lib/helpers/marketplace/EvenPerSellerStripeFeePolicy.js +46 -0
- package/lib/helpers/marketplace/FeeAllocationPolicy.d.ts +10 -0
- package/lib/helpers/marketplace/FeeAllocationPolicy.js +36 -0
- package/lib/helpers/marketplace/FeeAllocationPolicyRegistry.d.ts +6 -0
- package/lib/helpers/marketplace/FeeAllocationPolicyRegistry.js +26 -0
- package/lib/helpers/marketplace/InventoryPolicy.d.ts +18 -0
- package/lib/helpers/marketplace/InventoryPolicy.js +7 -0
- package/lib/helpers/marketplace/InventoryPolicyRegistry.d.ts +4 -0
- package/lib/helpers/marketplace/InventoryPolicyRegistry.js +29 -0
- package/lib/helpers/marketplace/LineNetCommissionPolicy.d.ts +5 -0
- package/lib/helpers/marketplace/LineNetCommissionPolicy.js +25 -0
- package/lib/helpers/marketplace/MarketplaceErrors.d.ts +6 -0
- package/lib/helpers/marketplace/MarketplaceErrors.js +21 -0
- package/lib/helpers/marketplace/MarketplaceLedgerHelpers.d.ts +40 -0
- package/lib/helpers/marketplace/MarketplaceLedgerHelpers.js +120 -0
- package/lib/helpers/marketplace/MarketplaceLegacyAdapters.d.ts +53 -0
- package/lib/helpers/marketplace/MarketplaceLegacyAdapters.js +99 -0
- package/lib/helpers/marketplace/MarketplaceLineDisplayHelpers.d.ts +40 -0
- package/lib/helpers/marketplace/MarketplaceLineDisplayHelpers.js +125 -0
- package/lib/helpers/marketplace/MarketplaceOrderHelpers.d.ts +15 -0
- package/lib/helpers/marketplace/MarketplaceOrderHelpers.js +77 -0
- package/lib/helpers/marketplace/MultivariantLocationInventoryPolicy.d.ts +9 -0
- package/lib/helpers/marketplace/MultivariantLocationInventoryPolicy.js +60 -0
- package/lib/helpers/marketplace/OneOfAKindInventoryPolicy.d.ts +9 -0
- package/lib/helpers/marketplace/OneOfAKindInventoryPolicy.js +55 -0
- package/lib/helpers/marketplace/OriginalCommissionShareCommissionPolicy.d.ts +5 -0
- package/lib/helpers/marketplace/OriginalCommissionShareCommissionPolicy.js +26 -0
- package/lib/helpers/marketplace/ProportionalToLineNetPolicy.d.ts +5 -0
- package/lib/helpers/marketplace/ProportionalToLineNetPolicy.js +35 -0
- package/lib/helpers/marketplace/UntrackedStockInventoryPolicy.d.ts +7 -0
- package/lib/helpers/marketplace/UntrackedStockInventoryPolicy.js +23 -0
- package/lib/index.d.ts +18 -1
- package/lib/index.js +56 -1
- package/lib/models/Product.d.ts +16 -0
- package/lib/models/Product.js +140 -0
- package/lib/types/pricing-types.d.ts +85 -0
- package/lib/types/pricing-types.js +5 -0
- package/lib/types/rerobe-order-types.d.ts +86 -0
- package/lib/types/rerobe-product-types.d.ts +19 -0
- package/package.json +1 -1
package/lib/models/Product.js
CHANGED
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const Base_1 = require("../Base");
|
|
4
4
|
const product_constants_1 = require("../constants/product-constants");
|
|
5
|
+
const marketplace_constants_1 = require("../constants/marketplace-constants");
|
|
5
6
|
const options_1 = require("../form-states/Product/options");
|
|
6
7
|
const ReRobeProductHelpers_1 = require("../helpers/ReRobeProductHelpers");
|
|
8
|
+
const MarketplaceProductHelpers_1 = require("../helpers/MarketplaceProductHelpers");
|
|
9
|
+
const PricingHelpers_1 = require("../helpers/PricingHelpers");
|
|
10
|
+
const ProductSkuHelpers_1 = require("../helpers/ProductSkuHelpers");
|
|
7
11
|
class Product extends Base_1.default {
|
|
8
12
|
constructor(props) {
|
|
9
13
|
super();
|
|
@@ -44,6 +48,7 @@ class Product extends Base_1.default {
|
|
|
44
48
|
isTaxable: (props === null || props === void 0 ? void 0 : props.isTaxable) || '',
|
|
45
49
|
taxCategory: (props === null || props === void 0 ? void 0 : props.taxCategory) || 'STANDARD',
|
|
46
50
|
productClass: (props === null || props === void 0 ? void 0 : props.productClass) || 'UNIQUE',
|
|
51
|
+
marketplace: MarketplaceProductHelpers_1.default.normalizeMarketplace(props === null || props === void 0 ? void 0 : props.marketplace),
|
|
47
52
|
};
|
|
48
53
|
this.filterAttributes = {
|
|
49
54
|
documentId: (props === null || props === void 0 ? void 0 : props.documentId) || this.utilities.makeRandId(28),
|
|
@@ -164,6 +169,112 @@ class Product extends Base_1.default {
|
|
|
164
169
|
}
|
|
165
170
|
return obj;
|
|
166
171
|
}
|
|
172
|
+
// True for retail products that should be treated as having indefinite
|
|
173
|
+
// stock (cafe items, services, etc.). The web app marks these by writing
|
|
174
|
+
// `stockStatus = 'IN_STOCK_UNLIMITED'` on the product when the merchant
|
|
175
|
+
// toggles "Track stock" off in retail quick entry. Ordering, refund, and
|
|
176
|
+
// payout flows must skip per-location quantity decrements/restores when
|
|
177
|
+
// this returns true. Mirrors the legacy backend `isUntrackedStockProduct`
|
|
178
|
+
// shim so it lives in one place.
|
|
179
|
+
isUntrackedStock() {
|
|
180
|
+
return String(this.filterAttributes.stockStatus || '').trim() === marketplace_constants_1.STOCK_STATUSES.inStockUnlimited;
|
|
181
|
+
}
|
|
182
|
+
// Marketplace listing accessors — all return safe empty values when the
|
|
183
|
+
// product has no marketplace metadata, so legacy products are unaffected.
|
|
184
|
+
hasActiveMarketplaceListing() {
|
|
185
|
+
return this.getActiveMarketplaceListings().length > 0;
|
|
186
|
+
}
|
|
187
|
+
getActiveMarketplaceListings() {
|
|
188
|
+
const marketplace = MarketplaceProductHelpers_1.default.normalizeMarketplace(this.attributes.marketplace);
|
|
189
|
+
return Object.keys(marketplace.listings)
|
|
190
|
+
.map((parentMarketplaceId) => ({ parentMarketplaceId, listing: marketplace.listings[parentMarketplaceId] }))
|
|
191
|
+
.filter(({ listing }) => listing && listing.status !== marketplace_constants_1.MARKETPLACE_LISTING_STATUSES.removed);
|
|
192
|
+
}
|
|
193
|
+
getMarketplaceListingForParent(parentMarketplaceId) {
|
|
194
|
+
if (!parentMarketplaceId)
|
|
195
|
+
return null;
|
|
196
|
+
const marketplace = MarketplaceProductHelpers_1.default.normalizeMarketplace(this.attributes.marketplace);
|
|
197
|
+
return marketplace.listings[parentMarketplaceId] || null;
|
|
198
|
+
}
|
|
199
|
+
isMarketplaceVisibleTo(parentMarketplaceId) {
|
|
200
|
+
const listing = this.getMarketplaceListingForParent(parentMarketplaceId);
|
|
201
|
+
if (!listing)
|
|
202
|
+
return false;
|
|
203
|
+
return listing.status !== marketplace_constants_1.MARKETPLACE_LISTING_STATUSES.removed;
|
|
204
|
+
}
|
|
205
|
+
// Pricing accessors. Resolve once for the merchant's country and project
|
|
206
|
+
// every price-like field into both stored (net) and displayable (gross)
|
|
207
|
+
// forms. Backwards-compatible: legacy callers that read raw
|
|
208
|
+
// `attributes.price` continue to work; new callers can use these to get
|
|
209
|
+
// a single source of truth for gross/net display math without hand-
|
|
210
|
+
// rolling tax-rate lookups in every UI/service.
|
|
211
|
+
getResolvedTaxRate(countryCode) {
|
|
212
|
+
return PricingHelpers_1.default.resolveTaxRate({
|
|
213
|
+
countryCode,
|
|
214
|
+
taxCategory: this.attributes.taxCategory,
|
|
215
|
+
isTaxable: this.attributes.isTaxable,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
getPricing(countryCode) {
|
|
219
|
+
return PricingHelpers_1.default.getProductPricing({
|
|
220
|
+
isTaxable: this.attributes.isTaxable,
|
|
221
|
+
taxCategory: this.attributes.taxCategory,
|
|
222
|
+
price: this.attributes.price,
|
|
223
|
+
salePrice: this.consignmentAttributes.salePrice,
|
|
224
|
+
compareAtPrice: this.attributes.compareAtPrice,
|
|
225
|
+
costPerItem: this.attributes.costPerItem,
|
|
226
|
+
}, { countryCode });
|
|
227
|
+
}
|
|
228
|
+
getVariantPricing(variantId, countryCode) {
|
|
229
|
+
const variants = (this.attributes.variantInventory || []);
|
|
230
|
+
const variant = variants.find((v) => v && v.id === variantId);
|
|
231
|
+
if (!variant)
|
|
232
|
+
return null;
|
|
233
|
+
return PricingHelpers_1.default.getVariantPricing(variant, {
|
|
234
|
+
isTaxable: this.attributes.isTaxable,
|
|
235
|
+
taxCategory: this.attributes.taxCategory,
|
|
236
|
+
}, { countryCode });
|
|
237
|
+
}
|
|
238
|
+
// SKU and variant-description accessors. Centralize the parent-SKU
|
|
239
|
+
// fallback and the human-readable options join so every label printer,
|
|
240
|
+
// receipt builder, and admin list view that surfaces a variant uses
|
|
241
|
+
// the same rule. Returns '' for missing SKUs / variants rather than
|
|
242
|
+
// throwing — callers were doing their own fallback anyway.
|
|
243
|
+
getEffectiveSku() {
|
|
244
|
+
return String(this.attributes.sku || '').trim();
|
|
245
|
+
}
|
|
246
|
+
getEffectiveVariantSku(variantId) {
|
|
247
|
+
const variants = (this.attributes.variantInventory || []);
|
|
248
|
+
const variant = variants.find((v) => v && v.id === variantId) || null;
|
|
249
|
+
return ProductSkuHelpers_1.default.effectiveVariantSku({ sku: this.attributes.sku }, variant);
|
|
250
|
+
}
|
|
251
|
+
describeVariant(variantId) {
|
|
252
|
+
const variants = (this.attributes.variantInventory || []);
|
|
253
|
+
const variant = variants.find((v) => v && v.id === variantId);
|
|
254
|
+
if (!variant)
|
|
255
|
+
return '';
|
|
256
|
+
return ProductSkuHelpers_1.default.describeVariantOptions(variant.options || {});
|
|
257
|
+
}
|
|
258
|
+
// Diagnose whether a variant-inventory product is purchasable. Mirrors
|
|
259
|
+
// the readiness gate the retail entry exposes as a confirm-before-save
|
|
260
|
+
// dialog: a multivariant product with no variants generated yet, or
|
|
261
|
+
// with every variant carrying zero across all locations, is technically
|
|
262
|
+
// savable but customers won't be able to buy anything from it. Returns
|
|
263
|
+
// 'ok' for non-multivariant products (single-row / unique inventory
|
|
264
|
+
// are handled by other checks).
|
|
265
|
+
diagnoseVariantInventory() {
|
|
266
|
+
const variants = (this.attributes.variantInventory || []);
|
|
267
|
+
if (this.attributes.productClass !== 'MULTIVARIANT')
|
|
268
|
+
return 'ok';
|
|
269
|
+
if (!variants.length)
|
|
270
|
+
return 'no_variants';
|
|
271
|
+
const allZero = variants.every((v) => {
|
|
272
|
+
const locs = Array.isArray(v === null || v === void 0 ? void 0 : v.locations) ? v.locations : [];
|
|
273
|
+
const total = locs.reduce((acc, loc) => acc + (Number(loc === null || loc === void 0 ? void 0 : loc.availableAmount) || 0), 0);
|
|
274
|
+
return total <= 0;
|
|
275
|
+
});
|
|
276
|
+
return allZero ? 'all_zero_qty' : 'ok';
|
|
277
|
+
}
|
|
167
278
|
toProductInputObjForShopify(location) {
|
|
168
279
|
const productInputObj = {
|
|
169
280
|
title: this.attributes.title,
|
|
@@ -505,6 +616,7 @@ class Product extends Base_1.default {
|
|
|
505
616
|
const createdAtTimestamp = this.utilities.sanitizeMillisTimeStamp(this.timestampAttributes.createdAtTimestamp);
|
|
506
617
|
const { createdAtHour, createdAtDay, createdAtMonth, createdAtYear } = this.utilities.formatTimestamp(createdAtTimestamp);
|
|
507
618
|
const [priceSold, commissionFee, productionFee, fulfillmentFee] = ReRobeProductHelpers_1.default.buildReRobeEarningsV2(this.toObj(), isCanonicalMerchant);
|
|
619
|
+
const marketplaceFields = MarketplaceProductHelpers_1.default.buildTypesenseFields(this.attributes.marketplace);
|
|
508
620
|
const merchantValue = commissionFee + productionFee + fulfillmentFee;
|
|
509
621
|
const sellerValue = priceSold - merchantValue;
|
|
510
622
|
const calculatedCommission = merchantValue / priceSold;
|
|
@@ -523,6 +635,10 @@ class Product extends Base_1.default {
|
|
|
523
635
|
isTaxable: this.utilities.sanitizeString(this.attributes.isTaxable),
|
|
524
636
|
merchants: this.utilities.sanitzeStringArr(this.attributes.merchants),
|
|
525
637
|
merchantId: this.utilities.sanitizeString(this.attributes.merchantId),
|
|
638
|
+
marketplaceVisibleToMerchantIds: marketplaceFields.marketplaceVisibleToMerchantIds,
|
|
639
|
+
marketplaceParentMerchantIds: marketplaceFields.marketplaceParentMerchantIds,
|
|
640
|
+
marketplaceRelationshipIds: marketplaceFields.marketplaceRelationshipIds,
|
|
641
|
+
isMarketplaceVisible: marketplaceFields.isMarketplaceVisible,
|
|
526
642
|
price: this.utilities.sanitizeNumber(this.attributes.price),
|
|
527
643
|
merchantValue: this.utilities.sanitizeNumber(merchantValue),
|
|
528
644
|
sellerValue: this.utilities.sanitizeNumber(sellerValue),
|
|
@@ -979,6 +1095,30 @@ class Product extends Base_1.default {
|
|
|
979
1095
|
name: 'merchants',
|
|
980
1096
|
type: 'string[]',
|
|
981
1097
|
},
|
|
1098
|
+
{
|
|
1099
|
+
facet: false,
|
|
1100
|
+
optional: true,
|
|
1101
|
+
name: 'marketplaceVisibleToMerchantIds',
|
|
1102
|
+
type: 'string[]',
|
|
1103
|
+
},
|
|
1104
|
+
{
|
|
1105
|
+
facet: false,
|
|
1106
|
+
optional: true,
|
|
1107
|
+
name: 'marketplaceParentMerchantIds',
|
|
1108
|
+
type: 'string[]',
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
facet: false,
|
|
1112
|
+
optional: true,
|
|
1113
|
+
name: 'marketplaceRelationshipIds',
|
|
1114
|
+
type: 'string[]',
|
|
1115
|
+
},
|
|
1116
|
+
{
|
|
1117
|
+
facet: true,
|
|
1118
|
+
optional: true,
|
|
1119
|
+
name: 'isMarketplaceVisible',
|
|
1120
|
+
type: 'bool',
|
|
1121
|
+
},
|
|
982
1122
|
{
|
|
983
1123
|
facet: false,
|
|
984
1124
|
optional: true,
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { TaxCategoryValue } from '../constants/tax-constants';
|
|
2
|
+
export type IsTaxableValue = 'yes' | 'no' | boolean | string | undefined | null;
|
|
3
|
+
export interface CatalogRateInput {
|
|
4
|
+
countryCode: string;
|
|
5
|
+
taxCategory: string | null | undefined;
|
|
6
|
+
isTaxable: IsTaxableValue;
|
|
7
|
+
}
|
|
8
|
+
export interface FrozenRateInput {
|
|
9
|
+
taxRate: number | string | null | undefined;
|
|
10
|
+
isTaxable: IsTaxableValue;
|
|
11
|
+
}
|
|
12
|
+
export type RateInput = CatalogRateInput | FrozenRateInput;
|
|
13
|
+
export interface TaxResolution {
|
|
14
|
+
rate: number;
|
|
15
|
+
category?: TaxCategoryValue;
|
|
16
|
+
taxable: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface ProductPricing {
|
|
19
|
+
rate: number;
|
|
20
|
+
taxable: boolean;
|
|
21
|
+
priceNet: string;
|
|
22
|
+
salePriceNet: string;
|
|
23
|
+
compareAtPriceNet: string;
|
|
24
|
+
costPerItemNet: string;
|
|
25
|
+
priceGross: string;
|
|
26
|
+
salePriceGross: string;
|
|
27
|
+
compareAtPriceGross: string;
|
|
28
|
+
costPerItemGross: string;
|
|
29
|
+
}
|
|
30
|
+
export interface VariantPricing {
|
|
31
|
+
rate: number;
|
|
32
|
+
taxable: boolean;
|
|
33
|
+
priceNet: string;
|
|
34
|
+
salePriceNet: string;
|
|
35
|
+
compareAtPriceNet: string;
|
|
36
|
+
costPerItemNet: string;
|
|
37
|
+
priceGross: string;
|
|
38
|
+
salePriceGross: string;
|
|
39
|
+
compareAtPriceGross: string;
|
|
40
|
+
costPerItemGross: string;
|
|
41
|
+
}
|
|
42
|
+
export interface OrderLinePricing {
|
|
43
|
+
rate: number;
|
|
44
|
+
taxable: boolean;
|
|
45
|
+
unitPriceNet: string;
|
|
46
|
+
unitPriceGross: string;
|
|
47
|
+
totalPriceNet: string;
|
|
48
|
+
totalPriceGross: string;
|
|
49
|
+
salePriceNet: string;
|
|
50
|
+
salePriceGross: string;
|
|
51
|
+
}
|
|
52
|
+
export interface ProductPricingLike {
|
|
53
|
+
isTaxable?: IsTaxableValue;
|
|
54
|
+
taxCategory?: string | null;
|
|
55
|
+
price?: string | number | null;
|
|
56
|
+
salePrice?: string | number | null;
|
|
57
|
+
compareAtPrice?: string | number | null;
|
|
58
|
+
costPerItem?: string | number | null;
|
|
59
|
+
}
|
|
60
|
+
export interface VariantPricingLike {
|
|
61
|
+
taxable?: IsTaxableValue;
|
|
62
|
+
price?: string | number | null;
|
|
63
|
+
salePrice?: string | number | null;
|
|
64
|
+
compareAtPrice?: string | number | null;
|
|
65
|
+
costPerItem?: string | number | null;
|
|
66
|
+
}
|
|
67
|
+
export interface OrderLinePricingLike {
|
|
68
|
+
isTaxable?: IsTaxableValue;
|
|
69
|
+
taxRate?: number | string | null;
|
|
70
|
+
originalUnitPrice?: {
|
|
71
|
+
amount?: number | string | null;
|
|
72
|
+
} | null;
|
|
73
|
+
originalTotalPrice?: {
|
|
74
|
+
amount?: number | string | null;
|
|
75
|
+
} | null;
|
|
76
|
+
salePrice?: {
|
|
77
|
+
amount?: number | string | null;
|
|
78
|
+
} | number | string | null;
|
|
79
|
+
}
|
|
80
|
+
export interface TaxCategoryOption {
|
|
81
|
+
value: string;
|
|
82
|
+
label: string;
|
|
83
|
+
rate: number;
|
|
84
|
+
rateLabel: string;
|
|
85
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Shared pricing types. Cross-cutting between Product (catalog) and Order
|
|
3
|
+
// (frozen-rate) surfaces, kept dependency-free so they can be consumed by
|
|
4
|
+
// helpers, models, and form-states without circular imports.
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -351,7 +351,93 @@ interface ReRobeOrderLineItem extends OrderLineItem {
|
|
|
351
351
|
discountedPrice?: Money;
|
|
352
352
|
taxAmountWithDiscount?: Money;
|
|
353
353
|
handle?: string;
|
|
354
|
+
marketplace?: MarketplaceLineSnapshot;
|
|
354
355
|
}
|
|
356
|
+
type MarketplaceCommissionBasis = 'LINE_NET_EXCLUDING_TAX' | 'ORIGINAL_COMMISSION_SHARE' | string;
|
|
357
|
+
type MarketplaceLineAmounts = {
|
|
358
|
+
lineNetAmount: number;
|
|
359
|
+
discountAmount: number;
|
|
360
|
+
taxableAmount: number;
|
|
361
|
+
taxAmount: number;
|
|
362
|
+
lineGrossAmount: number;
|
|
363
|
+
originalProductCommissionAmount: number;
|
|
364
|
+
marketplaceCommissionAmount: number;
|
|
365
|
+
stripeFeeAllocatedAmount: number;
|
|
366
|
+
ribbnFeeAllocatedAmount: number;
|
|
367
|
+
sellerProceedsAmount: number;
|
|
368
|
+
managedMerchantProceedsAmount: number;
|
|
369
|
+
marketplaceProceedsAmount: number;
|
|
370
|
+
};
|
|
371
|
+
type MarketplaceVariantSnapshot = {
|
|
372
|
+
variantId: string;
|
|
373
|
+
sku: string;
|
|
374
|
+
options: VariantOptions;
|
|
375
|
+
price: string;
|
|
376
|
+
compareAtPrice?: string | null;
|
|
377
|
+
salePrice?: string | null;
|
|
378
|
+
isOnSale?: 'yes' | 'no' | null;
|
|
379
|
+
taxable?: 'yes' | 'no' | null;
|
|
380
|
+
taxCategory: string;
|
|
381
|
+
locations: InventoryLocation[];
|
|
382
|
+
};
|
|
383
|
+
type MarketplaceLineSnapshot = {
|
|
384
|
+
isMarketplaceItem: boolean;
|
|
385
|
+
parentMerchantId: string;
|
|
386
|
+
managedMerchantId: string;
|
|
387
|
+
relationshipId: string;
|
|
388
|
+
productId: string;
|
|
389
|
+
variantId?: string;
|
|
390
|
+
sellerDisplayName?: string;
|
|
391
|
+
lineDisplayTitle?: string;
|
|
392
|
+
originalProductCommissionRate: string;
|
|
393
|
+
marketplaceCommissionRate: string;
|
|
394
|
+
marketplaceCommissionBasis: MarketplaceCommissionBasis;
|
|
395
|
+
quantity: number;
|
|
396
|
+
currencyCode: string;
|
|
397
|
+
amounts: MarketplaceLineAmounts;
|
|
398
|
+
variant?: MarketplaceVariantSnapshot;
|
|
399
|
+
};
|
|
400
|
+
type MarketplaceReturnAdjustment = {
|
|
401
|
+
quantityReturned: number;
|
|
402
|
+
amounts: MarketplaceLineAmounts;
|
|
403
|
+
remainingQuantity: number;
|
|
404
|
+
};
|
|
405
|
+
type MarketplaceLedgerStatus = 'PENDING_RETURN_PERIOD' | 'PAYABLE' | 'PAID_OUT' | 'RETURNED_BEFORE_PAYOUT' | 'REFUNDED_AFTER_PAYOUT' | 'TRANSFER_REVERSED' | string;
|
|
406
|
+
type MarketplaceLedgerLifecycleTimestamps = {
|
|
407
|
+
createdAtTimestamp?: number | null;
|
|
408
|
+
pendingReturnPeriodAtTimestamp?: number | null;
|
|
409
|
+
payableAtTimestamp?: number | null;
|
|
410
|
+
paidOutAtTimestamp?: number | null;
|
|
411
|
+
returnedBeforePayoutAtTimestamp?: number | null;
|
|
412
|
+
refundedAfterPayoutAtTimestamp?: number | null;
|
|
413
|
+
transferReversedAtTimestamp?: number | null;
|
|
414
|
+
updatedAtTimestamp?: number | null;
|
|
415
|
+
};
|
|
416
|
+
type MarketplaceLedgerEntry = {
|
|
417
|
+
documentId?: string;
|
|
418
|
+
parentOrderId: string;
|
|
419
|
+
parentOrderLineItemId?: string;
|
|
420
|
+
parentMerchantId: string;
|
|
421
|
+
managedMerchantId: string;
|
|
422
|
+
relationshipId: string;
|
|
423
|
+
productId: string;
|
|
424
|
+
variantId?: string;
|
|
425
|
+
status: MarketplaceLedgerStatus;
|
|
426
|
+
snapshot: MarketplaceLineSnapshot;
|
|
427
|
+
returnDeadlineTimestamp?: number | null;
|
|
428
|
+
lifecycle: MarketplaceLedgerLifecycleTimestamps;
|
|
429
|
+
};
|
|
430
|
+
type MarketplaceFeeAllocation = {
|
|
431
|
+
lineKey: string;
|
|
432
|
+
amount: number;
|
|
433
|
+
};
|
|
434
|
+
type MarketplaceFeeBasketLine = {
|
|
435
|
+
lineKey: string;
|
|
436
|
+
sellerMerchantId: string;
|
|
437
|
+
lineNetAmount: number;
|
|
438
|
+
taxableAmount?: number;
|
|
439
|
+
quantity?: number;
|
|
440
|
+
};
|
|
355
441
|
type OrderLineItemConnection = {
|
|
356
442
|
edges: OrderLineItemEdge[];
|
|
357
443
|
};
|
|
@@ -34,6 +34,7 @@ type ProductAttributes = {
|
|
|
34
34
|
taxCategory?: string;
|
|
35
35
|
productClass?: 'UNIQUE' | 'MULTIVARIANT' | 'TEMPLATE' | 'SUPPLY' | 'DIGITAL' | string;
|
|
36
36
|
variantInventory?: VariantInventory[];
|
|
37
|
+
marketplace?: ProductMarketplace;
|
|
37
38
|
};
|
|
38
39
|
type ProductFilterAttributes = {
|
|
39
40
|
documentId: string;
|
|
@@ -173,6 +174,20 @@ type VariantInventory = {
|
|
|
173
174
|
costPerItem?: string | null;
|
|
174
175
|
continueSellingWhenOutOfStock?: boolean | null;
|
|
175
176
|
};
|
|
177
|
+
type MarketplaceListingStatus = 'ACTIVE' | 'PAUSED' | 'REMOVED' | string;
|
|
178
|
+
type ProductMarketplaceListing = {
|
|
179
|
+
relationshipId: string;
|
|
180
|
+
relationshipType: string;
|
|
181
|
+
status: MarketplaceListingStatus;
|
|
182
|
+
listedAt?: number | null;
|
|
183
|
+
updatedAt?: number | null;
|
|
184
|
+
};
|
|
185
|
+
type ProductMarketplace = {
|
|
186
|
+
visibleToMerchantIds: string[];
|
|
187
|
+
listings: {
|
|
188
|
+
[parentMarketplaceId: string]: ProductMarketplaceListing;
|
|
189
|
+
};
|
|
190
|
+
};
|
|
176
191
|
type ProductSellStatusKeys = 'SELL_REQUEST_REVIEW' | 'REJECTED' | 'HOLD' | 'ACCEPTED' | 'DROP_OFF_AT_REROBE' | 'SHIP_TO_REROBE' | 'AT_HOME_PICK_UP' | 'QUALITY_CONTROL' | 'LISTED' | 'SOLD' | 'RETURNED' | 'SOLD_SELLER_TO_BE_PAID' | 'SOLD_SELLER_PAID' | 'HIDDEN' | 'BOOKED' | 'OPEN';
|
|
177
192
|
type ProductPublishKeys = 'USER_PUBLISHED' | 'MERCHANT_PUBLISHED';
|
|
178
193
|
type ShopifyProduct = ProductAttributes & ProductFilterAttributes;
|
|
@@ -329,6 +344,10 @@ type TypesenseProductObj = {
|
|
|
329
344
|
sku: string;
|
|
330
345
|
salesChannel: string[];
|
|
331
346
|
thirdPartySalesChannels: string[];
|
|
347
|
+
marketplaceVisibleToMerchantIds: string[];
|
|
348
|
+
marketplaceParentMerchantIds: string[];
|
|
349
|
+
marketplaceRelationshipIds: string[];
|
|
350
|
+
isMarketplaceVisible: boolean;
|
|
332
351
|
status: string;
|
|
333
352
|
tags: string[];
|
|
334
353
|
systemTags: string[];
|