@fas-core/shared-types 1.0.48 → 1.0.50
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 +60 -8
- package/dist/index.d.ts +60 -8
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -109,12 +109,6 @@ interface IContent {
|
|
|
109
109
|
keyFeatures: string[];
|
|
110
110
|
applications: string;
|
|
111
111
|
}
|
|
112
|
-
interface IRelationships {
|
|
113
|
-
similarProducts: string[];
|
|
114
|
-
parts: string[];
|
|
115
|
-
accessories: string[];
|
|
116
|
-
toolKits: string[];
|
|
117
|
-
}
|
|
118
112
|
|
|
119
113
|
interface ICurrency extends BaseEntity {
|
|
120
114
|
name: string;
|
|
@@ -219,7 +213,6 @@ interface IProductVariantFields {
|
|
|
219
213
|
images: IMediaAsset[];
|
|
220
214
|
videos: IMediaAsset[];
|
|
221
215
|
shipping: IShipping;
|
|
222
|
-
relationships: IRelationships;
|
|
223
216
|
metaData: Metadata;
|
|
224
217
|
seoMetaData: ISEOMetaData;
|
|
225
218
|
status: boolean;
|
|
@@ -280,6 +273,26 @@ interface IVariant extends BaseEntity, IProductVariantFields {
|
|
|
280
273
|
variantOptionMode?: VariantOptionMode;
|
|
281
274
|
}
|
|
282
275
|
|
|
276
|
+
/**
|
|
277
|
+
* A globally-defined relation group: named buckets that products assign SKUs
|
|
278
|
+
* into. `addable` distinguishes groups whose items can be added to the order
|
|
279
|
+
* (Accessories, Tool Kits, Parts) from display-only cross-sell (Similar Products).
|
|
280
|
+
*/
|
|
281
|
+
interface IRelationGroup extends BaseEntity {
|
|
282
|
+
name: string;
|
|
283
|
+
key: string;
|
|
284
|
+
description: string;
|
|
285
|
+
addable: boolean;
|
|
286
|
+
sortOrder: number;
|
|
287
|
+
isVisible: boolean;
|
|
288
|
+
status: boolean;
|
|
289
|
+
}
|
|
290
|
+
/** Per-product assignment of SKUs into a relation group (referenced by group key). */
|
|
291
|
+
interface IProductRelationGroup {
|
|
292
|
+
group: string;
|
|
293
|
+
skus: string[];
|
|
294
|
+
}
|
|
295
|
+
|
|
283
296
|
interface IProduct extends BaseEntity, IProductVariantFields {
|
|
284
297
|
name: string;
|
|
285
298
|
slug: string;
|
|
@@ -289,6 +302,7 @@ interface IProduct extends BaseEntity, IProductVariantFields {
|
|
|
289
302
|
variantOptions?: IProductVariantOptionGroup[];
|
|
290
303
|
variantOptionSignatures?: string[];
|
|
291
304
|
variants: IVariant[];
|
|
305
|
+
relationGroups: IProductRelationGroup[];
|
|
292
306
|
}
|
|
293
307
|
|
|
294
308
|
interface IOrderItem extends BaseEntity {
|
|
@@ -534,6 +548,44 @@ interface IAddonGroup extends BaseEntity {
|
|
|
534
548
|
status: boolean;
|
|
535
549
|
}
|
|
536
550
|
|
|
551
|
+
type RedirectTargetType = "product" | "variant" | "category" | "url";
|
|
552
|
+
/** An old→new URL redirect for safe site migration (many old paths → one target). */
|
|
553
|
+
interface IRedirect extends BaseEntity {
|
|
554
|
+
fromPath: string;
|
|
555
|
+
targetType: RedirectTargetType;
|
|
556
|
+
/** Catalog reference id when targetType is product/variant/category. */
|
|
557
|
+
targetRef?: string | null;
|
|
558
|
+
/** Raw destination path/URL when targetType is "url". */
|
|
559
|
+
targetUrl?: string | null;
|
|
560
|
+
statusCode: number;
|
|
561
|
+
/** Append the incoming query string to the destination. */
|
|
562
|
+
preserveQuery: boolean;
|
|
563
|
+
status: boolean;
|
|
564
|
+
hits: number;
|
|
565
|
+
lastHitAt?: Date | null;
|
|
566
|
+
}
|
|
567
|
+
/** A captured 404 (unmatched path) surfaced in admin to find missing redirects. */
|
|
568
|
+
interface IUnmatched404 extends BaseEntity {
|
|
569
|
+
path: string;
|
|
570
|
+
count: number;
|
|
571
|
+
lastSeenAt: Date;
|
|
572
|
+
referrer?: string | null;
|
|
573
|
+
resolved: boolean;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Normalizes a URL or path into a canonical, lookup-stable path so old-site URLs
|
|
578
|
+
* match reliably regardless of how they were entered (full URL, casing, trailing
|
|
579
|
+
* slash, query/hash, encoding). Shared by the backend (storing `fromPath`) and
|
|
580
|
+
* the storefront proxy (matching incoming paths) so the two can never drift.
|
|
581
|
+
*
|
|
582
|
+
* Examples:
|
|
583
|
+
* "https://old.com/Shop/Item/?x=1#a" -> "/shop/item"
|
|
584
|
+
* "Foo//Bar/" -> "/foo/bar"
|
|
585
|
+
* "" -> "/"
|
|
586
|
+
*/
|
|
587
|
+
declare const normalizePath: (input: string) => string;
|
|
588
|
+
|
|
537
589
|
interface ICartItem extends BaseEntity {
|
|
538
590
|
cart: ICart;
|
|
539
591
|
product: IProduct;
|
|
@@ -552,4 +604,4 @@ interface ICart extends BaseEntity {
|
|
|
552
604
|
pricing: ISummaryPricing;
|
|
553
605
|
}
|
|
554
606
|
|
|
555
|
-
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 IProductTechnicalSpec, type IProductTechnicalSpecTable, type IProductVariantFields, type IProductVariantOptionGroup, type IProductVariantOptionMatrix, type IProductVariantOptionValue, type IRefundTransaction, type
|
|
607
|
+
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 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 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
|
@@ -109,12 +109,6 @@ interface IContent {
|
|
|
109
109
|
keyFeatures: string[];
|
|
110
110
|
applications: string;
|
|
111
111
|
}
|
|
112
|
-
interface IRelationships {
|
|
113
|
-
similarProducts: string[];
|
|
114
|
-
parts: string[];
|
|
115
|
-
accessories: string[];
|
|
116
|
-
toolKits: string[];
|
|
117
|
-
}
|
|
118
112
|
|
|
119
113
|
interface ICurrency extends BaseEntity {
|
|
120
114
|
name: string;
|
|
@@ -219,7 +213,6 @@ interface IProductVariantFields {
|
|
|
219
213
|
images: IMediaAsset[];
|
|
220
214
|
videos: IMediaAsset[];
|
|
221
215
|
shipping: IShipping;
|
|
222
|
-
relationships: IRelationships;
|
|
223
216
|
metaData: Metadata;
|
|
224
217
|
seoMetaData: ISEOMetaData;
|
|
225
218
|
status: boolean;
|
|
@@ -280,6 +273,26 @@ interface IVariant extends BaseEntity, IProductVariantFields {
|
|
|
280
273
|
variantOptionMode?: VariantOptionMode;
|
|
281
274
|
}
|
|
282
275
|
|
|
276
|
+
/**
|
|
277
|
+
* A globally-defined relation group: named buckets that products assign SKUs
|
|
278
|
+
* into. `addable` distinguishes groups whose items can be added to the order
|
|
279
|
+
* (Accessories, Tool Kits, Parts) from display-only cross-sell (Similar Products).
|
|
280
|
+
*/
|
|
281
|
+
interface IRelationGroup extends BaseEntity {
|
|
282
|
+
name: string;
|
|
283
|
+
key: string;
|
|
284
|
+
description: string;
|
|
285
|
+
addable: boolean;
|
|
286
|
+
sortOrder: number;
|
|
287
|
+
isVisible: boolean;
|
|
288
|
+
status: boolean;
|
|
289
|
+
}
|
|
290
|
+
/** Per-product assignment of SKUs into a relation group (referenced by group key). */
|
|
291
|
+
interface IProductRelationGroup {
|
|
292
|
+
group: string;
|
|
293
|
+
skus: string[];
|
|
294
|
+
}
|
|
295
|
+
|
|
283
296
|
interface IProduct extends BaseEntity, IProductVariantFields {
|
|
284
297
|
name: string;
|
|
285
298
|
slug: string;
|
|
@@ -289,6 +302,7 @@ interface IProduct extends BaseEntity, IProductVariantFields {
|
|
|
289
302
|
variantOptions?: IProductVariantOptionGroup[];
|
|
290
303
|
variantOptionSignatures?: string[];
|
|
291
304
|
variants: IVariant[];
|
|
305
|
+
relationGroups: IProductRelationGroup[];
|
|
292
306
|
}
|
|
293
307
|
|
|
294
308
|
interface IOrderItem extends BaseEntity {
|
|
@@ -534,6 +548,44 @@ interface IAddonGroup extends BaseEntity {
|
|
|
534
548
|
status: boolean;
|
|
535
549
|
}
|
|
536
550
|
|
|
551
|
+
type RedirectTargetType = "product" | "variant" | "category" | "url";
|
|
552
|
+
/** An old→new URL redirect for safe site migration (many old paths → one target). */
|
|
553
|
+
interface IRedirect extends BaseEntity {
|
|
554
|
+
fromPath: string;
|
|
555
|
+
targetType: RedirectTargetType;
|
|
556
|
+
/** Catalog reference id when targetType is product/variant/category. */
|
|
557
|
+
targetRef?: string | null;
|
|
558
|
+
/** Raw destination path/URL when targetType is "url". */
|
|
559
|
+
targetUrl?: string | null;
|
|
560
|
+
statusCode: number;
|
|
561
|
+
/** Append the incoming query string to the destination. */
|
|
562
|
+
preserveQuery: boolean;
|
|
563
|
+
status: boolean;
|
|
564
|
+
hits: number;
|
|
565
|
+
lastHitAt?: Date | null;
|
|
566
|
+
}
|
|
567
|
+
/** A captured 404 (unmatched path) surfaced in admin to find missing redirects. */
|
|
568
|
+
interface IUnmatched404 extends BaseEntity {
|
|
569
|
+
path: string;
|
|
570
|
+
count: number;
|
|
571
|
+
lastSeenAt: Date;
|
|
572
|
+
referrer?: string | null;
|
|
573
|
+
resolved: boolean;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Normalizes a URL or path into a canonical, lookup-stable path so old-site URLs
|
|
578
|
+
* match reliably regardless of how they were entered (full URL, casing, trailing
|
|
579
|
+
* slash, query/hash, encoding). Shared by the backend (storing `fromPath`) and
|
|
580
|
+
* the storefront proxy (matching incoming paths) so the two can never drift.
|
|
581
|
+
*
|
|
582
|
+
* Examples:
|
|
583
|
+
* "https://old.com/Shop/Item/?x=1#a" -> "/shop/item"
|
|
584
|
+
* "Foo//Bar/" -> "/foo/bar"
|
|
585
|
+
* "" -> "/"
|
|
586
|
+
*/
|
|
587
|
+
declare const normalizePath: (input: string) => string;
|
|
588
|
+
|
|
537
589
|
interface ICartItem extends BaseEntity {
|
|
538
590
|
cart: ICart;
|
|
539
591
|
product: IProduct;
|
|
@@ -552,4 +604,4 @@ interface ICart extends BaseEntity {
|
|
|
552
604
|
pricing: ISummaryPricing;
|
|
553
605
|
}
|
|
554
606
|
|
|
555
|
-
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 IProductTechnicalSpec, type IProductTechnicalSpecTable, type IProductVariantFields, type IProductVariantOptionGroup, type IProductVariantOptionMatrix, type IProductVariantOptionValue, type IRefundTransaction, type
|
|
607
|
+
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 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 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
|
@@ -30,6 +30,7 @@ __export(index_exports, {
|
|
|
30
30
|
PaymentStatusEnum: () => PaymentStatusEnum,
|
|
31
31
|
TRANSACTION_TYPE_VALUES: () => TRANSACTION_TYPE_VALUES,
|
|
32
32
|
TransactionTypeEnum: () => TransactionTypeEnum,
|
|
33
|
+
normalizePath: () => normalizePath,
|
|
33
34
|
paymentMethodColorMap: () => paymentMethodColorMap,
|
|
34
35
|
paymentStatusColorMap: () => paymentStatusColorMap,
|
|
35
36
|
statusColors: () => statusColors,
|
|
@@ -55,6 +56,27 @@ var DiscountTypeEnum = {
|
|
|
55
56
|
FIXED: "FIXED"
|
|
56
57
|
};
|
|
57
58
|
|
|
59
|
+
// src/path/index.ts
|
|
60
|
+
var normalizePath = (input) => {
|
|
61
|
+
if (!input || typeof input !== "string") return "/";
|
|
62
|
+
let path = input.trim();
|
|
63
|
+
if (/^https?:\/\//i.test(path)) {
|
|
64
|
+
try {
|
|
65
|
+
path = new URL(path).pathname;
|
|
66
|
+
} catch {
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
path = path.split("?")[0].split("#")[0];
|
|
70
|
+
try {
|
|
71
|
+
path = decodeURIComponent(path);
|
|
72
|
+
} catch {
|
|
73
|
+
}
|
|
74
|
+
if (!path.startsWith("/")) path = `/${path}`;
|
|
75
|
+
path = path.replace(/\/{2,}/g, "/").toLowerCase();
|
|
76
|
+
if (path.length > 1) path = path.replace(/\/+$/, "");
|
|
77
|
+
return path || "/";
|
|
78
|
+
};
|
|
79
|
+
|
|
58
80
|
// src/order/interface.ts
|
|
59
81
|
var OrderStatusEnum = {
|
|
60
82
|
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 './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;;;AC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EAC7B,CAAC,kBAAkB,UAAU,GAAG;AAAA,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/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 './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","/**\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;;;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;;;ACKO,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,EAAG,QAAO,IAAI,IAAI;AAC1C,SAAO,KAAK,QAAQ,WAAW,GAAG,EAAE,YAAY;AAGhD,MAAI,KAA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normalizePath = (input) => {
|
|
21
|
+
if (!input || typeof input !== "string") return "/";
|
|
22
|
+
let path = input.trim();
|
|
23
|
+
if (/^https?:\/\//i.test(path)) {
|
|
24
|
+
try {
|
|
25
|
+
path = new URL(path).pathname;
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
path = path.split("?")[0].split("#")[0];
|
|
30
|
+
try {
|
|
31
|
+
path = decodeURIComponent(path);
|
|
32
|
+
} catch {
|
|
33
|
+
}
|
|
34
|
+
if (!path.startsWith("/")) path = `/${path}`;
|
|
35
|
+
path = path.replace(/\/{2,}/g, "/").toLowerCase();
|
|
36
|
+
if (path.length > 1) path = path.replace(/\/+$/, "");
|
|
37
|
+
return path || "/";
|
|
38
|
+
};
|
|
39
|
+
|
|
19
40
|
// src/order/interface.ts
|
|
20
41
|
var OrderStatusEnum = {
|
|
21
42
|
CREATED: "CREATED",
|
|
@@ -114,6 +135,7 @@ export {
|
|
|
114
135
|
PaymentStatusEnum,
|
|
115
136
|
TRANSACTION_TYPE_VALUES,
|
|
116
137
|
TransactionTypeEnum,
|
|
138
|
+
normalizePath,
|
|
117
139
|
paymentMethodColorMap,
|
|
118
140
|
paymentStatusColorMap,
|
|
119
141
|
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}\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;;;ACGO,IAAM,kBAAkB;AAAA,EAC3B,SAAS;AAAA,EACT,UAAU;AAAA,EACV,SAAS;AAAA,EACT,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,WAAW;AAAA,EACX,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,oBAAoB;AAAA,EACpB,UAAU;AAAA,EACV,UAAU;AACd;AAGO,IAAM,sBAAsB,OAAO,OAAO,eAAe;AAEzD,IAAM,eAAgD;AAAA,EACzD,CAAC,gBAAgB,OAAO,GAAG;AAAA,EAC3B,CAAC,gBAAgB,QAAQ,GAAG;AAAA,EAC5B,CAAC,gBAAgB,OAAO,GAAG;AAAA,EAC3B,CAAC,gBAAgB,SAAS,GAAG;AAAA,EAC7B,CAAC,gBAAgB,UAAU,GAAG;AAAA,EAC9B,CAAC,gBAAgB,OAAO,GAAG;AAAA,EAC3B,CAAC,gBAAgB,SAAS,GAAG;AAAA,EAC7B,CAAC,gBAAgB,QAAQ,GAAG;AAAA,EAC5B,CAAC,gBAAgB,MAAM,GAAG;AAAA,EAC1B,CAAC,gBAAgB,QAAQ,GAAG;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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/admin/interface.ts","../src/coupon/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","/**\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;;;ACKO,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,EAAG,QAAO,IAAI,IAAI;AAC1C,SAAO,KAAK,QAAQ,WAAW,GAAG,EAAE,YAAY;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