@workbuddy/piece-workbuddy-vnext 1.0.60 → 1.0.62

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.
@@ -401,7 +401,7 @@ export const PublicCrmCustomerController_updateStatus = createAction({
401
401
  export const PublicCrmCustomerController_listContacts = createAction({
402
402
  name: 'PublicCrmCustomerController_listContacts',
403
403
  auth: workbuddyAuth,
404
- displayName: 'List contacts for customer',
404
+ displayName: 'List contacts for customer (contacts + external users)',
405
405
  description: '',
406
406
  props: {
407
407
  customerId: Property.ShortText({
@@ -452,6 +452,411 @@ export const PublicCrmCustomerController_listContacts = createAction({
452
452
  },
453
453
  });
454
454
 
455
+ export const PublicCrmCustomerController_createContact = createAction({
456
+ name: 'PublicCrmCustomerController_createContact',
457
+ auth: workbuddyAuth,
458
+ displayName:
459
+ 'Create customer contact. login=false creates a contact; login=true invites an external user (email required and must be free via ID validate).',
460
+ description: '',
461
+ props: {
462
+ customerId: Property.ShortText({
463
+ displayName: 'Customer Id',
464
+ description: 'Customer ID',
465
+ required: true,
466
+ }),
467
+ firstName: Property.ShortText({
468
+ displayName: 'First Name',
469
+ description: '',
470
+ required: true,
471
+ }),
472
+ lastName: Property.ShortText({
473
+ displayName: 'Last Name',
474
+ description: '',
475
+ required: true,
476
+ }),
477
+ login: Property.Checkbox({
478
+ displayName: 'Login',
479
+ description: '',
480
+ required: true,
481
+ }),
482
+ email: Property.ShortText({
483
+ displayName: 'Email',
484
+ description: 'Email address',
485
+ required: false,
486
+ }),
487
+ phone: Property.ShortText({
488
+ displayName: 'Phone',
489
+ description: 'Phone number',
490
+ required: false,
491
+ }),
492
+ mobile: Property.ShortText({
493
+ displayName: 'Mobile',
494
+ description: 'Mobile phone number',
495
+ required: false,
496
+ }),
497
+ title: Property.ShortText({
498
+ displayName: 'Title',
499
+ description: '',
500
+ required: false,
501
+ }),
502
+ note: Property.ShortText({
503
+ displayName: 'Note',
504
+ description: '',
505
+ required: false,
506
+ }),
507
+ integrationId: Property.ShortText({
508
+ displayName: 'Integration Id',
509
+ description: 'integration ID',
510
+ required: false,
511
+ }),
512
+ roleId: Property.ShortText({
513
+ displayName: 'Role Id',
514
+ description: 'role ID',
515
+ required: false,
516
+ }),
517
+ sendEmail: Property.Checkbox({
518
+ displayName: 'Send Email',
519
+ description: '',
520
+ required: false,
521
+ }),
522
+ },
523
+ async run(context) {
524
+ const token = await getAccessToken(context.auth);
525
+ const baseUrl = context.auth.props.baseUrl;
526
+
527
+ const url = `${baseUrl}/api/v2/public/customers/${context.propsValue.customerId}/contacts`;
528
+
529
+ const rawBody: Record<string, unknown> = {
530
+ firstName: context.propsValue.firstName,
531
+ lastName: context.propsValue.lastName,
532
+ email: context.propsValue.email,
533
+ phone: context.propsValue.phone,
534
+ mobile: context.propsValue.mobile,
535
+ title: context.propsValue.title,
536
+ note: context.propsValue.note,
537
+ integrationId: context.propsValue.integrationId,
538
+ login: context.propsValue.login,
539
+ roleId: context.propsValue.roleId,
540
+ sendEmail: context.propsValue.sendEmail,
541
+ };
542
+
543
+ const body = rawBody;
544
+ const response = await httpClient.sendRequest({
545
+ method: HttpMethod.POST,
546
+ url: `${baseUrl}/api/v2/public/customers/${context.propsValue.customerId}/contacts`,
547
+ headers: {
548
+ Authorization: `Bearer ${token}`,
549
+ 'Content-Type': 'application/json',
550
+ 'X-WorkBuddy-Version': '2026-01',
551
+ },
552
+ body: body,
553
+ });
554
+
555
+ return response.body;
556
+ },
557
+ });
558
+
559
+ export const PublicCrmCustomerController_getContact = createAction({
560
+ name: 'PublicCrmCustomerController_getContact',
561
+ auth: workbuddyAuth,
562
+ displayName: 'Get customer contact by ID',
563
+ description: '',
564
+ props: {
565
+ customerId: Property.ShortText({
566
+ displayName: 'Customer Id',
567
+ description: 'Customer ID',
568
+ required: true,
569
+ }),
570
+ contactId: Property.ShortText({
571
+ displayName: 'Contact Id',
572
+ description: 'Contact ID',
573
+ required: true,
574
+ }),
575
+ },
576
+ async run(context) {
577
+ const token = await getAccessToken(context.auth);
578
+ const baseUrl = context.auth.props.baseUrl;
579
+
580
+ const url = `${baseUrl}/api/v2/public/customers/${context.propsValue.customerId}/contacts/${context.propsValue.contactId}`;
581
+
582
+ const response = await httpClient.sendRequest({
583
+ method: HttpMethod.GET,
584
+ url: `${baseUrl}/api/v2/public/customers/${context.propsValue.customerId}/contacts/${context.propsValue.contactId}`,
585
+ headers: {
586
+ Authorization: `Bearer ${token}`,
587
+ 'Content-Type': 'application/json',
588
+ 'X-WorkBuddy-Version': '2026-01',
589
+ },
590
+ });
591
+
592
+ return response.body;
593
+ },
594
+ });
595
+
596
+ export const PublicCrmCustomerController_updateContact = createAction({
597
+ name: 'PublicCrmCustomerController_updateContact',
598
+ auth: workbuddyAuth,
599
+ displayName: 'Update customer contact',
600
+ description: '',
601
+ props: {
602
+ customerId: Property.ShortText({
603
+ displayName: 'Customer Id',
604
+ description: 'Customer ID',
605
+ required: true,
606
+ }),
607
+ contactId: Property.ShortText({
608
+ displayName: 'Contact Id',
609
+ description: 'Contact ID',
610
+ required: true,
611
+ }),
612
+ firstName: Property.ShortText({
613
+ displayName: 'First Name',
614
+ description: '',
615
+ required: false,
616
+ }),
617
+ lastName: Property.ShortText({
618
+ displayName: 'Last Name',
619
+ description: '',
620
+ required: false,
621
+ }),
622
+ email: Property.ShortText({
623
+ displayName: 'Email',
624
+ description: 'Email address',
625
+ required: false,
626
+ }),
627
+ phone: Property.ShortText({
628
+ displayName: 'Phone',
629
+ description: 'Phone number',
630
+ required: false,
631
+ }),
632
+ mobile: Property.ShortText({
633
+ displayName: 'Mobile',
634
+ description: 'Mobile phone number',
635
+ required: false,
636
+ }),
637
+ title: Property.ShortText({
638
+ displayName: 'Title',
639
+ description: '',
640
+ required: false,
641
+ }),
642
+ note: Property.ShortText({
643
+ displayName: 'Note',
644
+ description: '',
645
+ required: false,
646
+ }),
647
+ integrationId: Property.ShortText({
648
+ displayName: 'Integration Id',
649
+ description: 'integration ID',
650
+ required: false,
651
+ }),
652
+ },
653
+ async run(context) {
654
+ const token = await getAccessToken(context.auth);
655
+ const baseUrl = context.auth.props.baseUrl;
656
+
657
+ const url = `${baseUrl}/api/v2/public/customers/${context.propsValue.customerId}/contacts/${context.propsValue.contactId}`;
658
+
659
+ // Build body with only defined values (for partial updates)
660
+ const rawBody: Record<string, unknown> = {
661
+ firstName: context.propsValue.firstName,
662
+ lastName: context.propsValue.lastName,
663
+ email: context.propsValue.email,
664
+ phone: context.propsValue.phone,
665
+ mobile: context.propsValue.mobile,
666
+ title: context.propsValue.title,
667
+ note: context.propsValue.note,
668
+ integrationId: context.propsValue.integrationId,
669
+ };
670
+
671
+ const body = Object.fromEntries(
672
+ Object.entries(rawBody).filter(([_, v]) => v !== undefined && v !== null && v !== '')
673
+ );
674
+ const response = await httpClient.sendRequest({
675
+ method: HttpMethod.PATCH,
676
+ url: `${baseUrl}/api/v2/public/customers/${context.propsValue.customerId}/contacts/${context.propsValue.contactId}`,
677
+ headers: {
678
+ Authorization: `Bearer ${token}`,
679
+ 'Content-Type': 'application/json',
680
+ 'X-WorkBuddy-Version': '2026-01',
681
+ },
682
+ body: body,
683
+ });
684
+
685
+ return response.body;
686
+ },
687
+ });
688
+
689
+ export const PublicCrmCustomerController_deleteContact = createAction({
690
+ name: 'PublicCrmCustomerController_deleteContact',
691
+ auth: workbuddyAuth,
692
+ displayName: 'Delete customer contact',
693
+ description: '',
694
+ props: {
695
+ customerId: Property.ShortText({
696
+ displayName: 'Customer Id',
697
+ description: 'Customer ID',
698
+ required: true,
699
+ }),
700
+ contactId: Property.ShortText({
701
+ displayName: 'Contact Id',
702
+ description: 'Contact ID',
703
+ required: true,
704
+ }),
705
+ },
706
+ async run(context) {
707
+ const token = await getAccessToken(context.auth);
708
+ const baseUrl = context.auth.props.baseUrl;
709
+
710
+ const url = `${baseUrl}/api/v2/public/customers/${context.propsValue.customerId}/contacts/${context.propsValue.contactId}`;
711
+
712
+ const response = await httpClient.sendRequest({
713
+ method: HttpMethod.DELETE,
714
+ url: `${baseUrl}/api/v2/public/customers/${context.propsValue.customerId}/contacts/${context.propsValue.contactId}`,
715
+ headers: {
716
+ Authorization: `Bearer ${token}`,
717
+ 'Content-Type': 'application/json',
718
+ 'X-WorkBuddy-Version': '2026-01',
719
+ },
720
+ });
721
+
722
+ return response.body;
723
+ },
724
+ });
725
+
726
+ export const PublicCrmCustomerController_inviteContact = createAction({
727
+ name: 'PublicCrmCustomerController_inviteContact',
728
+ auth: workbuddyAuth,
729
+ displayName: 'Promote an existing contact to external user and send invite (CRM)',
730
+ description: '',
731
+ props: {
732
+ customerId: Property.ShortText({
733
+ displayName: 'Customer Id',
734
+ description: 'Customer ID',
735
+ required: true,
736
+ }),
737
+ contactId: Property.ShortText({
738
+ displayName: 'Contact Id',
739
+ description: 'Contact ID',
740
+ required: true,
741
+ }),
742
+ email: Property.ShortText({
743
+ displayName: 'Email',
744
+ description: 'Email address',
745
+ required: false,
746
+ }),
747
+ roleId: Property.ShortText({
748
+ displayName: 'Role Id',
749
+ description: 'role ID',
750
+ required: false,
751
+ }),
752
+ sendEmail: Property.Checkbox({
753
+ displayName: 'Send Email',
754
+ description: '',
755
+ required: false,
756
+ }),
757
+ },
758
+ async run(context) {
759
+ const token = await getAccessToken(context.auth);
760
+ const baseUrl = context.auth.props.baseUrl;
761
+
762
+ const url = `${baseUrl}/api/v2/public/customers/${context.propsValue.customerId}/contacts/${context.propsValue.contactId}/invite`;
763
+
764
+ const rawBody: Record<string, unknown> = {
765
+ email: context.propsValue.email,
766
+ roleId: context.propsValue.roleId,
767
+ sendEmail: context.propsValue.sendEmail,
768
+ };
769
+
770
+ const body = rawBody;
771
+ const response = await httpClient.sendRequest({
772
+ method: HttpMethod.POST,
773
+ url: `${baseUrl}/api/v2/public/customers/${context.propsValue.customerId}/contacts/${context.propsValue.contactId}/invite`,
774
+ headers: {
775
+ Authorization: `Bearer ${token}`,
776
+ 'Content-Type': 'application/json',
777
+ 'X-WorkBuddy-Version': '2026-01',
778
+ },
779
+ body: body,
780
+ });
781
+
782
+ return response.body;
783
+ },
784
+ });
785
+
786
+ export const PublicCrmCustomerController_activateContact = createAction({
787
+ name: 'PublicCrmCustomerController_activateContact',
788
+ auth: workbuddyAuth,
789
+ displayName: 'Unlock portal login for an external user (CRM)',
790
+ description: '',
791
+ props: {
792
+ customerId: Property.ShortText({
793
+ displayName: 'Customer Id',
794
+ description: 'Customer ID',
795
+ required: true,
796
+ }),
797
+ contactId: Property.ShortText({
798
+ displayName: 'Contact Id',
799
+ description: 'Contact ID',
800
+ required: true,
801
+ }),
802
+ },
803
+ async run(context) {
804
+ const token = await getAccessToken(context.auth);
805
+ const baseUrl = context.auth.props.baseUrl;
806
+
807
+ const url = `${baseUrl}/api/v2/public/customers/${context.propsValue.customerId}/contacts/${context.propsValue.contactId}/activate`;
808
+
809
+ const response = await httpClient.sendRequest({
810
+ method: HttpMethod.POST,
811
+ url: `${baseUrl}/api/v2/public/customers/${context.propsValue.customerId}/contacts/${context.propsValue.contactId}/activate`,
812
+ headers: {
813
+ Authorization: `Bearer ${token}`,
814
+ 'Content-Type': 'application/json',
815
+ 'X-WorkBuddy-Version': '2026-01',
816
+ },
817
+ });
818
+
819
+ return response.body;
820
+ },
821
+ });
822
+
823
+ export const PublicCrmCustomerController_deactivateContact = createAction({
824
+ name: 'PublicCrmCustomerController_deactivateContact',
825
+ auth: workbuddyAuth,
826
+ displayName: 'Lock portal login for an external user (CRM)',
827
+ description: '',
828
+ props: {
829
+ customerId: Property.ShortText({
830
+ displayName: 'Customer Id',
831
+ description: 'Customer ID',
832
+ required: true,
833
+ }),
834
+ contactId: Property.ShortText({
835
+ displayName: 'Contact Id',
836
+ description: 'Contact ID',
837
+ required: true,
838
+ }),
839
+ },
840
+ async run(context) {
841
+ const token = await getAccessToken(context.auth);
842
+ const baseUrl = context.auth.props.baseUrl;
843
+
844
+ const url = `${baseUrl}/api/v2/public/customers/${context.propsValue.customerId}/contacts/${context.propsValue.contactId}/deactivate`;
845
+
846
+ const response = await httpClient.sendRequest({
847
+ method: HttpMethod.POST,
848
+ url: `${baseUrl}/api/v2/public/customers/${context.propsValue.customerId}/contacts/${context.propsValue.contactId}/deactivate`,
849
+ headers: {
850
+ Authorization: `Bearer ${token}`,
851
+ 'Content-Type': 'application/json',
852
+ 'X-WorkBuddy-Version': '2026-01',
853
+ },
854
+ });
855
+
856
+ return response.body;
857
+ },
858
+ });
859
+
455
860
  export const PublicCrmCustomerController_listSites = createAction({
456
861
  name: 'PublicCrmCustomerController_listSites',
457
862
  auth: workbuddyAuth,