@oxygen-agent/cli 1.1046.51 → 1.1046.52
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 +1 -1
- package/node_modules/@oxygen/shared/dist/sequences/linkedin-send-restrictions.d.ts +74 -0
- package/node_modules/@oxygen/shared/dist/sequences/linkedin-send-restrictions.js +102 -0
- package/node_modules/@oxygen/shared/dist/version.generated.d.ts +1 -1
- package/node_modules/@oxygen/shared/dist/version.generated.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A LinkedIn account whose invitations or InMails LinkedIn refuses as the
|
|
3
|
+
* ACCOUNT's restriction, with the provider proving nothing was sent. Dispatch
|
|
4
|
+
* parks that account's invitations (or InMails) and keeps every lead waiting
|
|
5
|
+
* instead of failing it (`senderWriteRestrictionScope`); this record is how the
|
|
6
|
+
* account, its Sequences and the workspace learn that it happened.
|
|
7
|
+
*
|
|
8
|
+
* Plain T-478: an account past LinkedIn's allowance for invitations with a note
|
|
9
|
+
* held 149 leads of two Sequences for 13 days while it read `active` with health
|
|
10
|
+
* `low`, and every waiting lead said "LinkedIn asked the sender to slow down".
|
|
11
|
+
*
|
|
12
|
+
* Stored on `ox_sequencer.sender_accounts.metadata`, keyed by the parked provider
|
|
13
|
+
* operation (`users_invite`, `inmail`). Written by dispatch on each refusal and
|
|
14
|
+
* removed by the next send of that kind from the account. Browser-safe.
|
|
15
|
+
*/
|
|
16
|
+
export declare const LINKEDIN_SEND_RESTRICTIONS_METADATA_KEY = "send_restrictions";
|
|
17
|
+
/**
|
|
18
|
+
* When OXYGEN last emailed the workspace about any restriction of this account.
|
|
19
|
+
* Survives the record itself, so an account that flaps between refused and
|
|
20
|
+
* accepted is not announced more than once per LINKEDIN_SEND_RESTRICTION_ALERT_INTERVAL_MS.
|
|
21
|
+
*/
|
|
22
|
+
export declare const LINKEDIN_SEND_RESTRICTION_ALERTED_AT_METADATA_KEY = "send_restriction_alerted_at";
|
|
23
|
+
/** One workspace email per account per week at most, however often the restriction returns. */
|
|
24
|
+
export declare const LINKEDIN_SEND_RESTRICTION_ALERT_INTERVAL_MS: number;
|
|
25
|
+
/**
|
|
26
|
+
* A restriction nothing refused for this long is history, not a hold: while
|
|
27
|
+
* leads wait, dispatch asks LinkedIn at least daily (the cooldown backs off to a
|
|
28
|
+
* day) and moves `last_refused_at`. Readers stop showing it, and the next refusal
|
|
29
|
+
* starts a new restriction (`recordLinkedInSendRestriction`).
|
|
30
|
+
*/
|
|
31
|
+
export declare const LINKEDIN_SEND_RESTRICTION_STALE_MS: number;
|
|
32
|
+
/**
|
|
33
|
+
* What LinkedIn refused:
|
|
34
|
+
* - `invite_note_allowance`: "You have reached the limit for custom messages" —
|
|
35
|
+
* the account has used its allowance of invitations with a note.
|
|
36
|
+
* - `account_restricted`: an access restriction LinkedIn did not explain.
|
|
37
|
+
*/
|
|
38
|
+
export type LinkedInSendRestrictionRefusal = "invite_note_allowance" | "account_restricted";
|
|
39
|
+
export type LinkedInSendRestrictionKind = "invite" | "inmail";
|
|
40
|
+
export type LinkedInSendRestriction = {
|
|
41
|
+
/** The parked provider operation (`users_invite`, `inmail`). */
|
|
42
|
+
operation: string;
|
|
43
|
+
actionKind: LinkedInSendRestrictionKind;
|
|
44
|
+
refusal: LinkedInSendRestrictionRefusal;
|
|
45
|
+
/** LinkedIn's own sentence as the provider relayed it, when it gave one. */
|
|
46
|
+
providerMessage: string | null;
|
|
47
|
+
firstRefusedAt: string;
|
|
48
|
+
lastRefusedAt: string;
|
|
49
|
+
/** When dispatch asks LinkedIn again: the parked operation's cooldown. */
|
|
50
|
+
retryAt: string | null;
|
|
51
|
+
/** When the workspace was emailed about this restriction; null until then. */
|
|
52
|
+
alertedAt: string | null;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* The account's current restrictions, newest refusal first: not those nothing
|
|
56
|
+
* refused within LINKEDIN_SEND_RESTRICTION_STALE_MS of `now`. Pure and total.
|
|
57
|
+
*/
|
|
58
|
+
export declare function readLinkedInSendRestrictions(metadata: Record<string, unknown> | null | undefined, now?: Date): LinkedInSendRestriction[];
|
|
59
|
+
/** The restriction parking this provider operation, if the account has one. */
|
|
60
|
+
export declare function linkedInSendRestrictionFor(metadata: Record<string, unknown> | null | undefined, operation: string, now?: Date): LinkedInSendRestriction | null;
|
|
61
|
+
/**
|
|
62
|
+
* What the account's waiting leads can be moved by: shared by the account's
|
|
63
|
+
* explanation and the workspace email, so both name the same actions.
|
|
64
|
+
*/
|
|
65
|
+
export declare function linkedInSendRestrictionRemedy(restriction: Pick<LinkedInSendRestriction, "actionKind" | "refusal">): string;
|
|
66
|
+
/**
|
|
67
|
+
* The account-level explanation (senders health, the Connections notice and
|
|
68
|
+
* panel): what LinkedIn refuses, that every send of that kind from the account
|
|
69
|
+
* waits unsent, and what moves the leads. Never names the provider.
|
|
70
|
+
*/
|
|
71
|
+
export declare function linkedInSendRestrictionExplanation(input: {
|
|
72
|
+
displayName: string | null;
|
|
73
|
+
restriction: Pick<LinkedInSendRestriction, "actionKind" | "refusal">;
|
|
74
|
+
}): string;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A LinkedIn account whose invitations or InMails LinkedIn refuses as the
|
|
3
|
+
* ACCOUNT's restriction, with the provider proving nothing was sent. Dispatch
|
|
4
|
+
* parks that account's invitations (or InMails) and keeps every lead waiting
|
|
5
|
+
* instead of failing it (`senderWriteRestrictionScope`); this record is how the
|
|
6
|
+
* account, its Sequences and the workspace learn that it happened.
|
|
7
|
+
*
|
|
8
|
+
* Plain T-478: an account past LinkedIn's allowance for invitations with a note
|
|
9
|
+
* held 149 leads of two Sequences for 13 days while it read `active` with health
|
|
10
|
+
* `low`, and every waiting lead said "LinkedIn asked the sender to slow down".
|
|
11
|
+
*
|
|
12
|
+
* Stored on `ox_sequencer.sender_accounts.metadata`, keyed by the parked provider
|
|
13
|
+
* operation (`users_invite`, `inmail`). Written by dispatch on each refusal and
|
|
14
|
+
* removed by the next send of that kind from the account. Browser-safe.
|
|
15
|
+
*/
|
|
16
|
+
export const LINKEDIN_SEND_RESTRICTIONS_METADATA_KEY = "send_restrictions";
|
|
17
|
+
/**
|
|
18
|
+
* When OXYGEN last emailed the workspace about any restriction of this account.
|
|
19
|
+
* Survives the record itself, so an account that flaps between refused and
|
|
20
|
+
* accepted is not announced more than once per LINKEDIN_SEND_RESTRICTION_ALERT_INTERVAL_MS.
|
|
21
|
+
*/
|
|
22
|
+
export const LINKEDIN_SEND_RESTRICTION_ALERTED_AT_METADATA_KEY = "send_restriction_alerted_at";
|
|
23
|
+
/** One workspace email per account per week at most, however often the restriction returns. */
|
|
24
|
+
export const LINKEDIN_SEND_RESTRICTION_ALERT_INTERVAL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
25
|
+
/**
|
|
26
|
+
* A restriction nothing refused for this long is history, not a hold: while
|
|
27
|
+
* leads wait, dispatch asks LinkedIn at least daily (the cooldown backs off to a
|
|
28
|
+
* day) and moves `last_refused_at`. Readers stop showing it, and the next refusal
|
|
29
|
+
* starts a new restriction (`recordLinkedInSendRestriction`).
|
|
30
|
+
*/
|
|
31
|
+
export const LINKEDIN_SEND_RESTRICTION_STALE_MS = 14 * 24 * 60 * 60 * 1000;
|
|
32
|
+
function isRecord(value) {
|
|
33
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
34
|
+
}
|
|
35
|
+
function readText(record, key) {
|
|
36
|
+
const value = record[key];
|
|
37
|
+
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The account's current restrictions, newest refusal first: not those nothing
|
|
41
|
+
* refused within LINKEDIN_SEND_RESTRICTION_STALE_MS of `now`. Pure and total.
|
|
42
|
+
*/
|
|
43
|
+
export function readLinkedInSendRestrictions(metadata, now = new Date()) {
|
|
44
|
+
const stored = metadata?.[LINKEDIN_SEND_RESTRICTIONS_METADATA_KEY];
|
|
45
|
+
if (!isRecord(stored))
|
|
46
|
+
return [];
|
|
47
|
+
const restrictions = [];
|
|
48
|
+
for (const [operation, raw] of Object.entries(stored)) {
|
|
49
|
+
if (!isRecord(raw))
|
|
50
|
+
continue;
|
|
51
|
+
const firstRefusedAt = readText(raw, "first_refused_at");
|
|
52
|
+
const lastRefusedAt = readText(raw, "last_refused_at") ?? firstRefusedAt;
|
|
53
|
+
if (!firstRefusedAt || !lastRefusedAt)
|
|
54
|
+
continue;
|
|
55
|
+
const lastRefused = Date.parse(lastRefusedAt);
|
|
56
|
+
if (!Number.isFinite(lastRefused) || lastRefused < now.getTime() - LINKEDIN_SEND_RESTRICTION_STALE_MS)
|
|
57
|
+
continue;
|
|
58
|
+
restrictions.push({
|
|
59
|
+
operation,
|
|
60
|
+
actionKind: raw.action_kind === "inmail" ? "inmail" : "invite",
|
|
61
|
+
refusal: raw.refusal === "invite_note_allowance" ? "invite_note_allowance" : "account_restricted",
|
|
62
|
+
providerMessage: readText(raw, "provider_message"),
|
|
63
|
+
firstRefusedAt,
|
|
64
|
+
lastRefusedAt,
|
|
65
|
+
retryAt: readText(raw, "retry_at"),
|
|
66
|
+
alertedAt: readText(raw, "alerted_at"),
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return restrictions.sort((a, b) => b.lastRefusedAt.localeCompare(a.lastRefusedAt));
|
|
70
|
+
}
|
|
71
|
+
/** The restriction parking this provider operation, if the account has one. */
|
|
72
|
+
export function linkedInSendRestrictionFor(metadata, operation, now = new Date()) {
|
|
73
|
+
return readLinkedInSendRestrictions(metadata, now).find((restriction) => restriction.operation === operation) ?? null;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* What the account's waiting leads can be moved by: shared by the account's
|
|
77
|
+
* explanation and the workspace email, so both name the same actions.
|
|
78
|
+
*/
|
|
79
|
+
export function linkedInSendRestrictionRemedy(restriction) {
|
|
80
|
+
if (restriction.actionKind === "invite" && restriction.refusal === "invite_note_allowance") {
|
|
81
|
+
return "To keep them moving, remove the note from the invitation step (invitations without a note have their own, larger LinkedIn limit), or pause the sequences.";
|
|
82
|
+
}
|
|
83
|
+
return "Check the account on LinkedIn, or pause the sequences.";
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The account-level explanation (senders health, the Connections notice and
|
|
87
|
+
* panel): what LinkedIn refuses, that every send of that kind from the account
|
|
88
|
+
* waits unsent, and what moves the leads. Never names the provider.
|
|
89
|
+
*/
|
|
90
|
+
export function linkedInSendRestrictionExplanation(input) {
|
|
91
|
+
const account = input.displayName?.trim() || "this LinkedIn account";
|
|
92
|
+
const { restriction } = input;
|
|
93
|
+
const inMail = restriction.actionKind === "inmail";
|
|
94
|
+
const allowance = !inMail && restriction.refusal === "invite_note_allowance";
|
|
95
|
+
const refused = inMail
|
|
96
|
+
? `LinkedIn refuses InMails from ${account}.`
|
|
97
|
+
: allowance
|
|
98
|
+
? `LinkedIn refuses invitations with a note from ${account}: the account has used LinkedIn's allowance of invitations with a note (accounts without a paid LinkedIn plan get about five a month).`
|
|
99
|
+
: `LinkedIn refuses invitations from ${account}.`;
|
|
100
|
+
const kind = inMail ? "InMail" : "invitation";
|
|
101
|
+
return `${refused} Until LinkedIn accepts one again, every ${kind} from this account waits and nothing is sent to its leads; OXYGEN asks LinkedIn again on its own, backing off to once a day. ${linkedInSendRestrictionRemedy(restriction)}`;
|
|
102
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const OXYGEN_BUILD_VERSION = "1.1046.
|
|
1
|
+
export declare const OXYGEN_BUILD_VERSION = "1.1046.52";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// GENERATED by scripts/ci/version-stamp.mjs from VERSION + git history. Do not edit; do not commit.
|
|
2
|
-
export const OXYGEN_BUILD_VERSION = "1.1046.
|
|
2
|
+
export const OXYGEN_BUILD_VERSION = "1.1046.52";
|