@signskart/shared 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@signskart/shared",
3
+ "version": "1.0.0",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "scripts": {
7
+ "build": "tsc --project tsconfig.json"
8
+ },
9
+ "license": "MIT"
10
+ }
package/src/index.ts ADDED
File without changes
@@ -0,0 +1,60 @@
1
+ import { ILocalizedString } from './common';
2
+ import { IStore } from './store';
3
+
4
+ // media types
5
+ export type BannerMediaType = 'image' | 'video';
6
+
7
+ export interface BannerMedia {
8
+ type: BannerMediaType;
9
+ sources: {
10
+ desktop: string;
11
+ mobile?: string;
12
+ tablet?: string;
13
+ };
14
+ altText?: ILocalizedString; // i18n-friendly alt text for accessibility
15
+
16
+ // Video-specific fields
17
+ poster?: string;
18
+ autoplay?: boolean;
19
+ loop?: boolean;
20
+ muted?: boolean;
21
+ }
22
+
23
+ // link types
24
+ export type LinkType = 'internal' | 'external';
25
+
26
+ export interface BannerLink {
27
+ type: LinkType;
28
+ url: string;
29
+ openInNewTab: boolean;
30
+ }
31
+
32
+ export interface IBannerFormValues extends Omit<IBanner, 'visibility'> {
33
+ visibility: BannerVisibility & {
34
+ scheduledRange?: [Date, Date]; // used only in the form
35
+ };
36
+ }
37
+
38
+ // visibility controls (with optional scheduling)
39
+ export interface BannerVisibility {
40
+ status: boolean;
41
+ scheduled: {
42
+ from: Date | null;
43
+ to: Date | null;
44
+ };
45
+ }
46
+
47
+ // main banner interface
48
+ export interface IBanner {
49
+ _id?: string; // MongoDB document ID
50
+ store: IStore; // Store ID (multi-tenant support)
51
+ title: ILocalizedString; // i18n title
52
+ description?: ILocalizedString; // optional i18n description
53
+ media: BannerMedia; // image or video media block
54
+ link?: BannerLink; // optional CTA link
55
+ visibility: BannerVisibility; // active + scheduled
56
+ position: string; // UI position, e.g. 'homepage-top'
57
+ sortOrder: number; // for ordering banners
58
+ createdAt: Date;
59
+ updatedAt: Date;
60
+ }
@@ -0,0 +1,61 @@
1
+ import { ILocalizedString } from "./common";
2
+ import { IStore } from "./store";
3
+
4
+ export interface ICategory {
5
+ _id: string;
6
+ name: ILocalizedString;
7
+ description?: ILocalizedString;
8
+ slug?: string;
9
+ parent?: string | null;
10
+ parentName?: string;
11
+ children?: string[];
12
+ level?: number;
13
+ status?: boolean;
14
+ store: IStore;
15
+ skuInitial?: string;
16
+ sortPosition?: number;
17
+
18
+ images?: {
19
+ desktopBanner?: string;
20
+ mobileBanner?: string;
21
+ shopPageThumbnail?: string;
22
+ categoryThumbnail?: string;
23
+ };
24
+
25
+ metaData?: {
26
+ category?: {
27
+ titleTag?: string;
28
+ headerTag?: string;
29
+ metaDescription?: string;
30
+ csrKeywords?: string;
31
+ };
32
+ product?: {
33
+ titleTag?: string;
34
+ headerTag?: string;
35
+ metaDescription?: string;
36
+ csrKeywords?: string;
37
+ };
38
+ };
39
+
40
+ createdAt?: string;
41
+ updatedAt?: string;
42
+ productCount?: number;
43
+
44
+ [key: string]: any; // Optional catch-all for dynamic properties
45
+ }
46
+
47
+ export interface CategoryQueryParams {
48
+ page?: number;
49
+ limit?: number;
50
+ name?: string;
51
+ status?: string;
52
+ minLevel?: string;
53
+ maxLevel?: string;
54
+ }
55
+
56
+ export interface CategoryResponse {
57
+ categories: ICategory[];
58
+ totalCategories: number;
59
+ totalPages: number;
60
+ currentPage: number;
61
+ }
@@ -0,0 +1,3 @@
1
+ export interface ILocalizedString {
2
+ [languageCode: string]: string;
3
+ }
@@ -0,0 +1,25 @@
1
+ import { ILocalizedString } from './common';
2
+ import { IStore } from './store';
3
+ import { Dayjs } from 'dayjs';
4
+
5
+
6
+ export interface IDiscountType {
7
+ type: string;
8
+ value: number;
9
+ }
10
+
11
+ export interface ICoupon {
12
+ _id: string;
13
+ title: ILocalizedString;
14
+ logo: string;
15
+ couponCode: string;
16
+ startTime: string | Dayjs;
17
+ endTime: string | Dayjs;
18
+ discountType: IDiscountType;
19
+ minimumAmount: number;
20
+ isPromotional: boolean;
21
+ status: boolean;
22
+ store: IStore;
23
+ createdAt: string;
24
+ updatedAt: string;
25
+ }
@@ -0,0 +1,11 @@
1
+ export interface ICurrency {
2
+ _id?: string;
3
+ name: string;
4
+ symbol: string;
5
+ status: boolean;
6
+ // iso_code: string;
7
+ // exchange_rate?: string;
8
+ live_exchange_rates?: 'show' | 'hide';
9
+ createdAt: string;
10
+ updatedAt: string;
11
+ }
@@ -0,0 +1,25 @@
1
+ export interface IGlobalSetting {
2
+ _id: string;
3
+ name: string;
4
+ number_of_image_per_product: number;
5
+ shop_name: string;
6
+ address: string;
7
+ company_name: string;
8
+ vat_number: string;
9
+ post_code: string;
10
+ contact: string;
11
+ email: string;
12
+ website: string;
13
+ default_currency: string;
14
+ default_time_zone: string;
15
+ default_date_format: string;
16
+ receipt_size: string;
17
+ from_email: string;
18
+ email_to_customer: boolean;
19
+ allow_auto_trans: boolean;
20
+ translation_key: string;
21
+ default_language: string;
22
+ floating_number: number;
23
+ createdAt: string;
24
+ updatedAt: string;
25
+ }
@@ -0,0 +1,12 @@
1
+ export * from './category';
2
+ export * from './product';
3
+ export * from './productType';
4
+ export * from './globalSetting';
5
+ export * from './store';
6
+ export * from './currency';
7
+ export * from './coupon';
8
+ export * from './variant';
9
+ export * from './subscriber';
10
+ export * from './language';
11
+ export * from './banner';
12
+ export * from './common'
@@ -0,0 +1,9 @@
1
+ export interface ILanguage {
2
+ _id: string
3
+ name: string;
4
+ iso_code: string;
5
+ flag: string;
6
+ status: boolean;
7
+ createdAt: string;
8
+ updatedAt: string;
9
+ }
@@ -0,0 +1,79 @@
1
+ import { ICategory, ILocalizedString, IProductType, IStore, IVariant } from "@/utils/interface";
2
+
3
+ export interface IPrices {
4
+ originalPrice: number;
5
+ price: number
6
+ discount?: number;
7
+ }
8
+
9
+ export interface IMetaDataProduct {
10
+ title?: string;
11
+ header?: string;
12
+ description?: string;
13
+ keywords?: string[];
14
+ canonicalUrl?: string;
15
+ }
16
+
17
+ export interface IImages {
18
+ productImage?: string;
19
+ seoImage?: string;
20
+ displayImage?: string;
21
+ }
22
+
23
+ export interface IProduct {
24
+ _id: string;
25
+ sku?: string;
26
+ barcode?: string;
27
+ title: ILocalizedString;
28
+ description?: ILocalizedString;
29
+ slug: string;
30
+ categories: ICategory[];
31
+ category: ICategory;
32
+ productType?: IProductType;
33
+ image: string[];
34
+ stock: number;
35
+ sales: number;
36
+ tag: string[];
37
+ variants: IVariant[]; // direct ref array
38
+ hasVariant: boolean;
39
+ hasSize: boolean;
40
+ isCombination: boolean;
41
+ prices: IPrices;
42
+ status: boolean;
43
+ store: IStore;
44
+ images?: IImages;
45
+ metaData?: {
46
+ product?: IMetaDataProduct;
47
+ };
48
+ createdAt?: Date;
49
+ updatedAt?: Date;
50
+
51
+ // Optional: virtual populate
52
+ variantList?: IVariant[];
53
+
54
+ [key: string]: any;
55
+ }
56
+
57
+ export interface IProductQuery {
58
+ page?: number;
59
+ limit?: number;
60
+ category?: string;
61
+ title?: string;
62
+ price?: string;
63
+ stockStatus?: string;
64
+ published?: string;
65
+ minPrice?: string;
66
+ maxPrice?: string;
67
+ }
68
+
69
+ export interface IProductResponse {
70
+ products: IProduct[];
71
+ totalDoc: number;
72
+ limits: number;
73
+ pages: number;
74
+ }
75
+
76
+ export interface IProductUpdate {
77
+ ids: string[];
78
+ [key: string]: any;
79
+ }
@@ -0,0 +1,100 @@
1
+ import { IStore } from "./store";
2
+
3
+ export interface IProductType {
4
+ _id: string;
5
+ name: string;
6
+ slug: string;
7
+ status: boolean;
8
+ pricingChart: IPricingChartDocument;
9
+ shippingChart: IShippingChartDocument;
10
+ variantChart: IVariantChart;
11
+ frameChart: IFrameChartDocument;
12
+ store: IStore;
13
+ }
14
+
15
+ // pricing
16
+ export interface IPricingTier {
17
+ from: number;
18
+ to: number;
19
+ price: number;
20
+ }
21
+
22
+ export interface IPricingData {
23
+ label: string;
24
+ tiers: IPricingTier[];
25
+ }
26
+
27
+ export interface IPricingChartDocument {
28
+ _id: string;
29
+ name: string;
30
+ pricing: IPricingData[];
31
+ status: boolean;
32
+ }
33
+
34
+
35
+ export interface IPricingChartFormProps {
36
+ onClose: () => void;
37
+ pricingChartId?: string | null;
38
+ initialData?: IPricingChartDocument | null;
39
+ }
40
+
41
+ // Frame
42
+ export interface IFrameChartDocument {
43
+ _id: string;
44
+ name: string;
45
+ pricing: IPricingData[];
46
+ status: boolean;
47
+ }
48
+
49
+ export interface IFrameChartFormProps {
50
+ onClose: () => void;
51
+ frameChartId?: string | null;
52
+ initialData?: IFrameChartDocument | null;
53
+ }
54
+
55
+
56
+ // Shipping
57
+ export interface IShippingTier {
58
+ from: number;
59
+ to: number;
60
+ price: number;
61
+ }
62
+
63
+ export interface IShippingData {
64
+ label: string;
65
+ day: number;
66
+ tiers: IShippingTier[];
67
+ }
68
+
69
+ export interface IShippingChartDocument {
70
+ _id: string;
71
+ name: string;
72
+ shipping: IShippingData[];
73
+ status: boolean;
74
+ }
75
+
76
+ export interface IShippingChartFormProps {
77
+ onClose: () => void;
78
+ shippingChartId?: string | null;
79
+ initialData?: IShippingChartDocument | null;
80
+ }
81
+
82
+ // variant
83
+ export interface IVariantOption {
84
+ label: string;
85
+ }
86
+
87
+ export interface IVariantChart {
88
+ _id: string;
89
+ name: string;
90
+ status: boolean;
91
+ variants: IVariantOption[];
92
+ createdAt?: string;
93
+ updatedAt?: string;
94
+ }
95
+
96
+ export interface IVariantChartFormProps {
97
+ onClose: () => void;
98
+ variantChartId?: string | null;
99
+ initialData?: IVariantChart | null;
100
+ }
@@ -0,0 +1,30 @@
1
+ import { ICurrency } from "./currency";
2
+
3
+ export interface IStoreSettings {
4
+ logo: string;
5
+ theme: 'light' | 'dark';
6
+ timezone: string;
7
+ }
8
+
9
+ export interface IStore {
10
+ _id: string;
11
+ name: string;
12
+ shortName: string;
13
+ slug: string;
14
+ domain: string;
15
+ currency: ICurrency;
16
+ settings: IStoreSettings;
17
+ status: boolean;
18
+ createdAt: string;
19
+ updatedAt: string;
20
+ }
21
+
22
+ export interface ICreateStoreDTO {
23
+ name: string;
24
+ shortName: string;
25
+ slug: string;
26
+ domain: string;
27
+ currency: string;
28
+ settings: Partial<IStoreSettings>;
29
+ status: boolean;
30
+ }
@@ -0,0 +1,129 @@
1
+ import { IStore } from "./store";
2
+
3
+ export interface ISubscriberSegmentRules {
4
+ status?: 'active' | 'unsubscribed' | 'bounced' | 'blocked';
5
+ channels?: 'email' | 'sms' | 'push' | Array<'email' | 'sms' | 'push'>;
6
+ // Add more filtering fields as needed
7
+ }
8
+
9
+
10
+ export interface ISubscriber {
11
+ _id?: string;
12
+ email?: string;
13
+ phone?: string;
14
+ userId?: string;
15
+ channels: Array<'email' | 'sms' | 'push'>;
16
+ status?: 'active' | 'unsubscribed' | 'bounced' | 'blocked';
17
+ locale?: string;
18
+ store?: IStore;
19
+ schemaVersion?: number;
20
+ isDeleted?: boolean;
21
+ createdAt?: Date;
22
+ updatedAt?: Date;
23
+ }
24
+
25
+ export interface ISubscriberCampaignContent {
26
+ html?: string;
27
+ text?: string;
28
+ }
29
+
30
+ export interface ISubscriberCampaign {
31
+ _id?: string;
32
+ store?: IStore;
33
+ name: string;
34
+ type: 'email' | 'sms' | 'push';
35
+ segmentId?: string;
36
+ subject?: string;
37
+ content?: ISubscriberCampaignContent;
38
+ status?: 'draft' | 'scheduled' | 'sent' | 'failed';
39
+ scheduledAt?: Date;
40
+ sentAt?: Date;
41
+ createdAt?: Date;
42
+ }
43
+
44
+ export interface ISubscriberCampaignLogMetaLocation {
45
+ country?: string;
46
+ city?: string;
47
+ }
48
+
49
+ export interface ISubscriberCampaignLogMeta {
50
+ ip?: string;
51
+ userAgent?: string;
52
+ location?: ISubscriberCampaignLogMetaLocation;
53
+ }
54
+
55
+ export interface ISubscriberCampaignLog {
56
+ _id?: string;
57
+ campaignId: string;
58
+ subscriberId: string;
59
+ event: 'delivered' | 'opened' | 'clicked' | 'bounced' | 'unsubscribed';
60
+ timestamp?: Date;
61
+ meta?: ISubscriberCampaignLogMeta;
62
+ }
63
+
64
+ // export interface ISubscriberEvent {
65
+ // _id?: string;
66
+ // subscriberId: string;
67
+ // eventType: 'subscribed' | 'unsubscribed' | 'preference_updated' | 'bounced';
68
+ // details?: Record<string, any>;
69
+ // createdAt?: Date;
70
+ // }
71
+
72
+ export interface ISubscriberEventBase {
73
+ _id?: string;
74
+ subscriberId: string;
75
+ createdAt?: Date;
76
+ }
77
+
78
+ export interface ISubscriberEventSubscribed extends ISubscriberEventBase {
79
+ eventType: 'subscribed' | 'unsubscribed' | 'preference_updated' | 'bounced' | 'created' | 'deleted';
80
+ details?: Record<string, any>;
81
+ }
82
+
83
+ export interface ISubscriberEventUpdated extends ISubscriberEventBase {
84
+ eventType: 'updated';
85
+ details: {
86
+ updatedFields: Record<string, any>;
87
+ };
88
+ }
89
+
90
+ export type ISubscriberEvent = ISubscriberEventSubscribed | ISubscriberEventUpdated;
91
+
92
+ export interface ISubscriberList {
93
+ _id?: string;
94
+ store?: IStore;
95
+ name: string;
96
+ description?: string;
97
+ channel: 'email' | 'sms' | 'push';
98
+ defaultOptIn?: boolean;
99
+ createdAt?: Date;
100
+ }
101
+
102
+ export interface ISubscriberPreference {
103
+ _id?: string;
104
+ subscriberId: string;
105
+ channel: 'email' | 'sms' | 'push';
106
+ topics: string[];
107
+ unsubscribed: boolean;
108
+ updatedAt?: Date;
109
+ }
110
+
111
+ export interface ISubscriberSegment {
112
+ _id?: string;
113
+ store?: IStore;
114
+ name: string;
115
+ type: 'static' | 'dynamic';
116
+ rules?: ISubscriberSegmentRules; // Replace with a specific type if you have a schema for rules
117
+ subscriberIds?: Array<string>;
118
+ createdAt?: Date;
119
+ }
120
+
121
+ export interface ISubscriberSubscription {
122
+ _id?: string;
123
+ subscriberId: string;
124
+ listId: string;
125
+ status?: 'subscribed' | 'unsubscribed' | 'pending';
126
+ subscribedAt?: Date;
127
+ unsubscribedAt?: Date;
128
+ isDeleted?: boolean;
129
+ }
@@ -0,0 +1,40 @@
1
+ import { ILocalizedString } from "@/utils/interface";
2
+
3
+ export interface IVariantPrices {
4
+ originalPrice: number;
5
+ price: number;
6
+ discount?: number;
7
+ }
8
+
9
+ export interface IVariant {
10
+ _id: string; // MongoDB ObjectId string (optional on creation)
11
+ productId?: string; // Reference to parent product's _id
12
+ sku: string;
13
+ barcode?: string;
14
+ title: ILocalizedString; // Multilingual title
15
+ description?: ILocalizedString;
16
+ slug: string;
17
+ stock: number;
18
+ sales?: number; // Default 0
19
+ tag?: string[];
20
+ prices: IVariantPrices;
21
+ image?: string;
22
+ templateJson?: string;
23
+ size: {
24
+ width: number;
25
+ height: number;
26
+ }
27
+ status: boolean; // Active status, default true
28
+ createdAt?: Date;
29
+ updatedAt?: Date;
30
+ }
31
+
32
+ export interface IProductVariantQuery {
33
+ page?: number;
34
+ limit?: number;
35
+ title?: string;
36
+ price?: string;
37
+ stockStatus?: string;
38
+ minPrice?: string;
39
+ maxPrice?: string;
40
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "declaration": true,
6
+ "outDir": "dist",
7
+ "rootDir": "src",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "skipLibCheck": true
12
+ },
13
+ "include": [
14
+ "src"
15
+ ]
16
+ }