repzo 1.0.151 → 1.0.153

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.
@@ -17,14 +17,6 @@ export interface Headers {
17
17
  [key: string]: string;
18
18
  }
19
19
 
20
- interface ActivityComment {
21
- time: number;
22
- user_name: string;
23
- user_id: string;
24
- user_type: string;
25
- comment: string;
26
- }
27
-
28
20
  interface AdminCreator {
29
21
  _id: string;
30
22
  type: "admin";
@@ -252,6 +244,8 @@ export type FieldType =
252
244
  | "Separator"
253
245
  | "Heading"
254
246
  | "Media";
247
+ export type Method = "find" | "get" | "create" | "update" | "patch" | "remove";
248
+
255
249
  export interface WeeklyDetails {
256
250
  every: number;
257
251
  days: Day[];
@@ -375,6 +369,14 @@ export type DocumentTypes =
375
369
  | "ocrInvoiceJobGroup";
376
370
 
377
371
  export type PrintTypes = "workorder" | "form" | "invoice" | "proforma";
372
+ type Granularity =
373
+ | "Year"
374
+ | "Year Month"
375
+ | "Year Week"
376
+ | "Month"
377
+ | "Year Month Day"
378
+ | "Year Month Day Time"
379
+ | "Year Month Day Time Offset";
378
380
 
379
381
  export interface MediaDoc {
380
382
  _id?: string;
@@ -550,6 +552,7 @@ export namespace Service {
550
552
  updatedAt: string;
551
553
  __v: number;
552
554
  }
555
+ export type Data = ClientSchema;
553
556
  export interface CreateBody {
554
557
  name?: string;
555
558
  local_name?: string;
@@ -3095,7 +3098,7 @@ export namespace Service {
3095
3098
  populatedKeys?: PopulatedKeys[];
3096
3099
  withProductLines?: boolean;
3097
3100
  }
3098
- export type Result = RepSchema;
3101
+ export type Result = RepWithPopulatedKeysSchema;
3099
3102
  }
3100
3103
 
3101
3104
  export namespace Create {
@@ -4052,6 +4055,7 @@ export namespace Service {
4052
4055
  createdAt: string;
4053
4056
  updatedAt: string;
4054
4057
  }
4058
+ export type Data = CustomListSchema;
4055
4059
  export interface CreateBody {
4056
4060
  code: string;
4057
4061
  name: string;
@@ -4732,6 +4736,7 @@ export namespace Service {
4732
4736
  createdAt: Date;
4733
4737
  updatedAt: Date;
4734
4738
  }
4739
+ export type Data = VisitSchema;
4735
4740
  export interface CreateBody {
4736
4741
  geoPoint: {
4737
4742
  type: "Point";
@@ -5287,6 +5292,7 @@ export namespace Service {
5287
5292
  createdAt: Date;
5288
5293
  updatedAt: Date;
5289
5294
  }
5295
+ export type Data = WorkorderSchema;
5290
5296
  export interface PopulatedData {
5291
5297
  _id: StringId;
5292
5298
  name: string;
@@ -6267,6 +6273,7 @@ export namespace Service {
6267
6273
  device_id?: string;
6268
6274
  device_unique_id?: string;
6269
6275
  }
6276
+ export type Data = InvoiceSchema;
6270
6277
  export interface CreateBody {
6271
6278
  items?: Item.Body[];
6272
6279
  return_items?: Item.Body[];
@@ -7006,6 +7013,7 @@ export namespace Service {
7006
7013
  updatedAt: string;
7007
7014
  __v: number;
7008
7015
  }
7016
+ export type Data = ProformaSchema;
7009
7017
  export interface CreateBody {
7010
7018
  items: Item.Schema[];
7011
7019
  return_items?: Item.Schema[];
@@ -7477,6 +7485,7 @@ export namespace Service {
7477
7485
  ending_balance?: number;
7478
7486
  __v: number;
7479
7487
  }
7488
+ export type Data = PaymentSchema;
7480
7489
  export interface CreateBody {
7481
7490
  amount: number;
7482
7491
  client_id: string;
@@ -7624,6 +7633,7 @@ export namespace Service {
7624
7633
  updatedAt: string;
7625
7634
  __v: number;
7626
7635
  }
7636
+ export type Data = RefundSchema;
7627
7637
  export interface CreateBody {
7628
7638
  amount: number;
7629
7639
  client_id: string;
@@ -7725,6 +7735,7 @@ export namespace Service {
7725
7735
  export type Result = RefundSchema;
7726
7736
  }
7727
7737
  }
7738
+
7728
7739
  export namespace Settlement {
7729
7740
  export interface SettlementSchema {
7730
7741
  _id: string;
@@ -7753,9 +7764,11 @@ export namespace Service {
7753
7764
  company_namespace: string[];
7754
7765
  sync_id: string;
7755
7766
  transaction_processed: boolean;
7767
+ media?: StringId[];
7756
7768
  createdAt: Date;
7757
7769
  updatedAt: Date;
7758
7770
  }
7771
+ export type Data = SettlementSchema;
7759
7772
  export interface CreateBody {
7760
7773
  amount: number;
7761
7774
  time?: number;
@@ -7782,13 +7795,15 @@ export namespace Service {
7782
7795
  company_namespace: string[];
7783
7796
  sync_id: string;
7784
7797
  transaction_processed: boolean;
7798
+ media?: StringId[];
7785
7799
  }
7786
7800
 
7787
7801
  type SettlementSchemaWithPopulatedKeys = SettlementSchema & {
7788
7802
  teams_populated?: string[] | Team.TeamSchema[];
7789
7803
  check_populated?: string | Check.CheckSchema;
7804
+ media_populated?: StringId[] | MediaPopulated[];
7790
7805
  };
7791
- type PopulatedKeys = "teams" | "check_id";
7806
+ type PopulatedKeys = "teams" | "check_id" | "media";
7792
7807
  export namespace Find {
7793
7808
  export type Params = DefaultPaginationQueryParams & {
7794
7809
  _id?: StringId[] | StringId;
@@ -8172,6 +8187,7 @@ export namespace Service {
8172
8187
  createdAt: string;
8173
8188
  updatedAt: string;
8174
8189
  }
8190
+ export type Data = ReceivingMaterialSchema;
8175
8191
  export interface CreateBody {
8176
8192
  from: string;
8177
8193
  to: string;
@@ -8541,6 +8557,7 @@ export namespace Service {
8541
8557
  updatedAt: string;
8542
8558
  __v: number;
8543
8559
  }
8560
+ export type Data = Schema;
8544
8561
  }
8545
8562
 
8546
8563
  export namespace Transfer {
@@ -8581,6 +8598,7 @@ export namespace Service {
8581
8598
  updatedAt: string;
8582
8599
  __v: number;
8583
8600
  }
8601
+ export type Data = Schema;
8584
8602
  export interface CreateBody {
8585
8603
  serial_number?: SerialNumber;
8586
8604
  time: number;
@@ -14342,63 +14360,1812 @@ export namespace Service {
14342
14360
  export type Result = Data;
14343
14361
  }
14344
14362
  }
14345
- }
14346
14363
 
14347
- export type StringId = string;
14348
- export type NameSpaces = string[];
14349
- export interface Admin {
14350
- _id: StringId;
14351
- name?: string;
14352
- type: "admin";
14353
- admin?: StringId;
14354
- }
14355
- export interface Rep {
14356
- _id: StringId;
14357
- name?: string;
14358
- type: "rep";
14359
- rep?: StringId;
14360
- }
14361
- export interface AdminOrRep {
14362
- _id: StringId;
14363
- name?: string;
14364
- type: "admin" | "rep";
14365
- admin?: StringId;
14366
- rep?: StringId;
14367
- }
14368
- export interface AdminOrRepOrTenant {
14369
- _id: StringId;
14370
- type: "admin" | "rep" | "tenant";
14371
- name?: string;
14372
- admin?: StringId;
14373
- rep?: StringId;
14374
- tenant?: StringId;
14375
- }
14376
- interface ValidityCheck {
14377
- valid: boolean;
14378
- reasons: { message: string; code: string }[];
14379
- }
14380
- type PopulatedMediaStorage = Pick<
14381
- Service.MediaStorage.MediaStorageSchema,
14382
- | "_id"
14383
- | "createdAt"
14384
- | "ContentType"
14385
- | "media_type"
14386
- | "mime_type"
14387
- | "publicUrl"
14388
- | "type_name"
14389
- | "file_name"
14390
- | "media_id"
14391
- | "thumbnails"
14392
- | "createdAt"
14393
- > & {
14394
- thumbnails: Pick<
14395
- Service.MediaStorage.Thumbnail,
14396
- | "_id"
14397
- | "ContentType"
14398
- | "mime_type"
14399
- | "publicUrl"
14400
- | "type_name"
14401
- | "file_name"
14402
- | "createdAt"
14403
- >[];
14404
- };
14364
+ export namespace ActivityPhoto {
14365
+ export interface Data {
14366
+ _id: string;
14367
+ photo?: string;
14368
+ media: string[];
14369
+ caption?: string;
14370
+ photo_meta: {
14371
+ device_orientation?: 1 | 2 | 3 | 4;
14372
+ height?: 1 | 2 | 3 | 4;
14373
+ width?: 1 | 2 | 3 | 4;
14374
+ };
14375
+ geo_tag: GeoTag;
14376
+ time: number;
14377
+ tags?: string[];
14378
+ visit_id: string;
14379
+ user: string;
14380
+ client: string;
14381
+ visit?: string;
14382
+ client_name: string;
14383
+ user_name: string;
14384
+ sync_id: string;
14385
+ route?: string;
14386
+ platform?: string;
14387
+ version_name?: string;
14388
+ battery_level?: number;
14389
+ device_brand?: string;
14390
+ device_os?: string;
14391
+ device_os_version?: string;
14392
+ device_model?: string;
14393
+ time_zone?: string;
14394
+ identifier?: number;
14395
+ device_id?: string;
14396
+ device_unique_id?: string;
14397
+ teams?: string[];
14398
+ reviewed_by: ActivityReview[];
14399
+ network_state?: number;
14400
+ admin_notes: ActivityAdminNote[];
14401
+ comments: ActivityComment[];
14402
+ company_namespace: string[];
14403
+ job_start_time?: number;
14404
+ job_end_time?: number;
14405
+ job_duration?: number;
14406
+ createdAt: string;
14407
+ updatedAt: string;
14408
+ }
14409
+ }
14410
+
14411
+ export namespace ActivityNote {
14412
+ export interface Data {
14413
+ _id: string;
14414
+ content: string;
14415
+ geo_tag: GeoTag;
14416
+ time: number;
14417
+ tags?: string[];
14418
+ visit_id: string;
14419
+ user: string;
14420
+ client: string;
14421
+ visit?: string;
14422
+ client_name: string;
14423
+ user_name: string;
14424
+ sync_id: string;
14425
+ route?: string;
14426
+ platform?: string;
14427
+ version_name?: string;
14428
+ battery_level?: number;
14429
+ device_brand?: string;
14430
+ device_os?: string;
14431
+ device_os_version?: string;
14432
+ device_model?: string;
14433
+ time_zone?: string;
14434
+ identifier?: number;
14435
+ device_id?: string;
14436
+ device_unique_id?: string;
14437
+ teams?: string[];
14438
+ reviewed_by: ActivityReview[];
14439
+ network_state?: number;
14440
+ admin_notes: ActivityAdminNote[];
14441
+ comments: ActivityComment[];
14442
+ company_namespace: string[];
14443
+ job_start_time?: number;
14444
+ job_end_time?: number;
14445
+ job_duration?: number;
14446
+ createdAt: string;
14447
+ updatedAt: string;
14448
+ }
14449
+ }
14450
+
14451
+ export namespace ActivityTask {
14452
+ export interface Data {
14453
+ _id: string;
14454
+ start_photo?: string;
14455
+ end_photo?: string;
14456
+ start_media?: string[];
14457
+ end_media?: string[];
14458
+ caption?: string;
14459
+ start_photo_meta?: {
14460
+ device_orientation?: 1 | 2 | 3 | 4;
14461
+ height?: 1 | 2 | 3 | 4;
14462
+ width?: 1 | 2 | 3 | 4;
14463
+ };
14464
+ end_photo_meta?: {
14465
+ device_orientation?: 1 | 2 | 3 | 4;
14466
+ height?: 1 | 2 | 3 | 4;
14467
+ width?: 1 | 2 | 3 | 4;
14468
+ };
14469
+ start_time: number;
14470
+ end_time: number;
14471
+ total_time?: string;
14472
+ geo_tag: GeoTag;
14473
+ time: number;
14474
+ tags?: string[];
14475
+ visit_id: string;
14476
+ user: string;
14477
+ client: string;
14478
+ visit?: string;
14479
+ client_name: string;
14480
+ user_name: string;
14481
+ sync_id: string;
14482
+ route?: string;
14483
+ platform?: string;
14484
+ version_name?: string;
14485
+ battery_level?: number;
14486
+ device_brand?: string;
14487
+ device_os?: string;
14488
+ device_os_version?: string;
14489
+ device_model?: string;
14490
+ time_zone?: string;
14491
+ identifier?: number;
14492
+ device_id?: string;
14493
+ device_unique_id?: string;
14494
+ teams?: string[];
14495
+ reviewed_by: ActivityReview[];
14496
+ network_state?: number;
14497
+ admin_notes: ActivityAdminNote[];
14498
+ comments: ActivityComment[];
14499
+ company_namespace: string[];
14500
+ job_start_time?: number;
14501
+ job_end_time?: number;
14502
+ job_duration?: number;
14503
+ createdAt: string;
14504
+ updatedAt: string;
14505
+ }
14506
+ }
14507
+
14508
+ export namespace ActivityAudit {
14509
+ interface Inventory {
14510
+ store_qun?: number;
14511
+ shelf_qun?: number;
14512
+ shelf_price?: number;
14513
+ exp_date: number;
14514
+ photo?: string;
14515
+ media?: string[];
14516
+ caption?: string;
14517
+ photo_meta?: {
14518
+ device_orientation?: 1 | 2 | 3 | 4;
14519
+ height?: 1 | 2 | 3 | 4;
14520
+ width?: 1 | 2 | 3 | 4;
14521
+ };
14522
+ note?: string;
14523
+ }
14524
+
14525
+ interface AuditItem {
14526
+ product_name: string;
14527
+ product_id: string;
14528
+ product_sub_category?: string;
14529
+ product_category?: string;
14530
+ productCategory?: string;
14531
+ productSubCategory?: string[];
14532
+ product_sku?: string;
14533
+ product_barcode?: string;
14534
+ audit_time: number;
14535
+ inventories: Inventory[];
14536
+ note?: string;
14537
+ }
14538
+
14539
+ export interface Data {
14540
+ _id: string;
14541
+ geo_tag: GeoTag;
14542
+ time: number;
14543
+ tags?: string[];
14544
+ visit_id: string;
14545
+ user: string;
14546
+ client: string;
14547
+ visit?: string;
14548
+ client_name: string;
14549
+ user_name: string;
14550
+ sync_id: string;
14551
+ route?: string;
14552
+ platform?: string;
14553
+ version_name?: string;
14554
+ battery_level?: number;
14555
+ device_brand?: string;
14556
+ device_os?: string;
14557
+ device_os_version?: string;
14558
+ device_model?: string;
14559
+ time_zone?: string;
14560
+ identifier?: number;
14561
+ device_id?: string;
14562
+ device_unique_id?: string;
14563
+ teams?: string[];
14564
+ reviewed_by: ActivityReview[];
14565
+ network_state?: number;
14566
+ admin_notes: ActivityAdminNote[];
14567
+ comments: ActivityComment[];
14568
+ company_namespace: string[];
14569
+ job_start_time?: number;
14570
+ job_end_time?: number;
14571
+ job_duration?: number;
14572
+ audits: AuditItem[];
14573
+ createdAt: string;
14574
+ updatedAt: string;
14575
+ }
14576
+ }
14577
+
14578
+ export namespace ActivityAvailability {
14579
+ export interface Data {
14580
+ _id: string;
14581
+ geo_tag: GeoTag;
14582
+ time: number;
14583
+ tags?: string[];
14584
+ visit_id: string;
14585
+ user: string;
14586
+ client: string;
14587
+ visit?: string;
14588
+ client_name: string;
14589
+ user_name: string;
14590
+ sync_id: string;
14591
+ route?: string;
14592
+ platform?: string;
14593
+ version_name?: string;
14594
+ battery_level?: number;
14595
+ device_brand?: string;
14596
+ device_os?: string;
14597
+ device_os_version?: string;
14598
+ device_model?: string;
14599
+ time_zone?: string;
14600
+ identifier?: number;
14601
+ device_id?: string;
14602
+ device_unique_id?: string;
14603
+ teams?: string[];
14604
+ reviewed_by: ActivityReview[];
14605
+ network_state?: number;
14606
+ admin_notes: ActivityAdminNote[];
14607
+ comments: ActivityComment[];
14608
+ company_namespace: string[];
14609
+ job_start_time?: number;
14610
+ job_end_time?: number;
14611
+ job_duration?: number;
14612
+ msl_id: string;
14613
+ products_available: {
14614
+ product_id: string;
14615
+ available: boolean;
14616
+ }[];
14617
+ createdAt: string;
14618
+ updatedAt: string;
14619
+ }
14620
+ }
14621
+
14622
+ export namespace ActivityCheckoutDisplay {
14623
+ export interface Data {
14624
+ _id: string;
14625
+ msl_id: string;
14626
+ checkout_count: number;
14627
+ geo_tag: GeoTag;
14628
+ time: number;
14629
+ tags?: string[];
14630
+ visit_id: string;
14631
+ user: string;
14632
+ client: string;
14633
+ visit?: string;
14634
+ client_name: string;
14635
+ user_name: string;
14636
+ sync_id: string;
14637
+ route?: string;
14638
+ platform?: string;
14639
+ version_name?: string;
14640
+ battery_level?: number;
14641
+ device_brand?: string;
14642
+ device_os?: string;
14643
+ device_os_version?: string;
14644
+ device_model?: string;
14645
+ time_zone?: string;
14646
+ identifier?: number;
14647
+ device_id?: string;
14648
+ device_unique_id?: string;
14649
+ teams?: string[];
14650
+ reviewed_by: ActivityReview[];
14651
+ network_state?: number;
14652
+ admin_notes: ActivityAdminNote[];
14653
+ comments: ActivityComment[];
14654
+ company_namespace: string[];
14655
+ job_start_time?: number;
14656
+ job_end_time?: number;
14657
+ job_duration?: number;
14658
+ createdAt: string;
14659
+ updatedAt: string;
14660
+ }
14661
+ }
14662
+
14663
+ export namespace ActivityFeedback {
14664
+ export interface Data {
14665
+ _id: string;
14666
+ visit_id: string;
14667
+ visit_UUID: string;
14668
+ feed_back_option: string;
14669
+ route?: string;
14670
+ teams?: string[];
14671
+ company_namespace: string[];
14672
+ createdAt: string;
14673
+ updatedAt: string;
14674
+ }
14675
+ }
14676
+
14677
+ export namespace ActivityFormResult {
14678
+ export interface Data {
14679
+ _id: string;
14680
+ serial_number?: SerialNumber;
14681
+ form_id: string;
14682
+ results: { [key: string]: any };
14683
+ geo_tag: GeoTag;
14684
+ time: number;
14685
+ tags?: string[];
14686
+ visit_id: string;
14687
+ user: string;
14688
+ client: string;
14689
+ visit?: string;
14690
+ client_name: string;
14691
+ user_name: string;
14692
+ sync_id: string;
14693
+ route?: string;
14694
+ platform?: string;
14695
+ version_name?: string;
14696
+ battery_level?: number;
14697
+ device_brand?: string;
14698
+ device_os?: string;
14699
+ device_os_version?: string;
14700
+ device_model?: string;
14701
+ time_zone?: string;
14702
+ identifier?: number;
14703
+ device_id?: string;
14704
+ device_unique_id?: string;
14705
+ teams?: string[];
14706
+ reviewed_by: ActivityReview[];
14707
+ network_state?: number;
14708
+ admin_notes: ActivityAdminNote[];
14709
+ comments: ActivityComment[];
14710
+ company_namespace: string[];
14711
+ job_start_time?: number;
14712
+ job_end_time?: number;
14713
+ job_duration?: number;
14714
+ workorder?: string;
14715
+ asset?: string;
14716
+ asset_unit?: string;
14717
+ createdAt: string;
14718
+ updatedAt: string;
14719
+ }
14720
+ }
14721
+
14722
+ export namespace AvailableField {
14723
+ export interface Data {
14724
+ patch_filter_key: string;
14725
+ patch_filter_slug:
14726
+ | "activity-storecheck"
14727
+ | "client"
14728
+ | "variant"
14729
+ | "product"
14730
+ | "product-group"
14731
+ | "product-brand"
14732
+ | "product-category"
14733
+ | "product-sub-category"
14734
+ | "measureunits"
14735
+ | "rep"
14736
+ | "tag"
14737
+ | "client-channel"
14738
+ | "paymentterms"
14739
+ | "speciality"
14740
+ | "activity-form-v2-result"
14741
+ | "bi-bucket";
14742
+ code: string; // unique key
14743
+ formula_key?: string;
14744
+ field_type:
14745
+ | "activity_attribute"
14746
+ | "source_attribute"
14747
+ | "template_field"
14748
+ | "calculated_field";
14749
+ data_type:
14750
+ | "Separator"
14751
+ | "timestamp"
14752
+ | "String"
14753
+ | "Number"
14754
+ | "Boolean"
14755
+ | "Date"
14756
+ | "Image"
14757
+ | "coords"
14758
+ | "Text"
14759
+ | "Media"
14760
+ | "Heading"
14761
+ | "List"
14762
+ | "Phone"
14763
+ | "Email"
14764
+ | "Signature"
14765
+ | "DateTime"
14766
+ | "YesNo"
14767
+ | "ProductBarcodeScan"
14768
+ | "BarcodeScan"
14769
+ | "GeoPoint";
14770
+ key: string;
14771
+ field_id?: string;
14772
+ isArray: boolean;
14773
+ array_delimiter?: string;
14774
+ label: string;
14775
+ manipulator_function?: string;
14776
+ lookup?: {
14777
+ from: string;
14778
+ select: string;
14779
+ unwind: boolean;
14780
+ filter?: {
14781
+ as: string;
14782
+ cond: any;
14783
+ };
14784
+ };
14785
+ granularity?: Granularity;
14786
+ current_granularity?: Granularity;
14787
+ }
14788
+ }
14789
+
14790
+ export namespace FormV2 {
14791
+ interface Visibility {
14792
+ operator: "and" | "or";
14793
+ conditions: {
14794
+ division_id: string;
14795
+ field_id: string;
14796
+ type: "Boolean" | "List" | "YesNo"; // FieldType;
14797
+ custom_list?: string | CustomList.Data;
14798
+ operator: "lte" | "lt" | "gte" | "gt" | "eq" | "ne" | "in" | "nin";
14799
+ value: any[];
14800
+ }[];
14801
+ }
14802
+
14803
+ export const fieldType_enums = [
14804
+ "Text", // Long Text
14805
+ "String", // Short Text
14806
+ "Phone", // phone
14807
+ "Email", // email
14808
+ "Date", // Date
14809
+ // "Boolean", // No need any more in this form
14810
+ "Number", // Number
14811
+ "List", // List => custom List with ref or template (Allow multi, not only for media)
14812
+ "Separator", // Separator
14813
+ "Heading", // Heading
14814
+ "Media", // Media + phone + Image
14815
+ "Signature", // signature
14816
+ "DateTime", // timestamp
14817
+ "YesNo", // Yes/No/NA (with disable N/A option )
14818
+ "ProductBarcodeScan", // String
14819
+ "BarcodeScan", // String
14820
+ "GeoPoint", // { coordinates: [0, 0], type: "Point" }
14821
+ ] as const;
14822
+
14823
+ export type FormV2FieldType = (typeof fieldType_enums)[number];
14824
+ interface FieldPrintSettings {
14825
+ three_inch: {
14826
+ grid_column?: 1 | 2;
14827
+ alignment?: "right" | "left" | "center";
14828
+ border_width?: number;
14829
+ label_font_size?: number;
14830
+ value_font_size?: number;
14831
+ media_height?: number | string;
14832
+ media_width?: number | string;
14833
+ align_media?: "right" | "left" | "center";
14834
+ label_value_spacing?: number;
14835
+ is_hidden?: boolean;
14836
+ };
14837
+ }
14838
+ interface UsedField {
14839
+ code: string;
14840
+ key: string;
14841
+ data_type: AvailableField.Data["data_type"];
14842
+ field_type:
14843
+ | "template_field"
14844
+ // | "calculated_field"
14845
+ | "source_attribute"
14846
+ | "activity_attribute";
14847
+ label: string;
14848
+ isArray?: boolean;
14849
+ formula_key: string;
14850
+ field_id?: string;
14851
+ example_value: AvailableField.Data["data_type"];
14852
+ manipulator_function?: string;
14853
+ lookup?: {
14854
+ from?: string;
14855
+ localField?: string;
14856
+ foreignField?: string;
14857
+ as?: string;
14858
+ select?: string;
14859
+ unwind?: boolean;
14860
+ filter?: {
14861
+ input?: string;
14862
+ as: string;
14863
+ cond: any;
14864
+ };
14865
+ };
14866
+ }
14867
+ export interface Field {
14868
+ _id?: string;
14869
+ name: string;
14870
+ local_name?: string;
14871
+ description?: string;
14872
+ local_description?: string;
14873
+ type: FormV2FieldType;
14874
+ isArray?: boolean;
14875
+ isRequired?: boolean;
14876
+ disabled?: boolean;
14877
+ formula_key?: string;
14878
+ scoring_enabled?: boolean;
14879
+ required_for_completion?: boolean;
14880
+ visibility?: Visibility;
14881
+ default_value?: any[];
14882
+ custom_list?: string | CustomList.Data;
14883
+ is_na_allowed?: boolean;
14884
+ score_accumulator_type?: "max" | "sum";
14885
+ yes_score?: number;
14886
+ no_score?: number;
14887
+ na_score?: number;
14888
+ exist_score?: number;
14889
+ media?: (string | MediaDoc)[];
14890
+ invisible: boolean;
14891
+ parent_field?: string;
14892
+ custom_list_element?: string;
14893
+ force_live_photo?: boolean;
14894
+ min?: number;
14895
+ max?: number;
14896
+ is_integer?: boolean;
14897
+ styles?: "check_list" | "toggle_yes_no_na" | "toggle_yes_no" | "buttons";
14898
+ field_print_settings?: FieldPrintSettings;
14899
+ is_calculated_field?: boolean;
14900
+ formula?: string;
14901
+ used_fields?: UsedField[];
14902
+ }
14903
+
14904
+ interface Division {
14905
+ _id: string;
14906
+ name: string;
14907
+ local_name?: string;
14908
+ description?: string;
14909
+ local_description?: string;
14910
+ disabled?: boolean;
14911
+ min_questions_to_answer_for_completion?: number;
14912
+ min_score_for_completion?: number;
14913
+ visibility?: Visibility;
14914
+ fields: Field[];
14915
+ }
14916
+ interface PrintSettings {
14917
+ three_inch: {
14918
+ grid_columns?: 1 | 2;
14919
+ logo_height?: number | string;
14920
+ logo_width?: number | string;
14921
+ align_logo?: "right" | "left" | "center";
14922
+ space_y?: number;
14923
+ };
14924
+ A_four: {
14925
+ banner_media?: string;
14926
+ banner_height: number;
14927
+ banner_width: number;
14928
+ align_banner: "right" | "left" | "center";
14929
+ header_label_font_size: number;
14930
+ header_value_font_size: number;
14931
+ align_header: "right" | "left" | "center";
14932
+ division_name_font_size: number;
14933
+ align_division: "right" | "left" | "center";
14934
+ grid_columns: 1 | 2 | 3 | 4;
14935
+ space_y: number;
14936
+ field_label_size: number;
14937
+ field_value_size: number;
14938
+ footer_media?: string;
14939
+ align_footer_media: "right" | "left" | "center";
14940
+ footer_media_height: number;
14941
+ footer_media_width: number;
14942
+ footer_details: string;
14943
+ align_footer_details: "right" | "left" | "center";
14944
+ compressed_media_size:
14945
+ | "original"
14946
+ | "small"
14947
+ | "medium"
14948
+ | "large"
14949
+ | "extra";
14950
+ view_custom_list_element: boolean;
14951
+ };
14952
+ }
14953
+
14954
+ export interface Data {
14955
+ _id: string;
14956
+ disabled: boolean;
14957
+ name: string;
14958
+ local_name?: string;
14959
+ description?: string;
14960
+ local_description?: string;
14961
+ copied_from?: string;
14962
+ scoring_enabled?: boolean;
14963
+ completion_rules_enabled?: boolean;
14964
+ min_questions_to_answer_for_completion?: number;
14965
+ min_score_for_completion?: number;
14966
+ divisions: Division[];
14967
+ company_namespace: string[];
14968
+ print_settings?: PrintSettings;
14969
+ createdAt: Date;
14970
+ updatedAt: Date;
14971
+ }
14972
+ }
14973
+
14974
+ export namespace ActivityFormV2Result {
14975
+ const fieldType_enums = [
14976
+ "Text", // Long Text
14977
+ "String", // Short Text
14978
+ "Phone", // phone
14979
+ "Email", // email
14980
+ "Date", // Date
14981
+ // "Boolean", // No need any more in this form
14982
+ "Number", // Number
14983
+ "List", // List => custom List with ref or template (Allow multi, not only for media)
14984
+ "Separator", // Separator
14985
+ "Heading", // Heading
14986
+ "Media", // Media + phone + Image
14987
+ "Signature", // signature
14988
+ "DateTime", // timestamp
14989
+ "YesNo", // Yes/No/NA (with disable N/A option )
14990
+ "ProductBarcodeScan", // String
14991
+ "BarcodeScan", // String
14992
+ "GeoPoint", // { coordinates: [0, 0], type: "Point" }
14993
+ ] as const;
14994
+ type FormV2FieldType = (typeof fieldType_enums)[number];
14995
+
14996
+ interface FieldResult {
14997
+ _id?: string;
14998
+ field_id: string;
14999
+ name: string;
15000
+ type: FormV2FieldType;
15001
+ isArray?: boolean;
15002
+ isRequired?: boolean;
15003
+ custom_list?: string;
15004
+ formula_key?: string;
15005
+ is_calculated_field?: boolean;
15006
+ calculation_status?: "success" | "failed";
15007
+ calculation_error?: any[];
15008
+ score?: number;
15009
+ is_completed?: boolean;
15010
+ result:
15011
+ | string[]
15012
+ | number[]
15013
+ | ["yes"]
15014
+ | ["no"]
15015
+ | ["na"]
15016
+ | []
15017
+ | { coordinates: [number, number]; type: "Point" }[]
15018
+ | {
15019
+ _id: string;
15020
+ value: string | number;
15021
+ type: "Number" | "String";
15022
+ score?: number;
15023
+ }[];
15024
+ }
15025
+
15026
+ interface DivisionResult {
15027
+ _id: string;
15028
+ division_id: string;
15029
+ name: string;
15030
+ score?: number;
15031
+ is_completed?: boolean;
15032
+ fields: FieldResult[];
15033
+ }
15034
+
15035
+ export interface Data {
15036
+ _id: string;
15037
+ creator: AdminOrRepOrTenantOrClient;
15038
+ editor?: AdminOrRepOrTenantOrClient;
15039
+ serial_number: SerialNumber;
15040
+ teams: string[];
15041
+ tags: string[];
15042
+ time: number;
15043
+ client?: string;
15044
+ client_name?: string;
15045
+ visit?: string;
15046
+ visit_id?: string;
15047
+ route?: string;
15048
+ workorder?: string;
15049
+ sync_id: string;
15050
+ // mobile data
15051
+ geo_tag?: GeoTag;
15052
+ geoPoint?: GeoPoint;
15053
+ platform?: string;
15054
+ version_name?: string;
15055
+ battery_level?: number;
15056
+ device_brand?: string;
15057
+ device_os?: string;
15058
+ device_os_version?: string;
15059
+ device_model?: string;
15060
+ identifier?: number;
15061
+ device_id?: string;
15062
+ device_unique_id?: string;
15063
+ network_state?: number;
15064
+ time_zone?: string;
15065
+ job_start_time?: number;
15066
+ job_end_time?: number;
15067
+ job_duration?: number;
15068
+ form_id: string;
15069
+ results: DivisionResult[];
15070
+ score?: number;
15071
+ is_completed: boolean;
15072
+ company_namespace: string[];
15073
+ createdAt: Date;
15074
+ updatedAt: Date;
15075
+ }
15076
+ }
15077
+
15078
+ export namespace ActivityItemStatus {
15079
+ type ItemStatus =
15080
+ | "current_user"
15081
+ | "non_user"
15082
+ | "generic_user"
15083
+ | "competitor_user"
15084
+ | "other";
15085
+
15086
+ interface Item {
15087
+ product: string;
15088
+ product_name: string;
15089
+ status: ItemStatus;
15090
+ item_status_type?: string;
15091
+ feedback?: string;
15092
+ note?: string;
15093
+ feedback_current_user?: number;
15094
+ previous_status?: ItemStatus;
15095
+ previous_status_id?: string;
15096
+ previous_user?: string;
15097
+ previous_user_name?: string;
15098
+ previous_time?: number;
15099
+ }
15100
+
15101
+ export interface Data {
15102
+ _id: string;
15103
+ items: Item[];
15104
+ geoPoint: GeoPoint;
15105
+ time: number;
15106
+ tags?: string[];
15107
+ visit_id: string;
15108
+ user: string;
15109
+ client: string;
15110
+ visit?: string;
15111
+ client_name: string;
15112
+ user_name: string;
15113
+ sync_id: string;
15114
+ route?: string;
15115
+ platform?: string;
15116
+ version_name?: string;
15117
+ battery_level?: number;
15118
+ device_brand?: string;
15119
+ device_os?: string;
15120
+ device_os_version?: string;
15121
+ device_model?: string;
15122
+ time_zone?: string;
15123
+ identifier?: number;
15124
+ device_id?: string;
15125
+ device_unique_id?: string;
15126
+ teams?: string[];
15127
+ reviewed_by: ActivityReview[];
15128
+ network_state?: number;
15129
+ admin_notes: ActivityAdminNote[];
15130
+ comments: ActivityComment[];
15131
+ company_namespace: string[];
15132
+ job_start_time?: number;
15133
+ job_end_time?: number;
15134
+ job_duration?: number;
15135
+ createdAt: string;
15136
+ updatedAt: string;
15137
+ }
15138
+ }
15139
+
15140
+ export namespace ActivityPlanogram {
15141
+ export interface Data {
15142
+ _id: string;
15143
+ msl_id: string;
15144
+ media?: string[];
15145
+ actual_planogram_imgs?: string[];
15146
+ does_planogram_comply: boolean;
15147
+ planogram_reason?: string;
15148
+ geo_tag: GeoTag;
15149
+ time: number;
15150
+ tags?: string[];
15151
+ visit_id: string;
15152
+ user: string;
15153
+ client: string;
15154
+ visit?: string;
15155
+ client_name: string;
15156
+ user_name: string;
15157
+ sync_id: string;
15158
+ route?: string;
15159
+ platform?: string;
15160
+ version_name?: string;
15161
+ battery_level?: number;
15162
+ device_brand?: string;
15163
+ device_os?: string;
15164
+ device_os_version?: string;
15165
+ device_model?: string;
15166
+ time_zone?: string;
15167
+ identifier?: number;
15168
+ device_id?: string;
15169
+ device_unique_id?: string;
15170
+ teams?: string[];
15171
+ reviewed_by: ActivityReview[];
15172
+ network_state?: number;
15173
+ admin_notes: ActivityAdminNote[];
15174
+ comments: ActivityComment[];
15175
+ company_namespace: string[];
15176
+ job_start_time?: number;
15177
+ job_end_time?: number;
15178
+ job_duration?: number;
15179
+ createdAt: string;
15180
+ updatedAt: string;
15181
+ }
15182
+ }
15183
+
15184
+ export namespace ActivitySecondaryDisplay {
15185
+ export interface Data {
15186
+ _id: string;
15187
+ secondary_count: number;
15188
+ msl_id: string;
15189
+ geo_tag: GeoTag;
15190
+ time: number;
15191
+ tags?: string[];
15192
+ visit_id: string;
15193
+ user: string;
15194
+ client: string;
15195
+ visit?: string;
15196
+ client_name: string;
15197
+ user_name: string;
15198
+ sync_id: string;
15199
+ route?: string;
15200
+ platform?: string;
15201
+ version_name?: string;
15202
+ battery_level?: number;
15203
+ device_brand?: string;
15204
+ device_os?: string;
15205
+ device_os_version?: string;
15206
+ device_model?: string;
15207
+ time_zone?: string;
15208
+ identifier?: number;
15209
+ device_id?: string;
15210
+ device_unique_id?: string;
15211
+ teams?: string[];
15212
+ reviewed_by: ActivityReview[];
15213
+ network_state?: number;
15214
+ admin_notes: ActivityAdminNote[];
15215
+ comments: ActivityComment[];
15216
+ company_namespace: string[];
15217
+ job_start_time?: number;
15218
+ job_end_time?: number;
15219
+ job_duration?: number;
15220
+ createdAt: string;
15221
+ updatedAt: string;
15222
+ }
15223
+ }
15224
+
15225
+ export namespace ActivityShelfshare {
15226
+ export interface Data {
15227
+ _id: string;
15228
+ msl_length: number;
15229
+ total_msl_length: number;
15230
+ msl_id: string;
15231
+ geo_tag: GeoTag;
15232
+ time: number;
15233
+ tags?: string[];
15234
+ visit_id: string;
15235
+ user: string;
15236
+ client: string;
15237
+ visit?: string;
15238
+ client_name: string;
15239
+ user_name: string;
15240
+ sync_id: string;
15241
+ route?: string;
15242
+ platform?: string;
15243
+ version_name?: string;
15244
+ battery_level?: number;
15245
+ device_brand?: string;
15246
+ device_os?: string;
15247
+ device_os_version?: string;
15248
+ device_model?: string;
15249
+ time_zone?: string;
15250
+ identifier?: number;
15251
+ device_id?: string;
15252
+ device_unique_id?: string;
15253
+ teams?: string[];
15254
+ reviewed_by: ActivityReview[];
15255
+ network_state?: number;
15256
+ admin_notes: ActivityAdminNote[];
15257
+ comments: ActivityComment[];
15258
+ company_namespace: string[];
15259
+ job_start_time?: number;
15260
+ job_end_time?: number;
15261
+ job_duration?: number;
15262
+ createdAt: string;
15263
+ updatedAt: string;
15264
+ }
15265
+ }
15266
+
15267
+ export namespace ActivityStorecheck {
15268
+ type FieldType =
15269
+ | "Text"
15270
+ | "String"
15271
+ | "Date"
15272
+ | "Image"
15273
+ | "Boolean"
15274
+ | "Number"
15275
+ | "List"
15276
+ | "Separator"
15277
+ | "Heading"
15278
+ | "Media";
15279
+
15280
+ type Source =
15281
+ | "product"
15282
+ | "variant"
15283
+ | "product-category"
15284
+ | "product-sub-category"
15285
+ | "product-brand"
15286
+ | "product-group";
15287
+
15288
+ interface GeoTag {
15289
+ lat?: number;
15290
+ lng?: number;
15291
+ formatted_address?: string;
15292
+ }
15293
+
15294
+ interface GeoPoint {
15295
+ type: "Point";
15296
+ coordinates: [number, number];
15297
+ }
15298
+
15299
+ interface Entry {
15300
+ entry_id: string;
15301
+ source: Source;
15302
+ results: Result[];
15303
+ }
15304
+ interface Result {
15305
+ source_id: string;
15306
+ source_name: string;
15307
+ divisions: Division[];
15308
+ }
15309
+ interface Division {
15310
+ fields: Field[];
15311
+ }
15312
+ interface Field {
15313
+ _id?: string;
15314
+ name: string;
15315
+ type: FieldType;
15316
+ isArray: boolean;
15317
+ isRequired?: boolean;
15318
+ is_calculated_field?: boolean;
15319
+ formula_key?: string;
15320
+ parent_field?: string;
15321
+ custom_list?: string | CustomList.Data | StringId;
15322
+ field_id: string | StringId;
15323
+ result: any[];
15324
+ result_custom_list_ids?: any[];
15325
+ calculation_status?: "success" | "failed";
15326
+ calculation_error?: string | any[];
15327
+ company_namespace?: string[];
15328
+ }
15329
+ export interface Data {
15330
+ _id: string;
15331
+ company_namespace: string[];
15332
+ client: string;
15333
+ client_name: string;
15334
+ sync_id: string;
15335
+ time_zone: string;
15336
+ template_id: string;
15337
+ visit?: string;
15338
+ visit_id?: string;
15339
+ battery_level?: number;
15340
+ user: string;
15341
+ user_name: string;
15342
+ time: number;
15343
+ geo_tag?: GeoTag;
15344
+ geoPoint: GeoPoint;
15345
+ teams?: string[];
15346
+ route?: string;
15347
+ tags?: string[];
15348
+ entries: Entry[];
15349
+ platform?: string;
15350
+ version_name?: string;
15351
+ device_brand?: string;
15352
+ device_os?: string;
15353
+ device_os_version?: string;
15354
+ device_model?: string;
15355
+ identifier?: number;
15356
+ device_id?: string;
15357
+ device_unique_id?: string;
15358
+ network_state?: number;
15359
+ serial_number?: SerialNumber;
15360
+ job_start_time?: number;
15361
+ job_end_time?: number;
15362
+ job_duration?: number;
15363
+ createdAt: Date;
15364
+ updatedAt: Date;
15365
+ }
15366
+ }
15367
+
15368
+ export namespace Reminder {
15369
+ export interface Data {
15370
+ _id: string;
15371
+ name: string;
15372
+ creator: AdminOrRep;
15373
+ from: number;
15374
+ to: number;
15375
+ visibility: "reps" | "teams" | "public";
15376
+ clients: string[];
15377
+ reps: string[];
15378
+ teams: string[];
15379
+ content: string;
15380
+ disabled: boolean;
15381
+ photo?: string;
15382
+ cover_photo?: string;
15383
+ sync_id: string;
15384
+ company_namespace: string[];
15385
+ createdAt: Date;
15386
+ updatedAt: Date;
15387
+ }
15388
+ }
15389
+
15390
+ export namespace TimelineReport {
15391
+ export const activity_types = [
15392
+ "client",
15393
+ "visit",
15394
+ "payment",
15395
+ "activity-photo",
15396
+ "activity-audit",
15397
+ "activity-availability",
15398
+ "activity-checkout-display",
15399
+ "activity-feedback",
15400
+ "activity-form-result",
15401
+ "activity-form-v2-result",
15402
+ "activity-item-status",
15403
+ "activity-note",
15404
+ "activity-planogram",
15405
+ "activity-secondary-display",
15406
+ "activity-shelfshare",
15407
+ "activity-storecheck",
15408
+ "activity-task",
15409
+ "approval-request",
15410
+ "asset-part-receival",
15411
+ "asset-part-transfer",
15412
+ "asset",
15413
+ "asset-part",
15414
+ "asset-unit",
15415
+ "reminders",
15416
+ "return-asset-part-unit",
15417
+ "store-asset-part-unit",
15418
+ "refund",
15419
+ "settlement",
15420
+ "convert-proforma",
15421
+ "transfer",
15422
+ "proforma",
15423
+ "receiving-material",
15424
+ "void-invoice",
15425
+ "fullinvoices",
15426
+ "workorder",
15427
+ "workorder-request",
15428
+ "return-whole-invoice",
15429
+ "cycle",
15430
+ ] as const;
15431
+ type ActivityType = (typeof activity_types)[number];
15432
+
15433
+ export interface Data {
15434
+ _id: StringId;
15435
+ company_namespace: string[];
15436
+ activity_type: ActivityType;
15437
+ activity_id: StringId;
15438
+ time: number;
15439
+ business_day?: string;
15440
+ user: {
15441
+ _id: StringId;
15442
+ type: "admin" | "rep";
15443
+ name?: string;
15444
+ rep?: StringId;
15445
+ admin?: StringId;
15446
+ };
15447
+ action: Method;
15448
+ teams?: StringId[];
15449
+ visit_id?: string;
15450
+ sync_id?: string;
15451
+ client?: StringId;
15452
+ client_name?: string;
15453
+ geoPoint?: { coordinates: [number, number]; type: "Point" };
15454
+ details:
15455
+ | VisitDetails
15456
+ | PaymentDetails
15457
+ | RefundDetails
15458
+ | ActivityPhotoDetails
15459
+ | ActivityAuditDetails
15460
+ | ActivityNoteDetails
15461
+ | ActivityTaskDetails
15462
+ | ActivityAvailabilityDetails
15463
+ | ActivityCheckoutDisplayDetails
15464
+ | ActivityFeedbackDetails
15465
+ | ActivityFormResultDetails
15466
+ | ActivityFormV2ResultDetails
15467
+ | ActivityItemStatusDetails
15468
+ | ActivityPlanogramDetails
15469
+ | ActivitySecondaryDisplayDetails
15470
+ | ActivityShelfshareDetails
15471
+ | ActivityStorecheckDetails
15472
+ | ApprovalRequestDetails
15473
+ | AssetPartReceivalDetails
15474
+ | AssetPartTransferDetails
15475
+ | AssetDetails
15476
+ | AssetPartDetails
15477
+ | AssetUnitDetails
15478
+ | ReminderDetails
15479
+ | ReturnAssetPartUnitDetails
15480
+ | StoreAssetPartUnitDetails
15481
+ | SettlementDetails
15482
+ | ConvertProformaDetails
15483
+ | TransferDetails
15484
+ | ReceivingMaterialDetails
15485
+ | FullInvoiceDetails
15486
+ | ProformaDetails
15487
+ | WorkorderDetails
15488
+ | WorkorderRequestDetails
15489
+ | ReturnWholeInvoiceDetails
15490
+ | VoidInvoiceDetails
15491
+ | CycleDetails
15492
+ | ClientDetails;
15493
+ createdAt: Date;
15494
+ updatedAt: Date;
15495
+ }
15496
+
15497
+ type VisitDetails = {
15498
+ activity_type: "visit";
15499
+ activities: (
15500
+ | ActivityAuditVisitDetails
15501
+ | ActivityPhotoVisitDetails
15502
+ | ActivityAvailabilityVisitDetails
15503
+ | ActivityNoteVisitDetails
15504
+ | ActivityTaskVisitDetails
15505
+ | ActivityPlanogramVisitDetails
15506
+ | ActivityShelfshareVisitDetails
15507
+ | ActivitySecondaryDisplayVisitDetails
15508
+ | ActivityCheckoutDisplayVisitDetails
15509
+ | ActivityItemStatusVisitDetails
15510
+ | ActivityFormResultVisitDetails
15511
+ | ActivityFormV2ResultVisitDetails
15512
+ | ActivityStorecheckVisitDetails
15513
+ | ActivityFeedbackVisitDetails
15514
+ | ApprovalRequestVisitDetails
15515
+ | AssetPartReceivalVisitDetails
15516
+ | AssetPartTransferVisitDetails
15517
+ | ReturnAssetPartUnitVisitDetails
15518
+ | StoreAssetPartUnitVisitDetails
15519
+ | PaymentVisitDetails
15520
+ | RefundVisitDetails
15521
+ | ConvertProformaVisitDetails
15522
+ | SettlementVisitDetails
15523
+ | FullInvoiceVisitDetails
15524
+ | ProformaVisitDetails
15525
+ | ReturnWholeInvoiceVisitDetails
15526
+ | VoidInvoiceVisitDetails
15527
+ )[];
15528
+ } & Pick<
15529
+ Visit.Data,
15530
+ | "closed_by_system"
15531
+ | "geoPoint"
15532
+ | "start_time"
15533
+ | "end_time"
15534
+ | "total_time"
15535
+ | "battery_level"
15536
+ | "version_name"
15537
+ | "device_brand"
15538
+ >;
15539
+
15540
+ // ActivityPhoto ********************************************************************
15541
+ type ActivityPhotoDetails = { activity_type: "activity-photo" } & Pick<
15542
+ ActivityPhoto.Data,
15543
+ "media"
15544
+ >;
15545
+ type ActivityPhotoVisitDetails = {
15546
+ activity_type: "activity-photo";
15547
+ activity_id: StringId;
15548
+ } & Pick<ActivityPhoto.Data, "media" | "time">;
15549
+
15550
+ // ActivityAudit ********************************************************************
15551
+ type ActivityAuditDetails = {
15552
+ activity_type: "activity-audit";
15553
+ audits_length: number;
15554
+ };
15555
+ type ActivityAuditVisitDetails = {
15556
+ activity_type: "activity-audit";
15557
+ activity_id: StringId;
15558
+ audits_length: number;
15559
+ } & Pick<ActivityAudit.Data, "time">;
15560
+
15561
+ // ActivityAvailability ********************************************************************
15562
+ type ActivityAvailabilityDetails = {
15563
+ activity_type: "activity-availability";
15564
+ products_available_length: number;
15565
+ msl_name: string;
15566
+ } & Pick<ActivityAvailability.Data, "msl_id">;
15567
+ type ActivityAvailabilityVisitDetails = {
15568
+ activity_type: "activity-availability";
15569
+ activity_id: StringId;
15570
+ products_available_length: number;
15571
+ msl_name: string;
15572
+ } & Pick<ActivityAvailability.Data, "time" | "msl_id">;
15573
+
15574
+ // ActivityNote ********************************************************************
15575
+ type ActivityNoteDetails = { activity_type: "activity-note" } & Pick<
15576
+ ActivityNote.Data,
15577
+ "content"
15578
+ >;
15579
+ type ActivityNoteVisitDetails = {
15580
+ activity_type: "activity-note";
15581
+ activity_id: StringId;
15582
+ } & Pick<ActivityNote.Data, "content" | "time">;
15583
+
15584
+ // ActivityTask ********************************************************************
15585
+ type ActivityTaskDetails = { activity_type: "activity-task" } & Pick<
15586
+ ActivityTask.Data,
15587
+ "start_media" | "end_media"
15588
+ >;
15589
+ type ActivityTaskVisitDetails = {
15590
+ activity_type: "activity-task";
15591
+ activity_id: StringId;
15592
+ } & Pick<ActivityTask.Data, "start_media" | "end_media" | "time">;
15593
+
15594
+ // ActivityPlanogram ********************************************************************
15595
+ type ActivityPlanogramDetails = {
15596
+ activity_type: "activity-planogram";
15597
+ msl_name: string;
15598
+ } & Pick<ActivityPlanogram.Data, "media" | "planogram_reason" | "msl_id">;
15599
+ type ActivityPlanogramVisitDetails = {
15600
+ activity_type: "activity-planogram";
15601
+ activity_id: StringId;
15602
+ msl_name: string;
15603
+ } & Pick<
15604
+ ActivityPlanogram.Data,
15605
+ "media" | "planogram_reason" | "time" | "msl_id"
15606
+ >;
15607
+
15608
+ // ActivityShelfshare ********************************************************************
15609
+ type ActivityShelfshareDetails = {
15610
+ activity_type: "activity-shelfshare";
15611
+ msl_name: string;
15612
+ } & Pick<
15613
+ ActivityShelfshare.Data,
15614
+ "msl_length" | "total_msl_length" | "msl_id"
15615
+ >;
15616
+ type ActivityShelfshareVisitDetails = {
15617
+ activity_type: "activity-shelfshare";
15618
+ activity_id: StringId;
15619
+ msl_name: string;
15620
+ } & Pick<
15621
+ ActivityShelfshare.Data,
15622
+ "msl_length" | "total_msl_length" | "time" | "msl_id"
15623
+ >;
15624
+
15625
+ // ActivitySecondaryDisplay ********************************************************************
15626
+ type ActivitySecondaryDisplayDetails = {
15627
+ activity_type: "activity-secondary-display";
15628
+ msl_name: string;
15629
+ } & Pick<ActivitySecondaryDisplay.Data, "secondary_count" | "msl_id">;
15630
+ type ActivitySecondaryDisplayVisitDetails = {
15631
+ activity_type: "activity-secondary-display";
15632
+ activity_id: StringId;
15633
+ msl_name: string;
15634
+ } & Pick<
15635
+ ActivitySecondaryDisplay.Data,
15636
+ "secondary_count" | "time" | "msl_id"
15637
+ >;
15638
+
15639
+ // ActivityCheckoutDisplay ********************************************************************
15640
+ type ActivityCheckoutDisplayDetails = {
15641
+ activity_type: "activity-checkout-display";
15642
+ msl_name: string;
15643
+ } & Pick<ActivityCheckoutDisplay.Data, "checkout_count" | "msl_id">;
15644
+ type ActivityCheckoutDisplayVisitDetails = {
15645
+ activity_type: "activity-checkout-display";
15646
+ activity_id: StringId;
15647
+ msl_name: string;
15648
+ } & Pick<
15649
+ ActivityCheckoutDisplay.Data,
15650
+ "checkout_count" | "time" | "msl_id"
15651
+ >;
15652
+
15653
+ // ActivityItemStatus ********************************************************************
15654
+ type ActivityItemStatusDetails = {
15655
+ activity_type: "activity-item-status";
15656
+ items_length?: number;
15657
+ };
15658
+ type ActivityItemStatusVisitDetails = {
15659
+ activity_type: "activity-item-status";
15660
+ activity_id: StringId;
15661
+ items_length?: number;
15662
+ } & Pick<ActivityItemStatus.Data, "time">;
15663
+
15664
+ // ActivityFormResult ********************************************************************
15665
+ type ActivityFormResultDetails = {
15666
+ activity_type: "activity-form-result";
15667
+ form_name?: string;
15668
+ } & Pick<ActivityFormResult.Data, "form_id">;
15669
+ type ActivityFormResultVisitDetails = {
15670
+ activity_type: "activity-form-result";
15671
+ activity_id: StringId;
15672
+ form_name?: string;
15673
+ } & Pick<ActivityFormResult.Data, "form_id" | "time">;
15674
+
15675
+ // ActivityFormV2Result ********************************************************************
15676
+ type ActivityFormV2ResultDetails = {
15677
+ activity_type: "activity-form-v2-result";
15678
+ form_name?: string;
15679
+ } & Pick<ActivityFormV2Result.Data, "form_id" | "serial_number">;
15680
+ type ActivityFormV2ResultVisitDetails = {
15681
+ activity_type: "activity-form-v2-result";
15682
+ activity_id: StringId;
15683
+ form_name?: string;
15684
+ } & Pick<ActivityFormV2Result.Data, "form_id" | "serial_number" | "time">;
15685
+
15686
+ // ActivityStorecheck ********************************************************************
15687
+ type ActivityStorecheckDetails = {
15688
+ activity_type: "activity-storecheck";
15689
+ template_name?: string;
15690
+ } & Pick<ActivityStorecheck.Data, "template_id" | "serial_number">;
15691
+ type ActivityStorecheckVisitDetails = {
15692
+ activity_type: "activity-storecheck";
15693
+ activity_id: StringId;
15694
+ template_name?: string;
15695
+ } & Pick<ActivityStorecheck.Data, "template_id" | "serial_number" | "time">;
15696
+
15697
+ // ActivityFeedback ********************************************************************
15698
+ type ActivityFeedbackDetails = {
15699
+ activity_type: "activity-feedback";
15700
+ feed_back_option_label?: string;
15701
+ } & Pick<ActivityFeedback.Data, "feed_back_option">;
15702
+ type ActivityFeedbackVisitDetails = {
15703
+ activity_type: "activity-feedback";
15704
+ activity_id: StringId;
15705
+ time?: number;
15706
+ feed_back_option_label?: string;
15707
+ } & Pick<ActivityFeedback.Data, "feed_back_option">;
15708
+
15709
+ // ApprovalRequest ********************************************************************
15710
+ type ApprovalRequestDetails = { activity_type: "approval-request" } & Pick<
15711
+ ApprovalRequest.Data,
15712
+ "serial_number" | "type" | "subtype"
15713
+ >;
15714
+ type ApprovalRequestVisitDetails = {
15715
+ activity_type: "approval-request";
15716
+ activity_id: StringId;
15717
+ } & Pick<
15718
+ ApprovalRequest.Data,
15719
+ "serial_number" | "type" | "subtype" | "time"
15720
+ >;
15721
+
15722
+ // Reminder ********************************************************************
15723
+ type ReminderDetails = { activity_type: "reminders" } & Pick<
15724
+ Reminder.Data,
15725
+ "content" | "cover_photo"
15726
+ >;
15727
+
15728
+ // Asset ********************************************************************
15729
+ type AssetDetails = { activity_type: "asset" } & Pick<Asset.Data, "name">;
15730
+
15731
+ // AssetUnit ********************************************************************
15732
+ type AssetUnitDetails = { activity_type: "asset-unit" } & Pick<
15733
+ AssetUnit.Data,
15734
+ "name"
15735
+ >;
15736
+
15737
+ // AssetPart ********************************************************************
15738
+ type AssetPartDetails = { activity_type: "asset-part" } & Pick<
15739
+ AssetPart.Data,
15740
+ "name"
15741
+ >;
15742
+
15743
+ // AssetPartReceival ********************************************************************
15744
+ type AssetPartReceivalDetails = {
15745
+ activity_type: "asset-part-receival";
15746
+ } & Pick<
15747
+ AssetPartReceival.Data,
15748
+ | "serial_number"
15749
+ | "warehouse"
15750
+ | "warehouse_name"
15751
+ | "asset_parts_count"
15752
+ | "total_asset_parts_qty"
15753
+ >;
15754
+ type AssetPartReceivalVisitDetails = {
15755
+ activity_type: "asset-part-receival";
15756
+ activity_id: StringId;
15757
+ } & Pick<
15758
+ AssetPartReceival.Data,
15759
+ | "serial_number"
15760
+ | "warehouse"
15761
+ | "warehouse_name"
15762
+ | "time"
15763
+ | "asset_parts_count"
15764
+ | "total_asset_parts_qty"
15765
+ >;
15766
+
15767
+ // AssetPartTransfer ********************************************************************
15768
+ type AssetPartTransferDetails = {
15769
+ activity_type: "asset-part-transfer";
15770
+ } & Pick<
15771
+ AssetPartTransfer.Data,
15772
+ | "serial_number"
15773
+ | "from"
15774
+ | "from_name"
15775
+ | "to"
15776
+ | "to_name"
15777
+ | "asset_part_units_count"
15778
+ | "total_asset_part_units_qty"
15779
+ >;
15780
+ type AssetPartTransferVisitDetails = {
15781
+ activity_type: "asset-part-transfer";
15782
+ activity_id: StringId;
15783
+ } & Pick<
15784
+ AssetPartTransfer.Data,
15785
+ | "serial_number"
15786
+ | "from"
15787
+ | "from_name"
15788
+ | "to"
15789
+ | "to_name"
15790
+ | "asset_part_units_count"
15791
+ | "total_asset_part_units_qty"
15792
+ | "time"
15793
+ >;
15794
+
15795
+ // ReturnAssetPartUnit ********************************************************************
15796
+ type ReturnAssetPartUnitDetails = {
15797
+ activity_type: "return-asset-part-unit";
15798
+ } & Pick<
15799
+ ReturnAssetPartUnit.Data,
15800
+ | "serial_number"
15801
+ | "warehouse"
15802
+ | "warehouse_name"
15803
+ | "asset_part_units_count"
15804
+ | "total_asset_part_units_qty"
15805
+ >;
15806
+ type ReturnAssetPartUnitVisitDetails = {
15807
+ activity_type: "return-asset-part-unit";
15808
+ activity_id: StringId;
15809
+ } & Pick<
15810
+ ReturnAssetPartUnit.Data,
15811
+ | "serial_number"
15812
+ | "warehouse"
15813
+ | "warehouse_name"
15814
+ | "asset_part_units_count"
15815
+ | "total_asset_part_units_qty"
15816
+ | "time"
15817
+ >;
15818
+
15819
+ // StoreAssetPartUnit ********************************************************************
15820
+ type StoreAssetPartUnitDetails = {
15821
+ activity_type: "store-asset-part-unit";
15822
+ } & Pick<
15823
+ StoreAssetPartUnit.Data,
15824
+ | "serial_number"
15825
+ | "warehouse"
15826
+ | "warehouse_name"
15827
+ | "asset_part_units_count"
15828
+ | "total_asset_part_units_qty"
15829
+ >;
15830
+ type StoreAssetPartUnitVisitDetails = {
15831
+ activity_type: "store-asset-part-unit";
15832
+ activity_id: StringId;
15833
+ } & Pick<
15834
+ StoreAssetPartUnit.Data,
15835
+ | "serial_number"
15836
+ | "warehouse"
15837
+ | "warehouse_name"
15838
+ | "asset_part_units_count"
15839
+ | "total_asset_part_units_qty"
15840
+ | "time"
15841
+ >;
15842
+
15843
+ // Payment ********************************************************************
15844
+ type PaymentDetails = { activity_type: "payment" } & Pick<
15845
+ Payment.Data,
15846
+ "amount" | "serial_number" | "paytime" | "currency" | "payment_type"
15847
+ >;
15848
+ type PaymentVisitDetails = {
15849
+ activity_type: "payment";
15850
+ activity_id: StringId;
15851
+ } & Pick<
15852
+ Payment.Data,
15853
+ "amount" | "serial_number" | "currency" | "payment_type" | "time"
15854
+ >;
15855
+
15856
+ // Refund ********************************************************************
15857
+ type RefundDetails = { activity_type: "refund" } & Pick<
15858
+ Refund.Data,
15859
+ "amount" | "serial_number" | "paytime" | "currency" | "transaction_type"
15860
+ >;
15861
+ type RefundVisitDetails = {
15862
+ activity_type: "refund";
15863
+ activity_id: StringId;
15864
+ } & Pick<
15865
+ Refund.Data,
15866
+ "amount" | "serial_number" | "currency" | "transaction_type" | "time"
15867
+ >;
15868
+
15869
+ // Settlement ********************************************************************
15870
+ type SettlementDetails = { activity_type: "settlement" } & Pick<
15871
+ Settlement.Data,
15872
+ "amount" | "serial_number" | "paytime" | "origin" | "payment_type"
15873
+ >;
15874
+ type SettlementVisitDetails = {
15875
+ activity_type: "settlement";
15876
+ activity_id: StringId;
15877
+ } & Pick<
15878
+ Settlement.Data,
15879
+ "amount" | "serial_number" | "origin" | "payment_type" | "time"
15880
+ >;
15881
+
15882
+ // ConvertProforma ********************************************************************
15883
+ type ConvertProformaDetails = {
15884
+ activity_type: "convert-proforma";
15885
+ proforma_reference: FullInvoice.Data["proforma_reference"];
15886
+ proforma_serial_number: Proforma.Data["serial_number"];
15887
+ invoice_serial_number: FullInvoice.Data["serial_number"];
15888
+ };
15889
+ type ConvertProformaVisitDetails = {
15890
+ activity_type: "convert-proforma";
15891
+ activity_id: StringId;
15892
+ proforma_serial_number: Proforma.Data["serial_number"];
15893
+ invoice_serial_number: FullInvoice.Data["serial_number"];
15894
+ time: number;
15895
+ proforma_reference: FullInvoice.Data["proforma_reference"];
15896
+ };
15897
+
15898
+ // Transfer ********************************************************************
15899
+ type TransferDetails = {
15900
+ activity_type: "transfer";
15901
+ from_name: string;
15902
+ to_name: string;
15903
+ } & Pick<
15904
+ Transfer.Data,
15905
+ "type" | "serial_number" | "from" | "to" | "items_count" | "comment"
15906
+ >;
15907
+
15908
+ // ReceivingMaterial ********************************************************************
15909
+ type ReceivingMaterialDetails = {
15910
+ activity_type: "receiving-material";
15911
+ to_name: string;
15912
+ } & Pick<
15913
+ ReceivingMaterial.Data,
15914
+ "serial_number" | "to" | "items_count" | "comment"
15915
+ >;
15916
+
15917
+ // FullInvoice ********************************************************************
15918
+ type FullInvoiceDetails = { activity_type: "fullinvoices" } & Pick<
15919
+ FullInvoice.Data,
15920
+ | "total"
15921
+ | "serial_number"
15922
+ | "currency"
15923
+ | "issue_date"
15924
+ | "due_date"
15925
+ | "external_serial_number"
15926
+ >;
15927
+ type FullInvoiceVisitDetails = {
15928
+ activity_type: "fullinvoices";
15929
+ activity_id: StringId;
15930
+ } & Pick<
15931
+ FullInvoice.Data,
15932
+ | "total"
15933
+ | "serial_number"
15934
+ | "currency"
15935
+ | "time"
15936
+ | "issue_date"
15937
+ | "due_date"
15938
+ | "external_serial_number"
15939
+ >;
15940
+
15941
+ // Proforma ********************************************************************
15942
+ type ProformaDetails = { activity_type: "proforma" } & Pick<
15943
+ Proforma.Data,
15944
+ | "total"
15945
+ | "serial_number"
15946
+ | "currency"
15947
+ | "issue_date"
15948
+ | "external_serial_number"
15949
+ >;
15950
+ type ProformaVisitDetails = {
15951
+ activity_type: "proforma";
15952
+ activity_id: StringId;
15953
+ } & Pick<
15954
+ Proforma.Data,
15955
+ | "total"
15956
+ | "serial_number"
15957
+ | "currency"
15958
+ | "time"
15959
+ | "issue_date"
15960
+ | "external_serial_number"
15961
+ >;
15962
+
15963
+ // Workorder ********************************************************************
15964
+ type WorkorderDetails = { activity_type: "workorder" } & Pick<
15965
+ Workorder.Data,
15966
+ "name" | "serial_number" | "due_date"
15967
+ >;
15968
+
15969
+ // WorkorderRequest ********************************************************************
15970
+ type WorkorderRequestDetails = {
15971
+ activity_type: "workorder-request";
15972
+ } & Pick<WorkorderRequest.Data, "name">;
15973
+
15974
+ // ReturnWholeInvoice ********************************************************************
15975
+ type ReturnWholeInvoiceDetails = {
15976
+ activity_type: "return-whole-invoice";
15977
+ returned_from_serial_number: FullInvoice.Data["returned_from_serial_number"];
15978
+ } & Pick<FullInvoice.Data, "returned_from" | "returned_to_serial_number">;
15979
+ type ReturnWholeInvoiceVisitDetails = {
15980
+ activity_type: "return-whole-invoice";
15981
+ activity_id: StringId;
15982
+ returned_from_serial_number: FullInvoice.Data["returned_from_serial_number"];
15983
+ } & Pick<
15984
+ FullInvoice.Data,
15985
+ "returned_from" | "returned_to_serial_number" | "time"
15986
+ >;
15987
+
15988
+ // VoidInvoice ********************************************************************
15989
+ type VoidInvoiceDetails = {
15990
+ activity_type: "void-invoice";
15991
+ returned_from_serial_number: FullInvoice.Data["returned_from_serial_number"];
15992
+ } & Pick<FullInvoice.Data, "returned_from" | "returned_to_serial_number">;
15993
+ type VoidInvoiceVisitDetails = {
15994
+ activity_type: "void-invoice";
15995
+ activity_id: StringId;
15996
+ returned_from_serial_number: FullInvoice.Data["returned_from_serial_number"];
15997
+ } & Pick<
15998
+ FullInvoice.Data,
15999
+ "returned_from" | "returned_to_serial_number" | "time"
16000
+ >;
16001
+
16002
+ // Cycle ********************************************************************
16003
+ type CycleDetails = { activity_type: "cycle"; stage_name?: string } & Pick<
16004
+ Cycle.Data,
16005
+ "document_type" | "serial_number" | "document_id" | "status"
16006
+ >;
16007
+
16008
+ // Client ********************************************************************
16009
+ type ClientDetails = { activity_type: "client" } & Pick<
16010
+ Client.Data,
16011
+ "name" | "client_code" | "local_name"
16012
+ >;
16013
+
16014
+ export type PopulatedDoc = Data & {
16015
+ client_name?: string;
16016
+ client_code?: string;
16017
+ client_local_name?: string;
16018
+ client_customFields?: { [key: string]: any };
16019
+ chain?: string;
16020
+ channel?: string;
16021
+ area_tags?: string[];
16022
+ client_tags?: string[];
16023
+ city?: string;
16024
+ state?: string;
16025
+ country?: string;
16026
+ rep_username?: string;
16027
+ rep_customFields: { [key: string]: any };
16028
+ teams?: string[];
16029
+ };
16030
+
16031
+ type SortingKeys = "_id";
16032
+
16033
+ export namespace Find {
16034
+ export type Params = DefaultPaginationQueryParams & {
16035
+ visit_mode?: boolean;
16036
+ admin?: StringId | StringId[];
16037
+ rep?: StringId | StringId[];
16038
+ sortBy?: { field: SortingKeys; type: "asc" | "desc" }[];
16039
+ _id?: StringId | StringId[];
16040
+ "user._id"?: StringId | StringId[];
16041
+ user?: StringId | StringId[];
16042
+ "user.type"?: Data["user"]["type"] | Data["user"]["type"][];
16043
+ user_type?: Data["user"]["type"] | Data["user"]["type"][];
16044
+ from_createdAt?: number;
16045
+ to_createdAt?: number;
16046
+ teams?: StringId | StringId[];
16047
+ activity_type?: Data["activity_type"] | Data["activity_type"][];
16048
+ action?: Data["action"] | Data["action"][];
16049
+ visit_id?: string | string[];
16050
+ activity_id?: StringId | StringId[];
16051
+ time?: number;
16052
+ from_time?: number;
16053
+ to_time?: number;
16054
+ sync_id?: string | string[];
16055
+ client?: StringId | StringId[];
16056
+ "details.activities.activity_type"?:
16057
+ | VisitDetails["activities"][0]["activity_type"]
16058
+ | VisitDetails["activities"][0]["activity_type"][];
16059
+ chain?: StringId | StringId[];
16060
+ channel?: StringId | StringId[];
16061
+ city?: string | string[];
16062
+ region?: string | string[];
16063
+ state?: string | string[];
16064
+ country?: string | string[];
16065
+ tags?: StringId | StringId[];
16066
+ CLIENT_TAGS?: StringId | StringId[];
16067
+ AREA_TAGS?: StringId | StringId[];
16068
+ with_media?: boolean;
16069
+ with_client_customFields?: boolean;
16070
+ with_client_details?: boolean;
16071
+ with_chain?: boolean;
16072
+ with_channel?: boolean;
16073
+ with_area_tags?: boolean;
16074
+ with_tags?: boolean;
16075
+ with_client_tags?: boolean;
16076
+ with_teams?: boolean;
16077
+ with_rep_details?: boolean;
16078
+ with_rep_customFields?: boolean;
16079
+ };
16080
+ export interface Result extends DefaultPaginationResult {
16081
+ data: PopulatedDoc[];
16082
+ }
16083
+ }
16084
+ }
16085
+ }
16086
+
16087
+ export type StringId = string;
16088
+ export type NameSpaces = string[];
16089
+ export interface Admin {
16090
+ _id: StringId;
16091
+ name?: string;
16092
+ type: "admin";
16093
+ admin?: StringId;
16094
+ }
16095
+ export interface Rep {
16096
+ _id: StringId;
16097
+ name?: string;
16098
+ type: "rep";
16099
+ rep?: StringId;
16100
+ }
16101
+ export interface AdminOrRep {
16102
+ _id: StringId;
16103
+ name?: string;
16104
+ type: "admin" | "rep";
16105
+ admin?: StringId;
16106
+ rep?: StringId;
16107
+ }
16108
+ export interface AdminOrRepOrTenant {
16109
+ _id: StringId;
16110
+ type: "admin" | "rep" | "tenant";
16111
+ name?: string;
16112
+ admin?: StringId;
16113
+ rep?: StringId;
16114
+ tenant?: StringId;
16115
+ }
16116
+ export interface AdminOrRepOrTenantOrClient {
16117
+ _id: StringId;
16118
+ type: "admin" | "rep" | "tenant" | "client";
16119
+ name?: string;
16120
+ admin?: StringId;
16121
+ rep?: StringId;
16122
+ tenant?: StringId;
16123
+ client?: StringId;
16124
+ }
16125
+ interface ValidityCheck {
16126
+ valid: boolean;
16127
+ reasons: { message: string; code: string }[];
16128
+ }
16129
+ type PopulatedMediaStorage = Pick<
16130
+ Service.MediaStorage.MediaStorageSchema,
16131
+ | "_id"
16132
+ | "createdAt"
16133
+ | "ContentType"
16134
+ | "media_type"
16135
+ | "mime_type"
16136
+ | "publicUrl"
16137
+ | "type_name"
16138
+ | "file_name"
16139
+ | "media_id"
16140
+ | "thumbnails"
16141
+ | "createdAt"
16142
+ > & {
16143
+ thumbnails: Pick<
16144
+ Service.MediaStorage.Thumbnail,
16145
+ | "_id"
16146
+ | "ContentType"
16147
+ | "mime_type"
16148
+ | "publicUrl"
16149
+ | "type_name"
16150
+ | "file_name"
16151
+ | "createdAt"
16152
+ >[];
16153
+ };
16154
+
16155
+ interface ActivityComment {
16156
+ time: number;
16157
+ user_name: string;
16158
+ user_id: string;
16159
+ user_type: string;
16160
+ comment: string;
16161
+ }
16162
+ interface ActivityReview {
16163
+ admin_id: string;
16164
+ time: number;
16165
+ }
16166
+ interface ActivityAdminNote {
16167
+ admin_name: string;
16168
+ note: string;
16169
+ admin_id: string;
16170
+ time: number;
16171
+ }