@happyvertical/smrt-sales 0.57.22 → 0.57.23

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 (52) hide show
  1. package/AGENTS.md +8 -0
  2. package/README.md +17 -0
  3. package/agents/agreements.md +32 -0
  4. package/agents/crm.md +150 -0
  5. package/agents/svelte.md +7 -0
  6. package/dist/agreements/collections/AgreementCollection.d.ts +3 -2
  7. package/dist/agreements/collections/AgreementCollection.d.ts.map +1 -1
  8. package/dist/agreements/models/Agreement.d.ts.map +1 -1
  9. package/dist/agreements/services/AgreementExecutionService.d.ts +9 -0
  10. package/dist/agreements/services/AgreementExecutionService.d.ts.map +1 -1
  11. package/dist/agreements/types.d.ts +2 -0
  12. package/dist/agreements/types.d.ts.map +1 -1
  13. package/dist/agreements.js +2 -2
  14. package/dist/chunks/{__smrt-register__-bn1C2AUF.js → __smrt-register__-BRrJGGpG.js} +2 -2
  15. package/dist/chunks/{__smrt-register__-bn1C2AUF.js.map → __smrt-register__-BRrJGGpG.js.map} +1 -1
  16. package/dist/chunks/{agreements-jBiVmttD.js → agreements-RsyRLeDn.js} +35 -16
  17. package/dist/chunks/agreements-RsyRLeDn.js.map +1 -0
  18. package/dist/chunks/{crm-BRICSwf2.js → crm-BENK-hHd.js} +793 -123
  19. package/dist/chunks/crm-BENK-hHd.js.map +1 -0
  20. package/dist/commissions.js +1 -1
  21. package/dist/crm/collections/SalesGovernanceEventCollection.d.ts +7 -0
  22. package/dist/crm/collections/SalesGovernanceEventCollection.d.ts.map +1 -0
  23. package/dist/crm/collections/SalesGovernanceStateCollection.d.ts +13 -0
  24. package/dist/crm/collections/SalesGovernanceStateCollection.d.ts.map +1 -0
  25. package/dist/crm/index.d.ts +6 -0
  26. package/dist/crm/index.d.ts.map +1 -1
  27. package/dist/crm/models/SalesGovernanceEvent.d.ts +19 -0
  28. package/dist/crm/models/SalesGovernanceEvent.d.ts.map +1 -0
  29. package/dist/crm/models/SalesGovernanceState.d.ts +17 -0
  30. package/dist/crm/models/SalesGovernanceState.d.ts.map +1 -0
  31. package/dist/crm/services/SalesGovernanceService.d.ts +68 -0
  32. package/dist/crm/services/SalesGovernanceService.d.ts.map +1 -0
  33. package/dist/crm/services/governance-write.d.ts +4 -0
  34. package/dist/crm/services/governance-write.d.ts.map +1 -0
  35. package/dist/crm/services/sales-governance-types.d.ts +108 -0
  36. package/dist/crm/services/sales-governance-types.d.ts.map +1 -0
  37. package/dist/crm.js +3 -3
  38. package/dist/index.js +4 -4
  39. package/dist/manifest.json +522 -1
  40. package/dist/referrals.js +1 -1
  41. package/dist/smrt-knowledge.json +274 -12
  42. package/dist/svelte/components/SellerGovernancePanel.svelte +65 -0
  43. package/dist/svelte/components/SellerGovernancePanel.svelte.d.ts +13 -0
  44. package/dist/svelte/components/SellerGovernancePanel.svelte.d.ts.map +1 -0
  45. package/dist/svelte/index.d.ts +2 -1
  46. package/dist/svelte/index.d.ts.map +1 -1
  47. package/dist/svelte/index.js +1 -0
  48. package/dist/svelte/types.d.ts +19 -0
  49. package/dist/svelte/types.d.ts.map +1 -1
  50. package/package.json +6 -6
  51. package/dist/chunks/agreements-jBiVmttD.js.map +0 -1
  52. package/dist/chunks/crm-BRICSwf2.js.map +0 -1
@@ -1,3 +1,3 @@
1
- import "./chunks/__smrt-register__-bn1C2AUF.js";
1
+ import "./chunks/__smrt-register__-BRrJGGpG.js";
2
2
  import { A as COMMISSION_BASES, B as WATERFALL_POOL_RESIDUAL_RULES, C as WaterfallRecipientResolverRegistry, D as validateWaterfallPlan, E as prepareWaterfallPools, F as EARNER_SOURCE_ATTRIBUTION_STATUSES, G as Commission, H as CommissionPayoutCollection, I as EARNER_STATUSES, J as CommissionAdjustmentCollection, K as CommissionAdjustmentOperationCollection, L as EARNING_EVENT_KINDS, M as COMMISSION_PLAN_STATUSES, N as COMMISSION_STATUSES, O as ADJUSTMENT_SETTLEABLE_COMMISSION_STATUSES, P as EARNER_KINDS, R as PAYOUT_METHODS, S as validateCommissionPlanComponents, T as calculateWaterfallWithPools, U as CommissionPayout, V as WATERFALL_POOL_ZERO_WEIGHT_RULES, W as CommissionCollection, Y as CommissionAdjustment, _ as EarnerCollection, a as CommissionBalanceService, b as CommissionPlanCollection, c as CommissionAdjustmentValidationError, d as centsToAmount, f as roundCents, g as EarnerSourceAttribution, h as EarnerSourceAttributionCollection, i as CommissionCalculationService, j as COMMISSION_PAYOUT_STATUSES, k as COMMISSION_ADJUSTMENT_KINDS, l as amountToCents, m as EarningEvent, n as CommissionSettlementService, o as CommissionAdjustmentReplayConflictError, p as EarningEventCollection, q as CommissionAdjustmentOperation, r as CommissionPayoutService, s as CommissionAdjustmentService, t as EarnerAttributionService, u as calculateCommissionAmountCents, v as Earner, w as calculateWaterfall, x as CommissionPlan, y as validatePayoutDestination, z as PAYOUT_METHODS_REQUIRING_DESTINATION } from "./chunks/commissions-D5x24d4o.js";
