Function: createSuppressionList()
createSuppressionList(
__namedParameters):object
Defined in: suppression.ts:105
The rules of the suppression list, over a store you provide.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | SuppressionListOptions |
Returns
assertCanResubscribe
assertCanResubscribe: (
args) =>Promise<void>
Throws ResubscribeRefusedError unless the address is free or only manually suppressed.
Parameters
| Parameter | Type |
|---|---|
args | { email: string; scope: string; } |
args.email | string |
args.scope | string |
Returns
Promise<void>
find
find: (
__namedParameters) =>Promise<Suppression|null>
The suppression that decides for this sender: the recipient's own over the sender's checkbox.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { email: string; scope: string; } |
__namedParameters.email | string |
__namedParameters.scope | string |
Returns
Promise<Suppression | null>
isSuppressed
isSuppressed: (
args) =>Promise<boolean>
Parameters
| Parameter | Type |
|---|---|
args | { email: string; scope: string; } |
args.email | string |
args.scope | string |
Returns
Promise<boolean>
resubscribe
resubscribe: (
__namedParameters) =>Promise<void>
Undoes the sender's own (manual) opt-out. Refused for any other reason.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { email: string; scope: string; } |
__namedParameters.email | string |
__namedParameters.scope | string |
Returns
Promise<void>
suppress
suppress: (
__namedParameters) =>Promise<boolean>
Stops marketing to the address for one sender, or for every sender with
scope: null. Suppressing again keeps the stronger reason. Returns
whether anything changed.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { detail?: string | null; email: string; reason: SuppressionReason; scope: string | null; } |
__namedParameters.detail? | string | null |
__namedParameters.email | string |
__namedParameters.reason | SuppressionReason |
__namedParameters.scope | string | null |
Returns
Promise<boolean>
Example
const suppressions = createSuppressionList({ store });
await suppressions.suppress({ scope: 'company-1', email, reason: 'manual' });
await suppressions.isSuppressed({ scope: 'company-1', email }); // true
await suppressions.resubscribe({ scope: 'company-1', email }); // allowed: it was manual