@retaila/shared-types 1.1.73 → 1.1.75
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.mts +186 -1
- package/dist/index.d.ts +186 -1
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +51 -51
package/dist/index.d.mts
CHANGED
|
@@ -1197,10 +1197,189 @@ declare enum CartItemErrorCode {
|
|
|
1197
1197
|
VALIDATION_ERROR = "VALIDATION_ERROR"
|
|
1198
1198
|
}
|
|
1199
1199
|
|
|
1200
|
+
/**
|
|
1201
|
+
* Promotion Module Types
|
|
1202
|
+
* Types for the promotion system including promotions, rules, application methods, and adjustments
|
|
1203
|
+
*/
|
|
1204
|
+
/**
|
|
1205
|
+
* Main promotion entity that defines discount rules and metadata
|
|
1206
|
+
*/
|
|
1207
|
+
interface Promotion {
|
|
1208
|
+
id: string;
|
|
1209
|
+
accountId: string;
|
|
1210
|
+
code: string;
|
|
1211
|
+
type: PromotionType;
|
|
1212
|
+
isAutomatic: boolean;
|
|
1213
|
+
isStackable: boolean;
|
|
1214
|
+
campaignId?: string | null;
|
|
1215
|
+
name: string;
|
|
1216
|
+
description?: string | null;
|
|
1217
|
+
status: PromotionStatus;
|
|
1218
|
+
createdAt: Date;
|
|
1219
|
+
updatedAt: Date;
|
|
1220
|
+
deletedAt?: Date | null;
|
|
1221
|
+
}
|
|
1222
|
+
declare enum PromotionType {
|
|
1223
|
+
STANDARD = "standard"
|
|
1224
|
+
}
|
|
1225
|
+
declare enum PromotionStatus {
|
|
1226
|
+
ACTIVE = "active",
|
|
1227
|
+
INACTIVE = "inactive"
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Reusable rule entity that can be attached to either Promotions (cart/order level)
|
|
1231
|
+
* or ApplicationMethods (target level)
|
|
1232
|
+
*/
|
|
1233
|
+
interface PromotionRule {
|
|
1234
|
+
id: string;
|
|
1235
|
+
accountId: string;
|
|
1236
|
+
ruleAttribute: string;
|
|
1237
|
+
ruleOperator: PromotionRuleOperator;
|
|
1238
|
+
createdAt: Date;
|
|
1239
|
+
updatedAt: Date;
|
|
1240
|
+
}
|
|
1241
|
+
declare enum PromotionRuleOperator {
|
|
1242
|
+
GT = "gt",// greater than
|
|
1243
|
+
GTE = "gte",// greater than or equal
|
|
1244
|
+
LT = "lt",// less than
|
|
1245
|
+
LTE = "lte",// less than or equal
|
|
1246
|
+
EQ = "eq",// equals
|
|
1247
|
+
IN = "in",// in array
|
|
1248
|
+
NIN = "nin"
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Stores the values that a PromotionRule is evaluated against
|
|
1252
|
+
*/
|
|
1253
|
+
interface PromotionRuleValue {
|
|
1254
|
+
id: string;
|
|
1255
|
+
promotionRuleId: string;
|
|
1256
|
+
value: string;
|
|
1257
|
+
createdAt: Date;
|
|
1258
|
+
updatedAt: Date;
|
|
1259
|
+
}
|
|
1260
|
+
/**
|
|
1261
|
+
* Many-to-many relationship between Promotion and PromotionRule for cart/order-level rules
|
|
1262
|
+
*/
|
|
1263
|
+
interface PromotionPromotionRule {
|
|
1264
|
+
promotionId: string;
|
|
1265
|
+
promotionRuleId: string;
|
|
1266
|
+
}
|
|
1267
|
+
/**
|
|
1268
|
+
* Many-to-many relationship between PromotionApplicationMethod and PromotionRule for target-level rules
|
|
1269
|
+
*/
|
|
1270
|
+
interface PromotionApplicationMethodPromotionRule {
|
|
1271
|
+
applicationMethodId: string;
|
|
1272
|
+
promotionRuleId: string;
|
|
1273
|
+
}
|
|
1274
|
+
/**
|
|
1275
|
+
* Defines how the promotion discount is applied
|
|
1276
|
+
*/
|
|
1277
|
+
interface PromotionApplicationMethod {
|
|
1278
|
+
id: string;
|
|
1279
|
+
accountId: string;
|
|
1280
|
+
promotionId: string;
|
|
1281
|
+
targetType: PromotionTargetType;
|
|
1282
|
+
applicationType: PromotionApplicationType;
|
|
1283
|
+
value: number;
|
|
1284
|
+
createdAt: Date;
|
|
1285
|
+
updatedAt: Date;
|
|
1286
|
+
deletedAt?: Date | null;
|
|
1287
|
+
}
|
|
1288
|
+
declare enum PromotionTargetType {
|
|
1289
|
+
ITEMS = "items",// apply to cart/order line items
|
|
1290
|
+
SHIPPING = "shipping",// apply to cart/order delivery methods
|
|
1291
|
+
ORDER = "order"
|
|
1292
|
+
}
|
|
1293
|
+
declare enum PromotionApplicationType {
|
|
1294
|
+
PERCENTAGE = "percentage",// e.g., 10% off
|
|
1295
|
+
FIXED = "fixed"
|
|
1296
|
+
}
|
|
1297
|
+
/**
|
|
1298
|
+
* Tracks promotion adjustments applied to individual cart items
|
|
1299
|
+
*/
|
|
1300
|
+
interface CartLineItemAdjustment {
|
|
1301
|
+
id: string;
|
|
1302
|
+
accountId: string;
|
|
1303
|
+
cartItemId: string;
|
|
1304
|
+
promotionId?: string | null;
|
|
1305
|
+
description: string;
|
|
1306
|
+
code?: string | null;
|
|
1307
|
+
amount: number;
|
|
1308
|
+
createdAt: Date;
|
|
1309
|
+
updatedAt: Date;
|
|
1310
|
+
deletedAt?: Date | null;
|
|
1311
|
+
}
|
|
1312
|
+
/**
|
|
1313
|
+
* Tracks promotion adjustments applied to cart delivery methods
|
|
1314
|
+
*/
|
|
1315
|
+
interface CartDeliveryMethodAdjustment {
|
|
1316
|
+
id: string;
|
|
1317
|
+
accountId: string;
|
|
1318
|
+
cartDeliveryMethodId: string;
|
|
1319
|
+
promotionId?: string | null;
|
|
1320
|
+
description: string;
|
|
1321
|
+
code?: string | null;
|
|
1322
|
+
amount: number;
|
|
1323
|
+
createdAt: Date;
|
|
1324
|
+
updatedAt: Date;
|
|
1325
|
+
deletedAt?: Date | null;
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* Links carts to applied promotions for easy querying (pivot table)
|
|
1329
|
+
*/
|
|
1330
|
+
interface CartPromotion {
|
|
1331
|
+
cartId: string;
|
|
1332
|
+
promotionId: string;
|
|
1333
|
+
createdAt: Date;
|
|
1334
|
+
updatedAt: Date;
|
|
1335
|
+
deletedAt?: Date | null;
|
|
1336
|
+
}
|
|
1337
|
+
/**
|
|
1338
|
+
* Tracks promotion adjustments on order items (snapshot from cart)
|
|
1339
|
+
*/
|
|
1340
|
+
interface OrderLineItemAdjustment {
|
|
1341
|
+
id: string;
|
|
1342
|
+
accountId: string;
|
|
1343
|
+
orderItemId: string;
|
|
1344
|
+
promotionId?: string | null;
|
|
1345
|
+
description: string;
|
|
1346
|
+
code?: string | null;
|
|
1347
|
+
amount: number;
|
|
1348
|
+
createdAt: Date;
|
|
1349
|
+
updatedAt: Date;
|
|
1350
|
+
deletedAt?: Date | null;
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* Tracks promotion adjustments on order delivery methods
|
|
1354
|
+
*/
|
|
1355
|
+
interface OrderDeliveryMethodAdjustment {
|
|
1356
|
+
id: string;
|
|
1357
|
+
accountId: string;
|
|
1358
|
+
orderDeliveryMethodId: string;
|
|
1359
|
+
promotionId?: string | null;
|
|
1360
|
+
description: string;
|
|
1361
|
+
code?: string | null;
|
|
1362
|
+
amount: number;
|
|
1363
|
+
createdAt: Date;
|
|
1364
|
+
updatedAt: Date;
|
|
1365
|
+
deletedAt?: Date | null;
|
|
1366
|
+
}
|
|
1367
|
+
/**
|
|
1368
|
+
* Links orders to applied promotions for easy querying (pivot table, snapshot from cart)
|
|
1369
|
+
*/
|
|
1370
|
+
interface OrderPromotion {
|
|
1371
|
+
orderId: string;
|
|
1372
|
+
promotionId: string;
|
|
1373
|
+
createdAt: Date;
|
|
1374
|
+
updatedAt: Date;
|
|
1375
|
+
deletedAt?: Date | null;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1200
1378
|
/**
|
|
1201
1379
|
* CartDeliveryMethod Entity
|
|
1202
1380
|
* Represents a snapshot of the selected delivery option for a cart
|
|
1203
1381
|
*/
|
|
1382
|
+
|
|
1204
1383
|
interface CartDeliveryMethod {
|
|
1205
1384
|
id: string;
|
|
1206
1385
|
cartId: string;
|
|
@@ -1210,6 +1389,7 @@ interface CartDeliveryMethod {
|
|
|
1210
1389
|
amount: number;
|
|
1211
1390
|
data?: Record<string, any>;
|
|
1212
1391
|
accountId: string;
|
|
1392
|
+
adjustments?: CartDeliveryMethodAdjustment[];
|
|
1213
1393
|
createdAt: Date;
|
|
1214
1394
|
updatedAt: Date;
|
|
1215
1395
|
deletedAt?: Date;
|
|
@@ -1293,6 +1473,10 @@ interface Cart {
|
|
|
1293
1473
|
customer?: Partial<Customer> | null;
|
|
1294
1474
|
accountDomain?: Partial<AccountDomain> | null;
|
|
1295
1475
|
deliveryMethod?: CartDeliveryMethod | null;
|
|
1476
|
+
promotions: {
|
|
1477
|
+
code: string;
|
|
1478
|
+
amount: number;
|
|
1479
|
+
}[];
|
|
1296
1480
|
}
|
|
1297
1481
|
interface CartItem {
|
|
1298
1482
|
id: string;
|
|
@@ -1306,6 +1490,7 @@ interface CartItem {
|
|
|
1306
1490
|
sku?: string;
|
|
1307
1491
|
attributeDetails: CartItemAttributeDetail[];
|
|
1308
1492
|
validation?: CartItemValidation;
|
|
1493
|
+
adjustments?: CartLineItemAdjustment[];
|
|
1309
1494
|
}
|
|
1310
1495
|
interface CartItemAttributeDetail {
|
|
1311
1496
|
name: string;
|
|
@@ -1707,4 +1892,4 @@ declare enum IntegrationDeliveryZoneStatus {
|
|
|
1707
1892
|
INACTIVE = "INACTIVE"
|
|
1708
1893
|
}
|
|
1709
1894
|
|
|
1710
|
-
export { type Account, type AccountBranch, type AccountBranchSchedule, AccountBranchScheduleDay, AccountBranchScheduleStatus, AccountBranchStatus, type AccountDeliveryOption, type AccountDeliveryOptionCalculatedCost, AccountDeliveryOptionPriceLogic, AccountDeliveryOptionStatus, type AccountDeliveryOptionZone, AccountDeliveryOptionZoneStatus, type AccountDomain, AccountDomainStatus, type AccountIntegration, type AccountIntegrationConfigDTO, AccountIntegrationConnectionStatus, AccountIntegrationEnvironment, AccountIntegrationStatus, type AccountPaymentMethod, AccountPaymentMethodStatus, AccountStatus, type Address, type AdminOrderStatusChangeDto, type BaseEntity, type BaseEntityWithAccount, type BaseEntityWithAccountAndUser, type BaseEntityWithUser, type ButtonStyle, type Cart, type CartConfirmDto, type CartDeliveryMethod, type CartDeliveryMethodCreateData, type CartDeliveryMethodCreateDto, type CartDeliveryMethodFindParams, type CartDeliveryMethodResponse, type CartDeliveryMethodUpdateData, type CartDeliveryMethodUpdateDto, CartDeliveryType, type CartItem, type CartItemAddDto, type CartItemAttributeDetail, CartItemErrorCode, type CartItemRemoveDto, type CartItemUpdateDto, type CartItemValidation, CartSource, CartStatus, type CartUpdateDto, type CreateAccountDeliveryOptionDTO, type CreateDeliveryOptionDto, type CreateFulfillmentDto, type CreateFulfillmentItemDto, Currency, type Customer, CustomerStatus, type CustomerUpsertDto, DayOfWeek, DeliveryType, type DeliveryZoneInput, type Fulfillment, type FulfillmentDeliveryOption, type FulfillmentItem, type FulfillmentLabel, type FulfillmentLabelCreateData, type FulfillmentLabelUpdateData, type FulfillmentProviderAdapter, type FulfillmentProviderContext, type FulfillmentProviderCreateInput, type FulfillmentProviderCreateOutput, type FulfillmentProviderKey, type FulfillmentProviderProcessWebhookInput, type FulfillmentProviderProcessWebhookOutput, type FulfillmentRecollectionCapabilities, type FulfillmentRecollectionConfig, type FulfillmentRecollectionMode, type FulfillmentRecollectionSchedule, FulfillmentStatus, type GeoZone, type GeoZoneInput, GeoZoneStatus, type Integration, IntegrationCategory, type IntegrationDeliveryZone, IntegrationDeliveryZoneStatus, IntegrationStatus, type MapPosition, type Media, MediaType, type NextStatusAction, type Order, type OrderCreateFromCartDto, type OrderDeliveryMethod, type OrderDeliveryMethodCreateData, type OrderDeliveryMethodUpdateData, OrderDeliveryType, type OrderItem, type OrderItemSnapshot, OrderPaymentStatus, OrderSource, OrderStatus, type Payment, type PaymentCardBrand, PaymentCardBrandKey, PaymentMethodType, type PaymentProviderAdapter, type PaymentProviderCaptureInput, type PaymentProviderCaptureOutput, type PaymentProviderContext, type PaymentProviderInitInput, type PaymentProviderInitOutput, type PaymentProviderKey, type PaymentProviderRefundInput, type PaymentProviderRefundOutput, type PaymentProviderWebhookResult, PaymentStatus, type Phone, type PickupLocation, type Product, type ProductAttribute, type ProductAttributeOption, ProductAttributeStatus, ProductAttributeType, type ProductCategory, ProductCategoryStatus, ProductStatus, ProductType, type ProductVariant, PubSubTopics, type StandardCategory, StandardCategoryStatus, type StatusChangeHistory, type StatusFlow, type StoreBanner, StoreBannerStatus, type StoreCustomization, type StoreCustomizationComponentSettings, type StoreCustomizationLayoutComponent, type StoreCustomizationPage, type StoreCustomizationPageComponent, type StoreCustomizationSeo, type StoreCustomizationThemeButtons, type StoreCustomizationThemeColors, type StoreCustomizationThemeTypography, type StorePage, StorePageStatus, StorePageType, type SupportConversation, SupportConversationChannel, type SupportConversationMessage, SupportConversationMessageAiAnalysisStatus, SupportConversationMessageDeliveryStatus, SupportConversationMessageDirection, SupportConversationMessageSenderType, SupportConversationPriority, SupportConversationStatus, SupportConversationVisibility, type ThemeConfig, type UpdateAccountDeliveryOptionDTO, type UpdateFulfillmentDto, type Webhook, type WebhookPayload, getAccountPaymentMethodStatusInfo, getCurrencySymbol, getFulfillmentStatusInfo, getIntegrationCategoryName, getOrderStatusInfo, getPaymentCardBrand, getPaymentStatusInfo, getProductStatusInfo, parsePriceFormatPattern };
|
|
1895
|
+
export { type Account, type AccountBranch, type AccountBranchSchedule, AccountBranchScheduleDay, AccountBranchScheduleStatus, AccountBranchStatus, type AccountDeliveryOption, type AccountDeliveryOptionCalculatedCost, AccountDeliveryOptionPriceLogic, AccountDeliveryOptionStatus, type AccountDeliveryOptionZone, AccountDeliveryOptionZoneStatus, type AccountDomain, AccountDomainStatus, type AccountIntegration, type AccountIntegrationConfigDTO, AccountIntegrationConnectionStatus, AccountIntegrationEnvironment, AccountIntegrationStatus, type AccountPaymentMethod, AccountPaymentMethodStatus, AccountStatus, type Address, type AdminOrderStatusChangeDto, type BaseEntity, type BaseEntityWithAccount, type BaseEntityWithAccountAndUser, type BaseEntityWithUser, type ButtonStyle, type Cart, type CartConfirmDto, type CartDeliveryMethod, type CartDeliveryMethodAdjustment, type CartDeliveryMethodCreateData, type CartDeliveryMethodCreateDto, type CartDeliveryMethodFindParams, type CartDeliveryMethodResponse, type CartDeliveryMethodUpdateData, type CartDeliveryMethodUpdateDto, CartDeliveryType, type CartItem, type CartItemAddDto, type CartItemAttributeDetail, CartItemErrorCode, type CartItemRemoveDto, type CartItemUpdateDto, type CartItemValidation, type CartLineItemAdjustment, type CartPromotion, CartSource, CartStatus, type CartUpdateDto, type CreateAccountDeliveryOptionDTO, type CreateDeliveryOptionDto, type CreateFulfillmentDto, type CreateFulfillmentItemDto, Currency, type Customer, CustomerStatus, type CustomerUpsertDto, DayOfWeek, DeliveryType, type DeliveryZoneInput, type Fulfillment, type FulfillmentDeliveryOption, type FulfillmentItem, type FulfillmentLabel, type FulfillmentLabelCreateData, type FulfillmentLabelUpdateData, type FulfillmentProviderAdapter, type FulfillmentProviderContext, type FulfillmentProviderCreateInput, type FulfillmentProviderCreateOutput, type FulfillmentProviderKey, type FulfillmentProviderProcessWebhookInput, type FulfillmentProviderProcessWebhookOutput, type FulfillmentRecollectionCapabilities, type FulfillmentRecollectionConfig, type FulfillmentRecollectionMode, type FulfillmentRecollectionSchedule, FulfillmentStatus, type GeoZone, type GeoZoneInput, GeoZoneStatus, type Integration, IntegrationCategory, type IntegrationDeliveryZone, IntegrationDeliveryZoneStatus, IntegrationStatus, type MapPosition, type Media, MediaType, type NextStatusAction, type Order, type OrderCreateFromCartDto, type OrderDeliveryMethod, type OrderDeliveryMethodAdjustment, type OrderDeliveryMethodCreateData, type OrderDeliveryMethodUpdateData, OrderDeliveryType, type OrderItem, type OrderItemSnapshot, type OrderLineItemAdjustment, OrderPaymentStatus, type OrderPromotion, OrderSource, OrderStatus, type Payment, type PaymentCardBrand, PaymentCardBrandKey, PaymentMethodType, type PaymentProviderAdapter, type PaymentProviderCaptureInput, type PaymentProviderCaptureOutput, type PaymentProviderContext, type PaymentProviderInitInput, type PaymentProviderInitOutput, type PaymentProviderKey, type PaymentProviderRefundInput, type PaymentProviderRefundOutput, type PaymentProviderWebhookResult, PaymentStatus, type Phone, type PickupLocation, type Product, type ProductAttribute, type ProductAttributeOption, ProductAttributeStatus, ProductAttributeType, type ProductCategory, ProductCategoryStatus, ProductStatus, ProductType, type ProductVariant, type Promotion, type PromotionApplicationMethod, type PromotionApplicationMethodPromotionRule, PromotionApplicationType, type PromotionPromotionRule, type PromotionRule, PromotionRuleOperator, type PromotionRuleValue, PromotionStatus, PromotionTargetType, PromotionType, PubSubTopics, type StandardCategory, StandardCategoryStatus, type StatusChangeHistory, type StatusFlow, type StoreBanner, StoreBannerStatus, type StoreCustomization, type StoreCustomizationComponentSettings, type StoreCustomizationLayoutComponent, type StoreCustomizationPage, type StoreCustomizationPageComponent, type StoreCustomizationSeo, type StoreCustomizationThemeButtons, type StoreCustomizationThemeColors, type StoreCustomizationThemeTypography, type StorePage, StorePageStatus, StorePageType, type SupportConversation, SupportConversationChannel, type SupportConversationMessage, SupportConversationMessageAiAnalysisStatus, SupportConversationMessageDeliveryStatus, SupportConversationMessageDirection, SupportConversationMessageSenderType, SupportConversationPriority, SupportConversationStatus, SupportConversationVisibility, type ThemeConfig, type UpdateAccountDeliveryOptionDTO, type UpdateFulfillmentDto, type Webhook, type WebhookPayload, getAccountPaymentMethodStatusInfo, getCurrencySymbol, getFulfillmentStatusInfo, getIntegrationCategoryName, getOrderStatusInfo, getPaymentCardBrand, getPaymentStatusInfo, getProductStatusInfo, parsePriceFormatPattern };
|
package/dist/index.d.ts
CHANGED
|
@@ -1197,10 +1197,189 @@ declare enum CartItemErrorCode {
|
|
|
1197
1197
|
VALIDATION_ERROR = "VALIDATION_ERROR"
|
|
1198
1198
|
}
|
|
1199
1199
|
|
|
1200
|
+
/**
|
|
1201
|
+
* Promotion Module Types
|
|
1202
|
+
* Types for the promotion system including promotions, rules, application methods, and adjustments
|
|
1203
|
+
*/
|
|
1204
|
+
/**
|
|
1205
|
+
* Main promotion entity that defines discount rules and metadata
|
|
1206
|
+
*/
|
|
1207
|
+
interface Promotion {
|
|
1208
|
+
id: string;
|
|
1209
|
+
accountId: string;
|
|
1210
|
+
code: string;
|
|
1211
|
+
type: PromotionType;
|
|
1212
|
+
isAutomatic: boolean;
|
|
1213
|
+
isStackable: boolean;
|
|
1214
|
+
campaignId?: string | null;
|
|
1215
|
+
name: string;
|
|
1216
|
+
description?: string | null;
|
|
1217
|
+
status: PromotionStatus;
|
|
1218
|
+
createdAt: Date;
|
|
1219
|
+
updatedAt: Date;
|
|
1220
|
+
deletedAt?: Date | null;
|
|
1221
|
+
}
|
|
1222
|
+
declare enum PromotionType {
|
|
1223
|
+
STANDARD = "standard"
|
|
1224
|
+
}
|
|
1225
|
+
declare enum PromotionStatus {
|
|
1226
|
+
ACTIVE = "active",
|
|
1227
|
+
INACTIVE = "inactive"
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Reusable rule entity that can be attached to either Promotions (cart/order level)
|
|
1231
|
+
* or ApplicationMethods (target level)
|
|
1232
|
+
*/
|
|
1233
|
+
interface PromotionRule {
|
|
1234
|
+
id: string;
|
|
1235
|
+
accountId: string;
|
|
1236
|
+
ruleAttribute: string;
|
|
1237
|
+
ruleOperator: PromotionRuleOperator;
|
|
1238
|
+
createdAt: Date;
|
|
1239
|
+
updatedAt: Date;
|
|
1240
|
+
}
|
|
1241
|
+
declare enum PromotionRuleOperator {
|
|
1242
|
+
GT = "gt",// greater than
|
|
1243
|
+
GTE = "gte",// greater than or equal
|
|
1244
|
+
LT = "lt",// less than
|
|
1245
|
+
LTE = "lte",// less than or equal
|
|
1246
|
+
EQ = "eq",// equals
|
|
1247
|
+
IN = "in",// in array
|
|
1248
|
+
NIN = "nin"
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Stores the values that a PromotionRule is evaluated against
|
|
1252
|
+
*/
|
|
1253
|
+
interface PromotionRuleValue {
|
|
1254
|
+
id: string;
|
|
1255
|
+
promotionRuleId: string;
|
|
1256
|
+
value: string;
|
|
1257
|
+
createdAt: Date;
|
|
1258
|
+
updatedAt: Date;
|
|
1259
|
+
}
|
|
1260
|
+
/**
|
|
1261
|
+
* Many-to-many relationship between Promotion and PromotionRule for cart/order-level rules
|
|
1262
|
+
*/
|
|
1263
|
+
interface PromotionPromotionRule {
|
|
1264
|
+
promotionId: string;
|
|
1265
|
+
promotionRuleId: string;
|
|
1266
|
+
}
|
|
1267
|
+
/**
|
|
1268
|
+
* Many-to-many relationship between PromotionApplicationMethod and PromotionRule for target-level rules
|
|
1269
|
+
*/
|
|
1270
|
+
interface PromotionApplicationMethodPromotionRule {
|
|
1271
|
+
applicationMethodId: string;
|
|
1272
|
+
promotionRuleId: string;
|
|
1273
|
+
}
|
|
1274
|
+
/**
|
|
1275
|
+
* Defines how the promotion discount is applied
|
|
1276
|
+
*/
|
|
1277
|
+
interface PromotionApplicationMethod {
|
|
1278
|
+
id: string;
|
|
1279
|
+
accountId: string;
|
|
1280
|
+
promotionId: string;
|
|
1281
|
+
targetType: PromotionTargetType;
|
|
1282
|
+
applicationType: PromotionApplicationType;
|
|
1283
|
+
value: number;
|
|
1284
|
+
createdAt: Date;
|
|
1285
|
+
updatedAt: Date;
|
|
1286
|
+
deletedAt?: Date | null;
|
|
1287
|
+
}
|
|
1288
|
+
declare enum PromotionTargetType {
|
|
1289
|
+
ITEMS = "items",// apply to cart/order line items
|
|
1290
|
+
SHIPPING = "shipping",// apply to cart/order delivery methods
|
|
1291
|
+
ORDER = "order"
|
|
1292
|
+
}
|
|
1293
|
+
declare enum PromotionApplicationType {
|
|
1294
|
+
PERCENTAGE = "percentage",// e.g., 10% off
|
|
1295
|
+
FIXED = "fixed"
|
|
1296
|
+
}
|
|
1297
|
+
/**
|
|
1298
|
+
* Tracks promotion adjustments applied to individual cart items
|
|
1299
|
+
*/
|
|
1300
|
+
interface CartLineItemAdjustment {
|
|
1301
|
+
id: string;
|
|
1302
|
+
accountId: string;
|
|
1303
|
+
cartItemId: string;
|
|
1304
|
+
promotionId?: string | null;
|
|
1305
|
+
description: string;
|
|
1306
|
+
code?: string | null;
|
|
1307
|
+
amount: number;
|
|
1308
|
+
createdAt: Date;
|
|
1309
|
+
updatedAt: Date;
|
|
1310
|
+
deletedAt?: Date | null;
|
|
1311
|
+
}
|
|
1312
|
+
/**
|
|
1313
|
+
* Tracks promotion adjustments applied to cart delivery methods
|
|
1314
|
+
*/
|
|
1315
|
+
interface CartDeliveryMethodAdjustment {
|
|
1316
|
+
id: string;
|
|
1317
|
+
accountId: string;
|
|
1318
|
+
cartDeliveryMethodId: string;
|
|
1319
|
+
promotionId?: string | null;
|
|
1320
|
+
description: string;
|
|
1321
|
+
code?: string | null;
|
|
1322
|
+
amount: number;
|
|
1323
|
+
createdAt: Date;
|
|
1324
|
+
updatedAt: Date;
|
|
1325
|
+
deletedAt?: Date | null;
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* Links carts to applied promotions for easy querying (pivot table)
|
|
1329
|
+
*/
|
|
1330
|
+
interface CartPromotion {
|
|
1331
|
+
cartId: string;
|
|
1332
|
+
promotionId: string;
|
|
1333
|
+
createdAt: Date;
|
|
1334
|
+
updatedAt: Date;
|
|
1335
|
+
deletedAt?: Date | null;
|
|
1336
|
+
}
|
|
1337
|
+
/**
|
|
1338
|
+
* Tracks promotion adjustments on order items (snapshot from cart)
|
|
1339
|
+
*/
|
|
1340
|
+
interface OrderLineItemAdjustment {
|
|
1341
|
+
id: string;
|
|
1342
|
+
accountId: string;
|
|
1343
|
+
orderItemId: string;
|
|
1344
|
+
promotionId?: string | null;
|
|
1345
|
+
description: string;
|
|
1346
|
+
code?: string | null;
|
|
1347
|
+
amount: number;
|
|
1348
|
+
createdAt: Date;
|
|
1349
|
+
updatedAt: Date;
|
|
1350
|
+
deletedAt?: Date | null;
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* Tracks promotion adjustments on order delivery methods
|
|
1354
|
+
*/
|
|
1355
|
+
interface OrderDeliveryMethodAdjustment {
|
|
1356
|
+
id: string;
|
|
1357
|
+
accountId: string;
|
|
1358
|
+
orderDeliveryMethodId: string;
|
|
1359
|
+
promotionId?: string | null;
|
|
1360
|
+
description: string;
|
|
1361
|
+
code?: string | null;
|
|
1362
|
+
amount: number;
|
|
1363
|
+
createdAt: Date;
|
|
1364
|
+
updatedAt: Date;
|
|
1365
|
+
deletedAt?: Date | null;
|
|
1366
|
+
}
|
|
1367
|
+
/**
|
|
1368
|
+
* Links orders to applied promotions for easy querying (pivot table, snapshot from cart)
|
|
1369
|
+
*/
|
|
1370
|
+
interface OrderPromotion {
|
|
1371
|
+
orderId: string;
|
|
1372
|
+
promotionId: string;
|
|
1373
|
+
createdAt: Date;
|
|
1374
|
+
updatedAt: Date;
|
|
1375
|
+
deletedAt?: Date | null;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1200
1378
|
/**
|
|
1201
1379
|
* CartDeliveryMethod Entity
|
|
1202
1380
|
* Represents a snapshot of the selected delivery option for a cart
|
|
1203
1381
|
*/
|
|
1382
|
+
|
|
1204
1383
|
interface CartDeliveryMethod {
|
|
1205
1384
|
id: string;
|
|
1206
1385
|
cartId: string;
|
|
@@ -1210,6 +1389,7 @@ interface CartDeliveryMethod {
|
|
|
1210
1389
|
amount: number;
|
|
1211
1390
|
data?: Record<string, any>;
|
|
1212
1391
|
accountId: string;
|
|
1392
|
+
adjustments?: CartDeliveryMethodAdjustment[];
|
|
1213
1393
|
createdAt: Date;
|
|
1214
1394
|
updatedAt: Date;
|
|
1215
1395
|
deletedAt?: Date;
|
|
@@ -1293,6 +1473,10 @@ interface Cart {
|
|
|
1293
1473
|
customer?: Partial<Customer> | null;
|
|
1294
1474
|
accountDomain?: Partial<AccountDomain> | null;
|
|
1295
1475
|
deliveryMethod?: CartDeliveryMethod | null;
|
|
1476
|
+
promotions: {
|
|
1477
|
+
code: string;
|
|
1478
|
+
amount: number;
|
|
1479
|
+
}[];
|
|
1296
1480
|
}
|
|
1297
1481
|
interface CartItem {
|
|
1298
1482
|
id: string;
|
|
@@ -1306,6 +1490,7 @@ interface CartItem {
|
|
|
1306
1490
|
sku?: string;
|
|
1307
1491
|
attributeDetails: CartItemAttributeDetail[];
|
|
1308
1492
|
validation?: CartItemValidation;
|
|
1493
|
+
adjustments?: CartLineItemAdjustment[];
|
|
1309
1494
|
}
|
|
1310
1495
|
interface CartItemAttributeDetail {
|
|
1311
1496
|
name: string;
|
|
@@ -1707,4 +1892,4 @@ declare enum IntegrationDeliveryZoneStatus {
|
|
|
1707
1892
|
INACTIVE = "INACTIVE"
|
|
1708
1893
|
}
|
|
1709
1894
|
|
|
1710
|
-
export { type Account, type AccountBranch, type AccountBranchSchedule, AccountBranchScheduleDay, AccountBranchScheduleStatus, AccountBranchStatus, type AccountDeliveryOption, type AccountDeliveryOptionCalculatedCost, AccountDeliveryOptionPriceLogic, AccountDeliveryOptionStatus, type AccountDeliveryOptionZone, AccountDeliveryOptionZoneStatus, type AccountDomain, AccountDomainStatus, type AccountIntegration, type AccountIntegrationConfigDTO, AccountIntegrationConnectionStatus, AccountIntegrationEnvironment, AccountIntegrationStatus, type AccountPaymentMethod, AccountPaymentMethodStatus, AccountStatus, type Address, type AdminOrderStatusChangeDto, type BaseEntity, type BaseEntityWithAccount, type BaseEntityWithAccountAndUser, type BaseEntityWithUser, type ButtonStyle, type Cart, type CartConfirmDto, type CartDeliveryMethod, type CartDeliveryMethodCreateData, type CartDeliveryMethodCreateDto, type CartDeliveryMethodFindParams, type CartDeliveryMethodResponse, type CartDeliveryMethodUpdateData, type CartDeliveryMethodUpdateDto, CartDeliveryType, type CartItem, type CartItemAddDto, type CartItemAttributeDetail, CartItemErrorCode, type CartItemRemoveDto, type CartItemUpdateDto, type CartItemValidation, CartSource, CartStatus, type CartUpdateDto, type CreateAccountDeliveryOptionDTO, type CreateDeliveryOptionDto, type CreateFulfillmentDto, type CreateFulfillmentItemDto, Currency, type Customer, CustomerStatus, type CustomerUpsertDto, DayOfWeek, DeliveryType, type DeliveryZoneInput, type Fulfillment, type FulfillmentDeliveryOption, type FulfillmentItem, type FulfillmentLabel, type FulfillmentLabelCreateData, type FulfillmentLabelUpdateData, type FulfillmentProviderAdapter, type FulfillmentProviderContext, type FulfillmentProviderCreateInput, type FulfillmentProviderCreateOutput, type FulfillmentProviderKey, type FulfillmentProviderProcessWebhookInput, type FulfillmentProviderProcessWebhookOutput, type FulfillmentRecollectionCapabilities, type FulfillmentRecollectionConfig, type FulfillmentRecollectionMode, type FulfillmentRecollectionSchedule, FulfillmentStatus, type GeoZone, type GeoZoneInput, GeoZoneStatus, type Integration, IntegrationCategory, type IntegrationDeliveryZone, IntegrationDeliveryZoneStatus, IntegrationStatus, type MapPosition, type Media, MediaType, type NextStatusAction, type Order, type OrderCreateFromCartDto, type OrderDeliveryMethod, type OrderDeliveryMethodCreateData, type OrderDeliveryMethodUpdateData, OrderDeliveryType, type OrderItem, type OrderItemSnapshot, OrderPaymentStatus, OrderSource, OrderStatus, type Payment, type PaymentCardBrand, PaymentCardBrandKey, PaymentMethodType, type PaymentProviderAdapter, type PaymentProviderCaptureInput, type PaymentProviderCaptureOutput, type PaymentProviderContext, type PaymentProviderInitInput, type PaymentProviderInitOutput, type PaymentProviderKey, type PaymentProviderRefundInput, type PaymentProviderRefundOutput, type PaymentProviderWebhookResult, PaymentStatus, type Phone, type PickupLocation, type Product, type ProductAttribute, type ProductAttributeOption, ProductAttributeStatus, ProductAttributeType, type ProductCategory, ProductCategoryStatus, ProductStatus, ProductType, type ProductVariant, PubSubTopics, type StandardCategory, StandardCategoryStatus, type StatusChangeHistory, type StatusFlow, type StoreBanner, StoreBannerStatus, type StoreCustomization, type StoreCustomizationComponentSettings, type StoreCustomizationLayoutComponent, type StoreCustomizationPage, type StoreCustomizationPageComponent, type StoreCustomizationSeo, type StoreCustomizationThemeButtons, type StoreCustomizationThemeColors, type StoreCustomizationThemeTypography, type StorePage, StorePageStatus, StorePageType, type SupportConversation, SupportConversationChannel, type SupportConversationMessage, SupportConversationMessageAiAnalysisStatus, SupportConversationMessageDeliveryStatus, SupportConversationMessageDirection, SupportConversationMessageSenderType, SupportConversationPriority, SupportConversationStatus, SupportConversationVisibility, type ThemeConfig, type UpdateAccountDeliveryOptionDTO, type UpdateFulfillmentDto, type Webhook, type WebhookPayload, getAccountPaymentMethodStatusInfo, getCurrencySymbol, getFulfillmentStatusInfo, getIntegrationCategoryName, getOrderStatusInfo, getPaymentCardBrand, getPaymentStatusInfo, getProductStatusInfo, parsePriceFormatPattern };
|
|
1895
|
+
export { type Account, type AccountBranch, type AccountBranchSchedule, AccountBranchScheduleDay, AccountBranchScheduleStatus, AccountBranchStatus, type AccountDeliveryOption, type AccountDeliveryOptionCalculatedCost, AccountDeliveryOptionPriceLogic, AccountDeliveryOptionStatus, type AccountDeliveryOptionZone, AccountDeliveryOptionZoneStatus, type AccountDomain, AccountDomainStatus, type AccountIntegration, type AccountIntegrationConfigDTO, AccountIntegrationConnectionStatus, AccountIntegrationEnvironment, AccountIntegrationStatus, type AccountPaymentMethod, AccountPaymentMethodStatus, AccountStatus, type Address, type AdminOrderStatusChangeDto, type BaseEntity, type BaseEntityWithAccount, type BaseEntityWithAccountAndUser, type BaseEntityWithUser, type ButtonStyle, type Cart, type CartConfirmDto, type CartDeliveryMethod, type CartDeliveryMethodAdjustment, type CartDeliveryMethodCreateData, type CartDeliveryMethodCreateDto, type CartDeliveryMethodFindParams, type CartDeliveryMethodResponse, type CartDeliveryMethodUpdateData, type CartDeliveryMethodUpdateDto, CartDeliveryType, type CartItem, type CartItemAddDto, type CartItemAttributeDetail, CartItemErrorCode, type CartItemRemoveDto, type CartItemUpdateDto, type CartItemValidation, type CartLineItemAdjustment, type CartPromotion, CartSource, CartStatus, type CartUpdateDto, type CreateAccountDeliveryOptionDTO, type CreateDeliveryOptionDto, type CreateFulfillmentDto, type CreateFulfillmentItemDto, Currency, type Customer, CustomerStatus, type CustomerUpsertDto, DayOfWeek, DeliveryType, type DeliveryZoneInput, type Fulfillment, type FulfillmentDeliveryOption, type FulfillmentItem, type FulfillmentLabel, type FulfillmentLabelCreateData, type FulfillmentLabelUpdateData, type FulfillmentProviderAdapter, type FulfillmentProviderContext, type FulfillmentProviderCreateInput, type FulfillmentProviderCreateOutput, type FulfillmentProviderKey, type FulfillmentProviderProcessWebhookInput, type FulfillmentProviderProcessWebhookOutput, type FulfillmentRecollectionCapabilities, type FulfillmentRecollectionConfig, type FulfillmentRecollectionMode, type FulfillmentRecollectionSchedule, FulfillmentStatus, type GeoZone, type GeoZoneInput, GeoZoneStatus, type Integration, IntegrationCategory, type IntegrationDeliveryZone, IntegrationDeliveryZoneStatus, IntegrationStatus, type MapPosition, type Media, MediaType, type NextStatusAction, type Order, type OrderCreateFromCartDto, type OrderDeliveryMethod, type OrderDeliveryMethodAdjustment, type OrderDeliveryMethodCreateData, type OrderDeliveryMethodUpdateData, OrderDeliveryType, type OrderItem, type OrderItemSnapshot, type OrderLineItemAdjustment, OrderPaymentStatus, type OrderPromotion, OrderSource, OrderStatus, type Payment, type PaymentCardBrand, PaymentCardBrandKey, PaymentMethodType, type PaymentProviderAdapter, type PaymentProviderCaptureInput, type PaymentProviderCaptureOutput, type PaymentProviderContext, type PaymentProviderInitInput, type PaymentProviderInitOutput, type PaymentProviderKey, type PaymentProviderRefundInput, type PaymentProviderRefundOutput, type PaymentProviderWebhookResult, PaymentStatus, type Phone, type PickupLocation, type Product, type ProductAttribute, type ProductAttributeOption, ProductAttributeStatus, ProductAttributeType, type ProductCategory, ProductCategoryStatus, ProductStatus, ProductType, type ProductVariant, type Promotion, type PromotionApplicationMethod, type PromotionApplicationMethodPromotionRule, PromotionApplicationType, type PromotionPromotionRule, type PromotionRule, PromotionRuleOperator, type PromotionRuleValue, PromotionStatus, PromotionTargetType, PromotionType, PubSubTopics, type StandardCategory, StandardCategoryStatus, type StatusChangeHistory, type StatusFlow, type StoreBanner, StoreBannerStatus, type StoreCustomization, type StoreCustomizationComponentSettings, type StoreCustomizationLayoutComponent, type StoreCustomizationPage, type StoreCustomizationPageComponent, type StoreCustomizationSeo, type StoreCustomizationThemeButtons, type StoreCustomizationThemeColors, type StoreCustomizationThemeTypography, type StorePage, StorePageStatus, StorePageType, type SupportConversation, SupportConversationChannel, type SupportConversationMessage, SupportConversationMessageAiAnalysisStatus, SupportConversationMessageDeliveryStatus, SupportConversationMessageDirection, SupportConversationMessageSenderType, SupportConversationPriority, SupportConversationStatus, SupportConversationVisibility, type ThemeConfig, type UpdateAccountDeliveryOptionDTO, type UpdateFulfillmentDto, type Webhook, type WebhookPayload, getAccountPaymentMethodStatusInfo, getCurrencySymbol, getFulfillmentStatusInfo, getIntegrationCategoryName, getOrderStatusInfo, getPaymentCardBrand, getPaymentStatusInfo, getProductStatusInfo, parsePriceFormatPattern };
|
package/dist/index.js
CHANGED
|
@@ -59,6 +59,11 @@ __export(index_exports, {
|
|
|
59
59
|
ProductCategoryStatus: () => ProductCategoryStatus,
|
|
60
60
|
ProductStatus: () => ProductStatus,
|
|
61
61
|
ProductType: () => ProductType,
|
|
62
|
+
PromotionApplicationType: () => PromotionApplicationType,
|
|
63
|
+
PromotionRuleOperator: () => PromotionRuleOperator,
|
|
64
|
+
PromotionStatus: () => PromotionStatus,
|
|
65
|
+
PromotionTargetType: () => PromotionTargetType,
|
|
66
|
+
PromotionType: () => PromotionType,
|
|
62
67
|
PubSubTopics: () => PubSubTopics,
|
|
63
68
|
StandardCategoryStatus: () => StandardCategoryStatus,
|
|
64
69
|
StoreBannerStatus: () => StoreBannerStatus,
|
|
@@ -590,6 +595,38 @@ function getProductStatusInfo(status) {
|
|
|
590
595
|
return map[status] ?? { text: String(status), class: "secondary" };
|
|
591
596
|
}
|
|
592
597
|
|
|
598
|
+
// src/promotion/types.ts
|
|
599
|
+
var PromotionType = /* @__PURE__ */ ((PromotionType2) => {
|
|
600
|
+
PromotionType2["STANDARD"] = "standard";
|
|
601
|
+
return PromotionType2;
|
|
602
|
+
})(PromotionType || {});
|
|
603
|
+
var PromotionStatus = /* @__PURE__ */ ((PromotionStatus2) => {
|
|
604
|
+
PromotionStatus2["ACTIVE"] = "active";
|
|
605
|
+
PromotionStatus2["INACTIVE"] = "inactive";
|
|
606
|
+
return PromotionStatus2;
|
|
607
|
+
})(PromotionStatus || {});
|
|
608
|
+
var PromotionRuleOperator = /* @__PURE__ */ ((PromotionRuleOperator2) => {
|
|
609
|
+
PromotionRuleOperator2["GT"] = "gt";
|
|
610
|
+
PromotionRuleOperator2["GTE"] = "gte";
|
|
611
|
+
PromotionRuleOperator2["LT"] = "lt";
|
|
612
|
+
PromotionRuleOperator2["LTE"] = "lte";
|
|
613
|
+
PromotionRuleOperator2["EQ"] = "eq";
|
|
614
|
+
PromotionRuleOperator2["IN"] = "in";
|
|
615
|
+
PromotionRuleOperator2["NIN"] = "nin";
|
|
616
|
+
return PromotionRuleOperator2;
|
|
617
|
+
})(PromotionRuleOperator || {});
|
|
618
|
+
var PromotionTargetType = /* @__PURE__ */ ((PromotionTargetType2) => {
|
|
619
|
+
PromotionTargetType2["ITEMS"] = "items";
|
|
620
|
+
PromotionTargetType2["SHIPPING"] = "shipping";
|
|
621
|
+
PromotionTargetType2["ORDER"] = "order";
|
|
622
|
+
return PromotionTargetType2;
|
|
623
|
+
})(PromotionTargetType || {});
|
|
624
|
+
var PromotionApplicationType = /* @__PURE__ */ ((PromotionApplicationType2) => {
|
|
625
|
+
PromotionApplicationType2["PERCENTAGE"] = "percentage";
|
|
626
|
+
PromotionApplicationType2["FIXED"] = "fixed";
|
|
627
|
+
return PromotionApplicationType2;
|
|
628
|
+
})(PromotionApplicationType || {});
|
|
629
|
+
|
|
593
630
|
// src/productAttribute/types.ts
|
|
594
631
|
var ProductAttributeStatus = /* @__PURE__ */ ((ProductAttributeStatus2) => {
|
|
595
632
|
ProductAttributeStatus2["ACTIVE"] = "ACTIVE";
|
|
@@ -787,6 +824,11 @@ var IntegrationDeliveryZoneStatus = /* @__PURE__ */ ((IntegrationDeliveryZoneSta
|
|
|
787
824
|
ProductCategoryStatus,
|
|
788
825
|
ProductStatus,
|
|
789
826
|
ProductType,
|
|
827
|
+
PromotionApplicationType,
|
|
828
|
+
PromotionRuleOperator,
|
|
829
|
+
PromotionStatus,
|
|
830
|
+
PromotionTargetType,
|
|
831
|
+
PromotionType,
|
|
790
832
|
PubSubTopics,
|
|
791
833
|
StandardCategoryStatus,
|
|
792
834
|
StoreBannerStatus,
|