-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Expand file tree
/
Copy pathtypes.ts
More file actions
987 lines (802 loc) · 25.8 KB
/
Copy pathtypes.ts
File metadata and controls
987 lines (802 loc) · 25.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
import type { SiteVisitTrackingSettingsValue } from "@/lib/sitemaps/site-visit-tracking";
import {
PartnerBountySchema,
partnerBountySubmissionSchema,
PartnerEarningsSchema,
partnerPayoutMethodSchema,
PartnerProfileCustomerSchema,
PartnerProfileLinkSchema,
partnerSubmittedLeadsCountByStatusSchema,
partnerUserSchema,
} from "@/lib/zod/schemas/partner-profile";
import { DirectorySyncProviders } from "@boxyhq/saml-jackson";
import {
Commission,
CommissionStatus,
FolderUserRole,
FraudEvent,
FraudEventGroup,
FraudRuleType,
Link,
PartnerGroup,
PartnerPayoutMethod,
PartnerRole,
PayoutStatus,
Prisma,
ProgramEnrollmentStatus,
Project,
SubmittedLead,
User,
UtmTemplate,
Webhook,
WorkflowTrigger,
WorkspaceRole,
} from "@dub/prisma/client";
import * as z from "zod/v4";
import { RESOURCE_COLORS } from "../ui/colors";
import {
apiLogCountRowSchema,
apiLogEnrichedSchema,
apiLogSchemaTB,
requestTypeSchema,
} from "./api-logs/schemas";
import { PAID_TRAFFIC_PLATFORMS } from "./api/fraud/constants";
import {
APPLICATION_EVENT_STAGES,
applicationEventAnalyticsQuerySchema,
applicationEventAnalyticsSchema,
applicationEventSchema,
applicationEventsQuerySchema,
} from "./application-events/schema";
import { BOUNTY_SUBMISSION_REQUIREMENTS } from "./bounty/constants";
import { BOUNTY_SOCIAL_PLATFORMS } from "./bounty/social-content";
import {
commissionAnalyticsQuerySchema,
commissionAnalyticsSchema,
} from "./commissions/schema";
import {
FOLDER_PERMISSIONS,
FOLDER_WORKSPACE_ACCESS,
} from "./folder/constants";
import { POSTBACK_TRIGGERS } from "./postback/constants";
import { postbackEventInputSchemaTB, postbackSchema } from "./postback/schemas";
import { WEBHOOK_TRIGGER_DESCRIPTIONS } from "./webhook/constants";
import {
activityLogActionSchema,
activityLogResourceTypeSchema,
activityLogSchema,
fieldDiffSchema,
getActivityLogsQuerySchema,
} from "./zod/schemas/activity-log";
import { adminNetworkPartnerSchema } from "./zod/schemas/admin";
import {
BountyListSchema,
bountyPerformanceConditionSchema,
BountySchema,
bountySocialContentIncrementalBonusSchema,
BountySubmissionExtendedSchema,
createBountySchema,
getBountySubmissionsQuerySchema,
socialContentOutputSchema,
submissionRequirementsSchema,
} from "./zod/schemas/bounties";
import {
CampaignListSchema,
CampaignSchema,
campaignSummarySchema,
campaignTriggerConditionSchema,
EMAIL_TEMPLATE_VARIABLES,
updateCampaignSchema,
} from "./zod/schemas/campaigns";
import {
clickEventResponseSchema,
clickEventSchemaTB,
} from "./zod/schemas/clicks";
import {
CommissionDetailSchema,
CommissionEnrichedSchema,
CommissionSchema,
createPartnerCommissionSchema,
} from "./zod/schemas/commissions";
import { customerActivityResponseSchema } from "./zod/schemas/customer-activity";
import {
CustomerEnrichedSchema,
CustomerSchema,
} from "./zod/schemas/customers";
import { dashboardSchema } from "./zod/schemas/dashboard";
import { DiscountCodeSchema, DiscountSchema } from "./zod/schemas/discount";
import { EmailDomainSchema } from "./zod/schemas/email-domains";
import { FolderSchema } from "./zod/schemas/folders";
import {
fraudGroupSchema,
fraudRuleSchema,
updateFraudRuleSettingsSchema,
} from "./zod/schemas/fraud";
import { GroupBountySummarySchema } from "./zod/schemas/group-bounties";
import { GroupWithProgramSchema } from "./zod/schemas/group-with-program";
import {
additionalPartnerLinkSchemaOptionalPath,
GroupSchema,
GroupSchemaExtended,
GroupWithFormDataSchema,
PartnerGroupDefaultLinkSchema,
} from "./zod/schemas/groups";
import { integrationSchema } from "./zod/schemas/integration";
import { InvoiceSchema } from "./zod/schemas/invoices";
import {
leadEventResponseSchema,
leadEventSchemaTB,
trackLeadResponseSchema,
} from "./zod/schemas/leads";
import {
ABTestVariantsSchema,
createLinkBodySchema,
} from "./zod/schemas/links";
import { MessageSchema } from "./zod/schemas/messages";
import { createOAuthAppSchema, oAuthAppSchema } from "./zod/schemas/oauth";
import {
NetworkPartnerSchema,
PartnerConversionScoreSchema,
} from "./zod/schemas/partner-network";
import { PartnerTagSchema } from "./zod/schemas/partner-tags";
import {
createPartnerSchema,
EnrolledPartnerSchema,
EnrolledPartnerSchemaExtended,
partnerPlatformSchema,
PartnerRewindSchema,
PartnerSchema,
WebhookPartnerSchema,
} from "./zod/schemas/partners";
import {
PartnerPayoutResponseSchema,
PayoutResponseSchema,
} from "./zod/schemas/payouts";
import { PartnerApplicationSchema } from "./zod/schemas/program-application";
import {
programApplicationFormDataWithValuesSchema,
programApplicationFormFieldWithValuesSchema,
programApplicationFormSchema,
} from "./zod/schemas/program-application-form";
import { programInviteEmailDataSchema } from "./zod/schemas/program-invite-email";
import { programLanderSchema } from "./zod/schemas/program-lander";
import {
NetworkProgramExtendedSchema,
NetworkProgramSchema,
} from "./zod/schemas/program-network";
import { programDataSchema } from "./zod/schemas/program-onboarding";
import {
applicationRequirementsSchema,
eligibilityConditionSchema,
PartnerCommentSchema,
ProgramEnrollmentSchema,
ProgramSchema,
} from "./zod/schemas/programs";
import {
CUSTOMER_SOURCES,
rewardConditionsArraySchema,
rewardConditionSchema,
rewardConditionsSchema,
rewardContextSchema,
RewardSchema,
} from "./zod/schemas/rewards";
import {
saleEventResponseSchema,
trackSaleResponseSchema,
} from "./zod/schemas/sales";
import { fraudEventContext } from "./zod/schemas/schemas";
import { submittedLeadFormDataSchema } from "./zod/schemas/submitted-lead-form";
import {
submittedLeadSchema,
updateSubmittedLeadStatusSchema,
} from "./zod/schemas/submitted-leads";
import { tokenSchema } from "./zod/schemas/token";
import { usageResponse } from "./zod/schemas/usage";
import {
createWebhookSchema,
webhookEventSchemaTB,
WebhookSchema,
} from "./zod/schemas/webhooks";
import {
WORKFLOW_ATTRIBUTES,
WORKFLOW_COMPARISON_OPERATORS,
workflowActionSchema,
workflowConditionSchema,
} from "./zod/schemas/workflows";
import { workspacePreferencesSchema } from "./zod/schemas/workspace-preferences";
import { workspaceUserSchema } from "./zod/schemas/workspaces";
export type LinkProps = Omit<Link, "saleAmount"> & {
saleAmount: number;
};
// used on client side (e.g. Link builder)
// TODO: standardize this with ExpandedLink
export type ExpandedLinkProps = LinkProps & {
tags: TagProps[];
webhookIds: string[];
dashboardId: string | null;
user?: UserProps;
};
export interface SimpleLinkProps {
domain: string;
key: string;
url: string;
}
export interface QRLinkProps {
domain: string;
key?: string;
url?: string;
}
export interface RedisLinkProps {
id: string;
url?: string;
trackConversion?: boolean;
password?: boolean;
proxy?: boolean;
rewrite?: boolean;
expiresAt?: Date;
expiredUrl?: string;
disabledAt?: Date;
ios?: string;
android?: string;
geo?: object;
doIndex?: boolean;
projectId?: string;
webhookIds?: string[];
programId?: string;
partnerId?: string;
partner?: Pick<PartnerProps, "id" | "name" | "image"> & {
groupId?: string | null;
tenantId?: string | null;
};
discount?: Pick<
DiscountProps,
"id" | "amount" | "type" | "maxDuration" | "couponId" | "couponTestId"
>;
testVariants?: z.infer<typeof ABTestVariantsSchema>;
testCompletedAt?: Date;
}
export type ResourceColorsEnum = (typeof RESOURCE_COLORS)[number];
export interface TagProps {
id: string;
name: string;
color: ResourceColorsEnum;
}
export type UtmTemplateProps = UtmTemplate;
export type UtmTemplateWithUserProps = UtmTemplateProps & {
user?: UserProps;
};
export type PlanProps = (typeof plans)[number];
export type BetaFeatures = "analyticsSettingsSiteVisitTracking";
export type PartnerBetaFeatures = "postbacks";
export interface WorkspaceProps
extends Omit<Project, "siteVisitTrackingSettings"> {
logo: string | null;
plan: PlanProps;
siteVisitTrackingSettings: SiteVisitTrackingSettingsValue | null;
domains: {
slug: string;
primary: boolean;
verified: boolean;
}[];
users: {
role: WorkspaceRole;
defaultFolderId: string | null;
}[];
flags?: {
[key in BetaFeatures]: boolean;
};
store: Record<string, any> | null;
}
export interface ExtendedWorkspaceProps extends WorkspaceProps {
domains: (WorkspaceProps["domains"][number] & {
linkRetentionDays: number | null;
})[];
defaultProgramId: string | null;
allowedHostnames: string[];
users: (WorkspaceProps["users"][number] & {
workspacePreferences?: z.infer<typeof workspacePreferencesSchema>;
})[];
publishableKey: string | null;
}
export type WorkspaceWithUsers = Omit<WorkspaceProps, "domains">;
export type WorkspaceUserProps = z.infer<typeof workspaceUserSchema>;
export interface UserProps {
id: string;
name: string;
email: string;
image?: string;
createdAt: Date;
source: string | null;
defaultWorkspace?: string;
defaultPartnerId?: string;
isMachine: boolean;
hasPassword: boolean;
provider: string | null;
}
export type DomainVerificationStatusProps =
| "Valid Configuration"
| "Invalid Configuration"
| "Conflicting DNS Records"
| "Pending Verification"
| "Domain Not Found"
| "Unknown Error";
export interface DomainProps {
id: string;
slug: string;
verified: boolean;
primary: boolean;
archived: boolean;
createdAt: Date;
placeholder?: string;
expiredUrl?: string;
notFoundUrl?: string;
projectId: string;
logo?: string;
appleAppSiteAssociation?: string;
assetLinks?: string;
deepviewData?: string;
link?: LinkProps;
registeredDomain?: RegisteredDomainProps;
}
export interface RegisteredDomainProps {
id: string;
autoRenewalDisabledAt: Date | null;
createdAt: Date;
expiresAt: Date;
renewalFee: number;
}
export interface BitlyGroupProps {
guid: string;
bsds: string[]; // custom domains
tags: string[];
}
export interface ImportedDomainCountProps {
id: number;
domain: string;
links: number;
}
export interface SAMLProviderProps {
name: string;
logo: string;
saml: "okta" | "azure" | "google";
samlModalCopy: string;
scim: keyof typeof DirectorySyncProviders;
scimModalCopy: {
url: string;
token: string;
};
}
export type NewLinkProps = z.infer<typeof createLinkBodySchema>;
type ProcessedLinkOverrides = "domain" | "key" | "url" | "projectId";
export type ProcessedLinkProps = Omit<NewLinkProps, ProcessedLinkOverrides> &
Pick<LinkProps, ProcessedLinkOverrides> & { userId?: LinkProps["userId"] } & {
createdAt?: Date;
id?: string;
partnerGroupDefaultLinkId?: string | null;
};
export const plans = [
"free",
"pro",
"business",
"business plus",
"business extra",
"business max",
"advanced",
"enterprise",
] as const;
export type DashboardProps = z.infer<typeof dashboardSchema>;
export type TokenProps = z.infer<typeof tokenSchema>;
export type OAuthAppProps = z.infer<typeof oAuthAppSchema>;
export type OAuthAppWithClientSecret = OAuthAppProps & { clientSecret: string };
export type NewOAuthApp = z.infer<typeof createOAuthAppSchema>;
export type IntegrationProps = z.infer<typeof integrationSchema>;
export type NewOrExistingIntegration = Omit<
IntegrationProps,
"id" | "verified" | "installations"
> & {
id?: string;
};
export type InstalledIntegrationProps = Pick<
IntegrationProps,
| "id"
| "projectId"
| "slug"
| "logo"
| "name"
| "developer"
| "description"
| "verified"
| "comingSoon"
| "guideUrl"
> & {
installations: number;
installed?: boolean;
};
export type InstalledIntegrationInfoProps = Pick<
IntegrationProps,
| "id"
| "projectId"
| "slug"
| "logo"
| "name"
| "developer"
| "description"
| "verified"
| "readme"
| "website"
| "screenshots"
| "installUrl"
> & {
createdAt: Date;
installed: {
id: string;
createdAt: Date;
by: {
id: string;
name: string | null;
email: string | null;
image: string | null;
};
} | null;
credentials?: Prisma.JsonValue;
settings?: Prisma.JsonValue;
webhookId?: string; // Only if the webhook is managed by an integration
};
export type WebhookTrigger = keyof typeof WEBHOOK_TRIGGER_DESCRIPTIONS;
export type WebhookProps = z.infer<typeof WebhookSchema>;
export type NewWebhook = z.infer<typeof createWebhookSchema>;
export type WebhookEventProps = z.infer<typeof webhookEventSchemaTB>;
export type WebhookCacheProps = Pick<
Webhook,
"id" | "url" | "secret" | "triggers" | "disabledAt"
>;
export type WebhookPartner = z.infer<typeof WebhookPartnerSchema>;
export type TrackLeadResponse = z.infer<typeof trackLeadResponseSchema>;
export type TrackSaleResponse = z.infer<typeof trackSaleResponseSchema>;
export type Customer = z.infer<typeof CustomerSchema>;
export type CustomerEnriched = z.infer<typeof CustomerEnrichedSchema>;
export type UsageResponse = z.infer<typeof usageResponse>;
export type PartnersCount = Record<ProgramEnrollmentStatus | "all", number>;
export type CommissionsCount = Record<
CommissionStatus | "all" | "hold",
{
count: number;
amount: number;
earnings: number;
}
>;
export type CommissionResponse = z.infer<typeof CommissionEnrichedSchema>;
export type PartnerEarningsResponse = z.infer<typeof PartnerEarningsSchema>;
export type CustomerProps = z.infer<typeof CustomerSchema>;
export type PartnerPlatformProps = z.infer<typeof partnerPlatformSchema>;
export type PartnerProps = z.infer<typeof PartnerSchema> & {
role: PartnerRole;
userId: string;
platforms: PartnerPlatformProps[];
defaultPayoutMethod: PartnerPayoutMethod | null;
};
export type PartnerRewindProps = z.infer<typeof PartnerRewindSchema>;
export type PartnerUserProps = z.infer<typeof partnerUserSchema>;
export type PartnerProfileCustomerProps = z.infer<
typeof PartnerProfileCustomerSchema
>;
export type PartnerProfileLinkProps = z.infer<typeof PartnerProfileLinkSchema>;
export type PartnerTagProps = z.infer<typeof PartnerTagSchema>;
export type PartnerPayoutMethodSetting = z.infer<
typeof partnerPayoutMethodSchema
>;
export type PartnerProfileSubmittedLeadsCountByStatus = z.infer<
typeof partnerSubmittedLeadsCountByStatusSchema
>;
export type EnrolledPartnerProps = z.infer<typeof EnrolledPartnerSchema> & {
platforms: PartnerPlatformProps[];
};
export type PartnerApplicationProps = z.infer<typeof PartnerApplicationSchema>;
export type NetworkPartnerProps = z.infer<typeof NetworkPartnerSchema>;
export type AdminNetworkPartner = z.infer<typeof adminNetworkPartnerSchema>;
export type PartnerConversionScore = z.infer<
typeof PartnerConversionScoreSchema
>;
export type NetworkProgramProps = z.infer<typeof NetworkProgramSchema>;
export type NetworkProgramExtendedProps = z.infer<
typeof NetworkProgramExtendedSchema
>;
export type EnrolledPartnerExtendedProps = z.infer<
typeof EnrolledPartnerSchemaExtended
> & {
platforms: PartnerPlatformProps[];
};
export type DiscountProps = z.infer<typeof DiscountSchema>;
export type DiscountCodeProps = z.infer<typeof DiscountCodeSchema>;
export type ProgramProps = Omit<
z.infer<typeof ProgramSchema>,
"referralFormData" | "applicationRequirements"
> & {
referralFormData?: Prisma.JsonValue | null;
applicationRequirements?: Prisma.JsonValue | null;
};
export type ProgramInviteEmailData = z.infer<
typeof programInviteEmailDataSchema
>;
export type ProgramLanderData = z.infer<typeof programLanderSchema>;
export type ProgramApplicationFormData = z.infer<
typeof programApplicationFormSchema
>;
export type ProgramApplicationFormDataWithValues = z.infer<
typeof programApplicationFormDataWithValuesSchema
>;
export type ProgramApplicationFormFieldWithValues = z.infer<
typeof programApplicationFormFieldWithValuesSchema
>;
export type ProgramEnrollmentProps = z.infer<typeof ProgramEnrollmentSchema>;
export type EligibilityConditionDB = z.infer<typeof eligibilityConditionSchema>;
export type ApplicationRequirementsDB = z.infer<
typeof applicationRequirementsSchema
>;
export type PayoutsCount = {
status: PayoutStatus;
count: number;
amount: number;
};
export type PayoutResponse = z.infer<typeof PayoutResponseSchema>;
export type PartnerPayoutResponse = z.infer<typeof PartnerPayoutResponseSchema>;
export type SegmentIntegrationCredentials = {
writeKey?: string;
};
export type InvoiceProps = z.infer<typeof InvoiceSchema>;
export type CustomerActivityResponse = z.infer<
typeof customerActivityResponseSchema
>;
export type ClickEvent = z.infer<typeof clickEventResponseSchema>;
export type SaleEvent = z.infer<typeof saleEventResponseSchema>;
export type LeadEvent = z.infer<typeof leadEventResponseSchema>;
// Folders
export type Folder = z.infer<typeof FolderSchema>;
export type FolderAccessLevel = keyof typeof FOLDER_WORKSPACE_ACCESS;
export type FolderPermission = (typeof FOLDER_PERMISSIONS)[number];
export type FolderUser = Pick<User, "id" | "name" | "email" | "image"> & {
role: FolderUserRole;
workspaceRole: WorkspaceRole;
};
export type FolderWithPermissions = {
id: string;
permissions: FolderPermission[];
};
export type FolderSummary = Pick<
Folder,
"id" | "name" | "description" | "accessLevel"
>;
export type RewardProps = z.infer<typeof RewardSchema>;
export type CreatePartnerProps = z.infer<typeof createPartnerSchema>;
export type ProgramData = z.infer<typeof programDataSchema>;
export type PaymentMethodOption = {
currency?: string;
mandate_options?: {
payment_schedule?: string;
transaction_type?: string;
};
};
export interface FolderLinkCount {
folderId: string;
_count: number;
}
export type RewardContext = z.infer<typeof rewardContextSchema>;
export type RewardCondition = z.infer<typeof rewardConditionSchema>;
export type RewardConditions = z.infer<typeof rewardConditionsSchema>;
export type RewardConditionsArray = z.infer<typeof rewardConditionsArraySchema>;
export type ClickEventTB = z.infer<typeof clickEventSchemaTB>;
export type LeadEventTB = z.infer<typeof leadEventSchemaTB>;
export type GroupProps = z.infer<typeof GroupSchema>;
export type GroupWithFormDataProps = z.infer<typeof GroupWithFormDataSchema>;
export type GroupWithProgramProps = z.infer<typeof GroupWithProgramSchema>;
export type GroupExtendedProps = z.infer<typeof GroupSchemaExtended>;
export type PartnerGroupDefaultLink = z.infer<
typeof PartnerGroupDefaultLinkSchema
>;
export type PartnerGroupAdditionalLink = z.infer<
typeof additionalPartnerLinkSchemaOptionalPath
>;
export type PartnerGroupProps = PartnerGroup & {
additionalLinks: PartnerGroupAdditionalLink[];
};
export type PartnerCommentProps = z.infer<typeof PartnerCommentSchema>;
export type BountyProps = z.infer<typeof BountySchema>;
export type BountyListProps = z.infer<typeof BountyListSchema>;
export type GroupBountySummaryProps = z.infer<typeof GroupBountySummarySchema>;
export type PartnerBountyProps = z.infer<typeof PartnerBountySchema>;
export type BountySubmissionProps = z.infer<
typeof BountySubmissionExtendedSchema
>;
export type BountySubmissionRequirement =
(typeof BOUNTY_SUBMISSION_REQUIREMENTS)[number];
export type SocialMetricsChannel =
(typeof BOUNTY_SOCIAL_PLATFORMS)[number]["value"];
export type WorkflowCondition = z.infer<typeof workflowConditionSchema>;
export type BountyPerformanceCondition = z.infer<
typeof bountyPerformanceConditionSchema
>;
export type BountySocialMetricsIncrementalBonus = z.infer<
typeof bountySocialContentIncrementalBonusSchema
>;
export type CampaignTriggerCondition = z.infer<
typeof campaignTriggerConditionSchema
>;
export type WorkflowConditionAttribute = (typeof WORKFLOW_ATTRIBUTES)[number];
export type WorkflowComparisonOperator =
(typeof WORKFLOW_COMPARISON_OPERATORS)[number];
export type WorkflowAction = z.infer<typeof workflowActionSchema>;
export type OperatorFn = (
aV: number,
cV: number | { min: number; max?: number },
) => boolean;
export type BountySubmissionsQueryFilters = z.infer<
typeof getBountySubmissionsQuerySchema
>;
export type Message = z.infer<typeof MessageSchema>;
export type CampaignList = z.infer<typeof CampaignListSchema>;
export type Campaign = z.infer<typeof CampaignSchema>;
export type UpdateCampaignFormData = z.infer<typeof updateCampaignSchema>;
export type CampaignSummary = z.infer<typeof campaignSummarySchema>;
export type StripeMode = "test" | "sandbox" | "live";
export type EmailTemplateVariables = Record<
(typeof EMAIL_TEMPLATE_VARIABLES)[number],
string | null | undefined
>;
export interface TiptapNode {
type: string;
text?: string;
attrs?: Record<string, any>;
content?: TiptapNode[];
marks?: Array<{ type: string; attrs?: Record<string, any> }>;
}
export interface CampaignWorkflowAttributeConfig {
label: string;
inputType: "number" | "currency" | "dropdown" | "none";
dropdownValues?: number[];
}
export type WorkflowAttribute = (typeof WORKFLOW_ATTRIBUTES)[number];
export type EmailDomainProps = z.infer<typeof EmailDomainSchema>;
export type FraudGroupProps = z.infer<typeof fraudGroupSchema>;
export type ExtendedFraudRuleType =
| FraudRuleType
| "partnerEmailDomainMismatch"
| "partnerEmailMasked"
| "partnerNoSocialLinks"
| "partnerNoVerifiedSocialLinks";
export type FraudSeverity = "low" | "medium" | "high";
export interface FraudTriggeredRule {
triggered: boolean;
metadata?: Record<string, unknown>;
}
export interface FraudRuleInfo {
type: ExtendedFraudRuleType;
name: string;
description: string;
severity?: FraudSeverity;
configurable: boolean;
scope: "partner" | "conversionEvent";
}
export type FraudRuleProps = z.infer<typeof fraudRuleSchema>;
export type FraudEventContext = z.infer<typeof fraudEventContext>;
export type PaidTrafficPlatform = (typeof PAID_TRAFFIC_PLATFORMS)[number];
export type UpdateFraudRuleSettings = z.infer<
typeof updateFraudRuleSettingsSchema
>;
export interface FraudGroupCountByPartner {
partnerId: string;
_count: number;
}
export interface FraudGroupCountByType {
type: FraudRuleType;
_count: number;
}
export type CreateFraudEventInput = Pick<
FraudEventGroup,
"programId" | "partnerId" | "type"
> &
Partial<
Pick<FraudEvent, "linkId" | "eventId" | "customerId" | "sourceProgramId">
> & {
metadata?: Record<string, unknown> | null;
};
interface WorkflowIdentity {
workspaceId: string;
programId: string;
partnerId: string;
groupId?: string;
customerId?: string;
customerFirstSaleAt?: Date;
}
interface PartnerMetrics {
leads?: number;
conversions?: number;
saleAmount?: number;
commissions?: number;
}
export interface WorkflowContext {
trigger: WorkflowTrigger;
reason?: "lead" | "sale" | "commission";
identity: WorkflowIdentity;
metrics?: {
current?: PartnerMetrics;
aggregated?: PartnerMetrics;
};
}
export type SubmittedLeadProps = z.infer<typeof submittedLeadSchema>;
export type SubmittedLeadFormDataField = z.infer<
typeof submittedLeadFormDataSchema
>;
export type UpdateSubmittedLeadStatusPayload = z.infer<
typeof updateSubmittedLeadStatusSchema
>;
export type CustomerSource = (typeof CUSTOMER_SOURCES)[number];
export type SubmittedLeadWithCustomer = SubmittedLead & {
customer: Customer | null;
};
export type GetActivityLogsQuery = z.infer<typeof getActivityLogsQuerySchema>;
export type ActivityLogResourceType = z.infer<
typeof activityLogResourceTypeSchema
>;
export type ActivityLogAction = z.infer<typeof activityLogActionSchema>;
export type FieldDiff = z.infer<typeof fieldDiffSchema>;
export type ChangeSet = Record<string, FieldDiff>;
export type ActivityLog = z.infer<typeof activityLogSchema>;
export type CreateBountyInput = z.infer<typeof createBountySchema>;
export type SocialContent = z.infer<typeof socialContentOutputSchema>;
export type SubmissionRequirements = z.infer<
typeof submissionRequirementsSchema
>;
export type BountySocialPlatform =
(typeof BOUNTY_SOCIAL_PLATFORMS)[number]["value"];
export type BountySocialPlatformMetric =
(typeof BOUNTY_SOCIAL_PLATFORMS)[number]["metrics"][number];
export type PostbackProps = z.infer<typeof postbackSchema>;
export type PostbackEventProps = z.infer<typeof postbackEventInputSchemaTB>;
export type PostbackTrigger = (typeof POSTBACK_TRIGGERS)[number];
export type CommissionDetail = z.infer<typeof CommissionDetailSchema>;
export type NullableOptional<T> = {
[K in keyof T]?: T[K] | null;
};
export type PartnerBountySubmission = z.infer<
typeof partnerBountySubmissionSchema
>;
export type CommissionActivitySnapshot = Pick<
Commission,
"amount" | "earnings" | "status"
>;
export type EnrichedApiLog = z.infer<typeof apiLogEnrichedSchema>;
export type ApiLogsCountRow = z.infer<typeof apiLogCountRowSchema>;
export type ApiLogsCountByRoutePattern = ApiLogsCountRow;
export type RequestType = z.infer<typeof requestTypeSchema>;
export type ApiLogTB = z.infer<typeof apiLogSchemaTB>;
// Commission events
export type CommissionAnalyticsQuery = z.infer<
typeof commissionAnalyticsQuerySchema
>;
export type CommissionAnalyticsGroupBy = CommissionAnalyticsQuery["groupBy"];
export type CommissionAnalyticsByGroup = {
[K in keyof typeof commissionAnalyticsSchema]: z.infer<
(typeof commissionAnalyticsSchema)[K]
>;
};
export type CommissionCategoryRow = CommissionAnalyticsByGroup["type"][number];
export type CommissionAnalyticsPartnerRow =
CommissionAnalyticsByGroup["partnerId"][number];
// Application events
export type ApplicationEvent = z.infer<typeof applicationEventSchema>;
export type ApplicationEventsQuery = z.infer<
typeof applicationEventsQuerySchema
>;
export type ApplicationEventAnalyticsQuery = z.infer<
typeof applicationEventAnalyticsQuerySchema
>;
export type ApplicationEventStages = (typeof APPLICATION_EVENT_STAGES)[number];
export type ApplicationAnalyticsByGroup = {
[K in keyof typeof applicationEventAnalyticsSchema]: z.infer<
(typeof applicationEventAnalyticsSchema)[K]
>;
};
export type CommissionProps = z.infer<typeof CommissionSchema>;
export type CreatePartnerCommissionProps = z.infer<
typeof createPartnerCommissionSchema
>;