@sendhome/common 1.0.240 → 1.0.243

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.
@@ -5,13 +5,17 @@ export interface BranchCreatedEvent {
5
5
  data: {
6
6
  id: string;
7
7
  branch_id: number;
8
+ slug: string;
8
9
  name: string;
9
10
  address: string;
11
+ branch_type: "company" | "agent";
10
12
  status: BranchStatus;
11
13
  module: string;
12
14
  company: string;
13
15
  country: string;
14
16
  city: string;
17
+ created_at: Date;
18
+ updated_at: Date;
15
19
  version: number;
16
20
  };
17
21
  }
@@ -5,13 +5,17 @@ export interface BranchUpdatedEvent {
5
5
  data: {
6
6
  id: string;
7
7
  branch_id: number;
8
+ slug: string;
8
9
  name: string;
9
10
  address: string;
11
+ branch_type: "company" | "agent";
10
12
  status: BranchStatus;
11
13
  module: string;
12
14
  company: string;
13
15
  country: string;
14
16
  city: string;
17
+ created_at: Date;
18
+ updated_at: Date;
15
19
  version: number;
16
20
  };
17
21
  }
@@ -31,6 +31,7 @@ export interface CompanyCreatedEvent {
31
31
  }[];
32
32
  country: string;
33
33
  currency: string;
34
+ dashboard_enabled: boolean;
34
35
  slug: string;
35
36
  created_at: Date;
36
37
  updated_at: Date;
@@ -31,6 +31,7 @@ export interface CompanyUpdatedEvent {
31
31
  }[];
32
32
  country: string;
33
33
  currency: string;
34
+ dashboard_enabled: boolean;
34
35
  slug: string;
35
36
  created_at: Date;
36
37
  updated_at: Date;
