@howuse/feedback 0.4.0 → 0.5.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 +18 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.mjs +18 -0
- package/dist/native/index.d.ts +2 -1
- package/dist/types.d.ts +15 -0
- package/native/howuse_feedback.dll +0 -0
- package/native/howuse_feedback.h +1 -0
- package/native/libhowuse_feedback.dylib +0 -0
- package/native/libhowuse_feedback.h +1 -0
- package/native/libhowuse_feedback_arm64.dylib +0 -0
- package/native/libhowuse_feedback_arm64.h +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -43,6 +43,7 @@ function createNativeClient() {
|
|
|
43
43
|
const SubmitFeedback = lib.func("SubmitFeedback", "str", ["str"]);
|
|
44
44
|
const Activate = lib.func("Activate", "str", ["str"]);
|
|
45
45
|
const CheckActivation = lib.func("CheckActivation", "str", ["str"]);
|
|
46
|
+
const StoreData = lib.func("StoreData", "str", ["str"]);
|
|
46
47
|
return {
|
|
47
48
|
async initClient(options) {
|
|
48
49
|
const json = JSON.stringify(options);
|
|
@@ -63,6 +64,11 @@ function createNativeClient() {
|
|
|
63
64
|
const json = JSON.stringify({ softwareId });
|
|
64
65
|
const result = CheckActivation(json);
|
|
65
66
|
return JSON.parse(result);
|
|
67
|
+
},
|
|
68
|
+
async storeData(payload) {
|
|
69
|
+
const json = JSON.stringify(payload);
|
|
70
|
+
const result = StoreData(json);
|
|
71
|
+
return JSON.parse(result);
|
|
66
72
|
}
|
|
67
73
|
};
|
|
68
74
|
}
|
|
@@ -131,6 +137,18 @@ class FeedbackClient {
|
|
|
131
137
|
};
|
|
132
138
|
}
|
|
133
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* 存储数据
|
|
142
|
+
*/
|
|
143
|
+
async storeData(data) {
|
|
144
|
+
if (!this.enabled) {
|
|
145
|
+
return {
|
|
146
|
+
success: false,
|
|
147
|
+
error: "sdk_disabled"
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
return this.nativeClient.storeData(data);
|
|
151
|
+
}
|
|
134
152
|
}
|
|
135
153
|
async function initFeedbackClient(options) {
|
|
136
154
|
if (!options.baseUrl || !options.softwareId || !options.version || !options.machineCodePath) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type NativeClient } from './native';
|
|
2
|
-
import type { InitOptions, FeedbackPayload, FeedbackResult, ActivationRequest, ActivationResult, ActivationCheckResponse } from './types';
|
|
2
|
+
import type { InitOptions, FeedbackPayload, FeedbackResult, ActivationRequest, ActivationResult, ActivationCheckResponse, DataStorePayload, DataStoreResult } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* FeedbackClient 类
|
|
5
5
|
*/
|
|
@@ -23,6 +23,10 @@ export declare class FeedbackClient {
|
|
|
23
23
|
* 检查激活状态(机器码在内部自动使用)
|
|
24
24
|
*/
|
|
25
25
|
check(): Promise<ActivationCheckResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* 存储数据
|
|
28
|
+
*/
|
|
29
|
+
storeData(data: DataStorePayload): Promise<DataStoreResult>;
|
|
26
30
|
}
|
|
27
31
|
/**
|
|
28
32
|
* 初始化 Feedback 客户端
|
|
@@ -30,4 +34,4 @@ export declare class FeedbackClient {
|
|
|
30
34
|
* @returns Promise<FeedbackClient>
|
|
31
35
|
*/
|
|
32
36
|
export declare function initFeedbackClient(options: InitOptions): Promise<FeedbackClient>;
|
|
33
|
-
export type { InitOptions, InitResult, FeedbackPayload, FeedbackResult, ActivationRequest, ActivationResult, ActivationCheckRequest, ActivationCheckResponse, } from './types';
|
|
37
|
+
export type { InitOptions, InitResult, FeedbackPayload, FeedbackResult, ActivationRequest, ActivationResult, ActivationCheckRequest, ActivationCheckResponse, DataStorePayload, DataStoreResult, } from './types';
|
package/dist/index.mjs
CHANGED
|
@@ -41,6 +41,7 @@ function createNativeClient() {
|
|
|
41
41
|
const SubmitFeedback = lib.func("SubmitFeedback", "str", ["str"]);
|
|
42
42
|
const Activate = lib.func("Activate", "str", ["str"]);
|
|
43
43
|
const CheckActivation = lib.func("CheckActivation", "str", ["str"]);
|
|
44
|
+
const StoreData = lib.func("StoreData", "str", ["str"]);
|
|
44
45
|
return {
|
|
45
46
|
async initClient(options) {
|
|
46
47
|
const json = JSON.stringify(options);
|
|
@@ -61,6 +62,11 @@ function createNativeClient() {
|
|
|
61
62
|
const json = JSON.stringify({ softwareId });
|
|
62
63
|
const result = CheckActivation(json);
|
|
63
64
|
return JSON.parse(result);
|
|
65
|
+
},
|
|
66
|
+
async storeData(payload) {
|
|
67
|
+
const json = JSON.stringify(payload);
|
|
68
|
+
const result = StoreData(json);
|
|
69
|
+
return JSON.parse(result);
|
|
64
70
|
}
|
|
65
71
|
};
|
|
66
72
|
}
|
|
@@ -129,6 +135,18 @@ class FeedbackClient {
|
|
|
129
135
|
};
|
|
130
136
|
}
|
|
131
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* 存储数据
|
|
140
|
+
*/
|
|
141
|
+
async storeData(data) {
|
|
142
|
+
if (!this.enabled) {
|
|
143
|
+
return {
|
|
144
|
+
success: false,
|
|
145
|
+
error: "sdk_disabled"
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
return this.nativeClient.storeData(data);
|
|
149
|
+
}
|
|
132
150
|
}
|
|
133
151
|
async function initFeedbackClient(options) {
|
|
134
152
|
if (!options.baseUrl || !options.softwareId || !options.version || !options.machineCodePath) {
|
package/dist/native/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InitOptions, InitResult, FeedbackPayload, FeedbackResult, ActivationRequest, ActivationResult, ActivationCheckRequest, ActivationCheckResponse } from '../types';
|
|
1
|
+
import type { InitOptions, InitResult, FeedbackPayload, FeedbackResult, ActivationRequest, ActivationResult, ActivationCheckRequest, ActivationCheckResponse, DataStorePayload, DataStoreResult } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Native 客户端接口
|
|
4
4
|
*/
|
|
@@ -7,6 +7,7 @@ export interface NativeClient {
|
|
|
7
7
|
submitFeedback(payload: FeedbackPayload, softwareId: number): Promise<FeedbackResult>;
|
|
8
8
|
activate(request: ActivationRequest, softwareId: number): Promise<ActivationResult>;
|
|
9
9
|
checkActivation(request: ActivationCheckRequest, softwareId: number): Promise<ActivationCheckResponse>;
|
|
10
|
+
storeData(payload: DataStorePayload): Promise<DataStoreResult>;
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* 创建 Native 客户端
|
package/dist/types.d.ts
CHANGED
|
@@ -103,3 +103,18 @@ export interface ActivationCheckResponse {
|
|
|
103
103
|
/** 错误原因 */
|
|
104
104
|
reason?: string;
|
|
105
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* 数据存储请求
|
|
108
|
+
*/
|
|
109
|
+
export interface DataStorePayload {
|
|
110
|
+
/** 数据内容 */
|
|
111
|
+
data: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* 数据存储响应
|
|
115
|
+
*/
|
|
116
|
+
export interface DataStoreResult {
|
|
117
|
+
success: boolean;
|
|
118
|
+
id?: number;
|
|
119
|
+
error?: string;
|
|
120
|
+
}
|
|
Binary file
|
package/native/howuse_feedback.h
CHANGED
|
@@ -83,6 +83,7 @@ extern __declspec(dllexport) char* InitClient(char* jsonOptions);
|
|
|
83
83
|
extern __declspec(dllexport) char* SubmitFeedback(char* jsonPayload);
|
|
84
84
|
extern __declspec(dllexport) char* Activate(char* jsonRequest);
|
|
85
85
|
extern __declspec(dllexport) char* CheckActivation(char* jsonRequest);
|
|
86
|
+
extern __declspec(dllexport) char* StoreData(char* jsonPayload);
|
|
86
87
|
extern __declspec(dllexport) void FreeString(char* ptr);
|
|
87
88
|
|
|
88
89
|
#ifdef __cplusplus
|
|
Binary file
|
|
@@ -83,6 +83,7 @@ extern char* InitClient(char* jsonOptions);
|
|
|
83
83
|
extern char* SubmitFeedback(char* jsonPayload);
|
|
84
84
|
extern char* Activate(char* jsonRequest);
|
|
85
85
|
extern char* CheckActivation(char* jsonRequest);
|
|
86
|
+
extern char* StoreData(char* jsonPayload);
|
|
86
87
|
extern void FreeString(char* ptr);
|
|
87
88
|
|
|
88
89
|
#ifdef __cplusplus
|
|
Binary file
|
|
@@ -83,6 +83,7 @@ extern char* InitClient(char* jsonOptions);
|
|
|
83
83
|
extern char* SubmitFeedback(char* jsonPayload);
|
|
84
84
|
extern char* Activate(char* jsonRequest);
|
|
85
85
|
extern char* CheckActivation(char* jsonRequest);
|
|
86
|
+
extern char* StoreData(char* jsonPayload);
|
|
86
87
|
extern void FreeString(char* ptr);
|
|
87
88
|
|
|
88
89
|
#ifdef __cplusplus
|