Skip to content

Commit 4cce90d

Browse files
committed
wip
1 parent ff7ef49 commit 4cce90d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+784
-304
lines changed

CHANGELOG.md

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
11
# CHANGELOG
22

3-
**v0.1.0-alpha.4:**
3+
## v0.1.0-alpha.5:
4+
5+
### New Features
6+
- New social icons: `Service.Mastodon` and `Service.Rss`
7+
- New `StoreBadges` component
8+
- New `QrCode` component
9+
- New `Signature` component
10+
- New [examples](examples)
11+
12+
### Enhancements
13+
- Updated README
14+
- Dependency updates
15+
16+
## v0.1.0-alpha.4:
417
- `README.md`: notice about test mode
518
- Support for test mode logging
619
- npm updates
720

8-
**v0.1.0-alpha.3:**
21+
## v0.1.0-alpha.3:
922
- `README.md` cleanup (listing of components)
1023
- `Image` component now requires only `src`; the other params are optional
1124
- `ViewInBrowser` component has changed: text is optional
1225
- npm updates
1326

14-
**v0.1.0-alpha.2:**
27+
## v0.1.0-alpha.2:
1528
- Introduced `CHANGELOG.md`
1629
- npm updates
1730
- Introduced new services as [social icons](examples/confirm_email/index.js):
@@ -29,5 +42,5 @@
2942
- **Breaking Changes:**
3043
- Renamed `Service.Github` to `Service.GitHub`
3144

32-
**v0.1.0-alpha.1:**
45+
## v0.1.0-alpha.1:
3346
- Initial implementation

README.md

+126-41
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ const sendEmail = async () => {
8282
.build()
8383

8484
const templateless = new Templateless('<YOUR_API_KEY>')
85-
const result = await templateless.send(email)
86-
87-
console.log(result)
85+
await templateless.send(email)
8886
}
8987

9088
sendEmail()
@@ -145,9 +143,9 @@ Text component allow you to insert a paragraph. Each paragraph supports basic ma
145143

146144
```javascript
147145
Content.builder()
148-
.text("## Thank you for signing up")
149-
.text("Please **verify your email** by [clicking here](https://example.com/confirm?token=XYZ)")
150-
.build()
146+
.text("## Thank you for signing up")
147+
.text("Please **verify your email** by [clicking here](https://example.com/confirm?token=XYZ)")
148+
.build()
151149
```
152150

153151
</details>
@@ -157,9 +155,8 @@ Link component adds an anchor tag. This is the same as a text component with the
157155

158156
```javascript
159157
Content.builder()
160-
.link("Confirm Email", "https://example.com/confirm?token=XYZ") // or...
161-
.text("[Confirm Email](https://example.com/confirm?token=XYZ)")
162-
.build()
158+
.link("Confirm Email", "https://example.com/confirm?token=XYZ")
159+
.build()
163160
```
164161

165162
</details>
@@ -169,8 +166,8 @@ Button can also be used as a call to action. Button color is set via your dashbo
169166

170167
```javascript
171168
Content.builder()
172-
.button("Confirm Email", "https://example.com/confirm?token=XYZ")
173-
.build()
169+
.button("Confirm Email", "https://example.com/confirm?token=XYZ")
170+
.build()
174171
```
175172

176173
</details>
@@ -180,14 +177,14 @@ Image component will link to an image within your email. Keep in mind that a lot
180177

181178
```javascript
182179
Content.builder()
183-
.image(
184-
"https://placekitten.com/300/200", // where the image is hosted
185-
"https://example.com", // [optional] link url, if you want it to be clickable
186-
300, // [optional] width
187-
200, // [optional] height
188-
"Alt text" // [optional] alternate text
189-
)
190-
.build()
180+
.image(
181+
"https://placekitten.com/300/200", // where the image is hosted
182+
"https://example.com", // [optional] link url, if you want it to be clickable
183+
300, // [optional] width
184+
200, // [optional] height
185+
"Alt text" // [optional] alternate text
186+
)
187+
.build()
191188
```
192189

193190
Only the `src` parameter is required; everything else is optional.
@@ -216,9 +213,9 @@ OTP component is designed for showing temporary passwords and reset codes.
216213

217214
```javascript
218215
Content.builder()
219-
.text("Here's your **temporary login code**:")
220-
.otp("XY78-2BT0-YFNB-ALW9")
221-
.build()
216+
.text("Here's your **temporary login code**:")
217+
.otp("XY78-2BT0-YFNB-ALW9")
218+
.build()
222219
```
223220

224221
</details>
@@ -230,25 +227,27 @@ These are all the supported platforms:
230227

