@fas-core/shared-types 1.0.49 → 1.0.52
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 +50 -1
- package/dist/index.d.ts +50 -1
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -200,11 +200,22 @@ interface IStock extends BaseEntity {
|
|
|
200
200
|
lowStockThreshold: number;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
+
/** Out-of-stock selling policy for a product/variant. */
|
|
204
|
+
declare const InventoryPolicyEnum: {
|
|
205
|
+
/** Hard-stop at available stock (no oversell). */
|
|
206
|
+
readonly DENY: "deny";
|
|
207
|
+
/** Allow backorder / oversell past available stock. */
|
|
208
|
+
readonly CONTINUE: "continue";
|
|
209
|
+
};
|
|
210
|
+
type InventoryPolicy = (typeof InventoryPolicyEnum)[keyof typeof InventoryPolicyEnum];
|
|
211
|
+
declare const INVENTORY_POLICY_VALUES: InventoryPolicy[];
|
|
212
|
+
|
|
203
213
|
interface IProductVariantFields {
|
|
204
214
|
description: string;
|
|
205
215
|
overview: string;
|
|
206
216
|
price: IPrice;
|
|
207
217
|
quantity: number;
|
|
218
|
+
inventoryPolicy: InventoryPolicy;
|
|
208
219
|
brand: IBrand;
|
|
209
220
|
store: IStore;
|
|
210
221
|
stock: IStock;
|
|
@@ -548,6 +559,44 @@ interface IAddonGroup extends BaseEntity {
|
|
|
548
559
|
status: boolean;
|
|
549
560
|
}
|
|
550
561
|
|
|
562
|
+
type RedirectTargetType = "product" | "variant" | "category" | "url";
|
|
563
|
+
/** An old→new URL redirect for safe site migration (many old paths → one target). */
|
|
564
|
+
interface IRedirect extends BaseEntity {
|
|
565
|
+
fromPath: string;
|
|
566
|
+
targetType: RedirectTargetType;
|
|
567
|
+
/** Catalog reference id when targetType is product/variant/category. */
|
|
568
|
+
targetRef?: string | null;
|
|
569
|
+
/** Raw destination path/URL when targetType is "url". */
|
|
570
|
+
targetUrl?: string | null;
|
|
571
|
+
statusCode: number;
|
|
572
|
+
/** Append the incoming query string to the destination. */
|
|
573
|
+
preserveQuery: boolean;
|
|
574
|
+
status: boolean;
|
|
575
|
+
hits: number;
|
|
576
|
+
lastHitAt?: Date | null;
|
|
577
|
+
}
|
|
578
|
+
/** A captured 404 (unmatched path) surfaced in admin to find missing redirects. */
|
|
579
|
+
interface IUnmatched404 extends BaseEntity {
|
|
580
|
+
path: string;
|
|
581
|
+
count: number;
|
|
582
|
+
lastSeenAt: Date;
|
|
583
|
+
referrer?: string | null;
|
|
584
|
+
resolved: boolean;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Normalizes a URL or path into a canonical, lookup-stable path so old-site URLs
|
|
589
|
+
* match reliably regardless of how they were entered (full URL, casing, trailing
|
|
590
|
+
* slash, query/hash, encoding). Shared by the backend (storing `fromPath`) and
|
|
591
|
+
* the storefront proxy (matching incoming paths) so the two can never drift.
|
|
592
|
+
*
|
|
593
|
+
* Examples:
|
|
594
|
+
* "https://old.com/Shop/Item/?x=1#a" -> "/shop/item"
|
|
595
|
+
* "Foo//Bar/" -> "/foo/bar"
|
|
596
|
+
* "" -> "/"
|
|
597
|
+
*/
|
|
598
|
+
declare const normalizePath: (input: string) => string;
|
|
599
|
+
|
|
551
600
|
interface ICartItem extends BaseEntity {
|
|
552
601
|
cart: ICart;
|
|
553
602
|
product: IProduct;
|
|
@@ -566,4 +615,4 @@ interface ICart extends BaseEntity {
|
|
|
566
615
|
pricing: ISummaryPricing;
|
|
567
616
|
}
|
|
568
617
|
|
|
569
|
-
export { ADMIN_ROLES, type ApiResponse, type BaseEntity, DiscountTypeEnum, type IAddonConfig, type IAddonGroup, type IAddress, type IAdmin, type IAdminCreate, type IAdminRoleType, type IAdminSafe, type IAdminUpdate, type IBrand, type ICart, type ICartItem, type ICategory, type ICompliance, type IContact, type IContent, type ICountry, type ICoupon, type ICurrency, type ICustomer, type IDiscountType, type IDocumentation, type IKeyValue, type ILinePricing, type IMediaAsset, type IOrder, type IOrderItem, type IOrderTransaction, type IPrice, type IProduct, type IProductOptionGroup, type IProductOptionValue, type IProductRelationGroup, type IProductTechnicalSpec, type IProductTechnicalSpecTable, type IProductVariantFields, type IProductVariantOptionGroup, type IProductVariantOptionMatrix, type IProductVariantOptionValue, type IRefundTransaction, type IRelationGroup, type ISEOMetaData, type IShipping, type IState, type IStock, type IStore, type IStoreSettings, type ISummaryPricing, type ITechSpec, type ITechnicalSpecColumn, type ITechnicalSpecGroup, type ITransactionBase, type IVariant, type IVariantOptionSelection, type Metadata, ORDER_STATUS_VALUES, OrderStatusEnum, PAYMENT_METHOD_VALUES, PAYMENT_STATUS_VALUES, type Paginated, PaymentMethodEnum, PaymentStatusEnum, type PricingType, type ProductVariantType, type SoftDeleteFilter, type StockStatus, TRANSACTION_TYPE_VALUES, TransactionTypeEnum, type VariantOptionMode, paymentMethodColorMap, paymentStatusColorMap, statusColors, typeColorMap };
|
|
618
|
+
export { ADMIN_ROLES, type ApiResponse, type BaseEntity, DiscountTypeEnum, type IAddonConfig, type IAddonGroup, type IAddress, type IAdmin, type IAdminCreate, type IAdminRoleType, type IAdminSafe, type IAdminUpdate, type IBrand, type ICart, type ICartItem, type ICategory, type ICompliance, type IContact, type IContent, type ICountry, type ICoupon, type ICurrency, type ICustomer, type IDiscountType, type IDocumentation, type IKeyValue, type ILinePricing, type IMediaAsset, INVENTORY_POLICY_VALUES, type IOrder, type IOrderItem, type IOrderTransaction, type IPrice, type IProduct, type IProductOptionGroup, type IProductOptionValue, type IProductRelationGroup, type IProductTechnicalSpec, type IProductTechnicalSpecTable, type IProductVariantFields, type IProductVariantOptionGroup, type IProductVariantOptionMatrix, type IProductVariantOptionValue, type IRedirect, type IRefundTransaction, type IRelationGroup, type ISEOMetaData, type IShipping, type IState, type IStock, type IStore, type IStoreSettings, type ISummaryPricing, type ITechSpec, type ITechnicalSpecColumn, type ITechnicalSpecGroup, type ITransactionBase, type IUnmatched404, type IVariant, type IVariantOptionSelection, type InventoryPolicy, InventoryPolicyEnum, type Metadata, ORDER_STATUS_VALUES, OrderStatusEnum, PAYMENT_METHOD_VALUES, PAYMENT_STATUS_VALUES, type Paginated, PaymentMethodEnum, PaymentStatusEnum, type PricingType, type ProductVariantType, type RedirectTargetType, type SoftDeleteFilter, type StockStatus, TRANSACTION_TYPE_VALUES, TransactionTypeEnum, type VariantOptionMode, normalizePath, paymentMethodColorMap, paymentStatusColorMap, statusColors, typeColorMap };
|
package/dist/index.d.ts
CHANGED
|
@@ -200,11 +200,22 @@ interface IStock extends BaseEntity {
|
|
|
200
200
|
lowStockThreshold: number;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
+
/** Out-of-stock selling policy for a product/variant. */
|
|
204
|
+
declare const InventoryPolicyEnum: {
|
|
205
|
+
/** Hard-stop at available stock (no oversell). */
|
|
206
|
+
readonly DENY: "deny";
|
|
207
|
+
/** Allow backorder / oversell past available stock. */
|
|
208
|
+
readonly CONTINUE: "continue";
|
|
209
|
+
};
|
|
210
|
+
type InventoryPolicy = (typeof InventoryPolicyEnum)[keyof typeof InventoryPolicyEnum];
|
|
211
|
+
declare const INVENTORY_POLICY_VALUES: InventoryPolicy[];
|
|
212
|
+
|
|
203
213
|
interface IProductVariantFields {
|
|
204
214
|
description: string;
|
|
205
215
|
overview: string;
|
|
206
216
|
price: IPrice;
|
|
207
217
|
quantity: number;
|
|
218
|
+
inventoryPolicy: InventoryPolicy;
|
|
208
219
|
brand: IBrand;
|
|
209
220
|
store: IStore;
|
|
210
221
|
stock: IStock;
|
|
@@ -548,6 +559,44 @@ interface IAddonGroup extends BaseEntity {
|
|
|
548
559
|
status: boolean;
|
|
549
560
|
}
|
|
550
561
|
|
|
562
|
+
type RedirectTargetType = "product" | "variant" | "category" | "url";
|
|
563
|
+
/** An old→new URL redirect for safe site migration (many old paths → one target). */
|
|
564
|
+
interface IRedirect extends BaseEntity {
|
|
565
|
+
fromPath: string;
|
|
566
|
+
targetType: RedirectTargetType;
|
|
567
|
+
/** Catalog reference id when targetType is product/variant/category. */
|
|
568
|
+
targetRef?: string | null;
|
|
569
|
+
/** Raw destination path/URL when targetType is "url". */
|
|
570
|
+
targetUrl?: string | null;
|
|
571
|
+
statusCode: number;
|
|
572
|
+
/** Append the incoming query string to the destination. */
|
|
573
|
+
preserveQuery: boolean;
|
|
574
|
+
status: boolean;
|
|
575
|
+
hits: number;
|
|
576
|
+
lastHitAt?: Date | null;
|
|
577
|
+
}
|
|
578
|
+
/** A captured 404 (unmatched path) surfaced in admin to find missing redirects. */
|
|
579
|
+
interface IUnmatched404 extends BaseEntity {
|
|
580
|
+
path: string;
|
|
581
|
+
count: number;
|
|
582
|
+
lastSeenAt: Date;
|
|
583
|
+
referrer?: string | null;
|
|
584
|
+
resolved: boolean;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Normalizes a URL or path into a canonical, lookup-stable path so old-site URLs
|
|
589
|
+
* match reliably regardless of how they were entered (full URL, casing, trailing
|
|
590
|
+
* slash, query/hash, encoding). Shared by the backend (storing `fromPath`) and
|
|
591
|
+
* the storefront proxy (matching incoming paths) so the two can never drift.
|
|
592
|
+
*
|
|
593
|
+
* Examples:
|
|
594
|
+
* "https://old.com/Shop/Item/?x=1#a" -> "/shop/item"
|
|
595
|
+
* "Foo//Bar/" -> "/foo/bar"
|
|
596
|
+
* "" -> "/"
|
|
597
|
+
*/
|
|
598
|
+
declare const normalizePath: (input: string) => string;
|
|
599
|
+
|
|
551
600
|
interface ICartItem extends BaseEntity {
|
|
552
601
|
cart: ICart;
|
|
553
602
|
product: IProduct;
|
|
@@ -566,4 +615,4 @@ interface ICart extends BaseEntity {
|
|
|
566
615
|
pricing: ISummaryPricing;
|
|
567
616
|
}
|
|
568
617
|
|
|
569
|
-
export { ADMIN_ROLES, type ApiResponse, type BaseEntity, DiscountTypeEnum, type IAddonConfig, type IAddonGroup, type IAddress, type IAdmin, type IAdminCreate, type IAdminRoleType, type IAdminSafe, type IAdminUpdate, type IBrand, type ICart, type ICartItem, type ICategory, type ICompliance, type IContact, type IContent, type ICountry, type ICoupon, type ICurrency, type ICustomer, type IDiscountType, type IDocumentation, type IKeyValue, type ILinePricing, type IMediaAsset, type IOrder, type IOrderItem, type IOrderTransaction, type IPrice, type IProduct, type IProductOptionGroup, type IProductOptionValue, type IProductRelationGroup, type IProductTechnicalSpec, type IProductTechnicalSpecTable, type IProductVariantFields, type IProductVariantOptionGroup, type IProductVariantOptionMatrix, type IProductVariantOptionValue, type IRefundTransaction, type IRelationGroup, type ISEOMetaData, type IShipping, type IState, type IStock, type IStore, type IStoreSettings, type ISummaryPricing, type ITechSpec, type ITechnicalSpecColumn, type ITechnicalSpecGroup, type ITransactionBase, type IVariant, type IVariantOptionSelection, type Metadata, ORDER_STATUS_VALUES, OrderStatusEnum, PAYMENT_METHOD_VALUES, PAYMENT_STATUS_VALUES, type Paginated, PaymentMethodEnum, PaymentStatusEnum, type PricingType, type ProductVariantType, type SoftDeleteFilter, type StockStatus, TRANSACTION_TYPE_VALUES, TransactionTypeEnum, type VariantOptionMode, paymentMethodColorMap, paymentStatusColorMap, statusColors, typeColorMap };
|
|
618
|
+
export { ADMIN_ROLES, type ApiResponse, type BaseEntity, DiscountTypeEnum, type IAddonConfig, type IAddonGroup, type IAddress, type IAdmin, type IAdminCreate, type IAdminRoleType, type IAdminSafe, type IAdminUpdate, type IBrand, type ICart, type ICartItem, type ICategory, type ICompliance, type IContact, type IContent, type ICountry, type ICoupon, type ICurrency, type ICustomer, type IDiscountType, type IDocumentation, type IKeyValue, type ILinePricing, type IMediaAsset, INVENTORY_POLICY_VALUES, type IOrder, type IOrderItem, type IOrderTransaction, type IPrice, type IProduct, type IProductOptionGroup, type IProductOptionValue, type IProductRelationGroup, type IProductTechnicalSpec, type IProductTechnicalSpecTable, type IProductVariantFields, type IProductVariantOptionGroup, type IProductVariantOptionMatrix, type IProductVariantOptionValue, type IRedirect, type IRefundTransaction, type IRelationGroup, type ISEOMetaData, type IShipping, type IState, type IStock, type IStore, type IStoreSettings, type ISummaryPricing, type ITechSpec, type ITechnicalSpecColumn, type ITechnicalSpecGroup, type ITransactionBase, type IUnmatched404, type IVariant, type IVariantOptionSelection, type InventoryPolicy, InventoryPolicyEnum, type Metadata, ORDER_STATUS_VALUES, OrderStatusEnum, PAYMENT_METHOD_VALUES, PAYMENT_STATUS_VALUES, type Paginated, PaymentMethodEnum, PaymentStatusEnum, type PricingType, type ProductVariantType, type RedirectTargetType, type SoftDeleteFilter, type StockStatus, TRANSACTION_TYPE_VALUES, TransactionTypeEnum, type VariantOptionMode, normalizePath, paymentMethodColorMap, paymentStatusColorMap, statusColors, typeColorMap };
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,8 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
ADMIN_ROLES: () => ADMIN_ROLES,
|
|
24
24
|
DiscountTypeEnum: () => DiscountTypeEnum,
|
|
25
|
+
INVENTORY_POLICY_VALUES: () => INVENTORY_POLICY_VALUES,
|
|
26
|
+
InventoryPolicyEnum: () => InventoryPolicyEnum,
|
|
25
27
|
ORDER_STATUS_VALUES: () => ORDER_STATUS_VALUES,
|
|
26
28
|
OrderStatusEnum: () => OrderStatusEnum,
|
|
27
29
|
PAYMENT_METHOD_VALUES: () => PAYMENT_METHOD_VALUES,
|
|
@@ -30,6 +32,7 @@ __export(index_exports, {
|
|
|
30
32
|
PaymentStatusEnum: () => PaymentStatusEnum,
|
|
31
33
|
TRANSACTION_TYPE_VALUES: () => TRANSACTION_TYPE_VALUES,
|
|
32
34
|
TransactionTypeEnum: () => TransactionTypeEnum,
|
|
35
|
+
normalizePath: () => normalizePath,
|
|
33
36
|
paymentMethodColorMap: () => paymentMethodColorMap,
|
|
34
37
|
paymentStatusColorMap: () => paymentStatusColorMap,
|
|
35
38
|
statusColors: () => statusColors,
|
|
@@ -55,6 +58,36 @@ var DiscountTypeEnum = {
|
|
|
55
58
|
FIXED: "FIXED"
|
|
56
59
|
};
|
|
57
60
|
|
|
61
|
+
// src/inventory/interface.ts
|
|
62
|
+
var InventoryPolicyEnum = {
|
|
63
|
+
/** Hard-stop at available stock (no oversell). */
|
|
64
|
+
DENY: "deny",
|
|
65
|
+
/** Allow backorder / oversell past available stock. */
|
|
66
|
+
CONTINUE: "continue"
|
|
67
|
+
};
|
|
68
|
+
var INVENTORY_POLICY_VALUES = Object.values(InventoryPolicyEnum);
|
|
69
|
+
|
|
70
|
+
// src/path/index.ts
|
|
71
|
+
var normalizePath = (input) => {
|
|
72
|
+
if (!input || typeof input !== "string") return "/";
|
|
73
|
+
let path = input.trim();
|
|
74
|
+
if (/^https?:\/\//i.test(path)) {
|
|
75
|
+
try {
|
|
76
|
+
path = new URL(path).pathname;
|
|
77
|
+
} catch {
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
path = path.split("?")[0].split("#")[0];
|
|
81
|
+
try {
|
|
82
|
+
path = decodeURIComponent(path);
|
|
83
|
+
} catch {
|
|
84
|
+
}
|
|
85
|
+
if (!path.startsWith("/")) path = `/${path}`;
|
|
86
|
+
path = path.replace(/\/{2,}/g, "/").toLowerCase();
|
|
87
|
+
if (path.length > 1) path = path.replace(/\/+$/, "");
|
|
88
|
+
return path || "/";
|
|
89
|
+
};
|
|
90
|
+
|
|
58
91
|
// src/order/interface.ts
|
|
59
92
|
var OrderStatusEnum = {
|
|
60
93
|
CREATED: "CREATED",
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/admin/interface.ts","../src/coupon/interface.ts","../src/order/interface.ts","../src/transaction/interface.ts"],"sourcesContent":["export * from './address';\nexport * from './admin';\nexport * from './base';\nexport * from './common';\nexport * from './country';\nexport * from './customer';\nexport * from './state';\nexport * from './store';\nexport * from './currency';\nexport * from './contact';\nexport * from './coupon';\nexport * from './product';\nexport * from './productVariantOptions';\nexport * from './productTechnicalSpec';\nexport * from './addonConfig';\nexport * from './relationGroup';\nexport * from './variant';\nexport * from './productVariant';\nexport * from './order';\nexport * from './orderItem';\nexport * from './cart';\nexport * from './cartItem';\nexport * from './category';\nexport * from './brand';\nexport * from './stock';\nexport * from './transaction';\n","import type { BaseEntity } from '../base/interface';\n\nexport type IAdminRoleType =\n | 'Admin'\n | 'Super Admin'\n | 'Cashier'\n | 'Manager'\n | 'CEO'\n | 'Driver'\n | 'Security Guard'\n | 'Accountant';\n\nexport const ADMIN_ROLES: IAdminRoleType[] = [\n 'Admin',\n 'Super Admin',\n 'Cashier',\n 'Manager',\n 'CEO',\n 'Driver',\n 'Security Guard',\n 'Accountant',\n];\n\nexport interface IAdmin extends BaseEntity {\n firstName: string;\n lastName: string;\n email: string;\n phoneNumber: string;\n status: boolean;\n password: string;\n role: IAdminRoleType;\n access_list: string[];\n joiningDate: Date;\n profileImage: string;\n lastLogin: Date;\n}\n\nexport type IAdminCreate = Omit<IAdmin, keyof BaseEntity>;\nexport type IAdminUpdate = Partial<IAdminCreate>;\nexport type IAdminSafe = Omit<IAdmin, 'password'>;\n","import type { BaseEntity } from \"../base\";\nimport type { IStore } from \"../store\";\n\nexport const DiscountTypeEnum = {\n PERCENTAGE: \"PERCENTAGE\",\n FIXED: \"FIXED\",\n} as const;\n\nexport type DiscountTypeEnum = (typeof DiscountTypeEnum)[keyof typeof DiscountTypeEnum];\n\nexport interface IDiscountType {\n type: DiscountTypeEnum;\n value: number;\n}\n\nexport interface ICoupon extends BaseEntity {\n title: string;\n couponCode: string;\n startTime: Date;\n endTime: Date;\n discountType: IDiscountType;\n minimumAmount: number;\n isPromotional: boolean;\n status: boolean;\n stores: IStore[];\n}\n","import type { BaseEntity } from \"../base\";\nimport type { ISummaryPricing, Metadata } from \"../common\";\nimport type { ICoupon } from \"../coupon\";\nimport type { ICustomer } from \"../customer\";\nimport type { IOrderItem } from \"../orderItem\";\nimport type { IStore } from \"../store\";\nimport type { IOrderTransaction, IRefundTransaction } from \"../transaction\";\nimport type { PaymentMethodEnum, PaymentStatusEnum } from \"../transaction\";\n\nexport const OrderStatusEnum = {\n CREATED: \"CREATED\",\n RECEIVED: \"RECEIVED\",\n PENDING: \"PENDING\",\n CONFIRMED: \"CONFIRMED\",\n PROCESSING: \"PROCESSING\",\n SHIPPED: \"SHIPPED\",\n DELIVERED: \"DELIVERED\",\n CANCELED: \"CANCELED\",\n FAILED: \"FAILED\",\n REFUNDED: \"REFUNDED\",\n PARTIALLY_REFUNDED: \"PARTIALLY_REFUNDED\",\n ARCHIVED: \"ARCHIVED\",\n RETURNED: \"RETURNED\",\n} as const;\n\nexport type OrderStatusEnum = (typeof OrderStatusEnum)[keyof typeof OrderStatusEnum];\nexport const ORDER_STATUS_VALUES = Object.values(OrderStatusEnum);\n\nexport const statusColors: Record<OrderStatusEnum, string> = {\n [OrderStatusEnum.CREATED]: \"default\",\n [OrderStatusEnum.RECEIVED]: \"cyan\",\n [OrderStatusEnum.PENDING]: \"gold\",\n [OrderStatusEnum.CONFIRMED]: \"blue\",\n [OrderStatusEnum.PROCESSING]: \"cyan\",\n [OrderStatusEnum.SHIPPED]: \"purple\",\n [OrderStatusEnum.DELIVERED]: \"green\",\n [OrderStatusEnum.CANCELED]: \"volcano\",\n [OrderStatusEnum.FAILED]: \"red\",\n [OrderStatusEnum.REFUNDED]: \"orange\",\n [OrderStatusEnum.PARTIALLY_REFUNDED]: \"magenta\",\n [OrderStatusEnum.ARCHIVED]: \"gray\",\n [OrderStatusEnum.RETURNED]: \"purple\",\n};\n\nexport interface IOrder extends BaseEntity {\n orderId: string;\n orderItems: IOrderItem[];\n customer: ICustomer;\n coupon: ICoupon;\n store: IStore;\n status: OrderStatusEnum;\n paymentStatus: PaymentStatusEnum;\n paymentMethod: PaymentMethodEnum;\n metaData: Metadata;\n orderTransactions: IOrderTransaction[];\n refundTransactions: IRefundTransaction[];\n pricing: ISummaryPricing;\n}\n","import type { BaseEntity } from \"../base\";\nimport type { Metadata } from \"../common\";\nimport type { IOrder } from \"../order\";\nimport type { ICurrency } from \"../currency\";\n\nexport const PaymentStatusEnum = {\n INITIATED: 'INITIATED',\n PENDING: 'PENDING',\n PROCESSING: 'PROCESSING',\n FAILED: 'FAILED',\n CANCELLED: 'CANCELLED',\n PENDING_CAPTURE: 'PENDING_CAPTURE',\n COMPLETED: 'COMPLETED',\n VOIDED: 'VOIDED',\n REDIRECTED_TO_GATEWAY: 'REDIRECTED_TO_GATEWAY',\n UNKNOWN: 'UNKNOWN',\n REFUNDED: 'REFUNDED',\n PARTIALLY_REFUNDED: 'PARTIALLY_REFUNDED',\n} as const;\n\nexport type PaymentStatusEnum = (typeof PaymentStatusEnum)[keyof typeof PaymentStatusEnum];\nexport const PAYMENT_STATUS_VALUES = Object.values(PaymentStatusEnum);\n\nexport const paymentStatusColorMap: Record<PaymentStatusEnum, string> = {\n [PaymentStatusEnum.INITIATED]: 'default',\n [PaymentStatusEnum.PENDING]: 'gold',\n [PaymentStatusEnum.PROCESSING]: 'cyan',\n [PaymentStatusEnum.FAILED]: 'red',\n [PaymentStatusEnum.CANCELLED]: 'volcano',\n [PaymentStatusEnum.PENDING_CAPTURE]: 'blue',\n [PaymentStatusEnum.COMPLETED]: 'green',\n [PaymentStatusEnum.VOIDED]: 'magenta',\n [PaymentStatusEnum.REDIRECTED_TO_GATEWAY]: 'purple',\n [PaymentStatusEnum.UNKNOWN]: 'gray',\n [PaymentStatusEnum.REFUNDED]: 'orange',\n [PaymentStatusEnum.PARTIALLY_REFUNDED]: 'magenta',\n};\n\nexport const PaymentMethodEnum = {\n CREDIT_CARD: 'CREDIT_CARD',\n PAYPAL: 'PAYPAL',\n STRIPE: 'STRIPE',\n CHECK: 'CHECK',\n APPLE_PAY: 'APPLE_PAY',\n} as const;\n\nexport type PaymentMethodEnum = (typeof PaymentMethodEnum)[keyof typeof PaymentMethodEnum];\nexport const PAYMENT_METHOD_VALUES = Object.values(PaymentMethodEnum);\n\nexport const paymentMethodColorMap: Record<PaymentMethodEnum, string> = {\n [PaymentMethodEnum.CREDIT_CARD]: 'blue',\n [PaymentMethodEnum.PAYPAL]: 'geekblue',\n [PaymentMethodEnum.STRIPE]: 'purple',\n [PaymentMethodEnum.CHECK]: 'orange',\n [PaymentMethodEnum.APPLE_PAY]: 'black',\n};\n\nexport const TransactionTypeEnum = {\n ORDER: \"ORDER\",\n REFUND: \"REFUND\",\n} as const;\n\nexport type TransactionTypeEnum = (typeof TransactionTypeEnum)[keyof typeof TransactionTypeEnum];\n\nexport const TRANSACTION_TYPE_VALUES = Object.values(TransactionTypeEnum);\n\nexport const typeColorMap: Record<TransactionTypeEnum, string> = {\n [TransactionTypeEnum.ORDER]: \"blue\",\n [TransactionTypeEnum.REFUND]: \"purple\",\n};\n\nexport interface ITransactionBase extends BaseEntity {\n order: IOrder;\n currency: ICurrency;\n transactionId: string;\n amount: number;\n status: PaymentStatusEnum;\n paymentMethod: PaymentMethodEnum;\n gatewayId?: string;\n metaData?: Metadata;\n comment?: string;\n isPaymentLink?: boolean;\n refundedAmount?: number;\n proofFileId?: string;\n}\n\nexport interface IOrderTransaction extends ITransactionBase {\n type: typeof TransactionTypeEnum.ORDER;\n}\n\nexport interface IRefundTransaction extends ITransactionBase {\n type: typeof TransactionTypeEnum.REFUND;\n originalTransaction?: ITransactionBase;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACYO,IAAM,cAAgC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;;;AClBO,IAAM,mBAAmB;AAAA,EAC5B,YAAY;AAAA,EACZ,OAAO;AACX;;;ACGO,IAAM,kBAAkB;AAAA,EAC3B,SAAS;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A,EAChC,CAAC,kBAAkB,MAAM,GAAG;AAAA,EAC5B,CAAC,kBAAkB,SAAS,GAAG;AAAA,EAC/B,CAAC,kBAAkB,eAAe,GAAG;AAAA,EACrC,CAAC,kBAAkB,SAAS,GAAG;AAAA,EAC/B,CAAC,kBAAkB,MAAM,GAAG;AAAA,EAC5B,CAAC,kBAAkB,qBAAqB,GAAG;AAAA,EAC3C,CAAC,kBAAkB,OAAO,GAAG;AAAA,EAC7B,CAAC,kBAAkB,QAAQ,GAAG;AAAA,EAC9B,CAAC,kBAAkB,kBAAkB,GAAG;AAC5C;AAEO,IAAM,oBAAoB;AAAA,EAC7B,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,WAAW;AACf;AAGO,IAAM,wBAAwB,OAAO,OAAO,iBAAiB;AAE7D,IAAM,wBAA2D;AAAA,EACpE,CAAC,kBAAkB,WAAW,GAAG;AAAA,EACjC,CAAC,kBAAkB,MAAM,GAAG;AAAA,EAC5B,CAAC,kBAAkB,MAAM,GAAG;AAAA,EAC5B,CAAC,kBAAkB,KAAK,GAAG;AAAA,EAC3B,CAAC,kBAAkB,SAAS,GAAG;AACnC;AAEO,IAAM,sBAAsB;AAAA,EAC/B,OAAO;AAAA,EACP,QAAQ;AACZ;AAIO,IAAM,0BAA0B,OAAO,OAAO,mBAAmB;AAEjE,IAAM,eAAoD;AAAA,EAC7D,CAAC,oBAAoB,KAAK,GAAG;AAAA,EAC7B,CAAC,oBAAoB,MAAM,GAAG;AAClC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/admin/interface.ts","../src/coupon/interface.ts","../src/inventory/interface.ts","../src/path/index.ts","../src/order/interface.ts","../src/transaction/interface.ts"],"sourcesContent":["export * from './address';\nexport * from './admin';\nexport * from './base';\nexport * from './common';\nexport * from './country';\nexport * from './customer';\nexport * from './state';\nexport * from './store';\nexport * from './currency';\nexport * from './contact';\nexport * from './coupon';\nexport * from './product';\nexport * from './productVariantOptions';\nexport * from './productTechnicalSpec';\nexport * from './addonConfig';\nexport * from './relationGroup';\nexport * from './inventory';\nexport * from './redirect';\nexport * from './path';\nexport * from './variant';\nexport * from './productVariant';\nexport * from './order';\nexport * from './orderItem';\nexport * from './cart';\nexport * from './cartItem';\nexport * from './category';\nexport * from './brand';\nexport * from './stock';\nexport * from './transaction';\n","import type { BaseEntity } from '../base/interface';\n\nexport type IAdminRoleType =\n | 'Admin'\n | 'Super Admin'\n | 'Cashier'\n | 'Manager'\n | 'CEO'\n | 'Driver'\n | 'Security Guard'\n | 'Accountant';\n\nexport const ADMIN_ROLES: IAdminRoleType[] = [\n 'Admin',\n 'Super Admin',\n 'Cashier',\n 'Manager',\n 'CEO',\n 'Driver',\n 'Security Guard',\n 'Accountant',\n];\n\nexport interface IAdmin extends BaseEntity {\n firstName: string;\n lastName: string;\n email: string;\n phoneNumber: string;\n status: boolean;\n password: string;\n role: IAdminRoleType;\n access_list: string[];\n joiningDate: Date;\n profileImage: string;\n lastLogin: Date;\n}\n\nexport type IAdminCreate = Omit<IAdmin, keyof BaseEntity>;\nexport type IAdminUpdate = Partial<IAdminCreate>;\nexport type IAdminSafe = Omit<IAdmin, 'password'>;\n","import type { BaseEntity } from \"../base\";\nimport type { IStore } from \"../store\";\n\nexport const DiscountTypeEnum = {\n PERCENTAGE: \"PERCENTAGE\",\n FIXED: \"FIXED\",\n} as const;\n\nexport type DiscountTypeEnum = (typeof DiscountTypeEnum)[keyof typeof DiscountTypeEnum];\n\nexport interface IDiscountType {\n type: DiscountTypeEnum;\n value: number;\n}\n\nexport interface ICoupon extends BaseEntity {\n title: string;\n couponCode: string;\n startTime: Date;\n endTime: Date;\n discountType: IDiscountType;\n minimumAmount: number;\n isPromotional: boolean;\n status: boolean;\n stores: IStore[];\n}\n","/** Out-of-stock selling policy for a product/variant. */\nexport const InventoryPolicyEnum = {\n /** Hard-stop at available stock (no oversell). */\n DENY: \"deny\",\n /** Allow backorder / oversell past available stock. */\n CONTINUE: \"continue\",\n} as const;\n\nexport type InventoryPolicy = (typeof InventoryPolicyEnum)[keyof typeof InventoryPolicyEnum];\n\nexport const INVENTORY_POLICY_VALUES: InventoryPolicy[] = Object.values(InventoryPolicyEnum);\n","/**\n * Normalizes a URL or path into a canonical, lookup-stable path so old-site URLs\n * match reliably regardless of how they were entered (full URL, casing, trailing\n * slash, query/hash, encoding). Shared by the backend (storing `fromPath`) and\n * the storefront proxy (matching incoming paths) so the two can never drift.\n *\n * Examples:\n * \"https://old.com/Shop/Item/?x=1#a\" -> \"/shop/item\"\n * \"Foo//Bar/\" -> \"/foo/bar\"\n * \"\" -> \"/\"\n */\nexport const normalizePath = (input: string): string => {\n if (!input || typeof input !== \"string\") return \"/\";\n\n let path = input.trim();\n\n // Strip protocol + host if a full URL was pasted.\n if (/^https?:\\/\\//i.test(path)) {\n try {\n path = new URL(path).pathname;\n } catch {\n // fall through with the raw value\n }\n }\n\n // Drop query string and hash fragment.\n path = path.split(\"?\")[0].split(\"#\")[0];\n\n // Decode percent-encoding (best effort).\n try {\n path = decodeURIComponent(path);\n } catch {\n // keep as-is if malformed\n }\n\n // Ensure a single leading slash, collapse repeats, lowercase.\n if (!path.startsWith(\"/\")) path = `/${path}`;\n path = path.replace(/\\/{2,}/g, \"/\").toLowerCase();\n\n // Strip trailing slash except for the root.\n if (path.length > 1) path = path.replace(/\\/+$/, \"\");\n\n return path || \"/\";\n};\n","import type { BaseEntity } from \"../base\";\nimport type { ISummaryPricing, Metadata } from \"../common\";\nimport type { ICoupon } from \"../coupon\";\nimport type { ICustomer } from \"../customer\";\nimport type { IOrderItem } from \"../orderItem\";\nimport type { IStore } from \"../store\";\nimport type { IOrderTransaction, IRefundTransaction } from \"../transaction\";\nimport type { PaymentMethodEnum, PaymentStatusEnum } from \"../transaction\";\n\nexport const OrderStatusEnum = {\n CREATED: \"CREATED\",\n RECEIVED: \"RECEIVED\",\n PENDING: \"PENDING\",\n CONFIRMED: \"CONFIRMED\",\n PROCESSING: \"PROCESSING\",\n SHIPPED: \"SHIPPED\",\n DELIVERED: \"DELIVERED\",\n CANCELED: \"CANCELED\",\n FAILED: \"FAILED\",\n REFUNDED: \"REFUNDED\",\n PARTIALLY_REFUNDED: \"PARTIALLY_REFUNDED\",\n ARCHIVED: \"ARCHIVED\",\n RETURNED: \"RETURNED\",\n} as const;\n\nexport type OrderStatusEnum = (typeof OrderStatusEnum)[keyof typeof OrderStatusEnum];\nexport const ORDER_STATUS_VALUES = Object.values(OrderStatusEnum);\n\nexport const statusColors: Record<OrderStatusEnum, string> = {\n [OrderStatusEnum.CREATED]: \"default\",\n [OrderStatusEnum.RECEIVED]: \"cyan\",\n [OrderStatusEnum.PENDING]: \"gold\",\n [OrderStatusEnum.CONFIRMED]: \"blue\",\n [OrderStatusEnum.PROCESSING]: \"cyan\",\n [OrderStatusEnum.SHIPPED]: \"purple\",\n [OrderStatusEnum.DELIVERED]: \"green\",\n [OrderStatusEnum.CANCELED]: \"volcano\",\n [OrderStatusEnum.FAILED]: \"red\",\n [OrderStatusEnum.REFUNDED]: \"orange\",\n [OrderStatusEnum.PARTIALLY_REFUNDED]: \"magenta\",\n [OrderStatusEnum.ARCHIVED]: \"gray\",\n [OrderStatusEnum.RETURNED]: \"purple\",\n};\n\nexport interface IOrder extends BaseEntity {\n orderId: string;\n orderItems: IOrderItem[];\n customer: ICustomer;\n coupon: ICoupon;\n store: IStore;\n status: OrderStatusEnum;\n paymentStatus: PaymentStatusEnum;\n paymentMethod: PaymentMethodEnum;\n metaData: Metadata;\n orderTransactions: IOrderTransaction[];\n refundTransactions: IRefundTransaction[];\n pricing: ISummaryPricing;\n}\n","import type { BaseEntity } from \"../base\";\nimport type { Metadata } from \"../common\";\nimport type { IOrder } from \"../order\";\nimport type { ICurrency } from \"../currency\";\n\nexport const PaymentStatusEnum = {\n INITIATED: 'INITIATED',\n PENDING: 'PENDING',\n PROCESSING: 'PROCESSING',\n FAILED: 'FAILED',\n CANCELLED: 'CANCELLED',\n PENDING_CAPTURE: 'PENDING_CAPTURE',\n COMPLETED: 'COMPLETED',\n VOIDED: 'VOIDED',\n REDIRECTED_TO_GATEWAY: 'REDIRECTED_TO_GATEWAY',\n UNKNOWN: 'UNKNOWN',\n REFUNDED: 'REFUNDED',\n PARTIALLY_REFUNDED: 'PARTIALLY_REFUNDED',\n} as const;\n\nexport type PaymentStatusEnum = (typeof PaymentStatusEnum)[keyof typeof PaymentStatusEnum];\nexport const PAYMENT_STATUS_VALUES = Object.values(PaymentStatusEnum);\n\nexport const paymentStatusColorMap: Record<PaymentStatusEnum, string> = {\n [PaymentStatusEnum.INITIATED]: 'default',\n [PaymentStatusEnum.PENDING]: 'gold',\n [PaymentStatusEnum.PROCESSING]: 'cyan',\n [PaymentStatusEnum.FAILED]: 'red',\n [PaymentStatusEnum.CANCELLED]: 'volcano',\n [PaymentStatusEnum.PENDING_CAPTURE]: 'blue',\n [PaymentStatusEnum.COMPLETED]: 'green',\n [PaymentStatusEnum.VOIDED]: 'magenta',\n [PaymentStatusEnum.REDIRECTED_TO_GATEWAY]: 'purple',\n [PaymentStatusEnum.UNKNOWN]: 'gray',\n [PaymentStatusEnum.REFUNDED]: 'orange',\n [PaymentStatusEnum.PARTIALLY_REFUNDED]: 'magenta',\n};\n\nexport const PaymentMethodEnum = {\n CREDIT_CARD: 'CREDIT_CARD',\n PAYPAL: 'PAYPAL',\n STRIPE: 'STRIPE',\n CHECK: 'CHECK',\n APPLE_PAY: 'APPLE_PAY',\n} as const;\n\nexport type PaymentMethodEnum = (typeof PaymentMethodEnum)[keyof typeof PaymentMethodEnum];\nexport const PAYMENT_METHOD_VALUES = Object.values(PaymentMethodEnum);\n\nexport const paymentMethodColorMap: Record<PaymentMethodEnum, string> = {\n [PaymentMethodEnum.CREDIT_CARD]: 'blue',\n [PaymentMethodEnum.PAYPAL]: 'geekblue',\n [PaymentMethodEnum.STRIPE]: 'purple',\n [PaymentMethodEnum.CHECK]: 'orange',\n [PaymentMethodEnum.APPLE_PAY]: 'black',\n};\n\nexport const TransactionTypeEnum = {\n ORDER: \"ORDER\",\n REFUND: \"REFUND\",\n} as const;\n\nexport type TransactionTypeEnum = (typeof TransactionTypeEnum)[keyof typeof TransactionTypeEnum];\n\nexport const TRANSACTION_TYPE_VALUES = Object.values(TransactionTypeEnum);\n\nexport const typeColorMap: Record<TransactionTypeEnum, string> = {\n [TransactionTypeEnum.ORDER]: \"blue\",\n [TransactionTypeEnum.REFUND]: \"purple\",\n};\n\nexport interface ITransactionBase extends BaseEntity {\n order: IOrder;\n currency: ICurrency;\n transactionId: string;\n amount: number;\n status: PaymentStatusEnum;\n paymentMethod: PaymentMethodEnum;\n gatewayId?: string;\n metaData?: Metadata;\n comment?: string;\n isPaymentLink?: boolean;\n refundedAmount?: number;\n proofFileId?: string;\n}\n\nexport interface IOrderTransaction extends ITransactionBase {\n type: typeof TransactionTypeEnum.ORDER;\n}\n\nexport interface IRefundTransaction extends ITransactionBase {\n type: typeof TransactionTypeEnum.REFUND;\n originalTransaction?: ITransactionBase;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACYO,IAAM,cAAgC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;;;AClBO,IAAM,mBAAmB;AAAA,EAC5B,YAAY;AAAA,EACZ,OAAO;AACX;;;ACLO,IAAM,sBAAsB;AAAA;AAAA,EAE/B,MAAM;AAAA;AAAA,EAEN,UAAU;AACd;AAIO,IAAM,0BAA6C,OAAO,OAAO,mBAAmB;;;ACCpF,IAAM,gBAAgB,CAAC,UAA0B;AACpD,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU,QAAO;AAEhD,MAAI,OAAO,MAAM,KAAK;AAGtB,MAAI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,GAAG;AACnC;AAEO,IAAM,sBAAsB;AAAA,EAC/B,OAAO;AAAA,EACP,QAAQ;AACZ;AAIO,IAAM,0BAA0B,OAAO,OAAO,mBAAmB;AAEjE,IAAM,eAAoD;AAAA,EAC7D,CAAC,oBAAoB,KAAK,GAAG;AAAA,EAC7B,CAAC,oBAAoB,MAAM,GAAG;AAClC;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -16,6 +16,36 @@ var DiscountTypeEnum = {
|
|
|
16
16
|
FIXED: "FIXED"
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
+
// src/inventory/interface.ts
|
|
20
|
+
var InventoryPolicyEnum = {
|
|
21
|
+
/** Hard-stop at available stock (no oversell). */
|
|
22
|
+
DENY: "deny",
|
|
23
|
+
/** Allow backorder / oversell past available stock. */
|
|
24
|
+
CONTINUE: "continue"
|
|
25
|
+
};
|
|
26
|
+
var INVENTORY_POLICY_VALUES = Object.values(InventoryPolicyEnum);
|
|
27
|
+
|
|
28
|
+
// src/path/index.ts
|
|
29
|
+
var normalizePath = (input) => {
|
|
30
|
+
if (!input || typeof input !== "string") return "/";
|
|
31
|
+
let path = input.trim();
|
|
32
|
+
if (/^https?:\/\//i.test(path)) {
|
|
33
|
+
try {
|
|
34
|
+
path = new URL(path).pathname;
|
|
35
|
+
} catch {
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
path = path.split("?")[0].split("#")[0];
|
|
39
|
+
try {
|
|
40
|
+
path = decodeURIComponent(path);
|
|
41
|
+
} catch {
|
|
42
|
+
}
|
|
43
|
+
if (!path.startsWith("/")) path = `/${path}`;
|
|
44
|
+
path = path.replace(/\/{2,}/g, "/").toLowerCase();
|
|
45
|
+
if (path.length > 1) path = path.replace(/\/+$/, "");
|
|
46
|
+
return path || "/";
|
|
47
|
+
};
|
|
48
|
+
|
|
19
49
|
// src/order/interface.ts
|
|
20
50
|
var OrderStatusEnum = {
|
|
21
51
|
CREATED: "CREATED",
|
|
@@ -106,6 +136,8 @@ var typeColorMap = {
|
|
|
106
136
|
export {
|
|
107
137
|
ADMIN_ROLES,
|
|
108
138
|
DiscountTypeEnum,
|
|
139
|
+
INVENTORY_POLICY_VALUES,
|
|
140
|
+
InventoryPolicyEnum,
|
|
109
141
|
ORDER_STATUS_VALUES,
|
|
110
142
|
OrderStatusEnum,
|
|
111
143
|
PAYMENT_METHOD_VALUES,
|
|
@@ -114,6 +146,7 @@ export {
|
|
|
114
146
|
PaymentStatusEnum,
|
|
115
147
|
TRANSACTION_TYPE_VALUES,
|
|
116
148
|
TransactionTypeEnum,
|
|
149
|
+
normalizePath,
|
|
117
150
|
paymentMethodColorMap,
|
|
118
151
|
paymentStatusColorMap,
|
|
119
152
|
statusColors,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/admin/interface.ts","../src/coupon/interface.ts","../src/order/interface.ts","../src/transaction/interface.ts"],"sourcesContent":["import type { BaseEntity } from '../base/interface';\n\nexport type IAdminRoleType =\n | 'Admin'\n | 'Super Admin'\n | 'Cashier'\n | 'Manager'\n | 'CEO'\n | 'Driver'\n | 'Security Guard'\n | 'Accountant';\n\nexport const ADMIN_ROLES: IAdminRoleType[] = [\n 'Admin',\n 'Super Admin',\n 'Cashier',\n 'Manager',\n 'CEO',\n 'Driver',\n 'Security Guard',\n 'Accountant',\n];\n\nexport interface IAdmin extends BaseEntity {\n firstName: string;\n lastName: string;\n email: string;\n phoneNumber: string;\n status: boolean;\n password: string;\n role: IAdminRoleType;\n access_list: string[];\n joiningDate: Date;\n profileImage: string;\n lastLogin: Date;\n}\n\nexport type IAdminCreate = Omit<IAdmin, keyof BaseEntity>;\nexport type IAdminUpdate = Partial<IAdminCreate>;\nexport type IAdminSafe = Omit<IAdmin, 'password'>;\n","import type { BaseEntity } from \"../base\";\nimport type { IStore } from \"../store\";\n\nexport const DiscountTypeEnum = {\n PERCENTAGE: \"PERCENTAGE\",\n FIXED: \"FIXED\",\n} as const;\n\nexport type DiscountTypeEnum = (typeof DiscountTypeEnum)[keyof typeof DiscountTypeEnum];\n\nexport interface IDiscountType {\n type: DiscountTypeEnum;\n value: number;\n}\n\nexport interface ICoupon extends BaseEntity {\n title: string;\n couponCode: string;\n startTime: Date;\n endTime: Date;\n discountType: IDiscountType;\n minimumAmount: number;\n isPromotional: boolean;\n status: boolean;\n stores: IStore[];\n}\n","import type { BaseEntity } from \"../base\";\nimport type { ISummaryPricing, Metadata } from \"../common\";\nimport type { ICoupon } from \"../coupon\";\nimport type { ICustomer } from \"../customer\";\nimport type { IOrderItem } from \"../orderItem\";\nimport type { IStore } from \"../store\";\nimport type { IOrderTransaction, IRefundTransaction } from \"../transaction\";\nimport type { PaymentMethodEnum, PaymentStatusEnum } from \"../transaction\";\n\nexport const OrderStatusEnum = {\n CREATED: \"CREATED\",\n RECEIVED: \"RECEIVED\",\n PENDING: \"PENDING\",\n CONFIRMED: \"CONFIRMED\",\n PROCESSING: \"PROCESSING\",\n SHIPPED: \"SHIPPED\",\n DELIVERED: \"DELIVERED\",\n CANCELED: \"CANCELED\",\n FAILED: \"FAILED\",\n REFUNDED: \"REFUNDED\",\n PARTIALLY_REFUNDED: \"PARTIALLY_REFUNDED\",\n ARCHIVED: \"ARCHIVED\",\n RETURNED: \"RETURNED\",\n} as const;\n\nexport type OrderStatusEnum = (typeof OrderStatusEnum)[keyof typeof OrderStatusEnum];\nexport const ORDER_STATUS_VALUES = Object.values(OrderStatusEnum);\n\nexport const statusColors: Record<OrderStatusEnum, string> = {\n [OrderStatusEnum.CREATED]: \"default\",\n [OrderStatusEnum.RECEIVED]: \"cyan\",\n [OrderStatusEnum.PENDING]: \"gold\",\n [OrderStatusEnum.CONFIRMED]: \"blue\",\n [OrderStatusEnum.PROCESSING]: \"cyan\",\n [OrderStatusEnum.SHIPPED]: \"purple\",\n [OrderStatusEnum.DELIVERED]: \"green\",\n [OrderStatusEnum.CANCELED]: \"volcano\",\n [OrderStatusEnum.FAILED]: \"red\",\n [OrderStatusEnum.REFUNDED]: \"orange\",\n [OrderStatusEnum.PARTIALLY_REFUNDED]: \"magenta\",\n [OrderStatusEnum.ARCHIVED]: \"gray\",\n [OrderStatusEnum.RETURNED]: \"purple\",\n};\n\nexport interface IOrder extends BaseEntity {\n orderId: string;\n orderItems: IOrderItem[];\n customer: ICustomer;\n coupon: ICoupon;\n store: IStore;\n status: OrderStatusEnum;\n paymentStatus: PaymentStatusEnum;\n paymentMethod: PaymentMethodEnum;\n metaData: Metadata;\n orderTransactions: IOrderTransaction[];\n refundTransactions: IRefundTransaction[];\n pricing: ISummaryPricing;\n}\n","import type { BaseEntity } from \"../base\";\nimport type { Metadata } from \"../common\";\nimport type { IOrder } from \"../order\";\nimport type { ICurrency } from \"../currency\";\n\nexport const PaymentStatusEnum = {\n INITIATED: 'INITIATED',\n PENDING: 'PENDING',\n PROCESSING: 'PROCESSING',\n FAILED: 'FAILED',\n CANCELLED: 'CANCELLED',\n PENDING_CAPTURE: 'PENDING_CAPTURE',\n COMPLETED: 'COMPLETED',\n VOIDED: 'VOIDED',\n REDIRECTED_TO_GATEWAY: 'REDIRECTED_TO_GATEWAY',\n UNKNOWN: 'UNKNOWN',\n REFUNDED: 'REFUNDED',\n PARTIALLY_REFUNDED: 'PARTIALLY_REFUNDED',\n} as const;\n\nexport type PaymentStatusEnum = (typeof PaymentStatusEnum)[keyof typeof PaymentStatusEnum];\nexport const PAYMENT_STATUS_VALUES = Object.values(PaymentStatusEnum);\n\nexport const paymentStatusColorMap: Record<PaymentStatusEnum, string> = {\n [PaymentStatusEnum.INITIATED]: 'default',\n [PaymentStatusEnum.PENDING]: 'gold',\n [PaymentStatusEnum.PROCESSING]: 'cyan',\n [PaymentStatusEnum.FAILED]: 'red',\n [PaymentStatusEnum.CANCELLED]: 'volcano',\n [PaymentStatusEnum.PENDING_CAPTURE]: 'blue',\n [PaymentStatusEnum.COMPLETED]: 'green',\n [PaymentStatusEnum.VOIDED]: 'magenta',\n [PaymentStatusEnum.REDIRECTED_TO_GATEWAY]: 'purple',\n [PaymentStatusEnum.UNKNOWN]: 'gray',\n [PaymentStatusEnum.REFUNDED]: 'orange',\n [PaymentStatusEnum.PARTIALLY_REFUNDED]: 'magenta',\n};\n\nexport const PaymentMethodEnum = {\n CREDIT_CARD: 'CREDIT_CARD',\n PAYPAL: 'PAYPAL',\n STRIPE: 'STRIPE',\n CHECK: 'CHECK',\n APPLE_PAY: 'APPLE_PAY',\n} as const;\n\nexport type PaymentMethodEnum = (typeof PaymentMethodEnum)[keyof typeof PaymentMethodEnum];\nexport const PAYMENT_METHOD_VALUES = Object.values(PaymentMethodEnum);\n\nexport const paymentMethodColorMap: Record<PaymentMethodEnum, string> = {\n [PaymentMethodEnum.CREDIT_CARD]: 'blue',\n [PaymentMethodEnum.PAYPAL]: 'geekblue',\n [PaymentMethodEnum.STRIPE]: 'purple',\n [PaymentMethodEnum.CHECK]: 'orange',\n [PaymentMethodEnum.APPLE_PAY]: 'black',\n};\n\nexport const TransactionTypeEnum = {\n ORDER: \"ORDER\",\n REFUND: \"REFUND\",\n} as const;\n\nexport type TransactionTypeEnum = (typeof TransactionTypeEnum)[keyof typeof TransactionTypeEnum];\n\nexport const TRANSACTION_TYPE_VALUES = Object.values(TransactionTypeEnum);\n\nexport const typeColorMap: Record<TransactionTypeEnum, string> = {\n [TransactionTypeEnum.ORDER]: \"blue\",\n [TransactionTypeEnum.REFUND]: \"purple\",\n};\n\nexport interface ITransactionBase extends BaseEntity {\n order: IOrder;\n currency: ICurrency;\n transactionId: string;\n amount: number;\n status: PaymentStatusEnum;\n paymentMethod: PaymentMethodEnum;\n gatewayId?: string;\n metaData?: Metadata;\n comment?: string;\n isPaymentLink?: boolean;\n refundedAmount?: number;\n proofFileId?: string;\n}\n\nexport interface IOrderTransaction extends ITransactionBase {\n type: typeof TransactionTypeEnum.ORDER;\n}\n\nexport interface IRefundTransaction extends ITransactionBase {\n type: typeof TransactionTypeEnum.REFUND;\n originalTransaction?: ITransactionBase;\n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ts","../src/coupon/interface.ts","../src/inventory/interface.ts","../src/path/index.ts","../src/order/interface.ts","../src/transaction/interface.ts"],"sourcesContent":["import type { BaseEntity } from '../base/interface';\n\nexport type IAdminRoleType =\n | 'Admin'\n | 'Super Admin'\n | 'Cashier'\n | 'Manager'\n | 'CEO'\n | 'Driver'\n | 'Security Guard'\n | 'Accountant';\n\nexport const ADMIN_ROLES: IAdminRoleType[] = [\n 'Admin',\n 'Super Admin',\n 'Cashier',\n 'Manager',\n 'CEO',\n 'Driver',\n 'Security Guard',\n 'Accountant',\n];\n\nexport interface IAdmin extends BaseEntity {\n firstName: string;\n lastName: string;\n email: string;\n phoneNumber: string;\n status: boolean;\n password: string;\n role: IAdminRoleType;\n access_list: string[];\n joiningDate: Date;\n profileImage: string;\n lastLogin: Date;\n}\n\nexport type IAdminCreate = Omit<IAdmin, keyof BaseEntity>;\nexport type IAdminUpdate = Partial<IAdminCreate>;\nexport type IAdminSafe = Omit<IAdmin, 'password'>;\n","import type { BaseEntity } from \"../base\";\nimport type { IStore } from \"../store\";\n\nexport const DiscountTypeEnum = {\n PERCENTAGE: \"PERCENTAGE\",\n FIXED: \"FIXED\",\n} as const;\n\nexport type DiscountTypeEnum = (typeof DiscountTypeEnum)[keyof typeof DiscountTypeEnum];\n\nexport interface IDiscountType {\n type: DiscountTypeEnum;\n value: number;\n}\n\nexport interface ICoupon extends BaseEntity {\n title: string;\n couponCode: string;\n startTime: Date;\n endTime: Date;\n discountType: IDiscountType;\n minimumAmount: number;\n isPromotional: boolean;\n status: boolean;\n stores: IStore[];\n}\n","/** Out-of-stock selling policy for a product/variant. */\nexport const InventoryPolicyEnum = {\n /** Hard-stop at available stock (no oversell). */\n DENY: \"deny\",\n /** Allow backorder / oversell past available stock. */\n CONTINUE: \"continue\",\n} as const;\n\nexport type InventoryPolicy = (typeof InventoryPolicyEnum)[keyof typeof InventoryPolicyEnum];\n\nexport const INVENTORY_POLICY_VALUES: InventoryPolicy[] = Object.values(InventoryPolicyEnum);\n","/**\n * Normalizes a URL or path into a canonical, lookup-stable path so old-site URLs\n * match reliably regardless of how they were entered (full URL, casing, trailing\n * slash, query/hash, encoding). Shared by the backend (storing `fromPath`) and\n * the storefront proxy (matching incoming paths) so the two can never drift.\n *\n * Examples:\n * \"https://old.com/Shop/Item/?x=1#a\" -> \"/shop/item\"\n * \"Foo//Bar/\" -> \"/foo/bar\"\n * \"\" -> \"/\"\n */\nexport const normalizePath = (input: string): string => {\n if (!input || typeof input !== \"string\") return \"/\";\n\n let path = input.trim();\n\n // Strip protocol + host if a full URL was pasted.\n if (/^https?:\\/\\//i.test(path)) {\n try {\n path = new URL(path).pathname;\n } catch {\n // fall through with the raw value\n }\n }\n\n // Drop query string and hash fragment.\n path = path.split(\"?\")[0].split(\"#\")[0];\n\n // Decode percent-encoding (best effort).\n try {\n path = decodeURIComponent(path);\n } catch {\n // keep as-is if malformed\n }\n\n // Ensure a single leading slash, collapse repeats, lowercase.\n if (!path.startsWith(\"/\")) path = `/${path}`;\n path = path.replace(/\\/{2,}/g, \"/\").toLowerCase();\n\n // Strip trailing slash except for the root.\n if (path.length > 1) path = path.replace(/\\/+$/, \"\");\n\n return path || \"/\";\n};\n","import type { BaseEntity } from \"../base\";\nimport type { ISummaryPricing, Metadata } from \"../common\";\nimport type { ICoupon } from \"../coupon\";\nimport type { ICustomer } from \"../customer\";\nimport type { IOrderItem } from \"../orderItem\";\nimport type { IStore } from \"../store\";\nimport type { IOrderTransaction, IRefundTransaction } from \"../transaction\";\nimport type { PaymentMethodEnum, PaymentStatusEnum } from \"../transaction\";\n\nexport const OrderStatusEnum = {\n CREATED: \"CREATED\",\n RECEIVED: \"RECEIVED\",\n PENDING: \"PENDING\",\n CONFIRMED: \"CONFIRMED\",\n PROCESSING: \"PROCESSING\",\n SHIPPED: \"SHIPPED\",\n DELIVERED: \"DELIVERED\",\n CANCELED: \"CANCELED\",\n FAILED: \"FAILED\",\n REFUNDED: \"REFUNDED\",\n PARTIALLY_REFUNDED: \"PARTIALLY_REFUNDED\",\n ARCHIVED: \"ARCHIVED\",\n RETURNED: \"RETURNED\",\n} as const;\n\nexport type OrderStatusEnum = (typeof OrderStatusEnum)[keyof typeof OrderStatusEnum];\nexport const ORDER_STATUS_VALUES = Object.values(OrderStatusEnum);\n\nexport const statusColors: Record<OrderStatusEnum, string> = {\n [OrderStatusEnum.CREATED]: \"default\",\n [OrderStatusEnum.RECEIVED]: \"cyan\",\n [OrderStatusEnum.PENDING]: \"gold\",\n [OrderStatusEnum.CONFIRMED]: \"blue\",\n [OrderStatusEnum.PROCESSING]: \"cyan\",\n [OrderStatusEnum.SHIPPED]: \"purple\",\n [OrderStatusEnum.DELIVERED]: \"green\",\n [OrderStatusEnum.CANCELED]: \"volcano\",\n [OrderStatusEnum.FAILED]: \"red\",\n [OrderStatusEnum.REFUNDED]: \"orange\",\n [OrderStatusEnum.PARTIALLY_REFUNDED]: \"magenta\",\n [OrderStatusEnum.ARCHIVED]: \"gray\",\n [OrderStatusEnum.RETURNED]: \"purple\",\n};\n\nexport interface IOrder extends BaseEntity {\n orderId: string;\n orderItems: IOrderItem[];\n customer: ICustomer;\n coupon: ICoupon;\n store: IStore;\n status: OrderStatusEnum;\n paymentStatus: PaymentStatusEnum;\n paymentMethod: PaymentMethodEnum;\n metaData: Metadata;\n orderTransactions: IOrderTransaction[];\n refundTransactions: IRefundTransaction[];\n pricing: ISummaryPricing;\n}\n","import type { BaseEntity } from \"../base\";\nimport type { Metadata } from \"../common\";\nimport type { IOrder } from \"../order\";\nimport type { ICurrency } from \"../currency\";\n\nexport const PaymentStatusEnum = {\n INITIATED: 'INITIATED',\n PENDING: 'PENDING',\n PROCESSING: 'PROCESSING',\n FAILED: 'FAILED',\n CANCELLED: 'CANCELLED',\n PENDING_CAPTURE: 'PENDING_CAPTURE',\n COMPLETED: 'COMPLETED',\n VOIDED: 'VOIDED',\n REDIRECTED_TO_GATEWAY: 'REDIRECTED_TO_GATEWAY',\n UNKNOWN: 'UNKNOWN',\n REFUNDED: 'REFUNDED',\n PARTIALLY_REFUNDED: 'PARTIALLY_REFUNDED',\n} as const;\n\nexport type PaymentStatusEnum = (typeof PaymentStatusEnum)[keyof typeof PaymentStatusEnum];\nexport const PAYMENT_STATUS_VALUES = Object.values(PaymentStatusEnum);\n\nexport const paymentStatusColorMap: Record<PaymentStatusEnum, string> = {\n [PaymentStatusEnum.INITIATED]: 'default',\n [PaymentStatusEnum.PENDING]: 'gold',\n [PaymentStatusEnum.PROCESSING]: 'cyan',\n [PaymentStatusEnum.FAILED]: 'red',\n [PaymentStatusEnum.CANCELLED]: 'volcano',\n [PaymentStatusEnum.PENDING_CAPTURE]: 'blue',\n [PaymentStatusEnum.COMPLETED]: 'green',\n [PaymentStatusEnum.VOIDED]: 'magenta',\n [PaymentStatusEnum.REDIRECTED_TO_GATEWAY]: 'purple',\n [PaymentStatusEnum.UNKNOWN]: 'gray',\n [PaymentStatusEnum.REFUNDED]: 'orange',\n [PaymentStatusEnum.PARTIALLY_REFUNDED]: 'magenta',\n};\n\nexport const PaymentMethodEnum = {\n CREDIT_CARD: 'CREDIT_CARD',\n PAYPAL: 'PAYPAL',\n STRIPE: 'STRIPE',\n CHECK: 'CHECK',\n APPLE_PAY: 'APPLE_PAY',\n} as const;\n\nexport type PaymentMethodEnum = (typeof PaymentMethodEnum)[keyof typeof PaymentMethodEnum];\nexport const PAYMENT_METHOD_VALUES = Object.values(PaymentMethodEnum);\n\nexport const paymentMethodColorMap: Record<PaymentMethodEnum, string> = {\n [PaymentMethodEnum.CREDIT_CARD]: 'blue',\n [PaymentMethodEnum.PAYPAL]: 'geekblue',\n [PaymentMethodEnum.STRIPE]: 'purple',\n [PaymentMethodEnum.CHECK]: 'orange',\n [PaymentMethodEnum.APPLE_PAY]: 'black',\n};\n\nexport const TransactionTypeEnum = {\n ORDER: \"ORDER\",\n REFUND: \"REFUND\",\n} as const;\n\nexport type TransactionTypeEnum = (typeof TransactionTypeEnum)[keyof typeof TransactionTypeEnum];\n\nexport const TRANSACTION_TYPE_VALUES = Object.values(TransactionTypeEnum);\n\nexport const typeColorMap: Record<TransactionTypeEnum, string> = {\n [TransactionTypeEnum.ORDER]: \"blue\",\n [TransactionTypeEnum.REFUND]: \"purple\",\n};\n\nexport interface ITransactionBase extends BaseEntity {\n order: IOrder;\n currency: ICurrency;\n transactionId: string;\n amount: number;\n status: PaymentStatusEnum;\n paymentMethod: PaymentMethodEnum;\n gatewayId?: string;\n metaData?: Metadata;\n comment?: string;\n isPaymentLink?: boolean;\n refundedAmount?: number;\n proofFileId?: string;\n}\n\nexport interface IOrderTransaction extends ITransactionBase {\n type: typeof TransactionTypeEnum.ORDER;\n}\n\nexport interface IRefundTransaction extends ITransactionBase {\n type: typeof TransactionTypeEnum.REFUND;\n originalTransaction?: ITransactionBase;\n}\n"],"mappings":";AAYO,IAAM,cAAgC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;;;AClBO,IAAM,mBAAmB;AAAA,EAC5B,YAAY;AAAA,EACZ,OAAO;AACX;;;ACLO,IAAM,sBAAsB;AAAA;AAAA,EAE/B,MAAM;AAAA;AAAA,EAEN,UAAU;AACd;AAIO,IAAM,0BAA6C,OAAO,OAAO,mBAAmB;;;ACCpF,IAAM,gBAAgB,CAAC,UAA0B;AACpD,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU,QAAO;AAEhD,MAAI,OAAO,MAAM,KAAK;AAGtB,MAAI,gBAAgB,KAAK,IAAI,GAAG;AAC5B,QAAI;AACA,aAAO,IAAI,IAAI,IAAI,EAAE;AAAA,IACzB,QAAQ;AAAA,IAER;AAAA,EACJ;AAGA,SAAO,KAAK,MAAM,GAAG,EAAE,CAAC,EAAE,MAAM,GAAG,EAAE,CAAC;AAGtC,MAAI;AACA,WAAO,mBAAmB,IAAI;AAAA,EAClC,QAAQ;AAAA,EAER;AAGA,MAAI,CAAC,KAAK,WAAW,GAAG,EAA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