@lodashventure/medusa-membership 0.0.8 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.medusa/server/src/admin/index.js +19 -1170
- package/.medusa/server/src/admin/index.mjs +18 -1170
- package/.medusa/server/src/api/middlewares/consent.js +19 -1
- package/.medusa/server/src/api/middlewares/member-tiers.js +5 -1
- package/.medusa/server/src/api/middlewares/notifications.js +22 -1
- package/.medusa/server/src/api/store/customers/me/consents/[keyId]/route.js +98 -12
- package/.medusa/server/src/api/store/customers/me/consents/route.js +31 -8
- package/.medusa/server/src/api/store/customers/me/consents/settings/route.js +110 -0
- package/.medusa/server/src/api/store/customers/me/notifications/settings/route.js +105 -0
- package/.medusa/server/src/workflows/membership-consent/consent-update-notification.js +62 -0
- package/.medusa/server/src/workflows/membership-consent/retrieve-membership-consent.js +5 -8
- package/package.json +8 -4
- package/.medusa/server/src/api/store/customers/me/notifications/[key]/route.js +0 -21
- package/.medusa/server/src/api/store/promotion-codes/route.js +0 -66
|
@@ -1,1163 +1,11 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { defineWidgetConfig, defineRouteConfig } from "@medusajs/admin-sdk";
|
|
3
3
|
import { toast, Container, Heading, Switch, Label, Text, Input, Button, createDataTableColumnHelper, usePrompt, useDataTable, DataTable, Drawer, Textarea } from "@medusajs/ui";
|
|
4
|
+
import axios from "axios";
|
|
4
5
|
import { useQuery, useQueryClient, useMutation } from "@tanstack/react-query";
|
|
5
6
|
import Medusa from "@medusajs/js-sdk";
|
|
6
7
|
import { Users } from "@medusajs/icons";
|
|
7
8
|
import { useState, useEffect } from "react";
|
|
8
|
-
function getDefaultExportFromCjs(x) {
|
|
9
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
10
|
-
}
|
|
11
|
-
var axios$3 = { exports: {} };
|
|
12
|
-
var bind$2 = function bind(fn, thisArg) {
|
|
13
|
-
return function wrap() {
|
|
14
|
-
var args = new Array(arguments.length);
|
|
15
|
-
for (var i = 0; i < args.length; i++) {
|
|
16
|
-
args[i] = arguments[i];
|
|
17
|
-
}
|
|
18
|
-
return fn.apply(thisArg, args);
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
var bind$1 = bind$2;
|
|
22
|
-
var toString = Object.prototype.toString;
|
|
23
|
-
function isArray(val) {
|
|
24
|
-
return toString.call(val) === "[object Array]";
|
|
25
|
-
}
|
|
26
|
-
function isUndefined(val) {
|
|
27
|
-
return typeof val === "undefined";
|
|
28
|
-
}
|
|
29
|
-
function isBuffer(val) {
|
|
30
|
-
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && typeof val.constructor.isBuffer === "function" && val.constructor.isBuffer(val);
|
|
31
|
-
}
|
|
32
|
-
function isArrayBuffer(val) {
|
|
33
|
-
return toString.call(val) === "[object ArrayBuffer]";
|
|
34
|
-
}
|
|
35
|
-
function isFormData(val) {
|
|
36
|
-
return typeof FormData !== "undefined" && val instanceof FormData;
|
|
37
|
-
}
|
|
38
|
-
function isArrayBufferView(val) {
|
|
39
|
-
var result;
|
|
40
|
-
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
41
|
-
result = ArrayBuffer.isView(val);
|
|
42
|
-
} else {
|
|
43
|
-
result = val && val.buffer && val.buffer instanceof ArrayBuffer;
|
|
44
|
-
}
|
|
45
|
-
return result;
|
|
46
|
-
}
|
|
47
|
-
function isString(val) {
|
|
48
|
-
return typeof val === "string";
|
|
49
|
-
}
|
|
50
|
-
function isNumber(val) {
|
|
51
|
-
return typeof val === "number";
|
|
52
|
-
}
|
|
53
|
-
function isObject(val) {
|
|
54
|
-
return val !== null && typeof val === "object";
|
|
55
|
-
}
|
|
56
|
-
function isPlainObject(val) {
|
|
57
|
-
if (toString.call(val) !== "[object Object]") {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
var prototype = Object.getPrototypeOf(val);
|
|
61
|
-
return prototype === null || prototype === Object.prototype;
|
|
62
|
-
}
|
|
63
|
-
function isDate(val) {
|
|
64
|
-
return toString.call(val) === "[object Date]";
|
|
65
|
-
}
|
|
66
|
-
function isFile(val) {
|
|
67
|
-
return toString.call(val) === "[object File]";
|
|
68
|
-
}
|
|
69
|
-
function isBlob(val) {
|
|
70
|
-
return toString.call(val) === "[object Blob]";
|
|
71
|
-
}
|
|
72
|
-
function isFunction(val) {
|
|
73
|
-
return toString.call(val) === "[object Function]";
|
|
74
|
-
}
|
|
75
|
-
function isStream(val) {
|
|
76
|
-
return isObject(val) && isFunction(val.pipe);
|
|
77
|
-
}
|
|
78
|
-
function isURLSearchParams(val) {
|
|
79
|
-
return typeof URLSearchParams !== "undefined" && val instanceof URLSearchParams;
|
|
80
|
-
}
|
|
81
|
-
function trim(str) {
|
|
82
|
-
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "");
|
|
83
|
-
}
|
|
84
|
-
function isStandardBrowserEnv() {
|
|
85
|
-
if (typeof navigator !== "undefined" && (navigator.product === "ReactNative" || navigator.product === "NativeScript" || navigator.product === "NS")) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
89
|
-
}
|
|
90
|
-
function forEach(obj, fn) {
|
|
91
|
-
if (obj === null || typeof obj === "undefined") {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
if (typeof obj !== "object") {
|
|
95
|
-
obj = [obj];
|
|
96
|
-
}
|
|
97
|
-
if (isArray(obj)) {
|
|
98
|
-
for (var i = 0, l = obj.length; i < l; i++) {
|
|
99
|
-
fn.call(null, obj[i], i, obj);
|
|
100
|
-
}
|
|
101
|
-
} else {
|
|
102
|
-
for (var key in obj) {
|
|
103
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
104
|
-
fn.call(null, obj[key], key, obj);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function merge() {
|
|
110
|
-
var result = {};
|
|
111
|
-
function assignValue(val, key) {
|
|
112
|
-
if (isPlainObject(result[key]) && isPlainObject(val)) {
|
|
113
|
-
result[key] = merge(result[key], val);
|
|
114
|
-
} else if (isPlainObject(val)) {
|
|
115
|
-
result[key] = merge({}, val);
|
|
116
|
-
} else if (isArray(val)) {
|
|
117
|
-
result[key] = val.slice();
|
|
118
|
-
} else {
|
|
119
|
-
result[key] = val;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
123
|
-
forEach(arguments[i], assignValue);
|
|
124
|
-
}
|
|
125
|
-
return result;
|
|
126
|
-
}
|
|
127
|
-
function extend(a, b, thisArg) {
|
|
128
|
-
forEach(b, function assignValue(val, key) {
|
|
129
|
-
if (thisArg && typeof val === "function") {
|
|
130
|
-
a[key] = bind$1(val, thisArg);
|
|
131
|
-
} else {
|
|
132
|
-
a[key] = val;
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
return a;
|
|
136
|
-
}
|
|
137
|
-
function stripBOM(content) {
|
|
138
|
-
if (content.charCodeAt(0) === 65279) {
|
|
139
|
-
content = content.slice(1);
|
|
140
|
-
}
|
|
141
|
-
return content;
|
|
142
|
-
}
|
|
143
|
-
var utils$9 = {
|
|
144
|
-
isArray,
|
|
145
|
-
isArrayBuffer,
|
|
146
|
-
isBuffer,
|
|
147
|
-
isFormData,
|
|
148
|
-
isArrayBufferView,
|
|
149
|
-
isString,
|
|
150
|
-
isNumber,
|
|
151
|
-
isObject,
|
|
152
|
-
isPlainObject,
|
|
153
|
-
isUndefined,
|
|
154
|
-
isDate,
|
|
155
|
-
isFile,
|
|
156
|
-
isBlob,
|
|
157
|
-
isFunction,
|
|
158
|
-
isStream,
|
|
159
|
-
isURLSearchParams,
|
|
160
|
-
isStandardBrowserEnv,
|
|
161
|
-
forEach,
|
|
162
|
-
merge,
|
|
163
|
-
extend,
|
|
164
|
-
trim,
|
|
165
|
-
stripBOM
|
|
166
|
-
};
|
|
167
|
-
var utils$8 = utils$9;
|
|
168
|
-
function encode(val) {
|
|
169
|
-
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
170
|
-
}
|
|
171
|
-
var buildURL$1 = function buildURL(url, params, paramsSerializer) {
|
|
172
|
-
if (!params) {
|
|
173
|
-
return url;
|
|
174
|
-
}
|
|
175
|
-
var serializedParams;
|
|
176
|
-
if (paramsSerializer) {
|
|
177
|
-
serializedParams = paramsSerializer(params);
|
|
178
|
-
} else if (utils$8.isURLSearchParams(params)) {
|
|
179
|
-
serializedParams = params.toString();
|
|
180
|
-
} else {
|
|
181
|
-
var parts = [];
|
|
182
|
-
utils$8.forEach(params, function serialize(val, key) {
|
|
183
|
-
if (val === null || typeof val === "undefined") {
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
if (utils$8.isArray(val)) {
|
|
187
|
-
key = key + "[]";
|
|
188
|
-
} else {
|
|
189
|
-
val = [val];
|
|
190
|
-
}
|
|
191
|
-
utils$8.forEach(val, function parseValue(v) {
|
|
192
|
-
if (utils$8.isDate(v)) {
|
|
193
|
-
v = v.toISOString();
|
|
194
|
-
} else if (utils$8.isObject(v)) {
|
|
195
|
-
v = JSON.stringify(v);
|
|
196
|
-
}
|
|
197
|
-
parts.push(encode(key) + "=" + encode(v));
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
serializedParams = parts.join("&");
|
|
201
|
-
}
|
|
202
|
-
if (serializedParams) {
|
|
203
|
-
var hashmarkIndex = url.indexOf("#");
|
|
204
|
-
if (hashmarkIndex !== -1) {
|
|
205
|
-
url = url.slice(0, hashmarkIndex);
|
|
206
|
-
}
|
|
207
|
-
url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
|
|
208
|
-
}
|
|
209
|
-
return url;
|
|
210
|
-
};
|
|
211
|
-
var utils$7 = utils$9;
|
|
212
|
-
function InterceptorManager$1() {
|
|
213
|
-
this.handlers = [];
|
|
214
|
-
}
|
|
215
|
-
InterceptorManager$1.prototype.use = function use(fulfilled, rejected, options) {
|
|
216
|
-
this.handlers.push({
|
|
217
|
-
fulfilled,
|
|
218
|
-
rejected,
|
|
219
|
-
synchronous: options ? options.synchronous : false,
|
|
220
|
-
runWhen: options ? options.runWhen : null
|
|
221
|
-
});
|
|
222
|
-
return this.handlers.length - 1;
|
|
223
|
-
};
|
|
224
|
-
InterceptorManager$1.prototype.eject = function eject(id) {
|
|
225
|
-
if (this.handlers[id]) {
|
|
226
|
-
this.handlers[id] = null;
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
InterceptorManager$1.prototype.forEach = function forEach2(fn) {
|
|
230
|
-
utils$7.forEach(this.handlers, function forEachHandler(h) {
|
|
231
|
-
if (h !== null) {
|
|
232
|
-
fn(h);
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
};
|
|
236
|
-
var InterceptorManager_1 = InterceptorManager$1;
|
|
237
|
-
var utils$6 = utils$9;
|
|
238
|
-
var normalizeHeaderName$1 = function normalizeHeaderName(headers, normalizedName) {
|
|
239
|
-
utils$6.forEach(headers, function processHeader(value, name) {
|
|
240
|
-
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
|
|
241
|
-
headers[normalizedName] = value;
|
|
242
|
-
delete headers[name];
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
};
|
|
246
|
-
var enhanceError$1 = function enhanceError(error, config2, code, request2, response) {
|
|
247
|
-
error.config = config2;
|
|
248
|
-
if (code) {
|
|
249
|
-
error.code = code;
|
|
250
|
-
}
|
|
251
|
-
error.request = request2;
|
|
252
|
-
error.response = response;
|
|
253
|
-
error.isAxiosError = true;
|
|
254
|
-
error.toJSON = function toJSON() {
|
|
255
|
-
return {
|
|
256
|
-
// Standard
|
|
257
|
-
message: this.message,
|
|
258
|
-
name: this.name,
|
|
259
|
-
// Microsoft
|
|
260
|
-
description: this.description,
|
|
261
|
-
number: this.number,
|
|
262
|
-
// Mozilla
|
|
263
|
-
fileName: this.fileName,
|
|
264
|
-
lineNumber: this.lineNumber,
|
|
265
|
-
columnNumber: this.columnNumber,
|
|
266
|
-
stack: this.stack,
|
|
267
|
-
// Axios
|
|
268
|
-
config: this.config,
|
|
269
|
-
code: this.code
|
|
270
|
-
};
|
|
271
|
-
};
|
|
272
|
-
return error;
|
|
273
|
-
};
|
|
274
|
-
var createError;
|
|
275
|
-
var hasRequiredCreateError;
|
|
276
|
-
function requireCreateError() {
|
|
277
|
-
if (hasRequiredCreateError) return createError;
|
|
278
|
-
hasRequiredCreateError = 1;
|
|
279
|
-
var enhanceError3 = enhanceError$1;
|
|
280
|
-
createError = function createError2(message, config2, code, request2, response) {
|
|
281
|
-
var error = new Error(message);
|
|
282
|
-
return enhanceError3(error, config2, code, request2, response);
|
|
283
|
-
};
|
|
284
|
-
return createError;
|
|
285
|
-
}
|
|
286
|
-
var settle;
|
|
287
|
-
var hasRequiredSettle;
|
|
288
|
-
function requireSettle() {
|
|
289
|
-
if (hasRequiredSettle) return settle;
|
|
290
|
-
hasRequiredSettle = 1;
|
|
291
|
-
var createError2 = requireCreateError();
|
|
292
|
-
settle = function settle2(resolve, reject, response) {
|
|
293
|
-
var validateStatus2 = response.config.validateStatus;
|
|
294
|
-
if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
|
|
295
|
-
resolve(response);
|
|
296
|
-
} else {
|
|
297
|
-
reject(createError2(
|
|
298
|
-
"Request failed with status code " + response.status,
|
|
299
|
-
response.config,
|
|
300
|
-
null,
|
|
301
|
-
response.request,
|
|
302
|
-
response
|
|
303
|
-
));
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
|
-
return settle;
|
|
307
|
-
}
|
|
308
|
-
var cookies;
|
|
309
|
-
var hasRequiredCookies;
|
|
310
|
-
function requireCookies() {
|
|
311
|
-
if (hasRequiredCookies) return cookies;
|
|
312
|
-
hasRequiredCookies = 1;
|
|
313
|
-
var utils2 = utils$9;
|
|
314
|
-
cookies = utils2.isStandardBrowserEnv() ? (
|
|
315
|
-
// Standard browser envs support document.cookie
|
|
316
|
-
/* @__PURE__ */ function standardBrowserEnv() {
|
|
317
|
-
return {
|
|
318
|
-
write: function write(name, value, expires, path, domain, secure) {
|
|
319
|
-
var cookie = [];
|
|
320
|
-
cookie.push(name + "=" + encodeURIComponent(value));
|
|
321
|
-
if (utils2.isNumber(expires)) {
|
|
322
|
-
cookie.push("expires=" + new Date(expires).toGMTString());
|
|
323
|
-
}
|
|
324
|
-
if (utils2.isString(path)) {
|
|
325
|
-
cookie.push("path=" + path);
|
|
326
|
-
}
|
|
327
|
-
if (utils2.isString(domain)) {
|
|
328
|
-
cookie.push("domain=" + domain);
|
|
329
|
-
}
|
|
330
|
-
if (secure === true) {
|
|
331
|
-
cookie.push("secure");
|
|
332
|
-
}
|
|
333
|
-
document.cookie = cookie.join("; ");
|
|
334
|
-
},
|
|
335
|
-
read: function read(name) {
|
|
336
|
-
var match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
|
|
337
|
-
return match ? decodeURIComponent(match[3]) : null;
|
|
338
|
-
},
|
|
339
|
-
remove: function remove(name) {
|
|
340
|
-
this.write(name, "", Date.now() - 864e5);
|
|
341
|
-
}
|
|
342
|
-
};
|
|
343
|
-
}()
|
|
344
|
-
) : (
|
|
345
|
-
// Non standard browser env (web workers, react-native) lack needed support.
|
|
346
|
-
/* @__PURE__ */ function nonStandardBrowserEnv() {
|
|
347
|
-
return {
|
|
348
|
-
write: function write() {
|
|
349
|
-
},
|
|
350
|
-
read: function read() {
|
|
351
|
-
return null;
|
|
352
|
-
},
|
|
353
|
-
remove: function remove() {
|
|
354
|
-
}
|
|
355
|
-
};
|
|
356
|
-
}()
|
|
357
|
-
);
|
|
358
|
-
return cookies;
|
|
359
|
-
}
|
|
360
|
-
var isAbsoluteURL;
|
|
361
|
-
var hasRequiredIsAbsoluteURL;
|
|
362
|
-
function requireIsAbsoluteURL() {
|
|
363
|
-
if (hasRequiredIsAbsoluteURL) return isAbsoluteURL;
|
|
364
|
-
hasRequiredIsAbsoluteURL = 1;
|
|
365
|
-
isAbsoluteURL = function isAbsoluteURL2(url) {
|
|
366
|
-
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
|
367
|
-
};
|
|
368
|
-
return isAbsoluteURL;
|
|
369
|
-
}
|
|
370
|
-
var combineURLs;
|
|
371
|
-
var hasRequiredCombineURLs;
|
|
372
|
-
function requireCombineURLs() {
|
|
373
|
-
if (hasRequiredCombineURLs) return combineURLs;
|
|
374
|
-
hasRequiredCombineURLs = 1;
|
|
375
|
-
combineURLs = function combineURLs2(baseURL, relativeURL) {
|
|
376
|
-
return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
|
|
377
|
-
};
|
|
378
|
-
return combineURLs;
|
|
379
|
-
}
|
|
380
|
-
var buildFullPath;
|
|
381
|
-
var hasRequiredBuildFullPath;
|
|
382
|
-
function requireBuildFullPath() {
|
|
383
|
-
if (hasRequiredBuildFullPath) return buildFullPath;
|
|
384
|
-
hasRequiredBuildFullPath = 1;
|
|
385
|
-
var isAbsoluteURL2 = requireIsAbsoluteURL();
|
|
386
|
-
var combineURLs2 = requireCombineURLs();
|
|
387
|
-
buildFullPath = function buildFullPath2(baseURL, requestedURL) {
|
|
388
|
-
if (baseURL && !isAbsoluteURL2(requestedURL)) {
|
|
389
|
-
return combineURLs2(baseURL, requestedURL);
|
|
390
|
-
}
|
|
391
|
-
return requestedURL;
|
|
392
|
-
};
|
|
393
|
-
return buildFullPath;
|
|
394
|
-
}
|
|
395
|
-
var parseHeaders;
|
|
396
|
-
var hasRequiredParseHeaders;
|
|
397
|
-
function requireParseHeaders() {
|
|
398
|
-
if (hasRequiredParseHeaders) return parseHeaders;
|
|
399
|
-
hasRequiredParseHeaders = 1;
|
|
400
|
-
var utils2 = utils$9;
|
|
401
|
-
var ignoreDuplicateOf = [
|
|
402
|
-
"age",
|
|
403
|
-
"authorization",
|
|
404
|
-
"content-length",
|
|
405
|
-
"content-type",
|
|
406
|
-
"etag",
|
|
407
|
-
"expires",
|
|
408
|
-
"from",
|
|
409
|
-
"host",
|
|
410
|
-
"if-modified-since",
|
|
411
|
-
"if-unmodified-since",
|
|
412
|
-
"last-modified",
|
|
413
|
-
"location",
|
|
414
|
-
"max-forwards",
|
|
415
|
-
"proxy-authorization",
|
|
416
|
-
"referer",
|
|
417
|
-
"retry-after",
|
|
418
|
-
"user-agent"
|
|
419
|
-
];
|
|
420
|
-
parseHeaders = function parseHeaders2(headers) {
|
|
421
|
-
var parsed = {};
|
|
422
|
-
var key;
|
|
423
|
-
var val;
|
|
424
|
-
var i;
|
|
425
|
-
if (!headers) {
|
|
426
|
-
return parsed;
|
|
427
|
-
}
|
|
428
|
-
utils2.forEach(headers.split("\n"), function parser(line) {
|
|
429
|
-
i = line.indexOf(":");
|
|
430
|
-
key = utils2.trim(line.substr(0, i)).toLowerCase();
|
|
431
|
-
val = utils2.trim(line.substr(i + 1));
|
|
432
|
-
if (key) {
|
|
433
|
-
if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
|
|
434
|
-
return;
|
|
435
|
-
}
|
|
436
|
-
if (key === "set-cookie") {
|
|
437
|
-
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
|
|
438
|
-
} else {
|
|
439
|
-
parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
});
|
|
443
|
-
return parsed;
|
|
444
|
-
};
|
|
445
|
-
return parseHeaders;
|
|
446
|
-
}
|
|
447
|
-
var isURLSameOrigin;
|
|
448
|
-
var hasRequiredIsURLSameOrigin;
|
|
449
|
-
function requireIsURLSameOrigin() {
|
|
450
|
-
if (hasRequiredIsURLSameOrigin) return isURLSameOrigin;
|
|
451
|
-
hasRequiredIsURLSameOrigin = 1;
|
|
452
|
-
var utils2 = utils$9;
|
|
453
|
-
isURLSameOrigin = utils2.isStandardBrowserEnv() ? (
|
|
454
|
-
// Standard browser envs have full support of the APIs needed to test
|
|
455
|
-
// whether the request URL is of the same origin as current location.
|
|
456
|
-
function standardBrowserEnv() {
|
|
457
|
-
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
|
458
|
-
var urlParsingNode = document.createElement("a");
|
|
459
|
-
var originURL;
|
|
460
|
-
function resolveURL(url) {
|
|
461
|
-
var href = url;
|
|
462
|
-
if (msie) {
|
|
463
|
-
urlParsingNode.setAttribute("href", href);
|
|
464
|
-
href = urlParsingNode.href;
|
|
465
|
-
}
|
|
466
|
-
urlParsingNode.setAttribute("href", href);
|
|
467
|
-
return {
|
|
468
|
-
href: urlParsingNode.href,
|
|
469
|
-
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
|
|
470
|
-
host: urlParsingNode.host,
|
|
471
|
-
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
|
|
472
|
-
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
|
|
473
|
-
hostname: urlParsingNode.hostname,
|
|
474
|
-
port: urlParsingNode.port,
|
|
475
|
-
pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
|
|
476
|
-
};
|
|
477
|
-
}
|
|
478
|
-
originURL = resolveURL(window.location.href);
|
|
479
|
-
return function isURLSameOrigin2(requestURL) {
|
|
480
|
-
var parsed = utils2.isString(requestURL) ? resolveURL(requestURL) : requestURL;
|
|
481
|
-
return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
|
|
482
|
-
};
|
|
483
|
-
}()
|
|
484
|
-
) : (
|
|
485
|
-
// Non standard browser envs (web workers, react-native) lack needed support.
|
|
486
|
-
/* @__PURE__ */ function nonStandardBrowserEnv() {
|
|
487
|
-
return function isURLSameOrigin2() {
|
|
488
|
-
return true;
|
|
489
|
-
};
|
|
490
|
-
}()
|
|
491
|
-
);
|
|
492
|
-
return isURLSameOrigin;
|
|
493
|
-
}
|
|
494
|
-
var xhr;
|
|
495
|
-
var hasRequiredXhr;
|
|
496
|
-
function requireXhr() {
|
|
497
|
-
if (hasRequiredXhr) return xhr;
|
|
498
|
-
hasRequiredXhr = 1;
|
|
499
|
-
var utils2 = utils$9;
|
|
500
|
-
var settle2 = requireSettle();
|
|
501
|
-
var cookies2 = requireCookies();
|
|
502
|
-
var buildURL3 = buildURL$1;
|
|
503
|
-
var buildFullPath2 = requireBuildFullPath();
|
|
504
|
-
var parseHeaders2 = requireParseHeaders();
|
|
505
|
-
var isURLSameOrigin2 = requireIsURLSameOrigin();
|
|
506
|
-
var createError2 = requireCreateError();
|
|
507
|
-
xhr = function xhrAdapter(config2) {
|
|
508
|
-
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
509
|
-
var requestData = config2.data;
|
|
510
|
-
var requestHeaders = config2.headers;
|
|
511
|
-
var responseType = config2.responseType;
|
|
512
|
-
if (utils2.isFormData(requestData)) {
|
|
513
|
-
delete requestHeaders["Content-Type"];
|
|
514
|
-
}
|
|
515
|
-
var request2 = new XMLHttpRequest();
|
|
516
|
-
if (config2.auth) {
|
|
517
|
-
var username = config2.auth.username || "";
|
|
518
|
-
var password = config2.auth.password ? unescape(encodeURIComponent(config2.auth.password)) : "";
|
|
519
|
-
requestHeaders.Authorization = "Basic " + btoa(username + ":" + password);
|
|
520
|
-
}
|
|
521
|
-
var fullPath = buildFullPath2(config2.baseURL, config2.url);
|
|
522
|
-
request2.open(config2.method.toUpperCase(), buildURL3(fullPath, config2.params, config2.paramsSerializer), true);
|
|
523
|
-
request2.timeout = config2.timeout;
|
|
524
|
-
function onloadend() {
|
|
525
|
-
if (!request2) {
|
|
526
|
-
return;
|
|
527
|
-
}
|
|
528
|
-
var responseHeaders = "getAllResponseHeaders" in request2 ? parseHeaders2(request2.getAllResponseHeaders()) : null;
|
|
529
|
-
var responseData = !responseType || responseType === "text" || responseType === "json" ? request2.responseText : request2.response;
|
|
530
|
-
var response = {
|
|
531
|
-
data: responseData,
|
|
532
|
-
status: request2.status,
|
|
533
|
-
statusText: request2.statusText,
|
|
534
|
-
headers: responseHeaders,
|
|
535
|
-
config: config2,
|
|
536
|
-
request: request2
|
|
537
|
-
};
|
|
538
|
-
settle2(resolve, reject, response);
|
|
539
|
-
request2 = null;
|
|
540
|
-
}
|
|
541
|
-
if ("onloadend" in request2) {
|
|
542
|
-
request2.onloadend = onloadend;
|
|
543
|
-
} else {
|
|
544
|
-
request2.onreadystatechange = function handleLoad() {
|
|
545
|
-
if (!request2 || request2.readyState !== 4) {
|
|
546
|
-
return;
|
|
547
|
-
}
|
|
548
|
-
if (request2.status === 0 && !(request2.responseURL && request2.responseURL.indexOf("file:") === 0)) {
|
|
549
|
-
return;
|
|
550
|
-
}
|
|
551
|
-
setTimeout(onloadend);
|
|
552
|
-
};
|
|
553
|
-
}
|
|
554
|
-
request2.onabort = function handleAbort() {
|
|
555
|
-
if (!request2) {
|
|
556
|
-
return;
|
|
557
|
-
}
|
|
558
|
-
reject(createError2("Request aborted", config2, "ECONNABORTED", request2));
|
|
559
|
-
request2 = null;
|
|
560
|
-
};
|
|
561
|
-
request2.onerror = function handleError() {
|
|
562
|
-
reject(createError2("Network Error", config2, null, request2));
|
|
563
|
-
request2 = null;
|
|
564
|
-
};
|
|
565
|
-
request2.ontimeout = function handleTimeout() {
|
|
566
|
-
var timeoutErrorMessage = "timeout of " + config2.timeout + "ms exceeded";
|
|
567
|
-
if (config2.timeoutErrorMessage) {
|
|
568
|
-
timeoutErrorMessage = config2.timeoutErrorMessage;
|
|
569
|
-
}
|
|
570
|
-
reject(createError2(
|
|
571
|
-
timeoutErrorMessage,
|
|
572
|
-
config2,
|
|
573
|
-
config2.transitional && config2.transitional.clarifyTimeoutError ? "ETIMEDOUT" : "ECONNABORTED",
|
|
574
|
-
request2
|
|
575
|
-
));
|
|
576
|
-
request2 = null;
|
|
577
|
-
};
|
|
578
|
-
if (utils2.isStandardBrowserEnv()) {
|
|
579
|
-
var xsrfValue = (config2.withCredentials || isURLSameOrigin2(fullPath)) && config2.xsrfCookieName ? cookies2.read(config2.xsrfCookieName) : void 0;
|
|
580
|
-
if (xsrfValue) {
|
|
581
|
-
requestHeaders[config2.xsrfHeaderName] = xsrfValue;
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
if ("setRequestHeader" in request2) {
|
|
585
|
-
utils2.forEach(requestHeaders, function setRequestHeader(val, key) {
|
|
586
|
-
if (typeof requestData === "undefined" && key.toLowerCase() === "content-type") {
|
|
587
|
-
delete requestHeaders[key];
|
|
588
|
-
} else {
|
|
589
|
-
request2.setRequestHeader(key, val);
|
|
590
|
-
}
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
|
-
if (!utils2.isUndefined(config2.withCredentials)) {
|
|
594
|
-
request2.withCredentials = !!config2.withCredentials;
|
|
595
|
-
}
|
|
596
|
-
if (responseType && responseType !== "json") {
|
|
597
|
-
request2.responseType = config2.responseType;
|
|
598
|
-
}
|
|
599
|
-
if (typeof config2.onDownloadProgress === "function") {
|
|
600
|
-
request2.addEventListener("progress", config2.onDownloadProgress);
|
|
601
|
-
}
|
|
602
|
-
if (typeof config2.onUploadProgress === "function" && request2.upload) {
|
|
603
|
-
request2.upload.addEventListener("progress", config2.onUploadProgress);
|
|
604
|
-
}
|
|
605
|
-
if (config2.cancelToken) {
|
|
606
|
-
config2.cancelToken.promise.then(function onCanceled(cancel) {
|
|
607
|
-
if (!request2) {
|
|
608
|
-
return;
|
|
609
|
-
}
|
|
610
|
-
request2.abort();
|
|
611
|
-
reject(cancel);
|
|
612
|
-
request2 = null;
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
if (!requestData) {
|
|
616
|
-
requestData = null;
|
|
617
|
-
}
|
|
618
|
-
request2.send(requestData);
|
|
619
|
-
});
|
|
620
|
-
};
|
|
621
|
-
return xhr;
|
|
622
|
-
}
|
|
623
|
-
var utils$5 = utils$9;
|
|
624
|
-
var normalizeHeaderName2 = normalizeHeaderName$1;
|
|
625
|
-
var enhanceError2 = enhanceError$1;
|
|
626
|
-
var DEFAULT_CONTENT_TYPE = {
|
|
627
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
628
|
-
};
|
|
629
|
-
function setContentTypeIfUnset(headers, value) {
|
|
630
|
-
if (!utils$5.isUndefined(headers) && utils$5.isUndefined(headers["Content-Type"])) {
|
|
631
|
-
headers["Content-Type"] = value;
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
function getDefaultAdapter() {
|
|
635
|
-
var adapter;
|
|
636
|
-
if (typeof XMLHttpRequest !== "undefined") {
|
|
637
|
-
adapter = requireXhr();
|
|
638
|
-
} else if (typeof process !== "undefined" && Object.prototype.toString.call(process) === "[object process]") {
|
|
639
|
-
adapter = requireXhr();
|
|
640
|
-
}
|
|
641
|
-
return adapter;
|
|
642
|
-
}
|
|
643
|
-
function stringifySafely(rawValue, parser, encoder) {
|
|
644
|
-
if (utils$5.isString(rawValue)) {
|
|
645
|
-
try {
|
|
646
|
-
(parser || JSON.parse)(rawValue);
|
|
647
|
-
return utils$5.trim(rawValue);
|
|
648
|
-
} catch (e) {
|
|
649
|
-
if (e.name !== "SyntaxError") {
|
|
650
|
-
throw e;
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
return (encoder || JSON.stringify)(rawValue);
|
|
655
|
-
}
|
|
656
|
-
var defaults$3 = {
|
|
657
|
-
transitional: {
|
|
658
|
-
silentJSONParsing: true,
|
|
659
|
-
forcedJSONParsing: true,
|
|
660
|
-
clarifyTimeoutError: false
|
|
661
|
-
},
|
|
662
|
-
adapter: getDefaultAdapter(),
|
|
663
|
-
transformRequest: [function transformRequest(data, headers) {
|
|
664
|
-
normalizeHeaderName2(headers, "Accept");
|
|
665
|
-
normalizeHeaderName2(headers, "Content-Type");
|
|
666
|
-
if (utils$5.isFormData(data) || utils$5.isArrayBuffer(data) || utils$5.isBuffer(data) || utils$5.isStream(data) || utils$5.isFile(data) || utils$5.isBlob(data)) {
|
|
667
|
-
return data;
|
|
668
|
-
}
|
|
669
|
-
if (utils$5.isArrayBufferView(data)) {
|
|
670
|
-
return data.buffer;
|
|
671
|
-
}
|
|
672
|
-
if (utils$5.isURLSearchParams(data)) {
|
|
673
|
-
setContentTypeIfUnset(headers, "application/x-www-form-urlencoded;charset=utf-8");
|
|
674
|
-
return data.toString();
|
|
675
|
-
}
|
|
676
|
-
if (utils$5.isObject(data) || headers && headers["Content-Type"] === "application/json") {
|
|
677
|
-
setContentTypeIfUnset(headers, "application/json");
|
|
678
|
-
return stringifySafely(data);
|
|
679
|
-
}
|
|
680
|
-
return data;
|
|
681
|
-
}],
|
|
682
|
-
transformResponse: [function transformResponse(data) {
|
|
683
|
-
var transitional2 = this.transitional;
|
|
684
|
-
var silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
|
|
685
|
-
var forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
|
|
686
|
-
var strictJSONParsing = !silentJSONParsing && this.responseType === "json";
|
|
687
|
-
if (strictJSONParsing || forcedJSONParsing && utils$5.isString(data) && data.length) {
|
|
688
|
-
try {
|
|
689
|
-
return JSON.parse(data);
|
|
690
|
-
} catch (e) {
|
|
691
|
-
if (strictJSONParsing) {
|
|
692
|
-
if (e.name === "SyntaxError") {
|
|
693
|
-
throw enhanceError2(e, this, "E_JSON_PARSE");
|
|
694
|
-
}
|
|
695
|
-
throw e;
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
return data;
|
|
700
|
-
}],
|
|
701
|
-
/**
|
|
702
|
-
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
703
|
-
* timeout is not created.
|
|
704
|
-
*/
|
|
705
|
-
timeout: 0,
|
|
706
|
-
xsrfCookieName: "XSRF-TOKEN",
|
|
707
|
-
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
708
|
-
maxContentLength: -1,
|
|
709
|
-
maxBodyLength: -1,
|
|
710
|
-
validateStatus: function validateStatus(status) {
|
|
711
|
-
return status >= 200 && status < 300;
|
|
712
|
-
}
|
|
713
|
-
};
|
|
714
|
-
defaults$3.headers = {
|
|
715
|
-
common: {
|
|
716
|
-
"Accept": "application/json, text/plain, */*"
|
|
717
|
-
}
|
|
718
|
-
};
|
|
719
|
-
utils$5.forEach(["delete", "get", "head"], function forEachMethodNoData(method) {
|
|
720
|
-
defaults$3.headers[method] = {};
|
|
721
|
-
});
|
|
722
|
-
utils$5.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
|
|
723
|
-
defaults$3.headers[method] = utils$5.merge(DEFAULT_CONTENT_TYPE);
|
|
724
|
-
});
|
|
725
|
-
var defaults_1 = defaults$3;
|
|
726
|
-
var utils$4 = utils$9;
|
|
727
|
-
var defaults$2 = defaults_1;
|
|
728
|
-
var transformData$1 = function transformData(data, headers, fns) {
|
|
729
|
-
var context = this || defaults$2;
|
|
730
|
-
utils$4.forEach(fns, function transform(fn) {
|
|
731
|
-
data = fn.call(context, data, headers);
|
|
732
|
-
});
|
|
733
|
-
return data;
|
|
734
|
-
};
|
|
735
|
-
var isCancel$1;
|
|
736
|
-
var hasRequiredIsCancel;
|
|
737
|
-
function requireIsCancel() {
|
|
738
|
-
if (hasRequiredIsCancel) return isCancel$1;
|
|
739
|
-
hasRequiredIsCancel = 1;
|
|
740
|
-
isCancel$1 = function isCancel2(value) {
|
|
741
|
-
return !!(value && value.__CANCEL__);
|
|
742
|
-
};
|
|
743
|
-
return isCancel$1;
|
|
744
|
-
}
|
|
745
|
-
var utils$3 = utils$9;
|
|
746
|
-
var transformData2 = transformData$1;
|
|
747
|
-
var isCancel = requireIsCancel();
|
|
748
|
-
var defaults$1 = defaults_1;
|
|
749
|
-
function throwIfCancellationRequested(config2) {
|
|
750
|
-
if (config2.cancelToken) {
|
|
751
|
-
config2.cancelToken.throwIfRequested();
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
var dispatchRequest$1 = function dispatchRequest(config2) {
|
|
755
|
-
throwIfCancellationRequested(config2);
|
|
756
|
-
config2.headers = config2.headers || {};
|
|
757
|
-
config2.data = transformData2.call(
|
|
758
|
-
config2,
|
|
759
|
-
config2.data,
|
|
760
|
-
config2.headers,
|
|
761
|
-
config2.transformRequest
|
|
762
|
-
);
|
|
763
|
-
config2.headers = utils$3.merge(
|
|
764
|
-
config2.headers.common || {},
|
|
765
|
-
config2.headers[config2.method] || {},
|
|
766
|
-
config2.headers
|
|
767
|
-
);
|
|
768
|
-
utils$3.forEach(
|
|
769
|
-
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
770
|
-
function cleanHeaderConfig(method) {
|
|
771
|
-
delete config2.headers[method];
|
|
772
|
-
}
|
|
773
|
-
);
|
|
774
|
-
var adapter = config2.adapter || defaults$1.adapter;
|
|
775
|
-
return adapter(config2).then(function onAdapterResolution(response) {
|
|
776
|
-
throwIfCancellationRequested(config2);
|
|
777
|
-
response.data = transformData2.call(
|
|
778
|
-
config2,
|
|
779
|
-
response.data,
|
|
780
|
-
response.headers,
|
|
781
|
-
config2.transformResponse
|
|
782
|
-
);
|
|
783
|
-
return response;
|
|
784
|
-
}, function onAdapterRejection(reason) {
|
|
785
|
-
if (!isCancel(reason)) {
|
|
786
|
-
throwIfCancellationRequested(config2);
|
|
787
|
-
if (reason && reason.response) {
|
|
788
|
-
reason.response.data = transformData2.call(
|
|
789
|
-
config2,
|
|
790
|
-
reason.response.data,
|
|
791
|
-
reason.response.headers,
|
|
792
|
-
config2.transformResponse
|
|
793
|
-
);
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
return Promise.reject(reason);
|
|
797
|
-
});
|
|
798
|
-
};
|
|
799
|
-
var utils$2 = utils$9;
|
|
800
|
-
var mergeConfig$2 = function mergeConfig(config1, config2) {
|
|
801
|
-
config2 = config2 || {};
|
|
802
|
-
var config3 = {};
|
|
803
|
-
var valueFromConfig2Keys = ["url", "method", "data"];
|
|
804
|
-
var mergeDeepPropertiesKeys = ["headers", "auth", "proxy", "params"];
|
|
805
|
-
var defaultToConfig2Keys = [
|
|
806
|
-
"baseURL",
|
|
807
|
-
"transformRequest",
|
|
808
|
-
"transformResponse",
|
|
809
|
-
"paramsSerializer",
|
|
810
|
-
"timeout",
|
|
811
|
-
"timeoutMessage",
|
|
812
|
-
"withCredentials",
|
|
813
|
-
"adapter",
|
|
814
|
-
"responseType",
|
|
815
|
-
"xsrfCookieName",
|
|
816
|
-
"xsrfHeaderName",
|
|
817
|
-
"onUploadProgress",
|
|
818
|
-
"onDownloadProgress",
|
|
819
|
-
"decompress",
|
|
820
|
-
"maxContentLength",
|
|
821
|
-
"maxBodyLength",
|
|
822
|
-
"maxRedirects",
|
|
823
|
-
"transport",
|
|
824
|
-
"httpAgent",
|
|
825
|
-
"httpsAgent",
|
|
826
|
-
"cancelToken",
|
|
827
|
-
"socketPath",
|
|
828
|
-
"responseEncoding"
|
|
829
|
-
];
|
|
830
|
-
var directMergeKeys = ["validateStatus"];
|
|
831
|
-
function getMergedValue(target, source) {
|
|
832
|
-
if (utils$2.isPlainObject(target) && utils$2.isPlainObject(source)) {
|
|
833
|
-
return utils$2.merge(target, source);
|
|
834
|
-
} else if (utils$2.isPlainObject(source)) {
|
|
835
|
-
return utils$2.merge({}, source);
|
|
836
|
-
} else if (utils$2.isArray(source)) {
|
|
837
|
-
return source.slice();
|
|
838
|
-
}
|
|
839
|
-
return source;
|
|
840
|
-
}
|
|
841
|
-
function mergeDeepProperties(prop) {
|
|
842
|
-
if (!utils$2.isUndefined(config2[prop])) {
|
|
843
|
-
config3[prop] = getMergedValue(config1[prop], config2[prop]);
|
|
844
|
-
} else if (!utils$2.isUndefined(config1[prop])) {
|
|
845
|
-
config3[prop] = getMergedValue(void 0, config1[prop]);
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
utils$2.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
|
|
849
|
-
if (!utils$2.isUndefined(config2[prop])) {
|
|
850
|
-
config3[prop] = getMergedValue(void 0, config2[prop]);
|
|
851
|
-
}
|
|
852
|
-
});
|
|
853
|
-
utils$2.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
|
|
854
|
-
utils$2.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
|
|
855
|
-
if (!utils$2.isUndefined(config2[prop])) {
|
|
856
|
-
config3[prop] = getMergedValue(void 0, config2[prop]);
|
|
857
|
-
} else if (!utils$2.isUndefined(config1[prop])) {
|
|
858
|
-
config3[prop] = getMergedValue(void 0, config1[prop]);
|
|
859
|
-
}
|
|
860
|
-
});
|
|
861
|
-
utils$2.forEach(directMergeKeys, function merge2(prop) {
|
|
862
|
-
if (prop in config2) {
|
|
863
|
-
config3[prop] = getMergedValue(config1[prop], config2[prop]);
|
|
864
|
-
} else if (prop in config1) {
|
|
865
|
-
config3[prop] = getMergedValue(void 0, config1[prop]);
|
|
866
|
-
}
|
|
867
|
-
});
|
|
868
|
-
var axiosKeys = valueFromConfig2Keys.concat(mergeDeepPropertiesKeys).concat(defaultToConfig2Keys).concat(directMergeKeys);
|
|
869
|
-
var otherKeys = Object.keys(config1).concat(Object.keys(config2)).filter(function filterAxiosKeys(key) {
|
|
870
|
-
return axiosKeys.indexOf(key) === -1;
|
|
871
|
-
});
|
|
872
|
-
utils$2.forEach(otherKeys, mergeDeepProperties);
|
|
873
|
-
return config3;
|
|
874
|
-
};
|
|
875
|
-
const version = "0.21.4";
|
|
876
|
-
const require$$0 = {
|
|
877
|
-
version
|
|
878
|
-
};
|
|
879
|
-
var pkg = require$$0;
|
|
880
|
-
var validators$1 = {};
|
|
881
|
-
["object", "boolean", "number", "function", "string", "symbol"].forEach(function(type, i) {
|
|
882
|
-
validators$1[type] = function validator2(thing) {
|
|
883
|
-
return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
|
|
884
|
-
};
|
|
885
|
-
});
|
|
886
|
-
var deprecatedWarnings = {};
|
|
887
|
-
var currentVerArr = pkg.version.split(".");
|
|
888
|
-
function isOlderVersion(version2, thanVersion) {
|
|
889
|
-
var pkgVersionArr = thanVersion ? thanVersion.split(".") : currentVerArr;
|
|
890
|
-
var destVer = version2.split(".");
|
|
891
|
-
for (var i = 0; i < 3; i++) {
|
|
892
|
-
if (pkgVersionArr[i] > destVer[i]) {
|
|
893
|
-
return true;
|
|
894
|
-
} else if (pkgVersionArr[i] < destVer[i]) {
|
|
895
|
-
return false;
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
return false;
|
|
899
|
-
}
|
|
900
|
-
validators$1.transitional = function transitional(validator2, version2, message) {
|
|
901
|
-
var isDeprecated = version2 && isOlderVersion(version2);
|
|
902
|
-
function formatMessage(opt, desc) {
|
|
903
|
-
return "[Axios v" + pkg.version + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
|
|
904
|
-
}
|
|
905
|
-
return function(value, opt, opts) {
|
|
906
|
-
if (validator2 === false) {
|
|
907
|
-
throw new Error(formatMessage(opt, " has been removed in " + version2));
|
|
908
|
-
}
|
|
909
|
-
if (isDeprecated && !deprecatedWarnings[opt]) {
|
|
910
|
-
deprecatedWarnings[opt] = true;
|
|
911
|
-
console.warn(
|
|
912
|
-
formatMessage(
|
|
913
|
-
opt,
|
|
914
|
-
" has been deprecated since v" + version2 + " and will be removed in the near future"
|
|
915
|
-
)
|
|
916
|
-
);
|
|
917
|
-
}
|
|
918
|
-
return validator2 ? validator2(value, opt, opts) : true;
|
|
919
|
-
};
|
|
920
|
-
};
|
|
921
|
-
function assertOptions(options, schema, allowUnknown) {
|
|
922
|
-
if (typeof options !== "object") {
|
|
923
|
-
throw new TypeError("options must be an object");
|
|
924
|
-
}
|
|
925
|
-
var keys = Object.keys(options);
|
|
926
|
-
var i = keys.length;
|
|
927
|
-
while (i-- > 0) {
|
|
928
|
-
var opt = keys[i];
|
|
929
|
-
var validator2 = schema[opt];
|
|
930
|
-
if (validator2) {
|
|
931
|
-
var value = options[opt];
|
|
932
|
-
var result = value === void 0 || validator2(value, opt, options);
|
|
933
|
-
if (result !== true) {
|
|
934
|
-
throw new TypeError("option " + opt + " must be " + result);
|
|
935
|
-
}
|
|
936
|
-
continue;
|
|
937
|
-
}
|
|
938
|
-
if (allowUnknown !== true) {
|
|
939
|
-
throw Error("Unknown option " + opt);
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
var validator$1 = {
|
|
944
|
-
isOlderVersion,
|
|
945
|
-
assertOptions,
|
|
946
|
-
validators: validators$1
|
|
947
|
-
};
|
|
948
|
-
var utils$1 = utils$9;
|
|
949
|
-
var buildURL2 = buildURL$1;
|
|
950
|
-
var InterceptorManager = InterceptorManager_1;
|
|
951
|
-
var dispatchRequest2 = dispatchRequest$1;
|
|
952
|
-
var mergeConfig$1 = mergeConfig$2;
|
|
953
|
-
var validator = validator$1;
|
|
954
|
-
var validators = validator.validators;
|
|
955
|
-
function Axios$1(instanceConfig) {
|
|
956
|
-
this.defaults = instanceConfig;
|
|
957
|
-
this.interceptors = {
|
|
958
|
-
request: new InterceptorManager(),
|
|
959
|
-
response: new InterceptorManager()
|
|
960
|
-
};
|
|
961
|
-
}
|
|
962
|
-
Axios$1.prototype.request = function request(config2) {
|
|
963
|
-
if (typeof config2 === "string") {
|
|
964
|
-
config2 = arguments[1] || {};
|
|
965
|
-
config2.url = arguments[0];
|
|
966
|
-
} else {
|
|
967
|
-
config2 = config2 || {};
|
|
968
|
-
}
|
|
969
|
-
config2 = mergeConfig$1(this.defaults, config2);
|
|
970
|
-
if (config2.method) {
|
|
971
|
-
config2.method = config2.method.toLowerCase();
|
|
972
|
-
} else if (this.defaults.method) {
|
|
973
|
-
config2.method = this.defaults.method.toLowerCase();
|
|
974
|
-
} else {
|
|
975
|
-
config2.method = "get";
|
|
976
|
-
}
|
|
977
|
-
var transitional2 = config2.transitional;
|
|
978
|
-
if (transitional2 !== void 0) {
|
|
979
|
-
validator.assertOptions(transitional2, {
|
|
980
|
-
silentJSONParsing: validators.transitional(validators.boolean, "1.0.0"),
|
|
981
|
-
forcedJSONParsing: validators.transitional(validators.boolean, "1.0.0"),
|
|
982
|
-
clarifyTimeoutError: validators.transitional(validators.boolean, "1.0.0")
|
|
983
|
-
}, false);
|
|
984
|
-
}
|
|
985
|
-
var requestInterceptorChain = [];
|
|
986
|
-
var synchronousRequestInterceptors = true;
|
|
987
|
-
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
988
|
-
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config2) === false) {
|
|
989
|
-
return;
|
|
990
|
-
}
|
|
991
|
-
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
992
|
-
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
993
|
-
});
|
|
994
|
-
var responseInterceptorChain = [];
|
|
995
|
-
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
996
|
-
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
997
|
-
});
|
|
998
|
-
var promise;
|
|
999
|
-
if (!synchronousRequestInterceptors) {
|
|
1000
|
-
var chain = [dispatchRequest2, void 0];
|
|
1001
|
-
Array.prototype.unshift.apply(chain, requestInterceptorChain);
|
|
1002
|
-
chain = chain.concat(responseInterceptorChain);
|
|
1003
|
-
promise = Promise.resolve(config2);
|
|
1004
|
-
while (chain.length) {
|
|
1005
|
-
promise = promise.then(chain.shift(), chain.shift());
|
|
1006
|
-
}
|
|
1007
|
-
return promise;
|
|
1008
|
-
}
|
|
1009
|
-
var newConfig = config2;
|
|
1010
|
-
while (requestInterceptorChain.length) {
|
|
1011
|
-
var onFulfilled = requestInterceptorChain.shift();
|
|
1012
|
-
var onRejected = requestInterceptorChain.shift();
|
|
1013
|
-
try {
|
|
1014
|
-
newConfig = onFulfilled(newConfig);
|
|
1015
|
-
} catch (error) {
|
|
1016
|
-
onRejected(error);
|
|
1017
|
-
break;
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
try {
|
|
1021
|
-
promise = dispatchRequest2(newConfig);
|
|
1022
|
-
} catch (error) {
|
|
1023
|
-
return Promise.reject(error);
|
|
1024
|
-
}
|
|
1025
|
-
while (responseInterceptorChain.length) {
|
|
1026
|
-
promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
|
|
1027
|
-
}
|
|
1028
|
-
return promise;
|
|
1029
|
-
};
|
|
1030
|
-
Axios$1.prototype.getUri = function getUri(config2) {
|
|
1031
|
-
config2 = mergeConfig$1(this.defaults, config2);
|
|
1032
|
-
return buildURL2(config2.url, config2.params, config2.paramsSerializer).replace(/^\?/, "");
|
|
1033
|
-
};
|
|
1034
|
-
utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData2(method) {
|
|
1035
|
-
Axios$1.prototype[method] = function(url, config2) {
|
|
1036
|
-
return this.request(mergeConfig$1(config2 || {}, {
|
|
1037
|
-
method,
|
|
1038
|
-
url,
|
|
1039
|
-
data: (config2 || {}).data
|
|
1040
|
-
}));
|
|
1041
|
-
};
|
|
1042
|
-
});
|
|
1043
|
-
utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData2(method) {
|
|
1044
|
-
Axios$1.prototype[method] = function(url, data, config2) {
|
|
1045
|
-
return this.request(mergeConfig$1(config2 || {}, {
|
|
1046
|
-
method,
|
|
1047
|
-
url,
|
|
1048
|
-
data
|
|
1049
|
-
}));
|
|
1050
|
-
};
|
|
1051
|
-
});
|
|
1052
|
-
var Axios_1 = Axios$1;
|
|
1053
|
-
var Cancel_1;
|
|
1054
|
-
var hasRequiredCancel;
|
|
1055
|
-
function requireCancel() {
|
|
1056
|
-
if (hasRequiredCancel) return Cancel_1;
|
|
1057
|
-
hasRequiredCancel = 1;
|
|
1058
|
-
function Cancel(message) {
|
|
1059
|
-
this.message = message;
|
|
1060
|
-
}
|
|
1061
|
-
Cancel.prototype.toString = function toString2() {
|
|
1062
|
-
return "Cancel" + (this.message ? ": " + this.message : "");
|
|
1063
|
-
};
|
|
1064
|
-
Cancel.prototype.__CANCEL__ = true;
|
|
1065
|
-
Cancel_1 = Cancel;
|
|
1066
|
-
return Cancel_1;
|
|
1067
|
-
}
|
|
1068
|
-
var CancelToken_1;
|
|
1069
|
-
var hasRequiredCancelToken;
|
|
1070
|
-
function requireCancelToken() {
|
|
1071
|
-
if (hasRequiredCancelToken) return CancelToken_1;
|
|
1072
|
-
hasRequiredCancelToken = 1;
|
|
1073
|
-
var Cancel = requireCancel();
|
|
1074
|
-
function CancelToken(executor) {
|
|
1075
|
-
if (typeof executor !== "function") {
|
|
1076
|
-
throw new TypeError("executor must be a function.");
|
|
1077
|
-
}
|
|
1078
|
-
var resolvePromise;
|
|
1079
|
-
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
1080
|
-
resolvePromise = resolve;
|
|
1081
|
-
});
|
|
1082
|
-
var token = this;
|
|
1083
|
-
executor(function cancel(message) {
|
|
1084
|
-
if (token.reason) {
|
|
1085
|
-
return;
|
|
1086
|
-
}
|
|
1087
|
-
token.reason = new Cancel(message);
|
|
1088
|
-
resolvePromise(token.reason);
|
|
1089
|
-
});
|
|
1090
|
-
}
|
|
1091
|
-
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
|
1092
|
-
if (this.reason) {
|
|
1093
|
-
throw this.reason;
|
|
1094
|
-
}
|
|
1095
|
-
};
|
|
1096
|
-
CancelToken.source = function source() {
|
|
1097
|
-
var cancel;
|
|
1098
|
-
var token = new CancelToken(function executor(c) {
|
|
1099
|
-
cancel = c;
|
|
1100
|
-
});
|
|
1101
|
-
return {
|
|
1102
|
-
token,
|
|
1103
|
-
cancel
|
|
1104
|
-
};
|
|
1105
|
-
};
|
|
1106
|
-
CancelToken_1 = CancelToken;
|
|
1107
|
-
return CancelToken_1;
|
|
1108
|
-
}
|
|
1109
|
-
var spread;
|
|
1110
|
-
var hasRequiredSpread;
|
|
1111
|
-
function requireSpread() {
|
|
1112
|
-
if (hasRequiredSpread) return spread;
|
|
1113
|
-
hasRequiredSpread = 1;
|
|
1114
|
-
spread = function spread2(callback) {
|
|
1115
|
-
return function wrap(arr) {
|
|
1116
|
-
return callback.apply(null, arr);
|
|
1117
|
-
};
|
|
1118
|
-
};
|
|
1119
|
-
return spread;
|
|
1120
|
-
}
|
|
1121
|
-
var isAxiosError;
|
|
1122
|
-
var hasRequiredIsAxiosError;
|
|
1123
|
-
function requireIsAxiosError() {
|
|
1124
|
-
if (hasRequiredIsAxiosError) return isAxiosError;
|
|
1125
|
-
hasRequiredIsAxiosError = 1;
|
|
1126
|
-
isAxiosError = function isAxiosError2(payload) {
|
|
1127
|
-
return typeof payload === "object" && payload.isAxiosError === true;
|
|
1128
|
-
};
|
|
1129
|
-
return isAxiosError;
|
|
1130
|
-
}
|
|
1131
|
-
var utils = utils$9;
|
|
1132
|
-
var bind2 = bind$2;
|
|
1133
|
-
var Axios = Axios_1;
|
|
1134
|
-
var mergeConfig2 = mergeConfig$2;
|
|
1135
|
-
var defaults = defaults_1;
|
|
1136
|
-
function createInstance(defaultConfig) {
|
|
1137
|
-
var context = new Axios(defaultConfig);
|
|
1138
|
-
var instance = bind2(Axios.prototype.request, context);
|
|
1139
|
-
utils.extend(instance, Axios.prototype, context);
|
|
1140
|
-
utils.extend(instance, context);
|
|
1141
|
-
return instance;
|
|
1142
|
-
}
|
|
1143
|
-
var axios$2 = createInstance(defaults);
|
|
1144
|
-
axios$2.Axios = Axios;
|
|
1145
|
-
axios$2.create = function create(instanceConfig) {
|
|
1146
|
-
return createInstance(mergeConfig2(axios$2.defaults, instanceConfig));
|
|
1147
|
-
};
|
|
1148
|
-
axios$2.Cancel = requireCancel();
|
|
1149
|
-
axios$2.CancelToken = requireCancelToken();
|
|
1150
|
-
axios$2.isCancel = requireIsCancel();
|
|
1151
|
-
axios$2.all = function all(promises) {
|
|
1152
|
-
return Promise.all(promises);
|
|
1153
|
-
};
|
|
1154
|
-
axios$2.spread = requireSpread();
|
|
1155
|
-
axios$2.isAxiosError = requireIsAxiosError();
|
|
1156
|
-
axios$3.exports = axios$2;
|
|
1157
|
-
axios$3.exports.default = axios$2;
|
|
1158
|
-
var axiosExports = axios$3.exports;
|
|
1159
|
-
var axios = axiosExports;
|
|
1160
|
-
const axios$1 = /* @__PURE__ */ getDefaultExportFromCjs(axios);
|
|
1161
9
|
const useMembershipConfig = (storeId, options) => {
|
|
1162
10
|
return useQuery({
|
|
1163
11
|
...options,
|
|
@@ -1166,7 +14,7 @@ const useMembershipConfig = (storeId, options) => {
|
|
|
1166
14
|
if (!storeId) {
|
|
1167
15
|
throw new Error("No store id found");
|
|
1168
16
|
}
|
|
1169
|
-
const { data: config2 } = await axios
|
|
17
|
+
const { data: config2 } = await axios.get(
|
|
1170
18
|
`/admin/membership/config/${storeId}`
|
|
1171
19
|
);
|
|
1172
20
|
return config2;
|
|
@@ -1197,13 +45,13 @@ const useStore = () => {
|
|
|
1197
45
|
const usePromotionCollectable = (id) => {
|
|
1198
46
|
return useQuery({
|
|
1199
47
|
queryKey: ["promotion-collectable", id],
|
|
1200
|
-
queryFn: () => axios
|
|
48
|
+
queryFn: () => axios.get(`/admin/promotions/${id}/update-collectable`)
|
|
1201
49
|
});
|
|
1202
50
|
};
|
|
1203
51
|
const useUpdatePromotionCollectable = (id) => {
|
|
1204
52
|
const queryClient = useQueryClient();
|
|
1205
53
|
return useMutation({
|
|
1206
|
-
mutationFn: (data) => axios
|
|
54
|
+
mutationFn: (data) => axios.patch(`/admin/promotions/${id}/update-collectable`, data),
|
|
1207
55
|
onSuccess: () => {
|
|
1208
56
|
queryClient.invalidateQueries({
|
|
1209
57
|
queryKey: ["promotion-collectable", id]
|
|
@@ -1273,7 +121,7 @@ const useUpdateMembershipConfig = () => {
|
|
|
1273
121
|
if (!storeId) {
|
|
1274
122
|
throw new Error("No store id found");
|
|
1275
123
|
}
|
|
1276
|
-
const response = await axios
|
|
124
|
+
const response = await axios.patch(
|
|
1277
125
|
`/admin/membership/config/${storeId}`,
|
|
1278
126
|
config2
|
|
1279
127
|
);
|
|
@@ -1319,7 +167,7 @@ const MembershipPage = () => {
|
|
|
1319
167
|
});
|
|
1320
168
|
await refetch();
|
|
1321
169
|
} catch (error2) {
|
|
1322
|
-
if (axios
|
|
170
|
+
if (axios.isAxiosError(error2)) {
|
|
1323
171
|
toast.error("Error saving settings", {
|
|
1324
172
|
description: (_b = (_a = error2.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message,
|
|
1325
173
|
dismissable: true,
|
|
@@ -1426,7 +274,7 @@ const useCreateMembershipConsent = () => {
|
|
|
1426
274
|
const queryClient = useQueryClient();
|
|
1427
275
|
return useMutation({
|
|
1428
276
|
mutationFn: async (data) => {
|
|
1429
|
-
const response = await axios
|
|
277
|
+
const response = await axios.post("/admin/membership-consents", data);
|
|
1430
278
|
return response.data;
|
|
1431
279
|
},
|
|
1432
280
|
onSuccess: () => {
|
|
@@ -1438,7 +286,7 @@ const useDeleteMembershipConsent = () => {
|
|
|
1438
286
|
const queryClient = useQueryClient();
|
|
1439
287
|
return useMutation({
|
|
1440
288
|
mutationFn: async (id) => {
|
|
1441
|
-
await axios
|
|
289
|
+
await axios.delete(`/admin/membership-consents/${id}`);
|
|
1442
290
|
},
|
|
1443
291
|
onSuccess: () => {
|
|
1444
292
|
queryClient.invalidateQueries({ queryKey: ["membership-consents"] });
|
|
@@ -1450,7 +298,7 @@ const useMembershipConsents = () => {
|
|
|
1450
298
|
return useQuery({
|
|
1451
299
|
queryKey: [...MEMBERSHIP_TIERS_QUERY_KEY$1],
|
|
1452
300
|
queryFn: async () => {
|
|
1453
|
-
const response = await axios
|
|
301
|
+
const response = await axios.get("/admin/membership-consents");
|
|
1454
302
|
return response.data;
|
|
1455
303
|
}
|
|
1456
304
|
});
|
|
@@ -1459,7 +307,7 @@ const useUpdateMembershipConsent = () => {
|
|
|
1459
307
|
const queryClient = useQueryClient();
|
|
1460
308
|
return useMutation({
|
|
1461
309
|
mutationFn: async (consentKey) => {
|
|
1462
|
-
const response = await axios
|
|
310
|
+
const response = await axios.patch(
|
|
1463
311
|
`/admin/membership-consents/${consentKey.id}`,
|
|
1464
312
|
{
|
|
1465
313
|
name: consentKey.name,
|
|
@@ -1574,7 +422,7 @@ const MembershipConsentsRenderer = () => {
|
|
|
1574
422
|
}
|
|
1575
423
|
closeDrawer();
|
|
1576
424
|
} catch (error) {
|
|
1577
|
-
if (axios
|
|
425
|
+
if (axios.isAxiosError(error)) {
|
|
1578
426
|
toast.error("Error saving consent", {
|
|
1579
427
|
description: (_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message,
|
|
1580
428
|
dismissable: true,
|
|
@@ -1605,7 +453,7 @@ const MembershipConsentsRenderer = () => {
|
|
|
1605
453
|
});
|
|
1606
454
|
closeDrawer();
|
|
1607
455
|
} catch (error) {
|
|
1608
|
-
if (axios
|
|
456
|
+
if (axios.isAxiosError(error)) {
|
|
1609
457
|
toast.error("Error deleting consent", {
|
|
1610
458
|
description: (_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message,
|
|
1611
459
|
dismissable: true,
|
|
@@ -1686,7 +534,7 @@ const useCreateMembershipTier = () => {
|
|
|
1686
534
|
const queryClient = useQueryClient();
|
|
1687
535
|
return useMutation({
|
|
1688
536
|
mutationFn: async (data) => {
|
|
1689
|
-
const response = await axios
|
|
537
|
+
const response = await axios.post("/admin/member-tiers", data);
|
|
1690
538
|
return response.data;
|
|
1691
539
|
},
|
|
1692
540
|
onSuccess: () => {
|
|
@@ -1698,7 +546,7 @@ const useDeleteMembershipTier = () => {
|
|
|
1698
546
|
const queryClient = useQueryClient();
|
|
1699
547
|
return useMutation({
|
|
1700
548
|
mutationFn: async (id) => {
|
|
1701
|
-
await axios
|
|
549
|
+
await axios.delete(`/admin/member-tiers/${id}`);
|
|
1702
550
|
},
|
|
1703
551
|
onSuccess: () => {
|
|
1704
552
|
queryClient.invalidateQueries({ queryKey: ["member-tiers"] });
|
|
@@ -1716,7 +564,7 @@ const useMembershipTiers = (params = {
|
|
|
1716
564
|
return useQuery({
|
|
1717
565
|
queryKey: [...MEMBERSHIP_TIERS_QUERY_KEY, params],
|
|
1718
566
|
queryFn: async () => {
|
|
1719
|
-
const response = await axios
|
|
567
|
+
const response = await axios.get("/admin/member-tiers", {
|
|
1720
568
|
params
|
|
1721
569
|
});
|
|
1722
570
|
return response.data;
|
|
@@ -1727,7 +575,7 @@ const useUpdateMembershipTier = () => {
|
|
|
1727
575
|
const queryClient = useQueryClient();
|
|
1728
576
|
return useMutation({
|
|
1729
577
|
mutationFn: async (tier) => {
|
|
1730
|
-
const response = await axios
|
|
578
|
+
const response = await axios.patch(`/admin/member-tiers/${tier.id}`, {
|
|
1731
579
|
name: tier.name,
|
|
1732
580
|
description: tier.description,
|
|
1733
581
|
privilege_description: tier.privilege_description,
|
|
@@ -1857,7 +705,7 @@ const MembershipTierRenderer = () => {
|
|
|
1857
705
|
}
|
|
1858
706
|
closeDrawer();
|
|
1859
707
|
} catch (error) {
|
|
1860
|
-
if (axios
|
|
708
|
+
if (axios.isAxiosError(error)) {
|
|
1861
709
|
toast.error("Error saving tier", {
|
|
1862
710
|
description: (_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message,
|
|
1863
711
|
dismissable: true,
|
|
@@ -1888,7 +736,7 @@ const MembershipTierRenderer = () => {
|
|
|
1888
736
|
});
|
|
1889
737
|
closeDrawer();
|
|
1890
738
|
} catch (error) {
|
|
1891
|
-
if (axios
|
|
739
|
+
if (axios.isAxiosError(error)) {
|
|
1892
740
|
toast.error("Error deleting tier", {
|
|
1893
741
|
description: (_b = (_a = error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message,
|
|
1894
742
|
dismissable: true,
|