posthog-node 5.70.0 → 5.71.0
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/dist/emails/emails.d.ts.map +1 -1
- package/dist/emails/emails.js +12 -2
- package/dist/emails/emails.mjs +12 -2
- package/dist/emails/types.d.ts +43 -0
- package/dist/emails/types.d.ts.map +1 -1
- package/dist/exports.d.ts +1 -1
- package/dist/exports.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +2 -2
- package/src/emails/emails.ts +6 -2
- package/src/emails/types.ts +44 -0
- package/src/exports.ts +1 -0
- package/src/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emails.d.ts","sourceRoot":"","sources":["../../src/emails/emails.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,MAAM,EAKZ,MAAM,eAAe,CAAA;AAGtB,OAAO,KAAK,EAMV,MAAM,EACN,gBAAgB,EAEhB,gBAAgB,EAChB,iBAAiB,EAGjB,0BAA0B,EAC1B,2BAA2B,EAE5B,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"emails.d.ts","sourceRoot":"","sources":["../../src/emails/emails.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,MAAM,EAKZ,MAAM,eAAe,CAAA;AAGtB,OAAO,KAAK,EAMV,MAAM,EACN,gBAAgB,EAEhB,gBAAgB,EAChB,iBAAiB,EAGjB,0BAA0B,EAC1B,2BAA2B,EAE5B,MAAM,SAAS,CAAA;AAiEhB,eAAO,MAAM,gCAAgC,QAAS,CAAA;AACtD,eAAO,MAAM,iCAAiC,IAAI,CAAA;AAElD,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,E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
|
html: true,
|
|
70
72
|
text: true,
|
|
71
73
|
react: true
|
|
@@ -338,7 +340,7 @@ function templateContent(send, distinctId) {
|
|
|
338
340
|
};
|
|
339
341
|
}
|
|
340
342
|
function codeContent(send, distinctId) {
|
|
341
|
-
const { templateKey, subject, html, text, react, from, replyTo, captureEngagement } = send;
|
|
343
|
+
const { templateKey, subject, html, text, react, from, replyTo, captureEngagement, sensitive, tracking } = send;
|
|
342
344
|
if ('string' != typeof templateKey || !TEMPLATE_KEY_PATTERN.test(templateKey)) throw invalid('invalid_template_key', 'templateKey can only have letters, digits, hyphens (-) and underscores (_), at most 400.', 'templateKey');
|
|
343
345
|
refuseFieldsOutside(send, CODE_FORM, TEMPLATE_FORM);
|
|
344
346
|
if ('string' != typeof subject) throw invalid('invalid_form', 'A send with templateKey needs a subject.', 'subject');
|
|
@@ -364,7 +366,15 @@ function codeContent(send, distinctId) {
|
|
|
364
366
|
replyTo
|
|
365
367
|
] : replyTo
|
|
366
368
|
},
|
|
367
|
-
|
|
369
|
+
...void 0 !== captureEngagement && {
|
|
370
|
+
capture_engagement: captureEngagement
|
|
371
|
+
},
|
|
372
|
+
...void 0 !== sensitive && {
|
|
373
|
+
sensitive
|
|
374
|
+
},
|
|
375
|
+
...void 0 !== tracking && {
|
|
376
|
+
tracking
|
|
377
|
+
},
|
|
368
378
|
...void 0 !== distinctId && {
|
|
369
379
|
distinct_id: distinctId
|
|
370
380
|
}
|
package/dist/emails/emails.mjs
CHANGED
|
@@ -32,6 +32,8 @@ const CODE_FIELDS = {
|
|
|
32
32
|
from: true,
|
|
33
33
|
replyTo: true,
|
|
34
34
|
captureEngagement: true,
|
|
35
|
+
sensitive: true,
|
|
36
|
+
tracking: true,
|
|
35
37
|
html: true,
|
|
36
38
|
text: true,
|
|
37
39
|
react: true
|
|
@@ -304,7 +306,7 @@ function templateContent(send, distinctId) {
|
|
|
304
306
|
};
|
|
305
307
|
}
|
|
306
308
|
function codeContent(send, distinctId) {
|
|
307
|
-
const { templateKey, subject, html, text, react, from, replyTo, captureEngagement } = send;
|
|
309
|
+
const { templateKey, subject, html, text, react, from, replyTo, captureEngagement, sensitive, tracking } = send;
|
|
308
310
|
if ('string' != typeof templateKey || !TEMPLATE_KEY_PATTERN.test(templateKey)) throw invalid('invalid_template_key', 'templateKey can only have letters, digits, hyphens (-) and underscores (_), at most 400.', 'templateKey');
|
|
309
311
|
refuseFieldsOutside(send, CODE_FORM, TEMPLATE_FORM);
|
|
310
312
|
if ('string' != typeof subject) throw invalid('invalid_form', 'A send with templateKey needs a subject.', 'subject');
|
|
@@ -330,7 +332,15 @@ function codeContent(send, distinctId) {
|
|
|
330
332
|
replyTo
|
|
331
333
|
] : replyTo
|
|
332
334
|
},
|
|
333
|
-
|
|
335
|
+
...void 0 !== captureEngagement && {
|
|
336
|
+
capture_engagement: captureEngagement
|
|
337
|
+
},
|
|
338
|
+
...void 0 !== sensitive && {
|
|
339
|
+
sensitive
|
|
340
|
+
},
|
|
341
|
+
...void 0 !== tracking && {
|
|
342
|
+
tracking
|
|
343
|
+
},
|
|
334
344
|
...void 0 !== distinctId && {
|
|
335
345
|
distinct_id: distinctId
|
|
336
346
|
}
|
package/dist/emails/types.d.ts
CHANGED
|
@@ -41,8 +41,51 @@ interface CodeEmailFields {
|
|
|
41
41
|
* bounced) as events of the recipient. Defaults to `true`. A project whose admin turned
|
|
42
42
|
* engagement capture off captures nothing, whatever the send asks. A template made in PostHog
|
|
43
43
|
* follows the project's setting.
|
|
44
|
+
*
|
|
45
|
+
* @deprecated Use `tracking: { engagement: false }`. It keeps working, but PostHog refuses a
|
|
46
|
+
* send that sets both `captureEngagement` and `tracking`.
|
|
44
47
|
*/
|
|
45
48
|
captureEngagement?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Marks the email as sensitive, such as one that carries login links, reset tokens or codes.
|
|
51
|
+
* A sensitive email keeps its links as they are unless `tracking` turns clicks on, leaves its
|
|
52
|
+
* subject off engagement events, and keeps its content out of PostHog's logs.
|
|
53
|
+
*
|
|
54
|
+
* Without it, a send whose `templateKey` matches a template saved in PostHog follows that
|
|
55
|
+
* template's setting, and any other send is sensitive. PostHog refuses `sensitive: false` when
|
|
56
|
+
* the matching template is sensitive.
|
|
57
|
+
*/
|
|
58
|
+
sensitive?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* What PostHog tracks for this email. Without it, PostHog counts opens with its open pixel,
|
|
61
|
+
* captures engagement events, and counts clicks only when the email isn't sensitive.
|
|
62
|
+
*
|
|
63
|
+
* - `true` turns on opens, clicks and engagement events.
|
|
64
|
+
* - `false` turns off all tracking, including kinds PostHog adds later. PostHog can't count the
|
|
65
|
+
* email's opens or clicks, and captures no engagement events.
|
|
66
|
+
* - An object turns each kind on or off. A key you leave out keeps its default.
|
|
67
|
+
*
|
|
68
|
+
* Turn clicks on for a sensitive email only when its links are safe to send through PostHog's
|
|
69
|
+
* click tracking.
|
|
70
|
+
*/
|
|
71
|
+
tracking?: boolean | EmailTracking;
|
|
72
|
+
}
|
|
73
|
+
/** Which kinds of tracking a send with `templateKey` turns on. */
|
|
74
|
+
export interface EmailTracking {
|
|
75
|
+
/** Counts opens with PostHog's open pixel. Defaults to `true`. */
|
|
76
|
+
opens?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Counts clicks by sending the email's links through PostHog's click tracking. Defaults to
|
|
79
|
+
* `false` for a sensitive email and `true` for any other. Needs `opens`: PostHog refuses a send
|
|
80
|
+
* with `opens: false` and `clicks: true`.
|
|
81
|
+
*/
|
|
82
|
+
clicks?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Captures the email's engagement events (sent, delivered, opened, clicked, bounced) as events
|
|
85
|
+
* of the recipient. Defaults to `true`. A project whose admin turned engagement capture off
|
|
86
|
+
* captures nothing, whatever the send asks.
|
|
87
|
+
*/
|
|
88
|
+
engagement?: boolean;
|
|
46
89
|
}
|
|
47
90
|
/**
|
|
48
91
|
* A React element, such as `<WelcomeEmail firstName="Ada" />`. Typed by its shape, so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/emails/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C,gDAAgD;AAChD,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,EAAE,EAAE,MAAM,CAAA;IACV;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,4FAA4F;IAC5F,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,gEAAgE;AAChE,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,UAAU,EAAE,MAAM,CAAA;IAClB,0FAA0F;IAC1F,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACvC;AAED,UAAU,eAAe;IACvB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,4GAA4G;IAC5G,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC3B
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/emails/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C,gDAAgD;AAChD,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,EAAE,EAAE,MAAM,CAAA;IACV;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,4FAA4F;IAC5F,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,gEAAgE;AAChE,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,UAAU,EAAE,MAAM,CAAA;IAClB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CAAC,2BAA2B,CAAC,CAAA;CAC1F"}
|
package/dist/exports.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { enrichCurrentSpan } from './extensions/context/listeners';
|
|
|
6
6
|
export { FeatureFlagEvaluations } from './feature-flag-evaluations';
|
|
7
7
|
export { EmailError } from './emails/errors';
|
|
8
8
|
export type { EmailErrorName } from './emails/errors';
|
|
9
|
-
export type { CodeEmailForm, EmailDeliveryStatus, EmailPreferences, EmailReactElement, Emails, EmailStatus, EmailWarning, GetEmailResponse, SendCodeEmailOptions, SendEmailBase, SendEmailOptions, SendEmailResponse, SendEmailResult, SendTemplateEmailOptions, SetEmailPreferencesOptions, SetEmailPreferencesResponse, TemplateEmailForm, } from './emails/types';
|
|
9
|
+
export type { CodeEmailForm, EmailDeliveryStatus, EmailPreferences, EmailReactElement, Emails, EmailStatus, EmailTracking, EmailWarning, GetEmailResponse, SendCodeEmailOptions, SendEmailBase, SendEmailOptions, SendEmailResponse, SendEmailResult, SendTemplateEmailOptions, SetEmailPreferencesOptions, SetEmailPreferencesResponse, TemplateEmailForm, } from './emails/types';
|
|
10
10
|
export type { FlagDefinitionCacheData, FlagDefinitionCacheInput, FlagDefinitionCacheProvider, } from './extensions/feature-flags/cache';
|
|
11
11
|
export { FeatureFlagError } from '@posthog/core';
|
|
12
12
|
export type { FeatureFlagErrorType, UnresolvedFlagReason } from '@posthog/core';
|
package/dist/exports.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAA;AAC/C,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAElE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,iB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EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACrD,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,EACN,WAAW,EACX,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,0BAA0B,EAC1B,2BAA2B,EAC3B,iBAAiB,GAClB,MAAM,gBAAgB,CAAA;AACvB,YAAY,EACV,uBAAuB,EACvB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,kCAAkC,CAAA;AAIzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAI/E,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAInG,YAAY,EACV,IAAI,EACJ,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,YAAY,GACb,MAAM,eAAe,CAAA;AAKtB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,MAAM,GACP,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "5.
|
|
1
|
+
export declare const version = "5.71.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
package/dist/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const version = "5.
|
|
1
|
+
const version = "5.71.0";
|
|
2
2
|
export { version };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "posthog-node",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.71.0",
|
|
4
4
|
"bugs": {
|
|
5
5
|
"url": "https://github.com/PostHog/posthog-js/issues"
|
|
6
6
|
},
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"module": "dist/entrypoints/index.node.mjs",
|
|
30
30
|
"types": "dist/entrypoints/index.node.d.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@posthog/core": "^1.67.
|
|
32
|
+
"@posthog/core": "^1.67.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@edge-runtime/vm": "^5.0.0",
|
package/src/emails/emails.ts
CHANGED
|
@@ -70,6 +70,8 @@ const CODE_FIELDS: EveryField<CodeEmailForm> = {
|
|
|
70
70
|
from: true,
|
|
71
71
|
replyTo: true,
|
|
72
72
|
captureEngagement: true,
|
|
73
|
+
sensitive: true,
|
|
74
|
+
tracking: true,
|
|
73
75
|
html: true,
|
|
74
76
|
text: true,
|
|
75
77
|
react: true,
|
|
@@ -462,7 +464,7 @@ function templateContent(send: UncheckedSend, distinctId: string | undefined): R
|
|
|
462
464
|
}
|
|
463
465
|
|
|
464
466
|
function codeContent(send: UncheckedSend, distinctId: string | undefined): Record<string, unknown> {
|
|
465
|
-
const { templateKey, subject, html, text, react, from, replyTo, captureEngagement } = send
|
|
467
|
+
const { templateKey, subject, html, text, react, from, replyTo, captureEngagement, sensitive, tracking } = send
|
|
466
468
|
if (typeof templateKey !== 'string' || !TEMPLATE_KEY_PATTERN.test(templateKey)) {
|
|
467
469
|
throw invalid(
|
|
468
470
|
'invalid_template_key',
|
|
@@ -493,7 +495,9 @@ function codeContent(send: UncheckedSend, distinctId: string | undefined): Recor
|
|
|
493
495
|
...(text !== undefined && { text }),
|
|
494
496
|
...(from !== undefined && { from }),
|
|
495
497
|
...(sendsReplyTo && { reply_to: typeof replyTo === 'string' ? [replyTo] : replyTo }),
|
|
496
|
-
capture_engagement: captureEngagement
|
|
498
|
+
...(captureEngagement !== undefined && { capture_engagement: captureEngagement }),
|
|
499
|
+
...(sensitive !== undefined && { sensitive }),
|
|
500
|
+
...(tracking !== undefined && { tracking }),
|
|
497
501
|
...(distinctId !== undefined && { distinct_id: distinctId }),
|
|
498
502
|
}
|
|
499
503
|
}
|
package/src/emails/types.ts
CHANGED
|
@@ -44,8 +44,52 @@ interface CodeEmailFields {
|
|
|
44
44
|
* bounced) as events of the recipient. Defaults to `true`. A project whose admin turned
|
|
45
45
|
* engagement capture off captures nothing, whatever the send asks. A template made in PostHog
|
|
46
46
|
* follows the project's setting.
|
|
47
|
+
*
|
|
48
|
+
* @deprecated Use `tracking: { engagement: false }`. It keeps working, but PostHog refuses a
|
|
49
|
+
* send that sets both `captureEngagement` and `tracking`.
|
|
47
50
|
*/
|
|
48
51
|
captureEngagement?: boolean
|
|
52
|
+
/**
|
|
53
|
+
* Marks the email as sensitive, such as one that carries login links, reset tokens or codes.
|
|
54
|
+
* A sensitive email keeps its links as they are unless `tracking` turns clicks on, leaves its
|
|
55
|
+
* subject off engagement events, and keeps its content out of PostHog's logs.
|
|
56
|
+
*
|
|
57
|
+
* Without it, a send whose `templateKey` matches a template saved in PostHog follows that
|
|
58
|
+
* template's setting, and any other send is sensitive. PostHog refuses `sensitive: false` when
|
|
59
|
+
* the matching template is sensitive.
|
|
60
|
+
*/
|
|
61
|
+
sensitive?: boolean
|
|
62
|
+
/**
|
|
63
|
+
* What PostHog tracks for this email. Without it, PostHog counts opens with its open pixel,
|
|
64
|
+
* captures engagement events, and counts clicks only when the email isn't sensitive.
|
|
65
|
+
*
|
|
66
|
+
* - `true` turns on opens, clicks and engagement events.
|
|
67
|
+
* - `false` turns off all tracking, including kinds PostHog adds later. PostHog can't count the
|
|
68
|
+
* email's opens or clicks, and captures no engagement events.
|
|
69
|
+
* - An object turns each kind on or off. A key you leave out keeps its default.
|
|
70
|
+
*
|
|
71
|
+
* Turn clicks on for a sensitive email only when its links are safe to send through PostHog's
|
|
72
|
+
* click tracking.
|
|
73
|
+
*/
|
|
74
|
+
tracking?: boolean | EmailTracking
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Which kinds of tracking a send with `templateKey` turns on. */
|
|
78
|
+
export interface EmailTracking {
|
|
79
|
+
/** Counts opens with PostHog's open pixel. Defaults to `true`. */
|
|
80
|
+
opens?: boolean
|
|
81
|
+
/**
|
|
82
|
+
* Counts clicks by sending the email's links through PostHog's click tracking. Defaults to
|
|
83
|
+
* `false` for a sensitive email and `true` for any other. Needs `opens`: PostHog refuses a send
|
|
84
|
+
* with `opens: false` and `clicks: true`.
|
|
85
|
+
*/
|
|
86
|
+
clicks?: boolean
|
|
87
|
+
/**
|
|
88
|
+
* Captures the email's engagement events (sent, delivered, opened, clicked, bounced) as events
|
|
89
|
+
* of the recipient. Defaults to `true`. A project whose admin turned engagement capture off
|
|
90
|
+
* captures nothing, whatever the send asks.
|
|
91
|
+
*/
|
|
92
|
+
engagement?: boolean
|
|
49
93
|
}
|
|
50
94
|
|
|
51
95
|
/**
|
package/src/exports.ts
CHANGED
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "5.
|
|
1
|
+
export const version = "5.71.0"
|