@memberstack/dom 1.9.28 → 1.9.29
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/lib/auth/index.d.mts +9 -0
- package/lib/auth/index.d.ts +9 -0
- package/lib/auth/index.js +141 -0
- package/lib/auth/index.mjs +104 -0
- package/lib/constants/endpoints.d.mts +5 -0
- package/lib/constants/endpoints.d.ts +5 -0
- package/lib/constants/endpoints.js +31 -0
- package/lib/constants/endpoints.mjs +7 -0
- package/lib/index.d.mts +8 -578
- package/lib/index.d.ts +8 -578
- package/lib/methods/dom/index.d.mts +2 -0
- package/lib/methods/dom/index.d.ts +2 -0
- package/lib/methods/dom/index.js +0 -0
- package/lib/methods/dom/index.mjs +0 -0
- package/lib/methods/dom/main-dom.d.mts +14 -0
- package/lib/methods/dom/main-dom.d.ts +14 -0
- package/lib/methods/dom/main-dom.js +13766 -0
- package/lib/methods/dom/main-dom.mjs +13749 -0
- package/lib/methods/dom/methods.d.mts +12 -0
- package/lib/methods/dom/methods.d.ts +12 -0
- package/lib/methods/dom/methods.js +13972 -0
- package/lib/methods/dom/methods.mjs +13943 -0
- package/lib/methods/index.d.mts +79 -0
- package/lib/methods/index.d.ts +79 -0
- package/lib/methods/index.js +14861 -0
- package/lib/methods/index.mjs +14832 -0
- package/lib/methods/requests/index.d.mts +72 -0
- package/lib/methods/requests/index.d.ts +72 -0
- package/lib/methods/requests/index.js +912 -0
- package/lib/methods/requests/index.mjs +878 -0
- package/lib/methods/requests/requests.d.mts +31 -0
- package/lib/methods/requests/requests.d.ts +31 -0
- package/lib/methods/requests/requests.js +173 -0
- package/lib/methods/requests/requests.mjs +140 -0
- package/lib/types/index.d.mts +3 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/index.js +17 -0
- package/lib/types/index.mjs +0 -0
- package/lib/types/params.d.mts +206 -0
- package/lib/types/params.d.ts +206 -0
- package/lib/types/params.js +17 -0
- package/lib/types/params.mjs +0 -0
- package/lib/types/payloads.d.mts +64 -0
- package/lib/types/payloads.d.ts +64 -0
- package/lib/types/payloads.js +17 -0
- package/lib/types/payloads.mjs +0 -0
- package/lib/types/utils/payloads.d.mts +296 -0
- package/lib/types/utils/payloads.d.ts +296 -0
- package/lib/types/utils/payloads.js +17 -0
- package/lib/types/utils/payloads.mjs +0 -0
- package/lib/utils/cookies.d.mts +7 -0
- package/lib/utils/cookies.d.ts +7 -0
- package/lib/utils/cookies.js +120 -0
- package/lib/utils/cookies.mjs +85 -0
- package/lib/utils/defaultMessageBox.d.mts +5 -0
- package/lib/utils/defaultMessageBox.d.ts +5 -0
- package/lib/utils/defaultMessageBox.js +119 -0
- package/lib/utils/defaultMessageBox.mjs +93 -0
- package/package.json +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
declare enum HttpMethod {
|
|
2
|
+
POST = "POST",
|
|
3
|
+
GET = "GET",
|
|
4
|
+
PATCH = "PATCH",
|
|
5
|
+
DELETE = "DELETE"
|
|
6
|
+
}
|
|
7
|
+
declare enum HttpHeaders {
|
|
8
|
+
AUTHORIZATION = "Authorization",
|
|
9
|
+
API_KEY = "X-API-Key",
|
|
10
|
+
APP_ID = "X-APP-ID",
|
|
11
|
+
API_VERSION = "X-API-Version",
|
|
12
|
+
USER_AGENT = "X-User-Agent"
|
|
13
|
+
}
|
|
14
|
+
declare const createRequestHandler: ({ publicKey, appId, token, customEndpoint, }: {
|
|
15
|
+
publicKey: any;
|
|
16
|
+
appId: any;
|
|
17
|
+
token: any;
|
|
18
|
+
customEndpoint: any;
|
|
19
|
+
}) => {
|
|
20
|
+
sendRequest: (data: {
|
|
21
|
+
method: HttpMethod;
|
|
22
|
+
url: string;
|
|
23
|
+
data?: object;
|
|
24
|
+
headers?: object;
|
|
25
|
+
contentType?: string;
|
|
26
|
+
}, options?: {
|
|
27
|
+
token?: string;
|
|
28
|
+
}) => Promise<any>;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { HttpHeaders, HttpMethod, createRequestHandler };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
declare enum HttpMethod {
|
|
2
|
+
POST = "POST",
|
|
3
|
+
GET = "GET",
|
|
4
|
+
PATCH = "PATCH",
|
|
5
|
+
DELETE = "DELETE"
|
|
6
|
+
}
|
|
7
|
+
declare enum HttpHeaders {
|
|
8
|
+
AUTHORIZATION = "Authorization",
|
|
9
|
+
API_KEY = "X-API-Key",
|
|
10
|
+
APP_ID = "X-APP-ID",
|
|
11
|
+
API_VERSION = "X-API-Version",
|
|
12
|
+
USER_AGENT = "X-User-Agent"
|
|
13
|
+
}
|
|
14
|
+
declare const createRequestHandler: ({ publicKey, appId, token, customEndpoint, }: {
|
|
15
|
+
publicKey: any;
|
|
16
|
+
appId: any;
|
|
17
|
+
token: any;
|
|
18
|
+
customEndpoint: any;
|
|
19
|
+
}) => {
|
|
20
|
+
sendRequest: (data: {
|
|
21
|
+
method: HttpMethod;
|
|
22
|
+
url: string;
|
|
23
|
+
data?: object;
|
|
24
|
+
headers?: object;
|
|
25
|
+
contentType?: string;
|
|
26
|
+
}, options?: {
|
|
27
|
+
token?: string;
|
|
28
|
+
}) => Promise<any>;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { HttpHeaders, HttpMethod, createRequestHandler };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
37
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
38
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
39
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
40
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
41
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
42
|
+
mod
|
|
43
|
+
));
|
|
44
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
45
|
+
var __async = (__this, __arguments, generator) => {
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
var fulfilled = (value) => {
|
|
48
|
+
try {
|
|
49
|
+
step(generator.next(value));
|
|
50
|
+
} catch (e) {
|
|
51
|
+
reject(e);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var rejected = (value) => {
|
|
55
|
+
try {
|
|
56
|
+
step(generator.throw(value));
|
|
57
|
+
} catch (e) {
|
|
58
|
+
reject(e);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
62
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// src/methods/requests/requests.ts
|
|
67
|
+
var requests_exports = {};
|
|
68
|
+
__export(requests_exports, {
|
|
69
|
+
HttpHeaders: () => HttpHeaders,
|
|
70
|
+
HttpMethod: () => HttpMethod,
|
|
71
|
+
createRequestHandler: () => createRequestHandler
|
|
72
|
+
});
|
|
73
|
+
module.exports = __toCommonJS(requests_exports);
|
|
74
|
+
var import_axios = __toESM(require("axios"));
|
|
75
|
+
|
|
76
|
+
// src/constants/endpoints.ts
|
|
77
|
+
var endpoints = {
|
|
78
|
+
API: process.env.API_ENDPOINT
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// src/utils/cookies.ts
|
|
82
|
+
var import_js_cookie = __toESM(require("js-cookie"));
|
|
83
|
+
var memberAuthTokenName = "_ms-mid";
|
|
84
|
+
function isLocalStorageAvailable() {
|
|
85
|
+
try {
|
|
86
|
+
localStorage.setItem("test", "test");
|
|
87
|
+
localStorage.removeItem("test");
|
|
88
|
+
return true;
|
|
89
|
+
} catch (e) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
var localStorageAvailable = isLocalStorageAvailable();
|
|
94
|
+
var useCookies = false;
|
|
95
|
+
var getMemberToken = () => {
|
|
96
|
+
if (localStorageAvailable && !useCookies) {
|
|
97
|
+
const memAuthToken = localStorage.getItem(memberAuthTokenName);
|
|
98
|
+
if (memAuthToken)
|
|
99
|
+
return memAuthToken;
|
|
100
|
+
}
|
|
101
|
+
return import_js_cookie.default.get(memberAuthTokenName);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// src/methods/requests/requests.ts
|
|
105
|
+
var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
|
|
106
|
+
HttpMethod2["POST"] = "POST";
|
|
107
|
+
HttpMethod2["GET"] = "GET";
|
|
108
|
+
HttpMethod2["PATCH"] = "PATCH";
|
|
109
|
+
HttpMethod2["DELETE"] = "DELETE";
|
|
110
|
+
return HttpMethod2;
|
|
111
|
+
})(HttpMethod || {});
|
|
112
|
+
var HttpHeaders = /* @__PURE__ */ ((HttpHeaders2) => {
|
|
113
|
+
HttpHeaders2["AUTHORIZATION"] = "Authorization";
|
|
114
|
+
HttpHeaders2["API_KEY"] = "X-API-Key";
|
|
115
|
+
HttpHeaders2["APP_ID"] = "X-APP-ID";
|
|
116
|
+
HttpHeaders2["API_VERSION"] = "X-API-Version";
|
|
117
|
+
HttpHeaders2["USER_AGENT"] = "X-User-Agent";
|
|
118
|
+
return HttpHeaders2;
|
|
119
|
+
})(HttpHeaders || {});
|
|
120
|
+
var createRequestHandler = ({
|
|
121
|
+
publicKey,
|
|
122
|
+
appId,
|
|
123
|
+
token,
|
|
124
|
+
customEndpoint
|
|
125
|
+
}) => {
|
|
126
|
+
return {
|
|
127
|
+
sendRequest: (data, options) => __async(void 0, null, function* () {
|
|
128
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
129
|
+
try {
|
|
130
|
+
const { url } = data;
|
|
131
|
+
const memberToken = getMemberToken();
|
|
132
|
+
const authHeader = [
|
|
133
|
+
(_b = (_a = data.headers) == null ? void 0 : _a["Authorization"]) == null ? void 0 : _b.replace("Bearer ", ""),
|
|
134
|
+
memberToken,
|
|
135
|
+
options == null ? void 0 : options.token
|
|
136
|
+
].find((x) => x);
|
|
137
|
+
const formattedUrl = `${customEndpoint || endpoints.API}${url}`;
|
|
138
|
+
const res = yield (0, import_axios.default)({
|
|
139
|
+
method: data.method,
|
|
140
|
+
data: data.data,
|
|
141
|
+
url: formattedUrl,
|
|
142
|
+
headers: __spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, authHeader && { authorization: `Bearer ${authHeader}` }), publicKey && { ["X-API-Key" /* API_KEY */]: publicKey }), appId && { ["X-APP-ID" /* APP_ID */]: appId }), {
|
|
143
|
+
["X-User-Agent" /* USER_AGENT */]: "@memberstack/client@1.2.0"
|
|
144
|
+
}), data.contentType && { "Content-Type": data.contentType }),
|
|
145
|
+
withCredentials: true
|
|
146
|
+
});
|
|
147
|
+
if ((_c = res == null ? void 0 : res.headers) == null ? void 0 : _c["ms-mid"]) {
|
|
148
|
+
token = res.headers["ms-mid"];
|
|
149
|
+
}
|
|
150
|
+
if ((_d = res == null ? void 0 : res.data) == null ? void 0 : _d.error) {
|
|
151
|
+
if (res.data.error.name === "JsonWebTokenError") {
|
|
152
|
+
throw {
|
|
153
|
+
code: "client/invalid-token",
|
|
154
|
+
message: "An invalid token has been provided. Please make sure the token is valid."
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
throw (_e = res.data) == null ? void 0 : _e.error;
|
|
158
|
+
}
|
|
159
|
+
return res == null ? void 0 : res.data;
|
|
160
|
+
} catch (e) {
|
|
161
|
+
if (!e.response)
|
|
162
|
+
throw e;
|
|
163
|
+
throw ((_g = (_f = e.response) == null ? void 0 : _f.data) == null ? void 0 : _g.error) || ((_h = e.response) == null ? void 0 : _h.data);
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
169
|
+
0 && (module.exports = {
|
|
170
|
+
HttpHeaders,
|
|
171
|
+
HttpMethod,
|
|
172
|
+
createRequestHandler
|
|
173
|
+
});
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __async = (__this, __arguments, generator) => {
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
var fulfilled = (value) => {
|
|
23
|
+
try {
|
|
24
|
+
step(generator.next(value));
|
|
25
|
+
} catch (e) {
|
|
26
|
+
reject(e);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var rejected = (value) => {
|
|
30
|
+
try {
|
|
31
|
+
step(generator.throw(value));
|
|
32
|
+
} catch (e) {
|
|
33
|
+
reject(e);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
37
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// src/methods/requests/requests.ts
|
|
42
|
+
import axios from "axios";
|
|
43
|
+
|
|
44
|
+
// src/constants/endpoints.ts
|
|
45
|
+
var endpoints = {
|
|
46
|
+
API: process.env.API_ENDPOINT
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// src/utils/cookies.ts
|
|
50
|
+
import Cookie from "js-cookie";
|
|
51
|
+
var memberAuthTokenName = "_ms-mid";
|
|
52
|
+
function isLocalStorageAvailable() {
|
|
53
|
+
try {
|
|
54
|
+
localStorage.setItem("test", "test");
|
|
55
|
+
localStorage.removeItem("test");
|
|
56
|
+
return true;
|
|
57
|
+
} catch (e) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
var localStorageAvailable = isLocalStorageAvailable();
|
|
62
|
+
var useCookies = false;
|
|
63
|
+
var getMemberToken = () => {
|
|
64
|
+
if (localStorageAvailable && !useCookies) {
|
|
65
|
+
const memAuthToken = localStorage.getItem(memberAuthTokenName);
|
|
66
|
+
if (memAuthToken)
|
|
67
|
+
return memAuthToken;
|
|
68
|
+
}
|
|
69
|
+
return Cookie.get(memberAuthTokenName);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// src/methods/requests/requests.ts
|
|
73
|
+
var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
|
|
74
|
+
HttpMethod2["POST"] = "POST";
|
|
75
|
+
HttpMethod2["GET"] = "GET";
|
|
76
|
+
HttpMethod2["PATCH"] = "PATCH";
|
|
77
|
+
HttpMethod2["DELETE"] = "DELETE";
|
|
78
|
+
return HttpMethod2;
|
|
79
|
+
})(HttpMethod || {});
|
|
80
|
+
var HttpHeaders = /* @__PURE__ */ ((HttpHeaders2) => {
|
|
81
|
+
HttpHeaders2["AUTHORIZATION"] = "Authorization";
|
|
82
|
+
HttpHeaders2["API_KEY"] = "X-API-Key";
|
|
83
|
+
HttpHeaders2["APP_ID"] = "X-APP-ID";
|
|
84
|
+
HttpHeaders2["API_VERSION"] = "X-API-Version";
|
|
85
|
+
HttpHeaders2["USER_AGENT"] = "X-User-Agent";
|
|
86
|
+
return HttpHeaders2;
|
|
87
|
+
})(HttpHeaders || {});
|
|
88
|
+
var createRequestHandler = ({
|
|
89
|
+
publicKey,
|
|
90
|
+
appId,
|
|
91
|
+
token,
|
|
92
|
+
customEndpoint
|
|
93
|
+
}) => {
|
|
94
|
+
return {
|
|
95
|
+
sendRequest: (data, options) => __async(void 0, null, function* () {
|
|
96
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
97
|
+
try {
|
|
98
|
+
const { url } = data;
|
|
99
|
+
const memberToken = getMemberToken();
|
|
100
|
+
const authHeader = [
|
|
101
|
+
(_b = (_a = data.headers) == null ? void 0 : _a["Authorization"]) == null ? void 0 : _b.replace("Bearer ", ""),
|
|
102
|
+
memberToken,
|
|
103
|
+
options == null ? void 0 : options.token
|
|
104
|
+
].find((x) => x);
|
|
105
|
+
const formattedUrl = `${customEndpoint || endpoints.API}${url}`;
|
|
106
|
+
const res = yield axios({
|
|
107
|
+
method: data.method,
|
|
108
|
+
data: data.data,
|
|
109
|
+
url: formattedUrl,
|
|
110
|
+
headers: __spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, authHeader && { authorization: `Bearer ${authHeader}` }), publicKey && { ["X-API-Key" /* API_KEY */]: publicKey }), appId && { ["X-APP-ID" /* APP_ID */]: appId }), {
|
|
111
|
+
["X-User-Agent" /* USER_AGENT */]: "@memberstack/client@1.2.0"
|
|
112
|
+
}), data.contentType && { "Content-Type": data.contentType }),
|
|
113
|
+
withCredentials: true
|
|
114
|
+
});
|
|
115
|
+
if ((_c = res == null ? void 0 : res.headers) == null ? void 0 : _c["ms-mid"]) {
|
|
116
|
+
token = res.headers["ms-mid"];
|
|
117
|
+
}
|
|
118
|
+
if ((_d = res == null ? void 0 : res.data) == null ? void 0 : _d.error) {
|
|
119
|
+
if (res.data.error.name === "JsonWebTokenError") {
|
|
120
|
+
throw {
|
|
121
|
+
code: "client/invalid-token",
|
|
122
|
+
message: "An invalid token has been provided. Please make sure the token is valid."
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
throw (_e = res.data) == null ? void 0 : _e.error;
|
|
126
|
+
}
|
|
127
|
+
return res == null ? void 0 : res.data;
|
|
128
|
+
} catch (e) {
|
|
129
|
+
if (!e.response)
|
|
130
|
+
throw e;
|
|
131
|
+
throw ((_g = (_f = e.response) == null ? void 0 : _f.data) == null ? void 0 : _g.error) || ((_h = e.response) == null ? void 0 : _h.data);
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
export {
|
|
137
|
+
HttpHeaders,
|
|
138
|
+
HttpMethod,
|
|
139
|
+
createRequestHandler
|
|
140
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { AddMemberCardParams, AddPlanParams, CancelPlanParams, CreatePostParams, CreateThreadParams, DeletePostParams, DeleteThreadParams, GetAuthenticationClientSecretParams, GetMemberInvoicesParams, GetMemberPurchasesParams, GetMemberReceiptsParams, GetPlanParams, GetPlansParams, GetPostsParams, GetSecureContentParams, GetThreadsParams, GetTotalCheckoutAmountParams, LaunchStripeCustomerPortalParams, LoginMemberEmailPasswordParams, LoginMemberPasswordlessParams, LoginWithProviderParams, OpenStripeCustomerPortalParams, PostVoteParams, PurchasePlansParams, PurchasePlansWithCheckoutParams, RemovePlanParams, ReplacePlanParams, ResetMemberPasswordParams, SendMemberLoginPasswordlessEmailParams, SendMemberResetPasswordEmailParams, SetPasswordParams, SignupMemberAuthProviderParams, SignupMemberEmailPasswordParams, SignupWithProviderParams, ThreadVoteParams, UpdateDefaultCardParams, UpdateMemberAuthParams, UpdateMemberJSONParams, UpdateMemberParams, UpdateMemberProfileImageParams, UpdatePlanPaymentParams, UpdatePostParams, UpdateThreadParams } from './params.mjs';
|
|
2
|
+
export { AddMemberCardPayload, AddPlanPayload, AppPayload, CancelPlanPayload, ConnectProviderPayload, CreatePostPayload, CreateThreadPayload, GetAppAndMemberPayload, GetAuthProvidersPayload, GetAuthenticationClientSecretPayload, GetCurrentMemberPayload, GetMemberCardsPayload, GetMemberInvoicesPayload, GetMemberJSONPayload, GetMemberReceiptsPayload, GetPlanPayload, GetPlansPayload, GetPostsPayload, GetRestrictedUrlGroupsPayload, GetSecureContentPayload, GetThreadsPayload, GetTotalCheckoutAmountPayload, LaunchStripeCustomerPortalPayload, LoginMemberEmailPasswordPayload, LogoutMemberPayload, OpenStripeCustomerPortalPayload, PurchasePlansPayload, PurchasePlansWithCheckoutPayload, RefreshMemberTokensPayload, RemovePlanPayload, ReplacePlanPayload, ResetMemberPassworPayload, SendMemberLoginPasswordlessEmailPayload, SendMemberResetPasswordEmailPayload, SendMemberVerificationEmailPayload, SetPasswordPayload, SignupMemberAuthProviderPayload, SignupMemberEmailPasswordPayload, UpdateDefaultCardPayload, UpdateMemberAuthPayload, UpdateMemberPayload, UpdateMemberProfileImagePayload, UpdatePlanPaymentPayload, UpdatePostPayload, UpdateThreadPayload } from './payloads.mjs';
|
|
3
|
+
import './utils/payloads.mjs';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { AddMemberCardParams, AddPlanParams, CancelPlanParams, CreatePostParams, CreateThreadParams, DeletePostParams, DeleteThreadParams, GetAuthenticationClientSecretParams, GetMemberInvoicesParams, GetMemberPurchasesParams, GetMemberReceiptsParams, GetPlanParams, GetPlansParams, GetPostsParams, GetSecureContentParams, GetThreadsParams, GetTotalCheckoutAmountParams, LaunchStripeCustomerPortalParams, LoginMemberEmailPasswordParams, LoginMemberPasswordlessParams, LoginWithProviderParams, OpenStripeCustomerPortalParams, PostVoteParams, PurchasePlansParams, PurchasePlansWithCheckoutParams, RemovePlanParams, ReplacePlanParams, ResetMemberPasswordParams, SendMemberLoginPasswordlessEmailParams, SendMemberResetPasswordEmailParams, SetPasswordParams, SignupMemberAuthProviderParams, SignupMemberEmailPasswordParams, SignupWithProviderParams, ThreadVoteParams, UpdateDefaultCardParams, UpdateMemberAuthParams, UpdateMemberJSONParams, UpdateMemberParams, UpdateMemberProfileImageParams, UpdatePlanPaymentParams, UpdatePostParams, UpdateThreadParams } from './params.js';
|
|
2
|
+
export { AddMemberCardPayload, AddPlanPayload, AppPayload, CancelPlanPayload, ConnectProviderPayload, CreatePostPayload, CreateThreadPayload, GetAppAndMemberPayload, GetAuthProvidersPayload, GetAuthenticationClientSecretPayload, GetCurrentMemberPayload, GetMemberCardsPayload, GetMemberInvoicesPayload, GetMemberJSONPayload, GetMemberReceiptsPayload, GetPlanPayload, GetPlansPayload, GetPostsPayload, GetRestrictedUrlGroupsPayload, GetSecureContentPayload, GetThreadsPayload, GetTotalCheckoutAmountPayload, LaunchStripeCustomerPortalPayload, LoginMemberEmailPasswordPayload, LogoutMemberPayload, OpenStripeCustomerPortalPayload, PurchasePlansPayload, PurchasePlansWithCheckoutPayload, RefreshMemberTokensPayload, RemovePlanPayload, ReplacePlanPayload, ResetMemberPassworPayload, SendMemberLoginPasswordlessEmailPayload, SendMemberResetPasswordEmailPayload, SendMemberVerificationEmailPayload, SetPasswordPayload, SignupMemberAuthProviderPayload, SignupMemberEmailPasswordPayload, UpdateDefaultCardPayload, UpdateMemberAuthPayload, UpdateMemberPayload, UpdateMemberProfileImagePayload, UpdatePlanPaymentPayload, UpdatePostPayload, UpdateThreadPayload } from './payloads.js';
|
|
3
|
+
import './utils/payloads.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/types/index.ts
|
|
16
|
+
var types_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
|
File without changes
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
type SignupMemberEmailPasswordParams = {
|
|
2
|
+
email: string;
|
|
3
|
+
password: string;
|
|
4
|
+
customFields?: Record<string, any>;
|
|
5
|
+
metaData?: Record<string, any>;
|
|
6
|
+
plans?: {
|
|
7
|
+
planId: string;
|
|
8
|
+
}[];
|
|
9
|
+
captchaToken?: string;
|
|
10
|
+
};
|
|
11
|
+
type GetPostsParams = {
|
|
12
|
+
channelKey: string;
|
|
13
|
+
order?: "newest" | "oldest";
|
|
14
|
+
after?: string;
|
|
15
|
+
limit?: number;
|
|
16
|
+
};
|
|
17
|
+
type GetThreadsParams = {
|
|
18
|
+
postId: string;
|
|
19
|
+
order?: "newest" | "oldest";
|
|
20
|
+
after?: string;
|
|
21
|
+
limit?: number;
|
|
22
|
+
};
|
|
23
|
+
type CreatePostParams = {
|
|
24
|
+
channelKey: string;
|
|
25
|
+
content: string;
|
|
26
|
+
};
|
|
27
|
+
type UpdatePostParams = {
|
|
28
|
+
postId: string;
|
|
29
|
+
content: string;
|
|
30
|
+
};
|
|
31
|
+
type DeletePostParams = {
|
|
32
|
+
postId: string;
|
|
33
|
+
};
|
|
34
|
+
type PostVoteParams = {
|
|
35
|
+
postId: string;
|
|
36
|
+
vote: "UP" | "DOWN" | "NONE";
|
|
37
|
+
};
|
|
38
|
+
type ThreadVoteParams = {
|
|
39
|
+
threadId: string;
|
|
40
|
+
vote: "UP" | "DOWN" | "NONE";
|
|
41
|
+
};
|
|
42
|
+
type CreateThreadParams = {
|
|
43
|
+
postId: string;
|
|
44
|
+
content: string;
|
|
45
|
+
};
|
|
46
|
+
type UpdateThreadParams = {
|
|
47
|
+
threadId: string;
|
|
48
|
+
content: string;
|
|
49
|
+
};
|
|
50
|
+
type DeleteThreadParams = {
|
|
51
|
+
threadId: string;
|
|
52
|
+
};
|
|
53
|
+
type UpdateMemberProfileImageParams = {
|
|
54
|
+
profileImage: File;
|
|
55
|
+
};
|
|
56
|
+
type GetSecureContentParams = {
|
|
57
|
+
contentId: string;
|
|
58
|
+
};
|
|
59
|
+
type SetPasswordParams = {
|
|
60
|
+
password: string;
|
|
61
|
+
};
|
|
62
|
+
type SignupWithProviderParams = {
|
|
63
|
+
provider: string;
|
|
64
|
+
customFields?: Record<string, any>;
|
|
65
|
+
plans?: {
|
|
66
|
+
planId: string;
|
|
67
|
+
}[];
|
|
68
|
+
};
|
|
69
|
+
type LoginWithProviderParams = {
|
|
70
|
+
provider: string;
|
|
71
|
+
};
|
|
72
|
+
type LoginMemberPasswordlessParams = {
|
|
73
|
+
passwordlessToken: string;
|
|
74
|
+
email: string;
|
|
75
|
+
};
|
|
76
|
+
type SendMemberLoginPasswordlessEmailParams = {
|
|
77
|
+
email: string;
|
|
78
|
+
};
|
|
79
|
+
type SignupMemberAuthProviderParams = {
|
|
80
|
+
code: string;
|
|
81
|
+
provider: "GOOGLE" | "FACEBOOK";
|
|
82
|
+
planId?: string;
|
|
83
|
+
customFields?: Record<string, any>;
|
|
84
|
+
metaData?: Record<string, any>;
|
|
85
|
+
plans?: {
|
|
86
|
+
planId: string;
|
|
87
|
+
}[];
|
|
88
|
+
payment?: {
|
|
89
|
+
stripe?: {
|
|
90
|
+
paymentMethodId: string;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
type LoginMemberEmailPasswordParams = {
|
|
95
|
+
email: string;
|
|
96
|
+
password: string;
|
|
97
|
+
};
|
|
98
|
+
type UpdateMemberParams = {
|
|
99
|
+
customFields?: Record<string, any>;
|
|
100
|
+
};
|
|
101
|
+
type UpdateMemberAuthParams = {
|
|
102
|
+
email?: string;
|
|
103
|
+
oldPassword?: string;
|
|
104
|
+
newPassword?: string;
|
|
105
|
+
};
|
|
106
|
+
type PurchasePlansParams = {
|
|
107
|
+
plans: {
|
|
108
|
+
planId: string;
|
|
109
|
+
priceId?: string;
|
|
110
|
+
}[];
|
|
111
|
+
payment: {
|
|
112
|
+
cardId?: string;
|
|
113
|
+
stripe?: {
|
|
114
|
+
paymentMethodId: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
type AddPlanParams = {
|
|
119
|
+
planId: string;
|
|
120
|
+
};
|
|
121
|
+
type PurchasePlansWithCheckoutParams = {
|
|
122
|
+
priceId: string;
|
|
123
|
+
couponId?: string;
|
|
124
|
+
cancelUrl?: string;
|
|
125
|
+
successUrl?: string;
|
|
126
|
+
autoRedirect?: boolean;
|
|
127
|
+
};
|
|
128
|
+
type LaunchStripeCustomerPortalParams = {
|
|
129
|
+
priceIds?: string[];
|
|
130
|
+
configuration?: object;
|
|
131
|
+
returnUrl?: string;
|
|
132
|
+
autoRedirect?: boolean;
|
|
133
|
+
};
|
|
134
|
+
type OpenStripeCustomerPortalParams = {
|
|
135
|
+
configuration?: object;
|
|
136
|
+
returnUrl?: string;
|
|
137
|
+
autoRedirect?: boolean;
|
|
138
|
+
};
|
|
139
|
+
type RemovePlanParams = {
|
|
140
|
+
planId: string;
|
|
141
|
+
};
|
|
142
|
+
type CancelPlanParams = {
|
|
143
|
+
planConnectionId: string;
|
|
144
|
+
};
|
|
145
|
+
type AddMemberCardParams = {
|
|
146
|
+
stripePaymentMethodId: string;
|
|
147
|
+
default?: boolean;
|
|
148
|
+
};
|
|
149
|
+
type UpdateDefaultCardParams = {
|
|
150
|
+
cardId: string;
|
|
151
|
+
};
|
|
152
|
+
type UpdatePlanPaymentParams = {
|
|
153
|
+
planConnectionId: string;
|
|
154
|
+
cardId: string;
|
|
155
|
+
};
|
|
156
|
+
type GetMemberReceiptsParams = {
|
|
157
|
+
first?: number;
|
|
158
|
+
after?: string;
|
|
159
|
+
order?: "ASC" | "DESC";
|
|
160
|
+
};
|
|
161
|
+
type GetMemberInvoicesParams = {
|
|
162
|
+
first?: number;
|
|
163
|
+
after?: string;
|
|
164
|
+
order?: "ASC" | "DESC";
|
|
165
|
+
};
|
|
166
|
+
type UpdateMemberJSONParams = {
|
|
167
|
+
json: object;
|
|
168
|
+
};
|
|
169
|
+
type GetMemberPurchasesParams = {
|
|
170
|
+
expandPlan?: boolean;
|
|
171
|
+
expandPrice?: boolean;
|
|
172
|
+
expandCard?: boolean;
|
|
173
|
+
expandSubscription?: boolean;
|
|
174
|
+
};
|
|
175
|
+
type GetPlanParams = {
|
|
176
|
+
planId: string;
|
|
177
|
+
};
|
|
178
|
+
type GetPlansParams = {
|
|
179
|
+
status?: "ALL" | "ACTIVE" | "INACTIVE";
|
|
180
|
+
};
|
|
181
|
+
type SendMemberResetPasswordEmailParams = {
|
|
182
|
+
email: string;
|
|
183
|
+
};
|
|
184
|
+
type ResetMemberPasswordParams = {
|
|
185
|
+
token: string;
|
|
186
|
+
newPassword: string;
|
|
187
|
+
};
|
|
188
|
+
type ReplacePlanParams = {
|
|
189
|
+
planConnectionId: string;
|
|
190
|
+
newPlanId?: string;
|
|
191
|
+
priceId?: string;
|
|
192
|
+
payment?: {
|
|
193
|
+
cardId?: string;
|
|
194
|
+
stripe?: {
|
|
195
|
+
paymentMethodId: string;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
type GetAuthenticationClientSecretParams = {
|
|
200
|
+
planConnectionId: string;
|
|
201
|
+
};
|
|
202
|
+
type GetTotalCheckoutAmountParams = {
|
|
203
|
+
priceIds: string[];
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export { AddMemberCardParams, AddPlanParams, CancelPlanParams, CreatePostParams, CreateThreadParams, DeletePostParams, DeleteThreadParams, GetAuthenticationClientSecretParams, GetMemberInvoicesParams, GetMemberPurchasesParams, GetMemberReceiptsParams, GetPlanParams, GetPlansParams, GetPostsParams, GetSecureContentParams, GetThreadsParams, GetTotalCheckoutAmountParams, LaunchStripeCustomerPortalParams, LoginMemberEmailPasswordParams, LoginMemberPasswordlessParams, LoginWithProviderParams, OpenStripeCustomerPortalParams, PostVoteParams, PurchasePlansParams, PurchasePlansWithCheckoutParams, RemovePlanParams, ReplacePlanParams, ResetMemberPasswordParams, SendMemberLoginPasswordlessEmailParams, SendMemberResetPasswordEmailParams, SetPasswordParams, SignupMemberAuthProviderParams, SignupMemberEmailPasswordParams, SignupWithProviderParams, ThreadVoteParams, UpdateDefaultCardParams, UpdateMemberAuthParams, UpdateMemberJSONParams, UpdateMemberParams, UpdateMemberProfileImageParams, UpdatePlanPaymentParams, UpdatePostParams, UpdateThreadParams };
|