231228
```javascript
232229
Content.builder()
233-
.socials([
234-
new SocialItem(Service.Website, 'https://example.com'),
235-
new SocialItem(Service.Email, '[email protected]'),
236-
new SocialItem(Service.Phone, '123-456-7890'), // `tel:` link
237-
new SocialItem(Service.Facebook, 'ExampleApp'),
238-
new SocialItem(Service.YouTube, 'ChannelID'),
239-
new SocialItem(Service.Twitter, 'ExampleApp'),
240-
new SocialItem(Service.X, 'ExampleApp'),
241-
new SocialItem(Service.GitHub, 'ExampleApp'),
242-
new SocialItem(Service.Instagram, 'ExampleApp'),
243-
new SocialItem(Service.LinkedIn, 'ExampleApp'),
244-
new SocialItem(Service.Slack, 'Org'),
245-
new SocialItem(Service.Discord, 'ExampleApp'),
246-
new SocialItem(Service.TikTok, 'ExampleApp'),
247-
new SocialItem(Service.Snapchat, 'ExampleApp'),
248-
new SocialItem(Service.Threads, 'ExampleApp'),
249-
new SocialItem(Service.Telegram, 'ExampleApp'),
250-
])
251-
.build()
230+
.socials([
231+
new SocialItem(Service.Website, 'https://example.com'),
232+
new SocialItem(Service.Email, '[email protected]'),
233+
new SocialItem(Service.Phone, '123-456-7890'), // `tel:` link
234+
new SocialItem(Service.Facebook, 'Username'),
235+
new SocialItem(Service.YouTube, 'ChannelID'),
236+
new SocialItem(Service.Twitter, 'Username'),
237+
new SocialItem(Service.X, 'Username'),
238+
new SocialItem(Service.GitHub, 'Username'),
239+
new SocialItem(Service.Instagram, 'Username'),
240+
new SocialItem(Service.LinkedIn, 'Username'),
241+
new SocialItem(Service.Slack, 'Org'),
242+
new SocialItem(Service.Discord, 'Username'),
243+
new SocialItem(Service.TikTok, 'Username'),
244+
new SocialItem(Service.Snapchat, 'Username'),
245+
new SocialItem(Service.Threads, 'Username'),
246+
new SocialItem(Service.Telegram, 'Username'),
247+
new SocialItem(Service.Mastodon, '@[email protected]'),
248+
new SocialItem(Service.Rss, 'https://example.com/blog'),
249+
])
250+
.build()
252251
```
253252

