@mushi-mushi/core 1.16.0 → 1.17.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/index.cjs +9 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1115,6 +1115,8 @@ interface MushiSDKInstance {
|
|
|
1115
1115
|
hide(): void;
|
|
1116
1116
|
attachTo(selectorOrElement: string | Element, options?: MushiWidgetConfig): () => void;
|
|
1117
1117
|
setTrigger(trigger: NonNullable<MushiWidgetConfig['trigger']>): void;
|
|
1118
|
+
/** Open the widget directly to the reporter's "My reports" history view. */
|
|
1119
|
+
openReporter(): void;
|
|
1118
1120
|
close(): void;
|
|
1119
1121
|
destroy(): void;
|
|
1120
1122
|
updateConfig(config: MushiRuntimeSdkConfig): void;
|
|
@@ -1551,6 +1553,9 @@ interface ApiClientOptions {
|
|
|
1551
1553
|
apiEndpoint?: string;
|
|
1552
1554
|
timeout?: number;
|
|
1553
1555
|
maxRetries?: number;
|
|
1556
|
+
/** When set, sent on every request so heartbeats record the running SDK version. */
|
|
1557
|
+
sdkPackage?: string;
|
|
1558
|
+
sdkVersion?: string;
|
|
1554
1559
|
/**
|
|
1555
1560
|
* Returns the current signed end-user identity JWT, or null when the user is
|
|
1556
1561
|
* anonymous. When present it is sent on the X-Mushi-User-Token header so the
|
package/dist/index.d.ts
CHANGED
|
@@ -1115,6 +1115,8 @@ interface MushiSDKInstance {
|
|
|
1115
1115
|
hide(): void;
|
|
1116
1116
|
attachTo(selectorOrElement: string | Element, options?: MushiWidgetConfig): () => void;
|
|
1117
1117
|
setTrigger(trigger: NonNullable<MushiWidgetConfig['trigger']>): void;
|
|
1118
|
+
/** Open the widget directly to the reporter's "My reports" history view. */
|
|
1119
|
+
openReporter(): void;
|
|
1118
1120
|
close(): void;
|
|
1119
1121
|
destroy(): void;
|
|
1120
1122
|
updateConfig(config: MushiRuntimeSdkConfig): void;
|
|
@@ -1551,6 +1553,9 @@ interface ApiClientOptions {
|
|
|
1551
1553
|
apiEndpoint?: string;
|
|
1552
1554
|
timeout?: number;
|
|
1553
1555
|
maxRetries?: number;
|
|
1556
|
+
/** When set, sent on every request so heartbeats record the running SDK version. */
|
|
1557
|
+
sdkPackage?: string;
|
|
1558
|
+
sdkVersion?: string;
|
|
1554
1559
|
/**
|
|
1555
1560
|
* Returns the current signed end-user identity JWT, or null when the user is
|
|
1556
1561
|
* anonymous. When present it is sent on the X-Mushi-User-Token header so the
|
package/dist/index.js
CHANGED
|
@@ -42,6 +42,8 @@ function formatBytes(n) {
|
|
|
42
42
|
|
|
43
43
|
// src/api-client.ts
|
|
44
44
|
var MUSHI_USER_TOKEN_HEADER = "X-Mushi-User-Token";
|
|
45
|
+
var MUSHI_SDK_PACKAGE_HEADER = "X-Mushi-SDK-Package";
|
|
46
|
+
var MUSHI_SDK_VERSION_HEADER = "X-Mushi-SDK-Version";
|
|
45
47
|
var DEFAULT_API_ENDPOINT = "https://dxptnwrhwsqckaftyymj.supabase.co/functions/v1/api";
|
|
46
48
|
var MUSHI_INTERNAL_HEADER = "X-Mushi-Internal";
|
|
47
49
|
var MUSHI_INTERNAL_INIT_MARKER = "__mushiInternal";
|
|
@@ -54,7 +56,9 @@ function createApiClient(options) {
|
|
|
54
56
|
apiEndpoint = DEFAULT_API_ENDPOINT,
|
|
55
57
|
timeout = DEFAULT_TIMEOUT,
|
|
56
58
|
maxRetries = DEFAULT_MAX_RETRIES,
|
|
57
|
-
getUserToken
|
|
59
|
+
getUserToken,
|
|
60
|
+
sdkPackage,
|
|
61
|
+
sdkVersion
|
|
58
62
|
} = options;
|
|
59
63
|
let baseUrl = apiEndpoint.replace(/\/$/, "");
|
|
60
64
|
async function request(method, path, body, retries = maxRetries, internalKind, extraHeaders) {
|
|
@@ -69,6 +73,8 @@ function createApiClient(options) {
|
|
|
69
73
|
"Content-Type": "application/json",
|
|
70
74
|
"X-Mushi-Api-Key": apiKey,
|
|
71
75
|
"X-Mushi-Project": projectId,
|
|
76
|
+
...sdkPackage ? { [MUSHI_SDK_PACKAGE_HEADER]: sdkPackage } : {},
|
|
77
|
+
...sdkVersion ? { [MUSHI_SDK_VERSION_HEADER]: sdkVersion } : {},
|
|
72
78
|
...userToken ? { [MUSHI_USER_TOKEN_HEADER]: userToken } : {},
|
|
73
79
|
...internalKind ? { [MUSHI_INTERNAL_HEADER]: internalKind } : {},
|
|
74
80
|
...extraHeaders
|
|
@@ -131,6 +137,8 @@ function createApiClient(options) {
|
|
|
131
137
|
"Content-Type": "application/json",
|
|
132
138
|
"X-Mushi-Api-Key": apiKey,
|
|
133
139
|
"X-Mushi-Project": projectId,
|
|
140
|
+
...sdkPackage ? { [MUSHI_SDK_PACKAGE_HEADER]: sdkPackage } : {},
|
|
141
|
+
...sdkVersion ? { [MUSHI_SDK_VERSION_HEADER]: sdkVersion } : {},
|
|
134
142
|
[MUSHI_INTERNAL_HEADER]: "reporter-poll",
|
|
135
143
|
"X-Reporter-Token-Hash": tokenHash,
|
|
136
144
|
"X-Reporter-Ts": ts,
|