@@ -12,22 +12,21 @@ export interface ModuleCreatedEvent {
12
12
  category: Category;
13
13
  is_transport_company: boolean;
14
14
  commission: number;
15
+ apply_commission: boolean;
16
+ self_collect_enabled: boolean;
17
+ delivery_enabled: boolean;
18
+ notification_channels: {
19
+ email: boolean;
20
+ whatsapp: boolean;
21
+ };
15
22
  delivery_details: {
16
23
  category: string;
17
24
  cities: string[];
18
25
  delivery_rate: number;
19
- supported_zone_types?: ZoneType[];
20
26
  }[];
21
27
  company: string;
22
28
  receive_countries: string[];
23
29
  country: string;
24
- branches: string[];
25
- payout_bank_account?: {
26
- account_name: string;
27
- account_number: string;
28
- bank_name: string;
29
- currency: string;
30
- };
31
30
  delivery_settings: {
32
31
  delivery_enabled: boolean;
33
32
  delivery_radius_km?: number;
@@ -43,6 +42,15 @@ export interface ModuleCreatedEvent {
43
42
  status: ModuleStatus;
44
43
  created_at: Date;
45
44
  updated_at: Date;
45
+ is_delivery_partner: boolean;
46
+ delivery_routes: {
47
+ from_city: string;
48
+ to_city: string;
49
+ zone_type: ZoneType;
50
+ category: string;
51
+ fixed_fee?: number;
52
+ rate_per_km?: number;
53
+ }[];
46
54
  version: number;
47
55
  };
48
56
  }
@@ -12,6 +12,13 @@ export interface ModuleUpdatedEvent {
12
12
  category: Category;
13
13
  is_transport_company: boolean;
14
14
  commission: number;
15
+ apply_commission: boolean;
16
+ self_collect_enabled: boolean;
17
+ delivery_enabled: boolean;
18
+ notification_channels: {
19
+ email: boolean;
20
+ whatsapp: boolean;
21
+ };
15
22
  delivery_details: {
16
23
  category: string;
17
24
  cities: string[];
@@ -20,20 +27,12 @@ export interface ModuleUpdatedEvent {
20
27
  company: string;
21
28
  receive_countries: string[];
22
29
  country: string;
23
- branches: string[];
24
- payout_bank_account?: {
25
- account_name: string;
26
- account_number: string;
27
- bank_name: string;
28
- currency: string;
29
- };
30
30
  delivery_settings: {
31
31
  delivery_enabled: boolean;
32
32
  delivery_radius_km?: number;
33
33
  pricing_model: "fixed" | "per_km";
34
34
  rate_per_km?: number;
35
35
  flat_rate?: number;
36
- supported_zone_types?: ZoneType[];
37
36
  };
38
37
  module_documents: {
39
38
  type: string;
@@ -43,6 +42,15 @@ export interface ModuleUpdatedEvent {
43
42
  status: ModuleStatus;
44
43
  created_at: Date;
45
44
  updated_at: Date;
45
+ is_delivery_partner: boolean;
46
+ delivery_routes: {
47
+ from_city: string;
48
+ to_city: string;
49
+ zone_type: ZoneType;
50
+ category: string;
51
+ fixed_fee?: number;
52
+ rate_per_km?: number;
53
+ }[];
46
54
  version: number;
47
55
  };
48
56
  }
@@ -1,121 +1,57 @@
1
+ import mongoose from "mongoose";
1
2
  import { Subjects } from "../subjects/subjects";
2
3
  import { ProductStatus } from "../types/product-status";
3
4
  import { Category } from "../types/category";
4
5
  import { UnitType } from "../types/unit-type";
5
- interface IGroceriesFields {
6
- expiration_date?: Date;
7
- brand?: string;
8
- weight?: number;
9
- package_type?: string;
10
- storage_instructions?: string;
11
- expiry_date?: Date;
12
- freshness?: string;
13
- dietary_info?: string;
14
- certifications?: string;
15
- origin?: string;
16
- }
17
- interface IHardwareFields {
18
- brand?: string;
19
- model_number?: string;
20
- weight?: string;
21
- dimensions?: string;
22
- material?: string;
23
- power_source?: string;
24
- voltage?: string;
25
- warranty?: string;
26
- certifications?: string;
27
- usage?: string;
28
- safety_precautions?: string;
29
- }
30
- interface IClothingFields {
31
- brand?: string;
32
- size?: string;
33
- fit_type?: string;
34
- material?: string;
35
- color?: string;
36
- pattern?: string;
37
- sleeve_type?: string;
38
- neckline?: string;
39
- care_instructions?: string;
40
- occasion?: string;
41
- season?: string;
42
- }
43
- interface IFuelFields {
44
- brand?: string;
45
- fuel_grade?: string;
46
- octane_rating?: string;
47
- sulfur_content?: string;
48
- unit_volume?: string;
49
- emissions_rating?: string;
50
- biofuel_content?: string;
51
- storage_requirements?: string;
52
- }
53
- interface ILiquorFields {
54
- brand?: string;
55
- alcohol_content?: string;
56
- volume?: string;
57
- origin?: string;
58
- flavor_profile?: string;
59
- aging_info?: string;
60
- packaging_type?: string;
6
+ interface VariantAttribute {
7
+ name: string;
8
+ value: string;
9
+ label: string;
10
+ unit: UnitType;
11
+ }
12
+ interface IVariant {
13
+ sku: string;
14
+ combination: VariantAttribute[];
15
+ available: boolean;
16
+ media: {
17
+ images: string[];
18
+ videos?: string[];
19
+ };
20
+ attributes?: {
21
+ [key: string]: string | number;
22
+ };
61
23
  }
62
- interface IAutomotiveFields {
63
- part_type?: string;
64
- compatible_models?: string;
65
- material?: string;
66
- brand?: string;
67
- weight?: string;
68
- volume?: string;
69
- viscosity_grade?: string;
70
- specifications?: string;
71
- usage_notes?: string;
24
+ interface ITransportSchedule {
25
+ departure_time: string;
26
+ arrival_time: string;
72
27
  }
73
- interface ITransportFields {
74
- departure_city: string;
75
- destination_city: string;
76
- departure_country: string;
77
- destination_country: string;
78
- schedule: {
79
- [day: string]: {
80
- departure_times: string[];
81
- };
82
- };
28
+ interface ITransportDetails {
29
+ departure_city: mongoose.Types.ObjectId;
30
+ destination_city: mongoose.Types.ObjectId;
31
+ departure_country: mongoose.Types.ObjectId;
32
+ destination_country: mongoose.Types.ObjectId;
33
+ schedule: Map<string, ITransportSchedule[]>;
83
34
  notes?: string;
84
- bus_operator?: string;
85
- bus_type?: string;
86
- travel_duration?: string;
87
- seating_capacity?: number;
88
- luggage_allowance?: string;
89
- transit_points?: string[];
90
- amenities?: string[];
91
- ticket_instructions?: string;
92
- ticket_validity?: string;
93
- }
94
- interface IVariantDefinition {
95
- name: string;
96
- images: string[];
97
- values: string[];
98
35
  }
99
36
  export interface ProductCreatedEvent {
100
37
  subject: Subjects.ProductCreated;
101
38
  data: {
102
39
  id: string;
103
- images: string[];
104
- videos: string[];
105
40
  product_id: number;
106
41
  name: string;
107
- description: string;
108
- product_category: Category;
109
- quantity_type: "decimal" | "integer";
42
+ slug: string;
43
+ description?: string;
44
+ category: Category;
45
+ quantity_type?: "decimal" | "integer";
110
46
  brand: string;
111
- unit: UnitType;
112
- unit_value: number;
113
- variant_mode: boolean;
114
- properties: IGroceriesFields | IHardwareFields | IClothingFields | IFuelFields | ILiquorFields | IAutomotiveFields | ITransportFields | {};
115
- variants: IVariantDefinition[];
47
+ variant_mode: "single" | "multiple";
48
+ variants: IVariant[];
49
+ specifications: {
50
+ [key: string]: string | number;
51
+ };
52
+ tags: string[];
53
+ transport_details?: ITransportDetails;
116
54
  status: ProductStatus;
117
- countries: string[];
118
- slug: string;
119
55
  created_at: Date;
120
56
  updated_at: Date;
121
57
  version: number;
@@ -1,121 +1,57 @@
1
+ import mongoose from "mongoose";
1
2
  import { Subjects } from "../subjects/subjects";
2
3
  import { ProductStatus } from "../types/product-status";
3
4
  import { Category } from "../types/category";
4
5
  import { UnitType } from "../types/unit-type";
5
- interface IGroceriesFields {
6
- expiration_date?: Date;
7
- brand?: string;
8
- weight?: number;
9
- package_type?: string;
10
- storage_instructions?: string;
11
- expiry_date?: Date;
12
- freshness?: string;
13
- dietary_info?: string;
14
- certifications?: string;
15
- origin?: string;
16
- }
17
- interface IHardwareFields {
18
- brand?: string;
19
- model_number?: string;
20
- weight?: string;
21
- dimensions?: string;
22
- material?: string;
23
- power_source?: string;
24
- voltage?: string;
25
- warranty?: string;
26
- certifications?: string;
27
- usage?: string;
28
- safety_precautions?: string;
29
- }
30
- interface IClothingFields {
31
- brand?: string;
32
- size?: string;
33
- fit_type?: string;
34
- material?: string;
35
- color?: string;
36
- pattern?: string;
37
- sleeve_type?: string;
38
- neckline?: string;
39
- care_instructions?: string;
40
- occasion?: string;
41
- season?: string;
42
- }
43
- interface IFuelFields {
44
- brand?: string;
45
- fuel_grade?: string;
46
- octane_rating?: string;
47
- sulfur_content?: string;
48
- unit_volume?: string;
49
- emissions_rating?: string;
50
- biofuel_content?: string;
51
- storage_requirements?: string;
52
- }
53
- interface ILiquorFields {
54
- brand?: string;
55
- alcohol_content?: string;
56
- volume?: string;
57
- origin?: string;
58
- flavor_profile?: string;
59
- aging_info?: string;
60
- packaging_type?: string;
6
+ interface VariantAttribute {
7
+ name: string;
8
+ value: string;
9
+ label: string;
10
+ unit: UnitType;
11
+ }
12
+ interface IVariant {
13
+ sku: string;
14
+ combination: VariantAttribute[];
15
+ available: boolean;
16
+ media: {
17
+ images: string[];
18
+ videos?: string[];
19
+ };
20
+ attributes?: {
21
+ [key: string]: string | number;
22
+ };
61
23
  }
62
- interface IAutomotiveFields {
63
- part_type?: string;
64
- compatible_models?: string;
65
- material?: string;
66
- brand?: string;
67
- weight?: string;
68
- volume?: string;
69
- viscosity_grade?: string;
70
- specifications?: string;
71
- usage_notes?: string;
24
+ interface ITransportSchedule {
25
+ departure_time: string;
26
+ arrival_time: string;
72
27
  }
73
- interface ITransportFields {
74
- departure_city: string;
75
- destination_city: string;
76
- departure_country: string;
77
- destination_country: string;
78
- schedule: {
79
- [day: string]: {
80
- departure_times: string[];
81
- };
82
- };
28
+ interface ITransportDetails {
29
+ departure_city: mongoose.Types.ObjectId;
30
+ destination_city: mongoose.Types.ObjectId;
31
+ departure_country: mongoose.Types.ObjectId;
32
+ destination_country: mongoose.Types.ObjectId;
33
+ schedule: Map<string, ITransportSchedule[]>;
83
34
  notes?: string;
84
- bus_operator?: string;
85
- bus_type?: string;
86
- travel_duration?: string;
87
- seating_capacity?: number;
88
- luggage_allowance?: string;
89
- transit_points?: string[];
90
- amenities?: string[];
91
- ticket_instructions?: string;
92
- ticket_validity?: string;
93
- }
94
- interface IVariantDefinition {
95
- name: string;
96
- images: string[];
97
- values: string[];
98
35
  }
99
36
  export interface ProductUpdatedEvent {
100
37
  subject: Subjects.ProductUpdated;
101
38
  data: {
102
39
  id: string;
103
- images: string[];
104
- videos: string[];
105
40
  product_id: number;
106
41
  name: string;
107
- description: string;
108
- product_category: Category;
109
- quantity_type: "decimal" | "integer";
42
+ slug: string;
43
+ description?: string;
44
+ category: Category;
45
+ quantity_type?: "decimal" | "integer";
110
46
  brand: string;
111
- unit: UnitType;
112
- unit_value: number;
113
- variant_mode: boolean;
114
- properties: IGroceriesFields | IHardwareFields | IClothingFields | IFuelFields | ILiquorFields | IAutomotiveFields | ITransportFields | {};
115
- variants: IVariantDefinition[];
47
+ variant_mode: "single" | "multiple";
48
+ variants: IVariant[];
49
+ specifications: {
50
+ [key: string]: string | number;
51
+ };
52
+ tags: string[];
53
+ transport_details?: ITransportDetails;
116
54
  status: ProductStatus;
117
- countries: string[];
118
- slug: string;
119
55
  created_at: Date;
120
56
  updated_at: Date;
121
57
  version: number;
@@ -1,14 +1,11 @@
1
+ import mongoose from "mongoose";
1
2
  import { Subjects } from "../subjects/subjects";
2
3
  import { ProductStatus } from "../types/product-status";
3
4
  import { Category } from "../types/category";
4
- interface IVariantStock {
5
- combination: {
6
- [variant_name: string]: string;
7
- };
8
- sku?: string;
9
- available: boolean;
5
+ interface IVariantPricing {
6
+ variant_id: mongoose.Types.ObjectId;
10
7
  price: number;
11
- stock?: number;
8
+ available: boolean;
12
9
  media?: {
13
10
  images: string[];
14
11
  videos?: string[];
@@ -18,13 +15,11 @@ export interface ProductItemCreatedEvent {
18
15
  subject: Subjects.ProductItemCreated;
19
16
  data: {
20
17
  id: string;
21
- price: number;
18
+ variant_pricing: IVariantPricing[];
22
19
  currency: string;
23
20
  product_category: Category;
24
21
  category: string;
25
22
  sub_category: string;
26
- variant_mode: boolean;
27
- variants_available: IVariantStock[];
28
23
  brand: string;
29
24
  product: string;
30
25
  company: string;
@@ -1,14 +1,11 @@
1
+ import mongoose from "mongoose";
1
2
  import { Subjects } from "../subjects/subjects";
2
3
  import { ProductStatus } from "../types/product-status";
3
4
  import { Category } from "../types/category";
4
- interface IVariantStock {
5
- combination: {
6
- [variant_name: string]: string;
7
- };
8
- sku?: string;
9
- available: boolean;
5
+ interface IVariantPricing {
6
+ variant_id: mongoose.Types.ObjectId;
10
7
  price: number;
11
- stock?: number;
8
+ available: boolean;
12
9
  media?: {
13
10
  images: string[];
14
11
  videos?: string[];
@@ -18,13 +15,11 @@ export interface ProductItemUpdatedEvent {
18
15
  subject: Subjects.ProductItemUpdated;
19
16
  data: {
20
17
  id: string;
21
- price: number;
18
+ variant_pricing: IVariantPricing[];
22
19
  currency: string;
23
20
  product_category: Category;
24
21
  category: string;
25
22
  sub_category: string;
26
- variant_mode: boolean;
27
- variants_available: IVariantStock[];
28
23
  brand: string;
29
24
  product: string;
30
25
  company: string;
@@ -1,7 +1,54 @@
1
1
  export declare enum UnitType {
2
+ Piece = "pc",
3
+ Pack = "pack",
4
+ Box = "box",
5
+ Dozen = "dozen",
2
6
  Kilogram = "kg",
3
7
  Gram = "g",
4
8
  Litre = "l",
5
- Piece = "pc",
6
- Meter = "m"
9
+ Millilitre = "ml",
10
+ Bunch = "bunch",
11
+ Bottle = "bottle",
12
+ Tin = "tin",
13
+ Sachet = "sachet",
14
+ Carton = "carton",
15
+ Meter = "m",
16
+ Centimeter = "cm",
17
+ Millimeter = "mm",
18
+ Inch = "inch",
19
+ SquareMeter = "m\u00B2",
20
+ CubicMeter = "m\u00B3",
21
+ Bag = "bag",
22
+ Roll = "roll",
23
+ Length = "length",
24
+ Sheet = "sheet",
25
+ Watt = "W",
26
+ WattPeak = "Wp",
27
+ AmpHour = "Ah",
28
+ Volt = "V",
29
+ VoltAmp = "VA",
30
+ LitrePerMinute = "lpm",
31
+ Gallon = "gal",
32
+ CubicLitre = "L\u00B3",
33
+ Acre = "acre",
34
+ Hectare = "ha",
35
+ SeedlingTray = "tray",
36
+ Sack = "sack",
37
+ Tablet = "tablet",
38
+ Capsule = "capsule",
39
+ Strip = "strip",
40
+ Syringe = "syringe",
41
+ Vial = "vial",
42
+ Dose = "dose",
43
+ Drop = "drop",
44
+ Shot = "shot",
45
+ Pint = "pint",
46
+ Can = "can",
47
+ BottleSmall = "bottle_small",
48
+ BottleLarge = "bottle_large",
49
+ LitrePerKg = "l/kg",
50
+ Hour = "hr",
51
+ Minute = "min",
52
+ Second = "sec",
53
+ None = "none"
7
54
  }
@@ -3,9 +3,66 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UnitType = void 0;
4
4
  var UnitType;
5
5
  (function (UnitType) {
6
+ // 📦 General
7
+ UnitType["Piece"] = "pc";
8
+ UnitType["Pack"] = "pack";
9
+ UnitType["Box"] = "box";
10
+ UnitType["Dozen"] = "dozen";
11
+ // 🛒 Groceries
6
12
  UnitType["Kilogram"] = "kg";
7
13
  UnitType["Gram"] = "g";
8
14
  UnitType["Litre"] = "l";
9
- UnitType["Piece"] = "pc";
15
+ UnitType["Millilitre"] = "ml";
16
+ UnitType["Bunch"] = "bunch";
17
+ UnitType["Bottle"] = "bottle";
18
+ UnitType["Tin"] = "tin";
19
+ UnitType["Sachet"] = "sachet";
20
+ UnitType["Carton"] = "carton";
21
+ // 🧱 Construction & Hardware
10
22
  UnitType["Meter"] = "m";
23
+ UnitType["Centimeter"] = "cm";
24
+ UnitType["Millimeter"] = "mm";
25
+ UnitType["Inch"] = "inch";
26
+ UnitType["SquareMeter"] = "m\u00B2";
27
+ UnitType["CubicMeter"] = "m\u00B3";
28
+ UnitType["Bag"] = "bag";
29
+ UnitType["Roll"] = "roll";
30
+ UnitType["Length"] = "length";
31
+ UnitType["Sheet"] = "sheet";
32
+ // 🔋 Solar Solutions
33
+ UnitType["Watt"] = "W";
34
+ UnitType["WattPeak"] = "Wp";
35
+ UnitType["AmpHour"] = "Ah";
36
+ UnitType["Volt"] = "V";
37
+ UnitType["VoltAmp"] = "VA";
38
+ // 🚰 Water Solutions
39
+ UnitType["LitrePerMinute"] = "lpm";
40
+ UnitType["Gallon"] = "gal";
41
+ UnitType["CubicLitre"] = "L\u00B3";
42
+ // 🌾 Farming
43
+ UnitType["Acre"] = "acre";
44
+ UnitType["Hectare"] = "ha";
45
+ UnitType["SeedlingTray"] = "tray";
46
+ UnitType["Sack"] = "sack";
47
+ // 💊 Pharmacy
48
+ UnitType["Tablet"] = "tablet";
49
+ UnitType["Capsule"] = "capsule";
50
+ UnitType["Strip"] = "strip";
51
+ UnitType["Syringe"] = "syringe";
52
+ UnitType["Vial"] = "vial";
53
+ UnitType["Dose"] = "dose";
54
+ UnitType["Drop"] = "drop";
55
+ // 🍾 Liquor
56
+ UnitType["Shot"] = "shot";
57
+ UnitType["Pint"] = "pint";
58
+ UnitType["Can"] = "can";
59
+ UnitType["BottleSmall"] = "bottle_small";
60
+ UnitType["BottleLarge"] = "bottle_large";
61
+ // ⛽ Miscellaneous
62
+ UnitType["LitrePerKg"] = "l/kg";
63
+ UnitType["Hour"] = "hr";
64
+ UnitType["Minute"] = "min";
65
+ UnitType["Second"] = "sec";
66
+ // Default / fallback
67
+ UnitType["None"] = "none";
11
68
  })(UnitType = exports.UnitType || (exports.UnitType = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendhome/common",
3
- "version": "1.0.240",
3
+ "version": "1.0.243",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",