3
3
  export { ADJUSTMENT_SETTLEABLE_COMMISSION_STATUSES, COMMISSION_ADJUSTMENT_KINDS, COMMISSION_BASES, COMMISSION_PAYOUT_STATUSES, COMMISSION_PLAN_STATUSES, COMMISSION_STATUSES, Commission, CommissionAdjustment, CommissionAdjustmentCollection, CommissionAdjustmentOperation, CommissionAdjustmentOperationCollection, CommissionAdjustmentReplayConflictError, CommissionAdjustmentService, CommissionAdjustmentValidationError, CommissionBalanceService, CommissionCalculationService, CommissionCollection, CommissionPayout, CommissionPayoutCollection, CommissionPayoutService, CommissionPlan, CommissionPlanCollection, CommissionSettlementService, EARNER_KINDS, EARNER_SOURCE_ATTRIBUTION_STATUSES, EARNER_STATUSES, EARNING_EVENT_KINDS, Earner, EarnerAttributionService, EarnerCollection, EarnerSourceAttribution, EarnerSourceAttributionCollection, EarningEvent, EarningEventCollection, PAYOUT_METHODS, PAYOUT_METHODS_REQUIRING_DESTINATION, WATERFALL_POOL_RESIDUAL_RULES, WATERFALL_POOL_ZERO_WEIGHT_RULES, WaterfallRecipientResolverRegistry, amountToCents, calculateCommissionAmountCents, calculateWaterfall, calculateWaterfallWithPools, centsToAmount, prepareWaterfallPools, roundCents, validateCommissionPlanComponents, validatePayoutDestination, validateWaterfallPlan };
@@ -0,0 +1,7 @@
1
+ /** Read immutable operation outcomes and history in the current tenant. */
2
+ import { SmrtCollection } from '@happyvertical/smrt-core';
3
+ import { SalesGovernanceEvent } from '../models/SalesGovernanceEvent.js';
4
+ export declare class SalesGovernanceEventCollection extends SmrtCollection<SalesGovernanceEvent> {
5
+ static readonly _itemClass: typeof SalesGovernanceEvent;
6
+ }
7
+ //# sourceMappingURL=SalesGovernanceEventCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SalesGovernanceEventCollection.d.ts","sourceRoot":"","sources":["../../../src/crm/collections/SalesGovernanceEventCollection.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,qBAAa,8BAA+B,SAAQ,cAAc,CAAC,oBAAoB,CAAC;IACtF,MAAM,CAAC,QAAQ,CAAC,UAAU,8BAAwB;CACnD"}
@@ -0,0 +1,13 @@
1
+ /** Tenant-filtered database serialization primitives for seller governance. */
2
+ import { SmrtCollection } from '@happyvertical/smrt-core';
3
+ import { SalesGovernanceState } from '../models/SalesGovernanceState.js';
4
+ export declare class SalesGovernanceStateCollection extends SmrtCollection<SalesGovernanceState> {
5
+ static readonly _itemClass: typeof SalesGovernanceState;
6
+ /** Insert the shared resource fence without changing its current owner. */
7
+ ensure(id: string): Promise<void>;
8
+ /** Serialize a resource on pooled adapters and reload its committed state. */
9
+ lock(id: string): Promise<SalesGovernanceState>;
10
+ /** CAS is the cross-process serialization point; losers must retry the operation. */
11
+ compareAndSwap(id: string, revision: number, payload: string): Promise<boolean>;
12
+ }
13
+ //# sourceMappingURL=SalesGovernanceStateCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SalesGovernanceStateCollection.d.ts","sourceRoot":"","sources":["../../../src/crm/collections/SalesGovernanceStateCollection.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAIzE,qBAAa,8BAA+B,SAAQ,cAAc,CAAC,oBAAoB,CAAC;IACtF,MAAM,CAAC,QAAQ,CAAC,UAAU,8BAAwB;IAElD,2EAA2E;IACrE,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUvC,8EAA8E;IACxE,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAerD,qFAAqF;IAC/E,cAAc,CAClB,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,CAAC;CAUpB"}
@@ -15,6 +15,8 @@ export { OpportunityConversionCollection } from './collections/OpportunityConver
15
15
  export { PipelineDefinitionCollection } from './collections/PipelineDefinitionCollection.js';
16
16
  export { PipelineStageCollection } from './collections/PipelineStageCollection.js';
17
17
  export { SalesActivityCollection } from './collections/SalesActivityCollection.js';
18
+ export { SalesGovernanceEventCollection } from './collections/SalesGovernanceEventCollection.js';
19
+ export { SalesGovernanceStateCollection } from './collections/SalesGovernanceStateCollection.js';
18
20
  export { SalesRepresentativeCollection } from './collections/SalesRepresentativeCollection.js';
19
21
  export { Lead } from './models/Lead.js';
20
22
  export { Opportunity } from './models/Opportunity.js';
@@ -22,6 +24,8 @@ export { OpportunityConversion } from './models/OpportunityConversion.js';
22
24
  export { PipelineDefinition } from './models/PipelineDefinition.js';
23
25
  export { PipelineStage } from './models/PipelineStage.js';
24
26
  export { SalesActivity } from './models/SalesActivity.js';
27
+ export { SalesGovernanceEvent } from './models/SalesGovernanceEvent.js';
28
+ export { SalesGovernanceState } from './models/SalesGovernanceState.js';
25
29
  export { SalesRepresentative } from './models/SalesRepresentative.js';
26
30
  export { SalesPipelineRecipe } from './recipes.js';
27
31
  export type { GetLeadConversionInput, LeadConversionReceipt, RecordLeadConversionInput, } from './services/LeadConversionService.js';
@@ -29,5 +33,7 @@ export { LeadConversionService } from './services/LeadConversionService.js';
29
33
  export type { AssignLeadInput, AssignLeadResult, CloseOpportunityInput, CloseOpportunityResult, CompleteLeadNextActionInput, CompleteLeadNextActionResult, CreateLeadInput, CreateLeadResult, DisqualifyLeadInput, GetLeadWorkStateInput, LeadDedupePolicy, LeadHumanActivityKind, LeadWorkflowValidationReason, LeadWorkQueueInput, LeadWorkQueueProjection, LeadWorkQueueState, LeadWorkState, MoveOpportunityToStageInput, MoveOpportunityToStageResult, OpportunityConversionInput, QualifyLeadInput, QualifyLeadResult, RecordLeadActivityInput, ScheduleLeadNextActionInput, StartWorkingInput, UpdateLeadContactInput, } from './services/LeadWorkflowService.js';
30
34
  export { LEAD_HUMAN_ACTIVITY_KINDS, LeadWorkflowService, LeadWorkflowValidationError, MAX_LEAD_WORKFLOW_TEXT_LENGTH, projectLeadWorkQueue, } from './services/LeadWorkflowService.js';
