@hailer/app-sdk 2.0.0-beta-7 → 2.0.0-beta-9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/lib/app-sdk.js +2 -2
  2. package/lib/app-sdk.js.map +4 -4
  3. package/lib/hailer-api.d.ts +6 -0
  4. package/lib/index.d.ts +1 -0
  5. package/lib/modules/admin.d.ts +146 -0
  6. package/lib/modules/metrics.d.ts +61 -0
  7. package/lib/modules/network.d.ts +14 -0
  8. package/lib/modules/payment.d.ts +66 -0
  9. package/lib/modules/public/version.d.ts +16 -0
  10. package/lib/modules/version.d.ts +16 -0
  11. package/lib/modules/workspace.d.ts +1 -1
  12. package/lib/src/constants.d.ts +7 -0
  13. package/lib/src/hailer-api.d.ts +92 -0
  14. package/lib/src/index.d.ts +2 -0
  15. package/lib/src/modules/activity/kanban.d.ts +36 -0
  16. package/lib/src/modules/activity.d.ts +83 -0
  17. package/lib/src/modules/app.d.ts +12 -0
  18. package/lib/src/modules/insight.d.ts +36 -0
  19. package/lib/src/modules/network.d.ts +14 -0
  20. package/lib/src/modules/permission.d.ts +9 -0
  21. package/lib/src/modules/process.d.ts +38 -0
  22. package/lib/src/modules/product-installed.d.ts +40 -0
  23. package/lib/src/modules/product-version.d.ts +16 -0
  24. package/lib/src/modules/product.d.ts +104 -0
  25. package/lib/src/modules/public/app.d.ts +17 -0
  26. package/lib/src/modules/public/form.d.ts +31 -0
  27. package/lib/src/modules/public/insight.d.ts +30 -0
  28. package/lib/src/modules/public/product-version.d.ts +16 -0
  29. package/lib/src/modules/public/product.d.ts +27 -0
  30. package/lib/src/modules/public.d.ts +22 -0
  31. package/lib/src/modules/ui/activity.d.ts +30 -0
  32. package/lib/src/modules/ui/files.d.ts +18 -0
  33. package/lib/src/modules/ui/snackbar.d.ts +18 -0
  34. package/lib/src/modules/ui.d.ts +17 -0
  35. package/lib/src/modules/user.d.ts +36 -0
  36. package/lib/src/modules/workflow.d.ts +24 -0
  37. package/lib/src/types.d.ts +381 -0
  38. package/lib/tools/publish.d.ts +1 -0
  39. package/lib/tools/replace-private.d.ts +1 -0
  40. package/lib/tools/replace-private.js +33 -0
  41. package/lib/types.d.ts +547 -0
  42. package/lib/version.d.ts +0 -0
  43. package/package.json +1 -1
package/lib/types.d.ts CHANGED
@@ -457,4 +457,551 @@ export interface Version {
457
457
  packageHash: string;
458
458
  created: number;
459
459
  }
