shopoflex-types 1.0.162 → 1.0.166

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.
Files changed (2) hide show
  1. package/dist/common.d.ts +106 -12
  2. package/package.json +1 -1
package/dist/common.d.ts CHANGED
@@ -280,6 +280,42 @@ export interface PixelsOptions {
280
280
  active?: boolean;
281
281
  };
282
282
  }
283
+ type LimitValue = number | 'unlimited';
284
+ interface PlanLimits {
285
+ dailyOrders: LimitValue;
286
+ users: LimitValue;
287
+ branches: LimitValue;
288
+ }
289
+ interface PlanFeatures {
290
+ terminalSynchronization: boolean;
291
+ customDomain: boolean;
292
+ tableManagement: boolean;
293
+ accounting: boolean;
294
+ advancedReports: boolean;
295
+ whatsappNotifications: boolean;
296
+ emailNotifications: boolean;
297
+ }
298
+ export interface IPlanPackage {
299
+ _id?: any;
300
+ name: string;
301
+ price: number | 'custom';
302
+ limits: PlanLimits;
303
+ features: PlanFeatures;
304
+ isActive: boolean;
305
+ createdAt: Date;
306
+ updatedAt: Date;
307
+ }
308
+ interface TaxSettings {
309
+ active: boolean;
310
+ show: boolean;
311
+ payer: 'vendor' | 'customer';
312
+ percentage: number;
313
+ }
314
+ export type VendorUserInvitation = {
315
+ email: string;
316
+ role: string;
317
+ status: "pending";
318
+ };
283
319
  export interface Vendor {
284
320
  _id?: string;
285
321
  industry?: string;
@@ -327,17 +363,9 @@ export interface Vendor {
327
363
  createdAt: Date;
328
364
  orderType: PickType[];
329
365
  socialLinks: string[];
330
- users: Array<unknown>;
366
+ users: VendorUserPopulated[] | VendorUser[] | VendorUserUnpopulated[] | VendorUserInvitation[];
331
367
  areas: Record<string, unknown>;
332
368
  payments: VendorPayments;
333
- wallet: {
334
- balance: number;
335
- currency: string;
336
- commissionRates: {
337
- ecommerce: number;
338
- pos: number;
339
- };
340
- };
341
369
  usage: {
342
370
  productsCount: number;
343
371
  branchesCount: number;
@@ -346,10 +374,76 @@ export interface Vendor {
346
374
  allowCustomPricing?: boolean;
347
375
  pixelsOptions?: PixelsOptions;
348
376
  taxManagement?: TaxManagement;
349
- addToWallet(amount: number): Promise<this>;
350
- deductCommission(orderValue: number, source?: 'pos' | 'online'): Promise<this>;
351
- canProcessOrder(orderValue: number, source?: 'pos' | 'online'): boolean;
377
+ currentPlan?: IPlanPackage;
378
+ getTaxConfig(country?: string): TaxSettings;
379
+ calculateTax(subtotal: number, country?: string): {
380
+ taxAmount: number;
381
+ taxConfig: TaxSettings;
382
+ taxIncludedInTotal: boolean;
383
+ };
384
+ setTaxConfig(config: {
385
+ type: 'fixed' | 'perCountry';
386
+ settings: any;
387
+ }): Promise<any>;
388
+ setCountryTax(country: string, settings: TaxSettings): Promise<any>;
389
+ validateLockPin(userId: string, lockPin: string): boolean;
390
+ setUserLockPin(userId: string, lockPin: string): Promise<any>;
391
+ updatePlan(planId: string, startDate?: Date, endDate?: Date): Promise<any>;
392
+ getCurrentPlan(): Promise<any>;
393
+ getCurrentUsage(): Promise<{
394
+ dailyOrders: number;
395
+ branches: number;
396
+ users: number;
397
+ }>;
398
+ calculateRemainingLimits(planLimits: any): Promise<any>;
399
+ getSubscriptionDetails(): any;
400
+ checkLimit(limitType: string): Promise<boolean>;
401
+ canCreateOrder(): Promise<boolean>;
402
+ canCreateUser(): Promise<boolean>;
403
+ canCreateBranch(): Promise<boolean>;
404
+ }
405
+ export interface VendorUser<TUser = string, TRole = string> {
406
+ user: TUser;
407
+ role: TRole;
408
+ status: "pending" | "active" | "disabled";
409
+ email: string;
410
+ lockPin: string;
411
+ notifications: {
412
+ tokens: string[];
413
+ email: boolean;
414
+ push: boolean;
415
+ inApp: boolean;
416
+ types: {
417
+ new_order: boolean;
418
+ order_update: boolean;
419
+ stock_alert: boolean;
420
+ product_update: boolean;
421
+ system_update: boolean;
422
+ };
423
+ };
424
+ }
425
+ export interface VendorUser<TUser = string, TRole = string> {
426
+ user: TUser;
427
+ role: TRole;
428
+ status: "pending" | "active" | "disabled";
429
+ email: string;
430
+ lockPin: string;
431
+ notifications: {
432
+ tokens: string[];
433
+ email: boolean;
434
+ push: boolean;
435
+ inApp: boolean;
436
+ types: {
437
+ new_order: boolean;
438
+ order_update: boolean;
439
+ stock_alert: boolean;
440
+ product_update: boolean;
441
+ system_update: boolean;
442
+ };
443
+ };
352
444
  }
445
+ export type VendorUserPopulated = VendorUser<IUser, IRole>;
446
+ export type VendorUserUnpopulated = VendorUser<string, string>;
353
447
  export interface NotificationType {
354
448
  _id?: any;
355
449
  recipientId?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shopoflex-types",
3
- "version": "1.0.162",
3
+ "version": "1.0.166",
4
4
  "description": "Shared TypeScript types for Shopoflex applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",