31
35
  export type { LeadInboxItem, LeadInboxOptions, LeadInboxResult, LeadInboxSort, LeadInboxStatusCounts, } from './services/lead-inbox.js';
36
+ export { SalesGovernanceError, SalesGovernanceService, } from './services/SalesGovernanceService.js';
37
+ export type * from './services/sales-governance-types.js';
32
38
  export * from './types.js';
33
39
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/crm/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,+BAA+B,EAAE,MAAM,kDAAkD,CAAC;AACnG,OAA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,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC3B,4BAA4B,EAC5B,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,4BAA4B,EAC5B,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,2BAA2B,EAC3B,4BAA4B,EAC5B,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,2BAA2B,EAC3B,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,2BAA2B,EAC3B,6BAA6B,EAC7B,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,sCAAsC,CAAC;AAC9C,mBAAmB,sCAAsC,CAAC;AAE1D,cAAc,YAAY,CAAC"}
@@ -0,0 +1,19 @@
1
+ /** Immutable intent/result audit for seller governance operations. */
2
+ import { SmrtObject, type SmrtObjectOptions } from '@happyvertical/smrt-core';
3
+ export interface SalesGovernanceEventOptions extends SmrtObjectOptions {
4
+ tenantId?: string;
5
+ intent?: string;
6
+ result?: string;
7
+ }
8
+ /** UUID replay fence and immutable audit; no generated mutation surface. */
9
+ export declare class SalesGovernanceEvent extends SmrtObject {
10
+ tenantId: string;
11
+ intent: string;
12
+ result: string;
13
+ constructor(options?: SalesGovernanceEventOptions);
14
+ initialize(): Promise<this>;
15
+ save(): Promise<this>;
16
+ delete(): Promise<void>;
17
+ private snapshot;
18
+ }
19
+ //# sourceMappingURL=SalesGovernanceEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SalesGovernanceEvent.d.ts","sourceRoot":"","sources":["../../../src/crm/models/SalesGovernanceEvent.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EACL,UAAU,EACV,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAKlC,MAAM,WAAW,2BAA4B,SAAQ,iBAAiB;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAGD,4EAA4E;AAC5E,qBAEa,oBAAqB,SAAQ,UAAU;IAElD,QAAQ,EAAE,MAAM,CAAM;IACtB,MAAM,EAAE,MAAM,CAAM;IACpB,MAAM,EAAE,MAAM,CAAM;gBAER,OAAO,GAAE,2BAAgC;IAOtC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAWrB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAItC,OAAO,CAAC,QAAQ;CAGjB"}
@@ -0,0 +1,17 @@
1
+ /** Private transactional state for advertiser leases and governed quotes. */
2
+ import { SmrtObject, type SmrtObjectOptions } from '@happyvertical/smrt-core';
3
+ export interface SalesGovernanceStateOptions extends SmrtObjectOptions {
4
+ tenantId?: string;
5
+ revision?: number;
6
+ payload?: string;
7
+ }
8
+ /** Service-owned compare-and-swap fence. Migrate through the SMRT manifest. */
9
+ export declare class SalesGovernanceState extends SmrtObject {
10
+ tenantId: string;
11
+ revision: number;
12
+ payload: string;
13
+ constructor(options?: SalesGovernanceStateOptions);
14
+ save(): Promise<this>;
15
+ delete(): Promise<void>;
16
+ }
17
+ //# sourceMappingURL=SalesGovernanceState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SalesGovernanceState.d.ts","sourceRoot":"","sources":["../../../src/crm/models/SalesGovernanceState.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,OAAO,EACL,UAAU,EACV,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAKlC,MAAM,WAAW,2BAA4B,SAAQ,iBAAiB;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,+EAA+E;AAC/E,qBAEa,oBAAqB,SAAQ,UAAU;IAElD,QAAQ,EAAE,MAAM,CAAM;IACtB,QAAQ,EAAE,MAAM,CAAK;IACrB,OAAO,EAAE,MAAM,CAAQ;gBAEX,OAAO,GAAE,2BAAgC;IAMtC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAGvC"}
@@ -0,0 +1,68 @@
1
+ import { type DatabaseInterface } from '@happyvertical/sql';
2
+ import type { SalesAdvertiserLease, SalesApprovalDecision, SalesCreateQuoteInput, SalesGovernanceDatabaseConfig, SalesGovernanceHost, SalesLeaseChangeInput, SalesLeaseInput, SalesQuoteOperation, SalesQuoteSnapshot, SellerContext } from './sales-governance-types.js';
3
+ export declare class SalesGovernanceError extends Error {
4
+ readonly reason: string;
5
+ readonly code = "SALES_GOVERNANCE_DENIED";
6
+ constructor(reason: string);
7
+ }
8
+ /** All writes run in one transaction, or participate in the explicitly supplied executor. */
9
+ export declare class SalesGovernanceService {
10
+ #private;
11
+ private readonly host;
12
+ private readonly now;
13
+ private constructor();
14
+ /** Owned adapter for migrations and host reads; transaction writes use withTransaction. */
15
+ get database(): DatabaseInterface;
16
+ static create(options: {
17
+ database: SalesGovernanceDatabaseConfig;
18
+ host: SalesGovernanceHost;
19
+ now?: () => Date;
20
+ }): Promise<SalesGovernanceService>;
21
+ /**
22
+ * Run host writes and any governance mutations on one positively identified
23
+ * executor. A thrown callback rolls back all changes. Do not retain tx.
24
+ */
25
+ withTransaction<T>(fn: (tx: DatabaseInterface) => Promise<T>): Promise<T>;
26
+ /** First successful registration wins until expiresAtMs <= now, or release. */
27
+ acquireLease(input: SalesLeaseInput, transaction?: DatabaseInterface): Promise<SalesAdvertiserLease>;
28
+ /** Renewal requires a live matching owner token; it starts a fresh policy duration. */
29
+ renewLease(input: SalesLeaseChangeInput, transaction?: DatabaseInterface): Promise<SalesAdvertiserLease>;
30
+ /** Release never transfers ownership and is audited even at the expiry boundary. */
31
+ releaseLease(input: SalesLeaseChangeInput, transaction?: DatabaseInterface): Promise<SalesAdvertiserLease>;
32
+ private changeLease;
33
+ /** Freeze one immutable commercial revision. Amendments use a greater revision. */
34
+ createQuote(input: SalesCreateQuoteInput, transaction?: DatabaseInterface): Promise<SalesQuoteSnapshot>;
35
+ requestApproval(input: SalesQuoteOperation, transaction?: DatabaseInterface): Promise<SalesQuoteSnapshot>;
36
+ decideApproval(input: SalesApprovalDecision, transaction?: DatabaseInterface): Promise<SalesQuoteSnapshot>;
37
+ issueQuote(input: SalesQuoteOperation, transaction?: DatabaseInterface): Promise<SalesQuoteSnapshot>;
38
+ /** Commit local sign authority before provider I/O; never send directly from a stale quote. */
39
+ signQuote(input: SalesQuoteOperation, transaction?: DatabaseInterface): Promise<SalesQuoteSnapshot>;
40
+ private transition;
41
+ /** Provider preflight, including retries of already-signed local records. */
42
+ assertCanSign(input: Omit<SalesQuoteOperation, 'operationId'>, transaction?: DatabaseInterface): Promise<void>;
43
+ /** Read canonical registration for an authorized current tenant member. */
44
+ getLease(input: SellerContext & {
45
+ advertiserId: string;
46
+ }): Promise<SalesAdvertiserLease | null>;
47
+ /** Tenant-scoped UI projection. Authority is always rechecked by mutation methods. */
48
+ getQuote(input: {
49
+ tenantId: string;
50
+ quoteId: string;
51
+ revision: number;
52
+ }): Promise<SalesQuoteSnapshot | null>;
53
+ private approved;
54
+ private assertLiveLease;
55
+ private validateSellerQuote;
56
+ private quote;
57
+ private seller;
58
+ private context;
59
+ private advertiser;
60
+ private assertContext;
61
+ private time;
62
+ private store;
63
+ private operation;
64
+ private assertBackend;
65
+ private inCanonicalTenant;
66
+ private run;
67
+ }
68
+ //# sourceMappingURL=SalesGovernanceService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SalesGovernanceService.d.ts","sourceRoot":"","sources":["../../../src/crm/services/SalesGovernanceService.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,iBAAiB,EAAe,MAAM,oBAAoB,CAAC;AAMzE,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,6BAA6B,EAC7B,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAElB,aAAa,EAGd,MAAM,6BAA6B,CAAC;AAErC,qBAAa,oBAAqB,SAAQ,KAAK;IAEjC,QAAQ,CAAC,MAAM,EAAE,MAAM;IADnC,QAAQ,CAAC,IAAI,6BAA6B;gBACrB,MAAM,EAAE,MAAM;CAIpC;AAYD,6FAA6F;AAC7F,qBAAa,sBAAsB;;IAO/B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAJtB,OAAO;IAUP,2FAA2F;IAC3F,IAAI,QAAQ,IAAI,iBAAiB,CAEhC;WAEY,MAAM,CAAC,OAAO,EAAE;QAC3B,QAAQ,EAAE,6BAA6B,CAAC;QACxC,IAAI,EAAE,mBAAmB,CAAC;QAC1B,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;KAClB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAoCnC;;;OAGG;IACG,eAAe,CAAC,CAAC,EACrB,EAAE,EAAE,CAAC,EAAE,EAAE,iBAAiB,KAAK,OAAO,CAAC,CAAC,CAAC,GACxC,OAAO,CAAC,CAAC,CAAC;IAcb,+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CAAC;IAmBvC,sFAAsF;IAChF,QAAQ,CAAC,KAAK,EAAE;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAsBtC,OAAO,CAAC,QAAQ;YAmBF,eAAe;YAqBf,mBAAmB;YAgCnB,KAAK;YAmBL,MAAM;YA+BN,OAAO;YAUP,UAAU;IAYxB,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,IAAI;YAKE,KAAK;YAcL,SAAS;IAyCvB,OAAO,CAAC,aAAa;YAIP,iBAAiB;YAKjB,GAAG;CA0BlB"}
@@ -0,0 +1,4 @@
1
+ import type { DatabaseInterface } from '@happyvertical/sql';
2
+ export declare function withGovernanceWrite<T>(db: DatabaseInterface, fn: () => Promise<T>): Promise<T>;
3
+ export declare function assertGovernanceWrite(db: DatabaseInterface): void;
4
+ //# sourceMappingURL=governance-write.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"governance-write.d.ts","sourceRoot":"","sources":["../../../src/crm/services/governance-write.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,EAAE,EAAE,iBAAiB,EACrB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CAEZ;AACD,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,iBAAiB,GAAG,IAAI,CAGjE"}
@@ -0,0 +1,108 @@
1
+ /** Public host contracts for governed sales. Monetary values are integer cents. */
2
+ import type { DatabaseInterface } from '@happyvertical/sql';
3
+ /** Owned connection options. Schema creation and arbitrary adapter injection are excluded. */
4
+ export type SalesGovernanceDatabaseConfig = {
5
+ type: 'postgres';
6
+ url: string;
7
+ /** Owned adapters are never cached; true is rejected before opening SQL. */
8
+ cache?: false;
9
+ dbid?: string;
10
+ max?: number;
11
+ connectionTimeoutMillis?: number;
12
+ idleTimeoutMillis?: number;
13
+ };
14
+ /** UUID identities accept either case; all service/host values use lowercase. */
15
+ export interface SellerContext {
16
+ tenantId: string;
17
+ actorProfileId: string;
18
+ }
19
+ export interface SellerOperation extends SellerContext {
20
+ /** Globally unique UUID; exact retries must reuse it. */
21
+ operationId: string;
22
+ }
23
+ export interface SellerPolicy {
24
+ version: string;
25
+ /** Exact integer basis points, 0..10000. */
26
+ maxDiscountBps: number;
27
+ leaseDurationMs: number;
28
+ approvalDurationMs: number;
29
+ }
30
+ export interface SalesQuoteTerms {
31
+ quoteId: string;
32
+ revision: number;
33
+ sellerId: string;
34
+ /** Canonical advertiser UUID; quote actions require this seller's live lease. */
35
+ advertiserId: string;
36
+ rateCardVersion: string;
37
+ subtotalCents: number;
38
+ totalCents: number;
39
+ currency: string;
40
+ /** Opaque inventory revision validated authoritatively by the host. */
41
+ inventoryVersion: string;
42
+ }
43
+ export interface SalesQuoteSnapshot extends SalesQuoteTerms {
44
+ tenantId: string;
45
+ makerProfileId: string;
46
+ policy: SellerPolicy;
47
+ status: 'draft' | 'issued' | 'signed';
48
+ approval: SalesDiscountApproval | null;
49
+ }
50
+ export interface SalesDiscountApproval {
51
+ requestId: string;
52
+ status: 'pending' | 'approved' | 'rejected' | 'revoked';
53
+ termsHash: string;
54
+ checkerProfileId: string | null;
55
+ expiresAtMs: number;
56
+ reason: string;
57
+ }
58
+ export interface SalesAdvertiserLease {
59
+ tenantId: string;
60
+ advertiserId: string;
61
+ sellerId: string;
62
+ leaseId: string;
63
+ expiresAtMs: number;
64
+ released: boolean;
65
+ }
66
+ export interface SellerPolicyContext extends SellerContext {
67
+ sellerId: string;
68
+ }
69
+ /**
70
+ * Mandatory host predicates. Return literal true to authorize; false, missing
71
+ * results, and thrown upstream errors all fail closed. Use the supplied executor
72
+ * to lock authoritative membership, suspension, policy and inventory sources.
73
+ * Network calls cannot establish transactionally stable authority.
74
+ */
75
+ export interface SalesGovernanceHost {
76
+ isMember(context: SellerContext, db: DatabaseInterface): Promise<boolean>;
77
+ isUnsuspended(context: SellerContext, db: DatabaseInterface): Promise<boolean>;
78
+ canSell(context: SellerPolicyContext, db: DatabaseInterface): Promise<boolean>;
79
+ canApprove(context: SellerContext, db: DatabaseInterface): Promise<boolean>;
80
+ advertiserExists(context: SellerContext & {
81
+ advertiserId: string;
82
+ }, db: DatabaseInterface): Promise<boolean>;
83
+ policy(context: SellerPolicyContext, db: DatabaseInterface): Promise<SellerPolicy>;
84
+ validateQuote(quote: SalesQuoteTerms & {
85
+ tenantId: string;
86
+ }, db: DatabaseInterface): Promise<boolean>;
87
+ }
88
+ export interface SalesLeaseInput extends SellerOperation {
89
+ sellerId: string;
90
+ advertiserId: string;
91
+ }
92
+ export interface SalesLeaseChangeInput extends SalesLeaseInput {
93
+ /** Optimistic owner token: prevents delayed release/renew of a newer lease. */
94
+ leaseId: string;
95
+ }
96
+ export interface SalesCreateQuoteInput extends SellerOperation {
97
+ terms: SalesQuoteTerms;
98
+ }
99
+ export interface SalesQuoteOperation extends SellerOperation {
100
+ quoteId: string;
101
+ revision: number;
102
+ }
103
+ export interface SalesApprovalDecision extends SalesQuoteOperation {
104
+ requestId: string;
105
+ decision: 'approved' | 'rejected' | 'revoked';
106
+ reason: string;
107
+ }
108
+ //# sourceMappingURL=sales-governance-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sales-governance-types.d.ts","sourceRoot":"","sources":["../../../src/crm/services/sales-governance-types.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,8FAA8F;AAC9F,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,UAAU,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,4EAA4E;IAC5E,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,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AC,CAAC;CACrB;AACD,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AACD,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,+EAA+E;IAC/E,OAAO,EAAE,MAAM,CAAC;CACjB;AACD,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,KAAK,EAAE,eAAe,CAAC;CACxB;AACD,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB;IAChE,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;IAC9C,MAAM,EAAE,MAAM,CAAC;CAChB"}
package/dist/crm.js CHANGED
@@ -1,3 +1,3 @@
1
- import "./chunks/__smrt-register__-bn1C2AUF.js";
2
- import { C as LEAD_STATUSES, D as SALES_ACTIVITY_SUBJECT_KINDS, E as SALES_ACTIVITY_KINDS, O as SALES_REPRESENTATIVE_STATUSES, S as DEFAULT_PIPELINE_STAGES, T as PIPELINE_STATUSES, _ as SalesActivity, a as projectLeadWorkQueue, b as Opportunity, c as OpportunityConversionCollection, d as SalesRepresentativeCollection, f as SalesRepresentative, g as SalesActivityCollection, h as OpportunityCollection, i as MAX_LEAD_WORKFLOW_TEXT_LENGTH, k as Lead, l as OpportunityConversion, m as PipelineDefinition, n as LeadWorkflowService, o as LeadConversionService, p as PipelineDefinitionCollection, r as LeadWorkflowValidationError, s as SalesPipelineRecipe, t as LEAD_HUMAN_ACTIVITY_KINDS, u as LeadCollection, v as PipelineStageCollection, w as OPPORTUNITY_STATUSES, x as DEFAULT_PIPELINE_KEY, y as PipelineStage } from "./chunks/crm-BRICSwf2.js";
3
- export { DEFAULT_PIPELINE_KEY, DEFAULT_PIPELINE_STAGES, LEAD_HUMAN_ACTIVITY_KINDS, LEAD_STATUSES, Lead, LeadCollection, LeadConversionService, LeadWorkflowService, LeadWorkflowValidationError, MAX_LEAD_WORKFLOW_TEXT_LENGTH, OPPORTUNITY_STATUSES, Opportunity, OpportunityCollection, OpportunityConversion, OpportunityConversionCollection, PIPELINE_STATUSES, PipelineDefinition, PipelineDefinitionCollection, PipelineStage, PipelineStageCollection, SALES_ACTIVITY_KINDS, SALES_ACTIVITY_SUBJECT_KINDS, SALES_REPRESENTATIVE_STATUSES, SalesActivity, SalesActivityCollection, SalesPipelineRecipe, SalesRepresentative, SalesRepresentativeCollection, projectLeadWorkQueue };
1
+ import "./chunks/__smrt-register__-BRrJGGpG.js";
2
+ import { A as OPPORTUNITY_STATUSES, C as SalesActivity, D as DEFAULT_PIPELINE_KEY, E as Opportunity, F as Lead, M as SALES_ACTIVITY_KINDS, N as SALES_ACTIVITY_SUBJECT_KINDS, O as DEFAULT_PIPELINE_STAGES, P as SALES_REPRESENTATIVE_STATUSES, S as SalesActivityCollection, T as PipelineStage, _ as SalesRepresentativeCollection, a as LeadWorkflowValidationError, b as PipelineDefinition, c as LeadConversionService, d as SalesGovernanceState, f as SalesGovernanceEventCollection, g as LeadCollection, h as OpportunityConversion, i as LeadWorkflowService, j as PIPELINE_STATUSES, k as LEAD_STATUSES, l as SalesPipelineRecipe, m as OpportunityConversionCollection, n as SalesGovernanceService, o as MAX_LEAD_WORKFLOW_TEXT_LENGTH, p as SalesGovernanceEvent, r as LEAD_HUMAN_ACTIVITY_KINDS, s as projectLeadWorkQueue, t as SalesGovernanceError, u as SalesGovernanceStateCollection, v as SalesRepresentative, w as PipelineStageCollection, x as OpportunityCollection, y as PipelineDefinitionCollection } from "./chunks/crm-BENK-hHd.js";
3
+ export { DEFAULT_PIPELINE_KEY, DEFAULT_PIPELINE_STAGES, LEAD_HUMAN_ACTIVITY_KINDS, LEAD_STATUSES, Lead, LeadCollection, LeadConversionService, LeadWorkflowService, LeadWorkflowValidationError, MAX_LEAD_WORKFLOW_TEXT_LENGTH, OPPORTUNITY_STATUSES, Opportunity, OpportunityCollection, OpportunityConversion, OpportunityConversionCollection, PIPELINE_STATUSES, PipelineDefinition, PipelineDefinitionCollection, PipelineStage, PipelineStageCollection, SALES_ACTIVITY_KINDS, SALES_ACTIVITY_SUBJECT_KINDS, SALES_REPRESENTATIVE_STATUSES, SalesActivity, SalesActivityCollection, SalesGovernanceError, SalesGovernanceEvent, SalesGovernanceEventCollection, SalesGovernanceService, SalesGovernanceState, SalesGovernanceStateCollection, SalesPipelineRecipe, SalesRepresentative, SalesRepresentativeCollection, projectLeadWorkQueue };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import "./chunks/__smrt-register__-bn1C2AUF.js";
2
- import { a as AgreementExecutionEvent, c as AgreementCollection, d as serializeAgreementParty, f as AGREEMENT_EXECUTION_STATUSES, g as sanitizeSignerIntent, h as sanitizeSignerEvidence, i as AgreementExecutionEventCollection, l as Agreement, m as coerceAgreementDate, n as ExecutedAgreementCollection, o as AgreementExecutionCollection, p as AGREEMENT_STATUSES, r as ExecutedAgreement, s as AgreementExecution, t as AgreementExecutionService, u as parseAgreementParty } from "./chunks/agreements-jBiVmttD.js";
1
+ import "./chunks/__smrt-register__-BRrJGGpG.js";
2
+ import { a as AgreementExecutionEvent, c as AgreementCollection, d as serializeAgreementParty, f as AGREEMENT_EXECUTION_STATUSES, g as sanitizeSignerIntent, h as sanitizeSignerEvidence, i as AgreementExecutionEventCollection, l as Agreement, m as coerceAgreementDate, n as ExecutedAgreementCollection, o as AgreementExecutionCollection, p as AGREEMENT_STATUSES, r as ExecutedAgreement, s as AgreementExecution, t as AgreementExecutionService, u as parseAgreementParty } from "./chunks/agreements-RsyRLeDn.js";
3
3
  import { A as COMMISSION_BASES, B as WATERFALL_POOL_RESIDUAL_RULES, C as WaterfallRecipientResolverRegistry, D as validateWaterfallPlan, E as prepareWaterfallPools, F as EARNER_SOURCE_ATTRIBUTION_STATUSES, G as Commission, H as CommissionPayoutCollection, I as EARNER_STATUSES, J as CommissionAdjustmentCollection, K as CommissionAdjustmentOperationCollection, L as EARNING_EVENT_KINDS, M as COMMISSION_PLAN_STATUSES, N as COMMISSION_STATUSES, O as ADJUSTMENT_SETTLEABLE_COMMISSION_STATUSES, P as EARNER_KINDS, R as PAYOUT_METHODS, S as validateCommissionPlanComponents, T as calculateWaterfallWithPools, U as CommissionPayout, V as WATERFALL_POOL_ZERO_WEIGHT_RULES, W as CommissionCollection, Y as CommissionAdjustment, _ as EarnerCollection, a as CommissionBalanceService, b as CommissionPlanCollection, c as CommissionAdjustmentValidationError, d as centsToAmount, f as roundCents, g as EarnerSourceAttribution, h as EarnerSourceAttributionCollection, i as CommissionCalculationService, j as COMMISSION_PAYOUT_STATUSES, k as COMMISSION_ADJUSTMENT_KINDS, l as amountToCents, m as EarningEvent, n as CommissionSettlementService, o as CommissionAdjustmentReplayConflictError, p as EarningEventCollection, q as CommissionAdjustmentOperation, r as CommissionPayoutService, s as CommissionAdjustmentService, t as EarnerAttributionService, u as calculateCommissionAmountCents, v as Earner, w as calculateWaterfall, x as CommissionPlan, y as validatePayoutDestination, z as PAYOUT_METHODS_REQUIRING_DESTINATION } from "./chunks/commissions-D5x24d4o.js";