460
+ export interface PricingPlan {
461
+ planId: 'monthly' | 'yearly' | 'one_time';
462
+ label: string;
463
+ price: number;
464
+ currency: string;
465
+ interval: 'month' | 'year' | null;
466
+ }
467
+ export interface PaymentProvider {
468
+ priceId?: {
469
+ monthly?: string;
470
+ yearly?: string;
471
+ one_time?: string;
472
+ };
473
+ trial_days?: number;
474
+ }
475
+ export interface PricingProviders {
476
+ stripe?: PaymentProvider;
477
+ paddle?: PaymentProvider;
478
+ }
479
+ export interface PricingData {
480
+ _id?: string;
481
+ productId?: string;
482
+ types: PricingPlan[];
483
+ providers: PricingProviders;
484
+ paymentEnabled?: boolean;
485
+ created?: number;
486
+ updated?: number;
487
+ }
488
+ export interface CreatePricingRequest {
489
+ productId: string;
490
+ types: PricingPlan[];
491
+ providers: PricingProviders;
492
+ paymentEnabled?: boolean;
493
+ }
494
+ export interface UpdatePricingRequest {
495
+ productId: string;
496
+ types: PricingPlan[];
497
+ providers: PricingProviders;
498
+ paymentEnabled?: boolean;
499
+ }
500
+ export interface CreatePurchaseRequest {
501
+ productId: string;
502
+ workspaceId: string;
503
+ planType: 'monthly' | 'yearly' | 'one_time';
504
+ successUrl?: string;
505
+ cancelUrl?: string;
506
+ useTokens?: boolean;
507
+ }
508
+ export interface CreatePurchaseResponse {
509
+ status: 'installed_free' | 'subscription_created' | 'checkout_required' | 'payment_processed' | 'payment_failed';
510
+ message?: string;
511
+ productId?: string;
512
+ planType?: string;
513
+ purchaseId?: string;
514
+ subscriptionId?: string;
515
+ provider?: string;
516
+ trialDays?: number;
517
+ checkoutUrl?: string;
518
+ error?: string;
519
+ }
520
+ export interface Purchase {
521
+ _id: string;
522
+ uid: string;
523
+ cid: string;
524
+ productId?: string;
525
+ productName?: string;
526
+ provider?: 'stripe' | 'paddle' | 'fuze';
527
+ type: 'monthly' | 'yearly' | 'one_time';
528
+ purchaseType: 'workspace' | 'product';
529
+ startedAt: number;
530
+ created: number;
531
+ updated?: number;
532
+ customStatus?: string;
533
+ expiresAt?: number;
534
+ trialDays?: number;
535
+ trialStart?: number;
536
+ trialEnd?: number;
537
+ pricePaid?: {
538
+ amount: number;
539
+ currency: string;
540
+ };
541
+ pricing?: {
542
+ amount: number;
543
+ currency: string;
544
+ interval: string;
545
+ source: string;
546
+ };
547
+ stripe?: {
548
+ customerId?: string;
549
+ checkoutSessionId?: string;
550
+ subscriptionId?: string;
551
+ paymentIntentId?: string;
552
+ status?: string;
553
+ };
554
+ paddle?: {
555
+ customerId?: string;
556
+ subscriptionId?: string;
557
+ status?: string;
558
+ };
559
+ fuze?: {
560
+ customerId?: string;
561
+ subscriptionId?: string;
562
+ status?: string;
563
+ };
564
+ }
565
+ export interface AdminWorkspaceListItem {
566
+ _id: string;
567
+ name: string;
568
+ memberCount: number;
569
+ created: number;
570
+ updated?: number;
571
+ paymentPlan?: string;
572
+ monthlyPrice?: number;
573
+ paymentMethod?: 'subscription' | 'invoice';
574
+ subscriptionActive?: boolean;
575
+ provider?: string;
576
+ stripeStatus?: string;
577
+ hasPendingSubscription?: boolean;
578
+ tokenBalance?: number;
579
+ autoReloadEnabled?: boolean;
580
+ }
581
+ export interface AdminWorkspaceListRequest {
582
+ filter?: {
583
+ name?: string;
584
+ };
585
+ options?: {
586
+ search?: string;
587
+ sortBy?: string;
588
+ sortOrder?: string;
589
+ limit?: number;
590
+ skip?: number;
591
+ };
592
+ }
593
+ export interface AdminWorkspaceListResponse {
594
+ workspaces: AdminWorkspaceListItem[];
595
+ totalCount: number;
596
+ }
597
+ export interface AdminPurchaseData {
598
+ _id: string;
599
+ uid: string;
600
+ cid: string;
601
+ productId?: string | null;
602
+ productName?: string | null;
603
+ provider?: string;
604
+ type: string;
605
+ purchaseType: 'workspace' | 'product';
606
+ billingType?: 'subscription' | 'invoice';
607
+ planName?: 'flexible' | 'pro' | 'business' | 'enterprise';
608
+ startedAt?: number;
609
+ expiresAt?: number;
610
+ created: number;
611
+ updated?: number;
612
+ customStatus?: string;
613
+ trialStart?: number;
614
+ trialEnd?: number;
615
+ pricePaid?: {
616
+ amount: number;
617
+ currency: string;
618
+ };
619
+ pricing?: {
620
+ amount: number;
621
+ currency: string;
622
+ interval?: string;
623
+ source: 'purchase_record' | 'pricing_collection';
624
+ };
625
+ availablePricing?: Array<{
626
+ planId: 'monthly' | 'yearly' | 'one_time';
627
+ label: string;
628
+ price: number;
629
+ currency: string;
630
+ interval: string | null;
631
+ }>;
632
+ trialDays?: number;
633
+ stripe?: {
634
+ customerId?: string;
635
+ checkoutSessionId?: string;
636
+ subscriptionId?: string;
637
+ paymentIntentId?: string;
638
+ status?: string;
639
+ };
640
+ paddle?: {
641
+ customerId?: string;
642
+ subscriptionId?: string;
643
+ status?: string;
644
+ };
645
+ fuze?: {
646
+ customerId?: string;
647
+ subscriptionId?: string;
648
+ status?: string;
649
+ };
650
+ }
651
+ export interface AdminWorkspaceOverrides {
652
+ public?: boolean;
653
+ tableEdit?: boolean;
654
+ restricted?: boolean;
655
+ isolatedTeams?: boolean;
656
+ insight?: boolean;
657
+ groups?: boolean;
658
+ customRoles?: boolean;
659
+ activityRecovery?: boolean;
660
+ fastFunctions?: boolean;
661
+ }
662
+ export interface AdminWorkspaceMarketplaceSettings {
663
+ creatorPercent: number;
664
+ }
665
+ export interface AdminWorkspace extends AdminWorkspaceListItem {
666
+ purchaseId?: string;
667
+ purchases?: AdminPurchaseData[];
668
+ overrides?: AdminWorkspaceOverrides;
669
+ marketplace?: AdminWorkspaceMarketplaceSettings;
670
+ }
671
+ export interface AdminUpdateOverridesRequest {
672
+ workspaceId: string;
673
+ overrides: AdminWorkspaceOverrides;
674
+ }
675
+ export interface AdminUpdateMarketplaceSettingsRequest {
676
+ workspaceId: string;
677
+ creatorPercent: number;
678
+ }
679
+ export interface AdminCreateStripeSessionRequest {
680
+ workspaceId: string;
681
+ planName: 'flexible' | 'pro' | 'business' | 'enterprise';
682
+ customPrice: number;
683
+ paymentMethod: 'stripe';
684
+ baseUrl: string;
685
+ }
686
+ export interface AdminCreateStripeSessionResponse {
687
+ success: boolean;
688
+ message: string;
689
+ sessionUrl?: string;
690
+ }
691
+ export interface AdminCreateInvoiceIntegrationRequest {
692
+ workspaceId: string;
693
+ planName: 'enterprise';
694
+ customPrice: number;
695
+ paymentMethod: 'hailer';
696
+ }
697
+ export interface AdminCreateInvoiceIntegrationResponse {
698
+ success: boolean;
699
+ message: string;
700
+ }
701
+ export interface AdminUpdateWorkspaceSubscriptionRequest {
702
+ purchaseId: string;
703
+ billingType: 'subscription' | 'invoice';
704
+ customPrice: number;
705
+ planName: 'flexible' | 'pro' | 'business' | 'enterprise';
706
+ tokenAmount?: number;
707
+ }
708
+ export interface AdminUpdatePurchasePriceRequest {
709
+ purchaseId: string;
710
+ workspaceId: string;
711
+ newPrice: number;
712
+ }
713
+ export interface AdminWorkspaceUser {
714
+ _id: string;
715
+ name: string;
716
+ email: string;
717
+ role: 'owner' | 'admin' | 'user' | 'guest' | 'inviter';
718
+ joined?: number;
719
+ lastActive?: number;
720
+ emailVerified?: boolean;
721
+ }
722
+ export interface AdminWorkspaceUsersListRequest {
723
+ workspaceId?: string;
724
+ filter?: {
725
+ email?: string;
726
+ role?: string;
727
+ };
728
+ options?: {
729
+ search?: string;
730
+ sortBy?: string;
731
+ sortOrder?: string;
732
+ limit?: number;
733
+ skip?: number;
734
+ };
735
+ }
736
+ export interface AdminWorkspaceUsersListResponse {
737
+ users: AdminWorkspaceUser[];
738
+ totalCount: number;
739
+ }
740
+ export interface AdminUpdateUserRequest {
741
+ userId: string;
742
+ updates: {
743
+ emailVerified?: boolean;
744
+ };
745
+ }
746
+ export interface AdminUpdateUserResponse {
747
+ success: boolean;
748
+ }
749
+ export interface AdminUpdateTokenBalanceRequest {
750
+ workspaceId: string;
751
+ tokenAmount: number;
752
+ payoutType?: 'admin_bonus' | 'creator_payout';
753
+ payoutMonth?: number;
754
+ payoutYear?: number;
755
+ creatorPercent?: number;
756
+ }
757
+ export interface AdminTokenTransaction {
758
+ _id: string;
759
+ uid: string;
760
+ cid: string;
761
+ workspaceName: string;
762
+ created: number;
763
+ type: 'purchase' | 'deduction' | 'bonus' | 'admin_adjustment' | 'creator_payout';
764
+ amount: number;
765
+ reason: string;
766
+ meta?: {
767
+ payoutMonth?: number;
768
+ payoutYear?: number;
769
+ creatorProfit?: number;
770
+ creatorPercent?: number;
771
+ [key: string]: any;
772
+ };
773
+ createdAt: number;
774
+ }
775
+ export interface AdminTokenTransactionFilter {
776
+ workspaceId?: string;
777
+ type?: 'purchase' | 'deduction' | 'bonus' | 'admin_adjustment' | 'creator_payout';
778
+ operation?: string;
779
+ dateFrom?: number;
780
+ dateTo?: number;
781
+ search?: string;
782
+ }
783
+ export interface AdminTokenTransactionStatistics {
784
+ netChange: number;
785
+ totalPurchases: number;
786
+ totalPurchasesEuro: number;
787
+ purchasesBySource: {
788
+ stripe: {
789
+ count: number;
790
+ tokens: number;
791
+ revenue: number;
792
+ };
793
+ adminPortal: {
794
+ count: number;
795
+ tokens: number;
796
+ revenue: number;
797
+ };
798
+ };
799
+ totalDeductions: number;
800
+ totalDeductionsEuro: number;
801
+ consumptionByOperation: {
802
+ [operation: string]: {
803
+ count: number;
804
+ tokens: number;
805
+ };
806
+ };
807
+ totalBonuses: number;
808
+ totalBonusesEuro: number;
809
+ totalCreatorPayouts: number;
810
+ totalCreatorPayoutsEuro: number;
811
+ totalRefunds: number;
812
+ totalRefundsEuro: number;
813
+ }
814
+ export interface AdminTokenTransactionsListRequest {
815
+ filter?: AdminTokenTransactionFilter;
816
+ options?: {
817
+ sortBy?: string;
818
+ sortOrder?: 'asc' | 'desc';
819
+ limit?: number;
820
+ skip?: number;
821
+ };
822
+ }
823
+ export interface AdminTokenTransactionsListResponse {
824
+ transactions: AdminTokenTransaction[];
825
+ totalCount: number;
826
+ statistics: AdminTokenTransactionStatistics;
827
+ }
828
+ export interface AdminInvoicePurchase {
829
+ _id: string;
830
+ uid: string;
831
+ cid: string;
832
+ workspaceName: string;
833
+ created: number;
834
+ purchaseType: 'workspace' | 'product';
835
+ type: 'monthly' | 'yearly' | 'one_time';
836
+ provider: 'hailer';
837
+ billingType: 'invoice';
838
+ planName?: string;
839
+ productId?: string;
840
+ productName?: string;
841
+ pricePaid?: {
842
+ amount: number;
843
+ currency: string;
844
+ };
845
+ customStatus?: string;
846
+ invoiceHandled?: boolean;
847
+ startedAt: number;
848
+ expiresAt?: number;
849
+ trialStart?: number;
850
+ trialEnd?: number;
851
+ }
852
+ export interface AdminInvoiceListRequest {
853
+ filter?: {
854
+ workspaceId?: string;
855
+ purchaseType?: 'workspace' | 'product';
856
+ status?: 'handled' | 'unhandled' | 'all';
857
+ search?: string;
858
+ };
859
+ options?: {
860
+ sortBy?: string;
861
+ sortOrder?: 'asc' | 'desc';
862
+ limit?: number;
863
+ skip?: number;
864
+ };
865
+ }
866
+ export interface AdminInvoiceWorkspaceGroup {
867
+ cid: string;
868
+ workspaceName: string;
869
+ allHandled: boolean;
870
+ purchases: AdminInvoicePurchase[];
871
+ }
872
+ export interface AdminInvoiceListResponse {
873
+ invoices: AdminInvoicePurchase[];
874
+ totalCount: number;
875
+ workspaceGroups: AdminInvoiceWorkspaceGroup[];
876
+ }
877
+ export interface AdminInvoiceUpdateHandledRequest {
878
+ purchaseIds: string | string[];
879
+ handled: boolean;
880
+ }
881
+ export interface AdminInvoiceUpdateHandledResponse {
882
+ updatedCount: number;
883
+ }
884
+ export interface AdminRevenuePurchase {
885
+ _id: string;
886
+ uid: string;
887
+ cid: string;
888
+ workspaceName: string;
889
+ created: number;
890
+ purchaseType: 'workspace' | 'product';
891
+ type: 'monthly' | 'yearly' | 'one_time';
892
+ provider: string;
893
+ productId?: string;
894
+ productName?: string;
895
+ productOwnerCid?: string;
896
+ productOwnerName?: string;
897
+ pricePaid?: {
898
+ amount: number;
899
+ currency: string;
900
+ };
901
+ startedAt: number;
902
+ expiresAt?: number;
903
+ normalizedMonthlyRevenue: number;
904
+ isMarketplace: boolean;
905
+ profitToHailer: number;
906
+ profitToCreator?: number;
907
+ statusInMonth: 'active' | 'started' | 'ended';
908
+ }
909
+ export interface AdminRevenueWorkspaceGroup {
910
+ cid: string;
911
+ workspaceName: string;
912
+ totalRevenue: number;
913
+ totalMRR: number;
914
+ totalOneTime: number;
915
+ totalCreatorProfit: number;
916
+ totalHailerProfit: number;
917
+ creatorPercent: number;
918
+ productCount: number;
919
+ paidOut?: boolean;
920
+ productBreakdown: Array<{
921
+ productId: string;
922
+ productName: string;
923
+ installationCount: number;
924
+ totalRevenue: number;
925
+ subscriptionTypes: {
926
+ monthly: number;
927
+ yearly: number;
928
+ one_time: number;
929
+ };
930
+ installedBy: Array<{
931
+ cid: string;
932
+ workspaceName: string;
933
+ type: string;
934
+ }>;
935
+ }>;
936
+ purchases: AdminRevenuePurchase[];
937
+ }
938
+ export interface AdminRevenueWorkspaceSubscriptions {
939
+ totalWorkspaces: number;
940
+ totalRevenue: number;
941
+ byPlan: Array<{
942
+ planName: string;
943
+ count: number;
944
+ revenue: number;
945
+ }>;
946
+ }
947
+ export interface AdminRevenueStatistics {
948
+ selectedMonth: {
949
+ month: number;
950
+ year: number;
951
+ };
952
+ totalMRR: number;
953
+ totalOneTime: number;
954
+ totalRevenue: number;
955
+ activeCount: number;
956
+ hailerProfit: number;
957
+ creatorProfit: number;
958
+ }
959
+ export interface AdminRevenueListRequest {
960
+ month: number;
961
+ year: number;
962
+ filter?: {
963
+ workspaceId?: string;
964
+ purchaseType?: 'workspace' | 'product';
965
+ subscriptionType?: 'monthly' | 'yearly' | 'one_time';
966
+ search?: string;
967
+ };
968
+ options?: {
969
+ sortBy?: string;
970
+ sortOrder?: 'asc' | 'desc';
971
+ limit?: number;
972
+ skip?: number;
973
+ };
974
+ }
975
+ export interface AdminRevenueListResponse {
976
+ purchases: AdminRevenuePurchase[];
977
+ totalCount: number;
978
+ workspaceGroups: AdminRevenueWorkspaceGroup[];
979
+ statistics: AdminRevenueStatistics;
980
+ }
981
+ export interface StripeTaxLineItem {
982
+ amount: number;
983
+ reference: string;
984
+ tax_code?: string;
985
+ quantity?: number;
986
+ }
987
+ export interface StripeTaxCalculationRequest {
988
+ workspaceId: string;
989
+ lineItems: StripeTaxLineItem[];
990
+ }
991
+ export interface StripeTaxLineItemResult {
992
+ reference: string;
993
+ amount: number;
994
+ taxAmount: number;
995
+ totalAmount: number;
996
+ }
997
+ export interface StripeTaxCalculationResponse {
998
+ amountSubtotal: number;
999
+ amountTax: number;
1000
+ amountTotal: number;
1001
+ taxRate?: number;
1002
+ country?: string;
1003
+ countryName?: string;
1004
+ currency: string;
1005
+ lineItems: StripeTaxLineItemResult[];
1006
+ }
460
1007
  export {};
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hailer/app-sdk",
3
- "version": "2.0.0-beta-7",
3
+ "version": "2.0.0-beta-9",
4
4
  "description": "SDK for building Hailer Apps",
5
5
  "author": "",
6
6
  "license": "ISC",