254253
</details>
@@ -266,6 +265,92 @@ Content.builder()
266265
.build()
267266
```
268267

268+
</details>
269+
<details><summary>Store Badges</summary>
270+
271+
Link to your mobile apps via store badges:
272+
273+
```javascript
274+
Content.builder()
275+
.storeBadges([
276+
new StoreBadgeItem(StoreBadge.AppStore, "https://apps.apple.com/us/app/example/id1234567890"),
277+
new StoreBadgeItem(StoreBadge.GooglePlay, "https://play.google.com/store/apps/details?id=com.example"),
278+
new StoreBadgeItem(StoreBadge.MicrosoftStore, "https://apps.microsoft.com/detail/example"),
279+
])
280+
.build()
281+
```
282+
283+
</details>
284+
<details><summary>QR Code</summary>
285+
286+
You can also generate QR codes on the fly. They will be shown as images inside the email.
287+
288+
Here are all the supported data types:
289+
290+
```javascript
291+
// url
292+
Content.builder()
293+
.qrCode("https://example.com")
294+
.build()
295+
296+
// email
297+
Content.builder()
298+
.component(QrCode.email("[email protected]"))
299+
.build()
300+
301+
// phone
302+
Content.builder()
303+
.component(QrCode.phone("123-456-7890"))
304+
.build()
305+
306+
// sms / text message
307+
Content.builder()
308+
.component(QrCode.sms("123-456-7890"))
309+
.build()
310+
311+
// geo coordinates
312+
Content.builder()
313+
.component(QrCode.coordinates(37.773972, -122.431297))
314+
.build()
315+
316+
// crypto address (for now only Bitcoin and Ethereum are supported)
317+
Content.builder()
318+
.component(QrCode.cryptocurrencyAddress(Cryptocurrency.Bitcoin, "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"))
319+
.build()
320+
321+
// you can also encode any binary data
322+
Content.builder()
323+
.component(new QrCode(new Uint8Array([1, 2, 3])))
324+
.build()
325+
```
326+
327+
</details>
328+
<details><summary>Signature</summary>
329+
330+
Generated signatures can be added to your emails to give a bit of a personal touch. This will embed an image with your custom text using one of several available fonts:
331+
332+
```javascript
333+
// signature with a default font
334+
Content.builder()
335+
.signature("John Smith")
336+
.build()
337+
338+
// signature with a custom font
339+
Content.builder()
340+
.signature("John Smith", SignatureFont.ReenieBeanie)
341+
.build()
342+
```
343+
344+
These are the available fonts:
345+
346+
- `SignatureFont.ReenieBeanie` [preview →](https://fonts.google.com/specimen/Reenie+Beanie)
347+
- `SignatureFont.MeowScript` [preview →](https://fonts.google.com/specimen/Meow+Script)
348+
- `SignatureFont.Caveat` [preview →](https://fonts.google.com/specimen/Caveat)
349+
- `SignatureFont.Zeyada` [preview →](https://fonts.google.com/specimen/Zeyada)
350+
- `SignatureFont.Petemoss` [preview →](https://fonts.google.com/specimen/Petemoss)
351+
352+
Signature should not exceed 64 characters. Only alphanumeric characters and most common symbols are allowed.
353+
269354
</details>
270355

271356
---

dist/bundle.cjs.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/bundle.esm.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/bundle.umd.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/collection.d.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, SocialItem } from './components';
1+
import { Component, SocialItem, StoreBadgeItem, SignatureFont } from './components';
22
export declare class Collection {
33
components: Component[];
44
constructor(builder: CollectionBuilder);
@@ -14,6 +14,10 @@ declare class CollectionBuilder {
1414
socials(data: SocialItem[]): this;
1515
text(text: string): this;
1616
viewInBrowser(text?: string): this;
17+
qrCode(url: string): this;
18+
storeBadges(data: StoreBadgeItem[]): this;
19+
signature(text: string, font?: SignatureFont): this;
20+
component(c: Component): this;
1721
build(): Collection;
1822
private push;
1923
}

dist/common.d.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,10 @@ export declare enum ComponentId {
66
PoweredBy = "POWERED_BY",
77
Socials = "SOCIALS",
88
Text = "TEXT",
9-
ViewInBrowser = "VIEW_IN_BROWSER"
9+
ViewInBrowser = "VIEW_IN_BROWSER",
10+
StoreBadges = "STORE_BADGES",
11+
QrCode = "QR_CODE",
12+
Signature = "SIGNATURE"
13+
}
14+
export interface Component {
1015
}

dist/components/button.d.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
import { ComponentId } from '../common';
1+
import { Component, ComponentId } from '../common';
22
export declare class Button implements Component {
33
id: ComponentId;
44
text: string;
55
url: string;
66
constructor(text: string, url: string);
77
}
8-
interface Component {
9-
}
10-
export {};

dist/components/image.d.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ComponentId } from '../common';
1+
import { Component, ComponentId } from '../common';
22
export declare class Image implements Component {
33
id: ComponentId;
44
src: string;
@@ -8,6 +8,3 @@ export declare class Image implements Component {
88
url?: string;
99
constructor(src: string, alt?: string, width?: number, height?: number, url?: string);
1010
}
11-
interface Component {
12-
}
13-
export {};

dist/components/index.d.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@ import { Otp } from './otp';
55
import { Service, Item as SocialItem, Socials } from './socials';
66
import { Text } from './text';
77
import { ViewInBrowser } from './viewInBrowser';
8+
import { StoreBadge, Item as StoreBadgeItem, StoreBadges } from './storeBadges';
9+
import { QrCode } from './qrCode';
10+
import { Signature, Font as SignatureFont } from './signature';
811
export { Button };
912
export { Image };
1013
export { Link };
1114
export { Otp };
1215
export { Service, SocialItem, Socials };
1316
export { Text };
1417
export { ViewInBrowser };
15-
export type Component = Button | Image | Link | Otp | Service | SocialItem | Socials | Text | ViewInBrowser;
18+
export { StoreBadges, StoreBadgeItem, StoreBadge };
19+
export { QrCode };
20+
export { Signature, SignatureFont };
21+
export type Component = Button | Image | Link | Otp | Service | SocialItem | Socials | Text | ViewInBrowser | StoreBadges | QrCode | Signature;

dist/components/link.d.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
import { ComponentId } from '../common';
1+
import { Component, ComponentId } from '../common';
22
export declare class Link implements Component {
33
id: ComponentId;
44
text: string;
55
url: string;
66
constructor(text: string, url: string);
77
}
8-
interface Component {
9-
}
10-
export {};

dist/components/otp.d.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
import { ComponentId } from '../common';
1+
import { Component, ComponentId } from '../common';
22
export declare class Otp implements Component {
33
id: ComponentId;
44
text: string;
55
constructor(text: string);
66
}
7-
interface Component {
8-
}
9-
export {};

dist/components/qrCode.d.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Component, ComponentId } from '../common';
2+
export declare enum Cryptocurrency {
3+
Bitcoin = "bitcoin",
4+
Ethereum = "ethereum"
5+
}
6+
export declare class QrCode implements Component {
7+
id: ComponentId;
8+
data: string;
9+
constructor(data: Uint8Array);
10+
static email(email: string): QrCode;
11+
static url(url: string): QrCode;
12+
static phone(phone: string): QrCode;
13+
static sms(text: string): QrCode;
14+
static coordinates(lat: number, lng: number): QrCode;
15+
static cryptocurrencyAddress(cryptocurrency: Cryptocurrency, address: string): QrCode;
16+
}

dist/components/signature.d.ts

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Component, ComponentId } from '../common';
2+
export declare enum Font {
3+
ReenieBeanie = 1,
4+
MeowScript = 2,
5+
Caveat = 3,
6+
Zeyada = 4,
7+
Petemoss = 5
8+
}
9+
export declare class Signature implements Component {
10+
id: ComponentId;
11+
text: string;
12+
font?: Font;
13+
constructor(text: string, font?: Font);
14+
}

0 commit comments

Comments
 (0)