arky-sdk 0.9.12 → 0.9.16
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 +16 -12
- package/dist/admin-C-ZTxvz3.d.ts +1544 -0
- package/dist/admin-Dm2WRN6q.d.cts +1544 -0
- package/dist/admin.cjs +980 -433
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.d.cts +3 -3
- package/dist/admin.d.ts +3 -3
- package/dist/admin.js +980 -433
- package/dist/admin.js.map +1 -1
- package/dist/{api-D4lMmvF0.d.cts → api-D37IpMSq.d.cts} +1415 -671
- package/dist/{api-D4lMmvF0.d.ts → api-D37IpMSq.d.ts} +1415 -671
- package/dist/index.cjs +1315 -547
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1315 -547
- package/dist/index.js.map +1 -1
- package/dist/{index-Be8suRwP.d.ts → inventory-DdN96PX3.d.cts} +6 -4
- package/dist/{index-BS2x278C.d.cts → inventory-Dh1RevEb.d.ts} +6 -4
- package/dist/storefront.cjs +1210 -658
- package/dist/storefront.cjs.map +1 -1
- package/dist/storefront.d.cts +88 -285
- package/dist/storefront.d.ts +88 -285
- package/dist/storefront.js +1207 -659
- package/dist/storefront.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.cjs +198 -16
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +18 -2
- package/dist/utils.d.ts +18 -2
- package/dist/utils.js +191 -17
- package/dist/utils.js.map +1 -1
- package/package.json +4 -5
- package/dist/admin-D8HiRDCl.d.cts +0 -1536
- package/dist/admin-Dnnv18wN.d.ts +0 -1536
- package/scripts/contract-admin.mjs +0 -137
- package/scripts/contract-storefront.mjs +0 -296
package/dist/admin.cjs
CHANGED
|
@@ -1,29 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// src/utils/orderItems.ts
|
|
4
|
-
function normalizeOrderQuoteItems(items) {
|
|
5
|
-
return items.map((item) => {
|
|
6
|
-
if ("type" in item) {
|
|
7
|
-
return item;
|
|
8
|
-
}
|
|
9
|
-
if ("product_id" in item) {
|
|
10
|
-
return { type: "product", ...item };
|
|
11
|
-
}
|
|
12
|
-
return { type: "service", ...item };
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
function normalizeOrderCheckoutItems(items) {
|
|
16
|
-
return items.map((item) => {
|
|
17
|
-
if ("type" in item) {
|
|
18
|
-
return item;
|
|
19
|
-
}
|
|
20
|
-
if ("product_id" in item) {
|
|
21
|
-
return { type: "product", ...item };
|
|
22
|
-
}
|
|
23
|
-
return { type: "service", ...item };
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
3
|
// src/utils/errors.ts
|
|
28
4
|
var convertServerErrorToRequestError = (serverError, renameRules) => {
|
|
29
5
|
const validationErrors = serverError?.validationErrors ?? [];
|
|
@@ -41,27 +17,47 @@ var convertServerErrorToRequestError = (serverError, renameRules) => {
|
|
|
41
17
|
|
|
42
18
|
// src/utils/queryParams.ts
|
|
43
19
|
function buildQueryString(params) {
|
|
44
|
-
const queryParts =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const jsonString = JSON.stringify(value);
|
|
58
|
-
queryParts.push(`${key}=${encodeURIComponent(jsonString)}`);
|
|
20
|
+
const queryParts = Object.entries(params).flatMap(
|
|
21
|
+
([key, value]) => {
|
|
22
|
+
if (value === null || value === void 0) return [];
|
|
23
|
+
if (typeof value === "string") {
|
|
24
|
+
return [`${key}=${encodeURIComponent(value)}`];
|
|
25
|
+
}
|
|
26
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
27
|
+
return [`${key}=${value}`];
|
|
28
|
+
}
|
|
29
|
+
if (Array.isArray(value) || typeof value === "object") {
|
|
30
|
+
return [`${key}=${encodeURIComponent(JSON.stringify(value))}`];
|
|
31
|
+
}
|
|
32
|
+
return [];
|
|
59
33
|
}
|
|
60
|
-
|
|
34
|
+
);
|
|
61
35
|
return queryParts.length > 0 ? `?${queryParts.join("&")}` : "";
|
|
62
36
|
}
|
|
63
37
|
|
|
64
38
|
// src/services/createHttpClient.ts
|
|
39
|
+
function requestError(name, message, details = {}) {
|
|
40
|
+
return Object.assign(new Error(message), { name }, details);
|
|
41
|
+
}
|
|
42
|
+
function isRecord(value) {
|
|
43
|
+
return typeof value === "object" && value !== null;
|
|
44
|
+
}
|
|
45
|
+
function isTokenSet(value) {
|
|
46
|
+
return isRecord(value) && typeof value.access_token === "string" && (value.refresh_token === void 0 || typeof value.refresh_token === "string") && (value.access_expires_at === void 0 || typeof value.access_expires_at === "number");
|
|
47
|
+
}
|
|
48
|
+
function isValidationError(value) {
|
|
49
|
+
return isRecord(value) && typeof value.field === "string" && typeof value.error === "string";
|
|
50
|
+
}
|
|
51
|
+
function toServerError(value, statusCode) {
|
|
52
|
+
const payload = isRecord(value) ? value : {};
|
|
53
|
+
const validationErrors = Array.isArray(payload.validationErrors) ? payload.validationErrors.filter(isValidationError) : [];
|
|
54
|
+
return {
|
|
55
|
+
message: typeof payload.message === "string" ? payload.message : "Request failed",
|
|
56
|
+
error: typeof payload.error === "string" ? payload.error : "REQUEST_FAILED",
|
|
57
|
+
statusCode: typeof payload.statusCode === "number" ? payload.statusCode : statusCode,
|
|
58
|
+
validationErrors
|
|
59
|
+
};
|
|
60
|
+
}
|
|
65
61
|
function createHttpClient(cfg) {
|
|
66
62
|
const { authStorage } = cfg;
|
|
67
63
|
let refreshPromise = null;
|
|
@@ -78,32 +74,41 @@ function createHttpClient(cfg) {
|
|
|
78
74
|
const refresh_token = tokens?.refresh_token;
|
|
79
75
|
if (!refresh_token) {
|
|
80
76
|
authStorage.onForcedLogout();
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
throw err;
|
|
77
|
+
throw requestError("ApiError", "No refresh token available", {
|
|
78
|
+
statusCode: 401
|
|
79
|
+
});
|
|
85
80
|
}
|
|
86
81
|
const refRes = await fetch(getRefreshEndpoint(), {
|
|
87
82
|
method: "POST",
|
|
88
|
-
headers: {
|
|
83
|
+
headers: {
|
|
84
|
+
Accept: "application/json",
|
|
85
|
+
"Content-Type": "application/json"
|
|
86
|
+
},
|
|
89
87
|
body: JSON.stringify({ refresh_token })
|
|
90
88
|
});
|
|
91
89
|
if (!refRes.ok) {
|
|
92
90
|
authStorage.onForcedLogout();
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
throw err;
|
|
91
|
+
throw requestError("ApiError", "Token refresh failed", {
|
|
92
|
+
statusCode: 401
|
|
93
|
+
});
|
|
97
94
|
}
|
|
98
95
|
const data = await refRes.json();
|
|
96
|
+
if (!isTokenSet(data)) {
|
|
97
|
+
authStorage.onForcedLogout();
|
|
98
|
+
throw requestError(
|
|
99
|
+
"ParseError",
|
|
100
|
+
"Token refresh returned an invalid response",
|
|
101
|
+
{ statusCode: refRes.status }
|
|
102
|
+
);
|
|
103
|
+
}
|
|
99
104
|
authStorage.onTokensRefreshed(data);
|
|
100
105
|
})().finally(() => {
|
|
101
106
|
refreshPromise = null;
|
|
102
107
|
});
|
|
103
108
|
return refreshPromise;
|
|
104
109
|
}
|
|
105
|
-
async function request(method, path, body, options) {
|
|
106
|
-
if (options?.transformRequest) {
|
|
110
|
+
async function request(method, path, body, options, retried = false) {
|
|
111
|
+
if (!retried && options?.transformRequest) {
|
|
107
112
|
body = options.transformRequest(body);
|
|
108
113
|
}
|
|
109
114
|
const headers = {
|
|
@@ -121,23 +126,27 @@ function createHttpClient(cfg) {
|
|
|
121
126
|
headers["Authorization"] = `Bearer ${tokens.access_token}`;
|
|
122
127
|
}
|
|
123
128
|
const finalPath = options?.params ? path + buildQueryString(options.params) : path;
|
|
124
|
-
const
|
|
129
|
+
const fetchOptions = {
|
|
130
|
+
method,
|
|
131
|
+
headers,
|
|
132
|
+
signal: options?.signal
|
|
133
|
+
};
|
|
125
134
|
if (!["GET", "DELETE"].includes(method) && body !== void 0) {
|
|
126
|
-
|
|
135
|
+
fetchOptions.body = body instanceof URLSearchParams ? body.toString() : JSON.stringify(body);
|
|
127
136
|
}
|
|
128
137
|
const fullUrl = `${cfg.baseUrl}${finalPath}`;
|
|
129
138
|
let res;
|
|
130
139
|
let data;
|
|
131
140
|
const startedAt = Date.now();
|
|
132
141
|
try {
|
|
133
|
-
res = await fetch(fullUrl,
|
|
142
|
+
res = await fetch(fullUrl, fetchOptions);
|
|
134
143
|
} catch (error) {
|
|
135
144
|
const aborted = options?.signal?.aborted || error instanceof Error && error.name === "AbortError";
|
|
136
|
-
const err =
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
145
|
+
const err = requestError(
|
|
146
|
+
aborted ? "AbortError" : "NetworkError",
|
|
147
|
+
error instanceof Error ? error.message : "Network request failed",
|
|
148
|
+
{ method, url: fullUrl, aborted }
|
|
149
|
+
);
|
|
141
150
|
if (options?.onError && method !== "GET") {
|
|
142
151
|
Promise.resolve(
|
|
143
152
|
options.onError({ error: err, method, url: fullUrl, aborted })
|
|
@@ -146,18 +155,9 @@ function createHttpClient(cfg) {
|
|
|
146
155
|
}
|
|
147
156
|
throw err;
|
|
148
157
|
}
|
|
149
|
-
if (res.status === 401 && !
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const refreshed = authStorage.getTokens();
|
|
153
|
-
if (refreshed?.access_token) {
|
|
154
|
-
headers["Authorization"] = `Bearer ${refreshed.access_token}`;
|
|
155
|
-
fetchOpts.headers = headers;
|
|
156
|
-
}
|
|
157
|
-
return request(method, path, body, { ...options, _retried: true });
|
|
158
|
-
} catch (refreshError) {
|
|
159
|
-
throw refreshError;
|
|
160
|
-
}
|
|
158
|
+
if (res.status === 401 && !retried) {
|
|
159
|
+
await ensureFreshToken();
|
|
160
|
+
return request(method, path, body, options, true);
|
|
161
161
|
}
|
|
162
162
|
try {
|
|
163
163
|
const contentLength = res.headers.get("content-length");
|
|
@@ -168,30 +168,35 @@ function createHttpClient(cfg) {
|
|
|
168
168
|
data = await res.json();
|
|
169
169
|
}
|
|
170
170
|
} catch (error) {
|
|
171
|
-
const err =
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
171
|
+
const err = requestError("ParseError", "Failed to parse response", {
|
|
172
|
+
method,
|
|
173
|
+
url: fullUrl,
|
|
174
|
+
statusCode: res.status
|
|
175
|
+
});
|
|
176
176
|
if (options?.onError && method !== "GET") {
|
|
177
177
|
Promise.resolve(
|
|
178
|
-
options.onError({
|
|
178
|
+
options.onError({
|
|
179
|
+
error: err,
|
|
180
|
+
method,
|
|
181
|
+
url: fullUrl,
|
|
182
|
+
status: res.status
|
|
183
|
+
})
|
|
179
184
|
).catch(() => {
|
|
180
185
|
});
|
|
181
186
|
}
|
|
182
187
|
throw err;
|
|
183
188
|
}
|
|
184
189
|
if (!res.ok) {
|
|
185
|
-
const serverErr = data;
|
|
190
|
+
const serverErr = toServerError(data, res.status);
|
|
186
191
|
const reqErr = convertServerErrorToRequestError(serverErr);
|
|
187
|
-
const err = new Error(serverErr.message || "Request failed");
|
|
188
|
-
err.name = "ApiError";
|
|
189
|
-
err.statusCode = serverErr.statusCode || res.status;
|
|
190
|
-
err.validationErrors = reqErr.validationErrors;
|
|
191
|
-
err.method = method;
|
|
192
|
-
err.url = fullUrl;
|
|
193
192
|
const requestId = res.headers.get("x-request-id") || res.headers.get("request-id");
|
|
194
|
-
|
|
193
|
+
const err = requestError("ApiError", serverErr.message, {
|
|
194
|
+
statusCode: serverErr.statusCode,
|
|
195
|
+
validationErrors: reqErr.validationErrors,
|
|
196
|
+
method,
|
|
197
|
+
url: fullUrl,
|
|
198
|
+
requestId: requestId || void 0
|
|
199
|
+
});
|
|
195
200
|
if (options?.onError && method !== "GET") {
|
|
196
201
|
Promise.resolve(
|
|
197
202
|
options.onError({
|
|
@@ -234,35 +239,73 @@ function createHttpClient(cfg) {
|
|
|
234
239
|
}
|
|
235
240
|
|
|
236
241
|
// src/api/account.ts
|
|
237
|
-
var createAccountApi = (apiConfig) => {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
242
|
+
var createAccountApi = (apiConfig) => ({
|
|
243
|
+
async updateAccount(_params, options) {
|
|
244
|
+
return apiConfig.httpClient.put(
|
|
245
|
+
"/v1/accounts",
|
|
246
|
+
{},
|
|
247
|
+
options
|
|
248
|
+
);
|
|
249
|
+
},
|
|
250
|
+
async deleteAccount(_params, options) {
|
|
251
|
+
return apiConfig.httpClient.delete(
|
|
252
|
+
"/v1/accounts",
|
|
253
|
+
options
|
|
254
|
+
);
|
|
255
|
+
},
|
|
256
|
+
async getMe(_params, options) {
|
|
257
|
+
return apiConfig.httpClient.get("/v1/accounts/me", options);
|
|
258
|
+
},
|
|
259
|
+
async searchAccounts(params, options) {
|
|
260
|
+
return apiConfig.httpClient.get(
|
|
261
|
+
"/v1/accounts/search",
|
|
262
|
+
{ ...options, params }
|
|
263
|
+
);
|
|
264
|
+
},
|
|
265
|
+
async listApiTokens(options) {
|
|
266
|
+
return apiConfig.httpClient.get(
|
|
267
|
+
"/v1/accounts/me/api-tokens",
|
|
268
|
+
options
|
|
269
|
+
);
|
|
270
|
+
},
|
|
271
|
+
async createApiToken(params, options) {
|
|
272
|
+
return apiConfig.httpClient.post(
|
|
273
|
+
"/v1/accounts/me/api-tokens",
|
|
274
|
+
params,
|
|
275
|
+
options
|
|
276
|
+
);
|
|
277
|
+
},
|
|
278
|
+
async updateApiToken(params, options) {
|
|
279
|
+
const { id, ...payload } = params;
|
|
280
|
+
return apiConfig.httpClient.put(
|
|
281
|
+
`/v1/accounts/me/api-tokens/${id}`,
|
|
282
|
+
payload,
|
|
283
|
+
options
|
|
284
|
+
);
|
|
285
|
+
},
|
|
286
|
+
async revokeApiToken(id, options) {
|
|
287
|
+
return apiConfig.httpClient.delete(
|
|
288
|
+
`/v1/accounts/me/api-tokens/${id}`,
|
|
289
|
+
options
|
|
290
|
+
);
|
|
291
|
+
},
|
|
292
|
+
async listSessions(options) {
|
|
293
|
+
return apiConfig.httpClient.get(
|
|
294
|
+
"/v1/accounts/me/sessions",
|
|
295
|
+
options
|
|
296
|
+
);
|
|
297
|
+
},
|
|
298
|
+
async revokeSession(id, options) {
|
|
299
|
+
return apiConfig.httpClient.delete(
|
|
300
|
+
`/v1/accounts/me/sessions/${id}`,
|
|
301
|
+
options
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
});
|
|
263
305
|
|
|
264
306
|
// src/api/auth.ts
|
|
265
307
|
var createAuthApi = (apiConfig, updateSession) => {
|
|
308
|
+
const pendingEmails = /* @__PURE__ */ new Map();
|
|
266
309
|
function applyAuthToken(result, email) {
|
|
267
310
|
const next = {
|
|
268
311
|
access_token: result.access_token,
|
|
@@ -274,7 +317,9 @@ var createAuthApi = (apiConfig, updateSession) => {
|
|
|
274
317
|
}
|
|
275
318
|
return {
|
|
276
319
|
async code(params, options) {
|
|
277
|
-
|
|
320
|
+
const result = await apiConfig.httpClient.post("/v1/auth/code", params, options);
|
|
321
|
+
pendingEmails.set(result.challenge_id, params.email);
|
|
322
|
+
return result;
|
|
278
323
|
},
|
|
279
324
|
async verify(params, options) {
|
|
280
325
|
const result = await apiConfig.httpClient.post(
|
|
@@ -283,7 +328,8 @@ var createAuthApi = (apiConfig, updateSession) => {
|
|
|
283
328
|
options
|
|
284
329
|
);
|
|
285
330
|
if (result?.access_token) {
|
|
286
|
-
applyAuthToken(result, params.
|
|
331
|
+
applyAuthToken(result, pendingEmails.get(params.challenge_id));
|
|
332
|
+
pendingEmails.delete(params.challenge_id);
|
|
287
333
|
}
|
|
288
334
|
return result;
|
|
289
335
|
},
|
|
@@ -291,7 +337,9 @@ var createAuthApi = (apiConfig, updateSession) => {
|
|
|
291
337
|
return apiConfig.httpClient.post("/v1/auth/refresh", params, options);
|
|
292
338
|
},
|
|
293
339
|
async storeCode(storeId, params, options) {
|
|
294
|
-
|
|
340
|
+
const result = await apiConfig.httpClient.post(`/v1/stores/${storeId}/auth/code`, params, options);
|
|
341
|
+
pendingEmails.set(result.challenge_id, params.email);
|
|
342
|
+
return result;
|
|
295
343
|
},
|
|
296
344
|
async storeVerify(storeId, params, options) {
|
|
297
345
|
const result = await apiConfig.httpClient.post(
|
|
@@ -300,7 +348,8 @@ var createAuthApi = (apiConfig, updateSession) => {
|
|
|
300
348
|
options
|
|
301
349
|
);
|
|
302
350
|
if (result?.access_token) {
|
|
303
|
-
applyAuthToken(result, params.
|
|
351
|
+
applyAuthToken(result, pendingEmails.get(params.challenge_id));
|
|
352
|
+
pendingEmails.delete(params.challenge_id);
|
|
304
353
|
}
|
|
305
354
|
return result;
|
|
306
355
|
}
|
|
@@ -314,23 +363,10 @@ var createStoreApi = (apiConfig, _updateSession) => {
|
|
|
314
363
|
return apiConfig.httpClient.post(`/v1/stores`, params, options);
|
|
315
364
|
},
|
|
316
365
|
async updateStore(params, options) {
|
|
317
|
-
return apiConfig.httpClient.put(
|
|
318
|
-
`/v1/stores/${params.id}`,
|
|
319
|
-
params,
|
|
320
|
-
options
|
|
321
|
-
);
|
|
322
|
-
},
|
|
323
|
-
async deleteStore(params, options) {
|
|
324
|
-
return apiConfig.httpClient.delete(
|
|
325
|
-
`/v1/stores/${params.id}`,
|
|
326
|
-
options
|
|
327
|
-
);
|
|
366
|
+
return apiConfig.httpClient.put(`/v1/stores/${params.id}`, params, options);
|
|
328
367
|
},
|
|
329
368
|
async getStore(_params, options) {
|
|
330
|
-
return apiConfig.httpClient.get(
|
|
331
|
-
`/v1/stores/${apiConfig.storeId}`,
|
|
332
|
-
options
|
|
333
|
-
);
|
|
369
|
+
return apiConfig.httpClient.get(`/v1/stores/${apiConfig.storeId}`, options);
|
|
334
370
|
},
|
|
335
371
|
async getStores(params, options) {
|
|
336
372
|
return apiConfig.httpClient.get(`/v1/stores`, {
|
|
@@ -339,20 +375,58 @@ var createStoreApi = (apiConfig, _updateSession) => {
|
|
|
339
375
|
});
|
|
340
376
|
},
|
|
341
377
|
async getSubscriptionPlans(_params, options) {
|
|
342
|
-
return apiConfig.httpClient.get(
|
|
343
|
-
|
|
378
|
+
return apiConfig.httpClient.get("/v1/stores/plans", options);
|
|
379
|
+
},
|
|
380
|
+
async createSubscriptionAction(params, options) {
|
|
381
|
+
const { store_id, ...payload } = params;
|
|
382
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
383
|
+
const response = await apiConfig.httpClient.post(
|
|
384
|
+
`/v1/stores/${target_store_id}/subscription/actions`,
|
|
385
|
+
payload,
|
|
344
386
|
options
|
|
345
387
|
);
|
|
388
|
+
if (response.id !== params.action_id) {
|
|
389
|
+
throw new Error("Subscription response did not match the requested action_id");
|
|
390
|
+
}
|
|
391
|
+
return response;
|
|
346
392
|
},
|
|
347
|
-
async
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
393
|
+
async getSubscription(params = {}, options) {
|
|
394
|
+
const store_id = params.store_id || apiConfig.storeId;
|
|
395
|
+
return apiConfig.httpClient.get(`/v1/stores/${store_id}/subscription`, options);
|
|
396
|
+
},
|
|
397
|
+
async retrySubscriptionAction(params, options) {
|
|
398
|
+
const store_id = params.store_id || apiConfig.storeId;
|
|
399
|
+
return apiConfig.httpClient.post(
|
|
400
|
+
`/v1/stores/${store_id}/subscription/actions/${params.action_id}/retry`,
|
|
401
|
+
{},
|
|
353
402
|
options
|
|
354
403
|
);
|
|
355
404
|
},
|
|
405
|
+
async getSubscriptionAction(params, options) {
|
|
406
|
+
const store_id = params.store_id || apiConfig.storeId;
|
|
407
|
+
return apiConfig.httpClient.get(`/v1/stores/${store_id}/subscription/actions/${params.action_id}`, options);
|
|
408
|
+
},
|
|
409
|
+
async findSubscriptionActionEffects(params, options) {
|
|
410
|
+
const { store_id, action_id, ...query } = params;
|
|
411
|
+
return apiConfig.httpClient.get(
|
|
412
|
+
`/v1/stores/${store_id || apiConfig.storeId}/subscription/actions/${action_id}/effects`,
|
|
413
|
+
{ ...options, params: query }
|
|
414
|
+
);
|
|
415
|
+
},
|
|
416
|
+
async getSubscriptionActionEffect(params, options) {
|
|
417
|
+
const store_id = params.store_id || apiConfig.storeId;
|
|
418
|
+
return apiConfig.httpClient.get(
|
|
419
|
+
`/v1/stores/${store_id}/subscription/actions/${params.action_id}/effects/${params.effect_id}`,
|
|
420
|
+
options
|
|
421
|
+
);
|
|
422
|
+
},
|
|
423
|
+
async findSubscriptionActions(params = {}, options) {
|
|
424
|
+
const { store_id, ...query } = params;
|
|
425
|
+
return apiConfig.httpClient.get(
|
|
426
|
+
`/v1/stores/${store_id || apiConfig.storeId}/subscription/actions`,
|
|
427
|
+
{ ...options, params: query }
|
|
428
|
+
);
|
|
429
|
+
},
|
|
356
430
|
async createPortalSession(params, options) {
|
|
357
431
|
const store_id = params.store_id || apiConfig.storeId;
|
|
358
432
|
return apiConfig.httpClient.post(
|
|
@@ -363,114 +437,61 @@ var createStoreApi = (apiConfig, _updateSession) => {
|
|
|
363
437
|
},
|
|
364
438
|
async addMember(params, options) {
|
|
365
439
|
const { store_id, ...payload } = params;
|
|
366
|
-
return apiConfig.httpClient.post(
|
|
367
|
-
`/v1/stores/${store_id || apiConfig.storeId}/members`,
|
|
368
|
-
payload,
|
|
369
|
-
options
|
|
370
|
-
);
|
|
440
|
+
return apiConfig.httpClient.post(`/v1/stores/${store_id || apiConfig.storeId}/members`, payload, options);
|
|
371
441
|
},
|
|
372
442
|
async inviteUser(params, options) {
|
|
373
443
|
const { store_id, ...payload } = params;
|
|
374
|
-
return apiConfig.httpClient.post(
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
444
|
+
return apiConfig.httpClient.post(`/v1/stores/${store_id || apiConfig.storeId}/invitation`, payload, options);
|
|
445
|
+
},
|
|
446
|
+
async findMembers(params = {}, options) {
|
|
447
|
+
const { store_id, ...query } = params;
|
|
448
|
+
return apiConfig.httpClient.get(`/v1/stores/${store_id || apiConfig.storeId}/members`, {
|
|
449
|
+
...options,
|
|
450
|
+
params: query
|
|
451
|
+
});
|
|
452
|
+
},
|
|
453
|
+
async findOwnMemberships(options) {
|
|
454
|
+
return apiConfig.httpClient.get("/v1/stores/memberships", options);
|
|
379
455
|
},
|
|
380
456
|
async removeMember(params, options) {
|
|
381
457
|
return apiConfig.httpClient.delete(
|
|
382
|
-
`/v1/stores/${apiConfig.storeId}/members/${params.account_id}`,
|
|
458
|
+
`/v1/stores/${params.store_id || apiConfig.storeId}/members/${params.account_id}`,
|
|
383
459
|
options
|
|
384
460
|
);
|
|
385
461
|
},
|
|
386
462
|
async testWebhook(params, options) {
|
|
387
|
-
return apiConfig.httpClient.post(
|
|
388
|
-
`/v1/stores/${apiConfig.storeId}/webhooks/test`,
|
|
389
|
-
params,
|
|
390
|
-
options
|
|
391
|
-
);
|
|
392
|
-
},
|
|
393
|
-
async getStoreMedia(params, options) {
|
|
394
|
-
const queryParams = {
|
|
395
|
-
limit: params.limit
|
|
396
|
-
};
|
|
397
|
-
if (params.cursor) queryParams.cursor = params.cursor;
|
|
398
|
-
if (params.ids && params.ids.length > 0)
|
|
399
|
-
queryParams.ids = JSON.stringify(params.ids);
|
|
400
|
-
if (params.query) queryParams.query = params.query;
|
|
401
|
-
if (params.mime_type) queryParams.mime_type = params.mime_type;
|
|
402
|
-
if (params.sort_field) queryParams.sort_field = params.sort_field;
|
|
403
|
-
if (params.sort_direction)
|
|
404
|
-
queryParams.sort_direction = params.sort_direction;
|
|
405
|
-
return apiConfig.httpClient.get(
|
|
406
|
-
`/v1/stores/${params.id}/media`,
|
|
407
|
-
{
|
|
408
|
-
...options,
|
|
409
|
-
params: queryParams
|
|
410
|
-
}
|
|
411
|
-
);
|
|
463
|
+
return apiConfig.httpClient.post(`/v1/stores/${apiConfig.storeId}/webhooks/test`, params, options);
|
|
412
464
|
},
|
|
413
465
|
async listBuildHooks(params, options) {
|
|
414
|
-
return apiConfig.httpClient.get(
|
|
415
|
-
`/v1/stores/${params.store_id}/build-hooks`,
|
|
416
|
-
options
|
|
417
|
-
);
|
|
466
|
+
return apiConfig.httpClient.get(`/v1/stores/${params.store_id}/build-hooks`, options);
|
|
418
467
|
},
|
|
419
468
|
async createBuildHook(params, options) {
|
|
420
469
|
const { store_id, ...payload } = params;
|
|
421
|
-
return apiConfig.httpClient.post(
|
|
422
|
-
`/v1/stores/${store_id}/build-hooks`,
|
|
423
|
-
payload,
|
|
424
|
-
options
|
|
425
|
-
);
|
|
470
|
+
return apiConfig.httpClient.post(`/v1/stores/${store_id}/build-hooks`, payload, options);
|
|
426
471
|
},
|
|
427
472
|
async updateBuildHook(params, options) {
|
|
428
473
|
const { store_id, id, ...payload } = params;
|
|
429
|
-
return apiConfig.httpClient.put(
|
|
430
|
-
`/v1/stores/${store_id}/build-hooks/${id}`,
|
|
431
|
-
payload,
|
|
432
|
-
options
|
|
433
|
-
);
|
|
474
|
+
return apiConfig.httpClient.put(`/v1/stores/${store_id}/build-hooks/${id}`, payload, options);
|
|
434
475
|
},
|
|
435
476
|
async deleteBuildHook(params, options) {
|
|
436
|
-
return apiConfig.httpClient.delete(
|
|
437
|
-
`/v1/stores/${params.store_id}/build-hooks/${params.id}`,
|
|
438
|
-
options
|
|
439
|
-
);
|
|
477
|
+
return apiConfig.httpClient.delete(`/v1/stores/${params.store_id}/build-hooks/${params.id}`, options);
|
|
440
478
|
},
|
|
441
|
-
async
|
|
442
|
-
return apiConfig.httpClient.get(
|
|
443
|
-
`/v1/stores/${params.store_id}/config/${params.type}`,
|
|
444
|
-
options
|
|
445
|
-
);
|
|
479
|
+
async getPaymentConfig(params, options) {
|
|
480
|
+
return apiConfig.httpClient.get(`/v1/stores/${params.store_id}/config/payment`, options);
|
|
446
481
|
},
|
|
447
482
|
async listWebhooks(params, options) {
|
|
448
|
-
return apiConfig.httpClient.get(
|
|
449
|
-
`/v1/stores/${params.store_id}/webhooks`,
|
|
450
|
-
options
|
|
451
|
-
);
|
|
483
|
+
return apiConfig.httpClient.get(`/v1/stores/${params.store_id}/webhooks`, options);
|
|
452
484
|
},
|
|
453
485
|
async createWebhook(params, options) {
|
|
454
486
|
const { store_id, ...payload } = params;
|
|
455
|
-
return apiConfig.httpClient.post(
|
|
456
|
-
`/v1/stores/${store_id}/webhooks`,
|
|
457
|
-
payload,
|
|
458
|
-
options
|
|
459
|
-
);
|
|
487
|
+
return apiConfig.httpClient.post(`/v1/stores/${store_id}/webhooks`, payload, options);
|
|
460
488
|
},
|
|
461
489
|
async updateWebhook(params, options) {
|
|
462
490
|
const { store_id, id, ...payload } = params;
|
|
463
|
-
return apiConfig.httpClient.put(
|
|
464
|
-
`/v1/stores/${store_id}/webhooks/${id}`,
|
|
465
|
-
payload,
|
|
466
|
-
options
|
|
467
|
-
);
|
|
491
|
+
return apiConfig.httpClient.put(`/v1/stores/${store_id}/webhooks/${id}`, payload, options);
|
|
468
492
|
},
|
|
469
493
|
async deleteWebhook(params, options) {
|
|
470
|
-
return apiConfig.httpClient.delete(
|
|
471
|
-
`/v1/stores/${params.store_id}/webhooks/${params.id}`,
|
|
472
|
-
options
|
|
473
|
-
);
|
|
494
|
+
return apiConfig.httpClient.delete(`/v1/stores/${params.store_id}/webhooks/${params.id}`, options);
|
|
474
495
|
}
|
|
475
496
|
};
|
|
476
497
|
};
|
|
@@ -507,9 +528,10 @@ var createMediaApi = (apiConfig) => {
|
|
|
507
528
|
return await response.json();
|
|
508
529
|
},
|
|
509
530
|
async deleteStoreMedia(params, options) {
|
|
510
|
-
const {
|
|
531
|
+
const { store_id, media_id } = params;
|
|
532
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
511
533
|
return apiConfig.httpClient.delete(
|
|
512
|
-
`/v1/stores/${
|
|
534
|
+
`/v1/stores/${target_store_id}/media/${media_id}`,
|
|
513
535
|
options
|
|
514
536
|
);
|
|
515
537
|
},
|
|
@@ -553,16 +575,23 @@ var createMediaApi = (apiConfig) => {
|
|
|
553
575
|
// src/api/notification.ts
|
|
554
576
|
var createNotificationApi = (apiConfig) => {
|
|
555
577
|
return {
|
|
556
|
-
async
|
|
578
|
+
async sendEmail(request, options) {
|
|
579
|
+
return apiConfig.httpClient.post(
|
|
580
|
+
"/v1/notifications/email",
|
|
581
|
+
request,
|
|
582
|
+
options
|
|
583
|
+
);
|
|
584
|
+
},
|
|
585
|
+
async getEmailDelivery(params, options) {
|
|
557
586
|
return apiConfig.httpClient.get(
|
|
558
|
-
`/v1/notifications/
|
|
587
|
+
`/v1/notifications/email-deliveries/${params.delivery_id}`,
|
|
559
588
|
options
|
|
560
589
|
);
|
|
561
590
|
},
|
|
562
|
-
async
|
|
591
|
+
async retryEmailDelivery(params, options) {
|
|
563
592
|
return apiConfig.httpClient.post(
|
|
564
|
-
|
|
565
|
-
params,
|
|
593
|
+
`/v1/notifications/email-deliveries/${params.delivery_id}/retry`,
|
|
594
|
+
{ revision: params.revision },
|
|
566
595
|
options
|
|
567
596
|
);
|
|
568
597
|
}
|
|
@@ -645,14 +674,7 @@ var createCmsApi = (apiConfig) => {
|
|
|
645
674
|
},
|
|
646
675
|
async getCollection(params, options) {
|
|
647
676
|
const target_store_id = params.store_id || apiConfig.storeId;
|
|
648
|
-
|
|
649
|
-
if (params.id) {
|
|
650
|
-
identifier = params.id;
|
|
651
|
-
} else if (params.key) {
|
|
652
|
-
identifier = `${target_store_id}:${params.key}`;
|
|
653
|
-
} else {
|
|
654
|
-
throw new Error("GetCollectionParams requires id or key");
|
|
655
|
-
}
|
|
677
|
+
const identifier = params.id !== void 0 ? params.id : `${target_store_id}:${params.key}`;
|
|
656
678
|
return apiConfig.httpClient.get(
|
|
657
679
|
`/v1/stores/${target_store_id}/collections/${identifier}`,
|
|
658
680
|
options
|
|
@@ -920,7 +942,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
920
942
|
const target_store_id = store_id || apiConfig.storeId;
|
|
921
943
|
const payload = {
|
|
922
944
|
...rest,
|
|
923
|
-
...items ? { items
|
|
945
|
+
...items ? { items } : {}
|
|
924
946
|
};
|
|
925
947
|
return apiConfig.httpClient.put(
|
|
926
948
|
`/v1/stores/${target_store_id}/orders/${params.id}`,
|
|
@@ -971,7 +993,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
971
993
|
`/v1/stores/${target_store_id}/carts`,
|
|
972
994
|
{
|
|
973
995
|
...payload,
|
|
974
|
-
items:
|
|
996
|
+
items: payload.items || []
|
|
975
997
|
},
|
|
976
998
|
options
|
|
977
999
|
);
|
|
@@ -983,7 +1005,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
983
1005
|
`/v1/stores/${target_store_id}/carts/${id}`,
|
|
984
1006
|
{
|
|
985
1007
|
...payload,
|
|
986
|
-
...items ? { items
|
|
1008
|
+
...items ? { items } : {}
|
|
987
1009
|
},
|
|
988
1010
|
options
|
|
989
1011
|
);
|
|
@@ -993,7 +1015,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
993
1015
|
const target_store_id = store_id || apiConfig.storeId;
|
|
994
1016
|
return apiConfig.httpClient.post(
|
|
995
1017
|
`/v1/stores/${target_store_id}/carts/${id}/items`,
|
|
996
|
-
{ item
|
|
1018
|
+
{ item },
|
|
997
1019
|
options
|
|
998
1020
|
);
|
|
999
1021
|
},
|
|
@@ -1047,27 +1069,134 @@ var createEshopApi = (apiConfig) => {
|
|
|
1047
1069
|
`/v1/stores/${target_store_id}/orders/quote`,
|
|
1048
1070
|
{
|
|
1049
1071
|
...rest,
|
|
1050
|
-
items
|
|
1072
|
+
items,
|
|
1051
1073
|
shipping_address,
|
|
1052
1074
|
market: rest.market || apiConfig.market
|
|
1053
1075
|
},
|
|
1054
1076
|
options
|
|
1055
1077
|
);
|
|
1056
1078
|
},
|
|
1057
|
-
async
|
|
1079
|
+
async createRefund(params, options) {
|
|
1080
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1081
|
+
const response = await apiConfig.httpClient.post(
|
|
1082
|
+
`/v1/stores/${target_store_id}/orders/${params.order_id}/refunds`,
|
|
1083
|
+
{
|
|
1084
|
+
amount: params.amount,
|
|
1085
|
+
refund_id: params.refund_id
|
|
1086
|
+
},
|
|
1087
|
+
options
|
|
1088
|
+
);
|
|
1089
|
+
if (response.refund_id !== params.refund_id) {
|
|
1090
|
+
throw new Error(
|
|
1091
|
+
"Refund response did not match the requested refund_id"
|
|
1092
|
+
);
|
|
1093
|
+
}
|
|
1094
|
+
if (!Number.isSafeInteger(response.amount) || response.amount !== params.amount) {
|
|
1095
|
+
throw new Error("Refund response did not match the requested amount");
|
|
1096
|
+
}
|
|
1097
|
+
if (![
|
|
1098
|
+
"requested",
|
|
1099
|
+
"processing",
|
|
1100
|
+
"succeeded",
|
|
1101
|
+
"rejected",
|
|
1102
|
+
"failed",
|
|
1103
|
+
"unknown"
|
|
1104
|
+
].includes(response.status)) {
|
|
1105
|
+
throw new Error("Refund response contained an invalid status");
|
|
1106
|
+
}
|
|
1107
|
+
return response;
|
|
1108
|
+
},
|
|
1109
|
+
async retryRefund(params, options) {
|
|
1110
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1111
|
+
return apiConfig.httpClient.post(
|
|
1112
|
+
`/v1/stores/${target_store_id}/orders/${params.order_id}/refunds/${params.refund_id}/retry`,
|
|
1113
|
+
{},
|
|
1114
|
+
options
|
|
1115
|
+
);
|
|
1116
|
+
},
|
|
1117
|
+
async getPayment(params, options) {
|
|
1118
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1119
|
+
return apiConfig.httpClient.get(
|
|
1120
|
+
`/v1/stores/${target_store_id}/orders/${params.order_id}/payment`,
|
|
1121
|
+
options
|
|
1122
|
+
);
|
|
1123
|
+
},
|
|
1124
|
+
async retryPaymentTransaction(params, options) {
|
|
1125
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1058
1126
|
return apiConfig.httpClient.post(
|
|
1059
|
-
`/v1/stores/${
|
|
1060
|
-
{
|
|
1127
|
+
`/v1/stores/${target_store_id}/orders/${params.order_id}/payment/transactions/${params.transaction_id}/retry`,
|
|
1128
|
+
{},
|
|
1061
1129
|
options
|
|
1062
1130
|
);
|
|
1063
1131
|
},
|
|
1132
|
+
async getPaymentTransactions(params, options) {
|
|
1133
|
+
const { order_id, store_id, ...queryParams } = params;
|
|
1134
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1135
|
+
return apiConfig.httpClient.get(
|
|
1136
|
+
`/v1/stores/${target_store_id}/orders/${order_id}/payment/transactions`,
|
|
1137
|
+
{ ...options, params: queryParams }
|
|
1138
|
+
);
|
|
1139
|
+
},
|
|
1140
|
+
async getPaymentTransaction(params, options) {
|
|
1141
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1142
|
+
return apiConfig.httpClient.get(
|
|
1143
|
+
`/v1/stores/${target_store_id}/orders/${params.order_id}/payment/transactions/${params.transaction_id}`,
|
|
1144
|
+
options
|
|
1145
|
+
);
|
|
1146
|
+
},
|
|
1147
|
+
async getRefund(params, options) {
|
|
1148
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1149
|
+
return apiConfig.httpClient.get(
|
|
1150
|
+
`/v1/stores/${target_store_id}/orders/${params.order_id}/refunds/${params.refund_id}`,
|
|
1151
|
+
options
|
|
1152
|
+
);
|
|
1153
|
+
},
|
|
1154
|
+
async getRefunds(params, options) {
|
|
1155
|
+
const { order_id, store_id, ...queryParams } = params;
|
|
1156
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1157
|
+
return apiConfig.httpClient.get(
|
|
1158
|
+
`/v1/stores/${target_store_id}/orders/${order_id}/refunds`,
|
|
1159
|
+
{ ...options, params: queryParams }
|
|
1160
|
+
);
|
|
1161
|
+
},
|
|
1064
1162
|
async downloadDigitalAccess(params, options) {
|
|
1065
1163
|
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1066
1164
|
return apiConfig.httpClient.post(
|
|
1067
|
-
`/v1/stores/${target_store_id}/orders/${params.
|
|
1165
|
+
`/v1/stores/${target_store_id}/orders/${params.order_id}/digital-access/${params.grant_id}/download`,
|
|
1166
|
+
{},
|
|
1167
|
+
options
|
|
1168
|
+
);
|
|
1169
|
+
},
|
|
1170
|
+
async activateDigitalAccess(params, options) {
|
|
1171
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1172
|
+
return apiConfig.httpClient.post(
|
|
1173
|
+
`/v1/stores/${target_store_id}/orders/${params.order_id}/digital-access/${params.grant_id}/activate`,
|
|
1174
|
+
{},
|
|
1175
|
+
options
|
|
1176
|
+
);
|
|
1177
|
+
},
|
|
1178
|
+
async revokeDigitalAccess(params, options) {
|
|
1179
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1180
|
+
return apiConfig.httpClient.post(
|
|
1181
|
+
`/v1/stores/${target_store_id}/orders/${params.order_id}/digital-access/${params.grant_id}/revoke`,
|
|
1068
1182
|
{},
|
|
1069
1183
|
options
|
|
1070
1184
|
);
|
|
1185
|
+
},
|
|
1186
|
+
async findDigitalAccess(params, options) {
|
|
1187
|
+
const { order_id, store_id, ...queryParams } = params;
|
|
1188
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1189
|
+
return apiConfig.httpClient.get(
|
|
1190
|
+
`/v1/stores/${target_store_id}/orders/${order_id}/digital-access`,
|
|
1191
|
+
{ ...options, params: queryParams }
|
|
1192
|
+
);
|
|
1193
|
+
},
|
|
1194
|
+
async getDigitalAccess(params, options) {
|
|
1195
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1196
|
+
return apiConfig.httpClient.get(
|
|
1197
|
+
`/v1/stores/${target_store_id}/orders/${params.order_id}/digital-access/${params.grant_id}`,
|
|
1198
|
+
options
|
|
1199
|
+
);
|
|
1071
1200
|
}
|
|
1072
1201
|
};
|
|
1073
1202
|
};
|
|
@@ -1266,17 +1395,27 @@ var createContactApi = (apiConfig) => {
|
|
|
1266
1395
|
options
|
|
1267
1396
|
);
|
|
1268
1397
|
},
|
|
1269
|
-
async
|
|
1398
|
+
async findSessions(params, options) {
|
|
1399
|
+
const store_id = params.store_id || apiConfig.storeId;
|
|
1400
|
+
const queryParams = {};
|
|
1401
|
+
if (params.limit !== void 0) queryParams.limit = params.limit;
|
|
1402
|
+
if (params.cursor) queryParams.cursor = params.cursor;
|
|
1403
|
+
return apiConfig.httpClient.get(
|
|
1404
|
+
`/v1/stores/${store_id}/contacts/${params.contact_id}/sessions`,
|
|
1405
|
+
{ ...options, params: queryParams }
|
|
1406
|
+
);
|
|
1407
|
+
},
|
|
1408
|
+
async revokeSession(params, options) {
|
|
1270
1409
|
const store_id = params.store_id || apiConfig.storeId;
|
|
1271
1410
|
return apiConfig.httpClient.delete(
|
|
1272
|
-
`/v1/stores/${store_id}/contacts/${params.
|
|
1411
|
+
`/v1/stores/${store_id}/contacts/${params.contact_id}/sessions/${params.session_id}`,
|
|
1273
1412
|
options
|
|
1274
1413
|
);
|
|
1275
1414
|
},
|
|
1276
|
-
async
|
|
1415
|
+
async revokeAllSessions(params, options) {
|
|
1277
1416
|
const store_id = params.store_id || apiConfig.storeId;
|
|
1278
1417
|
return apiConfig.httpClient.delete(
|
|
1279
|
-
`/v1/stores/${store_id}/contacts/${params.
|
|
1418
|
+
`/v1/stores/${store_id}/contacts/${params.contact_id}/sessions`,
|
|
1280
1419
|
options
|
|
1281
1420
|
);
|
|
1282
1421
|
},
|
|
@@ -1314,6 +1453,49 @@ var createContactApi = (apiConfig) => {
|
|
|
1314
1453
|
{ ...options, params: queryParams }
|
|
1315
1454
|
);
|
|
1316
1455
|
},
|
|
1456
|
+
plans: {
|
|
1457
|
+
async create(params, options) {
|
|
1458
|
+
const { store_id, contact_list_id, ...payload } = params;
|
|
1459
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1460
|
+
return apiConfig.httpClient.post(
|
|
1461
|
+
`/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/plans`,
|
|
1462
|
+
payload,
|
|
1463
|
+
options
|
|
1464
|
+
);
|
|
1465
|
+
},
|
|
1466
|
+
async update(params, options) {
|
|
1467
|
+
const { id, store_id, contact_list_id, ...payload } = params;
|
|
1468
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1469
|
+
return apiConfig.httpClient.put(
|
|
1470
|
+
`/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/plans/${id}`,
|
|
1471
|
+
payload,
|
|
1472
|
+
options
|
|
1473
|
+
);
|
|
1474
|
+
},
|
|
1475
|
+
async get(params, options) {
|
|
1476
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1477
|
+
return apiConfig.httpClient.get(
|
|
1478
|
+
`/v1/stores/${target_store_id}/contact-lists/${params.contact_list_id}/plans/${params.id}`,
|
|
1479
|
+
options
|
|
1480
|
+
);
|
|
1481
|
+
},
|
|
1482
|
+
async find(params, options) {
|
|
1483
|
+
const { store_id, contact_list_id, ...queryParams } = params;
|
|
1484
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1485
|
+
return apiConfig.httpClient.get(
|
|
1486
|
+
`/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/plans`,
|
|
1487
|
+
{ ...options, params: queryParams }
|
|
1488
|
+
);
|
|
1489
|
+
},
|
|
1490
|
+
async retryCatalog(params, options) {
|
|
1491
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1492
|
+
return apiConfig.httpClient.post(
|
|
1493
|
+
`/v1/stores/${target_store_id}/contact-lists/${params.contact_list_id}/plans/${params.plan_id}/catalog/retry`,
|
|
1494
|
+
{},
|
|
1495
|
+
options
|
|
1496
|
+
);
|
|
1497
|
+
}
|
|
1498
|
+
},
|
|
1317
1499
|
async importContacts(params, options) {
|
|
1318
1500
|
const { store_id, contact_list_id, ...payload } = params;
|
|
1319
1501
|
const target_store_id = store_id || apiConfig.storeId;
|
|
@@ -1370,9 +1552,102 @@ var createContactApi = (apiConfig) => {
|
|
|
1370
1552
|
{ ...options, params: queryParams }
|
|
1371
1553
|
);
|
|
1372
1554
|
}
|
|
1555
|
+
},
|
|
1556
|
+
memberships: {
|
|
1557
|
+
async refund(params, options) {
|
|
1558
|
+
const { store_id, contact_list_id, membership_id, ...payload } = params;
|
|
1559
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1560
|
+
const response = await apiConfig.httpClient.post(
|
|
1561
|
+
`/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/memberships/${membership_id}/refund`,
|
|
1562
|
+
payload,
|
|
1563
|
+
options
|
|
1564
|
+
);
|
|
1565
|
+
if (response.refund_id !== params.refund_id) {
|
|
1566
|
+
throw new Error(
|
|
1567
|
+
"Membership refund response did not match the requested refund_id"
|
|
1568
|
+
);
|
|
1569
|
+
}
|
|
1570
|
+
return response;
|
|
1571
|
+
},
|
|
1572
|
+
paymentAttempts: {
|
|
1573
|
+
async find(params, options) {
|
|
1574
|
+
const { store_id, contact_list_id, membership_id, ...queryParams } = params;
|
|
1575
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1576
|
+
return apiConfig.httpClient.get(
|
|
1577
|
+
`/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/memberships/${membership_id}/payment-attempts`,
|
|
1578
|
+
{ ...options, params: queryParams }
|
|
1579
|
+
);
|
|
1580
|
+
},
|
|
1581
|
+
async get(params, options) {
|
|
1582
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1583
|
+
return apiConfig.httpClient.get(
|
|
1584
|
+
`/v1/stores/${target_store_id}/contact-lists/${params.contact_list_id}/memberships/${params.membership_id}/payment-attempts/${params.id}`,
|
|
1585
|
+
options
|
|
1586
|
+
);
|
|
1587
|
+
}
|
|
1588
|
+
},
|
|
1589
|
+
refunds: {
|
|
1590
|
+
async find(params, options) {
|
|
1591
|
+
const { store_id, contact_list_id, membership_id, ...queryParams } = params;
|
|
1592
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1593
|
+
return apiConfig.httpClient.get(
|
|
1594
|
+
`/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/memberships/${membership_id}/refunds`,
|
|
1595
|
+
{ ...options, params: queryParams }
|
|
1596
|
+
);
|
|
1597
|
+
},
|
|
1598
|
+
async get(params, options) {
|
|
1599
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1600
|
+
return apiConfig.httpClient.get(
|
|
1601
|
+
`/v1/stores/${target_store_id}/contact-lists/${params.contact_list_id}/memberships/${params.membership_id}/refunds/${params.id}`,
|
|
1602
|
+
options
|
|
1603
|
+
);
|
|
1604
|
+
},
|
|
1605
|
+
async retry(params, options) {
|
|
1606
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1607
|
+
return apiConfig.httpClient.post(
|
|
1608
|
+
`/v1/stores/${target_store_id}/contact-lists/${params.contact_list_id}/memberships/${params.membership_id}/refunds/${params.id}/retry`,
|
|
1609
|
+
{},
|
|
1610
|
+
options
|
|
1611
|
+
);
|
|
1612
|
+
}
|
|
1613
|
+
},
|
|
1614
|
+
cancellations: {
|
|
1615
|
+
async find(params, options) {
|
|
1616
|
+
const { store_id, contact_list_id, membership_id, ...queryParams } = params;
|
|
1617
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1618
|
+
return apiConfig.httpClient.get(
|
|
1619
|
+
`/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/memberships/${membership_id}/cancellations`,
|
|
1620
|
+
{ ...options, params: queryParams }
|
|
1621
|
+
);
|
|
1622
|
+
},
|
|
1623
|
+
async get(params, options) {
|
|
1624
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1625
|
+
return apiConfig.httpClient.get(
|
|
1626
|
+
`/v1/stores/${target_store_id}/contact-lists/${params.contact_list_id}/memberships/${params.membership_id}/cancellations/${params.id}`,
|
|
1627
|
+
options
|
|
1628
|
+
);
|
|
1629
|
+
},
|
|
1630
|
+
async retry(params, options) {
|
|
1631
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1632
|
+
return apiConfig.httpClient.post(
|
|
1633
|
+
`/v1/stores/${target_store_id}/contact-lists/${params.contact_list_id}/memberships/${params.membership_id}/cancellations/${params.id}/retry`,
|
|
1634
|
+
{},
|
|
1635
|
+
options
|
|
1636
|
+
);
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1373
1639
|
}
|
|
1374
1640
|
},
|
|
1375
1641
|
mailbox: {
|
|
1642
|
+
async connectGoogle(params, options) {
|
|
1643
|
+
const { store_id, ...payload } = params;
|
|
1644
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1645
|
+
return apiConfig.httpClient.post(
|
|
1646
|
+
`/v1/stores/${target_store_id}/mailboxes/google/connect-url`,
|
|
1647
|
+
payload,
|
|
1648
|
+
options
|
|
1649
|
+
);
|
|
1650
|
+
},
|
|
1376
1651
|
async create(params, options) {
|
|
1377
1652
|
const { store_id, ...payload } = params;
|
|
1378
1653
|
const target_store_id = store_id || apiConfig.storeId;
|
|
@@ -1946,11 +2221,50 @@ var createSocialApi = (apiConfig) => {
|
|
|
1946
2221
|
options
|
|
1947
2222
|
);
|
|
1948
2223
|
},
|
|
1949
|
-
async
|
|
1950
|
-
const { store_id, publication_id, comment_id,
|
|
2224
|
+
async createCommentReply(params, options) {
|
|
2225
|
+
const { store_id, publication_id, comment_id, ...payload } = params;
|
|
2226
|
+
return apiConfig.httpClient.post(
|
|
2227
|
+
`/v1/stores/${storeId(store_id)}/social-publications/${publication_id}/comments/${comment_id}/replies`,
|
|
2228
|
+
payload,
|
|
2229
|
+
options
|
|
2230
|
+
);
|
|
2231
|
+
},
|
|
2232
|
+
async listCommentReplies(params, options) {
|
|
2233
|
+
const { store_id, publication_id, comment_id, ...queryParams } = params;
|
|
2234
|
+
return apiConfig.httpClient.get(
|
|
2235
|
+
`/v1/stores/${storeId(store_id)}/social-publications/${publication_id}/comments/${comment_id}/replies`,
|
|
2236
|
+
{
|
|
2237
|
+
...options,
|
|
2238
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2239
|
+
}
|
|
2240
|
+
);
|
|
2241
|
+
},
|
|
2242
|
+
async getCommentReply(params, options) {
|
|
2243
|
+
return apiConfig.httpClient.get(
|
|
2244
|
+
`/v1/stores/${storeId(params.store_id)}/social-publications/${params.publication_id}/comments/${params.comment_id}/replies/${params.reply_id}`,
|
|
2245
|
+
options
|
|
2246
|
+
);
|
|
2247
|
+
},
|
|
2248
|
+
async retryCommentReply(params, options) {
|
|
1951
2249
|
return apiConfig.httpClient.post(
|
|
1952
|
-
`/v1/stores/${storeId(store_id)}/social-publications/${publication_id}/comments/${comment_id}/
|
|
1953
|
-
{
|
|
2250
|
+
`/v1/stores/${storeId(params.store_id)}/social-publications/${params.publication_id}/comments/${params.comment_id}/replies/${params.reply_id}/retry`,
|
|
2251
|
+
{},
|
|
2252
|
+
options
|
|
2253
|
+
);
|
|
2254
|
+
},
|
|
2255
|
+
async listPublicationEffects(params, options) {
|
|
2256
|
+
const { store_id, publication_id, ...queryParams } = params;
|
|
2257
|
+
return apiConfig.httpClient.get(
|
|
2258
|
+
`/v1/stores/${storeId(store_id)}/social-publications/${publication_id}/effects`,
|
|
2259
|
+
{
|
|
2260
|
+
...options,
|
|
2261
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2262
|
+
}
|
|
2263
|
+
);
|
|
2264
|
+
},
|
|
2265
|
+
async getPublicationEffect(params, options) {
|
|
2266
|
+
return apiConfig.httpClient.get(
|
|
2267
|
+
`/v1/stores/${storeId(params.store_id)}/social-publications/${params.publication_id}/effects/${params.effect_id}`,
|
|
1954
2268
|
options
|
|
1955
2269
|
);
|
|
1956
2270
|
},
|
|
@@ -1977,41 +2291,41 @@ var createSocialApi = (apiConfig) => {
|
|
|
1977
2291
|
},
|
|
1978
2292
|
async getCapabilities(params, options) {
|
|
1979
2293
|
return apiConfig.httpClient.get(
|
|
1980
|
-
`/v1/stores/${storeId(params?.store_id)}/social-
|
|
2294
|
+
`/v1/stores/${storeId(params?.store_id)}/social-connections/capabilities`,
|
|
1981
2295
|
options
|
|
1982
2296
|
);
|
|
1983
2297
|
},
|
|
1984
|
-
async
|
|
2298
|
+
async listConnections(params, options) {
|
|
1985
2299
|
return apiConfig.httpClient.get(
|
|
1986
|
-
`/v1/stores/${storeId(params?.store_id)}/social-
|
|
2300
|
+
`/v1/stores/${storeId(params?.store_id)}/social-connections`,
|
|
1987
2301
|
options
|
|
1988
2302
|
);
|
|
1989
2303
|
},
|
|
1990
2304
|
async connect(params, options) {
|
|
1991
2305
|
const { store_id, ...payload } = params;
|
|
1992
2306
|
return apiConfig.httpClient.post(
|
|
1993
|
-
`/v1/stores/${storeId(store_id)}/social-
|
|
2307
|
+
`/v1/stores/${storeId(store_id)}/social-connections/oauth/connect`,
|
|
1994
2308
|
payload,
|
|
1995
2309
|
options
|
|
1996
2310
|
);
|
|
1997
2311
|
},
|
|
1998
2312
|
async getOAuthAttempt(params, options) {
|
|
1999
2313
|
return apiConfig.httpClient.get(
|
|
2000
|
-
`/v1/stores/${storeId(params.store_id)}/social-
|
|
2314
|
+
`/v1/stores/${storeId(params.store_id)}/social-connections/oauth/attempts/${params.attempt_id}`,
|
|
2001
2315
|
options
|
|
2002
2316
|
);
|
|
2003
2317
|
},
|
|
2004
2318
|
async selectDestination(params, options) {
|
|
2005
2319
|
const { store_id, ...payload } = params;
|
|
2006
2320
|
return apiConfig.httpClient.post(
|
|
2007
|
-
`/v1/stores/${storeId(store_id)}/social-
|
|
2321
|
+
`/v1/stores/${storeId(store_id)}/social-connections/oauth/select-destination`,
|
|
2008
2322
|
payload,
|
|
2009
2323
|
options
|
|
2010
2324
|
);
|
|
2011
2325
|
},
|
|
2012
|
-
async
|
|
2326
|
+
async deleteConnection(params, options) {
|
|
2013
2327
|
return apiConfig.httpClient.delete(
|
|
2014
|
-
`/v1/stores/${storeId(params.store_id)}/social-
|
|
2328
|
+
`/v1/stores/${storeId(params.store_id)}/social-connections/${params.id}`,
|
|
2015
2329
|
options
|
|
2016
2330
|
);
|
|
2017
2331
|
},
|
|
@@ -2097,35 +2411,44 @@ var createWorkflowApi = (apiConfig) => {
|
|
|
2097
2411
|
options
|
|
2098
2412
|
);
|
|
2099
2413
|
},
|
|
2100
|
-
async
|
|
2101
|
-
const store_id = params
|
|
2414
|
+
async getWorkflowEffects(params, options) {
|
|
2415
|
+
const store_id = params.store_id || apiConfig.storeId;
|
|
2416
|
+
const { store_id: _, workflow_id, execution_id, ...queryParams } = params;
|
|
2102
2417
|
return apiConfig.httpClient.get(
|
|
2103
|
-
`/v1/stores/${store_id}/
|
|
2418
|
+
`/v1/stores/${store_id}/workflows/${workflow_id}/executions/${execution_id}/effects`,
|
|
2419
|
+
{
|
|
2420
|
+
...options,
|
|
2421
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2422
|
+
}
|
|
2423
|
+
);
|
|
2424
|
+
},
|
|
2425
|
+
async getWorkflowEffect(params, options) {
|
|
2426
|
+
const store_id = params.store_id || apiConfig.storeId;
|
|
2427
|
+
return apiConfig.httpClient.get(
|
|
2428
|
+
`/v1/stores/${store_id}/workflows/${params.workflow_id}/executions/${params.execution_id}/effects/${params.effect_id}`,
|
|
2104
2429
|
options
|
|
2105
2430
|
);
|
|
2106
2431
|
},
|
|
2107
|
-
async
|
|
2108
|
-
const
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
`/v1/stores/${target_store_id}/workflow-accounts/connect-url`,
|
|
2112
|
-
{ ...payload, type, store_id: target_store_id },
|
|
2432
|
+
async getWorkflowConnections(params, options) {
|
|
2433
|
+
const store_id = params?.store_id || apiConfig.storeId;
|
|
2434
|
+
return apiConfig.httpClient.get(
|
|
2435
|
+
`/v1/stores/${store_id}/workflow-connections`,
|
|
2113
2436
|
options
|
|
2114
2437
|
);
|
|
2115
2438
|
},
|
|
2116
|
-
async
|
|
2439
|
+
async getWorkflowConnectionConnectUrl(params, options) {
|
|
2117
2440
|
const { store_id, type, ...payload } = params;
|
|
2118
2441
|
const target_store_id = store_id || apiConfig.storeId;
|
|
2119
2442
|
return apiConfig.httpClient.post(
|
|
2120
|
-
`/v1/stores/${target_store_id}/workflow-
|
|
2443
|
+
`/v1/stores/${target_store_id}/workflow-connections/connect-url`,
|
|
2121
2444
|
{ ...payload, type, store_id: target_store_id },
|
|
2122
2445
|
options
|
|
2123
2446
|
);
|
|
2124
2447
|
},
|
|
2125
|
-
async
|
|
2448
|
+
async deleteWorkflowConnection(params, options) {
|
|
2126
2449
|
const store_id = params.store_id || apiConfig.storeId;
|
|
2127
2450
|
return apiConfig.httpClient.delete(
|
|
2128
|
-
`/v1/stores/${store_id}/workflow-
|
|
2451
|
+
`/v1/stores/${store_id}/workflow-connections/${params.id}`,
|
|
2129
2452
|
options
|
|
2130
2453
|
);
|
|
2131
2454
|
}
|
|
@@ -2169,27 +2492,105 @@ var createPlatformApi = (apiConfig) => {
|
|
|
2169
2492
|
|
|
2170
2493
|
// src/api/shipping.ts
|
|
2171
2494
|
var createShippingApi = (apiConfig) => {
|
|
2495
|
+
const storeId = (value) => value || apiConfig.storeId;
|
|
2172
2496
|
return {
|
|
2497
|
+
async findFulfillmentOrders(params, options) {
|
|
2498
|
+
const { store_id, order_id, ...queryParams } = params;
|
|
2499
|
+
return apiConfig.httpClient.get(
|
|
2500
|
+
`/v1/stores/${storeId(store_id)}/orders/${order_id}/fulfillment-orders`,
|
|
2501
|
+
{ ...options, params: queryParams }
|
|
2502
|
+
);
|
|
2503
|
+
},
|
|
2504
|
+
async getFulfillmentOrder(params, options) {
|
|
2505
|
+
return apiConfig.httpClient.get(
|
|
2506
|
+
`/v1/stores/${storeId(params.store_id)}/orders/${params.order_id}/fulfillment-orders/${params.fulfillment_order_id}`,
|
|
2507
|
+
options
|
|
2508
|
+
);
|
|
2509
|
+
},
|
|
2173
2510
|
async getRates(params, options) {
|
|
2174
|
-
const { order_id, ...payload } = params;
|
|
2511
|
+
const { store_id, order_id, ...payload } = params;
|
|
2175
2512
|
return apiConfig.httpClient.post(
|
|
2176
|
-
`/v1/stores/${
|
|
2513
|
+
`/v1/stores/${storeId(store_id)}/orders/${order_id}/shipping/rates`,
|
|
2177
2514
|
payload,
|
|
2178
2515
|
options
|
|
2179
2516
|
);
|
|
2180
2517
|
},
|
|
2181
|
-
async
|
|
2182
|
-
const { order_id, ...
|
|
2183
|
-
return apiConfig.httpClient.
|
|
2184
|
-
`/v1/stores/${
|
|
2518
|
+
async findShipments(params, options) {
|
|
2519
|
+
const { store_id, order_id, ...queryParams } = params;
|
|
2520
|
+
return apiConfig.httpClient.get(
|
|
2521
|
+
`/v1/stores/${storeId(store_id)}/orders/${order_id}/shipments`,
|
|
2522
|
+
{ ...options, params: queryParams }
|
|
2523
|
+
);
|
|
2524
|
+
},
|
|
2525
|
+
async getShipment(params, options) {
|
|
2526
|
+
return apiConfig.httpClient.get(
|
|
2527
|
+
`/v1/stores/${storeId(params.store_id)}/orders/${params.order_id}/shipments/${params.shipment_id}`,
|
|
2528
|
+
options
|
|
2529
|
+
);
|
|
2530
|
+
},
|
|
2531
|
+
async createShipment(params, options) {
|
|
2532
|
+
const { store_id, order_id, ...payload } = params;
|
|
2533
|
+
const response = await apiConfig.httpClient.post(
|
|
2534
|
+
`/v1/stores/${storeId(store_id)}/orders/${order_id}/shipments`,
|
|
2185
2535
|
payload,
|
|
2186
2536
|
options
|
|
2187
2537
|
);
|
|
2538
|
+
if (response.shipment_id !== params.shipment_id || response.shipment.id !== params.shipment_id) {
|
|
2539
|
+
throw new Error("Shipping response did not match the requested shipment_id");
|
|
2540
|
+
}
|
|
2541
|
+
return response;
|
|
2542
|
+
},
|
|
2543
|
+
async retryShipment(params, options) {
|
|
2544
|
+
return apiConfig.httpClient.post(
|
|
2545
|
+
`/v1/stores/${storeId(params.store_id)}/orders/${params.order_id}/shipments/${params.shipment_id}/retry`,
|
|
2546
|
+
{},
|
|
2547
|
+
options
|
|
2548
|
+
);
|
|
2188
2549
|
},
|
|
2189
|
-
async
|
|
2190
|
-
const { order_id, shipment_id } = params;
|
|
2550
|
+
async requestRefund(params, options) {
|
|
2191
2551
|
return apiConfig.httpClient.post(
|
|
2192
|
-
`/v1/stores/${
|
|
2552
|
+
`/v1/stores/${storeId(params.store_id)}/orders/${params.order_id}/shipments/${params.shipment_id}/refunds`,
|
|
2553
|
+
{},
|
|
2554
|
+
options
|
|
2555
|
+
);
|
|
2556
|
+
},
|
|
2557
|
+
async findRefunds(params, options) {
|
|
2558
|
+
const { store_id, order_id, shipment_id, ...queryParams } = params;
|
|
2559
|
+
return apiConfig.httpClient.get(
|
|
2560
|
+
`/v1/stores/${storeId(store_id)}/orders/${order_id}/shipments/${shipment_id}/refunds`,
|
|
2561
|
+
{ ...options, params: queryParams }
|
|
2562
|
+
);
|
|
2563
|
+
},
|
|
2564
|
+
async getRefund(params, options) {
|
|
2565
|
+
return apiConfig.httpClient.get(
|
|
2566
|
+
`/v1/stores/${storeId(params.store_id)}/orders/${params.order_id}/shipments/${params.shipment_id}/refunds/${params.refund_id}`,
|
|
2567
|
+
options
|
|
2568
|
+
);
|
|
2569
|
+
},
|
|
2570
|
+
async retryRefund(params, options) {
|
|
2571
|
+
return apiConfig.httpClient.post(
|
|
2572
|
+
`/v1/stores/${storeId(params.store_id)}/orders/${params.order_id}/shipments/${params.shipment_id}/refunds/${params.refund_id}/retry`,
|
|
2573
|
+
{},
|
|
2574
|
+
options
|
|
2575
|
+
);
|
|
2576
|
+
},
|
|
2577
|
+
async findAdjustments(params, options) {
|
|
2578
|
+
const { store_id, order_id, shipment_id, ...queryParams } = params;
|
|
2579
|
+
return apiConfig.httpClient.get(
|
|
2580
|
+
`/v1/stores/${storeId(store_id)}/orders/${order_id}/shipments/${shipment_id}/adjustments`,
|
|
2581
|
+
{ ...options, params: queryParams }
|
|
2582
|
+
);
|
|
2583
|
+
},
|
|
2584
|
+
async findSettlements(params, options) {
|
|
2585
|
+
const { store_id, order_id, shipment_id, ...queryParams } = params;
|
|
2586
|
+
return apiConfig.httpClient.get(
|
|
2587
|
+
`/v1/stores/${storeId(store_id)}/orders/${order_id}/shipments/${shipment_id}/settlements`,
|
|
2588
|
+
{ ...options, params: queryParams }
|
|
2589
|
+
);
|
|
2590
|
+
},
|
|
2591
|
+
async retrySettlement(params, options) {
|
|
2592
|
+
return apiConfig.httpClient.post(
|
|
2593
|
+
`/v1/stores/${storeId(params.store_id)}/orders/${params.order_id}/shipments/${params.shipment_id}/settlements/${params.settlement_id}/retry`,
|
|
2193
2594
|
{},
|
|
2194
2595
|
options
|
|
2195
2596
|
);
|
|
@@ -2498,155 +2899,230 @@ var createExperimentsApi = (apiConfig) => {
|
|
|
2498
2899
|
};
|
|
2499
2900
|
|
|
2500
2901
|
// src/utils/blocks.ts
|
|
2501
|
-
function
|
|
2502
|
-
|
|
2503
|
-
return block.key?.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase()) ?? "";
|
|
2902
|
+
function isRecord2(value) {
|
|
2903
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2504
2904
|
}
|
|
2505
|
-
function
|
|
2506
|
-
|
|
2507
|
-
const value = block.value;
|
|
2508
|
-
switch (block.type) {
|
|
2509
|
-
case "boolean":
|
|
2510
|
-
return value ? "Yes" : "No";
|
|
2511
|
-
case "number":
|
|
2512
|
-
if (block.properties?.variant === "DATE" || block.properties?.variant === "DATE_TIME") {
|
|
2513
|
-
return new Date(value).toLocaleDateString();
|
|
2514
|
-
}
|
|
2515
|
-
return String(value);
|
|
2516
|
-
case "media":
|
|
2517
|
-
if (value && typeof value === "object") {
|
|
2518
|
-
return value.mime_type ? value.name || value.id : value.title || value.name || value.id;
|
|
2519
|
-
}
|
|
2520
|
-
return String(value);
|
|
2521
|
-
default:
|
|
2522
|
-
return String(value);
|
|
2523
|
-
}
|
|
2905
|
+
function isBlock(value) {
|
|
2906
|
+
return isRecord2(value) && typeof value.key === "string" && typeof value.type === "string";
|
|
2524
2907
|
}
|
|
2525
|
-
function
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2908
|
+
function recordFromBlocks(values, locale) {
|
|
2909
|
+
const result = {};
|
|
2910
|
+
for (const value of values) {
|
|
2911
|
+
if (!isBlock(value)) continue;
|
|
2912
|
+
result[value.key] = unwrapBlock(value, locale);
|
|
2913
|
+
}
|
|
2914
|
+
return result;
|
|
2530
2915
|
}
|
|
2531
|
-
function
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
return values;
|
|
2916
|
+
function localizedValue(value, locale) {
|
|
2917
|
+
if (typeof value === "string") return value;
|
|
2918
|
+
if (!isRecord2(value)) return "";
|
|
2919
|
+
const selected = value[locale] ?? value.en;
|
|
2920
|
+
return typeof selected === "string" ? selected : "";
|
|
2537
2921
|
}
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
var getBlockTextValue = (block, locale = "en") => {
|
|
2543
|
-
if (!block || block.value === null || block.value === void 0) return "";
|
|
2544
|
-
const blockType = block.type;
|
|
2545
|
-
if (blockType === "localized_text" || blockType === "markdown") {
|
|
2546
|
-
if (typeof block.value === "object" && block.value !== null) {
|
|
2547
|
-
return block.value[locale] ?? block.value["en"] ?? "";
|
|
2548
|
-
}
|
|
2922
|
+
function unwrapBlock(value, locale) {
|
|
2923
|
+
if (!isBlock(value)) return value;
|
|
2924
|
+
if (value.type === "localized_text" || value.type === "markdown") {
|
|
2925
|
+
return localizedValue(value.value, locale);
|
|
2549
2926
|
}
|
|
2550
|
-
if (
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
if (block.type === "array" && Array.isArray(block.value)) {
|
|
2557
|
-
return block.value;
|
|
2558
|
-
}
|
|
2559
|
-
return [];
|
|
2560
|
-
};
|
|
2561
|
-
function unwrapBlock(block, locale) {
|
|
2562
|
-
if (!block?.type || block.value === void 0) return block;
|
|
2563
|
-
const blockType = block.type;
|
|
2564
|
-
if (blockType === "array") {
|
|
2565
|
-
return block.value.map((obj) => {
|
|
2566
|
-
const parsed = {};
|
|
2567
|
-
for (const [k, v] of Object.entries(obj)) {
|
|
2568
|
-
parsed[k] = unwrapBlock(v, locale);
|
|
2927
|
+
if (value.type === "array") {
|
|
2928
|
+
if (!Array.isArray(value.value)) return [];
|
|
2929
|
+
return value.value.map((item) => {
|
|
2930
|
+
if (isBlock(item)) return unwrapBlock(item, locale);
|
|
2931
|
+
if (isRecord2(item) && Array.isArray(item.value)) {
|
|
2932
|
+
return recordFromBlocks(item.value, locale);
|
|
2569
2933
|
}
|
|
2570
|
-
return
|
|
2934
|
+
if (!isRecord2(item)) return item;
|
|
2935
|
+
return Object.fromEntries(
|
|
2936
|
+
Object.entries(item).map(([key, nested]) => [key, unwrapBlock(nested, locale)])
|
|
2937
|
+
);
|
|
2571
2938
|
});
|
|
2572
2939
|
}
|
|
2573
|
-
if (
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2940
|
+
if (value.type === "object") {
|
|
2941
|
+
if (Array.isArray(value.value)) return recordFromBlocks(value.value, locale);
|
|
2942
|
+
if (!isRecord2(value.value)) return {};
|
|
2943
|
+
return Object.fromEntries(
|
|
2944
|
+
Object.entries(value.value).map(([key, nested]) => [key, unwrapBlock(nested, locale)])
|
|
2945
|
+
);
|
|
2579
2946
|
}
|
|
2580
|
-
|
|
2581
|
-
|
|
2947
|
+
return value.value;
|
|
2948
|
+
}
|
|
2949
|
+
function blockContentArray(values, locale) {
|
|
2950
|
+
const blocks = values.filter(isBlock);
|
|
2951
|
+
if (blocks.length === 0) return [];
|
|
2952
|
+
if (blocks.every((block) => block.key === blocks[0].key)) {
|
|
2953
|
+
return blocks.map((block) => blockContentValue(block, locale));
|
|
2582
2954
|
}
|
|
2583
|
-
return
|
|
2955
|
+
return Object.fromEntries(
|
|
2956
|
+
blocks.map((block) => [block.key, blockContentValue(block, locale)])
|
|
2957
|
+
);
|
|
2584
2958
|
}
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
};
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
return acc;
|
|
2603
|
-
}, {});
|
|
2959
|
+
function blockContentValue(block, locale) {
|
|
2960
|
+
if (block.type === "localized_text" || block.type === "markdown") {
|
|
2961
|
+
return localizedValue(block.value, locale);
|
|
2962
|
+
}
|
|
2963
|
+
if (block.type === "media") return block.value ?? null;
|
|
2964
|
+
if (block.type === "array") {
|
|
2965
|
+
return Array.isArray(block.value) ? blockContentArray(block.value, locale) : [];
|
|
2966
|
+
}
|
|
2967
|
+
if (block.type === "object") {
|
|
2968
|
+
if (Array.isArray(block.value)) return blockContentArray(block.value, locale);
|
|
2969
|
+
if (!isRecord2(block.value)) return {};
|
|
2970
|
+
return Object.fromEntries(
|
|
2971
|
+
Object.entries(block.value).map(([key, value]) => [
|
|
2972
|
+
key,
|
|
2973
|
+
isBlock(value) ? blockContentValue(value, locale) : value
|
|
2974
|
+
])
|
|
2975
|
+
);
|
|
2604
2976
|
}
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2977
|
+
return block.value;
|
|
2978
|
+
}
|
|
2979
|
+
function findBlock(entry, key) {
|
|
2980
|
+
return entry?.blocks?.find((block) => block.key === key);
|
|
2981
|
+
}
|
|
2982
|
+
function getBlockLabel(block) {
|
|
2983
|
+
return block?.key.replace(/_/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase()) ?? "";
|
|
2984
|
+
}
|
|
2985
|
+
function formatBlockValue(block) {
|
|
2986
|
+
if (block?.value === null || block?.value === void 0) return "";
|
|
2987
|
+
if (block.type === "boolean") return block.value ? "Yes" : "No";
|
|
2988
|
+
if (block.type === "number") {
|
|
2989
|
+
const properties = isRecord2(block.properties) ? block.properties : {};
|
|
2990
|
+
if (properties.variant === "DATE" || properties.variant === "DATE_TIME") {
|
|
2991
|
+
return new Date(Number(block.value)).toLocaleDateString();
|
|
2609
2992
|
}
|
|
2610
|
-
return result;
|
|
2611
2993
|
}
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
if (!imageBlock) return null;
|
|
2616
|
-
if (imageBlock.type === "media") {
|
|
2617
|
-
const mediaValue = imageBlock.value;
|
|
2618
|
-
return mediaValue?.resolutions?.original?.url || mediaValue?.url || null;
|
|
2994
|
+
if (block.type === "media" && isRecord2(block.value)) {
|
|
2995
|
+
const label = block.value.name ?? block.value.title ?? block.value.id;
|
|
2996
|
+
return typeof label === "string" ? label : "";
|
|
2619
2997
|
}
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2998
|
+
return String(block.value);
|
|
2999
|
+
}
|
|
3000
|
+
function prepareBlocksForSubmission(formData, blockTypes = {}) {
|
|
3001
|
+
return Object.entries(formData).filter(([, value]) => value !== null && value !== void 0).map(([key, value]) => ({
|
|
3002
|
+
key,
|
|
3003
|
+
value: blockTypes[key] === "array" && !Array.isArray(value) ? [value] : value
|
|
3004
|
+
}));
|
|
3005
|
+
}
|
|
3006
|
+
function extractBlockValues(blocks) {
|
|
3007
|
+
return Object.fromEntries(blocks.map((block) => [block.key, block.value ?? null]));
|
|
3008
|
+
}
|
|
3009
|
+
function getBlockValue(entry, key) {
|
|
3010
|
+
return findBlock(entry, key)?.value ?? null;
|
|
3011
|
+
}
|
|
3012
|
+
function getBlockTextValue(block, locale = "en") {
|
|
3013
|
+
if (!block || block.value === null || block.value === void 0) return "";
|
|
3014
|
+
if (block.type === "localized_text" || block.type === "markdown") {
|
|
3015
|
+
return localizedValue(block.value, locale);
|
|
2623
3016
|
}
|
|
2624
|
-
return
|
|
2625
|
-
}
|
|
3017
|
+
return typeof block.value === "string" ? block.value : String(block.value);
|
|
3018
|
+
}
|
|
3019
|
+
function getBlockContentValue(entry, key, locale = "en") {
|
|
3020
|
+
const block = findBlock(entry, key);
|
|
3021
|
+
return block ? blockContentValue(block, locale) : null;
|
|
3022
|
+
}
|
|
3023
|
+
function getBlockValues(entry, key) {
|
|
3024
|
+
const block = findBlock(entry, key);
|
|
3025
|
+
return block?.type === "array" && Array.isArray(block.value) ? block.value : [];
|
|
3026
|
+
}
|
|
3027
|
+
function getBlockObjectValues(entry, key, locale = "en") {
|
|
3028
|
+
return getBlockValues(entry, key).map((value) => {
|
|
3029
|
+
if (isRecord2(value) && Array.isArray(value.value)) {
|
|
3030
|
+
return recordFromBlocks(value.value, locale);
|
|
3031
|
+
}
|
|
3032
|
+
return isRecord2(value) ? Object.fromEntries(
|
|
3033
|
+
Object.entries(value).map(([field, nested]) => [field, unwrapBlock(nested, locale)])
|
|
3034
|
+
) : {};
|
|
3035
|
+
});
|
|
3036
|
+
}
|
|
3037
|
+
function getBlockFromArray(entry, key, locale = "en") {
|
|
3038
|
+
const block = findBlock(entry, key);
|
|
3039
|
+
if (!block) return {};
|
|
3040
|
+
const value = unwrapBlock(block, locale);
|
|
3041
|
+
if (isRecord2(value)) return value;
|
|
3042
|
+
if (Array.isArray(block.value)) return recordFromBlocks(block.value, locale);
|
|
3043
|
+
return { [block.key]: value };
|
|
3044
|
+
}
|
|
3045
|
+
function nestedUrl(value) {
|
|
3046
|
+
const resolutions = isRecord2(value.resolutions) ? value.resolutions : null;
|
|
3047
|
+
const original = resolutions && isRecord2(resolutions.original) ? resolutions.original : null;
|
|
3048
|
+
if (typeof original?.url === "string") return original.url;
|
|
3049
|
+
return typeof value.url === "string" ? value.url : null;
|
|
3050
|
+
}
|
|
3051
|
+
function getImageUrl(value, isBlock2 = true) {
|
|
3052
|
+
if (typeof value === "string") return value;
|
|
3053
|
+
if (!isRecord2(value)) return null;
|
|
3054
|
+
if (value.type === "media" && isRecord2(value.value)) return nestedUrl(value.value);
|
|
3055
|
+
if (isBlock2 && typeof value.url === "string") return value.url;
|
|
3056
|
+
return nestedUrl(value);
|
|
3057
|
+
}
|
|
2626
3058
|
|
|
2627
3059
|
// src/utils/price.ts
|
|
3060
|
+
var SUPPORTED_STORE_CURRENCIES = Object.freeze([
|
|
3061
|
+
"USD",
|
|
3062
|
+
"EUR",
|
|
3063
|
+
"GBP",
|
|
3064
|
+
"JPY",
|
|
3065
|
+
"CNY",
|
|
3066
|
+
"CHF",
|
|
3067
|
+
"AUD",
|
|
3068
|
+
"CAD",
|
|
3069
|
+
"HKD",
|
|
3070
|
+
"SGD",
|
|
3071
|
+
"NZD",
|
|
3072
|
+
"KRW",
|
|
3073
|
+
"SEK",
|
|
3074
|
+
"NOK",
|
|
3075
|
+
"DKK",
|
|
3076
|
+
"INR",
|
|
3077
|
+
"MXN",
|
|
3078
|
+
"BRL",
|
|
3079
|
+
"ZAR",
|
|
3080
|
+
"RUB",
|
|
3081
|
+
"TRY",
|
|
3082
|
+
"PLN",
|
|
3083
|
+
"THB",
|
|
3084
|
+
"IDR",
|
|
3085
|
+
"MYR",
|
|
3086
|
+
"PHP",
|
|
3087
|
+
"CZK",
|
|
3088
|
+
"ILS",
|
|
3089
|
+
"AED",
|
|
3090
|
+
"SAR",
|
|
3091
|
+
"HUF",
|
|
3092
|
+
"RON",
|
|
3093
|
+
"BGN",
|
|
3094
|
+
"HRK",
|
|
3095
|
+
"BAM",
|
|
3096
|
+
"RSD",
|
|
3097
|
+
"MKD",
|
|
3098
|
+
"ALL"
|
|
3099
|
+
]);
|
|
3100
|
+
var SUPPORTED_STORE_CURRENCY_SET = Object.freeze(
|
|
3101
|
+
new Set(SUPPORTED_STORE_CURRENCIES)
|
|
3102
|
+
);
|
|
3103
|
+
var ZERO_MINOR_UNIT_STORE_CURRENCIES = Object.freeze(
|
|
3104
|
+
/* @__PURE__ */ new Set(["JPY", "KRW"])
|
|
3105
|
+
);
|
|
2628
3106
|
function formatCurrency(amount, currencyCode, locale = "en") {
|
|
2629
|
-
|
|
3107
|
+
const normalized = currencyCode.trim().toUpperCase();
|
|
3108
|
+
if (!normalized) return "";
|
|
3109
|
+
const minorUnits = getCurrencyMinorUnits(normalized);
|
|
2630
3110
|
return new Intl.NumberFormat(locale, {
|
|
2631
3111
|
style: "currency",
|
|
2632
|
-
currency:
|
|
3112
|
+
currency: normalized,
|
|
3113
|
+
minimumFractionDigits: minorUnits,
|
|
3114
|
+
maximumFractionDigits: minorUnits
|
|
2633
3115
|
}).format(amount);
|
|
2634
3116
|
}
|
|
2635
|
-
function
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
currency: currency.toUpperCase()
|
|
2640
|
-
});
|
|
2641
|
-
const parts = formatter.formatToParts(1.11);
|
|
2642
|
-
const fractionPart = parts.find((p) => p.type === "fraction");
|
|
2643
|
-
return fractionPart?.value.length ?? 2;
|
|
2644
|
-
} catch {
|
|
2645
|
-
return 2;
|
|
3117
|
+
function getCurrencyMinorUnits(currency) {
|
|
3118
|
+
const normalized = currency.trim().toUpperCase();
|
|
3119
|
+
if (!SUPPORTED_STORE_CURRENCY_SET.has(normalized)) {
|
|
3120
|
+
throw new RangeError(`Unsupported currency '${currency}'`);
|
|
2646
3121
|
}
|
|
3122
|
+
return ZERO_MINOR_UNIT_STORE_CURRENCIES.has(normalized) ? 0 : 2;
|
|
2647
3123
|
}
|
|
2648
3124
|
function convertToMajor(minorAmount, currency) {
|
|
2649
|
-
const units =
|
|
3125
|
+
const units = getCurrencyMinorUnits(currency);
|
|
2650
3126
|
return minorAmount / Math.pow(10, units);
|
|
2651
3127
|
}
|
|
2652
3128
|
function getCurrencySymbol(currency) {
|
|
@@ -2668,22 +3144,24 @@ function getCurrencyName(currency) {
|
|
|
2668
3144
|
}
|
|
2669
3145
|
}
|
|
2670
3146
|
function formatMinor(amountMinor, currency) {
|
|
2671
|
-
if (!
|
|
3147
|
+
if (!Number.isSafeInteger(amountMinor)) {
|
|
3148
|
+
throw new RangeError("Minor-unit amount must be a safe integer");
|
|
3149
|
+
}
|
|
2672
3150
|
return formatCurrency(convertToMajor(amountMinor, currency), currency);
|
|
2673
3151
|
}
|
|
2674
3152
|
function formatPayment(payment) {
|
|
2675
3153
|
return formatMinor(payment.total, payment.currency);
|
|
2676
3154
|
}
|
|
2677
3155
|
function formatPrice(prices, marketId) {
|
|
2678
|
-
if (!prices || prices.length === 0) return "";
|
|
2679
|
-
const price =
|
|
2680
|
-
if (!price) return "";
|
|
3156
|
+
if (!prices || prices.length === 0 || !marketId) return "";
|
|
3157
|
+
const price = prices.find((p) => p.market === marketId);
|
|
3158
|
+
if (!price || !Number.isSafeInteger(price.amount) || price.amount < 0 || !price.currency) return "";
|
|
2681
3159
|
return formatMinor(price.amount, price.currency);
|
|
2682
3160
|
}
|
|
2683
3161
|
function getPriceAmount(prices, marketId) {
|
|
2684
|
-
if (!prices || prices.length === 0) return
|
|
2685
|
-
const price = prices.find((p) => p.market === marketId)
|
|
2686
|
-
return price
|
|
3162
|
+
if (!prices || prices.length === 0 || !marketId) return null;
|
|
3163
|
+
const price = prices.find((p) => p.market === marketId);
|
|
3164
|
+
return price && Number.isSafeInteger(price.amount) && price.amount >= 0 ? price.amount : null;
|
|
2687
3165
|
}
|
|
2688
3166
|
|
|
2689
3167
|
// src/utils/validation.ts
|
|
@@ -2784,6 +3262,7 @@ function formatDate(date, locale) {
|
|
|
2784
3262
|
async function fetchSvgContent(mediaObject) {
|
|
2785
3263
|
if (!mediaObject) return null;
|
|
2786
3264
|
const svgUrl = getImageUrl(mediaObject, false);
|
|
3265
|
+
if (!svgUrl) return null;
|
|
2787
3266
|
try {
|
|
2788
3267
|
const response = await fetch(svgUrl);
|
|
2789
3268
|
if (!response.ok) {
|
|
@@ -2876,9 +3355,10 @@ function getFirstAvailableFCId(variant, quantity = 1) {
|
|
|
2876
3355
|
// src/index.ts
|
|
2877
3356
|
function createUtilitySurface(apiConfig) {
|
|
2878
3357
|
return {
|
|
2879
|
-
getImageUrl: (imageBlock,
|
|
3358
|
+
getImageUrl: (imageBlock, isBlock2 = true) => getImageUrl(imageBlock, isBlock2),
|
|
2880
3359
|
getBlockValue,
|
|
2881
3360
|
getBlockTextValue,
|
|
3361
|
+
getBlockContentValue,
|
|
2882
3362
|
getBlockValues,
|
|
2883
3363
|
getBlockLabel,
|
|
2884
3364
|
getBlockObjectValues,
|
|
@@ -3029,10 +3509,11 @@ function createAdmin(config) {
|
|
|
3029
3509
|
trigger: workflowApi.triggerWorkflow,
|
|
3030
3510
|
getExecutions: workflowApi.getWorkflowExecutions,
|
|
3031
3511
|
getExecution: workflowApi.getWorkflowExecution,
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3512
|
+
listEffects: workflowApi.getWorkflowEffects,
|
|
3513
|
+
getEffect: workflowApi.getWorkflowEffect,
|
|
3514
|
+
listConnections: workflowApi.getWorkflowConnections,
|
|
3515
|
+
getConnectionConnectUrl: workflowApi.getWorkflowConnectionConnectUrl,
|
|
3516
|
+
deleteConnection: workflowApi.deleteWorkflowConnection
|
|
3036
3517
|
};
|
|
3037
3518
|
const formApi = createFormApi(apiConfig);
|
|
3038
3519
|
const taxonomyApi = createTaxonomyApi(apiConfig);
|
|
@@ -3045,22 +3526,43 @@ function createAdmin(config) {
|
|
|
3045
3526
|
delete: accountApi.deleteAccount,
|
|
3046
3527
|
getMe: accountApi.getMe,
|
|
3047
3528
|
search: accountApi.searchAccounts,
|
|
3529
|
+
apiToken: {
|
|
3530
|
+
list: accountApi.listApiTokens,
|
|
3531
|
+
create: accountApi.createApiToken,
|
|
3532
|
+
update: accountApi.updateApiToken,
|
|
3533
|
+
revoke: accountApi.revokeApiToken
|
|
3534
|
+
},
|
|
3535
|
+
session: {
|
|
3536
|
+
list: accountApi.listSessions,
|
|
3537
|
+
revoke: accountApi.revokeSession
|
|
3538
|
+
},
|
|
3048
3539
|
auth: authApi
|
|
3049
3540
|
},
|
|
3050
3541
|
store: {
|
|
3051
3542
|
create: storeApi.createStore,
|
|
3052
3543
|
update: storeApi.updateStore,
|
|
3053
|
-
delete: storeApi.deleteStore,
|
|
3054
3544
|
get: storeApi.getStore,
|
|
3055
3545
|
find: storeApi.getStores,
|
|
3056
3546
|
subscription: {
|
|
3547
|
+
get: storeApi.getSubscription,
|
|
3057
3548
|
getPlans: storeApi.getSubscriptionPlans,
|
|
3058
|
-
|
|
3549
|
+
action: {
|
|
3550
|
+
create: storeApi.createSubscriptionAction,
|
|
3551
|
+
find: storeApi.findSubscriptionActions,
|
|
3552
|
+
get: storeApi.getSubscriptionAction,
|
|
3553
|
+
retry: storeApi.retrySubscriptionAction,
|
|
3554
|
+
effect: {
|
|
3555
|
+
find: storeApi.findSubscriptionActionEffects,
|
|
3556
|
+
get: storeApi.getSubscriptionActionEffect
|
|
3557
|
+
}
|
|
3558
|
+
},
|
|
3059
3559
|
createPortalSession: storeApi.createPortalSession
|
|
3060
3560
|
},
|
|
3061
3561
|
member: {
|
|
3062
3562
|
add: storeApi.addMember,
|
|
3063
3563
|
invite: storeApi.inviteUser,
|
|
3564
|
+
find: storeApi.findMembers,
|
|
3565
|
+
findOwn: storeApi.findOwnMemberships,
|
|
3064
3566
|
remove: storeApi.removeMember
|
|
3065
3567
|
},
|
|
3066
3568
|
buildHook: {
|
|
@@ -3077,10 +3579,7 @@ function createAdmin(config) {
|
|
|
3077
3579
|
delete: storeApi.deleteWebhook
|
|
3078
3580
|
},
|
|
3079
3581
|
config: {
|
|
3080
|
-
|
|
3081
|
-
},
|
|
3082
|
-
media: {
|
|
3083
|
-
find: storeApi.getStoreMedia
|
|
3582
|
+
getPayment: storeApi.getPaymentConfig
|
|
3084
3583
|
},
|
|
3085
3584
|
location: locationApi,
|
|
3086
3585
|
market: marketApi,
|
|
@@ -3089,22 +3588,21 @@ function createAdmin(config) {
|
|
|
3089
3588
|
media: createMediaApi(apiConfig),
|
|
3090
3589
|
notification: {
|
|
3091
3590
|
email: {
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
send: notificationApi.trigger
|
|
3591
|
+
send: notificationApi.sendEmail,
|
|
3592
|
+
getDelivery: notificationApi.getEmailDelivery,
|
|
3593
|
+
retryDelivery: notificationApi.retryEmailDelivery
|
|
3096
3594
|
},
|
|
3097
3595
|
mailbox: crmApi.mailbox
|
|
3098
3596
|
},
|
|
3099
3597
|
platform: platformApi,
|
|
3100
3598
|
social: {
|
|
3101
|
-
|
|
3599
|
+
connection: {
|
|
3102
3600
|
getCapabilities: socialApi.getCapabilities,
|
|
3103
|
-
list: socialApi.
|
|
3601
|
+
list: socialApi.listConnections,
|
|
3104
3602
|
connect: socialApi.connect,
|
|
3105
3603
|
getOAuthAttempt: socialApi.getOAuthAttempt,
|
|
3106
3604
|
selectDestination: socialApi.selectDestination,
|
|
3107
|
-
delete: socialApi.
|
|
3605
|
+
delete: socialApi.deleteConnection
|
|
3108
3606
|
},
|
|
3109
3607
|
publication: {
|
|
3110
3608
|
create: socialApi.createPublication,
|
|
@@ -3120,7 +3618,16 @@ function createAdmin(config) {
|
|
|
3120
3618
|
syncCommentThread: socialApi.syncPublicationCommentThread,
|
|
3121
3619
|
findComments: socialApi.findPublicationComments,
|
|
3122
3620
|
classifyComments: socialApi.classifyPublicationComments,
|
|
3123
|
-
|
|
3621
|
+
commentReply: {
|
|
3622
|
+
create: socialApi.createCommentReply,
|
|
3623
|
+
list: socialApi.listCommentReplies,
|
|
3624
|
+
get: socialApi.getCommentReply,
|
|
3625
|
+
retry: socialApi.retryCommentReply
|
|
3626
|
+
},
|
|
3627
|
+
effect: {
|
|
3628
|
+
list: socialApi.listPublicationEffects,
|
|
3629
|
+
get: socialApi.getPublicationEffect
|
|
3630
|
+
},
|
|
3124
3631
|
getMetrics: socialApi.getPublicationMetrics,
|
|
3125
3632
|
syncMetrics: socialApi.syncPublicationMetrics,
|
|
3126
3633
|
syncEngagement: socialApi.syncEngagement
|
|
@@ -3182,11 +3689,43 @@ function createAdmin(config) {
|
|
|
3182
3689
|
get: eshopApi.getOrder,
|
|
3183
3690
|
find: eshopApi.getOrders,
|
|
3184
3691
|
getQuote: eshopApi.getQuote,
|
|
3185
|
-
|
|
3692
|
+
createRefund: eshopApi.createRefund,
|
|
3693
|
+
getRefund: eshopApi.getRefund,
|
|
3694
|
+
getRefunds: eshopApi.getRefunds,
|
|
3695
|
+
retryRefund: eshopApi.retryRefund,
|
|
3696
|
+
getPayment: eshopApi.getPayment,
|
|
3697
|
+
retryPaymentTransaction: eshopApi.retryPaymentTransaction,
|
|
3698
|
+
getPaymentTransactions: eshopApi.getPaymentTransactions,
|
|
3699
|
+
getPaymentTransaction: eshopApi.getPaymentTransaction,
|
|
3700
|
+
findDigitalAccess: eshopApi.findDigitalAccess,
|
|
3701
|
+
getDigitalAccess: eshopApi.getDigitalAccess,
|
|
3186
3702
|
downloadDigitalAccess: eshopApi.downloadDigitalAccess,
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3703
|
+
activateDigitalAccess: eshopApi.activateDigitalAccess,
|
|
3704
|
+
revokeDigitalAccess: eshopApi.revokeDigitalAccess
|
|
3705
|
+
},
|
|
3706
|
+
shipment: {
|
|
3707
|
+
getRates: shippingApi.getRates,
|
|
3708
|
+
create: shippingApi.createShipment,
|
|
3709
|
+
get: shippingApi.getShipment,
|
|
3710
|
+
find: shippingApi.findShipments,
|
|
3711
|
+
retry: shippingApi.retryShipment,
|
|
3712
|
+
fulfillment: {
|
|
3713
|
+
find: shippingApi.findFulfillmentOrders,
|
|
3714
|
+
get: shippingApi.getFulfillmentOrder
|
|
3715
|
+
},
|
|
3716
|
+
refund: {
|
|
3717
|
+
request: shippingApi.requestRefund,
|
|
3718
|
+
get: shippingApi.getRefund,
|
|
3719
|
+
find: shippingApi.findRefunds,
|
|
3720
|
+
retry: shippingApi.retryRefund
|
|
3721
|
+
},
|
|
3722
|
+
adjustment: {
|
|
3723
|
+
find: shippingApi.findAdjustments
|
|
3724
|
+
},
|
|
3725
|
+
settlement: {
|
|
3726
|
+
find: shippingApi.findSettlements,
|
|
3727
|
+
retry: shippingApi.retrySettlement
|
|
3728
|
+
}
|
|
3190
3729
|
},
|
|
3191
3730
|
cart: {
|
|
3192
3731
|
create: eshopApi.createCart,
|
|
@@ -3228,8 +3767,9 @@ function createAdmin(config) {
|
|
|
3228
3767
|
update: crmApi.update,
|
|
3229
3768
|
merge: crmApi.merge,
|
|
3230
3769
|
import: crmApi.import,
|
|
3231
|
-
|
|
3232
|
-
|
|
3770
|
+
findSessions: crmApi.findSessions,
|
|
3771
|
+
revokeSession: crmApi.revokeSession,
|
|
3772
|
+
revokeAllSessions: crmApi.revokeAllSessions
|
|
3233
3773
|
},
|
|
3234
3774
|
contactList: {
|
|
3235
3775
|
create: crmApi.contactList.create,
|
|
@@ -3241,7 +3781,14 @@ function createAdmin(config) {
|
|
|
3241
3781
|
addMember: crmApi.contactList.members.add,
|
|
3242
3782
|
updateMember: crmApi.contactList.members.update,
|
|
3243
3783
|
removeMember: crmApi.contactList.members.remove,
|
|
3244
|
-
findMembers: crmApi.contactList.members.find
|
|
3784
|
+
findMembers: crmApi.contactList.members.find,
|
|
3785
|
+
plans: crmApi.contactList.plans,
|
|
3786
|
+
memberships: {
|
|
3787
|
+
refund: crmApi.contactList.memberships.refund,
|
|
3788
|
+
paymentAttempts: crmApi.contactList.memberships.paymentAttempts,
|
|
3789
|
+
refunds: crmApi.contactList.memberships.refunds,
|
|
3790
|
+
cancellations: crmApi.contactList.memberships.cancellations
|
|
3791
|
+
}
|
|
3245
3792
|
},
|
|
3246
3793
|
action: crmApi.action
|
|
3247
3794
|
},
|