4
- import { C as LEAD_STATUSES, D as SALES_ACTIVITY_SUBJECT_KINDS, E as SALES_ACTIVITY_KINDS, O as SALES_REPRESENTATIVE_STATUSES, S as DEFAULT_PIPELINE_STAGES, T as PIPELINE_STATUSES, _ as SalesActivity, a as projectLeadWorkQueue, b as Opportunity, c as OpportunityConversionCollection, d as SalesRepresentativeCollection, f as SalesRepresentative, g as SalesActivityCollection, h as OpportunityCollection, i as MAX_LEAD_WORKFLOW_TEXT_LENGTH, k as Lead, l as OpportunityConversion, m as PipelineDefinition, n as LeadWorkflowService, o as LeadConversionService, p as PipelineDefinitionCollection, r as LeadWorkflowValidationError, s as SalesPipelineRecipe, t as LEAD_HUMAN_ACTIVITY_KINDS, u as LeadCollection, v as PipelineStageCollection, w as OPPORTUNITY_STATUSES, x as DEFAULT_PIPELINE_KEY, y as PipelineStage } from "./chunks/crm-BRICSwf2.js";
4
+ import { A as OPPORTUNITY_STATUSES, C as SalesActivity, D as DEFAULT_PIPELINE_KEY, E as Opportunity, F as Lead, M as SALES_ACTIVITY_KINDS, N as SALES_ACTIVITY_SUBJECT_KINDS, O as DEFAULT_PIPELINE_STAGES, P as SALES_REPRESENTATIVE_STATUSES, S as SalesActivityCollection, T as PipelineStage, _ as SalesRepresentativeCollection, a as LeadWorkflowValidationError, b as PipelineDefinition, c as LeadConversionService, d as SalesGovernanceState, f as SalesGovernanceEventCollection, g as LeadCollection, h as OpportunityConversion, i as LeadWorkflowService, j as PIPELINE_STATUSES, k as LEAD_STATUSES, l as SalesPipelineRecipe, m as OpportunityConversionCollection, n as SalesGovernanceService, o as MAX_LEAD_WORKFLOW_TEXT_LENGTH, p as SalesGovernanceEvent, r as LEAD_HUMAN_ACTIVITY_KINDS, s as projectLeadWorkQueue, t as SalesGovernanceError, u as SalesGovernanceStateCollection, v as SalesRepresentative, w as PipelineStageCollection, x as OpportunityCollection, y as PipelineDefinitionCollection } from "./chunks/crm-BENK-hHd.js";
5
5
  import { A as ReferralClickOperation, B as ATTRIBUTION_RESOLUTION_MODES, C as ReferralTouchCollection, D as ReferralCollection, E as assertHttpTargetUrl, F as validateAttributionPolicyTerms, G as REFERRAL_STATUSES, H as REFERRAL_AGREEMENT_STATUSES, I as ATTRIBUTION_CONFLICT_BEHAVIORS, J as AttributionExceptionCollection, K as REFERRAL_TOUCH_KINDS, L as ATTRIBUTION_CREDIT_MODES, M as ReferralAgreement, N as AttributionPolicyCollection, O as Referral, P as AttributionPolicy, R as ATTRIBUTION_EXCEPTION_STATUSES, S as generateReferralCode, T as ReferralLink, U as REFERRAL_LINK_STATUSES, V as REFERRAL_AGREEMENT_APPROVAL_MODES, W as REFERRAL_PROGRAM_STATUSES, Y as AttributionException, _ as REFERRAL_CODE_ALPHABET, a as ReferralAgreementExecutionService, b as ReferralClickValidationError, c as ReferrerCollection, d as ReferralTermSnapshot, f as ReferralProgramCollection, g as MAX_REFERRAL_CLICK_IDEMPOTENCY_KEY_BYTES, h as MAX_CODE_GENERATION_ATTEMPTS, i as REFERRAL_AGREEMENT_SOURCE_KIND, j as ReferralAgreementCollection, k as ReferralClickOperationCollection, l as Referrer, m as DEFAULT_REFERRAL_CLICK_EVIDENCE_MAX_BYTES, n as REFERRAL_TERMS_SNAPSHOT_KIND, o as AttributionService, p as ReferralProgram, q as REFERRER_STATUSES, r as ReferralCommissionService, s as QualifiedReferralOverrideError, t as ReferralQualificationService, u as ReferralTermSnapshotCollection, v as REFERRAL_CODE_LENGTH, w as ReferralTouch, x as ReferralLinkCollection, y as ReferralClickReplayConflictError, z as ATTRIBUTION_POLICY_STATUSES } from "./chunks/referrals-BRdTkEFt.js";
