@signskart/shared 1.0.0 → 1.0.2

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.
@@ -0,0 +1,513 @@
1
+ interface ILocalizedString {
2
+ [languageCode: string]: string;
3
+ }
4
+
5
+ interface ICurrency {
6
+ _id?: string;
7
+ name: string;
8
+ symbol: string;
9
+ status: boolean;
10
+ live_exchange_rates?: 'show' | 'hide';
11
+ createdAt?: string;
12
+ updatedAt?: string;
13
+ }
14
+
15
+ interface IStoreSettings {
16
+ logo: string;
17
+ theme: 'light' | 'dark';
18
+ timezone: string;
19
+ }
20
+ interface IStore {
21
+ _id?: string;
22
+ name: string;
23
+ shortName: string;
24
+ slug: string;
25
+ domain: string;
26
+ currency: ICurrency;
27
+ settings: IStoreSettings;
28
+ status: boolean;
29
+ createdAt?: string;
30
+ updatedAt?: string;
31
+ }
32
+ interface ICreateStoreDTO {
33
+ name: string;
34
+ shortName: string;
35
+ slug: string;
36
+ domain: string;
37
+ currency: string;
38
+ settings: Partial<IStoreSettings>;
39
+ status: boolean;
40
+ }
41
+
42
+ declare const TAGS: readonly ["new", "hot", "sale", "featured", "exclusive"];
43
+ type Tag = typeof TAGS[number];
44
+ interface ICategory {
45
+ _id?: string;
46
+ name: ILocalizedString;
47
+ description?: ILocalizedString;
48
+ slug: string;
49
+ parent?: string | null;
50
+ parentName?: string;
51
+ children?: string[];
52
+ level?: number;
53
+ status: boolean;
54
+ store: IStore;
55
+ skuInitial?: string;
56
+ sortPosition?: number;
57
+ tags: Tag[];
58
+ images: {
59
+ desktopBanner?: string;
60
+ mobileBanner?: string;
61
+ shopPageThumbnail?: string;
62
+ categoryThumbnail?: string;
63
+ };
64
+ metaData?: {
65
+ category?: {
66
+ titleTag?: string;
67
+ headerTag?: string;
68
+ metaDescription?: string;
69
+ csrKeywords?: string;
70
+ };
71
+ product?: {
72
+ titleTag?: string;
73
+ headerTag?: string;
74
+ metaDescription?: string;
75
+ csrKeywords?: string;
76
+ };
77
+ };
78
+ createdAt?: string;
79
+ updatedAt?: string;
80
+ productCount?: number;
81
+ [key: string]: any;
82
+ }
83
+ interface CategoryQueryParams {
84
+ page?: number;
85
+ limit?: number;
86
+ name?: string;
87
+ status?: string;
88
+ minLevel?: string;
89
+ maxLevel?: string;
90
+ }
91
+ interface CategoryResponse {
92
+ categories: ICategory[];
93
+ totalCategories: number;
94
+ totalPages: number;
95
+ currentPage: number;
96
+ }
97
+
98
+ interface IPrices {
99
+ originalPrice: number;
100
+ price: number;
101
+ discount?: number;
102
+ }
103
+ interface IMetaDataProduct {
104
+ title?: string;
105
+ header?: string;
106
+ description?: string;
107
+ keywords?: string[];
108
+ canonicalUrl?: string;
109
+ }
110
+ interface IImages {
111
+ productImage?: string;
112
+ seoImage?: string;
113
+ displayImage?: string;
114
+ }
115
+ interface IProduct {
116
+ _id: string;
117
+ sku?: string;
118
+ barcode?: string;
119
+ title: ILocalizedString;
120
+ description?: ILocalizedString;
121
+ slug: string;
122
+ categories: ICategory[];
123
+ category: ICategory;
124
+ productType: IProductType;
125
+ image: string[];
126
+ stock: number;
127
+ sales: number;
128
+ tag: string[];
129
+ variants: IVariant[];
130
+ hasVariant: boolean;
131
+ prices: IPrices;
132
+ status: boolean;
133
+ store: IStore;
134
+ images?: IImages;
135
+ metaData?: {
136
+ product?: IMetaDataProduct;
137
+ };
138
+ createdAt?: Date;
139
+ updatedAt?: Date;
140
+ variantList?: IVariant[];
141
+ [key: string]: any;
142
+ }
143
+ interface IProductQuery {
144
+ page?: number;
145
+ limit?: number;
146
+ category?: string;
147
+ categories?: string[];
148
+ title?: string;
149
+ price?: string;
150
+ stockStatus?: string;
151
+ published?: string;
152
+ status?: boolean;
153
+ minPrice?: string;
154
+ maxPrice?: string;
155
+ }
156
+ interface IProductResponse {
157
+ products: IProduct[];
158
+ totalDoc: number;
159
+ limits: number;
160
+ pages: number;
161
+ }
162
+ interface IProductUpdate {
163
+ ids: string[];
164
+ [key: string]: any;
165
+ }
166
+
167
+ interface IProductType {
168
+ _id: string;
169
+ name: string;
170
+ slug: string;
171
+ status: boolean;
172
+ pricingChart: IPricingChartDocument;
173
+ shippingChart: IShippingChartDocument;
174
+ variantChart: IVariantChart;
175
+ frameChart: IFrameChartDocument;
176
+ store: IStore;
177
+ }
178
+ interface IPricingTier {
179
+ from: number;
180
+ to: number;
181
+ price: number;
182
+ }
183
+ interface IPricingData {
184
+ label: string;
185
+ tiers: IPricingTier[];
186
+ }
187
+ interface IPricingChartDocument {
188
+ _id: string;
189
+ name: string;
190
+ pricing: IPricingData[];
191
+ status: boolean;
192
+ }
193
+ interface IPricingChartFormProps {
194
+ onClose: () => void;
195
+ pricingChartId?: string | null;
196
+ initialData?: IPricingChartDocument | null;
197
+ }
198
+ interface IFrameChartDocument {
199
+ _id: string;
200
+ name: string;
201
+ pricing: IPricingData[];
202
+ status: boolean;
203
+ }
204
+ interface IFrameChartFormProps {
205
+ onClose: () => void;
206
+ frameChartId?: string | null;
207
+ initialData?: IFrameChartDocument | null;
208
+ }
209
+ interface IShippingTier {
210
+ from: number;
211
+ to: number;
212
+ price: number;
213
+ }
214
+ interface IShippingData {
215
+ label: string;
216
+ day: number;
217
+ tiers: IShippingTier[];
218
+ }
219
+ interface IShippingChartDocument {
220
+ _id: string;
221
+ name: string;
222
+ shipping: IShippingData[];
223
+ status: boolean;
224
+ }
225
+ interface IShippingChartFormProps {
226
+ onClose: () => void;
227
+ shippingChartId?: string | null;
228
+ initialData?: IShippingChartDocument | null;
229
+ }
230
+ interface IVariantOption {
231
+ label: string;
232
+ }
233
+ interface IVariantChart {
234
+ _id: string;
235
+ name: string;
236
+ status: boolean;
237
+ variants: IVariantOption[];
238
+ createdAt?: string;
239
+ updatedAt?: string;
240
+ }
241
+ interface IVariantChartFormProps {
242
+ onClose: () => void;
243
+ variantChartId?: string | null;
244
+ initialData?: IVariantChart | null;
245
+ }
246
+
247
+ interface IGlobalSetting {
248
+ _id: string;
249
+ name: string;
250
+ number_of_image_per_product: number;
251
+ shop_name: string;
252
+ address: string;
253
+ company_name: string;
254
+ vat_number: string;
255
+ post_code: string;
256
+ contact: string;
257
+ email: string;
258
+ website: string;
259
+ default_currency: string;
260
+ default_time_zone: string;
261
+ default_date_format: string;
262
+ receipt_size: string;
263
+ from_email: string;
264
+ email_to_customer: boolean;
265
+ allow_auto_trans: boolean;
266
+ translation_key: string;
267
+ default_language: string;
268
+ floating_number: number;
269
+ createdAt: string;
270
+ updatedAt: string;
271
+ }
272
+
273
+ interface IDiscountType {
274
+ type: string;
275
+ value: number;
276
+ }
277
+ interface ICoupon {
278
+ _id: string;
279
+ title: ILocalizedString;
280
+ logo: string;
281
+ couponCode: string;
282
+ startTime: string;
283
+ endTime: string;
284
+ discountType: IDiscountType;
285
+ minimumAmount: number;
286
+ isPromotional: boolean;
287
+ status: boolean;
288
+ store: IStore;
289
+ createdAt: string;
290
+ updatedAt: string;
291
+ }
292
+
293
+ interface IVariantPrices {
294
+ originalPrice: number;
295
+ price: number;
296
+ discount?: number;
297
+ }
298
+ interface IVariant {
299
+ _id: string;
300
+ productId?: string;
301
+ sku: string;
302
+ barcode?: string;
303
+ title: ILocalizedString;
304
+ description?: ILocalizedString;
305
+ slug: string;
306
+ stock: number;
307
+ sales?: number;
308
+ tag?: string[];
309
+ prices: IVariantPrices;
310
+ image?: string;
311
+ templateJson?: string;
312
+ size: {
313
+ width: number;
314
+ height: number;
315
+ };
316
+ status: boolean;
317
+ createdAt?: Date;
318
+ updatedAt?: Date;
319
+ }
320
+ interface IProductVariantQuery {
321
+ page?: number;
322
+ limit?: number;
323
+ title?: string;
324
+ price?: string;
325
+ stockStatus?: string;
326
+ minPrice?: string;
327
+ maxPrice?: string;
328
+ }
329
+
330
+ interface ISubscriberSegmentRules {
331
+ status?: 'active' | 'unsubscribed' | 'bounced' | 'blocked';
332
+ channels?: 'email' | 'sms' | 'push' | Array<'email' | 'sms' | 'push'>;
333
+ }
334
+ interface ISubscriber {
335
+ _id?: string;
336
+ email?: string;
337
+ phone?: string;
338
+ userId?: string;
339
+ channels: Array<'email' | 'sms' | 'push'>;
340
+ status?: 'active' | 'unsubscribed' | 'bounced' | 'blocked';
341
+ locale?: string;
342
+ store?: IStore | string;
343
+ schemaVersion?: number;
344
+ isDeleted?: boolean;
345
+ createdAt?: Date;
346
+ updatedAt?: Date;
347
+ }
348
+ interface ISubscriberCampaignContent {
349
+ html?: string;
350
+ text?: string;
351
+ }
352
+ interface ISubscriberCampaign {
353
+ _id?: string;
354
+ store?: IStore;
355
+ name: string;
356
+ type: 'email' | 'sms' | 'push';
357
+ segmentId?: string;
358
+ subject?: string;
359
+ content?: ISubscriberCampaignContent;
360
+ status?: 'draft' | 'scheduled' | 'sent' | 'failed';
361
+ scheduledAt?: Date;
362
+ sentAt?: Date;
363
+ createdAt?: Date;
364
+ }
365
+ interface ISubscriberCampaignLogMetaLocation {
366
+ country?: string;
367
+ city?: string;
368
+ }
369
+ interface ISubscriberCampaignLogMeta {
370
+ ip?: string;
371
+ userAgent?: string;
372
+ location?: ISubscriberCampaignLogMetaLocation;
373
+ }
374
+ interface ISubscriberCampaignLog {
375
+ _id?: string;
376
+ campaignId: string;
377
+ subscriberId: string;
378
+ event: 'delivered' | 'opened' | 'clicked' | 'bounced' | 'unsubscribed';
379
+ timestamp?: Date;
380
+ meta?: ISubscriberCampaignLogMeta;
381
+ }
382
+ interface ISubscriberEventBase {
383
+ _id?: string;
384
+ subscriberId: string;
385
+ createdAt?: Date;
386
+ }
387
+ interface ISubscriberEventSubscribed extends ISubscriberEventBase {
388
+ eventType: 'subscribed' | 'unsubscribed' | 'preference_updated' | 'bounced' | 'created' | 'deleted';
389
+ details?: Record<string, any>;
390
+ }
391
+ interface ISubscriberEventUpdated extends ISubscriberEventBase {
392
+ eventType: 'updated';
393
+ details: {
394
+ updatedFields: Record<string, any>;
395
+ };
396
+ }
397
+ type ISubscriberEvent = ISubscriberEventSubscribed | ISubscriberEventUpdated;
398
+ interface ISubscriberList {
399
+ _id?: string;
400
+ store?: IStore;
401
+ name: string;
402
+ description?: string;
403
+ channel: 'email' | 'sms' | 'push';
404
+ defaultOptIn?: boolean;
405
+ createdAt?: Date;
406
+ }
407
+ interface ISubscriberPreference {
408
+ _id?: string;
409
+ subscriberId: string;
410
+ channel: 'email' | 'sms' | 'push';
411
+ topics: string[];
412
+ unsubscribed: boolean;
413
+ updatedAt?: Date;
414
+ }
415
+ interface ISubscriberSegment {
416
+ _id?: string;
417
+ store?: IStore;
418
+ name: string;
419
+ type: 'static' | 'dynamic';
420
+ rules?: ISubscriberSegmentRules;
421
+ subscriberIds?: Array<string>;
422
+ createdAt?: Date;
423
+ }
424
+ interface ISubscriberSubscription {
425
+ _id?: string;
426
+ subscriberId: string;
427
+ listId: string;
428
+ status?: 'subscribed' | 'unsubscribed' | 'pending';
429
+ subscribedAt?: Date;
430
+ unsubscribedAt?: Date;
431
+ isDeleted?: boolean;
432
+ }
433
+
434
+ interface ILanguage {
435
+ _id: string;
436
+ name: string;
437
+ iso_code: string;
438
+ flag: string;
439
+ status: boolean;
440
+ createdAt: string;
441
+ updatedAt: string;
442
+ }
443
+
444
+ type BannerMediaType = 'image' | 'video';
445
+ interface BannerMedia {
446
+ type: BannerMediaType;
447
+ sources: {
448
+ desktop: string;
449
+ mobile?: string;
450
+ tablet?: string;
451
+ };
452
+ altText?: ILocalizedString;
453
+ poster?: string;
454
+ autoplay?: boolean;
455
+ loop?: boolean;
456
+ muted?: boolean;
457
+ }
458
+ type LinkType = 'internal' | 'external';
459
+ interface BannerLink {
460
+ type: LinkType;
461
+ url: string;
462
+ openInNewTab: boolean;
463
+ }
464
+ interface IBannerFormValues extends Omit<IBanner, 'visibility'> {
465
+ visibility: BannerVisibility & {
466
+ scheduledRange?: [Date, Date];
467
+ };
468
+ }
469
+ interface BannerVisibility {
470
+ status: boolean;
471
+ scheduled: {
472
+ from: Date | null;
473
+ to: Date | null;
474
+ };
475
+ }
476
+ interface IBanner {
477
+ _id?: string;
478
+ store: IStore;
479
+ title: ILocalizedString;
480
+ description?: ILocalizedString;
481
+ media: BannerMedia;
482
+ link?: BannerLink;
483
+ visibility: BannerVisibility;
484
+ position: string;
485
+ sortOrder: number;
486
+ createdAt: Date;
487
+ updatedAt: Date;
488
+ }
489
+
490
+ type CustomerPhotoStatus = 'pending' | 'approved' | 'rejected';
491
+ interface ICustomerPhotos {
492
+ _id?: string;
493
+ store: IStore;
494
+ customer: {
495
+ name?: string;
496
+ email?: string;
497
+ comment?: string;
498
+ };
499
+ photos: string[];
500
+ status: CustomerPhotoStatus;
501
+ createdAt: Date;
502
+ updatedAt: Date;
503
+ }
504
+ interface CustomerPhotosQueryParams {
505
+ page?: number;
506
+ limit?: number;
507
+ name?: string;
508
+ email?: string;
509
+ status?: CustomerPhotoStatus;
510
+ store?: string;
511
+ }
512
+
513
+ export { type BannerLink, type BannerMedia, type BannerMediaType, type BannerVisibility, type CategoryQueryParams, type CategoryResponse, type CustomerPhotoStatus, type CustomerPhotosQueryParams, type IBanner, type IBannerFormValues, type ICategory, type ICoupon, type ICreateStoreDTO, type ICurrency, type ICustomerPhotos, type IDiscountType, type IFrameChartDocument, type IFrameChartFormProps, type IGlobalSetting, type IImages, type ILanguage, type ILocalizedString, type IMetaDataProduct, type IPrices, type IPricingChartDocument, type IPricingChartFormProps, type IPricingData, type IPricingTier, type IProduct, type IProductQuery, type IProductResponse, type IProductType, type IProductUpdate, type IProductVariantQuery, type IShippingChartDocument, type IShippingChartFormProps, type IShippingData, type IShippingTier, type IStore, type IStoreSettings, type ISubscriber, type ISubscriberCampaign, type ISubscriberCampaignContent, type ISubscriberCampaignLog, type ISubscriberCampaignLogMeta, type ISubscriberCampaignLogMetaLocation, type ISubscriberEvent, type ISubscriberEventBase, type ISubscriberEventSubscribed, type ISubscriberEventUpdated, type ISubscriberList, type ISubscriberPreference, type ISubscriberSegment, type ISubscriberSegmentRules, type ISubscriberSubscription, type IVariant, type IVariantChart, type IVariantChartFormProps, type IVariantOption, type IVariantPrices, type LinkType, TAGS, type Tag };
package/dist/index.js ADDED
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ TAGS: () => TAGS
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+
27
+ // src/interfaces/category.ts
28
+ var TAGS = ["new", "hot", "sale", "featured", "exclusive"];
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ TAGS
32
+ });
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/interfaces/category.ts"],"sourcesContent":["export * from './interfaces';\n","import { ILocalizedString } from \"./common\";\nimport { IStore } from \"./store\";\n\nexport const TAGS = ['new', 'hot', 'sale', 'featured', 'exclusive'] as const;\n\nexport type Tag = typeof TAGS[number];\n\nexport interface ICategory {\n _id?: string;\n name: ILocalizedString;\n description?: ILocalizedString;\n slug: string;\n parent?: string | null;\n parentName?: string;\n children?: string[];\n level?: number;\n status: boolean;\n store: IStore;\n skuInitial?: string;\n sortPosition?: number;\n tags: Tag[];\n\n images: {\n desktopBanner?: string;\n mobileBanner?: string;\n shopPageThumbnail?: string;\n categoryThumbnail?: string;\n };\n\n metaData?: {\n category?: {\n titleTag?: string;\n headerTag?: string;\n metaDescription?: string;\n csrKeywords?: string;\n };\n product?: {\n titleTag?: string;\n headerTag?: string;\n metaDescription?: string;\n csrKeywords?: string;\n };\n };\n\n createdAt?: string;\n updatedAt?: string;\n productCount?: number;\n\n [key: string]: any; // Optional catch-all for dynamic properties\n}\n\nexport interface CategoryQueryParams {\n page?: number;\n limit?: number;\n name?: string;\n status?: string;\n minLevel?: string;\n maxLevel?: string;\n}\n\nexport interface CategoryResponse {\n categories: ICategory[];\n totalCategories: number;\n totalPages: number;\n currentPage: number;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGO,IAAM,OAAO,CAAC,OAAO,OAAO,QAAQ,YAAY,WAAW;","names":[]}
package/dist/index.mjs ADDED
@@ -0,0 +1,6 @@
1
+ // src/interfaces/category.ts
2
+ var TAGS = ["new", "hot", "sale", "featured", "exclusive"];
3
+ export {
4
+ TAGS
5
+ };
6
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/interfaces/category.ts"],"sourcesContent":["import { ILocalizedString } from \"./common\";\nimport { IStore } from \"./store\";\n\nexport const TAGS = ['new', 'hot', 'sale', 'featured', 'exclusive'] as const;\n\nexport type Tag = typeof TAGS[number];\n\nexport interface ICategory {\n _id?: string;\n name: ILocalizedString;\n description?: ILocalizedString;\n slug: string;\n parent?: string | null;\n parentName?: string;\n children?: string[];\n level?: number;\n status: boolean;\n store: IStore;\n skuInitial?: string;\n sortPosition?: number;\n tags: Tag[];\n\n images: {\n desktopBanner?: string;\n mobileBanner?: string;\n shopPageThumbnail?: string;\n categoryThumbnail?: string;\n };\n\n metaData?: {\n category?: {\n titleTag?: string;\n headerTag?: string;\n metaDescription?: string;\n csrKeywords?: string;\n };\n product?: {\n titleTag?: string;\n headerTag?: string;\n metaDescription?: string;\n csrKeywords?: string;\n };\n };\n\n createdAt?: string;\n updatedAt?: string;\n productCount?: number;\n\n [key: string]: any; // Optional catch-all for dynamic properties\n}\n\nexport interface CategoryQueryParams {\n page?: number;\n limit?: number;\n name?: string;\n status?: string;\n minLevel?: string;\n maxLevel?: string;\n}\n\nexport interface CategoryResponse {\n categories: ICategory[];\n totalCategories: number;\n totalPages: number;\n currentPage: number;\n}\n"],"mappings":";AAGO,IAAM,OAAO,CAAC,OAAO,OAAO,QAAQ,YAAY,WAAW;","names":[]}
package/package.json CHANGED
@@ -1,10 +1,37 @@
1
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
- }
2
+ "name": "@signskart/shared",
3
+ "version": "1.0.2",
4
+ "description": "Production-grade upload manager SDK with queue, progress tracking, retry logic, and multi-provider support (S3, Cloudinary).",
5
+ "author": "Signskart",
6
+ "license": "UNLICENSED",
7
+ "main": "dist/index.cjs",
8
+ "module": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "exports": {
14
+ ".": {
15
+ "import": "./dist/index.js",
16
+ "require": "./dist/index.cjs"
17
+ }
18
+ },
19
+ "scripts": {
20
+ "build": "tsup",
21
+ "prepublishOnly": "npm run build"
22
+ },
23
+ "keywords": [
24
+ "signskart",
25
+ "upload",
26
+ "s3",
27
+ "cloudinary",
28
+ "upload-manager",
29
+ "typescript",
30
+ "file-upload",
31
+ "sdk"
32
+ ],
33
+ "devDependencies": {
34
+ "tsup": "^8.0.0",
35
+ "typescript": "^5.0.0"
36
+ }
37
+ }
package/src/index.ts DELETED
File without changes
@@ -1,60 +0,0 @@
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
- }