@fragus/sam-types 1.0.96 → 1.0.97
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.
- package/package.json +1 -1
- package/types/ISendEmail.d.ts +4 -0
- package/types/emailCampaign.d.ts +79 -0
- package/types/emailCampaign.js +17 -0
- package/types/emailCampaign.js.map +1 -0
- package/types/emailCampaign.ts +111 -0
- package/types/index.d.ts +1 -0
- package/types/index.js +4 -0
- package/types/index.js.map +1 -1
- package/types/index.ts +1 -0
package/package.json
CHANGED
package/types/ISendEmail.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { IUserResponse } from './user'
|
|
2
2
|
|
|
3
|
+
// Recipient-picker types. These remain in use by the email campaign recipient selection UI
|
|
4
|
+
// (provider-scoped, paginated user lookup). The legacy send-email request/attachment/form
|
|
5
|
+
// types were removed in favour of the email campaign draft-resource DTOs in ./emailCampaign.
|
|
6
|
+
|
|
3
7
|
export type ISendEmailUserResponse = IUserResponse & {
|
|
4
8
|
providerIds: number[]
|
|
5
9
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ProviderState } from './contractProvider';
|
|
2
|
+
export declare enum EmailCampaignStatus {
|
|
3
|
+
Draft = "draft",
|
|
4
|
+
Scheduled = "scheduled",
|
|
5
|
+
Sending = "sending",
|
|
6
|
+
Sent = "sent",
|
|
7
|
+
Failed = "failed",
|
|
8
|
+
Cancelled = "cancelled",
|
|
9
|
+
PartiallyFailed = "partially_failed"
|
|
10
|
+
}
|
|
11
|
+
export declare type EmailCampaignRole = 'admin' | 'seller';
|
|
12
|
+
export declare type EmailCampaignSelectionMode = 'all' | 'subset';
|
|
13
|
+
export declare type EmailCampaignProviderSelection = {
|
|
14
|
+
providerMode: 'all';
|
|
15
|
+
selectedProviderIds: null;
|
|
16
|
+
} | {
|
|
17
|
+
providerMode: 'subset';
|
|
18
|
+
selectedProviderIds: number[];
|
|
19
|
+
};
|
|
20
|
+
export declare type EmailCampaignRecipientSelection = {
|
|
21
|
+
recipientMode: 'all';
|
|
22
|
+
selectedUserIds: null;
|
|
23
|
+
} | {
|
|
24
|
+
recipientMode: 'subset';
|
|
25
|
+
selectedUserIds: number[];
|
|
26
|
+
};
|
|
27
|
+
export declare type EmailCampaignRecipientResolution = 'snapshot' | 'live';
|
|
28
|
+
export interface IEmailCampaignFilters {
|
|
29
|
+
countryIsoNames: string[] | null;
|
|
30
|
+
providerState: ProviderState | null;
|
|
31
|
+
}
|
|
32
|
+
export interface IEmailCampaignAttachmentMeta {
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
contentType: string;
|
|
36
|
+
size: number;
|
|
37
|
+
gcsUri: string;
|
|
38
|
+
}
|
|
39
|
+
export declare type TEmailCampaignSection = 'name' | 'content' | 'filters';
|
|
40
|
+
export interface ICreateEmailCampaignRequest {
|
|
41
|
+
name: string;
|
|
42
|
+
}
|
|
43
|
+
export interface IUpdateEmailCampaignContentRequest {
|
|
44
|
+
subject: string;
|
|
45
|
+
message: string;
|
|
46
|
+
}
|
|
47
|
+
export interface IUpdateEmailCampaignNameRequest {
|
|
48
|
+
name: string;
|
|
49
|
+
}
|
|
50
|
+
export declare type IUpdateEmailCampaignFiltersRequest = {
|
|
51
|
+
filters: IEmailCampaignFilters;
|
|
52
|
+
} & EmailCampaignProviderSelection & EmailCampaignRecipientSelection;
|
|
53
|
+
export interface IScheduleEmailCampaignRequest {
|
|
54
|
+
scheduledAt: string | null;
|
|
55
|
+
recipientResolution?: EmailCampaignRecipientResolution;
|
|
56
|
+
}
|
|
57
|
+
export interface IEmailCampaignListItem {
|
|
58
|
+
id: number;
|
|
59
|
+
name: string;
|
|
60
|
+
status: EmailCampaignStatus;
|
|
61
|
+
subject: string | null;
|
|
62
|
+
recipientCount: number;
|
|
63
|
+
sentCount: number;
|
|
64
|
+
failedCount: number;
|
|
65
|
+
scheduledAt: string | null;
|
|
66
|
+
updatedByEmail: string;
|
|
67
|
+
createdAt: string;
|
|
68
|
+
updatedAt: string;
|
|
69
|
+
}
|
|
70
|
+
export declare type IEmailCampaignDetail = IEmailCampaignListItem & {
|
|
71
|
+
message: string | null;
|
|
72
|
+
filters: IEmailCampaignFilters;
|
|
73
|
+
recipientResolution: EmailCampaignRecipientResolution;
|
|
74
|
+
attachments: IEmailCampaignAttachmentMeta[];
|
|
75
|
+
} & EmailCampaignProviderSelection & EmailCampaignRecipientSelection;
|
|
76
|
+
export interface IEmailCampaignListResponse {
|
|
77
|
+
data: IEmailCampaignListItem[];
|
|
78
|
+
nextCursor: number | null;
|
|
79
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Email campaign feature contracts (draft-resource API).
|
|
3
|
+
//
|
|
4
|
+
// This is a .ts source file (not .d.ts) because the EmailCampaignStatus enum emits runtime JS;
|
|
5
|
+
// tsc generates the published emailCampaign.d.ts / emailCampaign.js from this file.
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
var EmailCampaignStatus;
|
|
8
|
+
(function (EmailCampaignStatus) {
|
|
9
|
+
EmailCampaignStatus["Draft"] = "draft";
|
|
10
|
+
EmailCampaignStatus["Scheduled"] = "scheduled";
|
|
11
|
+
EmailCampaignStatus["Sending"] = "sending";
|
|
12
|
+
EmailCampaignStatus["Sent"] = "sent";
|
|
13
|
+
EmailCampaignStatus["Failed"] = "failed";
|
|
14
|
+
EmailCampaignStatus["Cancelled"] = "cancelled";
|
|
15
|
+
EmailCampaignStatus["PartiallyFailed"] = "partially_failed";
|
|
16
|
+
})(EmailCampaignStatus = exports.EmailCampaignStatus || (exports.EmailCampaignStatus = {}));
|
|
17
|
+
//# sourceMappingURL=emailCampaign.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emailCampaign.js","sourceRoot":"","sources":["emailCampaign.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,EAAE;AACF,+FAA+F;AAC/F,oFAAoF;;AAIpF,IAAY,mBAQX;AARD,WAAY,mBAAmB;IAC7B,sCAAe,CAAA;IACf,8CAAuB,CAAA;IACvB,0CAAmB,CAAA;IACnB,oCAAa,CAAA;IACb,wCAAiB,CAAA;IACjB,8CAAuB,CAAA;IACvB,2DAAoC,CAAA;AACtC,CAAC,EARW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAQ9B"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// Email campaign feature contracts (draft-resource API).
|
|
2
|
+
//
|
|
3
|
+
// This is a .ts source file (not .d.ts) because the EmailCampaignStatus enum emits runtime JS;
|
|
4
|
+
// tsc generates the published emailCampaign.d.ts / emailCampaign.js from this file.
|
|
5
|
+
|
|
6
|
+
import { ProviderState } from './contractProvider'
|
|
7
|
+
|
|
8
|
+
export enum EmailCampaignStatus {
|
|
9
|
+
Draft = 'draft',
|
|
10
|
+
Scheduled = 'scheduled',
|
|
11
|
+
Sending = 'sending',
|
|
12
|
+
Sent = 'sent',
|
|
13
|
+
Failed = 'failed',
|
|
14
|
+
Cancelled = 'cancelled',
|
|
15
|
+
PartiallyFailed = 'partially_failed',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Only admin/seller users are addressable. Not persisted — applied server-side (CAMPAIGN_ROLES).
|
|
19
|
+
export type EmailCampaignRole = 'admin' | 'seller'
|
|
20
|
+
|
|
21
|
+
// How a pool (providers or recipients) is narrowed: 'all' = every match, 'subset' = explicit ids.
|
|
22
|
+
export type EmailCampaignSelectionMode = 'all' | 'subset'
|
|
23
|
+
|
|
24
|
+
// Provider dimension: mode is discriminated against its selection, so an invalid combination can't type-check.
|
|
25
|
+
// The candidate-pool filter (`filters`) is carried separately on the request/detail DTOs.
|
|
26
|
+
export type EmailCampaignProviderSelection =
|
|
27
|
+
| { providerMode: 'all'; selectedProviderIds: null }
|
|
28
|
+
| { providerMode: 'subset'; selectedProviderIds: number[] }
|
|
29
|
+
|
|
30
|
+
// Recipient dimension: mode is discriminated against its user picks.
|
|
31
|
+
export type EmailCampaignRecipientSelection =
|
|
32
|
+
| { recipientMode: 'all'; selectedUserIds: null }
|
|
33
|
+
| { recipientMode: 'subset'; selectedUserIds: number[] }
|
|
34
|
+
|
|
35
|
+
// When the recipient pool is frozen: 'snapshot' resolves at schedule time, 'live' at send-start.
|
|
36
|
+
// Either way the resolved list is persisted before the first batch, so the worker is resumable.
|
|
37
|
+
export type EmailCampaignRecipientResolution = 'snapshot' | 'live'
|
|
38
|
+
|
|
39
|
+
// Candidate provider pool in 'all' provider mode.
|
|
40
|
+
export interface IEmailCampaignFilters {
|
|
41
|
+
countryIsoNames: string[] | null // null = all countries
|
|
42
|
+
providerState: ProviderState | null // null = any state (required when providerMode === 'all')
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Attachment metadata; the bytes live in GCS.
|
|
46
|
+
export interface IEmailCampaignAttachmentMeta {
|
|
47
|
+
id: string
|
|
48
|
+
name: string
|
|
49
|
+
contentType: string
|
|
50
|
+
size: number // raw byte size
|
|
51
|
+
gcsUri: string
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Editable draft sections for PATCH /email-campaigns/:id/sections/:section.
|
|
55
|
+
export type TEmailCampaignSection = 'name' | 'content' | 'filters'
|
|
56
|
+
|
|
57
|
+
// --- Request DTOs ---
|
|
58
|
+
|
|
59
|
+
// Body for POST /email-campaigns. Name is required up-front (API 400s on blank/missing).
|
|
60
|
+
export interface ICreateEmailCampaignRequest {
|
|
61
|
+
name: string
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface IUpdateEmailCampaignContentRequest {
|
|
65
|
+
subject: string
|
|
66
|
+
message: string
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface IUpdateEmailCampaignNameRequest {
|
|
70
|
+
name: string
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// `filters` is always sent; in 'subset' mode it is ignored server-side.
|
|
74
|
+
export type IUpdateEmailCampaignFiltersRequest = {
|
|
75
|
+
filters: IEmailCampaignFilters
|
|
76
|
+
} & EmailCampaignProviderSelection &
|
|
77
|
+
EmailCampaignRecipientSelection
|
|
78
|
+
|
|
79
|
+
export interface IScheduleEmailCampaignRequest {
|
|
80
|
+
scheduledAt: string | null // ISO 8601 UTC; null = send ASAP
|
|
81
|
+
recipientResolution?: EmailCampaignRecipientResolution // default 'snapshot'
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// --- Response DTOs ---
|
|
85
|
+
|
|
86
|
+
export interface IEmailCampaignListItem {
|
|
87
|
+
id: number
|
|
88
|
+
name: string // empty until named
|
|
89
|
+
status: EmailCampaignStatus
|
|
90
|
+
subject: string | null
|
|
91
|
+
recipientCount: number
|
|
92
|
+
sentCount: number
|
|
93
|
+
failedCount: number
|
|
94
|
+
scheduledAt: string | null
|
|
95
|
+
updatedByEmail: string // user who created or last edited it
|
|
96
|
+
createdAt: string
|
|
97
|
+
updatedAt: string // last state change (entity_updated)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export type IEmailCampaignDetail = IEmailCampaignListItem & {
|
|
101
|
+
message: string | null
|
|
102
|
+
filters: IEmailCampaignFilters
|
|
103
|
+
recipientResolution: EmailCampaignRecipientResolution
|
|
104
|
+
attachments: IEmailCampaignAttachmentMeta[]
|
|
105
|
+
} & EmailCampaignProviderSelection &
|
|
106
|
+
EmailCampaignRecipientSelection
|
|
107
|
+
|
|
108
|
+
export interface IEmailCampaignListResponse {
|
|
109
|
+
data: IEmailCampaignListItem[]
|
|
110
|
+
nextCursor: number | null
|
|
111
|
+
}
|
package/types/index.d.ts
CHANGED
package/types/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
function __export(m) {
|
|
3
|
+
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
4
|
+
}
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
var ContractState;
|
|
4
7
|
(function (ContractState) {
|
|
@@ -167,4 +170,5 @@ var AccessKeyService;
|
|
|
167
170
|
AccessKeyService[AccessKeyService["WorkshopOperation"] = 1] = "WorkshopOperation";
|
|
168
171
|
AccessKeyService[AccessKeyService["Report"] = 2] = "Report";
|
|
169
172
|
})(AccessKeyService = exports.AccessKeyService || (exports.AccessKeyService = {}));
|
|
173
|
+
__export(require("./emailCampaign"));
|
|
170
174
|
//# sourceMappingURL=index.js.map
|
package/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;AAAA,IAAY,aAgBX;AAhBD,WAAY,aAAa;IACvB,mDAAS,CAAA;IACT,qDAAW,CAAA;IACX,mEAAkB,CAAA;IAClB,mEAAkB,CAAA;IAClB,qEAAmB,CAAA;IACnB,uDAAY,CAAA;IACZ,qEAAmB,CAAA;IACnB,2FAA8B,CAAA;IAC9B,6DAAe,CAAA;IACf,qFAA2B,CAAA;IAC3B,+DAAgB,CAAA;IAChB,2DAAc,CAAA;IACd,yDAAa,CAAA;IACb,yDAAa,CAAA;IACb,uEAAoB,CAAA;AACtB,CAAC,EAhBW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAgBxB;AAED,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,uDAAY,CAAA;IACZ,2DAAc,CAAA;IACd,+DAAgB,CAAA;AAClB,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB;AAED,IAAY,MAMX;AAND,WAAY,MAAM;IAChB,iCAAO,CAAA;IACP,mCAAI,CAAA;IACJ,mCAAI,CAAA;IACJ,2CAAQ,CAAA;IACR,yCAAO,CAAA;AACT,CAAC,EANW,MAAM,GAAN,cAAM,KAAN,cAAM,QAMjB;AAED,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,+CAAO,CAAA;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