6
- export { ADJUSTMENT_SETTLEABLE_COMMISSION_STATUSES, AGREEMENT_EXECUTION_STATUSES, AGREEMENT_STATUSES, ATTRIBUTION_CONFLICT_BEHAVIORS, ATTRIBUTION_CREDIT_MODES, ATTRIBUTION_EXCEPTION_STATUSES, ATTRIBUTION_POLICY_STATUSES, ATTRIBUTION_RESOLUTION_MODES, Agreement, AgreementCollection, AgreementExecution, AgreementExecutionCollection, AgreementExecutionEvent, AgreementExecutionEventCollection, AgreementExecutionService, AttributionException, AttributionExceptionCollection, AttributionPolicy, AttributionPolicyCollection, AttributionService, COMMISSION_ADJUSTMENT_KINDS, COMMISSION_BASES, COMMISSION_PAYOUT_STATUSES, COMMISSION_PLAN_STATUSES, COMMISSION_STATUSES, Commission, CommissionAdjustment, CommissionAdjustmentCollection, CommissionAdjustmentOperation, CommissionAdjustmentOperationCollection, CommissionAdjustmentReplayConflictError, CommissionAdjustmentService, CommissionAdjustmentValidationError, CommissionBalanceService, CommissionCalculationService, CommissionCollection, CommissionPayout, CommissionPayoutCollection, CommissionPayoutService, CommissionPlan, CommissionPlanCollection, CommissionSettlementService, DEFAULT_PIPELINE_KEY, DEFAULT_PIPELINE_STAGES, DEFAULT_REFERRAL_CLICK_EVIDENCE_MAX_BYTES, EARNER_KINDS, EARNER_SOURCE_ATTRIBUTION_STATUSES, EARNER_STATUSES, EARNING_EVENT_KINDS, Earner, EarnerAttributionService, EarnerCollection, EarnerSourceAttribution, EarnerSourceAttributionCollection, EarningEvent, EarningEventCollection, ExecutedAgreement, ExecutedAgreementCollection, LEAD_HUMAN_ACTIVITY_KINDS, LEAD_STATUSES, Lead, LeadCollection, LeadConversionService, LeadWorkflowService, LeadWorkflowValidationError, MAX_CODE_GENERATION_ATTEMPTS, MAX_LEAD_WORKFLOW_TEXT_LENGTH, MAX_REFERRAL_CLICK_IDEMPOTENCY_KEY_BYTES, OPPORTUNITY_STATUSES, Opportunity, OpportunityCollection, OpportunityConversion, OpportunityConversionCollection, PAYOUT_METHODS, PAYOUT_METHODS_REQUIRING_DESTINATION, PIPELINE_STATUSES, PipelineDefinition, PipelineDefinitionCollection, PipelineStage, PipelineStageCollection, QualifiedReferralOverrideError, REFERRAL_AGREEMENT_APPROVAL_MODES, REFERRAL_AGREEMENT_SOURCE_KIND, REFERRAL_AGREEMENT_STATUSES, REFERRAL_CODE_ALPHABET, REFERRAL_CODE_LENGTH, REFERRAL_LINK_STATUSES, REFERRAL_PROGRAM_STATUSES, REFERRAL_STATUSES, REFERRAL_TERMS_SNAPSHOT_KIND, REFERRAL_TOUCH_KINDS, REFERRER_STATUSES, Referral, ReferralAgreement, ReferralAgreementCollection, ReferralAgreementExecutionService, ReferralClickOperation, ReferralClickOperationCollection, ReferralClickReplayConflictError, ReferralClickValidationError, ReferralCollection, ReferralCommissionService, ReferralLink, ReferralLinkCollection, ReferralProgram, ReferralProgramCollection, ReferralQualificationService, ReferralTermSnapshot, ReferralTermSnapshotCollection, ReferralTouch, ReferralTouchCollection, Referrer, ReferrerCollection, SALES_ACTIVITY_KINDS, SALES_ACTIVITY_SUBJECT_KINDS, SALES_REPRESENTATIVE_STATUSES, SalesActivity, SalesActivityCollection, SalesPipelineRecipe, SalesRepresentative, SalesRepresentativeCollection, WATERFALL_POOL_RESIDUAL_RULES, WATERFALL_POOL_ZERO_WEIGHT_RULES, WaterfallRecipientResolverRegistry, amountToCents, assertHttpTargetUrl, calculateCommissionAmountCents, calculateWaterfall, calculateWaterfallWithPools, centsToAmount, coerceAgreementDate, generateReferralCode, parseAgreementParty, prepareWaterfallPools, projectLeadWorkQueue, roundCents, sanitizeSignerEvidence, sanitizeSignerIntent, serializeAgreementParty, validateAttributionPolicyTerms, validateCommissionPlanComponents, validatePayoutDestination, validateWaterfallPlan };
6
+ export { ADJUSTMENT_SETTLEABLE_COMMISSION_STATUSES, AGREEMENT_EXECUTION_STATUSES, AGREEMENT_STATUSES, ATTRIBUTION_CONFLICT_BEHAVIORS, ATTRIBUTION_CREDIT_MODES, ATTRIBUTION_EXCEPTION_STATUSES, ATTRIBUTION_POLICY_STATUSES, ATTRIBUTION_RESOLUTION_MODES, Agreement, AgreementCollection, AgreementExecution, AgreementExecutionCollection, AgreementExecutionEvent, AgreementExecutionEventCollection, AgreementExecutionService, AttributionException, AttributionExceptionCollection, AttributionPolicy, AttributionPolicyCollection, AttributionService, COMMISSION_ADJUSTMENT_KINDS, COMMISSION_BASES, COMMISSION_PAYOUT_STATUSES, COMMISSION_PLAN_STATUSES, COMMISSION_STATUSES, Commission, CommissionAdjustment, CommissionAdjustmentCollection, CommissionAdjustmentOperation, CommissionAdjustmentOperationCollection, CommissionAdjustmentReplayConflictError, CommissionAdjustmentService, CommissionAdjustmentValidationError, CommissionBalanceService, CommissionCalculationService, CommissionCollection, CommissionPayout, CommissionPayoutCollection, CommissionPayoutService, CommissionPlan, CommissionPlanCollection, CommissionSettlementService, DEFAULT_PIPELINE_KEY, DEFAULT_PIPELINE_STAGES, DEFAULT_REFERRAL_CLICK_EVIDENCE_MAX_BYTES, EARNER_KINDS, EARNER_SOURCE_ATTRIBUTION_STATUSES, EARNER_STATUSES, EARNING_EVENT_KINDS, Earner, EarnerAttributionService, EarnerCollection, EarnerSourceAttribution, EarnerSourceAttributionCollection, EarningEvent, EarningEventCollection, ExecutedAgreement, ExecutedAgreementCollection, LEAD_HUMAN_ACTIVITY_KINDS, LEAD_STATUSES, Lead, LeadCollection, LeadConversionService, LeadWorkflowService, LeadWorkflowValidationError, MAX_CODE_GENERATION_ATTEMPTS, MAX_LEAD_WORKFLOW_TEXT_LENGTH, MAX_REFERRAL_CLICK_IDEMPOTENCY_KEY_BYTES, OPPORTUNITY_STATUSES, Opportunity, OpportunityCollection, OpportunityConversion, OpportunityConversionCollection, PAYOUT_METHODS, PAYOUT_METHODS_REQUIRING_DESTINATION, PIPELINE_STATUSES, PipelineDefinition, PipelineDefinitionCollection, PipelineStage, PipelineStageCollection, QualifiedReferralOverrideError, REFERRAL_AGREEMENT_APPROVAL_MODES, REFERRAL_AGREEMENT_SOURCE_KIND, REFERRAL_AGREEMENT_STATUSES, REFERRAL_CODE_ALPHABET, REFERRAL_CODE_LENGTH, REFERRAL_LINK_STATUSES, REFERRAL_PROGRAM_STATUSES, REFERRAL_STATUSES, REFERRAL_TERMS_SNAPSHOT_KIND, REFERRAL_TOUCH_KINDS, REFERRER_STATUSES, Referral, ReferralAgreement, ReferralAgreementCollection, ReferralAgreementExecutionService, ReferralClickOperation, ReferralClickOperationCollection, ReferralClickReplayConflictError, ReferralClickValidationError, ReferralCollection, ReferralCommissionService, ReferralLink, ReferralLinkCollection, ReferralProgram, ReferralProgramCollection, ReferralQualificationService, ReferralTermSnapshot, ReferralTermSnapshotCollection, ReferralTouch, ReferralTouchCollection, Referrer, ReferrerCollection, SALES_ACTIVITY_KINDS, SALES_ACTIVITY_SUBJECT_KINDS, SALES_REPRESENTATIVE_STATUSES, SalesActivity, SalesActivityCollection, SalesGovernanceError, SalesGovernanceEvent, SalesGovernanceEventCollection, SalesGovernanceService, SalesGovernanceState, SalesGovernanceStateCollection, SalesPipelineRecipe, SalesRepresentative, SalesRepresentativeCollection, WATERFALL_POOL_RESIDUAL_RULES, WATERFALL_POOL_ZERO_WEIGHT_RULES, WaterfallRecipientResolverRegistry, amountToCents, assertHttpTargetUrl, calculateCommissionAmountCents, calculateWaterfall, calculateWaterfallWithPools, centsToAmount, coerceAgreementDate, generateReferralCode, parseAgreementParty, prepareWaterfallPools, projectLeadWorkQueue, roundCents, sanitizeSignerEvidence, sanitizeSignerIntent, serializeAgreementParty, validateAttributionPolicyTerms, validateCommissionPlanComponents, validatePayoutDestination, validateWaterfallPlan };