@topol.io/editor 2.0.0-alpha.2 → 2.0.0-alpha.3
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/README.md
CHANGED
|
@@ -87,6 +87,50 @@ Omit `cloud.templateId` to start in the Cloud template browser. Cloud requires t
|
|
|
87
87
|
editor handles nonce refresh, persistence, and its Cloud recovery UI; this package
|
|
88
88
|
supplies the host bridge.
|
|
89
89
|
|
|
90
|
+
## Countdown block
|
|
91
|
+
|
|
92
|
+
The Countdown block is a paid add-on rolled out per user. It appears only when the
|
|
93
|
+
add-on flag your backend put into the editor nonce is set **and** `enableCountdown`
|
|
94
|
+
is `true`, and it needs `templateId`. The optional `countdown` object adapts the block
|
|
95
|
+
to your email service provider:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
const editor = await EmailEditor.init({
|
|
99
|
+
config: {
|
|
100
|
+
authorize: { apiKey: "pk_your-public-key", userId: "user-123" },
|
|
101
|
+
templateId: 123,
|
|
102
|
+
enableCountdown: true,
|
|
103
|
+
countdown: {
|
|
104
|
+
defaultColors: { background: "#ffffff", digits: "#000000", accent: "#2b66b3" },
|
|
105
|
+
styleThumbnailBase: "https://cdn.example.com/countdown-styles",
|
|
106
|
+
mergeTag: "*|CONTACT_ID|*",
|
|
107
|
+
dateMergeTags: [{ label: "From send", value: "*|SEND_DATE+{seconds}|*" }],
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
async getNonce() {
|
|
111
|
+
/* ... */
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
- `defaultColors` — palette of newly created countdowns; any subset of `background`,
|
|
117
|
+
`digits`, `labels`, `accent` as hex colors (`#RGB`, `#RRGGBB`, `#RRGGBBAA`). Unset
|
|
118
|
+
colors keep the editor defaults.
|
|
119
|
+
- `styleThumbnailBase` — base URL of your own style thumbnails; the editor loads
|
|
120
|
+
`{base}/{style}.gif` for each of the ten styles.
|
|
121
|
+
- `mergeTag` — merge tag identifying the recipient of an evergreen countdown, stored
|
|
122
|
+
in the template as part of the countdown image URL (`?key={tag}`). Prefer a stable
|
|
123
|
+
contact ID over the email address. At most 100 characters, no quotes. Unset = the
|
|
124
|
+
recipient's email address in the syntax of `emailServiceProvider`.
|
|
125
|
+
- `dateMergeTags` — merge tags that can supply the end date of a dynamic countdown
|
|
126
|
+
(for automations); without them the editor does not offer the dynamic type.
|
|
127
|
+
`{seconds}` in a `value` is replaced with the countdown length the user sets. The
|
|
128
|
+
value goes into the URL verbatim: at most 200 characters, no quotes, `<`, `>` or `&`.
|
|
129
|
+
|
|
130
|
+
The types are exported as `ICountdownOptions`, `ICountdownDefaultColors` and
|
|
131
|
+
`ICountdownDateMergeTag`. Details and the ESP requirements are in the
|
|
132
|
+
[option reference](https://docs.topol.io/email-editor/reference/topol-options#countdown).
|
|
133
|
+
|
|
90
134
|
## Loader selection
|
|
91
135
|
|
|
92
136
|
The default is `https://v4.email-assets.topol.io/loader/build.js`.
|
package/dist/types/src/main.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import type ISavedBlock from "../types/SavedBlock/ISavedBlock";
|
|
|
16
16
|
import type IMergeTagGroup from "../types/MergeTag/IMergeTagGroup";
|
|
17
17
|
import type IMergeTag from "../types/MergeTag/IMergeTag";
|
|
18
18
|
import type { IContentBlockOptions } from "../types/ContentBlock/IContentBlockOptions";
|
|
19
|
+
import type { ICountdownOptions, ICountdownDefaultColors, ICountdownDateMergeTag } from "../types/Countdown/ICountdownOptions";
|
|
19
20
|
import type ITheme from "../types/Theme/ITheme";
|
|
20
21
|
import type IAuthHeaderConfig from "../types/AuthHeaderConfig/IAuthHeaderConfig";
|
|
21
22
|
import type IFont from "../types/Font/IFont";
|
|
@@ -34,7 +35,7 @@ export default TopolPlugin;
|
|
|
34
35
|
export { TopolPlugin };
|
|
35
36
|
export { EmailEditor };
|
|
36
37
|
export { LandingPageEditor };
|
|
37
|
-
export type { ITopolOptions, IEmailCallbacks, INotification, ISavedBlock, IMergeTagGroup, IMergeTag, IContentBlockOptions, ITheme, IAuthHeaderConfig, IFont, IAPI, ICustomBlockData, Stage as IStage };
|
|
38
|
+
export type { ITopolOptions, IEmailCallbacks, INotification, ISavedBlock, IMergeTagGroup, IMergeTag, IContentBlockOptions, ICountdownOptions, ICountdownDefaultColors, ICountdownDateMergeTag, ITheme, IAuthHeaderConfig, IFont, IAPI, ICustomBlockData, Stage as IStage, };
|
|
38
39
|
export type { ISaveData, IErrorData, ISendTestData };
|
|
39
40
|
export type { ILandingPageOptions, ILandingPageCallbacks, ILandingPageEditorInstance, TopolSection, ILandingPageSavePayload, ILandingPageDeletedItem, ILandingPageErrorPayload };
|
|
40
41
|
export type { default as IEmailConfig } from "../types/IEmailConfig";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Palette of newly created countdowns. Any subset of `background`, `digits`, `labels`
|
|
3
|
+
* and `accent` as hex colors (`#RGB`, `#RRGGBB` or `#RRGGBBAA`); unset colors keep the
|
|
4
|
+
* editor defaults (white background, black text, purple accent).
|
|
5
|
+
*/
|
|
6
|
+
export interface ICountdownDefaultColors {
|
|
7
|
+
background?: string;
|
|
8
|
+
digits?: string;
|
|
9
|
+
labels?: string;
|
|
10
|
+
accent?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A merge tag of your ESP that can supply the end date of a dynamic countdown.
|
|
14
|
+
* The `value` goes into the countdown image URL verbatim (`?end_date_time={tag}`)
|
|
15
|
+
* and must produce an RFC 3339 date once the ESP substitutes it.
|
|
16
|
+
*/
|
|
17
|
+
export interface ICountdownDateMergeTag {
|
|
18
|
+
/** Name shown to the user when picking the tag. */
|
|
19
|
+
label: string;
|
|
20
|
+
/**
|
|
21
|
+
* The tag itself. `{seconds}` in it is replaced with the countdown length the user
|
|
22
|
+
* sets (e.g. `*|SEND_DATE+{seconds}|*`); without it the tag is inserted as is
|
|
23
|
+
* (e.g. `*|RESERVATION_UNTIL|*`). At most 200 characters, no quotes, `<`, `>` or `&`.
|
|
24
|
+
*/
|
|
25
|
+
value: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Countdown block settings of the host. The block itself is switched on with
|
|
29
|
+
* `enableCountdown`. See https://docs.topol.io/email-editor/reference/topol-options#countdown
|
|
30
|
+
*/
|
|
31
|
+
export interface ICountdownOptions {
|
|
32
|
+
/** Palette of newly created countdowns (any subset); unset colors keep the package defaults. */
|
|
33
|
+
defaultColors?: ICountdownDefaultColors;
|
|
34
|
+
/** Base URL of a custom style thumbnail set: the editor loads `{base}/{style}.gif` for every countdown style. */
|
|
35
|
+
styleThumbnailBase?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Merge tag the evergreen countdowns' recipient key is rendered with (verbatim, no quotes).
|
|
38
|
+
* Use a value that is stable and unique per recipient, ideally a contact ID
|
|
39
|
+
* (e.g. `*|CONTACT_ID|*`). Unset = the recipient's email address in the syntax of
|
|
40
|
+
* `emailServiceProvider`. At most 100 characters.
|
|
41
|
+
*/
|
|
42
|
+
mergeTag?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Merge tags a dynamic countdown's deadline (`end_date_time`) can come from;
|
|
45
|
+
* `{seconds}` in a value = the countdown length the user sets. Unset = no dynamic mode.
|
|
46
|
+
*/
|
|
47
|
+
dateMergeTags?: ICountdownDateMergeTag[];
|
|
48
|
+
}
|
|
@@ -4,6 +4,7 @@ import type { ISavedSection, IPremadeSectionsOptions } from "./Sections/ISection
|
|
|
4
4
|
import type { ICloudOptions } from "./Cloud/ICloudOptions";
|
|
5
5
|
import type IMergeTagGroup from "./MergeTag/IMergeTagGroup";
|
|
6
6
|
import type { IContentBlockOptions } from "./ContentBlock/IContentBlockOptions";
|
|
7
|
+
import type { ICountdownOptions } from "./Countdown/ICountdownOptions";
|
|
7
8
|
import type ITheme from "./Theme/ITheme";
|
|
8
9
|
import type IAuthHeaderConfig from "./AuthHeaderConfig/IAuthHeaderConfig";
|
|
9
10
|
import type IFont from "./Font/IFont";
|
|
@@ -42,6 +43,8 @@ export default interface IEmailConfig {
|
|
|
42
43
|
cloud?: ICloudOptions;
|
|
43
44
|
colors?: Array<string>;
|
|
44
45
|
contentBlocks?: IContentBlockOptions;
|
|
46
|
+
/** Countdown block settings of the host (the block itself is gated by `enableCountdown`). */
|
|
47
|
+
countdown?: ICountdownOptions;
|
|
45
48
|
currentUser?: IUser;
|
|
46
49
|
customBlocks?: ICustomBlockData[];
|
|
47
50
|
customFileManager?: boolean;
|
|
@@ -92,6 +95,12 @@ export default interface IEmailConfig {
|
|
|
92
95
|
emailServiceProvider?: "mailchimp" | "sparkpost";
|
|
93
96
|
enableAutosaves?: boolean;
|
|
94
97
|
enableComments?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Opt-in for the Countdown block, a paid add-on rolled out per user: the block only appears
|
|
100
|
+
* when the add-on flag your backend put into the editor nonce is set **and** this option is
|
|
101
|
+
* `true`, and it also needs `templateId`.
|
|
102
|
+
*/
|
|
103
|
+
enableCountdown?: boolean;
|
|
95
104
|
enableDarkMode?: boolean;
|
|
96
105
|
enableFileManagerInGif?: boolean;
|
|
97
106
|
enableSubjectLine?: boolean;
|