@ecency/sdk 2.3.92 → 2.3.93
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/browser/index.d.ts
CHANGED
|
@@ -1058,6 +1058,14 @@ declare const INTERNAL_API_TIMEOUT_MS = 10000;
|
|
|
1058
1058
|
declare const SERVER_GC_TIME_MS: number;
|
|
1059
1059
|
declare const CONFIG: {
|
|
1060
1060
|
privateApiHost: string;
|
|
1061
|
+
/**
|
|
1062
|
+
* Host for the newsletter relay routes (/api/newsletter/*), which live on
|
|
1063
|
+
* the WEB origin (Next.js route handlers), not on the private API service.
|
|
1064
|
+
* `undefined` falls back to `privateApiHost` (right for mobile, whose one
|
|
1065
|
+
* host serves both); the web client pins it to "" so newsletter requests
|
|
1066
|
+
* stay same-origin on ANY deployment, hostname regardless.
|
|
1067
|
+
*/
|
|
1068
|
+
newsletterHost: string | undefined;
|
|
1061
1069
|
/**
|
|
1062
1070
|
* Observer used for bridge calls when nobody is logged in. The bridge applies
|
|
1063
1071
|
* this account's mute list to the response, marking muted authors' posts and
|
|
@@ -1131,6 +1139,12 @@ declare namespace ConfigManager {
|
|
|
1131
1139
|
* @param host - The private API host URL (e.g., "https://ecency.com" or "" for relative URLs)
|
|
1132
1140
|
*/
|
|
1133
1141
|
function setPrivateApiHost(host: string): void;
|
|
1142
|
+
/**
|
|
1143
|
+
* Set the host for the newsletter relay routes (/api/newsletter/*), or
|
|
1144
|
+
* `undefined` to fall back to the private API host. Use "" for same-origin
|
|
1145
|
+
* relative requests (the web client's case).
|
|
1146
|
+
*/
|
|
1147
|
+
function setNewsletterHost(host: string | undefined): void;
|
|
1134
1148
|
/**
|
|
1135
1149
|
* Set the first-party client identifier sent as the `X-Ecency-Client` header
|
|
1136
1150
|
* on search/private API requests (e.g. "web" or "mobile"). Defaults to
|
|
@@ -9740,6 +9754,31 @@ declare function getContentModerationReason(content: ModerationCandidate | undef
|
|
|
9740
9754
|
/** True if the post body contains an outbound (non-Hive, non-image) link. */
|
|
9741
9755
|
declare function hasExternalLink(body: string | undefined | null): boolean;
|
|
9742
9756
|
|
|
9757
|
+
/**
|
|
9758
|
+
* Error types for the newsletter client, in their own dependency-free file so
|
|
9759
|
+
* test setups can hand out the REAL classes (instanceof must hold across the
|
|
9760
|
+
* app) without pulling the SDK config chain along.
|
|
9761
|
+
*/
|
|
9762
|
+
declare class NewsletterApiError extends Error {
|
|
9763
|
+
readonly status: number;
|
|
9764
|
+
readonly data?: unknown | undefined;
|
|
9765
|
+
constructor(message: string, status: number, data?: unknown | undefined);
|
|
9766
|
+
}
|
|
9767
|
+
/** A refused send, carrying the relay's routing `code` (already_sent, suspended, ...). */
|
|
9768
|
+
declare class NewsletterSendRefusedError extends NewsletterApiError {
|
|
9769
|
+
readonly code?: string | undefined;
|
|
9770
|
+
readonly taken?: Array<{
|
|
9771
|
+
cadence: string;
|
|
9772
|
+
period: string;
|
|
9773
|
+
kind: string;
|
|
9774
|
+
}> | undefined;
|
|
9775
|
+
constructor(message: string, status: number, code?: string | undefined, taken?: Array<{
|
|
9776
|
+
cadence: string;
|
|
9777
|
+
period: string;
|
|
9778
|
+
kind: string;
|
|
9779
|
+
}> | undefined, data?: unknown);
|
|
9780
|
+
}
|
|
9781
|
+
|
|
9743
9782
|
type DigestType = "own" | "community" | "creator" | "site";
|
|
9744
9783
|
type DigestCadence = "weekly" | "monthly";
|
|
9745
9784
|
type DigestStatus = "active" | "pending_confirmation" | "suppressed" | "ended";
|
|
@@ -9874,42 +9913,6 @@ interface NewsletterSenderStanding {
|
|
|
9874
9913
|
};
|
|
9875
9914
|
}
|
|
9876
9915
|
|
|
9877
|
-
/**
|
|
9878
|
-
* Client for the newsletter relay at {privateApiHost}/api/newsletter/*
|
|
9879
|
-
* (Next.js route handlers on ecency.com, which alone hold the news-service
|
|
9880
|
-
* credentials — clients never talk to the service directly).
|
|
9881
|
-
*
|
|
9882
|
-
* Identity is the HiveSigner access token, passed here as the explicit `code`
|
|
9883
|
-
* argument. Transport mirrors the deployed web client per route: subscribe and
|
|
9884
|
-
* unsubscribe-all carry it in the POST body as `code` (the subscribe route
|
|
9885
|
-
* authenticates ONLY from the body — a header alone is treated as anonymous);
|
|
9886
|
-
* every other call, the send/preview POSTs included, uses the `X-HS-Token`
|
|
9887
|
-
* header. The relay verifies it upstream and derives the account from it, so
|
|
9888
|
-
* a stale token 401s — callers are responsible for supplying a fresh one
|
|
9889
|
-
* (web: ensureValidToken; mobile: the token-refresh wrapper).
|
|
9890
|
-
*
|
|
9891
|
-
* The email-token confirm/unsubscribe flows are deliberately absent: those
|
|
9892
|
-
* links land on web pages.
|
|
9893
|
-
*/
|
|
9894
|
-
declare class NewsletterApiError extends Error {
|
|
9895
|
-
readonly status: number;
|
|
9896
|
-
readonly data?: unknown | undefined;
|
|
9897
|
-
constructor(message: string, status: number, data?: unknown | undefined);
|
|
9898
|
-
}
|
|
9899
|
-
/** A refused send, carrying the relay's routing `code` (already_sent, suspended, ...). */
|
|
9900
|
-
declare class NewsletterSendRefusedError extends NewsletterApiError {
|
|
9901
|
-
readonly code?: string | undefined;
|
|
9902
|
-
readonly taken?: Array<{
|
|
9903
|
-
cadence: string;
|
|
9904
|
-
period: string;
|
|
9905
|
-
kind: string;
|
|
9906
|
-
}> | undefined;
|
|
9907
|
-
constructor(message: string, status: number, code?: string | undefined, taken?: Array<{
|
|
9908
|
-
cadence: string;
|
|
9909
|
-
period: string;
|
|
9910
|
-
kind: string;
|
|
9911
|
-
}> | undefined, data?: unknown);
|
|
9912
|
-
}
|
|
9913
9916
|
/**
|
|
9914
9917
|
* Subscribe an address to a digest. Authenticated callers (code given) skip
|
|
9915
9918
|
* the captcha; anonymous callers must supply `captchaToken` in the input and
|