@myparcel-dev/pdk-admin-js 2.2.5 → 2.2.7
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/CHANGELOG.md +10 -0
- package/dist/OrderModeOrderListItem-lkgBZYlb.js +43 -0
- package/dist/PrintOptionsModalForm-BIGhMvHF.js +30 -0
- package/dist/ShipmentModeOrderListItem-C0gSveq1.js +58 -0
- package/dist/ShipmentOptionsModalForm-Eq6TGCE1.js +21 -0
- package/dist/ShipmentTableBox-BLkFhAGr.js +214 -0
- package/dist/{style.css → index.css} +1 -0
- package/dist/index.js +4001 -177
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/shared-IXbJs3EW.js +15405 -0
- package/package.json +4 -4
- package/vite.config.ts +10 -9
- package/dist/ChildProductSettings-CWdldjU8.js +0 -4
- package/dist/Modals-CqhfaUfv.js +0 -4
- package/dist/Notifications-BsEoAoXb.js +0 -4
- package/dist/OrderBox-Bn8AcI8b.js +0 -4
- package/dist/OrderListItem-DT_77Xo3.js +0 -4
- package/dist/OrderModeOrderListItem-BrBhUyyu.js +0 -60
- package/dist/PluginSettings-6qK6JuXL.js +0 -4
- package/dist/PrintOptionsModalForm-BhshAOse.js +0 -32
- package/dist/ProductSettings-D5kTD7jw.js +0 -4
- package/dist/ShipmentLabel.vue_vue_type_script_setup_true_lang-Cpk2IaBC.js +0 -212
- package/dist/ShipmentModeOrderListItem-wtNZ_vd8.js +0 -69
- package/dist/ShipmentOptionsModalForm-cj7Pa1yh.js +0 -25
- package/dist/ShipmentTableBox-PwR7YMws.js +0 -258
- package/dist/index-BCHGsSUm.js +0 -24316
package/dist/index.js
CHANGED
|
@@ -1,178 +1,4002 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { $ as useFetchProductsQuery, $n as isOfType, $r as toDisplayString, $t as NotificationContainer_default, A as resolveOrderParameters, An as M, Ar as h, At as useQueryStore, B as createMutationHandler, Bn as AdminIcon, Br as resolveDynamicComponent, Bt as ShipmentBarcode_default, C as shipmentsPrintAction, Cn as root, Cr as createBlock, Ct as useOrderMode, D as openOrPrintPdf, Dn as globalLogger, Dr as createVNode, E as waitForLabelPrompt, En as createLogger, Er as createTextVNode, Et as useGlobalContext, F as executeHandler, Fn as ne, Fr as openBlock, Ft as INJECT_ADMIN_INSTANCE, G as useDeleteWebhooksMutation, Gn as allAdminComponentNames, Gr as markRaw, Gt as FORM_KEY_ACCOUNT_SETTINGS, H as doMutate, Hn as AdminModalKey, Hr as withCtx, Ht as resolveFormComponent, I as StopActionHandler, In as xe, Ir as provide, It as INJECT_GLOBAL_PDK_ADMIN, J as usePrintShipmentsMutation, Jn as optionalAdminPlainWrapperComponentNames, Jr as toRaw, Jt as FORM_KEY_MODAL_PRINT_OPTIONS, K as useCreateWebhooksMutation, Kn as optionalAdminActionContainerComponentNames, Kr as reactive, Kt as FORM_KEY_CHILD_PRODUCT_SETTINGS, L as createShipmentsMutationHandler, Ln as AdminView, Lr as renderList, Lt as fillShipmentsQueryData, M as executeAction, Mn as Xe, Mr as mergeProps, Mt as prefixComponent, N as executeAfterHandle, Nn as c, Nr as onMounted, Nt as formToBody, O as modalCloseAction, On as getActionIdentifier, Or as defineAsyncComponent, Ot as useStoreContextQuery, P as executeBeforeHandle, Pn as je, Pr as onUnmounted, Pt as createFormElement, Q as useFetchShipmentsQuery, Qn as PackageTypeName, Qr as normalizeClass, Qt as FORM_KEY_PRODUCT_SETTINGS, R as createQueryHandler, Rn as OrderMode, Rr as renderSlot, Rt as ShipmentStatus_default, S as shipmentsExportReturnAction, Si as Subscribable, Sn as baseGetTag, Sr as createBaseVNode, St as usePluginSettings, T as resolvePrintParameters, Tn as LogLevel, Tr as createElementBlock, Tt as useInstanceContext, U as resolveQuerySuffix, Un as NotificationCategory, Ur as withDirectives, Ut as defineFormField, V as createHandlerWithParameters, Vn as AdminInstanceContextKey, Vr as watch, Vt as generateFormFields, W as defineAction, Wn as AdminComponent, Wt as FORM_KEYS, X as useDeleteShipmentsMutation, Xn as useVModel, Xr as toValue, Xt as FORM_KEY_MODAL_SHIPMENT_OPTIONS, Y as useExportReturnMutation, Yn as requiredAdminComponentNames, Yr as toRefs, Yt as FORM_KEY_MODAL_RETURN_OPTIONS, Z as useFetchWebhooksQuery, Zr as unref, Zt as FORM_KEY_PLUGIN_SETTINGS, _ as ordersFetchAction, _i as parseFilterArgs, _n as defineProperty, _r as createApp, _t as useFormatter, a as LIST_ITEM_MODE_ACTIONS, ai as createRetryer, an as useModalStore, ar as SortType, at as useUpdateOrdersMutation, b as shipmentActions, bi as replaceData, bn as isArray, br as KeepAlive, bt as Format, c as webhooksCreateAction, ci as focusManager, cn as createPinia, cr as Status, ct as usePdkMutation, d as ORDER_VIEW_IN_BACKOFFICE_ID, di as hashQueryKey, dn as Map, dr as useQueryClient, dt as createActionContext, ei as Mutation, er as partitionArray, et as useFetchOrdersQuery, f as orderExportAction, fi as hashQueryKeyByOptions, fn as ListCache, fr as cloneDeepUnref, g as ordersExportPrintShipmentsAction, gi as noop, gn as isIndex, gt as useLocalizedFormatter, h as ordersEditAction, hi as matchQuery, hn as baseAssignValue, hr as Transition, ht as useOrderData, i as BOX_MODE_ACTIONS, ii as canFetch, in as ActionButton_default, ir as AdminContextKey, it as useUpdateProductSettingsMutation, j as executeNextAction, jn as Ne, jr as inject, jt as downloadFileFromUrl, k as modalSubmitFormAction, kn as Je, kr as defineComponent, kt as useStoreQuery, l as webhooksDeleteAction, li as functionalUpdate, ln as get, lr as Variant, lt as instantiateActions, m as orderViewInBackofficeAction, mi as matchMutation, mn as eq, mr as isQueryKey, mt as useOrdersData, n as ProductSettings_default, ni as notifyManager, nn as PackageType_default, nr as BackendEndpoint, nt as QUERY_KEY_SHIPMENT, o as MODAL_MODE_ACTIONS, oi as isCancelledError, on as useNotificationStore, or as TriState, ot as usePrintOrdersMutation, p as orderExportToShipmentsAction, pi as isServer, pn as assignValue, pr as getClientKey, pt as useProductData, q as useUpdateShipmentsMutation, qn as optionalAdminComponentNames, qr as ref, qt as FORM_KEY_MODAL, ri as defaultLogger, rn as BulkSelectCheckbox_default, rr as FrontendEndpoint, rt as useFetchContextQuery, s as STORE_MODE_ACTIONS, si as onlineManager, sn as useActionStore, sr as Size, st as useExportOrdersMutation, ti as Removable, tn as usePdkAdminApi, tr as toArray, tt as QUERY_KEY_ORDER, u as webhooksFetchAction, ui as getAbortController, un as MapCache, ur as setupDevtoolsPlugin, ut as instantiateAction, v as ordersPrintAction, vi as parseQueryArgs, vn as isFunction, vr as vShow, vt as useAdminConfig, w as shipmentsUpdateAction, wn as freeGlobal, wr as createCommentVNode, wt as useLoading, x as shipmentsDeleteAction, xi as timeUntilStale, xn as isObjectLike, xr as computed, xt as useLanguage, y as ordersUpdateAction, yi as partialMatchKey, yn as isObject, yr as Fragment, yt as useAdminInstance, z as createOrdersMutationHandler, zn as AdminAction, zr as resolveComponent, zt as ShipmentOptionsForm_default } from "./shared-IXbJs3EW.js";
|
|
3
|
+
//#region ../../node_modules/@tanstack/query-core/build/lib/query.mjs
|
|
4
|
+
var Query = class extends Removable {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
super();
|
|
7
|
+
this.abortSignalConsumed = false;
|
|
8
|
+
this.defaultOptions = config.defaultOptions;
|
|
9
|
+
this.setOptions(config.options);
|
|
10
|
+
this.observers = [];
|
|
11
|
+
this.cache = config.cache;
|
|
12
|
+
this.logger = config.logger || defaultLogger;
|
|
13
|
+
this.queryKey = config.queryKey;
|
|
14
|
+
this.queryHash = config.queryHash;
|
|
15
|
+
this.initialState = config.state || getDefaultState(this.options);
|
|
16
|
+
this.state = this.initialState;
|
|
17
|
+
this.scheduleGc();
|
|
18
|
+
}
|
|
19
|
+
get meta() {
|
|
20
|
+
return this.options.meta;
|
|
21
|
+
}
|
|
22
|
+
setOptions(options) {
|
|
23
|
+
this.options = {
|
|
24
|
+
...this.defaultOptions,
|
|
25
|
+
...options
|
|
26
|
+
};
|
|
27
|
+
this.updateCacheTime(this.options.cacheTime);
|
|
28
|
+
}
|
|
29
|
+
optionalRemove() {
|
|
30
|
+
if (!this.observers.length && this.state.fetchStatus === "idle") this.cache.remove(this);
|
|
31
|
+
}
|
|
32
|
+
setData(newData, options) {
|
|
33
|
+
const data = replaceData(this.state.data, newData, this.options);
|
|
34
|
+
this.dispatch({
|
|
35
|
+
data,
|
|
36
|
+
type: "success",
|
|
37
|
+
dataUpdatedAt: options == null ? void 0 : options.updatedAt,
|
|
38
|
+
manual: options == null ? void 0 : options.manual
|
|
39
|
+
});
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
setState(state, setStateOptions) {
|
|
43
|
+
this.dispatch({
|
|
44
|
+
type: "setState",
|
|
45
|
+
state,
|
|
46
|
+
setStateOptions
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
cancel(options) {
|
|
50
|
+
var _this$retryer;
|
|
51
|
+
const promise = this.promise;
|
|
52
|
+
(_this$retryer = this.retryer) == null || _this$retryer.cancel(options);
|
|
53
|
+
return promise ? promise.then(noop).catch(noop) : Promise.resolve();
|
|
54
|
+
}
|
|
55
|
+
destroy() {
|
|
56
|
+
super.destroy();
|
|
57
|
+
this.cancel({ silent: true });
|
|
58
|
+
}
|
|
59
|
+
reset() {
|
|
60
|
+
this.destroy();
|
|
61
|
+
this.setState(this.initialState);
|
|
62
|
+
}
|
|
63
|
+
isActive() {
|
|
64
|
+
return this.observers.some((observer) => observer.options.enabled !== false);
|
|
65
|
+
}
|
|
66
|
+
isDisabled() {
|
|
67
|
+
return this.getObserversCount() > 0 && !this.isActive();
|
|
68
|
+
}
|
|
69
|
+
isStale() {
|
|
70
|
+
return this.state.isInvalidated || !this.state.dataUpdatedAt || this.observers.some((observer) => observer.getCurrentResult().isStale);
|
|
71
|
+
}
|
|
72
|
+
isStaleByTime(staleTime = 0) {
|
|
73
|
+
return this.state.isInvalidated || !this.state.dataUpdatedAt || !timeUntilStale(this.state.dataUpdatedAt, staleTime);
|
|
74
|
+
}
|
|
75
|
+
onFocus() {
|
|
76
|
+
var _this$retryer2;
|
|
77
|
+
const observer = this.observers.find((x) => x.shouldFetchOnWindowFocus());
|
|
78
|
+
if (observer) observer.refetch({ cancelRefetch: false });
|
|
79
|
+
(_this$retryer2 = this.retryer) == null || _this$retryer2.continue();
|
|
80
|
+
}
|
|
81
|
+
onOnline() {
|
|
82
|
+
var _this$retryer3;
|
|
83
|
+
const observer = this.observers.find((x) => x.shouldFetchOnReconnect());
|
|
84
|
+
if (observer) observer.refetch({ cancelRefetch: false });
|
|
85
|
+
(_this$retryer3 = this.retryer) == null || _this$retryer3.continue();
|
|
86
|
+
}
|
|
87
|
+
addObserver(observer) {
|
|
88
|
+
if (!this.observers.includes(observer)) {
|
|
89
|
+
this.observers.push(observer);
|
|
90
|
+
this.clearGcTimeout();
|
|
91
|
+
this.cache.notify({
|
|
92
|
+
type: "observerAdded",
|
|
93
|
+
query: this,
|
|
94
|
+
observer
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
removeObserver(observer) {
|
|
99
|
+
if (this.observers.includes(observer)) {
|
|
100
|
+
this.observers = this.observers.filter((x) => x !== observer);
|
|
101
|
+
if (!this.observers.length) {
|
|
102
|
+
if (this.retryer) {
|
|
103
|
+
if (this.abortSignalConsumed) this.retryer.cancel({ revert: true });
|
|
104
|
+
else this.retryer.cancelRetry();
|
|
105
|
+
}
|
|
106
|
+
this.scheduleGc();
|
|
107
|
+
}
|
|
108
|
+
this.cache.notify({
|
|
109
|
+
type: "observerRemoved",
|
|
110
|
+
query: this,
|
|
111
|
+
observer
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
getObserversCount() {
|
|
116
|
+
return this.observers.length;
|
|
117
|
+
}
|
|
118
|
+
invalidate() {
|
|
119
|
+
if (!this.state.isInvalidated) this.dispatch({ type: "invalidate" });
|
|
120
|
+
}
|
|
121
|
+
fetch(options, fetchOptions) {
|
|
122
|
+
var _this$options$behavio, _context$fetchOptions;
|
|
123
|
+
if (this.state.fetchStatus !== "idle") {
|
|
124
|
+
if (this.state.dataUpdatedAt && fetchOptions != null && fetchOptions.cancelRefetch) this.cancel({ silent: true });
|
|
125
|
+
else if (this.promise) {
|
|
126
|
+
var _this$retryer4;
|
|
127
|
+
(_this$retryer4 = this.retryer) == null || _this$retryer4.continueRetry();
|
|
128
|
+
return this.promise;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (options) this.setOptions(options);
|
|
132
|
+
if (!this.options.queryFn) {
|
|
133
|
+
const observer = this.observers.find((x) => x.options.queryFn);
|
|
134
|
+
if (observer) this.setOptions(observer.options);
|
|
135
|
+
}
|
|
136
|
+
if (process.env.NODE_ENV !== "production") {
|
|
137
|
+
if (!Array.isArray(this.options.queryKey)) this.logger.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']");
|
|
138
|
+
}
|
|
139
|
+
const abortController = getAbortController();
|
|
140
|
+
const queryFnContext = {
|
|
141
|
+
queryKey: this.queryKey,
|
|
142
|
+
pageParam: void 0,
|
|
143
|
+
meta: this.meta
|
|
144
|
+
};
|
|
145
|
+
const addSignalProperty = (object) => {
|
|
146
|
+
Object.defineProperty(object, "signal", {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
get: () => {
|
|
149
|
+
if (abortController) {
|
|
150
|
+
this.abortSignalConsumed = true;
|
|
151
|
+
return abortController.signal;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
addSignalProperty(queryFnContext);
|
|
157
|
+
const fetchFn = () => {
|
|
158
|
+
if (!this.options.queryFn) return Promise.reject("Missing queryFn for queryKey '" + this.options.queryHash + "'");
|
|
159
|
+
this.abortSignalConsumed = false;
|
|
160
|
+
return this.options.queryFn(queryFnContext);
|
|
161
|
+
};
|
|
162
|
+
const context = {
|
|
163
|
+
fetchOptions,
|
|
164
|
+
options: this.options,
|
|
165
|
+
queryKey: this.queryKey,
|
|
166
|
+
state: this.state,
|
|
167
|
+
fetchFn
|
|
168
|
+
};
|
|
169
|
+
addSignalProperty(context);
|
|
170
|
+
(_this$options$behavio = this.options.behavior) == null || _this$options$behavio.onFetch(context);
|
|
171
|
+
this.revertState = this.state;
|
|
172
|
+
if (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((_context$fetchOptions = context.fetchOptions) == null ? void 0 : _context$fetchOptions.meta)) {
|
|
173
|
+
var _context$fetchOptions2;
|
|
174
|
+
this.dispatch({
|
|
175
|
+
type: "fetch",
|
|
176
|
+
meta: (_context$fetchOptions2 = context.fetchOptions) == null ? void 0 : _context$fetchOptions2.meta
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
const onError = (error) => {
|
|
180
|
+
if (!(isCancelledError(error) && error.silent)) this.dispatch({
|
|
181
|
+
type: "error",
|
|
182
|
+
error
|
|
183
|
+
});
|
|
184
|
+
if (!isCancelledError(error)) {
|
|
185
|
+
var _this$cache$config$on, _this$cache$config, _this$cache$config$on2, _this$cache$config2;
|
|
186
|
+
(_this$cache$config$on = (_this$cache$config = this.cache.config).onError) == null || _this$cache$config$on.call(_this$cache$config, error, this);
|
|
187
|
+
(_this$cache$config$on2 = (_this$cache$config2 = this.cache.config).onSettled) == null || _this$cache$config$on2.call(_this$cache$config2, this.state.data, error, this);
|
|
188
|
+
if (process.env.NODE_ENV !== "production") this.logger.error(error);
|
|
189
|
+
}
|
|
190
|
+
if (!this.isFetchingOptimistic) this.scheduleGc();
|
|
191
|
+
this.isFetchingOptimistic = false;
|
|
192
|
+
};
|
|
193
|
+
this.retryer = createRetryer({
|
|
194
|
+
fn: context.fetchFn,
|
|
195
|
+
abort: abortController == null ? void 0 : abortController.abort.bind(abortController),
|
|
196
|
+
onSuccess: (data) => {
|
|
197
|
+
var _this$cache$config$on3, _this$cache$config3, _this$cache$config$on4, _this$cache$config4;
|
|
198
|
+
if (typeof data === "undefined") {
|
|
199
|
+
if (process.env.NODE_ENV !== "production") this.logger.error("Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: " + this.queryHash);
|
|
200
|
+
onError(/* @__PURE__ */ new Error(this.queryHash + " data is undefined"));
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
this.setData(data);
|
|
204
|
+
(_this$cache$config$on3 = (_this$cache$config3 = this.cache.config).onSuccess) == null || _this$cache$config$on3.call(_this$cache$config3, data, this);
|
|
205
|
+
(_this$cache$config$on4 = (_this$cache$config4 = this.cache.config).onSettled) == null || _this$cache$config$on4.call(_this$cache$config4, data, this.state.error, this);
|
|
206
|
+
if (!this.isFetchingOptimistic) this.scheduleGc();
|
|
207
|
+
this.isFetchingOptimistic = false;
|
|
208
|
+
},
|
|
209
|
+
onError,
|
|
210
|
+
onFail: (failureCount, error) => {
|
|
211
|
+
this.dispatch({
|
|
212
|
+
type: "failed",
|
|
213
|
+
failureCount,
|
|
214
|
+
error
|
|
215
|
+
});
|
|
216
|
+
},
|
|
217
|
+
onPause: () => {
|
|
218
|
+
this.dispatch({ type: "pause" });
|
|
219
|
+
},
|
|
220
|
+
onContinue: () => {
|
|
221
|
+
this.dispatch({ type: "continue" });
|
|
222
|
+
},
|
|
223
|
+
retry: context.options.retry,
|
|
224
|
+
retryDelay: context.options.retryDelay,
|
|
225
|
+
networkMode: context.options.networkMode
|
|
226
|
+
});
|
|
227
|
+
this.promise = this.retryer.promise;
|
|
228
|
+
return this.promise;
|
|
229
|
+
}
|
|
230
|
+
dispatch(action) {
|
|
231
|
+
const reducer = (state) => {
|
|
232
|
+
var _action$meta, _action$dataUpdatedAt;
|
|
233
|
+
switch (action.type) {
|
|
234
|
+
case "failed": return {
|
|
235
|
+
...state,
|
|
236
|
+
fetchFailureCount: action.failureCount,
|
|
237
|
+
fetchFailureReason: action.error
|
|
238
|
+
};
|
|
239
|
+
case "pause": return {
|
|
240
|
+
...state,
|
|
241
|
+
fetchStatus: "paused"
|
|
242
|
+
};
|
|
243
|
+
case "continue": return {
|
|
244
|
+
...state,
|
|
245
|
+
fetchStatus: "fetching"
|
|
246
|
+
};
|
|
247
|
+
case "fetch": return {
|
|
248
|
+
...state,
|
|
249
|
+
fetchFailureCount: 0,
|
|
250
|
+
fetchFailureReason: null,
|
|
251
|
+
fetchMeta: (_action$meta = action.meta) != null ? _action$meta : null,
|
|
252
|
+
fetchStatus: canFetch(this.options.networkMode) ? "fetching" : "paused",
|
|
253
|
+
...!state.dataUpdatedAt && {
|
|
254
|
+
error: null,
|
|
255
|
+
status: "loading"
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
case "success": return {
|
|
259
|
+
...state,
|
|
260
|
+
data: action.data,
|
|
261
|
+
dataUpdateCount: state.dataUpdateCount + 1,
|
|
262
|
+
dataUpdatedAt: (_action$dataUpdatedAt = action.dataUpdatedAt) != null ? _action$dataUpdatedAt : Date.now(),
|
|
263
|
+
error: null,
|
|
264
|
+
isInvalidated: false,
|
|
265
|
+
status: "success",
|
|
266
|
+
...!action.manual && {
|
|
267
|
+
fetchStatus: "idle",
|
|
268
|
+
fetchFailureCount: 0,
|
|
269
|
+
fetchFailureReason: null
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
case "error":
|
|
273
|
+
const error = action.error;
|
|
274
|
+
if (isCancelledError(error) && error.revert && this.revertState) return {
|
|
275
|
+
...this.revertState,
|
|
276
|
+
fetchStatus: "idle"
|
|
277
|
+
};
|
|
278
|
+
return {
|
|
279
|
+
...state,
|
|
280
|
+
error,
|
|
281
|
+
errorUpdateCount: state.errorUpdateCount + 1,
|
|
282
|
+
errorUpdatedAt: Date.now(),
|
|
283
|
+
fetchFailureCount: state.fetchFailureCount + 1,
|
|
284
|
+
fetchFailureReason: error,
|
|
285
|
+
fetchStatus: "idle",
|
|
286
|
+
status: "error"
|
|
287
|
+
};
|
|
288
|
+
case "invalidate": return {
|
|
289
|
+
...state,
|
|
290
|
+
isInvalidated: true
|
|
291
|
+
};
|
|
292
|
+
case "setState": return {
|
|
293
|
+
...state,
|
|
294
|
+
...action.state
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
this.state = reducer(this.state);
|
|
299
|
+
notifyManager.batch(() => {
|
|
300
|
+
this.observers.forEach((observer) => {
|
|
301
|
+
observer.onQueryUpdate(action);
|
|
302
|
+
});
|
|
303
|
+
this.cache.notify({
|
|
304
|
+
query: this,
|
|
305
|
+
type: "updated",
|
|
306
|
+
action
|
|
307
|
+
});
|
|
308
|
+
});
|
|
309
|
+
}
|
|
178
310
|
};
|
|
311
|
+
function getDefaultState(options) {
|
|
312
|
+
const data = typeof options.initialData === "function" ? options.initialData() : options.initialData;
|
|
313
|
+
const hasData = typeof data !== "undefined";
|
|
314
|
+
const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === "function" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;
|
|
315
|
+
return {
|
|
316
|
+
data,
|
|
317
|
+
dataUpdateCount: 0,
|
|
318
|
+
dataUpdatedAt: hasData ? initialDataUpdatedAt != null ? initialDataUpdatedAt : Date.now() : 0,
|
|
319
|
+
error: null,
|
|
320
|
+
errorUpdateCount: 0,
|
|
321
|
+
errorUpdatedAt: 0,
|
|
322
|
+
fetchFailureCount: 0,
|
|
323
|
+
fetchFailureReason: null,
|
|
324
|
+
fetchMeta: null,
|
|
325
|
+
isInvalidated: false,
|
|
326
|
+
status: hasData ? "success" : "loading",
|
|
327
|
+
fetchStatus: "idle"
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
//#endregion
|
|
331
|
+
//#region ../../node_modules/@tanstack/query-core/build/lib/queryCache.mjs
|
|
332
|
+
var QueryCache$1 = class extends Subscribable {
|
|
333
|
+
constructor(config) {
|
|
334
|
+
super();
|
|
335
|
+
this.config = config || {};
|
|
336
|
+
this.queries = [];
|
|
337
|
+
this.queriesMap = {};
|
|
338
|
+
}
|
|
339
|
+
build(client, options, state) {
|
|
340
|
+
var _options$queryHash;
|
|
341
|
+
const queryKey = options.queryKey;
|
|
342
|
+
const queryHash = (_options$queryHash = options.queryHash) != null ? _options$queryHash : hashQueryKeyByOptions(queryKey, options);
|
|
343
|
+
let query = this.get(queryHash);
|
|
344
|
+
if (!query) {
|
|
345
|
+
query = new Query({
|
|
346
|
+
cache: this,
|
|
347
|
+
logger: client.getLogger(),
|
|
348
|
+
queryKey,
|
|
349
|
+
queryHash,
|
|
350
|
+
options: client.defaultQueryOptions(options),
|
|
351
|
+
state,
|
|
352
|
+
defaultOptions: client.getQueryDefaults(queryKey)
|
|
353
|
+
});
|
|
354
|
+
this.add(query);
|
|
355
|
+
}
|
|
356
|
+
return query;
|
|
357
|
+
}
|
|
358
|
+
add(query) {
|
|
359
|
+
if (!this.queriesMap[query.queryHash]) {
|
|
360
|
+
this.queriesMap[query.queryHash] = query;
|
|
361
|
+
this.queries.push(query);
|
|
362
|
+
this.notify({
|
|
363
|
+
type: "added",
|
|
364
|
+
query
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
remove(query) {
|
|
369
|
+
const queryInMap = this.queriesMap[query.queryHash];
|
|
370
|
+
if (queryInMap) {
|
|
371
|
+
query.destroy();
|
|
372
|
+
this.queries = this.queries.filter((x) => x !== query);
|
|
373
|
+
if (queryInMap === query) delete this.queriesMap[query.queryHash];
|
|
374
|
+
this.notify({
|
|
375
|
+
type: "removed",
|
|
376
|
+
query
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
clear() {
|
|
381
|
+
notifyManager.batch(() => {
|
|
382
|
+
this.queries.forEach((query) => {
|
|
383
|
+
this.remove(query);
|
|
384
|
+
});
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
get(queryHash) {
|
|
388
|
+
return this.queriesMap[queryHash];
|
|
389
|
+
}
|
|
390
|
+
getAll() {
|
|
391
|
+
return this.queries;
|
|
392
|
+
}
|
|
393
|
+
find(arg1, arg2) {
|
|
394
|
+
const [filters] = parseFilterArgs(arg1, arg2);
|
|
395
|
+
if (typeof filters.exact === "undefined") filters.exact = true;
|
|
396
|
+
return this.queries.find((query) => matchQuery(filters, query));
|
|
397
|
+
}
|
|
398
|
+
findAll(arg1, arg2) {
|
|
399
|
+
const [filters] = parseFilterArgs(arg1, arg2);
|
|
400
|
+
return Object.keys(filters).length > 0 ? this.queries.filter((query) => matchQuery(filters, query)) : this.queries;
|
|
401
|
+
}
|
|
402
|
+
notify(event) {
|
|
403
|
+
notifyManager.batch(() => {
|
|
404
|
+
this.listeners.forEach(({ listener }) => {
|
|
405
|
+
listener(event);
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
onFocus() {
|
|
410
|
+
notifyManager.batch(() => {
|
|
411
|
+
this.queries.forEach((query) => {
|
|
412
|
+
query.onFocus();
|
|
413
|
+
});
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
onOnline() {
|
|
417
|
+
notifyManager.batch(() => {
|
|
418
|
+
this.queries.forEach((query) => {
|
|
419
|
+
query.onOnline();
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
//#endregion
|
|
425
|
+
//#region ../../node_modules/@tanstack/query-core/build/lib/mutationCache.mjs
|
|
426
|
+
var MutationCache$1 = class extends Subscribable {
|
|
427
|
+
constructor(config) {
|
|
428
|
+
super();
|
|
429
|
+
this.config = config || {};
|
|
430
|
+
this.mutations = [];
|
|
431
|
+
this.mutationId = 0;
|
|
432
|
+
}
|
|
433
|
+
build(client, options, state) {
|
|
434
|
+
const mutation = new Mutation({
|
|
435
|
+
mutationCache: this,
|
|
436
|
+
logger: client.getLogger(),
|
|
437
|
+
mutationId: ++this.mutationId,
|
|
438
|
+
options: client.defaultMutationOptions(options),
|
|
439
|
+
state,
|
|
440
|
+
defaultOptions: options.mutationKey ? client.getMutationDefaults(options.mutationKey) : void 0
|
|
441
|
+
});
|
|
442
|
+
this.add(mutation);
|
|
443
|
+
return mutation;
|
|
444
|
+
}
|
|
445
|
+
add(mutation) {
|
|
446
|
+
this.mutations.push(mutation);
|
|
447
|
+
this.notify({
|
|
448
|
+
type: "added",
|
|
449
|
+
mutation
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
remove(mutation) {
|
|
453
|
+
this.mutations = this.mutations.filter((x) => x !== mutation);
|
|
454
|
+
this.notify({
|
|
455
|
+
type: "removed",
|
|
456
|
+
mutation
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
clear() {
|
|
460
|
+
notifyManager.batch(() => {
|
|
461
|
+
this.mutations.forEach((mutation) => {
|
|
462
|
+
this.remove(mutation);
|
|
463
|
+
});
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
getAll() {
|
|
467
|
+
return this.mutations;
|
|
468
|
+
}
|
|
469
|
+
find(filters) {
|
|
470
|
+
if (typeof filters.exact === "undefined") filters.exact = true;
|
|
471
|
+
return this.mutations.find((mutation) => matchMutation(filters, mutation));
|
|
472
|
+
}
|
|
473
|
+
findAll(filters) {
|
|
474
|
+
return this.mutations.filter((mutation) => matchMutation(filters, mutation));
|
|
475
|
+
}
|
|
476
|
+
notify(event) {
|
|
477
|
+
notifyManager.batch(() => {
|
|
478
|
+
this.listeners.forEach(({ listener }) => {
|
|
479
|
+
listener(event);
|
|
480
|
+
});
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
resumePausedMutations() {
|
|
484
|
+
var _this$resuming;
|
|
485
|
+
this.resuming = ((_this$resuming = this.resuming) != null ? _this$resuming : Promise.resolve()).then(() => {
|
|
486
|
+
const pausedMutations = this.mutations.filter((x) => x.state.isPaused);
|
|
487
|
+
return notifyManager.batch(() => pausedMutations.reduce((promise, mutation) => promise.then(() => mutation.continue().catch(noop)), Promise.resolve()));
|
|
488
|
+
}).then(() => {
|
|
489
|
+
this.resuming = void 0;
|
|
490
|
+
});
|
|
491
|
+
return this.resuming;
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
//#endregion
|
|
495
|
+
//#region ../../node_modules/@tanstack/query-core/build/lib/infiniteQueryBehavior.mjs
|
|
496
|
+
function infiniteQueryBehavior() {
|
|
497
|
+
return { onFetch: (context) => {
|
|
498
|
+
context.fetchFn = () => {
|
|
499
|
+
var _context$fetchOptions, _context$fetchOptions2, _context$fetchOptions3, _context$fetchOptions4, _context$state$data, _context$state$data2;
|
|
500
|
+
const refetchPage = (_context$fetchOptions = context.fetchOptions) == null ? void 0 : (_context$fetchOptions2 = _context$fetchOptions.meta) == null ? void 0 : _context$fetchOptions2.refetchPage;
|
|
501
|
+
const fetchMore = (_context$fetchOptions3 = context.fetchOptions) == null ? void 0 : (_context$fetchOptions4 = _context$fetchOptions3.meta) == null ? void 0 : _context$fetchOptions4.fetchMore;
|
|
502
|
+
const pageParam = fetchMore == null ? void 0 : fetchMore.pageParam;
|
|
503
|
+
const isFetchingNextPage = (fetchMore == null ? void 0 : fetchMore.direction) === "forward";
|
|
504
|
+
const isFetchingPreviousPage = (fetchMore == null ? void 0 : fetchMore.direction) === "backward";
|
|
505
|
+
const oldPages = ((_context$state$data = context.state.data) == null ? void 0 : _context$state$data.pages) || [];
|
|
506
|
+
const oldPageParams = ((_context$state$data2 = context.state.data) == null ? void 0 : _context$state$data2.pageParams) || [];
|
|
507
|
+
let newPageParams = oldPageParams;
|
|
508
|
+
let cancelled = false;
|
|
509
|
+
const addSignalProperty = (object) => {
|
|
510
|
+
Object.defineProperty(object, "signal", {
|
|
511
|
+
enumerable: true,
|
|
512
|
+
get: () => {
|
|
513
|
+
var _context$signal;
|
|
514
|
+
if ((_context$signal = context.signal) != null && _context$signal.aborted) cancelled = true;
|
|
515
|
+
else {
|
|
516
|
+
var _context$signal2;
|
|
517
|
+
(_context$signal2 = context.signal) == null || _context$signal2.addEventListener("abort", () => {
|
|
518
|
+
cancelled = true;
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
return context.signal;
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
};
|
|
525
|
+
const queryFn = context.options.queryFn || (() => Promise.reject("Missing queryFn for queryKey '" + context.options.queryHash + "'"));
|
|
526
|
+
const buildNewPages = (pages, param, page, previous) => {
|
|
527
|
+
newPageParams = previous ? [param, ...newPageParams] : [...newPageParams, param];
|
|
528
|
+
return previous ? [page, ...pages] : [...pages, page];
|
|
529
|
+
};
|
|
530
|
+
const fetchPage = (pages, manual, param, previous) => {
|
|
531
|
+
if (cancelled) return Promise.reject("Cancelled");
|
|
532
|
+
if (typeof param === "undefined" && !manual && pages.length) return Promise.resolve(pages);
|
|
533
|
+
const queryFnContext = {
|
|
534
|
+
queryKey: context.queryKey,
|
|
535
|
+
pageParam: param,
|
|
536
|
+
meta: context.options.meta
|
|
537
|
+
};
|
|
538
|
+
addSignalProperty(queryFnContext);
|
|
539
|
+
const queryFnResult = queryFn(queryFnContext);
|
|
540
|
+
return Promise.resolve(queryFnResult).then((page) => buildNewPages(pages, param, page, previous));
|
|
541
|
+
};
|
|
542
|
+
let promise;
|
|
543
|
+
if (!oldPages.length) promise = fetchPage([]);
|
|
544
|
+
else if (isFetchingNextPage) {
|
|
545
|
+
const manual = typeof pageParam !== "undefined";
|
|
546
|
+
promise = fetchPage(oldPages, manual, manual ? pageParam : getNextPageParam(context.options, oldPages));
|
|
547
|
+
} else if (isFetchingPreviousPage) {
|
|
548
|
+
const manual = typeof pageParam !== "undefined";
|
|
549
|
+
promise = fetchPage(oldPages, manual, manual ? pageParam : getPreviousPageParam(context.options, oldPages), true);
|
|
550
|
+
} else {
|
|
551
|
+
newPageParams = [];
|
|
552
|
+
const manual = typeof context.options.getNextPageParam === "undefined";
|
|
553
|
+
promise = (refetchPage && oldPages[0] ? refetchPage(oldPages[0], 0, oldPages) : true) ? fetchPage([], manual, oldPageParams[0]) : Promise.resolve(buildNewPages([], oldPageParams[0], oldPages[0]));
|
|
554
|
+
for (let i = 1; i < oldPages.length; i++) promise = promise.then((pages) => {
|
|
555
|
+
if (refetchPage && oldPages[i] ? refetchPage(oldPages[i], i, oldPages) : true) {
|
|
556
|
+
const param = manual ? oldPageParams[i] : getNextPageParam(context.options, pages);
|
|
557
|
+
return fetchPage(pages, manual, param);
|
|
558
|
+
}
|
|
559
|
+
return Promise.resolve(buildNewPages(pages, oldPageParams[i], oldPages[i]));
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
return promise.then((pages) => ({
|
|
563
|
+
pages,
|
|
564
|
+
pageParams: newPageParams
|
|
565
|
+
}));
|
|
566
|
+
};
|
|
567
|
+
} };
|
|
568
|
+
}
|
|
569
|
+
function getNextPageParam(options, pages) {
|
|
570
|
+
return options.getNextPageParam == null ? void 0 : options.getNextPageParam(pages[pages.length - 1], pages);
|
|
571
|
+
}
|
|
572
|
+
function getPreviousPageParam(options, pages) {
|
|
573
|
+
return options.getPreviousPageParam == null ? void 0 : options.getPreviousPageParam(pages[0], pages);
|
|
574
|
+
}
|
|
575
|
+
//#endregion
|
|
576
|
+
//#region ../../node_modules/@tanstack/query-core/build/lib/queryClient.mjs
|
|
577
|
+
var QueryClient$1 = class {
|
|
578
|
+
constructor(config = {}) {
|
|
579
|
+
this.queryCache = config.queryCache || new QueryCache$1();
|
|
580
|
+
this.mutationCache = config.mutationCache || new MutationCache$1();
|
|
581
|
+
this.logger = config.logger || defaultLogger;
|
|
582
|
+
this.defaultOptions = config.defaultOptions || {};
|
|
583
|
+
this.queryDefaults = [];
|
|
584
|
+
this.mutationDefaults = [];
|
|
585
|
+
this.mountCount = 0;
|
|
586
|
+
if (process.env.NODE_ENV !== "production" && config.logger) this.logger.error("Passing a custom logger has been deprecated and will be removed in the next major version.");
|
|
587
|
+
}
|
|
588
|
+
mount() {
|
|
589
|
+
this.mountCount++;
|
|
590
|
+
if (this.mountCount !== 1) return;
|
|
591
|
+
this.unsubscribeFocus = focusManager.subscribe(() => {
|
|
592
|
+
if (focusManager.isFocused()) {
|
|
593
|
+
this.resumePausedMutations();
|
|
594
|
+
this.queryCache.onFocus();
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
this.unsubscribeOnline = onlineManager.subscribe(() => {
|
|
598
|
+
if (onlineManager.isOnline()) {
|
|
599
|
+
this.resumePausedMutations();
|
|
600
|
+
this.queryCache.onOnline();
|
|
601
|
+
}
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
unmount() {
|
|
605
|
+
var _this$unsubscribeFocu, _this$unsubscribeOnli;
|
|
606
|
+
this.mountCount--;
|
|
607
|
+
if (this.mountCount !== 0) return;
|
|
608
|
+
(_this$unsubscribeFocu = this.unsubscribeFocus) == null || _this$unsubscribeFocu.call(this);
|
|
609
|
+
this.unsubscribeFocus = void 0;
|
|
610
|
+
(_this$unsubscribeOnli = this.unsubscribeOnline) == null || _this$unsubscribeOnli.call(this);
|
|
611
|
+
this.unsubscribeOnline = void 0;
|
|
612
|
+
}
|
|
613
|
+
isFetching(arg1, arg2) {
|
|
614
|
+
const [filters] = parseFilterArgs(arg1, arg2);
|
|
615
|
+
filters.fetchStatus = "fetching";
|
|
616
|
+
return this.queryCache.findAll(filters).length;
|
|
617
|
+
}
|
|
618
|
+
isMutating(filters) {
|
|
619
|
+
return this.mutationCache.findAll({
|
|
620
|
+
...filters,
|
|
621
|
+
fetching: true
|
|
622
|
+
}).length;
|
|
623
|
+
}
|
|
624
|
+
getQueryData(queryKey, filters) {
|
|
625
|
+
var _this$queryCache$find;
|
|
626
|
+
return (_this$queryCache$find = this.queryCache.find(queryKey, filters)) == null ? void 0 : _this$queryCache$find.state.data;
|
|
627
|
+
}
|
|
628
|
+
ensureQueryData(arg1, arg2, arg3) {
|
|
629
|
+
const parsedOptions = parseQueryArgs(arg1, arg2, arg3);
|
|
630
|
+
const cachedData = this.getQueryData(parsedOptions.queryKey);
|
|
631
|
+
return cachedData ? Promise.resolve(cachedData) : this.fetchQuery(parsedOptions);
|
|
632
|
+
}
|
|
633
|
+
getQueriesData(queryKeyOrFilters) {
|
|
634
|
+
return this.getQueryCache().findAll(queryKeyOrFilters).map(({ queryKey, state }) => {
|
|
635
|
+
return [queryKey, state.data];
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
setQueryData(queryKey, updater, options) {
|
|
639
|
+
const query = this.queryCache.find(queryKey);
|
|
640
|
+
const prevData = query == null ? void 0 : query.state.data;
|
|
641
|
+
const data = functionalUpdate(updater, prevData);
|
|
642
|
+
if (typeof data === "undefined") return;
|
|
643
|
+
const parsedOptions = parseQueryArgs(queryKey);
|
|
644
|
+
const defaultedOptions = this.defaultQueryOptions(parsedOptions);
|
|
645
|
+
return this.queryCache.build(this, defaultedOptions).setData(data, {
|
|
646
|
+
...options,
|
|
647
|
+
manual: true
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
setQueriesData(queryKeyOrFilters, updater, options) {
|
|
651
|
+
return notifyManager.batch(() => this.getQueryCache().findAll(queryKeyOrFilters).map(({ queryKey }) => [queryKey, this.setQueryData(queryKey, updater, options)]));
|
|
652
|
+
}
|
|
653
|
+
getQueryState(queryKey, filters) {
|
|
654
|
+
var _this$queryCache$find2;
|
|
655
|
+
return (_this$queryCache$find2 = this.queryCache.find(queryKey, filters)) == null ? void 0 : _this$queryCache$find2.state;
|
|
656
|
+
}
|
|
657
|
+
removeQueries(arg1, arg2) {
|
|
658
|
+
const [filters] = parseFilterArgs(arg1, arg2);
|
|
659
|
+
const queryCache = this.queryCache;
|
|
660
|
+
notifyManager.batch(() => {
|
|
661
|
+
queryCache.findAll(filters).forEach((query) => {
|
|
662
|
+
queryCache.remove(query);
|
|
663
|
+
});
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
resetQueries(arg1, arg2, arg3) {
|
|
667
|
+
const [filters, options] = parseFilterArgs(arg1, arg2, arg3);
|
|
668
|
+
const queryCache = this.queryCache;
|
|
669
|
+
const refetchFilters = {
|
|
670
|
+
type: "active",
|
|
671
|
+
...filters
|
|
672
|
+
};
|
|
673
|
+
return notifyManager.batch(() => {
|
|
674
|
+
queryCache.findAll(filters).forEach((query) => {
|
|
675
|
+
query.reset();
|
|
676
|
+
});
|
|
677
|
+
return this.refetchQueries(refetchFilters, options);
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
cancelQueries(arg1, arg2, arg3) {
|
|
681
|
+
const [filters, cancelOptions = {}] = parseFilterArgs(arg1, arg2, arg3);
|
|
682
|
+
if (typeof cancelOptions.revert === "undefined") cancelOptions.revert = true;
|
|
683
|
+
const promises = notifyManager.batch(() => this.queryCache.findAll(filters).map((query) => query.cancel(cancelOptions)));
|
|
684
|
+
return Promise.all(promises).then(noop).catch(noop);
|
|
685
|
+
}
|
|
686
|
+
invalidateQueries(arg1, arg2, arg3) {
|
|
687
|
+
const [filters, options] = parseFilterArgs(arg1, arg2, arg3);
|
|
688
|
+
return notifyManager.batch(() => {
|
|
689
|
+
var _ref, _filters$refetchType;
|
|
690
|
+
this.queryCache.findAll(filters).forEach((query) => {
|
|
691
|
+
query.invalidate();
|
|
692
|
+
});
|
|
693
|
+
if (filters.refetchType === "none") return Promise.resolve();
|
|
694
|
+
const refetchFilters = {
|
|
695
|
+
...filters,
|
|
696
|
+
type: (_ref = (_filters$refetchType = filters.refetchType) != null ? _filters$refetchType : filters.type) != null ? _ref : "active"
|
|
697
|
+
};
|
|
698
|
+
return this.refetchQueries(refetchFilters, options);
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
refetchQueries(arg1, arg2, arg3) {
|
|
702
|
+
const [filters, options] = parseFilterArgs(arg1, arg2, arg3);
|
|
703
|
+
const promises = notifyManager.batch(() => this.queryCache.findAll(filters).filter((query) => !query.isDisabled()).map((query) => {
|
|
704
|
+
var _options$cancelRefetc;
|
|
705
|
+
return query.fetch(void 0, {
|
|
706
|
+
...options,
|
|
707
|
+
cancelRefetch: (_options$cancelRefetc = options == null ? void 0 : options.cancelRefetch) != null ? _options$cancelRefetc : true,
|
|
708
|
+
meta: { refetchPage: filters.refetchPage }
|
|
709
|
+
});
|
|
710
|
+
}));
|
|
711
|
+
let promise = Promise.all(promises).then(noop);
|
|
712
|
+
if (!(options != null && options.throwOnError)) promise = promise.catch(noop);
|
|
713
|
+
return promise;
|
|
714
|
+
}
|
|
715
|
+
fetchQuery(arg1, arg2, arg3) {
|
|
716
|
+
const parsedOptions = parseQueryArgs(arg1, arg2, arg3);
|
|
717
|
+
const defaultedOptions = this.defaultQueryOptions(parsedOptions);
|
|
718
|
+
if (typeof defaultedOptions.retry === "undefined") defaultedOptions.retry = false;
|
|
719
|
+
const query = this.queryCache.build(this, defaultedOptions);
|
|
720
|
+
return query.isStaleByTime(defaultedOptions.staleTime) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);
|
|
721
|
+
}
|
|
722
|
+
prefetchQuery(arg1, arg2, arg3) {
|
|
723
|
+
return this.fetchQuery(arg1, arg2, arg3).then(noop).catch(noop);
|
|
724
|
+
}
|
|
725
|
+
fetchInfiniteQuery(arg1, arg2, arg3) {
|
|
726
|
+
const parsedOptions = parseQueryArgs(arg1, arg2, arg3);
|
|
727
|
+
parsedOptions.behavior = infiniteQueryBehavior();
|
|
728
|
+
return this.fetchQuery(parsedOptions);
|
|
729
|
+
}
|
|
730
|
+
prefetchInfiniteQuery(arg1, arg2, arg3) {
|
|
731
|
+
return this.fetchInfiniteQuery(arg1, arg2, arg3).then(noop).catch(noop);
|
|
732
|
+
}
|
|
733
|
+
resumePausedMutations() {
|
|
734
|
+
return this.mutationCache.resumePausedMutations();
|
|
735
|
+
}
|
|
736
|
+
getQueryCache() {
|
|
737
|
+
return this.queryCache;
|
|
738
|
+
}
|
|
739
|
+
getMutationCache() {
|
|
740
|
+
return this.mutationCache;
|
|
741
|
+
}
|
|
742
|
+
getLogger() {
|
|
743
|
+
return this.logger;
|
|
744
|
+
}
|
|
745
|
+
getDefaultOptions() {
|
|
746
|
+
return this.defaultOptions;
|
|
747
|
+
}
|
|
748
|
+
setDefaultOptions(options) {
|
|
749
|
+
this.defaultOptions = options;
|
|
750
|
+
}
|
|
751
|
+
setQueryDefaults(queryKey, options) {
|
|
752
|
+
const result = this.queryDefaults.find((x) => hashQueryKey(queryKey) === hashQueryKey(x.queryKey));
|
|
753
|
+
if (result) result.defaultOptions = options;
|
|
754
|
+
else this.queryDefaults.push({
|
|
755
|
+
queryKey,
|
|
756
|
+
defaultOptions: options
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
getQueryDefaults(queryKey) {
|
|
760
|
+
if (!queryKey) return;
|
|
761
|
+
const firstMatchingDefaults = this.queryDefaults.find((x) => partialMatchKey(queryKey, x.queryKey));
|
|
762
|
+
if (process.env.NODE_ENV !== "production") {
|
|
763
|
+
if (this.queryDefaults.filter((x) => partialMatchKey(queryKey, x.queryKey)).length > 1) this.logger.error("[QueryClient] Several query defaults match with key '" + JSON.stringify(queryKey) + "'. The first matching query defaults are used. Please check how query defaults are registered. Order does matter here. cf. https://react-query.tanstack.com/reference/QueryClient#queryclientsetquerydefaults.");
|
|
764
|
+
}
|
|
765
|
+
return firstMatchingDefaults == null ? void 0 : firstMatchingDefaults.defaultOptions;
|
|
766
|
+
}
|
|
767
|
+
setMutationDefaults(mutationKey, options) {
|
|
768
|
+
const result = this.mutationDefaults.find((x) => hashQueryKey(mutationKey) === hashQueryKey(x.mutationKey));
|
|
769
|
+
if (result) result.defaultOptions = options;
|
|
770
|
+
else this.mutationDefaults.push({
|
|
771
|
+
mutationKey,
|
|
772
|
+
defaultOptions: options
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
getMutationDefaults(mutationKey) {
|
|
776
|
+
if (!mutationKey) return;
|
|
777
|
+
const firstMatchingDefaults = this.mutationDefaults.find((x) => partialMatchKey(mutationKey, x.mutationKey));
|
|
778
|
+
if (process.env.NODE_ENV !== "production") {
|
|
779
|
+
if (this.mutationDefaults.filter((x) => partialMatchKey(mutationKey, x.mutationKey)).length > 1) this.logger.error("[QueryClient] Several mutation defaults match with key '" + JSON.stringify(mutationKey) + "'. The first matching mutation defaults are used. Please check how mutation defaults are registered. Order does matter here. cf. https://react-query.tanstack.com/reference/QueryClient#queryclientsetmutationdefaults.");
|
|
780
|
+
}
|
|
781
|
+
return firstMatchingDefaults == null ? void 0 : firstMatchingDefaults.defaultOptions;
|
|
782
|
+
}
|
|
783
|
+
defaultQueryOptions(options) {
|
|
784
|
+
if (options != null && options._defaulted) return options;
|
|
785
|
+
const defaultedOptions = {
|
|
786
|
+
...this.defaultOptions.queries,
|
|
787
|
+
...this.getQueryDefaults(options == null ? void 0 : options.queryKey),
|
|
788
|
+
...options,
|
|
789
|
+
_defaulted: true
|
|
790
|
+
};
|
|
791
|
+
if (!defaultedOptions.queryHash && defaultedOptions.queryKey) defaultedOptions.queryHash = hashQueryKeyByOptions(defaultedOptions.queryKey, defaultedOptions);
|
|
792
|
+
if (typeof defaultedOptions.refetchOnReconnect === "undefined") defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== "always";
|
|
793
|
+
if (typeof defaultedOptions.useErrorBoundary === "undefined") defaultedOptions.useErrorBoundary = !!defaultedOptions.suspense;
|
|
794
|
+
return defaultedOptions;
|
|
795
|
+
}
|
|
796
|
+
defaultMutationOptions(options) {
|
|
797
|
+
if (options != null && options._defaulted) return options;
|
|
798
|
+
return {
|
|
799
|
+
...this.defaultOptions.mutations,
|
|
800
|
+
...this.getMutationDefaults(options == null ? void 0 : options.mutationKey),
|
|
801
|
+
...options,
|
|
802
|
+
_defaulted: true
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
clear() {
|
|
806
|
+
this.queryCache.clear();
|
|
807
|
+
this.mutationCache.clear();
|
|
808
|
+
}
|
|
809
|
+
};
|
|
810
|
+
//#endregion
|
|
811
|
+
//#region ../../node_modules/@tanstack/vue-query/build/lib/queryCache.mjs
|
|
812
|
+
var QueryCache = class extends QueryCache$1 {
|
|
813
|
+
find(arg1, arg2) {
|
|
814
|
+
const arg1Unreffed = cloneDeepUnref(arg1);
|
|
815
|
+
const arg2Unreffed = cloneDeepUnref(arg2);
|
|
816
|
+
if (isQueryKey(arg1Unreffed)) return super.find(arg1Unreffed, arg2Unreffed);
|
|
817
|
+
return super.find(arg1Unreffed);
|
|
818
|
+
}
|
|
819
|
+
findAll(arg1, arg2) {
|
|
820
|
+
const arg1Unreffed = cloneDeepUnref(arg1);
|
|
821
|
+
const arg2Unreffed = cloneDeepUnref(arg2);
|
|
822
|
+
if (isQueryKey(arg1Unreffed)) return super.findAll(arg1Unreffed, arg2Unreffed);
|
|
823
|
+
return super.findAll(arg1Unreffed);
|
|
824
|
+
}
|
|
825
|
+
};
|
|
826
|
+
//#endregion
|
|
827
|
+
//#region ../../node_modules/@tanstack/vue-query/build/lib/mutationCache.mjs
|
|
828
|
+
var MutationCache = class extends MutationCache$1 {
|
|
829
|
+
find(filters) {
|
|
830
|
+
return super.find(cloneDeepUnref(filters));
|
|
831
|
+
}
|
|
832
|
+
findAll(filters) {
|
|
833
|
+
return super.findAll(cloneDeepUnref(filters));
|
|
834
|
+
}
|
|
835
|
+
};
|
|
836
|
+
//#endregion
|
|
837
|
+
//#region ../../node_modules/@tanstack/vue-query/build/lib/queryClient.mjs
|
|
838
|
+
var QueryClient = class extends QueryClient$1 {
|
|
839
|
+
constructor(config = {}) {
|
|
840
|
+
const unreffedConfig = cloneDeepUnref(config);
|
|
841
|
+
const vueQueryConfig = {
|
|
842
|
+
logger: cloneDeepUnref(unreffedConfig.logger),
|
|
843
|
+
defaultOptions: cloneDeepUnref(unreffedConfig.defaultOptions),
|
|
844
|
+
queryCache: unreffedConfig.queryCache || new QueryCache(),
|
|
845
|
+
mutationCache: unreffedConfig.mutationCache || new MutationCache()
|
|
846
|
+
};
|
|
847
|
+
super(vueQueryConfig);
|
|
848
|
+
this.isRestoring = ref(false);
|
|
849
|
+
}
|
|
850
|
+
isFetching(arg1, arg2) {
|
|
851
|
+
const arg1Unreffed = cloneDeepUnref(arg1);
|
|
852
|
+
const arg2Unreffed = cloneDeepUnref(arg2);
|
|
853
|
+
if (isQueryKey(arg1Unreffed)) return super.isFetching(arg1Unreffed, arg2Unreffed);
|
|
854
|
+
return super.isFetching(arg1Unreffed);
|
|
855
|
+
}
|
|
856
|
+
isMutating(filters) {
|
|
857
|
+
return super.isMutating(cloneDeepUnref(filters));
|
|
858
|
+
}
|
|
859
|
+
getQueryData(queryKey, filters) {
|
|
860
|
+
return super.getQueryData(cloneDeepUnref(queryKey), cloneDeepUnref(filters));
|
|
861
|
+
}
|
|
862
|
+
getQueriesData(queryKeyOrFilters) {
|
|
863
|
+
const unreffed = cloneDeepUnref(queryKeyOrFilters);
|
|
864
|
+
if (isQueryKey(unreffed)) return super.getQueriesData(unreffed);
|
|
865
|
+
return super.getQueriesData(unreffed);
|
|
866
|
+
}
|
|
867
|
+
setQueryData(queryKey, updater, options) {
|
|
868
|
+
return super.setQueryData(cloneDeepUnref(queryKey), updater, cloneDeepUnref(options));
|
|
869
|
+
}
|
|
870
|
+
setQueriesData(queryKeyOrFilters, updater, options) {
|
|
871
|
+
const arg1Unreffed = cloneDeepUnref(queryKeyOrFilters);
|
|
872
|
+
const arg3Unreffed = cloneDeepUnref(options);
|
|
873
|
+
if (isQueryKey(arg1Unreffed)) return super.setQueriesData(arg1Unreffed, updater, arg3Unreffed);
|
|
874
|
+
return super.setQueriesData(arg1Unreffed, updater, arg3Unreffed);
|
|
875
|
+
}
|
|
876
|
+
getQueryState(queryKey, filters) {
|
|
877
|
+
return super.getQueryState(cloneDeepUnref(queryKey), cloneDeepUnref(filters));
|
|
878
|
+
}
|
|
879
|
+
removeQueries(arg1, arg2) {
|
|
880
|
+
const arg1Unreffed = cloneDeepUnref(arg1);
|
|
881
|
+
if (isQueryKey(arg1Unreffed)) return super.removeQueries(arg1Unreffed, cloneDeepUnref(arg2));
|
|
882
|
+
return super.removeQueries(arg1Unreffed);
|
|
883
|
+
}
|
|
884
|
+
resetQueries(arg1, arg2, arg3) {
|
|
885
|
+
const arg1Unreffed = cloneDeepUnref(arg1);
|
|
886
|
+
const arg2Unreffed = cloneDeepUnref(arg2);
|
|
887
|
+
if (isQueryKey(arg1Unreffed)) return super.resetQueries(arg1Unreffed, arg2Unreffed, cloneDeepUnref(arg3));
|
|
888
|
+
return super.resetQueries(arg1Unreffed, arg2Unreffed);
|
|
889
|
+
}
|
|
890
|
+
cancelQueries(arg1, arg2, arg3) {
|
|
891
|
+
const arg1Unreffed = cloneDeepUnref(arg1);
|
|
892
|
+
const arg2Unreffed = cloneDeepUnref(arg2);
|
|
893
|
+
if (isQueryKey(arg1Unreffed)) return super.cancelQueries(arg1Unreffed, arg2Unreffed, cloneDeepUnref(arg3));
|
|
894
|
+
return super.cancelQueries(arg1Unreffed, arg2Unreffed);
|
|
895
|
+
}
|
|
896
|
+
invalidateQueries(arg1, arg2, arg3) {
|
|
897
|
+
const arg1Unreffed = cloneDeepUnref(arg1);
|
|
898
|
+
const arg2Unreffed = cloneDeepUnref(arg2);
|
|
899
|
+
if (isQueryKey(arg1Unreffed)) return super.invalidateQueries(arg1Unreffed, arg2Unreffed, cloneDeepUnref(arg3));
|
|
900
|
+
return super.invalidateQueries(arg1Unreffed, arg2Unreffed);
|
|
901
|
+
}
|
|
902
|
+
refetchQueries(arg1, arg2, arg3) {
|
|
903
|
+
const arg1Unreffed = cloneDeepUnref(arg1);
|
|
904
|
+
const arg2Unreffed = cloneDeepUnref(arg2);
|
|
905
|
+
if (isQueryKey(arg1Unreffed)) return super.refetchQueries(arg1Unreffed, arg2Unreffed, cloneDeepUnref(arg3));
|
|
906
|
+
return super.refetchQueries(arg1Unreffed, arg2Unreffed);
|
|
907
|
+
}
|
|
908
|
+
fetchQuery(arg1, arg2, arg3) {
|
|
909
|
+
const arg1Unreffed = cloneDeepUnref(arg1);
|
|
910
|
+
const arg2Unreffed = cloneDeepUnref(arg2);
|
|
911
|
+
if (isQueryKey(arg1Unreffed)) return super.fetchQuery(arg1Unreffed, arg2Unreffed, cloneDeepUnref(arg3));
|
|
912
|
+
return super.fetchQuery(arg1Unreffed);
|
|
913
|
+
}
|
|
914
|
+
prefetchQuery(arg1, arg2, arg3) {
|
|
915
|
+
return super.prefetchQuery(cloneDeepUnref(arg1), cloneDeepUnref(arg2), cloneDeepUnref(arg3));
|
|
916
|
+
}
|
|
917
|
+
fetchInfiniteQuery(arg1, arg2, arg3) {
|
|
918
|
+
const arg1Unreffed = cloneDeepUnref(arg1);
|
|
919
|
+
const arg2Unreffed = cloneDeepUnref(arg2);
|
|
920
|
+
if (isQueryKey(arg1Unreffed)) return super.fetchInfiniteQuery(arg1Unreffed, arg2Unreffed, cloneDeepUnref(arg3));
|
|
921
|
+
return super.fetchInfiniteQuery(arg1Unreffed);
|
|
922
|
+
}
|
|
923
|
+
prefetchInfiniteQuery(arg1, arg2, arg3) {
|
|
924
|
+
return super.prefetchInfiniteQuery(cloneDeepUnref(arg1), cloneDeepUnref(arg2), cloneDeepUnref(arg3));
|
|
925
|
+
}
|
|
926
|
+
setDefaultOptions(options) {
|
|
927
|
+
super.setDefaultOptions(cloneDeepUnref(options));
|
|
928
|
+
}
|
|
929
|
+
setQueryDefaults(queryKey, options) {
|
|
930
|
+
super.setQueryDefaults(cloneDeepUnref(queryKey), cloneDeepUnref(options));
|
|
931
|
+
}
|
|
932
|
+
getQueryDefaults(queryKey) {
|
|
933
|
+
return super.getQueryDefaults(cloneDeepUnref(queryKey));
|
|
934
|
+
}
|
|
935
|
+
setMutationDefaults(mutationKey, options) {
|
|
936
|
+
super.setMutationDefaults(cloneDeepUnref(mutationKey), cloneDeepUnref(options));
|
|
937
|
+
}
|
|
938
|
+
getMutationDefaults(mutationKey) {
|
|
939
|
+
return super.getMutationDefaults(cloneDeepUnref(mutationKey));
|
|
940
|
+
}
|
|
941
|
+
};
|
|
942
|
+
//#endregion
|
|
943
|
+
//#region ../../node_modules/@tanstack/match-sorter-utils/build/lib/index.mjs
|
|
944
|
+
/**
|
|
945
|
+
* match-sorter-utils
|
|
946
|
+
*
|
|
947
|
+
* Copyright (c) TanStack
|
|
948
|
+
*
|
|
949
|
+
* This source code is licensed under the MIT license found in the
|
|
950
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
951
|
+
*
|
|
952
|
+
* @license MIT
|
|
953
|
+
*/
|
|
954
|
+
var characterMap = {
|
|
955
|
+
À: "A",
|
|
956
|
+
Á: "A",
|
|
957
|
+
Â: "A",
|
|
958
|
+
Ã: "A",
|
|
959
|
+
Ä: "A",
|
|
960
|
+
Å: "A",
|
|
961
|
+
Ấ: "A",
|
|
962
|
+
Ắ: "A",
|
|
963
|
+
Ẳ: "A",
|
|
964
|
+
Ẵ: "A",
|
|
965
|
+
Ặ: "A",
|
|
966
|
+
Æ: "AE",
|
|
967
|
+
Ầ: "A",
|
|
968
|
+
Ằ: "A",
|
|
969
|
+
Ȃ: "A",
|
|
970
|
+
Ç: "C",
|
|
971
|
+
Ḉ: "C",
|
|
972
|
+
È: "E",
|
|
973
|
+
É: "E",
|
|
974
|
+
Ê: "E",
|
|
975
|
+
Ë: "E",
|
|
976
|
+
Ế: "E",
|
|
977
|
+
Ḗ: "E",
|
|
978
|
+
Ề: "E",
|
|
979
|
+
Ḕ: "E",
|
|
980
|
+
Ḝ: "E",
|
|
981
|
+
Ȇ: "E",
|
|
982
|
+
Ì: "I",
|
|
983
|
+
Í: "I",
|
|
984
|
+
Î: "I",
|
|
985
|
+
Ï: "I",
|
|
986
|
+
Ḯ: "I",
|
|
987
|
+
Ȋ: "I",
|
|
988
|
+
Ð: "D",
|
|
989
|
+
Ñ: "N",
|
|
990
|
+
Ò: "O",
|
|
991
|
+
Ó: "O",
|
|
992
|
+
Ô: "O",
|
|
993
|
+
Õ: "O",
|
|
994
|
+
Ö: "O",
|
|
995
|
+
Ø: "O",
|
|
996
|
+
Ố: "O",
|
|
997
|
+
Ṍ: "O",
|
|
998
|
+
Ṓ: "O",
|
|
999
|
+
Ȏ: "O",
|
|
1000
|
+
Ù: "U",
|
|
1001
|
+
Ú: "U",
|
|
1002
|
+
Û: "U",
|
|
1003
|
+
Ü: "U",
|
|
1004
|
+
Ý: "Y",
|
|
1005
|
+
à: "a",
|
|
1006
|
+
á: "a",
|
|
1007
|
+
â: "a",
|
|
1008
|
+
ã: "a",
|
|
1009
|
+
ä: "a",
|
|
1010
|
+
å: "a",
|
|
1011
|
+
ấ: "a",
|
|
1012
|
+
ắ: "a",
|
|
1013
|
+
ẳ: "a",
|
|
1014
|
+
ẵ: "a",
|
|
1015
|
+
ặ: "a",
|
|
1016
|
+
æ: "ae",
|
|
1017
|
+
ầ: "a",
|
|
1018
|
+
ằ: "a",
|
|
1019
|
+
ȃ: "a",
|
|
1020
|
+
ç: "c",
|
|
1021
|
+
ḉ: "c",
|
|
1022
|
+
è: "e",
|
|
1023
|
+
é: "e",
|
|
1024
|
+
ê: "e",
|
|
1025
|
+
ë: "e",
|
|
1026
|
+
ế: "e",
|
|
1027
|
+
ḗ: "e",
|
|
1028
|
+
ề: "e",
|
|
1029
|
+
ḕ: "e",
|
|
1030
|
+
ḝ: "e",
|
|
1031
|
+
ȇ: "e",
|
|
1032
|
+
ì: "i",
|
|
1033
|
+
í: "i",
|
|
1034
|
+
î: "i",
|
|
1035
|
+
ï: "i",
|
|
1036
|
+
ḯ: "i",
|
|
1037
|
+
ȋ: "i",
|
|
1038
|
+
ð: "d",
|
|
1039
|
+
ñ: "n",
|
|
1040
|
+
ò: "o",
|
|
1041
|
+
ó: "o",
|
|
1042
|
+
ô: "o",
|
|
1043
|
+
õ: "o",
|
|
1044
|
+
ö: "o",
|
|
1045
|
+
ø: "o",
|
|
1046
|
+
ố: "o",
|
|
1047
|
+
ṍ: "o",
|
|
1048
|
+
ṓ: "o",
|
|
1049
|
+
ȏ: "o",
|
|
1050
|
+
ù: "u",
|
|
1051
|
+
ú: "u",
|
|
1052
|
+
û: "u",
|
|
1053
|
+
ü: "u",
|
|
1054
|
+
ý: "y",
|
|
1055
|
+
ÿ: "y",
|
|
1056
|
+
Ā: "A",
|
|
1057
|
+
ā: "a",
|
|
1058
|
+
Ă: "A",
|
|
1059
|
+
ă: "a",
|
|
1060
|
+
Ą: "A",
|
|
1061
|
+
ą: "a",
|
|
1062
|
+
Ć: "C",
|
|
1063
|
+
ć: "c",
|
|
1064
|
+
Ĉ: "C",
|
|
1065
|
+
ĉ: "c",
|
|
1066
|
+
Ċ: "C",
|
|
1067
|
+
ċ: "c",
|
|
1068
|
+
Č: "C",
|
|
1069
|
+
č: "c",
|
|
1070
|
+
C̆: "C",
|
|
1071
|
+
c̆: "c",
|
|
1072
|
+
Ď: "D",
|
|
1073
|
+
ď: "d",
|
|
1074
|
+
Đ: "D",
|
|
1075
|
+
đ: "d",
|
|
1076
|
+
Ē: "E",
|
|
1077
|
+
ē: "e",
|
|
1078
|
+
Ĕ: "E",
|
|
1079
|
+
ĕ: "e",
|
|
1080
|
+
Ė: "E",
|
|
1081
|
+
ė: "e",
|
|
1082
|
+
Ę: "E",
|
|
1083
|
+
ę: "e",
|
|
1084
|
+
Ě: "E",
|
|
1085
|
+
ě: "e",
|
|
1086
|
+
Ĝ: "G",
|
|
1087
|
+
Ǵ: "G",
|
|
1088
|
+
ĝ: "g",
|
|
1089
|
+
ǵ: "g",
|
|
1090
|
+
Ğ: "G",
|
|
1091
|
+
ğ: "g",
|
|
1092
|
+
Ġ: "G",
|
|
1093
|
+
ġ: "g",
|
|
1094
|
+
Ģ: "G",
|
|
1095
|
+
ģ: "g",
|
|
1096
|
+
Ĥ: "H",
|
|
1097
|
+
ĥ: "h",
|
|
1098
|
+
Ħ: "H",
|
|
1099
|
+
ħ: "h",
|
|
1100
|
+
Ḫ: "H",
|
|
1101
|
+
ḫ: "h",
|
|
1102
|
+
Ĩ: "I",
|
|
1103
|
+
ĩ: "i",
|
|
1104
|
+
Ī: "I",
|
|
1105
|
+
ī: "i",
|
|
1106
|
+
Ĭ: "I",
|
|
1107
|
+
ĭ: "i",
|
|
1108
|
+
Į: "I",
|
|
1109
|
+
į: "i",
|
|
1110
|
+
İ: "I",
|
|
1111
|
+
ı: "i",
|
|
1112
|
+
IJ: "IJ",
|
|
1113
|
+
ij: "ij",
|
|
1114
|
+
Ĵ: "J",
|
|
1115
|
+
ĵ: "j",
|
|
1116
|
+
Ķ: "K",
|
|
1117
|
+
ķ: "k",
|
|
1118
|
+
Ḱ: "K",
|
|
1119
|
+
ḱ: "k",
|
|
1120
|
+
K̆: "K",
|
|
1121
|
+
k̆: "k",
|
|
1122
|
+
Ĺ: "L",
|
|
1123
|
+
ĺ: "l",
|
|
1124
|
+
Ļ: "L",
|
|
1125
|
+
ļ: "l",
|
|
1126
|
+
Ľ: "L",
|
|
1127
|
+
ľ: "l",
|
|
1128
|
+
Ŀ: "L",
|
|
1129
|
+
ŀ: "l",
|
|
1130
|
+
Ł: "l",
|
|
1131
|
+
ł: "l",
|
|
1132
|
+
Ḿ: "M",
|
|
1133
|
+
ḿ: "m",
|
|
1134
|
+
M̆: "M",
|
|
1135
|
+
m̆: "m",
|
|
1136
|
+
Ń: "N",
|
|
1137
|
+
ń: "n",
|
|
1138
|
+
Ņ: "N",
|
|
1139
|
+
ņ: "n",
|
|
1140
|
+
Ň: "N",
|
|
1141
|
+
ň: "n",
|
|
1142
|
+
ʼn: "n",
|
|
1143
|
+
N̆: "N",
|
|
1144
|
+
n̆: "n",
|
|
1145
|
+
Ō: "O",
|
|
1146
|
+
ō: "o",
|
|
1147
|
+
Ŏ: "O",
|
|
1148
|
+
ŏ: "o",
|
|
1149
|
+
Ő: "O",
|
|
1150
|
+
ő: "o",
|
|
1151
|
+
Œ: "OE",
|
|
1152
|
+
œ: "oe",
|
|
1153
|
+
P̆: "P",
|
|
1154
|
+
p̆: "p",
|
|
1155
|
+
Ŕ: "R",
|
|
1156
|
+
ŕ: "r",
|
|
1157
|
+
Ŗ: "R",
|
|
1158
|
+
ŗ: "r",
|
|
1159
|
+
Ř: "R",
|
|
1160
|
+
ř: "r",
|
|
1161
|
+
R̆: "R",
|
|
1162
|
+
r̆: "r",
|
|
1163
|
+
Ȓ: "R",
|
|
1164
|
+
ȓ: "r",
|
|
1165
|
+
Ś: "S",
|
|
1166
|
+
ś: "s",
|
|
1167
|
+
Ŝ: "S",
|
|
1168
|
+
ŝ: "s",
|
|
1169
|
+
Ş: "S",
|
|
1170
|
+
Ș: "S",
|
|
1171
|
+
ș: "s",
|
|
1172
|
+
ş: "s",
|
|
1173
|
+
Š: "S",
|
|
1174
|
+
š: "s",
|
|
1175
|
+
Ţ: "T",
|
|
1176
|
+
ţ: "t",
|
|
1177
|
+
ț: "t",
|
|
1178
|
+
Ț: "T",
|
|
1179
|
+
Ť: "T",
|
|
1180
|
+
ť: "t",
|
|
1181
|
+
Ŧ: "T",
|
|
1182
|
+
ŧ: "t",
|
|
1183
|
+
T̆: "T",
|
|
1184
|
+
t̆: "t",
|
|
1185
|
+
Ũ: "U",
|
|
1186
|
+
ũ: "u",
|
|
1187
|
+
Ū: "U",
|
|
1188
|
+
ū: "u",
|
|
1189
|
+
Ŭ: "U",
|
|
1190
|
+
ŭ: "u",
|
|
1191
|
+
Ů: "U",
|
|
1192
|
+
ů: "u",
|
|
1193
|
+
Ű: "U",
|
|
1194
|
+
ű: "u",
|
|
1195
|
+
Ų: "U",
|
|
1196
|
+
ų: "u",
|
|
1197
|
+
Ȗ: "U",
|
|
1198
|
+
ȗ: "u",
|
|
1199
|
+
V̆: "V",
|
|
1200
|
+
v̆: "v",
|
|
1201
|
+
Ŵ: "W",
|
|
1202
|
+
ŵ: "w",
|
|
1203
|
+
Ẃ: "W",
|
|
1204
|
+
ẃ: "w",
|
|
1205
|
+
X̆: "X",
|
|
1206
|
+
x̆: "x",
|
|
1207
|
+
Ŷ: "Y",
|
|
1208
|
+
ŷ: "y",
|
|
1209
|
+
Ÿ: "Y",
|
|
1210
|
+
Y̆: "Y",
|
|
1211
|
+
y̆: "y",
|
|
1212
|
+
Ź: "Z",
|
|
1213
|
+
ź: "z",
|
|
1214
|
+
Ż: "Z",
|
|
1215
|
+
ż: "z",
|
|
1216
|
+
Ž: "Z",
|
|
1217
|
+
ž: "z",
|
|
1218
|
+
ſ: "s",
|
|
1219
|
+
ƒ: "f",
|
|
1220
|
+
Ơ: "O",
|
|
1221
|
+
ơ: "o",
|
|
1222
|
+
Ư: "U",
|
|
1223
|
+
ư: "u",
|
|
1224
|
+
Ǎ: "A",
|
|
1225
|
+
ǎ: "a",
|
|
1226
|
+
Ǐ: "I",
|
|
1227
|
+
ǐ: "i",
|
|
1228
|
+
Ǒ: "O",
|
|
1229
|
+
ǒ: "o",
|
|
1230
|
+
Ǔ: "U",
|
|
1231
|
+
ǔ: "u",
|
|
1232
|
+
Ǖ: "U",
|
|
1233
|
+
ǖ: "u",
|
|
1234
|
+
Ǘ: "U",
|
|
1235
|
+
ǘ: "u",
|
|
1236
|
+
Ǚ: "U",
|
|
1237
|
+
ǚ: "u",
|
|
1238
|
+
Ǜ: "U",
|
|
1239
|
+
ǜ: "u",
|
|
1240
|
+
Ứ: "U",
|
|
1241
|
+
ứ: "u",
|
|
1242
|
+
Ṹ: "U",
|
|
1243
|
+
ṹ: "u",
|
|
1244
|
+
Ǻ: "A",
|
|
1245
|
+
ǻ: "a",
|
|
1246
|
+
Ǽ: "AE",
|
|
1247
|
+
ǽ: "ae",
|
|
1248
|
+
Ǿ: "O",
|
|
1249
|
+
ǿ: "o",
|
|
1250
|
+
Þ: "TH",
|
|
1251
|
+
þ: "th",
|
|
1252
|
+
Ṕ: "P",
|
|
1253
|
+
ṕ: "p",
|
|
1254
|
+
Ṥ: "S",
|
|
1255
|
+
ṥ: "s",
|
|
1256
|
+
X́: "X",
|
|
1257
|
+
x́: "x",
|
|
1258
|
+
Ѓ: "Г",
|
|
1259
|
+
ѓ: "г",
|
|
1260
|
+
Ќ: "К",
|
|
1261
|
+
ќ: "к",
|
|
1262
|
+
A̋: "A",
|
|
1263
|
+
a̋: "a",
|
|
1264
|
+
E̋: "E",
|
|
1265
|
+
e̋: "e",
|
|
1266
|
+
I̋: "I",
|
|
1267
|
+
i̋: "i",
|
|
1268
|
+
Ǹ: "N",
|
|
1269
|
+
ǹ: "n",
|
|
1270
|
+
Ồ: "O",
|
|
1271
|
+
ồ: "o",
|
|
1272
|
+
Ṑ: "O",
|
|
1273
|
+
ṑ: "o",
|
|
1274
|
+
Ừ: "U",
|
|
1275
|
+
ừ: "u",
|
|
1276
|
+
Ẁ: "W",
|
|
1277
|
+
ẁ: "w",
|
|
1278
|
+
Ỳ: "Y",
|
|
1279
|
+
ỳ: "y",
|
|
1280
|
+
Ȁ: "A",
|
|
1281
|
+
ȁ: "a",
|
|
1282
|
+
Ȅ: "E",
|
|
1283
|
+
ȅ: "e",
|
|
1284
|
+
Ȉ: "I",
|
|
1285
|
+
ȉ: "i",
|
|
1286
|
+
Ȍ: "O",
|
|
1287
|
+
ȍ: "o",
|
|
1288
|
+
Ȑ: "R",
|
|
1289
|
+
ȑ: "r",
|
|
1290
|
+
Ȕ: "U",
|
|
1291
|
+
ȕ: "u",
|
|
1292
|
+
B̌: "B",
|
|
1293
|
+
b̌: "b",
|
|
1294
|
+
Č̣: "C",
|
|
1295
|
+
č̣: "c",
|
|
1296
|
+
Ê̌: "E",
|
|
1297
|
+
ê̌: "e",
|
|
1298
|
+
F̌: "F",
|
|
1299
|
+
f̌: "f",
|
|
1300
|
+
Ǧ: "G",
|
|
1301
|
+
ǧ: "g",
|
|
1302
|
+
Ȟ: "H",
|
|
1303
|
+
ȟ: "h",
|
|
1304
|
+
J̌: "J",
|
|
1305
|
+
ǰ: "j",
|
|
1306
|
+
Ǩ: "K",
|
|
1307
|
+
ǩ: "k",
|
|
1308
|
+
M̌: "M",
|
|
1309
|
+
m̌: "m",
|
|
1310
|
+
P̌: "P",
|
|
1311
|
+
p̌: "p",
|
|
1312
|
+
Q̌: "Q",
|
|
1313
|
+
q̌: "q",
|
|
1314
|
+
Ř̩: "R",
|
|
1315
|
+
ř̩: "r",
|
|
1316
|
+
Ṧ: "S",
|
|
1317
|
+
ṧ: "s",
|
|
1318
|
+
V̌: "V",
|
|
1319
|
+
v̌: "v",
|
|
1320
|
+
W̌: "W",
|
|
1321
|
+
w̌: "w",
|
|
1322
|
+
X̌: "X",
|
|
1323
|
+
x̌: "x",
|
|
1324
|
+
Y̌: "Y",
|
|
1325
|
+
y̌: "y",
|
|
1326
|
+
A̧: "A",
|
|
1327
|
+
a̧: "a",
|
|
1328
|
+
B̧: "B",
|
|
1329
|
+
b̧: "b",
|
|
1330
|
+
Ḑ: "D",
|
|
1331
|
+
ḑ: "d",
|
|
1332
|
+
Ȩ: "E",
|
|
1333
|
+
ȩ: "e",
|
|
1334
|
+
Ɛ̧: "E",
|
|
1335
|
+
ɛ̧: "e",
|
|
1336
|
+
Ḩ: "H",
|
|
1337
|
+
ḩ: "h",
|
|
1338
|
+
I̧: "I",
|
|
1339
|
+
i̧: "i",
|
|
1340
|
+
Ɨ̧: "I",
|
|
1341
|
+
ɨ̧: "i",
|
|
1342
|
+
M̧: "M",
|
|
1343
|
+
m̧: "m",
|
|
1344
|
+
O̧: "O",
|
|
1345
|
+
o̧: "o",
|
|
1346
|
+
Q̧: "Q",
|
|
1347
|
+
q̧: "q",
|
|
1348
|
+
U̧: "U",
|
|
1349
|
+
u̧: "u",
|
|
1350
|
+
X̧: "X",
|
|
1351
|
+
x̧: "x",
|
|
1352
|
+
Z̧: "Z",
|
|
1353
|
+
z̧: "z"
|
|
1354
|
+
};
|
|
1355
|
+
var chars = Object.keys(characterMap).join("|");
|
|
1356
|
+
var allAccents = new RegExp(chars, "g");
|
|
1357
|
+
function removeAccents(str) {
|
|
1358
|
+
return str.replace(allAccents, (match) => {
|
|
1359
|
+
return characterMap[match];
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
/**
|
|
1363
|
+
* @name match-sorter
|
|
1364
|
+
* @license MIT license.
|
|
1365
|
+
* @copyright (c) 2099 Kent C. Dodds
|
|
1366
|
+
* @author Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)
|
|
1367
|
+
*/
|
|
1368
|
+
var rankings = {
|
|
1369
|
+
CASE_SENSITIVE_EQUAL: 7,
|
|
1370
|
+
EQUAL: 6,
|
|
1371
|
+
STARTS_WITH: 5,
|
|
1372
|
+
WORD_STARTS_WITH: 4,
|
|
1373
|
+
CONTAINS: 3,
|
|
1374
|
+
ACRONYM: 2,
|
|
1375
|
+
MATCHES: 1,
|
|
1376
|
+
NO_MATCH: 0
|
|
1377
|
+
};
|
|
1378
|
+
function rankItem(item, value, options) {
|
|
1379
|
+
var _options$threshold;
|
|
1380
|
+
options = options || {};
|
|
1381
|
+
options.threshold = (_options$threshold = options.threshold) != null ? _options$threshold : rankings.MATCHES;
|
|
1382
|
+
if (!options.accessors) {
|
|
1383
|
+
const rank = getMatchRanking(item, value, options);
|
|
1384
|
+
return {
|
|
1385
|
+
rankedValue: item,
|
|
1386
|
+
rank,
|
|
1387
|
+
accessorIndex: -1,
|
|
1388
|
+
accessorThreshold: options.threshold,
|
|
1389
|
+
passed: rank >= options.threshold
|
|
1390
|
+
};
|
|
1391
|
+
}
|
|
1392
|
+
const valuesToRank = getAllValuesToRank(item, options.accessors);
|
|
1393
|
+
const rankingInfo = {
|
|
1394
|
+
rankedValue: item,
|
|
1395
|
+
rank: rankings.NO_MATCH,
|
|
1396
|
+
accessorIndex: -1,
|
|
1397
|
+
accessorThreshold: options.threshold,
|
|
1398
|
+
passed: false
|
|
1399
|
+
};
|
|
1400
|
+
for (let i = 0; i < valuesToRank.length; i++) {
|
|
1401
|
+
const rankValue = valuesToRank[i];
|
|
1402
|
+
let newRank = getMatchRanking(rankValue.itemValue, value, options);
|
|
1403
|
+
const { minRanking, maxRanking, threshold = options.threshold } = rankValue.attributes;
|
|
1404
|
+
if (newRank < minRanking && newRank >= rankings.MATCHES) newRank = minRanking;
|
|
1405
|
+
else if (newRank > maxRanking) newRank = maxRanking;
|
|
1406
|
+
newRank = Math.min(newRank, maxRanking);
|
|
1407
|
+
if (newRank >= threshold && newRank > rankingInfo.rank) {
|
|
1408
|
+
rankingInfo.rank = newRank;
|
|
1409
|
+
rankingInfo.passed = true;
|
|
1410
|
+
rankingInfo.accessorIndex = i;
|
|
1411
|
+
rankingInfo.accessorThreshold = threshold;
|
|
1412
|
+
rankingInfo.rankedValue = rankValue.itemValue;
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
return rankingInfo;
|
|
1416
|
+
}
|
|
1417
|
+
function getMatchRanking(testString, stringToRank, options) {
|
|
1418
|
+
testString = prepareValueForComparison(testString, options);
|
|
1419
|
+
stringToRank = prepareValueForComparison(stringToRank, options);
|
|
1420
|
+
if (stringToRank.length > testString.length) return rankings.NO_MATCH;
|
|
1421
|
+
if (testString === stringToRank) return rankings.CASE_SENSITIVE_EQUAL;
|
|
1422
|
+
testString = testString.toLowerCase();
|
|
1423
|
+
stringToRank = stringToRank.toLowerCase();
|
|
1424
|
+
if (testString === stringToRank) return rankings.EQUAL;
|
|
1425
|
+
if (testString.startsWith(stringToRank)) return rankings.STARTS_WITH;
|
|
1426
|
+
if (testString.includes(` ${stringToRank}`)) return rankings.WORD_STARTS_WITH;
|
|
1427
|
+
if (testString.includes(stringToRank)) return rankings.CONTAINS;
|
|
1428
|
+
else if (stringToRank.length === 1) return rankings.NO_MATCH;
|
|
1429
|
+
if (getAcronym(testString).includes(stringToRank)) return rankings.ACRONYM;
|
|
1430
|
+
return getClosenessRanking(testString, stringToRank);
|
|
1431
|
+
}
|
|
1432
|
+
function getAcronym(string) {
|
|
1433
|
+
let acronym = "";
|
|
1434
|
+
string.split(" ").forEach((wordInString) => {
|
|
1435
|
+
wordInString.split("-").forEach((splitByHyphenWord) => {
|
|
1436
|
+
acronym += splitByHyphenWord.substr(0, 1);
|
|
1437
|
+
});
|
|
1438
|
+
});
|
|
1439
|
+
return acronym;
|
|
1440
|
+
}
|
|
1441
|
+
function getClosenessRanking(testString, stringToRank) {
|
|
1442
|
+
let matchingInOrderCharCount = 0;
|
|
1443
|
+
let charNumber = 0;
|
|
1444
|
+
function findMatchingCharacter(matchChar, string, index) {
|
|
1445
|
+
for (let j = index, J = string.length; j < J; j++) if (string[j] === matchChar) {
|
|
1446
|
+
matchingInOrderCharCount += 1;
|
|
1447
|
+
return j + 1;
|
|
1448
|
+
}
|
|
1449
|
+
return -1;
|
|
1450
|
+
}
|
|
1451
|
+
function getRanking(spread) {
|
|
1452
|
+
const spreadPercentage = 1 / spread;
|
|
1453
|
+
const inOrderPercentage = matchingInOrderCharCount / stringToRank.length;
|
|
1454
|
+
return rankings.MATCHES + inOrderPercentage * spreadPercentage;
|
|
1455
|
+
}
|
|
1456
|
+
const firstIndex = findMatchingCharacter(stringToRank[0], testString, 0);
|
|
1457
|
+
if (firstIndex < 0) return rankings.NO_MATCH;
|
|
1458
|
+
charNumber = firstIndex;
|
|
1459
|
+
for (let i = 1, I = stringToRank.length; i < I; i++) {
|
|
1460
|
+
const matchChar = stringToRank[i];
|
|
1461
|
+
charNumber = findMatchingCharacter(matchChar, testString, charNumber);
|
|
1462
|
+
if (!(charNumber > -1)) return rankings.NO_MATCH;
|
|
1463
|
+
}
|
|
1464
|
+
return getRanking(charNumber - firstIndex);
|
|
1465
|
+
}
|
|
1466
|
+
function prepareValueForComparison(value, _ref) {
|
|
1467
|
+
let { keepDiacritics } = _ref;
|
|
1468
|
+
value = `${value}`;
|
|
1469
|
+
if (!keepDiacritics) value = removeAccents(value);
|
|
1470
|
+
return value;
|
|
1471
|
+
}
|
|
1472
|
+
function getItemValues(item, accessor) {
|
|
1473
|
+
let accessorFn = accessor;
|
|
1474
|
+
if (typeof accessor === "object") accessorFn = accessor.accessor;
|
|
1475
|
+
const value = accessorFn(item);
|
|
1476
|
+
if (value == null) return [];
|
|
1477
|
+
if (Array.isArray(value)) return value;
|
|
1478
|
+
return [String(value)];
|
|
1479
|
+
}
|
|
1480
|
+
function getAllValuesToRank(item, accessors) {
|
|
1481
|
+
const allValues = [];
|
|
1482
|
+
for (let j = 0, J = accessors.length; j < J; j++) {
|
|
1483
|
+
const accessor = accessors[j];
|
|
1484
|
+
const attributes = getAccessorAttributes(accessor);
|
|
1485
|
+
const itemValues = getItemValues(item, accessor);
|
|
1486
|
+
for (let i = 0, I = itemValues.length; i < I; i++) allValues.push({
|
|
1487
|
+
itemValue: itemValues[i],
|
|
1488
|
+
attributes
|
|
1489
|
+
});
|
|
1490
|
+
}
|
|
1491
|
+
return allValues;
|
|
1492
|
+
}
|
|
1493
|
+
var defaultKeyAttributes = {
|
|
1494
|
+
maxRanking: Infinity,
|
|
1495
|
+
minRanking: -Infinity
|
|
1496
|
+
};
|
|
1497
|
+
function getAccessorAttributes(accessor) {
|
|
1498
|
+
if (typeof accessor === "function") return defaultKeyAttributes;
|
|
1499
|
+
return {
|
|
1500
|
+
...defaultKeyAttributes,
|
|
1501
|
+
...accessor
|
|
1502
|
+
};
|
|
1503
|
+
}
|
|
1504
|
+
//#endregion
|
|
1505
|
+
//#region ../../node_modules/@tanstack/vue-query/build/lib/devtools/utils.mjs
|
|
1506
|
+
/* istanbul ignore file */
|
|
1507
|
+
var QueryState;
|
|
1508
|
+
(function(QueryState) {
|
|
1509
|
+
QueryState[QueryState["Fetching"] = 0] = "Fetching";
|
|
1510
|
+
QueryState[QueryState["Fresh"] = 1] = "Fresh";
|
|
1511
|
+
QueryState[QueryState["Stale"] = 2] = "Stale";
|
|
1512
|
+
QueryState[QueryState["Inactive"] = 3] = "Inactive";
|
|
1513
|
+
QueryState[QueryState["Paused"] = 4] = "Paused";
|
|
1514
|
+
})(QueryState || (QueryState = {}));
|
|
1515
|
+
function getQueryState(query) {
|
|
1516
|
+
if (query.state.fetchStatus === "fetching") return QueryState.Fetching;
|
|
1517
|
+
if (query.state.fetchStatus === "paused") return QueryState.Paused;
|
|
1518
|
+
if (!query.getObserversCount()) return QueryState.Inactive;
|
|
1519
|
+
if (query.isStale()) return QueryState.Stale;
|
|
1520
|
+
return QueryState.Fresh;
|
|
1521
|
+
}
|
|
1522
|
+
function getQueryStateLabel(query) {
|
|
1523
|
+
const queryState = getQueryState(query);
|
|
1524
|
+
if (queryState === QueryState.Fetching) return "fetching";
|
|
1525
|
+
if (queryState === QueryState.Paused) return "paused";
|
|
1526
|
+
if (queryState === QueryState.Stale) return "stale";
|
|
1527
|
+
if (queryState === QueryState.Inactive) return "inactive";
|
|
1528
|
+
return "fresh";
|
|
1529
|
+
}
|
|
1530
|
+
function getQueryStatusFg(query) {
|
|
1531
|
+
if (getQueryState(query) === QueryState.Stale) return 0;
|
|
1532
|
+
return 16777215;
|
|
1533
|
+
}
|
|
1534
|
+
function getQueryStatusBg(query) {
|
|
1535
|
+
const queryState = getQueryState(query);
|
|
1536
|
+
if (queryState === QueryState.Fetching) return 27647;
|
|
1537
|
+
if (queryState === QueryState.Paused) return 9193963;
|
|
1538
|
+
if (queryState === QueryState.Stale) return 16757248;
|
|
1539
|
+
if (queryState === QueryState.Inactive) return 4148832;
|
|
1540
|
+
return 33575;
|
|
1541
|
+
}
|
|
1542
|
+
var queryHashSort = (a, b) => a.queryHash.localeCompare(b.queryHash);
|
|
1543
|
+
var dateSort = (a, b) => a.state.dataUpdatedAt < b.state.dataUpdatedAt ? 1 : -1;
|
|
1544
|
+
var statusAndDateSort = (a, b) => {
|
|
1545
|
+
if (getQueryState(a) === getQueryState(b)) return dateSort(a, b);
|
|
1546
|
+
return getQueryState(a) > getQueryState(b) ? 1 : -1;
|
|
1547
|
+
};
|
|
1548
|
+
var sortFns = {
|
|
1549
|
+
"Status > Last Updated": statusAndDateSort,
|
|
1550
|
+
"Query Hash": queryHashSort,
|
|
1551
|
+
"Last Updated": dateSort
|
|
1552
|
+
};
|
|
1553
|
+
//#endregion
|
|
1554
|
+
//#region ../../node_modules/@tanstack/vue-query/build/lib/devtools/devtools.mjs
|
|
1555
|
+
/* istanbul ignore file */
|
|
1556
|
+
var pluginId = "vue-query";
|
|
1557
|
+
var pluginName = "Vue Query";
|
|
1558
|
+
function setupDevtools(app, queryClient) {
|
|
1559
|
+
setupDevtoolsPlugin({
|
|
1560
|
+
id: pluginId,
|
|
1561
|
+
label: pluginName,
|
|
1562
|
+
packageName: "vue-query",
|
|
1563
|
+
homepage: "https://tanstack.com/query/v4",
|
|
1564
|
+
logo: "https://vue-query.vercel.app/vue-query.svg",
|
|
1565
|
+
app,
|
|
1566
|
+
settings: {
|
|
1567
|
+
baseSort: {
|
|
1568
|
+
type: "choice",
|
|
1569
|
+
component: "button-group",
|
|
1570
|
+
label: "Sort Cache Entries",
|
|
1571
|
+
options: [{
|
|
1572
|
+
label: "ASC",
|
|
1573
|
+
value: 1
|
|
1574
|
+
}, {
|
|
1575
|
+
label: "DESC",
|
|
1576
|
+
value: -1
|
|
1577
|
+
}],
|
|
1578
|
+
defaultValue: 1
|
|
1579
|
+
},
|
|
1580
|
+
sortFn: {
|
|
1581
|
+
type: "choice",
|
|
1582
|
+
label: "Sort Function",
|
|
1583
|
+
options: Object.keys(sortFns).map((key) => ({
|
|
1584
|
+
label: key,
|
|
1585
|
+
value: key
|
|
1586
|
+
})),
|
|
1587
|
+
defaultValue: Object.keys(sortFns)[0]
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
}, (api) => {
|
|
1591
|
+
const queryCache = queryClient.getQueryCache();
|
|
1592
|
+
api.addInspector({
|
|
1593
|
+
id: pluginId,
|
|
1594
|
+
label: pluginName,
|
|
1595
|
+
icon: "api",
|
|
1596
|
+
nodeActions: [
|
|
1597
|
+
{
|
|
1598
|
+
icon: "cloud_download",
|
|
1599
|
+
tooltip: "Refetch",
|
|
1600
|
+
action: (queryHash) => {
|
|
1601
|
+
var _queryCache$get;
|
|
1602
|
+
(_queryCache$get = queryCache.get(queryHash)) == null || _queryCache$get.fetch();
|
|
1603
|
+
}
|
|
1604
|
+
},
|
|
1605
|
+
{
|
|
1606
|
+
icon: "alarm",
|
|
1607
|
+
tooltip: "Invalidate",
|
|
1608
|
+
action: (queryHash) => {
|
|
1609
|
+
const query = queryCache.get(queryHash);
|
|
1610
|
+
queryClient.invalidateQueries(query.queryKey);
|
|
1611
|
+
}
|
|
1612
|
+
},
|
|
1613
|
+
{
|
|
1614
|
+
icon: "settings_backup_restore",
|
|
1615
|
+
tooltip: "Reset",
|
|
1616
|
+
action: (queryHash) => {
|
|
1617
|
+
var _queryCache$get2;
|
|
1618
|
+
(_queryCache$get2 = queryCache.get(queryHash)) == null || _queryCache$get2.reset();
|
|
1619
|
+
}
|
|
1620
|
+
},
|
|
1621
|
+
{
|
|
1622
|
+
icon: "delete",
|
|
1623
|
+
tooltip: "Remove",
|
|
1624
|
+
action: (queryHash) => {
|
|
1625
|
+
const query = queryCache.get(queryHash);
|
|
1626
|
+
queryCache.remove(query);
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
]
|
|
1630
|
+
});
|
|
1631
|
+
api.addTimelineLayer({
|
|
1632
|
+
id: pluginId,
|
|
1633
|
+
label: pluginName,
|
|
1634
|
+
color: 16767308
|
|
1635
|
+
});
|
|
1636
|
+
queryCache.subscribe((event) => {
|
|
1637
|
+
api.sendInspectorTree(pluginId);
|
|
1638
|
+
api.sendInspectorState(pluginId);
|
|
1639
|
+
if (event && [
|
|
1640
|
+
"added",
|
|
1641
|
+
"removed",
|
|
1642
|
+
"updated"
|
|
1643
|
+
].includes(event.type)) api.addTimelineEvent({
|
|
1644
|
+
layerId: pluginId,
|
|
1645
|
+
event: {
|
|
1646
|
+
title: event.type,
|
|
1647
|
+
subtitle: event.query.queryHash,
|
|
1648
|
+
time: api.now(),
|
|
1649
|
+
data: {
|
|
1650
|
+
queryHash: event.query.queryHash,
|
|
1651
|
+
...event
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
});
|
|
1655
|
+
});
|
|
1656
|
+
api.on.getInspectorTree((payload) => {
|
|
1657
|
+
if (payload.inspectorId === pluginId) {
|
|
1658
|
+
const queries = queryCache.getAll();
|
|
1659
|
+
const settings = api.getSettings();
|
|
1660
|
+
payload.rootNodes = (payload.filter ? queries.filter((item) => rankItem(item.queryHash, payload.filter).passed) : [...queries]).sort((a, b) => sortFns[settings.sortFn](a, b) * settings.baseSort).map((query) => {
|
|
1661
|
+
const stateLabel = getQueryStateLabel(query);
|
|
1662
|
+
return {
|
|
1663
|
+
id: query.queryHash,
|
|
1664
|
+
label: query.queryHash,
|
|
1665
|
+
tags: [{
|
|
1666
|
+
label: stateLabel + " [" + query.getObserversCount() + "]",
|
|
1667
|
+
textColor: getQueryStatusFg(query),
|
|
1668
|
+
backgroundColor: getQueryStatusBg(query)
|
|
1669
|
+
}]
|
|
1670
|
+
};
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1673
|
+
});
|
|
1674
|
+
api.on.getInspectorState((payload) => {
|
|
1675
|
+
if (payload.inspectorId === pluginId) {
|
|
1676
|
+
const query = queryCache.get(payload.nodeId);
|
|
1677
|
+
if (!query) return;
|
|
1678
|
+
payload.state = {
|
|
1679
|
+
" Query Details": [
|
|
1680
|
+
{
|
|
1681
|
+
key: "Query key",
|
|
1682
|
+
value: query.queryHash
|
|
1683
|
+
},
|
|
1684
|
+
{
|
|
1685
|
+
key: "Query status",
|
|
1686
|
+
value: getQueryStateLabel(query)
|
|
1687
|
+
},
|
|
1688
|
+
{
|
|
1689
|
+
key: "Observers",
|
|
1690
|
+
value: query.getObserversCount()
|
|
1691
|
+
},
|
|
1692
|
+
{
|
|
1693
|
+
key: "Last Updated",
|
|
1694
|
+
value: new Date(query.state.dataUpdatedAt).toLocaleTimeString()
|
|
1695
|
+
}
|
|
1696
|
+
],
|
|
1697
|
+
"Data Explorer": [{
|
|
1698
|
+
key: "Data",
|
|
1699
|
+
value: query.state.data
|
|
1700
|
+
}],
|
|
1701
|
+
"Query Explorer": [{
|
|
1702
|
+
key: "Query",
|
|
1703
|
+
value: query
|
|
1704
|
+
}]
|
|
1705
|
+
};
|
|
1706
|
+
}
|
|
1707
|
+
});
|
|
1708
|
+
});
|
|
1709
|
+
}
|
|
1710
|
+
//#endregion
|
|
1711
|
+
//#region ../../node_modules/@tanstack/vue-query/build/lib/vueQueryPlugin.mjs
|
|
1712
|
+
var VueQueryPlugin = { install: (app, options = {}) => {
|
|
1713
|
+
const clientKey = getClientKey(options.queryClientKey);
|
|
1714
|
+
let client;
|
|
1715
|
+
if ("queryClient" in options && options.queryClient) client = options.queryClient;
|
|
1716
|
+
else if (options.contextSharing && typeof window !== "undefined") {
|
|
1717
|
+
if (!window.__VUE_QUERY_CONTEXT__) {
|
|
1718
|
+
client = new QueryClient("queryClientConfig" in options ? options.queryClientConfig : void 0);
|
|
1719
|
+
window.__VUE_QUERY_CONTEXT__ = client;
|
|
1720
|
+
} else client = window.__VUE_QUERY_CONTEXT__;
|
|
1721
|
+
} else client = new QueryClient("queryClientConfig" in options ? options.queryClientConfig : void 0);
|
|
1722
|
+
if (!isServer) client.mount();
|
|
1723
|
+
let persisterUnmount = () => {};
|
|
1724
|
+
if (options.clientPersister) {
|
|
1725
|
+
client.isRestoring.value = true;
|
|
1726
|
+
const [unmount, promise] = options.clientPersister(client);
|
|
1727
|
+
persisterUnmount = unmount;
|
|
1728
|
+
promise.then(() => {
|
|
1729
|
+
client.isRestoring.value = false;
|
|
1730
|
+
options.clientPersisterOnSuccess == null || options.clientPersisterOnSuccess(client);
|
|
1731
|
+
});
|
|
1732
|
+
}
|
|
1733
|
+
if (process.env.NODE_ENV !== "production" && options.contextSharing) client.getLogger().error("The contextSharing option has been deprecated and will be removed in the next major version");
|
|
1734
|
+
const cleanup = () => {
|
|
1735
|
+
client.unmount();
|
|
1736
|
+
persisterUnmount();
|
|
1737
|
+
};
|
|
1738
|
+
if (app.onUnmount) app.onUnmount(cleanup);
|
|
1739
|
+
else {
|
|
1740
|
+
const originalUnmount = app.unmount;
|
|
1741
|
+
app.unmount = function vueQueryUnmount() {
|
|
1742
|
+
cleanup();
|
|
1743
|
+
originalUnmount();
|
|
1744
|
+
};
|
|
1745
|
+
}
|
|
1746
|
+
app.provide(clientKey, client);
|
|
1747
|
+
if (process.env.NODE_ENV === "development") setupDevtools(app, client);
|
|
1748
|
+
} };
|
|
1749
|
+
//#endregion
|
|
1750
|
+
//#region ../../node_modules/lodash-es/identity.js
|
|
1751
|
+
function identity(value) {
|
|
1752
|
+
return value;
|
|
1753
|
+
}
|
|
1754
|
+
//#endregion
|
|
1755
|
+
//#region ../../node_modules/lodash-es/_baseCreate.js
|
|
1756
|
+
var objectCreate = Object.create;
|
|
1757
|
+
var baseCreate = function() {
|
|
1758
|
+
function object() {}
|
|
1759
|
+
return function(proto) {
|
|
1760
|
+
if (!isObject(proto)) return {};
|
|
1761
|
+
if (objectCreate) return objectCreate(proto);
|
|
1762
|
+
object.prototype = proto;
|
|
1763
|
+
var result = new object();
|
|
1764
|
+
object.prototype = void 0;
|
|
1765
|
+
return result;
|
|
1766
|
+
};
|
|
1767
|
+
}();
|
|
1768
|
+
//#endregion
|
|
1769
|
+
//#region ../../node_modules/lodash-es/_apply.js
|
|
1770
|
+
function apply(func, thisArg, args) {
|
|
1771
|
+
switch (args.length) {
|
|
1772
|
+
case 0: return func.call(thisArg);
|
|
1773
|
+
case 1: return func.call(thisArg, args[0]);
|
|
1774
|
+
case 2: return func.call(thisArg, args[0], args[1]);
|
|
1775
|
+
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
|
1776
|
+
}
|
|
1777
|
+
return func.apply(thisArg, args);
|
|
1778
|
+
}
|
|
1779
|
+
//#endregion
|
|
1780
|
+
//#region ../../node_modules/lodash-es/_copyArray.js
|
|
1781
|
+
function copyArray(source, array) {
|
|
1782
|
+
var index = -1, length = source.length;
|
|
1783
|
+
array || (array = Array(length));
|
|
1784
|
+
while (++index < length) array[index] = source[index];
|
|
1785
|
+
return array;
|
|
1786
|
+
}
|
|
1787
|
+
//#endregion
|
|
1788
|
+
//#region ../../node_modules/lodash-es/_shortOut.js
|
|
1789
|
+
var HOT_COUNT = 800;
|
|
1790
|
+
var HOT_SPAN = 16;
|
|
1791
|
+
var nativeNow = Date.now;
|
|
1792
|
+
function shortOut(func) {
|
|
1793
|
+
var count = 0, lastCalled = 0;
|
|
1794
|
+
return function() {
|
|
1795
|
+
var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
|
|
1796
|
+
lastCalled = stamp;
|
|
1797
|
+
if (remaining > 0) {
|
|
1798
|
+
if (++count >= HOT_COUNT) return arguments[0];
|
|
1799
|
+
} else count = 0;
|
|
1800
|
+
return func.apply(void 0, arguments);
|
|
1801
|
+
};
|
|
1802
|
+
}
|
|
1803
|
+
//#endregion
|
|
1804
|
+
//#region ../../node_modules/lodash-es/constant.js
|
|
1805
|
+
function constant(value) {
|
|
1806
|
+
return function() {
|
|
1807
|
+
return value;
|
|
1808
|
+
};
|
|
1809
|
+
}
|
|
1810
|
+
//#endregion
|
|
1811
|
+
//#region ../../node_modules/lodash-es/_setToString.js
|
|
1812
|
+
var setToString = shortOut(!defineProperty ? identity : function(func, string) {
|
|
1813
|
+
return defineProperty(func, "toString", {
|
|
1814
|
+
"configurable": true,
|
|
1815
|
+
"enumerable": false,
|
|
1816
|
+
"value": constant(string),
|
|
1817
|
+
"writable": true
|
|
1818
|
+
});
|
|
1819
|
+
});
|
|
1820
|
+
//#endregion
|
|
1821
|
+
//#region ../../node_modules/lodash-es/_copyObject.js
|
|
1822
|
+
function copyObject(source, props, object, customizer) {
|
|
1823
|
+
var isNew = !object;
|
|
1824
|
+
object || (object = {});
|
|
1825
|
+
var index = -1, length = props.length;
|
|
1826
|
+
while (++index < length) {
|
|
1827
|
+
var key = props[index];
|
|
1828
|
+
var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
|
|
1829
|
+
if (newValue === void 0) newValue = source[key];
|
|
1830
|
+
if (isNew) baseAssignValue(object, key, newValue);
|
|
1831
|
+
else assignValue(object, key, newValue);
|
|
1832
|
+
}
|
|
1833
|
+
return object;
|
|
1834
|
+
}
|
|
1835
|
+
//#endregion
|
|
1836
|
+
//#region ../../node_modules/lodash-es/_overRest.js
|
|
1837
|
+
var nativeMax = Math.max;
|
|
1838
|
+
function overRest(func, start, transform) {
|
|
1839
|
+
start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
|
|
1840
|
+
return function() {
|
|
1841
|
+
var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length);
|
|
1842
|
+
while (++index < length) array[index] = args[start + index];
|
|
1843
|
+
index = -1;
|
|
1844
|
+
var otherArgs = Array(start + 1);
|
|
1845
|
+
while (++index < start) otherArgs[index] = args[index];
|
|
1846
|
+
otherArgs[start] = transform(array);
|
|
1847
|
+
return apply(func, this, otherArgs);
|
|
1848
|
+
};
|
|
1849
|
+
}
|
|
1850
|
+
//#endregion
|
|
1851
|
+
//#region ../../node_modules/lodash-es/_baseRest.js
|
|
1852
|
+
function baseRest(func, start) {
|
|
1853
|
+
return setToString(overRest(func, start, identity), func + "");
|
|
1854
|
+
}
|
|
1855
|
+
//#endregion
|
|
1856
|
+
//#region ../../node_modules/lodash-es/isLength.js
|
|
1857
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
1858
|
+
function isLength(value) {
|
|
1859
|
+
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
1860
|
+
}
|
|
1861
|
+
//#endregion
|
|
1862
|
+
//#region ../../node_modules/lodash-es/isArrayLike.js
|
|
1863
|
+
function isArrayLike(value) {
|
|
1864
|
+
return value != null && isLength(value.length) && !isFunction(value);
|
|
1865
|
+
}
|
|
1866
|
+
//#endregion
|
|
1867
|
+
//#region ../../node_modules/lodash-es/_isIterateeCall.js
|
|
1868
|
+
function isIterateeCall(value, index, object) {
|
|
1869
|
+
if (!isObject(object)) return false;
|
|
1870
|
+
var type = typeof index;
|
|
1871
|
+
if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) return eq(object[index], value);
|
|
1872
|
+
return false;
|
|
1873
|
+
}
|
|
1874
|
+
//#endregion
|
|
1875
|
+
//#region ../../node_modules/lodash-es/_createAssigner.js
|
|
1876
|
+
function createAssigner(assigner) {
|
|
1877
|
+
return baseRest(function(object, sources) {
|
|
1878
|
+
var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
|
|
1879
|
+
customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
|
|
1880
|
+
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
|
1881
|
+
customizer = length < 3 ? void 0 : customizer;
|
|
1882
|
+
length = 1;
|
|
1883
|
+
}
|
|
1884
|
+
object = Object(object);
|
|
1885
|
+
while (++index < length) {
|
|
1886
|
+
var source = sources[index];
|
|
1887
|
+
if (source) assigner(object, source, index, customizer);
|
|
1888
|
+
}
|
|
1889
|
+
return object;
|
|
1890
|
+
});
|
|
1891
|
+
}
|
|
1892
|
+
//#endregion
|
|
1893
|
+
//#region ../../node_modules/lodash-es/_isPrototype.js
|
|
1894
|
+
var objectProto$2 = Object.prototype;
|
|
1895
|
+
function isPrototype(value) {
|
|
1896
|
+
var Ctor = value && value.constructor;
|
|
1897
|
+
return value === (typeof Ctor == "function" && Ctor.prototype || objectProto$2);
|
|
1898
|
+
}
|
|
1899
|
+
//#endregion
|
|
1900
|
+
//#region ../../node_modules/lodash-es/_baseTimes.js
|
|
1901
|
+
function baseTimes(n, iteratee) {
|
|
1902
|
+
var index = -1, result = Array(n);
|
|
1903
|
+
while (++index < n) result[index] = iteratee(index);
|
|
1904
|
+
return result;
|
|
1905
|
+
}
|
|
1906
|
+
//#endregion
|
|
1907
|
+
//#region ../../node_modules/lodash-es/_baseIsArguments.js
|
|
1908
|
+
var argsTag$1 = "[object Arguments]";
|
|
1909
|
+
function baseIsArguments(value) {
|
|
1910
|
+
return isObjectLike(value) && baseGetTag(value) == argsTag$1;
|
|
1911
|
+
}
|
|
1912
|
+
//#endregion
|
|
1913
|
+
//#region ../../node_modules/lodash-es/isArguments.js
|
|
1914
|
+
var objectProto$1 = Object.prototype;
|
|
1915
|
+
var hasOwnProperty$3 = objectProto$1.hasOwnProperty;
|
|
1916
|
+
var propertyIsEnumerable = objectProto$1.propertyIsEnumerable;
|
|
1917
|
+
var isArguments = baseIsArguments(function() {
|
|
1918
|
+
return arguments;
|
|
1919
|
+
}()) ? baseIsArguments : function(value) {
|
|
1920
|
+
return isObjectLike(value) && hasOwnProperty$3.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
|
|
1921
|
+
};
|
|
1922
|
+
//#endregion
|
|
1923
|
+
//#region ../../node_modules/lodash-es/stubFalse.js
|
|
1924
|
+
function stubFalse() {
|
|
1925
|
+
return false;
|
|
1926
|
+
}
|
|
1927
|
+
//#endregion
|
|
1928
|
+
//#region ../../node_modules/lodash-es/isBuffer.js
|
|
1929
|
+
var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
1930
|
+
var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
|
|
1931
|
+
var Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? root.Buffer : void 0;
|
|
1932
|
+
var isBuffer = (Buffer$1 ? Buffer$1.isBuffer : void 0) || stubFalse;
|
|
1933
|
+
//#endregion
|
|
1934
|
+
//#region ../../node_modules/lodash-es/_baseIsTypedArray.js
|
|
1935
|
+
var argsTag = "[object Arguments]";
|
|
1936
|
+
var arrayTag = "[object Array]";
|
|
1937
|
+
var boolTag = "[object Boolean]";
|
|
1938
|
+
var dateTag = "[object Date]";
|
|
1939
|
+
var errorTag = "[object Error]";
|
|
1940
|
+
var funcTag = "[object Function]";
|
|
1941
|
+
var mapTag = "[object Map]";
|
|
1942
|
+
var numberTag = "[object Number]";
|
|
1943
|
+
var objectTag$1 = "[object Object]";
|
|
1944
|
+
var regexpTag = "[object RegExp]";
|
|
1945
|
+
var setTag = "[object Set]";
|
|
1946
|
+
var stringTag = "[object String]";
|
|
1947
|
+
var weakMapTag = "[object WeakMap]";
|
|
1948
|
+
var arrayBufferTag = "[object ArrayBuffer]";
|
|
1949
|
+
var dataViewTag = "[object DataView]";
|
|
1950
|
+
var float32Tag = "[object Float32Array]";
|
|
1951
|
+
var float64Tag = "[object Float64Array]";
|
|
1952
|
+
var int8Tag = "[object Int8Array]";
|
|
1953
|
+
var int16Tag = "[object Int16Array]";
|
|
1954
|
+
var int32Tag = "[object Int32Array]";
|
|
1955
|
+
var uint8Tag = "[object Uint8Array]";
|
|
1956
|
+
var uint8ClampedTag = "[object Uint8ClampedArray]";
|
|
1957
|
+
var uint16Tag = "[object Uint16Array]";
|
|
1958
|
+
var uint32Tag = "[object Uint32Array]";
|
|
1959
|
+
var typedArrayTags = {};
|
|
1960
|
+
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
|
|
1961
|
+
typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag$1] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
|
|
1962
|
+
function baseIsTypedArray(value) {
|
|
1963
|
+
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
1964
|
+
}
|
|
1965
|
+
//#endregion
|
|
1966
|
+
//#region ../../node_modules/lodash-es/_baseUnary.js
|
|
1967
|
+
function baseUnary(func) {
|
|
1968
|
+
return function(value) {
|
|
1969
|
+
return func(value);
|
|
1970
|
+
};
|
|
1971
|
+
}
|
|
1972
|
+
//#endregion
|
|
1973
|
+
//#region ../../node_modules/lodash-es/_nodeUtil.js
|
|
1974
|
+
var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
1975
|
+
var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
|
|
1976
|
+
var freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && freeGlobal.process;
|
|
1977
|
+
var nodeUtil = function() {
|
|
1978
|
+
try {
|
|
1979
|
+
var types = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
|
|
1980
|
+
if (types) return types;
|
|
1981
|
+
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
1982
|
+
} catch (e) {}
|
|
1983
|
+
}();
|
|
1984
|
+
//#endregion
|
|
1985
|
+
//#region ../../node_modules/lodash-es/isTypedArray.js
|
|
1986
|
+
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
1987
|
+
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
1988
|
+
//#endregion
|
|
1989
|
+
//#region ../../node_modules/lodash-es/_arrayLikeKeys.js
|
|
1990
|
+
var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
1991
|
+
function arrayLikeKeys(value, inherited) {
|
|
1992
|
+
var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
|
|
1993
|
+
for (var key in value) if ((inherited || hasOwnProperty$2.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) result.push(key);
|
|
1994
|
+
return result;
|
|
1995
|
+
}
|
|
1996
|
+
//#endregion
|
|
1997
|
+
//#region ../../node_modules/lodash-es/_overArg.js
|
|
1998
|
+
function overArg(func, transform) {
|
|
1999
|
+
return function(arg) {
|
|
2000
|
+
return func(transform(arg));
|
|
2001
|
+
};
|
|
2002
|
+
}
|
|
2003
|
+
//#endregion
|
|
2004
|
+
//#region ../../node_modules/lodash-es/_nativeKeysIn.js
|
|
2005
|
+
function nativeKeysIn(object) {
|
|
2006
|
+
var result = [];
|
|
2007
|
+
if (object != null) for (var key in Object(object)) result.push(key);
|
|
2008
|
+
return result;
|
|
2009
|
+
}
|
|
2010
|
+
//#endregion
|
|
2011
|
+
//#region ../../node_modules/lodash-es/_baseKeysIn.js
|
|
2012
|
+
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
2013
|
+
function baseKeysIn(object) {
|
|
2014
|
+
if (!isObject(object)) return nativeKeysIn(object);
|
|
2015
|
+
var isProto = isPrototype(object), result = [];
|
|
2016
|
+
for (var key in object) if (!(key == "constructor" && (isProto || !hasOwnProperty$1.call(object, key)))) result.push(key);
|
|
2017
|
+
return result;
|
|
2018
|
+
}
|
|
2019
|
+
//#endregion
|
|
2020
|
+
//#region ../../node_modules/lodash-es/keysIn.js
|
|
2021
|
+
function keysIn(object) {
|
|
2022
|
+
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
|
2023
|
+
}
|
|
2024
|
+
//#endregion
|
|
2025
|
+
//#region ../../node_modules/lodash-es/_getPrototype.js
|
|
2026
|
+
var getPrototype = overArg(Object.getPrototypeOf, Object);
|
|
2027
|
+
//#endregion
|
|
2028
|
+
//#region ../../node_modules/lodash-es/isPlainObject.js
|
|
2029
|
+
var objectTag = "[object Object]";
|
|
2030
|
+
var funcProto = Function.prototype;
|
|
2031
|
+
var objectProto = Object.prototype;
|
|
2032
|
+
var funcToString = funcProto.toString;
|
|
2033
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
2034
|
+
var objectCtorString = funcToString.call(Object);
|
|
2035
|
+
function isPlainObject(value) {
|
|
2036
|
+
if (!isObjectLike(value) || baseGetTag(value) != objectTag) return false;
|
|
2037
|
+
var proto = getPrototype(value);
|
|
2038
|
+
if (proto === null) return true;
|
|
2039
|
+
var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
|
2040
|
+
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
|
|
2041
|
+
}
|
|
2042
|
+
//#endregion
|
|
2043
|
+
//#region ../../node_modules/lodash-es/_stackClear.js
|
|
2044
|
+
function stackClear() {
|
|
2045
|
+
this.__data__ = new ListCache();
|
|
2046
|
+
this.size = 0;
|
|
2047
|
+
}
|
|
2048
|
+
//#endregion
|
|
2049
|
+
//#region ../../node_modules/lodash-es/_stackDelete.js
|
|
2050
|
+
function stackDelete(key) {
|
|
2051
|
+
var data = this.__data__, result = data["delete"](key);
|
|
2052
|
+
this.size = data.size;
|
|
2053
|
+
return result;
|
|
2054
|
+
}
|
|
2055
|
+
//#endregion
|
|
2056
|
+
//#region ../../node_modules/lodash-es/_stackGet.js
|
|
2057
|
+
function stackGet(key) {
|
|
2058
|
+
return this.__data__.get(key);
|
|
2059
|
+
}
|
|
2060
|
+
//#endregion
|
|
2061
|
+
//#region ../../node_modules/lodash-es/_stackHas.js
|
|
2062
|
+
function stackHas(key) {
|
|
2063
|
+
return this.__data__.has(key);
|
|
2064
|
+
}
|
|
2065
|
+
//#endregion
|
|
2066
|
+
//#region ../../node_modules/lodash-es/_stackSet.js
|
|
2067
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
2068
|
+
function stackSet(key, value) {
|
|
2069
|
+
var data = this.__data__;
|
|
2070
|
+
if (data instanceof ListCache) {
|
|
2071
|
+
var pairs = data.__data__;
|
|
2072
|
+
if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
2073
|
+
pairs.push([key, value]);
|
|
2074
|
+
this.size = ++data.size;
|
|
2075
|
+
return this;
|
|
2076
|
+
}
|
|
2077
|
+
data = this.__data__ = new MapCache(pairs);
|
|
2078
|
+
}
|
|
2079
|
+
data.set(key, value);
|
|
2080
|
+
this.size = data.size;
|
|
2081
|
+
return this;
|
|
2082
|
+
}
|
|
2083
|
+
//#endregion
|
|
2084
|
+
//#region ../../node_modules/lodash-es/_Stack.js
|
|
2085
|
+
function Stack(entries) {
|
|
2086
|
+
var data = this.__data__ = new ListCache(entries);
|
|
2087
|
+
this.size = data.size;
|
|
2088
|
+
}
|
|
2089
|
+
Stack.prototype.clear = stackClear;
|
|
2090
|
+
Stack.prototype["delete"] = stackDelete;
|
|
2091
|
+
Stack.prototype.get = stackGet;
|
|
2092
|
+
Stack.prototype.has = stackHas;
|
|
2093
|
+
Stack.prototype.set = stackSet;
|
|
2094
|
+
//#endregion
|
|
2095
|
+
//#region ../../node_modules/lodash-es/_cloneBuffer.js
|
|
2096
|
+
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
2097
|
+
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
|
|
2098
|
+
var Buffer = freeModule && freeModule.exports === freeExports ? root.Buffer : void 0;
|
|
2099
|
+
var allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
|
|
2100
|
+
function cloneBuffer(buffer, isDeep) {
|
|
2101
|
+
if (isDeep) return buffer.slice();
|
|
2102
|
+
var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
|
2103
|
+
buffer.copy(result);
|
|
2104
|
+
return result;
|
|
2105
|
+
}
|
|
2106
|
+
//#endregion
|
|
2107
|
+
//#region ../../node_modules/lodash-es/_Uint8Array.js
|
|
2108
|
+
var Uint8Array = root.Uint8Array;
|
|
2109
|
+
//#endregion
|
|
2110
|
+
//#region ../../node_modules/lodash-es/_cloneArrayBuffer.js
|
|
2111
|
+
function cloneArrayBuffer(arrayBuffer) {
|
|
2112
|
+
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
2113
|
+
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
|
|
2114
|
+
return result;
|
|
2115
|
+
}
|
|
2116
|
+
//#endregion
|
|
2117
|
+
//#region ../../node_modules/lodash-es/_cloneTypedArray.js
|
|
2118
|
+
function cloneTypedArray(typedArray, isDeep) {
|
|
2119
|
+
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
|
2120
|
+
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
2121
|
+
}
|
|
2122
|
+
//#endregion
|
|
2123
|
+
//#region ../../node_modules/lodash-es/_initCloneObject.js
|
|
2124
|
+
function initCloneObject(object) {
|
|
2125
|
+
return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
|
|
2126
|
+
}
|
|
2127
|
+
//#endregion
|
|
2128
|
+
//#region ../../node_modules/lodash-es/_createBaseFor.js
|
|
2129
|
+
function createBaseFor(fromRight) {
|
|
2130
|
+
return function(object, iteratee, keysFunc) {
|
|
2131
|
+
var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
|
|
2132
|
+
while (length--) {
|
|
2133
|
+
var key = props[fromRight ? length : ++index];
|
|
2134
|
+
if (iteratee(iterable[key], key, iterable) === false) break;
|
|
2135
|
+
}
|
|
2136
|
+
return object;
|
|
2137
|
+
};
|
|
2138
|
+
}
|
|
2139
|
+
//#endregion
|
|
2140
|
+
//#region ../../node_modules/lodash-es/_baseFor.js
|
|
2141
|
+
var baseFor = createBaseFor();
|
|
2142
|
+
//#endregion
|
|
2143
|
+
//#region ../../node_modules/lodash-es/_assignMergeValue.js
|
|
2144
|
+
function assignMergeValue(object, key, value) {
|
|
2145
|
+
if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) baseAssignValue(object, key, value);
|
|
2146
|
+
}
|
|
2147
|
+
//#endregion
|
|
2148
|
+
//#region ../../node_modules/lodash-es/isArrayLikeObject.js
|
|
2149
|
+
function isArrayLikeObject(value) {
|
|
2150
|
+
return isObjectLike(value) && isArrayLike(value);
|
|
2151
|
+
}
|
|
2152
|
+
//#endregion
|
|
2153
|
+
//#region ../../node_modules/lodash-es/_safeGet.js
|
|
2154
|
+
function safeGet(object, key) {
|
|
2155
|
+
if (key === "constructor" && typeof object[key] === "function") return;
|
|
2156
|
+
if (key == "__proto__") return;
|
|
2157
|
+
return object[key];
|
|
2158
|
+
}
|
|
2159
|
+
//#endregion
|
|
2160
|
+
//#region ../../node_modules/lodash-es/toPlainObject.js
|
|
2161
|
+
function toPlainObject(value) {
|
|
2162
|
+
return copyObject(value, keysIn(value));
|
|
2163
|
+
}
|
|
2164
|
+
//#endregion
|
|
2165
|
+
//#region ../../node_modules/lodash-es/_baseMergeDeep.js
|
|
2166
|
+
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
|
2167
|
+
var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
|
|
2168
|
+
if (stacked) {
|
|
2169
|
+
assignMergeValue(object, key, stacked);
|
|
2170
|
+
return;
|
|
2171
|
+
}
|
|
2172
|
+
var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
|
|
2173
|
+
var isCommon = newValue === void 0;
|
|
2174
|
+
if (isCommon) {
|
|
2175
|
+
var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
|
|
2176
|
+
newValue = srcValue;
|
|
2177
|
+
if (isArr || isBuff || isTyped) {
|
|
2178
|
+
if (isArray(objValue)) newValue = objValue;
|
|
2179
|
+
else if (isArrayLikeObject(objValue)) newValue = copyArray(objValue);
|
|
2180
|
+
else if (isBuff) {
|
|
2181
|
+
isCommon = false;
|
|
2182
|
+
newValue = cloneBuffer(srcValue, true);
|
|
2183
|
+
} else if (isTyped) {
|
|
2184
|
+
isCommon = false;
|
|
2185
|
+
newValue = cloneTypedArray(srcValue, true);
|
|
2186
|
+
} else newValue = [];
|
|
2187
|
+
} else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
|
2188
|
+
newValue = objValue;
|
|
2189
|
+
if (isArguments(objValue)) newValue = toPlainObject(objValue);
|
|
2190
|
+
else if (!isObject(objValue) || isFunction(objValue)) newValue = initCloneObject(srcValue);
|
|
2191
|
+
} else isCommon = false;
|
|
2192
|
+
}
|
|
2193
|
+
if (isCommon) {
|
|
2194
|
+
stack.set(srcValue, newValue);
|
|
2195
|
+
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
|
|
2196
|
+
stack["delete"](srcValue);
|
|
2197
|
+
}
|
|
2198
|
+
assignMergeValue(object, key, newValue);
|
|
2199
|
+
}
|
|
2200
|
+
//#endregion
|
|
2201
|
+
//#region ../../node_modules/lodash-es/_baseMerge.js
|
|
2202
|
+
function baseMerge(object, source, srcIndex, customizer, stack) {
|
|
2203
|
+
if (object === source) return;
|
|
2204
|
+
baseFor(source, function(srcValue, key) {
|
|
2205
|
+
stack || (stack = new Stack());
|
|
2206
|
+
if (isObject(srcValue)) baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
|
2207
|
+
else {
|
|
2208
|
+
var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
|
|
2209
|
+
if (newValue === void 0) newValue = srcValue;
|
|
2210
|
+
assignMergeValue(object, key, newValue);
|
|
2211
|
+
}
|
|
2212
|
+
}, keysIn);
|
|
2213
|
+
}
|
|
2214
|
+
//#endregion
|
|
2215
|
+
//#region ../../node_modules/lodash-es/mergeWith.js
|
|
2216
|
+
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
|
|
2217
|
+
baseMerge(object, source, srcIndex, customizer);
|
|
2218
|
+
});
|
|
2219
|
+
//#endregion
|
|
2220
|
+
//#region ../../node_modules/lodash-es/merge.js
|
|
2221
|
+
var merge = createAssigner(function(object, source, srcIndex) {
|
|
2222
|
+
baseMerge(object, source, srcIndex);
|
|
2223
|
+
});
|
|
2224
|
+
//#endregion
|
|
2225
|
+
//#region ../admin/src/utils/booleanToTriState.ts
|
|
2226
|
+
var booleanToTriState = (value) => {
|
|
2227
|
+
return value ? TriState.On : TriState.Off;
|
|
2228
|
+
};
|
|
2229
|
+
//#endregion
|
|
2230
|
+
//#region ../admin/src/utils/createObjectWithKeys.ts
|
|
2231
|
+
var createObjectWithKeys = (keys, callback = (key) => key) => {
|
|
2232
|
+
return keys.reduce((acc, key) => ({
|
|
2233
|
+
...acc,
|
|
2234
|
+
[key]: callback(key)
|
|
2235
|
+
}), {});
|
|
2236
|
+
};
|
|
2237
|
+
//#endregion
|
|
2238
|
+
//#region ../admin/src/pdk/testIdDirective.ts
|
|
2239
|
+
var testIdDirective = (el, binding) => {};
|
|
2240
|
+
//#endregion
|
|
2241
|
+
//#region ../admin/src/pdk/instance/createInstanceContext.ts
|
|
2242
|
+
var createInstanceContext = (context) => {
|
|
2243
|
+
const instanceContext = {};
|
|
2244
|
+
if (context.orderData?.length === 1) {
|
|
2245
|
+
const [order] = context.orderData;
|
|
2246
|
+
instanceContext[AdminInstanceContextKey.OrderIdentifier] = order.externalIdentifier;
|
|
2247
|
+
}
|
|
2248
|
+
if (context.productData?.length === 1) {
|
|
2249
|
+
const [product] = context.productData;
|
|
2250
|
+
instanceContext[AdminInstanceContextKey.ProductIdentifier] = product.externalIdentifier;
|
|
2251
|
+
}
|
|
2252
|
+
return instanceContext;
|
|
2253
|
+
};
|
|
2254
|
+
//#endregion
|
|
2255
|
+
//#region ../admin/src/pdk/instance/createQueryClient.ts
|
|
2256
|
+
var clearApiNotifications = () => {
|
|
2257
|
+
useNotificationStore().remove(NotificationCategory.Api);
|
|
2258
|
+
};
|
|
2259
|
+
var createQueryClient = () => new QueryClient({ defaultOptions: {
|
|
2260
|
+
mutations: {
|
|
2261
|
+
onMutate: clearApiNotifications,
|
|
2262
|
+
retry: false
|
|
2263
|
+
},
|
|
2264
|
+
queries: {
|
|
2265
|
+
behavior: { onFetch: clearApiNotifications },
|
|
2266
|
+
refetchInterval: false,
|
|
2267
|
+
refetchOnMount: false,
|
|
2268
|
+
refetchOnReconnect: false,
|
|
2269
|
+
refetchOnWindowFocus: false,
|
|
2270
|
+
retry: false,
|
|
2271
|
+
retryOnMount: false,
|
|
2272
|
+
staleTime: Infinity
|
|
2273
|
+
}
|
|
2274
|
+
} });
|
|
2275
|
+
//#endregion
|
|
2276
|
+
//#region ../admin/src/pdk/instance/plugins/createContextPlugin.ts
|
|
2277
|
+
var createContextPlugin = ({ appName, config, context, logger, view }) => ({ install(app) {
|
|
2278
|
+
logger.debug("Installing context plugin");
|
|
2279
|
+
app.provide(INJECT_ADMIN_INSTANCE, {
|
|
2280
|
+
appName,
|
|
2281
|
+
config,
|
|
2282
|
+
context: createInstanceContext(context),
|
|
2283
|
+
logger,
|
|
2284
|
+
view
|
|
2285
|
+
});
|
|
2286
|
+
} });
|
|
2287
|
+
//#endregion
|
|
2288
|
+
//#region ../admin/src/pdk/instance/plugins/createLoggerPlugin.ts
|
|
2289
|
+
var createLoggerPlugin = (appConfig) => ({ install(app) {
|
|
2290
|
+
app.config.errorHandler = (err) => {
|
|
2291
|
+
appConfig.logger.error(err);
|
|
2292
|
+
};
|
|
2293
|
+
app.config.warnHandler = (msg) => {
|
|
2294
|
+
appConfig.logger.warn(msg);
|
|
2295
|
+
};
|
|
2296
|
+
} });
|
|
2297
|
+
//#endregion
|
|
2298
|
+
//#region ../admin/src/components/common/PlainElement.ts
|
|
2299
|
+
var PlainElement_default = defineComponent({
|
|
2300
|
+
name: "PlainElement",
|
|
2301
|
+
render() {
|
|
2302
|
+
return h("div", this.$attrs, this.$slots);
|
|
2303
|
+
}
|
|
2304
|
+
});
|
|
2305
|
+
//#endregion
|
|
2306
|
+
//#region ../admin/src/components/common/ResetButton.vue
|
|
2307
|
+
var ResetButton_default = /* @__PURE__ */ defineComponent({
|
|
2308
|
+
__name: "ResetButton",
|
|
2309
|
+
props: { disabled: { type: Boolean } },
|
|
2310
|
+
setup(__props) {
|
|
2311
|
+
const form = M();
|
|
2312
|
+
const reset = () => {
|
|
2313
|
+
form.reset();
|
|
2314
|
+
};
|
|
2315
|
+
return (_ctx, _cache) => {
|
|
2316
|
+
const _component_PdkButton = resolveComponent("PdkButton");
|
|
2317
|
+
return openBlock(), createBlock(_component_PdkButton, {
|
|
2318
|
+
disabled: _ctx.disabled,
|
|
2319
|
+
icon: unref(AdminIcon).Refresh,
|
|
2320
|
+
label: "action_reset",
|
|
2321
|
+
variant: unref(Variant).Secondary,
|
|
2322
|
+
onClick: reset
|
|
2323
|
+
}, null, 8, [
|
|
2324
|
+
"disabled",
|
|
2325
|
+
"icon",
|
|
2326
|
+
"variant"
|
|
2327
|
+
]);
|
|
2328
|
+
};
|
|
2329
|
+
}
|
|
2330
|
+
});
|
|
2331
|
+
//#endregion
|
|
2332
|
+
//#region ../admin/src/forms/createReturnsForm.ts
|
|
2333
|
+
var createReturnsForm = (id) => {
|
|
2334
|
+
return Ne(`returns${id}`, { fields: [] });
|
|
2335
|
+
};
|
|
2336
|
+
//#endregion
|
|
2337
|
+
//#region ../admin/src/forms/pluginSettings/createFormTab.ts
|
|
2338
|
+
var createFormTab = (tab) => {
|
|
2339
|
+
const language = useLanguage();
|
|
2340
|
+
const children = [h("div", {}, h(xe, { form: tab.form }))];
|
|
2341
|
+
if (tab.description && language.has(tab.description)) children.unshift(h("p", language.translate(tab.description)));
|
|
2342
|
+
return {
|
|
2343
|
+
...tab,
|
|
2344
|
+
component: () => h("div", {}, children)
|
|
2345
|
+
};
|
|
2346
|
+
};
|
|
2347
|
+
//#endregion
|
|
2348
|
+
//#region ../admin/src/forms/pluginSettings/resolveSettingsValues.ts
|
|
2349
|
+
var resolveSettingsValues = (pluginSettings, id) => {
|
|
2350
|
+
return get(pluginSettings, id) ?? get(pluginSettings, id.replace(/\.[^.]+$/, ".*"), {});
|
|
2351
|
+
};
|
|
2352
|
+
//#endregion
|
|
2353
|
+
//#region ../admin/src/forms/pluginSettings/createPluginSettingsForm.ts
|
|
2354
|
+
var createPluginSettingsForm = (id, view, context) => {
|
|
2355
|
+
const { pluginSettings, actionContext } = context;
|
|
2356
|
+
const mutation = useStoreQuery(BackendEndpoint.UpdatePluginSettings);
|
|
2357
|
+
const values = resolveSettingsValues(pluginSettings, id);
|
|
2358
|
+
const generatedFields = generateFormFields({
|
|
2359
|
+
fields: view.elements,
|
|
2360
|
+
values
|
|
2361
|
+
}, `${id}.`);
|
|
2362
|
+
return Ne(id, {
|
|
2363
|
+
...context.config.formConfigOverrides?.pluginSettings,
|
|
2364
|
+
fields: [...generatedFields, {
|
|
2365
|
+
component: SubmitButton_default,
|
|
2366
|
+
props: { loading: mutation.isLoading }
|
|
2367
|
+
}],
|
|
2368
|
+
async afterSubmit(form) {
|
|
2369
|
+
await executeAction({
|
|
2370
|
+
...actionContext,
|
|
2371
|
+
parameters: { form }
|
|
2372
|
+
});
|
|
2373
|
+
}
|
|
2374
|
+
});
|
|
2375
|
+
};
|
|
2376
|
+
//#endregion
|
|
2377
|
+
//#region ../admin/src/forms/pluginSettings/createPluginSettingsTabsComponent.ts
|
|
2378
|
+
var createPluginSettingsTabsComponent = (id, view, context) => defineComponent({
|
|
2379
|
+
name: `${AdminView.PluginSettings}-${id}`,
|
|
2380
|
+
setup: () => {
|
|
2381
|
+
return { tabs: (view.children ?? []).map((subview) => {
|
|
2382
|
+
const { subtext, description, id: subviewId, title, titleSuffix } = subview;
|
|
2383
|
+
return createFormTab({
|
|
2384
|
+
name: `${id}.${subviewId}`,
|
|
2385
|
+
label: title,
|
|
2386
|
+
labelSuffix: titleSuffix,
|
|
2387
|
+
form: createPluginSettingsForm(`${id}.${subviewId}`, subview, context),
|
|
2388
|
+
description,
|
|
2389
|
+
subtext
|
|
2390
|
+
});
|
|
2391
|
+
}) };
|
|
2392
|
+
},
|
|
2393
|
+
render() {
|
|
2394
|
+
return h("div", [h(TabNavigation_default, {
|
|
2395
|
+
hashPrefix: `${view.id}--`,
|
|
2396
|
+
tabs: this.tabs
|
|
2397
|
+
})]);
|
|
2398
|
+
}
|
|
2399
|
+
});
|
|
2400
|
+
//#endregion
|
|
2401
|
+
//#region ../admin/src/forms/pluginSettings/createPluginSettingsTabs.ts
|
|
2402
|
+
var createPluginSettingsTabs = (view, context) => {
|
|
2403
|
+
return Object.entries(view).map(([id, view]) => {
|
|
2404
|
+
const tab = {
|
|
2405
|
+
name: id,
|
|
2406
|
+
label: view.title
|
|
2407
|
+
};
|
|
2408
|
+
if (!view.children) return createFormTab({
|
|
2409
|
+
...tab,
|
|
2410
|
+
form: createPluginSettingsForm(id, view, context)
|
|
2411
|
+
});
|
|
2412
|
+
if (!view.children.length) {
|
|
2413
|
+
const { translate } = useLanguage();
|
|
2414
|
+
return {
|
|
2415
|
+
...tab,
|
|
2416
|
+
component: h("div", {}, translate(`view_${id}_empty`))
|
|
2417
|
+
};
|
|
2418
|
+
}
|
|
2419
|
+
return {
|
|
2420
|
+
...tab,
|
|
2421
|
+
component: markRaw(createPluginSettingsTabsComponent(id, view, context))
|
|
2422
|
+
};
|
|
2423
|
+
});
|
|
2424
|
+
};
|
|
2425
|
+
//#endregion
|
|
2426
|
+
//#region ../admin/src/forms/pluginSettings/filterPluginSettingsView.ts
|
|
2427
|
+
var GENERAL_SECTION_HEADING = "settings_order_general_title";
|
|
2428
|
+
var SHIPMENT_EXPORT_FIELDS = /* @__PURE__ */ new Set(["conceptShipments", "saveCustomerAddress"]);
|
|
2429
|
+
var isSettingsDivider = (field) => {
|
|
2430
|
+
return field.$component === "SettingsDivider";
|
|
2431
|
+
};
|
|
2432
|
+
var isGeneralDivider = (field) => {
|
|
2433
|
+
return isSettingsDivider(field) && field.heading === GENERAL_SECTION_HEADING;
|
|
2434
|
+
};
|
|
2435
|
+
var filterOrderElements = (elements, orderMode) => {
|
|
2436
|
+
let inGeneralSection = false;
|
|
2437
|
+
return elements.filter((field) => {
|
|
2438
|
+
if (isGeneralDivider(field)) inGeneralSection = true;
|
|
2439
|
+
else if (isSettingsDivider(field)) inGeneralSection = false;
|
|
2440
|
+
if (!inGeneralSection) return true;
|
|
2441
|
+
if (SHIPMENT_EXPORT_FIELDS.has(field.name ?? "")) return orderMode !== OrderMode.OrderV1;
|
|
2442
|
+
return true;
|
|
2443
|
+
});
|
|
2444
|
+
};
|
|
2445
|
+
var filterPluginSettingsView = (view, orderMode) => {
|
|
2446
|
+
const entries = Object.entries(view);
|
|
2447
|
+
return Object.fromEntries(entries.map(([tabId, tabView]) => {
|
|
2448
|
+
if (tabId !== "order" || !tabView.elements) return [tabId, tabView];
|
|
2449
|
+
return [tabId, {
|
|
2450
|
+
...tabView,
|
|
2451
|
+
elements: filterOrderElements(tabView.elements, orderMode)
|
|
2452
|
+
}];
|
|
2453
|
+
}));
|
|
2454
|
+
};
|
|
2455
|
+
//#endregion
|
|
2456
|
+
//#region ../admin/src/components/common/ReturnsForm.vue?vue&type=script&lang.ts
|
|
2457
|
+
var ReturnsForm_vue_vue_type_script_lang_default = defineComponent({
|
|
2458
|
+
name: "ReturnsForm",
|
|
2459
|
+
components: { MagicForm: xe },
|
|
2460
|
+
props: { orderId: {
|
|
2461
|
+
type: String,
|
|
2462
|
+
required: true
|
|
2463
|
+
} },
|
|
2464
|
+
setup(props) {
|
|
2465
|
+
return { returnsForm: createReturnsForm(props.orderId) };
|
|
2466
|
+
}
|
|
2467
|
+
});
|
|
2468
|
+
//#endregion
|
|
2469
|
+
//#region \0plugin-vue:export-helper
|
|
2470
|
+
var _plugin_vue_export_helper_default = (sfc, props) => {
|
|
2471
|
+
const target = sfc.__vccOpts || sfc;
|
|
2472
|
+
for (const [key, val] of props) target[key] = val;
|
|
2473
|
+
return target;
|
|
2474
|
+
};
|
|
2475
|
+
//#endregion
|
|
2476
|
+
//#region ../admin/src/components/common/ReturnsForm.vue
|
|
2477
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2478
|
+
const _component_MagicForm = resolveComponent("MagicForm");
|
|
2479
|
+
return openBlock(), createBlock(_component_MagicForm, { form: _ctx.returnsForm }, null, 8, ["form"]);
|
|
2480
|
+
}
|
|
2481
|
+
var ReturnsForm_default = /*#__PURE__*/ _plugin_vue_export_helper_default(ReturnsForm_vue_vue_type_script_lang_default, [["render", _sfc_render]]);
|
|
2482
|
+
//#endregion
|
|
2483
|
+
//#region ../admin/src/components/common/StatusIndicator.vue
|
|
2484
|
+
var StatusIndicator_default = /* @__PURE__ */ defineComponent({
|
|
2485
|
+
__name: "StatusIndicator",
|
|
2486
|
+
props: { status: {
|
|
2487
|
+
type: String,
|
|
2488
|
+
default: Status.Pending
|
|
2489
|
+
} },
|
|
2490
|
+
setup(__props) {
|
|
2491
|
+
const props = __props;
|
|
2492
|
+
const config = useAdminConfig();
|
|
2493
|
+
const icon = computed(() => {
|
|
2494
|
+
switch (props.status) {
|
|
2495
|
+
case Status.Success: return AdminIcon.Yes;
|
|
2496
|
+
case Status.Error: return AdminIcon.No;
|
|
2497
|
+
default: return AdminIcon.Spinner;
|
|
2498
|
+
}
|
|
2499
|
+
});
|
|
2500
|
+
const cssClasses = computed(() => ({
|
|
2501
|
+
[config?.cssUtilities?.textColorSuccess ?? ""]: props.status === Status.Success,
|
|
2502
|
+
[config?.cssUtilities?.textColorError ?? ""]: props.status === Status.Error,
|
|
2503
|
+
[config?.cssUtilities?.animationSpin ?? ""]: props.status === Status.Pending
|
|
2504
|
+
}));
|
|
2505
|
+
return (_ctx, _cache) => {
|
|
2506
|
+
const _component_PdkIcon = resolveComponent("PdkIcon");
|
|
2507
|
+
return openBlock(), createElementBlock("span", { class: normalizeClass(unref(config)?.cssUtilities?.whitespaceNoWrap) }, [createVNode(_component_PdkIcon, {
|
|
2508
|
+
class: normalizeClass(cssClasses.value),
|
|
2509
|
+
icon: icon.value
|
|
2510
|
+
}, null, 8, ["class", "icon"]), renderSlot(_ctx.$slots, "default")], 2);
|
|
2511
|
+
};
|
|
2512
|
+
}
|
|
2513
|
+
});
|
|
2514
|
+
//#endregion
|
|
2515
|
+
//#region ../admin/src/components/common/SubmitButton.vue
|
|
2516
|
+
var SubmitButton_default = /* @__PURE__ */ defineComponent({
|
|
2517
|
+
__name: "SubmitButton",
|
|
2518
|
+
props: { disabled: { type: Boolean } },
|
|
2519
|
+
setup(__props) {
|
|
2520
|
+
const form = M();
|
|
2521
|
+
const { loading, setLoading } = useLoading();
|
|
2522
|
+
async function submit() {
|
|
2523
|
+
setLoading(true);
|
|
2524
|
+
await form.submit();
|
|
2525
|
+
setLoading(false);
|
|
2526
|
+
}
|
|
2527
|
+
const icon = AdminIcon.Save;
|
|
2528
|
+
return (_ctx, _cache) => {
|
|
2529
|
+
const _component_PdkButton = resolveComponent("PdkButton");
|
|
2530
|
+
return openBlock(), createBlock(_component_PdkButton, {
|
|
2531
|
+
disabled: _ctx.disabled,
|
|
2532
|
+
icon: unref(icon),
|
|
2533
|
+
loading: unref(loading),
|
|
2534
|
+
label: "action_save",
|
|
2535
|
+
onClick: submit
|
|
2536
|
+
}, null, 8, [
|
|
2537
|
+
"disabled",
|
|
2538
|
+
"icon",
|
|
2539
|
+
"loading"
|
|
2540
|
+
]);
|
|
2541
|
+
};
|
|
2542
|
+
}
|
|
2543
|
+
});
|
|
2544
|
+
//#endregion
|
|
2545
|
+
//#region ../admin/src/components/common/TabNavigation.vue?vue&type=script&setup=true&lang.ts
|
|
2546
|
+
var _hoisted_1$4 = ["textContent"];
|
|
2547
|
+
//#endregion
|
|
2548
|
+
//#region ../admin/src/components/common/TabNavigation.vue
|
|
2549
|
+
var TabNavigation_default = /* @__PURE__ */ defineComponent({
|
|
2550
|
+
__name: "TabNavigation",
|
|
2551
|
+
props: {
|
|
2552
|
+
button: {
|
|
2553
|
+
type: [String, Object],
|
|
2554
|
+
default: () => prefixComponent(AdminComponent.TabNavButton)
|
|
2555
|
+
},
|
|
2556
|
+
buttonWrapper: {
|
|
2557
|
+
type: [String, Object],
|
|
2558
|
+
default: () => prefixComponent(AdminComponent.TabNavButtonWrapper)
|
|
2559
|
+
},
|
|
2560
|
+
closeable: { type: Boolean },
|
|
2561
|
+
hashPrefix: {
|
|
2562
|
+
type: String,
|
|
2563
|
+
default: ""
|
|
2564
|
+
},
|
|
2565
|
+
initialTab: {
|
|
2566
|
+
type: [String, Boolean],
|
|
2567
|
+
default: null
|
|
2568
|
+
},
|
|
2569
|
+
tabs: {
|
|
2570
|
+
type: Array,
|
|
2571
|
+
required: true
|
|
2572
|
+
}
|
|
2573
|
+
},
|
|
2574
|
+
setup(__props) {
|
|
2575
|
+
const props = __props;
|
|
2576
|
+
const activeTab = ref(null);
|
|
2577
|
+
const handleClick = (tab) => {
|
|
2578
|
+
if (props.initialTab !== false) window.location.hash = props.hashPrefix + tab.name;
|
|
2579
|
+
if (props.closeable && activeTab.value === tab.name) {
|
|
2580
|
+
activeTab.value = null;
|
|
2581
|
+
return;
|
|
2582
|
+
}
|
|
2583
|
+
activeTab.value = tab.name;
|
|
2584
|
+
};
|
|
2585
|
+
const activeTabContents = computed(() => {
|
|
2586
|
+
return props.tabs?.find((tab) => tab.name === activeTab.value);
|
|
2587
|
+
});
|
|
2588
|
+
const config = useAdminConfig();
|
|
2589
|
+
const { translate } = useLanguage();
|
|
2590
|
+
watch(() => [props.tabs, props.initialTab], () => {
|
|
2591
|
+
if (!props.tabs?.length) {
|
|
2592
|
+
activeTab.value = null;
|
|
2593
|
+
return;
|
|
2594
|
+
}
|
|
2595
|
+
if (activeTab.value || props.initialTab === false) return;
|
|
2596
|
+
let initialTab = props.initialTab === true ? null : props.initialTab;
|
|
2597
|
+
if (!props.initialTab) {
|
|
2598
|
+
const tabName = window.location.hash.replace("#", "").replace(props.hashPrefix ?? "", "").split("--")[0];
|
|
2599
|
+
if (props.tabs?.some((tab) => tab.name === tabName)) initialTab = tabName;
|
|
2600
|
+
}
|
|
2601
|
+
activeTab.value = initialTab ?? props.tabs?.[0]?.name;
|
|
2602
|
+
}, {
|
|
2603
|
+
immediate: true,
|
|
2604
|
+
deep: true
|
|
2605
|
+
});
|
|
2606
|
+
return (_ctx, _cache) => {
|
|
2607
|
+
const _component_PdkIcon = resolveComponent("PdkIcon");
|
|
2608
|
+
const _component_PdkTabNavContentWrapper = resolveComponent("PdkTabNavContentWrapper");
|
|
2609
|
+
return openBlock(), createElementBlock(Fragment, null, [__props.tabs.length > 1 ? (openBlock(), createBlock(resolveDynamicComponent(__props.buttonWrapper), {
|
|
2610
|
+
key: 0,
|
|
2611
|
+
role: "tablist"
|
|
2612
|
+
}, {
|
|
2613
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.tabs, (tab) => {
|
|
2614
|
+
return openBlock(), createBlock(resolveDynamicComponent(__props.button), {
|
|
2615
|
+
key: `tab_button_${tab.name}`,
|
|
2616
|
+
active: tab.name === activeTab.value,
|
|
2617
|
+
role: "tab",
|
|
2618
|
+
onClick: () => handleClick(tab)
|
|
2619
|
+
}, {
|
|
2620
|
+
default: withCtx(() => [
|
|
2621
|
+
tab.icon ? (openBlock(), createBlock(_component_PdkIcon, {
|
|
2622
|
+
key: 0,
|
|
2623
|
+
icon: tab.icon
|
|
2624
|
+
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
2625
|
+
createTextVNode(" " + toDisplayString(unref(translate)(tab.label)) + " ", 1),
|
|
2626
|
+
tab.labelSuffix ? (openBlock(), createElementBlock("span", {
|
|
2627
|
+
key: 1,
|
|
2628
|
+
textContent: toDisplayString(` ${unref(translate)(tab.labelSuffix)}`)
|
|
2629
|
+
}, null, 8, _hoisted_1$4)) : createCommentVNode("", true)
|
|
2630
|
+
]),
|
|
2631
|
+
_: 2
|
|
2632
|
+
}, 1032, ["active", "onClick"]);
|
|
2633
|
+
}), 128)), renderSlot(_ctx.$slots, "button-wrapper")]),
|
|
2634
|
+
_: 3
|
|
2635
|
+
})) : createCommentVNode("", true), activeTabContents.value ? (openBlock(), createBlock(_component_PdkTabNavContentWrapper, {
|
|
2636
|
+
key: 1,
|
|
2637
|
+
role: "tabpanel"
|
|
2638
|
+
}, {
|
|
2639
|
+
default: withCtx(() => [createVNode(Transition, {
|
|
2640
|
+
name: unref(config).transitions?.tabNavigation,
|
|
2641
|
+
mode: "out-in"
|
|
2642
|
+
}, {
|
|
2643
|
+
default: withCtx(() => [(openBlock(), createBlock(KeepAlive, null, [(openBlock(), createBlock(resolveDynamicComponent(activeTabContents.value.component), { key: activeTabContents.value.name }))], 1024))]),
|
|
2644
|
+
_: 1
|
|
2645
|
+
}, 8, ["name"])]),
|
|
2646
|
+
_: 1
|
|
2647
|
+
})) : createCommentVNode("", true)], 64);
|
|
2648
|
+
};
|
|
2649
|
+
}
|
|
2650
|
+
});
|
|
2651
|
+
//#endregion
|
|
2652
|
+
//#region ../admin/src/pdk/instance/plugins/createRegisterComponentsPlugin.ts
|
|
2653
|
+
var getOptionalComponents = (app) => {
|
|
2654
|
+
const isNotRegistered = (component) => app.component(component) === void 0;
|
|
2655
|
+
const createComponentMap = (componentNames, fallback) => {
|
|
2656
|
+
return componentNames.map(prefixComponent).filter(isNotRegistered).reduce((acc, componentName) => ({
|
|
2657
|
+
...acc,
|
|
2658
|
+
[componentName]: fallback
|
|
2659
|
+
}), {});
|
|
2660
|
+
};
|
|
2661
|
+
return {
|
|
2662
|
+
...createComponentMap(optionalAdminComponentNames, PlainElement_default),
|
|
2663
|
+
...createComponentMap(optionalAdminPlainWrapperComponentNames, PlainElement_default),
|
|
2664
|
+
...createComponentMap(optionalAdminActionContainerComponentNames, AdminComponent.Box)
|
|
2665
|
+
};
|
|
2666
|
+
};
|
|
2667
|
+
var createRegisterComponentsPlugin = ({ config, logger }) => {
|
|
2668
|
+
return { install(app) {
|
|
2669
|
+
const componentsFromConfig = Object.entries(config.components).reduce((acc, [name, component]) => ({
|
|
2670
|
+
...acc,
|
|
2671
|
+
[unprefixComponent(name)]: component
|
|
2672
|
+
}), {});
|
|
2673
|
+
const requiredComponents = {
|
|
2674
|
+
...requiredAdminComponentNames.reduce((acc, name) => ({
|
|
2675
|
+
...acc,
|
|
2676
|
+
[name]: null
|
|
2677
|
+
}), {}),
|
|
2678
|
+
...componentsFromConfig
|
|
2679
|
+
};
|
|
2680
|
+
Object.entries(requiredComponents).forEach(([componentName, component]) => {
|
|
2681
|
+
if (!component) {
|
|
2682
|
+
logger.error(`Missing component: "${componentName}". You must provide your own, or use one provided by one of the @myparcel-dev/pdk-admin-preset-* packages.`);
|
|
2683
|
+
return;
|
|
2684
|
+
}
|
|
2685
|
+
app.component(prefixComponent(componentName), markRaw(component));
|
|
2686
|
+
});
|
|
2687
|
+
Object.entries(getOptionalComponents(app)).forEach(([componentName, component]) => {
|
|
2688
|
+
const componentToRegister = typeof component === "string" ? componentsFromConfig[component] : component;
|
|
2689
|
+
if (!componentToRegister) return;
|
|
2690
|
+
app.component(prefixComponent(componentName), markRaw(componentToRegister));
|
|
2691
|
+
});
|
|
2692
|
+
const { translate } = useLanguage();
|
|
2693
|
+
const defaultConfig = {
|
|
2694
|
+
renderLabel: translate,
|
|
2695
|
+
field: { wrapper: componentsFromConfig[AdminComponent.FormGroup] }
|
|
2696
|
+
};
|
|
2697
|
+
app.use(je, mergeWith(defaultConfig, config.formConfig));
|
|
2698
|
+
logger.debug("Installed components plugin.");
|
|
2699
|
+
} };
|
|
2700
|
+
};
|
|
2701
|
+
//#endregion
|
|
2702
|
+
//#region ../admin/src/pdk/instance/plugins/createStorePlugin.ts
|
|
2703
|
+
var store;
|
|
2704
|
+
var initialized = false;
|
|
2705
|
+
var createStorePlugin = ({ config, logger }) => {
|
|
2706
|
+
store ??= createPinia();
|
|
2707
|
+
logger.debug("Preparing store plugin");
|
|
2708
|
+
store.use((storeContext) => {
|
|
2709
|
+
if (initialized || !config.onCreateStore) return;
|
|
2710
|
+
initialized = true;
|
|
2711
|
+
logger.debug("Calling store renderer hook");
|
|
2712
|
+
config.onCreateStore(storeContext);
|
|
2713
|
+
});
|
|
2714
|
+
return store;
|
|
2715
|
+
};
|
|
2716
|
+
//#endregion
|
|
2717
|
+
//#region ../admin/src/pdk/instance/plugins/createVueQueryPlugin.ts
|
|
2718
|
+
var queryClient;
|
|
2719
|
+
var createVueQueryPlugin = ({ context, logger }) => {
|
|
2720
|
+
return { install: (app) => {
|
|
2721
|
+
logger.debug("Installing vue-query plugin");
|
|
2722
|
+
queryClient ??= createQueryClient();
|
|
2723
|
+
Object.entries(context).forEach(([contextKey, value]) => {
|
|
2724
|
+
if (!value) return;
|
|
2725
|
+
queryClient.setQueryData([BackendEndpoint.FetchContext, contextKey], value);
|
|
2726
|
+
});
|
|
2727
|
+
const instanceContext = createInstanceContext(context);
|
|
2728
|
+
queryClient.setQueryData([BackendEndpoint.FetchContext, AdminContextKey.Instance], instanceContext);
|
|
2729
|
+
if (context.orderData) context.orderData.forEach((order) => {
|
|
2730
|
+
fillShipmentsQueryData(queryClient, order.shipments, order);
|
|
2731
|
+
});
|
|
2732
|
+
if (context.productData) context.productData.forEach((product) => {
|
|
2733
|
+
queryClient.setQueryData([BackendEndpoint.FetchProducts, { id: product.externalIdentifier }], product);
|
|
2734
|
+
});
|
|
2735
|
+
app.use(VueQueryPlugin, { queryClient });
|
|
2736
|
+
} };
|
|
2737
|
+
};
|
|
2738
|
+
//#endregion
|
|
2739
|
+
//#region ../admin/src/pdk/setupAdminApp.ts
|
|
2740
|
+
var setupAdminApp = (app, appConfig) => {
|
|
2741
|
+
app.use(createStorePlugin(appConfig));
|
|
2742
|
+
app.use(createVueQueryPlugin(appConfig));
|
|
2743
|
+
app.use(createContextPlugin(appConfig));
|
|
2744
|
+
app.use(createRegisterComponentsPlugin(appConfig));
|
|
2745
|
+
app.use(createLoggerPlugin(appConfig));
|
|
2746
|
+
app.directive("test", testIdDirective);
|
|
2747
|
+
};
|
|
2748
|
+
//#endregion
|
|
2749
|
+
//#region ../admin/src/pdk/renderMap.ts
|
|
2750
|
+
var renderMap = Object.freeze({
|
|
2751
|
+
[AdminView.ChildProductSettings]: async () => Promise.resolve().then(() => ChildProductSettings_exports),
|
|
2752
|
+
[AdminView.Modals]: async () => Promise.resolve().then(() => Modals_exports),
|
|
2753
|
+
[AdminView.Notifications]: async () => Promise.resolve().then(() => Notifications_exports),
|
|
2754
|
+
[AdminView.OrderBox]: async () => Promise.resolve().then(() => OrderBox_exports),
|
|
2755
|
+
[AdminView.OrderListItem]: async () => Promise.resolve().then(() => OrderListItem_exports),
|
|
2756
|
+
[AdminView.PluginSettings]: async () => Promise.resolve().then(() => PluginSettings_exports),
|
|
2757
|
+
[AdminView.ProductSettings]: async () => import("./shared-IXbJs3EW.js").then((n) => n.r)
|
|
2758
|
+
});
|
|
2759
|
+
var renderViewComponent = async (componentName) => {
|
|
2760
|
+
const renderMethod = renderMap[componentName];
|
|
2761
|
+
if (!renderMethod) throw new Error(`No render method found for component "${componentName}"`);
|
|
2762
|
+
return (await renderMethod()).default;
|
|
2763
|
+
};
|
|
2764
|
+
//#endregion
|
|
2765
|
+
//#region ../admin/src/pdk/PdkAdmin.ts
|
|
2766
|
+
var PdkAdmin = class {
|
|
2767
|
+
config;
|
|
2768
|
+
context;
|
|
2769
|
+
renderedComponents = [];
|
|
2770
|
+
constructor(config, context) {
|
|
2771
|
+
config.beforeInitialize?.(config, context);
|
|
2772
|
+
this.config = config;
|
|
2773
|
+
this.context = context;
|
|
2774
|
+
config.onInitialized?.(config, context);
|
|
2775
|
+
}
|
|
2776
|
+
async render(view, selector) {
|
|
2777
|
+
const config = { ...this.config };
|
|
2778
|
+
const context = {
|
|
2779
|
+
...this.context,
|
|
2780
|
+
...getElementContext(selector)
|
|
2781
|
+
};
|
|
2782
|
+
const appName = this.createAppName(view, context);
|
|
2783
|
+
const logger = createLogger(appName);
|
|
2784
|
+
logger.debug(`Rendering "${view}" in "${selector}"`);
|
|
2785
|
+
const app = await this.createApp(view, {
|
|
2786
|
+
appName,
|
|
2787
|
+
config,
|
|
2788
|
+
context,
|
|
2789
|
+
logger,
|
|
2790
|
+
view
|
|
2791
|
+
});
|
|
2792
|
+
try {
|
|
2793
|
+
app.mount(selector);
|
|
2794
|
+
this.renderedComponents.push(view);
|
|
2795
|
+
config?.onRendered?.(config);
|
|
2796
|
+
logger.debug(`Rendered in ${selector}`);
|
|
2797
|
+
} catch (e) {
|
|
2798
|
+
logger.error("Error mounting app", e);
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
async createApp(view, appConfig) {
|
|
2802
|
+
appConfig.view = view;
|
|
2803
|
+
appConfig.config?.beforeRender?.(appConfig.config);
|
|
2804
|
+
const component = await renderViewComponent(view);
|
|
2805
|
+
const app = createApp({
|
|
2806
|
+
...component,
|
|
2807
|
+
name: appConfig.appName
|
|
2808
|
+
}).provide(INJECT_GLOBAL_PDK_ADMIN, this);
|
|
2809
|
+
setupAdminApp(app, appConfig);
|
|
2810
|
+
return app;
|
|
2811
|
+
}
|
|
2812
|
+
createAppName(componentName, context) {
|
|
2813
|
+
if (process.env.NODE_ENV === "production") return componentName;
|
|
2814
|
+
const { orderData } = context;
|
|
2815
|
+
let appName = componentName;
|
|
2816
|
+
if (componentName === AdminView.OrderListItem) {
|
|
2817
|
+
const orderId = orderData?.length === 1 ? orderData[0].externalIdentifier : null;
|
|
2818
|
+
appName += ` #${orderId}`;
|
|
2819
|
+
}
|
|
2820
|
+
return appName;
|
|
2821
|
+
}
|
|
2822
|
+
};
|
|
2823
|
+
//#endregion
|
|
2824
|
+
//#region ../admin/src/pdk/sendBootEvent.ts
|
|
2825
|
+
var sendBootEvent = (pdkAdmin, context) => {
|
|
2826
|
+
const globalContext = context.global;
|
|
2827
|
+
if (!globalContext) throw new Error("Global context not found");
|
|
2828
|
+
document.dispatchEvent(new CustomEvent(globalContext.eventPong, { detail: pdkAdmin }));
|
|
2829
|
+
};
|
|
2830
|
+
//#endregion
|
|
2831
|
+
//#region ../admin/src/pdk/boot.ts
|
|
2832
|
+
var boot = (pdkAdmin, context) => {
|
|
2833
|
+
sendBootEvent(pdkAdmin, context);
|
|
2834
|
+
document.addEventListener(context.global.eventPing, () => {
|
|
2835
|
+
sendBootEvent(pdkAdmin, context);
|
|
2836
|
+
});
|
|
2837
|
+
globalLogger.debug("Created PDK admin!", { context });
|
|
2838
|
+
};
|
|
2839
|
+
//#endregion
|
|
2840
|
+
//#region ../admin/src/pdk/createAdminConfig.ts
|
|
2841
|
+
var createDefaultConfig = () => ({
|
|
2842
|
+
components: void 0,
|
|
2843
|
+
formatters: {},
|
|
2844
|
+
logLevel: LogLevel.Info,
|
|
2845
|
+
transitions: {},
|
|
2846
|
+
generateFieldId: (element) => `${element.form.name}-${element.name}`
|
|
2847
|
+
});
|
|
2848
|
+
var createAdminConfig = (customConfig) => {
|
|
2849
|
+
const defaultConfig = createDefaultConfig();
|
|
2850
|
+
const merged = mergeWith({}, defaultConfig, customConfig, (obj, src, key) => {
|
|
2851
|
+
if (key === "components") return src ?? obj;
|
|
2852
|
+
});
|
|
2853
|
+
Object.keys(defaultConfig).forEach((key) => {
|
|
2854
|
+
if (!merged[key]) throw new Error(`Config key "${key}" is missing.`);
|
|
2855
|
+
});
|
|
2856
|
+
return Object.freeze(merged);
|
|
2857
|
+
};
|
|
2858
|
+
//#endregion
|
|
2859
|
+
//#region ../admin/src/pdk/createPdkAdmin.ts
|
|
2860
|
+
var BOOTSTRAP_CONTAINER_SELECTOR = "#myparcel-pdk-boot";
|
|
2861
|
+
var createPdkAdmin = (configuration) => {
|
|
2862
|
+
try {
|
|
2863
|
+
const config = createAdminConfig(configuration);
|
|
2864
|
+
globalLogger.level = config.logLevel;
|
|
2865
|
+
const context = getElementContext(BOOTSTRAP_CONTAINER_SELECTOR);
|
|
2866
|
+
const pdkAdmin = new PdkAdmin(config, context);
|
|
2867
|
+
boot(pdkAdmin, context);
|
|
2868
|
+
return pdkAdmin;
|
|
2869
|
+
} catch (e) {
|
|
2870
|
+
globalLogger.error("Failed to create PDK admin:");
|
|
2871
|
+
console.error(e);
|
|
2872
|
+
}
|
|
2873
|
+
};
|
|
2874
|
+
//#endregion
|
|
2875
|
+
//#region ../admin/src/pdk/createPdkAdminPlugin.ts
|
|
2876
|
+
var createPdkAdminPlugin = (config, context) => {
|
|
2877
|
+
return { install(app) {
|
|
2878
|
+
setupAdminApp(app, {
|
|
2879
|
+
appName: "",
|
|
2880
|
+
config: createAdminConfig(config),
|
|
2881
|
+
context,
|
|
2882
|
+
logger: globalLogger
|
|
2883
|
+
});
|
|
2884
|
+
} };
|
|
2885
|
+
};
|
|
2886
|
+
//#endregion
|
|
2887
|
+
//#region ../admin/src/utils/extendAdminInstance.ts
|
|
2888
|
+
var extendAdminInstance = (data) => {
|
|
2889
|
+
const instance = inject(INJECT_ADMIN_INSTANCE);
|
|
2890
|
+
provide(INJECT_ADMIN_INSTANCE, merge({}, instance, data));
|
|
2891
|
+
};
|
|
2892
|
+
//#endregion
|
|
2893
|
+
//#region ../admin/src/utils/forms/generateFieldId.ts
|
|
2894
|
+
var generateFieldId = (element) => {
|
|
2895
|
+
const config = useAdminConfig();
|
|
2896
|
+
const resolvedElement = unref(element) ?? Je();
|
|
2897
|
+
const formBaseName = resolvedElement.form.name.split("--")[0];
|
|
2898
|
+
return (config.formConfigOverrides?.[formBaseName]?.generateFieldId ?? config.generateFieldId)(resolvedElement);
|
|
2899
|
+
};
|
|
2900
|
+
//#endregion
|
|
2901
|
+
//#region ../admin/src/utils/notificationBelongsToOrder.ts
|
|
2902
|
+
var notificationBelongsToOrder = (notification, externalIdentifier) => {
|
|
2903
|
+
const { orderIds } = notification.tags ?? {};
|
|
2904
|
+
if (!orderIds || !externalIdentifier) return false;
|
|
2905
|
+
return orderIds.split(",").includes(externalIdentifier);
|
|
2906
|
+
};
|
|
2907
|
+
//#endregion
|
|
2908
|
+
//#region ../admin/src/utils/translations/translateSelectOption.ts
|
|
2909
|
+
var translateSelectOption = (option, translate) => {
|
|
2910
|
+
const hasLabel = isOfType(option, "label");
|
|
2911
|
+
const translatedOption = { ...option };
|
|
2912
|
+
translatedOption.label = hasLabel ? translate(option.label) : option.plainLabel;
|
|
2913
|
+
return Object.freeze(translatedOption);
|
|
2914
|
+
};
|
|
2915
|
+
//#endregion
|
|
2916
|
+
//#region ../admin/src/utils/triStateToBoolean.ts
|
|
2917
|
+
var triStateToBoolean = (value) => {
|
|
2918
|
+
return TriState.Inherit === value ? false : Boolean(value);
|
|
2919
|
+
};
|
|
2920
|
+
//#endregion
|
|
2921
|
+
//#region ../admin/src/utils/unprefixComponent.ts
|
|
2922
|
+
var unprefixComponent = (componentName) => {
|
|
2923
|
+
return componentName.replace("Pdk", "");
|
|
2924
|
+
};
|
|
2925
|
+
//#endregion
|
|
2926
|
+
//#region ../admin/src/composables/context/useAppInfo.ts
|
|
2927
|
+
var useAppInfo = () => {
|
|
2928
|
+
return useGlobalContext().appInfo;
|
|
2929
|
+
};
|
|
2930
|
+
//#endregion
|
|
2931
|
+
//#region ../admin/src/composables/context/useModalContext.ts
|
|
2932
|
+
var useModalContext = (modalId, onSave, onCancel) => {
|
|
2933
|
+
const store = useModalStore();
|
|
2934
|
+
const resolvedId = ref(modalId?.value);
|
|
2935
|
+
if (!modalId?.value) {
|
|
2936
|
+
if (!store.opened) return null;
|
|
2937
|
+
resolvedId.value = store.opened;
|
|
2938
|
+
}
|
|
2939
|
+
const { loading, setLoading } = useLoading();
|
|
2940
|
+
const modalData = ref();
|
|
2941
|
+
const shown = computed(() => store.opened === resolvedId.value);
|
|
2942
|
+
const onButtonClick = async (type) => {
|
|
2943
|
+
const callback = type === "save" ? onSave : onCancel;
|
|
2944
|
+
if (callback) {
|
|
2945
|
+
setLoading(true);
|
|
2946
|
+
await callback.value?.(resolvedId.value);
|
|
2947
|
+
setLoading(false);
|
|
2948
|
+
}
|
|
2949
|
+
};
|
|
2950
|
+
return {
|
|
2951
|
+
opened: store.opened,
|
|
2952
|
+
loading,
|
|
2953
|
+
modalData,
|
|
2954
|
+
onButtonClick,
|
|
2955
|
+
setLoading,
|
|
2956
|
+
shown
|
|
2957
|
+
};
|
|
2958
|
+
};
|
|
2959
|
+
//#endregion
|
|
2960
|
+
//#region ../admin/src/composables/components/useElementOptions.ts
|
|
2961
|
+
var useElementOptions = (props) => {
|
|
2962
|
+
const { translate } = useLanguage();
|
|
2963
|
+
const sort = computed(() => props.element.props.sort);
|
|
2964
|
+
return { options: computed(() => {
|
|
2965
|
+
return (props.element.props.options ?? []).map((option) => translateSelectOption(option, translate)).sort((a, b) => {
|
|
2966
|
+
if (b.value === -1) return 1;
|
|
2967
|
+
switch (sort.value) {
|
|
2968
|
+
case SortType.Ascending: return a.label.localeCompare(b.label);
|
|
2969
|
+
case SortType.Descending: return b.label.localeCompare(a.label);
|
|
2970
|
+
}
|
|
2971
|
+
return 0;
|
|
2972
|
+
});
|
|
2973
|
+
}) };
|
|
2974
|
+
};
|
|
2975
|
+
//#endregion
|
|
2976
|
+
//#region ../admin/src/composables/components/useElementContext.ts
|
|
2977
|
+
var useElementContext = (props, emit) => {
|
|
2978
|
+
return {
|
|
2979
|
+
id: generateFieldId(props.element),
|
|
2980
|
+
model: useVModel(props, void 0, emit)
|
|
2981
|
+
};
|
|
2982
|
+
};
|
|
2983
|
+
//#endregion
|
|
2984
|
+
//#region ../admin/src/composables/components/useInputWithOptionsContext.ts
|
|
2985
|
+
var useInputWithOptionsContext = (props, emit, multiple) => {
|
|
2986
|
+
const { id, model } = useElementContext(props, emit);
|
|
2987
|
+
const { options } = useElementOptions(props);
|
|
2988
|
+
onMounted(() => {
|
|
2989
|
+
watch(options, (newOptions) => {
|
|
2990
|
+
const values = toArray(toValue(model));
|
|
2991
|
+
if (values.length && newOptions.some((option) => values.includes(option.value)) || newOptions.length === 0) return;
|
|
2992
|
+
model.value = multiple ? [newOptions[0].value] : newOptions[0].value;
|
|
2993
|
+
}, { immediate: Number(toValue(options)?.length) > 0 });
|
|
2994
|
+
});
|
|
2995
|
+
return {
|
|
2996
|
+
id,
|
|
2997
|
+
options,
|
|
2998
|
+
model
|
|
2999
|
+
};
|
|
3000
|
+
};
|
|
3001
|
+
//#endregion
|
|
3002
|
+
//#region ../admin/src/composables/components/useCheckboxGroupContext.ts
|
|
3003
|
+
var useCheckboxGroupContext = (props, emit) => useInputWithOptionsContext(props, emit);
|
|
3004
|
+
//#endregion
|
|
3005
|
+
//#region ../admin/src/composables/useWeekdays.ts
|
|
3006
|
+
var WEEKDAYS = [
|
|
3007
|
+
0,
|
|
3008
|
+
1,
|
|
3009
|
+
2,
|
|
3010
|
+
3,
|
|
3011
|
+
4,
|
|
3012
|
+
5,
|
|
3013
|
+
6
|
|
3014
|
+
];
|
|
3015
|
+
var useWeekdays = () => {
|
|
3016
|
+
const formatter = useLocalizedFormatter();
|
|
3017
|
+
return {
|
|
3018
|
+
weekdays: WEEKDAYS,
|
|
3019
|
+
weekdaysObject: createObjectWithKeys(WEEKDAYS, (day) => formatter.format(Format.Weekday, day))
|
|
3020
|
+
};
|
|
3021
|
+
};
|
|
3022
|
+
//#endregion
|
|
3023
|
+
//#region ../admin/src/composables/components/useDropOffInputContext.ts
|
|
3024
|
+
var useDropOffInputContext = (props, emit) => {
|
|
3025
|
+
const { weekdaysObject, weekdays } = useWeekdays();
|
|
3026
|
+
const createReactiveObject = (property, defaultValue) => {
|
|
3027
|
+
return reactive(createObjectWithKeys(weekdays, (day) => {
|
|
3028
|
+
return props.modelValue?.dropOffDays.find(({ weekday }) => weekday === day)?.[property] ?? defaultValue;
|
|
3029
|
+
}));
|
|
3030
|
+
};
|
|
3031
|
+
const toggleRefs = createReactiveObject("dispatch", false);
|
|
3032
|
+
const cutoffRefs = createReactiveObject("cutoffTime", "16:00");
|
|
3033
|
+
const { component: _, ...restElement } = props.element;
|
|
3034
|
+
const createElements = (reactiveObject, name) => createObjectWithKeys(weekdays, (day) => createFormElement({
|
|
3035
|
+
...restElement,
|
|
3036
|
+
ref: reactiveObject[day],
|
|
3037
|
+
name: `${name}${day.toString()}`
|
|
3038
|
+
}));
|
|
3039
|
+
const toggleElements = createElements(toggleRefs, "toggle");
|
|
3040
|
+
const cutoffElements = createElements(cutoffRefs, "cutoff");
|
|
3041
|
+
watch([toggleRefs, cutoffRefs], () => {
|
|
3042
|
+
const value = {
|
|
3043
|
+
dropOffDays: weekdays.map((day) => ({
|
|
3044
|
+
weekday: day,
|
|
3045
|
+
dispatch: toggleRefs[day],
|
|
3046
|
+
cutoffTime: cutoffRefs[day]
|
|
3047
|
+
})),
|
|
3048
|
+
dropOffDaysDeviations: []
|
|
3049
|
+
};
|
|
3050
|
+
emit?.("update:modelValue", value);
|
|
3051
|
+
});
|
|
3052
|
+
return {
|
|
3053
|
+
cutoffElements,
|
|
3054
|
+
toggleElements,
|
|
3055
|
+
cutoffRefs,
|
|
3056
|
+
toggleRefs,
|
|
3057
|
+
weekdays,
|
|
3058
|
+
weekdaysObject
|
|
3059
|
+
};
|
|
3060
|
+
};
|
|
3061
|
+
//#endregion
|
|
3062
|
+
//#region ../admin/src/composables/components/useDropdownButtonContext.ts
|
|
3063
|
+
var useDropdownButtonContext = (props) => {
|
|
3064
|
+
const toggled = ref(false);
|
|
3065
|
+
const propRefs = toRefs(props);
|
|
3066
|
+
return {
|
|
3067
|
+
dropdownActions: computed(() => {
|
|
3068
|
+
const [standalone, hidden] = partitionArray(toValue(propRefs.actions), (action) => action.standalone === true);
|
|
3069
|
+
return {
|
|
3070
|
+
standalone,
|
|
3071
|
+
hidden
|
|
3072
|
+
};
|
|
3073
|
+
}),
|
|
3074
|
+
dropdownIcon: computed(() => toggled.value ? AdminIcon.ArrowUp : AdminIcon.ArrowDown),
|
|
3075
|
+
toggle(value) {
|
|
3076
|
+
toggled.value = value ?? !toggled.value;
|
|
3077
|
+
},
|
|
3078
|
+
toggled
|
|
3079
|
+
};
|
|
3080
|
+
};
|
|
3081
|
+
//#endregion
|
|
3082
|
+
//#region ../admin/src/composables/components/useModalElementContext.ts
|
|
3083
|
+
var useModalElementContext = (modalKey) => {
|
|
3084
|
+
const modalStore = useModalStore();
|
|
3085
|
+
const context = computed(() => isOpen.value ? modalStore.context : null);
|
|
3086
|
+
const isOpen = computed(() => modalKey && modalStore.opened === modalKey);
|
|
3087
|
+
return {
|
|
3088
|
+
close: modalStore.close,
|
|
3089
|
+
context,
|
|
3090
|
+
isOpen
|
|
3091
|
+
};
|
|
3092
|
+
};
|
|
3093
|
+
//#endregion
|
|
3094
|
+
//#region ../admin/src/composables/components/useMultiSelectInputContext.ts
|
|
3095
|
+
var useMultiSelectInputContext = (props, emit) => {
|
|
3096
|
+
return useInputWithOptionsContext(props, emit, true);
|
|
3097
|
+
};
|
|
3098
|
+
//#endregion
|
|
3099
|
+
//#region ../admin/src/composables/components/useRadioGroupContext.ts
|
|
3100
|
+
var useRadioGroupContext = (props, emit) => {
|
|
3101
|
+
const context = useInputWithOptionsContext(props, emit);
|
|
3102
|
+
const elements = computed(() => {
|
|
3103
|
+
return createObjectWithKeys((toValue(context.options) ?? []).map((option) => option.value), (value) => {
|
|
3104
|
+
const option = (toValue(context.options) ?? []).find((option) => option.value === value);
|
|
3105
|
+
return createFormElement({
|
|
3106
|
+
ref: context.model,
|
|
3107
|
+
name: `${props.element.name}${value.toString()}`,
|
|
3108
|
+
label: isOfType(option, "label") ? option.label : option.plainLabel,
|
|
3109
|
+
props: {
|
|
3110
|
+
value: option.value,
|
|
3111
|
+
image: option.image,
|
|
3112
|
+
icon: option.icon
|
|
3113
|
+
}
|
|
3114
|
+
});
|
|
3115
|
+
});
|
|
3116
|
+
});
|
|
3117
|
+
return {
|
|
3118
|
+
...context,
|
|
3119
|
+
elements
|
|
3120
|
+
};
|
|
3121
|
+
};
|
|
3122
|
+
//#endregion
|
|
3123
|
+
//#region ../admin/src/composables/components/useSelectInputContext.ts
|
|
3124
|
+
var useSelectInputContext = (props, emit) => {
|
|
3125
|
+
return useInputWithOptionsContext(props, emit);
|
|
3126
|
+
};
|
|
3127
|
+
//#endregion
|
|
3128
|
+
//#region ../admin/src/composables/components/useShippingMethodsInputContext.ts
|
|
3129
|
+
var SHIPPING_METHOD_TYPES = Object.freeze([
|
|
3130
|
+
{
|
|
3131
|
+
label: "option_none",
|
|
3132
|
+
value: TriState.Off
|
|
3133
|
+
},
|
|
3134
|
+
{
|
|
3135
|
+
label: "option_inherit",
|
|
3136
|
+
value: TriState.Inherit
|
|
3137
|
+
},
|
|
3138
|
+
{
|
|
3139
|
+
label: PackageTypeName.Package,
|
|
3140
|
+
value: PackageTypeName.Package
|
|
3141
|
+
},
|
|
3142
|
+
{
|
|
3143
|
+
label: PackageTypeName.PackageSmall,
|
|
3144
|
+
value: PackageTypeName.PackageSmall
|
|
3145
|
+
},
|
|
3146
|
+
{
|
|
3147
|
+
label: PackageTypeName.Mailbox,
|
|
3148
|
+
value: PackageTypeName.Mailbox
|
|
3149
|
+
},
|
|
3150
|
+
{
|
|
3151
|
+
label: PackageTypeName.DigitalStamp,
|
|
3152
|
+
value: PackageTypeName.DigitalStamp
|
|
3153
|
+
},
|
|
3154
|
+
{
|
|
3155
|
+
label: PackageTypeName.Letter,
|
|
3156
|
+
value: PackageTypeName.Letter
|
|
3157
|
+
}
|
|
3158
|
+
]);
|
|
3159
|
+
var useShippingMethodsInputContext = (props, emit) => {
|
|
3160
|
+
const { options: shippingMethods } = useElementOptions(props);
|
|
3161
|
+
const model = useVModel(props, "modelValue", emit);
|
|
3162
|
+
const refs = reactive(shippingMethods.value.reduce((acc, shippingMethod) => {
|
|
3163
|
+
const shippingMethodId = shippingMethod.value.toString();
|
|
3164
|
+
const current = Object.entries(model.value).find(([, value]) => value.includes(shippingMethodId));
|
|
3165
|
+
return {
|
|
3166
|
+
...acc,
|
|
3167
|
+
[shippingMethodId]: current?.[0] ? Number(current[0]) || current[0] : TriState.Off
|
|
3168
|
+
};
|
|
3169
|
+
}, {}));
|
|
3170
|
+
onUnmounted(watch(refs, () => {
|
|
3171
|
+
const keys = SHIPPING_METHOD_TYPES.map(({ value }) => value).filter((type) => type !== TriState.Off);
|
|
3172
|
+
model.value = Object.entries(refs).filter(([, value]) => value !== TriState.Off).reduce((acc, [key, value]) => {
|
|
3173
|
+
acc[value] ??= [];
|
|
3174
|
+
acc[value].push(key);
|
|
3175
|
+
return acc;
|
|
3176
|
+
}, createObjectWithKeys(keys, () => []));
|
|
3177
|
+
}, {
|
|
3178
|
+
deep: true,
|
|
3179
|
+
immediate: true
|
|
3180
|
+
}));
|
|
3181
|
+
return {
|
|
3182
|
+
elements: reactive(shippingMethods.value.reduce((acc, shippingMethod) => {
|
|
3183
|
+
const shippingMethodId = shippingMethod.value.toString();
|
|
3184
|
+
return {
|
|
3185
|
+
...acc,
|
|
3186
|
+
[shippingMethodId]: SHIPPING_METHOD_TYPES.reduce((acc, option) => {
|
|
3187
|
+
const fieldName = `${props.element.name}__${shippingMethodId}__${option.value}`;
|
|
3188
|
+
const checkboxRef = computed({
|
|
3189
|
+
get: () => refs[shippingMethodId] === option.value,
|
|
3190
|
+
set: (checked) => {
|
|
3191
|
+
if (checked) refs[shippingMethodId] = option.value;
|
|
3192
|
+
else if (refs[shippingMethodId] === option.value) refs[shippingMethodId] = TriState.Off;
|
|
3193
|
+
}
|
|
3194
|
+
});
|
|
3195
|
+
return {
|
|
3196
|
+
...acc,
|
|
3197
|
+
[option.value]: toRaw(createFormElement({
|
|
3198
|
+
component: AdminComponent.CheckboxInput,
|
|
3199
|
+
ref: checkboxRef,
|
|
3200
|
+
name: fieldName,
|
|
3201
|
+
label: "",
|
|
3202
|
+
props: { value: option.value },
|
|
3203
|
+
attributes: { title: shippingMethod.label }
|
|
3204
|
+
}))
|
|
3205
|
+
};
|
|
3206
|
+
}, {})
|
|
3207
|
+
};
|
|
3208
|
+
}, {})),
|
|
3209
|
+
model,
|
|
3210
|
+
refs,
|
|
3211
|
+
shippingMethodTypes: SHIPPING_METHOD_TYPES,
|
|
3212
|
+
shippingMethods
|
|
3213
|
+
};
|
|
3214
|
+
};
|
|
3215
|
+
//#endregion
|
|
3216
|
+
//#region ../admin/src/composables/components/useTableContext.ts
|
|
3217
|
+
var useTableContext = (props) => {
|
|
3218
|
+
const config = useAdminConfig();
|
|
3219
|
+
return { transition: computed(() => {
|
|
3220
|
+
return props.transition === false ? void 0 : props.transition ?? config.transitions?.tableRow;
|
|
3221
|
+
}) };
|
|
3222
|
+
};
|
|
3223
|
+
//#endregion
|
|
3224
|
+
//#region ../admin/src/composables/components/useToggleInputContext.ts
|
|
3225
|
+
var useToggleInputContext = (props, emit) => {
|
|
3226
|
+
const toggleModel = ref(triStateToBoolean(toValue(props.modelValue)));
|
|
3227
|
+
const { id, model } = useElementContext(props, emit);
|
|
3228
|
+
watch(toggleModel, (toggle) => {
|
|
3229
|
+
model.value = booleanToTriState(toggle);
|
|
3230
|
+
});
|
|
3231
|
+
watch(model, (modelVal) => {
|
|
3232
|
+
toggleModel.value = triStateToBoolean(modelVal);
|
|
3233
|
+
});
|
|
3234
|
+
return {
|
|
3235
|
+
id,
|
|
3236
|
+
model,
|
|
3237
|
+
toggleId: `${id}__toggle`,
|
|
3238
|
+
toggleModel
|
|
3239
|
+
};
|
|
3240
|
+
};
|
|
3241
|
+
//#endregion
|
|
3242
|
+
//#region ../admin/src/composables/components/useTriStateInputContext.ts
|
|
3243
|
+
var useTriStateInputContext = (props, emit) => {
|
|
3244
|
+
const { translate } = useLanguage();
|
|
3245
|
+
const form = M();
|
|
3246
|
+
const inheritModel = ref(TriState.Inherit === toValue(props.modelValue));
|
|
3247
|
+
const toggleModel = ref(triStateToBoolean(toValue(props.modelValue)));
|
|
3248
|
+
const { id, model } = useElementContext(props, emit);
|
|
3249
|
+
const defaultValue = computed(() => {
|
|
3250
|
+
return props.element.props.defaultValue ?? TriState.Inherit;
|
|
3251
|
+
});
|
|
3252
|
+
const commonFieldProperties = Object.freeze({
|
|
3253
|
+
form,
|
|
3254
|
+
component: "input",
|
|
3255
|
+
wrapper: false,
|
|
3256
|
+
attributes: { hidden: true }
|
|
3257
|
+
});
|
|
3258
|
+
const inheritElement = reactive(Xe({
|
|
3259
|
+
...commonFieldProperties,
|
|
3260
|
+
ref: inheritModel,
|
|
3261
|
+
name: `${props.element.name}__inherit`,
|
|
3262
|
+
label: translate("settings_use_default_value")
|
|
3263
|
+
}));
|
|
3264
|
+
const toggleElement = reactive(Xe({
|
|
3265
|
+
...commonFieldProperties,
|
|
3266
|
+
name: `${props.element.name}__toggle`,
|
|
3267
|
+
ref: toggleModel,
|
|
3268
|
+
isReadOnly: markRaw(computed(() => toValue(inheritModel) || toValue(props.element.isReadOnly)))
|
|
3269
|
+
}));
|
|
3270
|
+
watch(toggleModel, (toggle) => {
|
|
3271
|
+
if (inheritModel.value) return;
|
|
3272
|
+
model.value = booleanToTriState(toggle);
|
|
3273
|
+
});
|
|
3274
|
+
watch([inheritModel, defaultValue], ([inherit, defaultValue], [oldInherit, oldDefaultValue]) => {
|
|
3275
|
+
if (inherit === oldInherit && defaultValue === oldDefaultValue) return;
|
|
3276
|
+
if (!inherit) {
|
|
3277
|
+
model.value = booleanToTriState(toggleModel.value);
|
|
3278
|
+
return;
|
|
3279
|
+
}
|
|
3280
|
+
model.value = TriState.Inherit;
|
|
3281
|
+
toggleModel.value = triStateToBoolean(defaultValue ?? TriState.Inherit);
|
|
3282
|
+
});
|
|
3283
|
+
watch(model, (modelVal) => {
|
|
3284
|
+
if (inheritModel.value) return;
|
|
3285
|
+
toggleModel.value = triStateToBoolean(modelVal);
|
|
3286
|
+
});
|
|
3287
|
+
return {
|
|
3288
|
+
id,
|
|
3289
|
+
inheritElement,
|
|
3290
|
+
inheritModel,
|
|
3291
|
+
model,
|
|
3292
|
+
toggleElement,
|
|
3293
|
+
toggleModel
|
|
3294
|
+
};
|
|
3295
|
+
};
|
|
3296
|
+
//#endregion
|
|
3297
|
+
//#region ../admin/src/composables/useGlobalPdkAdmin.ts
|
|
3298
|
+
var useGlobalPdkAdmin = () => {
|
|
3299
|
+
const pdkAdmin = inject(INJECT_GLOBAL_PDK_ADMIN);
|
|
3300
|
+
if (!pdkAdmin) throw new Error("PDK frontend not found. First use createPdkAdmin() to create the global instance.");
|
|
3301
|
+
return pdkAdmin;
|
|
3302
|
+
};
|
|
3303
|
+
//#endregion
|
|
3304
|
+
//#region ../admin/src/composables/useLoadMore.ts
|
|
3305
|
+
var useLoadMore = (options) => {
|
|
3306
|
+
const loaded = ref(options.start ?? options.step ?? toValue(options.items).length - 1);
|
|
3307
|
+
const hasMore = computed(() => loaded.value < toValue(options.items).length - 1);
|
|
3308
|
+
const loadMore = () => {
|
|
3309
|
+
if (!hasMore.value) return;
|
|
3310
|
+
const step = options.step ?? 1;
|
|
3311
|
+
const maxLength = toValue(options.items).length;
|
|
3312
|
+
if (loaded.value + step > maxLength) loaded.value = maxLength;
|
|
3313
|
+
else loaded.value += step;
|
|
3314
|
+
};
|
|
3315
|
+
return {
|
|
3316
|
+
items: computed(() => toValue(options.items).slice(0, loaded.value)),
|
|
3317
|
+
loaded,
|
|
3318
|
+
hasMore,
|
|
3319
|
+
loadMore
|
|
3320
|
+
};
|
|
3321
|
+
};
|
|
3322
|
+
//#endregion
|
|
3323
|
+
//#region ../admin/src/composables/useLogger.ts
|
|
3324
|
+
var useLogger = () => {
|
|
3325
|
+
return useAdminInstance().logger;
|
|
3326
|
+
};
|
|
3327
|
+
//#endregion
|
|
3328
|
+
//#region ../admin/src/services/context/getElementContext.ts
|
|
3329
|
+
var getElementContext = (selector) => {
|
|
3330
|
+
const element = document.querySelector(selector);
|
|
3331
|
+
const context = element?.getAttribute("data-pdk-context");
|
|
3332
|
+
const parsedContext = context ? JSON.parse(context) : null;
|
|
3333
|
+
if (parsedContext && Object.keys(parsedContext).length) {
|
|
3334
|
+
globalLogger.debug(`Found context in ${selector}`, parsedContext);
|
|
3335
|
+
element?.removeAttribute("data-pdk-context");
|
|
3336
|
+
return parsedContext;
|
|
3337
|
+
}
|
|
3338
|
+
globalLogger.info(`No context found in ${selector}`);
|
|
3339
|
+
return {};
|
|
3340
|
+
};
|
|
3341
|
+
//#endregion
|
|
3342
|
+
//#region ../admin/src/actions/composables/mutations/account/useDeleteAccountMutation.ts
|
|
3343
|
+
var useDeleteAccountMutation = () => {
|
|
3344
|
+
const queryClient = useQueryClient();
|
|
3345
|
+
return usePdkMutation(BackendEndpoint.DeleteAccount, async () => {
|
|
3346
|
+
return (await usePdkAdminApi().deleteAccount())[0];
|
|
3347
|
+
}, {
|
|
3348
|
+
...queryClient.defaultMutationOptions(),
|
|
3349
|
+
onSuccess(data) {
|
|
3350
|
+
queryClient.setQueryData([BackendEndpoint.FetchContext, AdminContextKey.Dynamic], data[AdminContextKey.Dynamic]);
|
|
3351
|
+
}
|
|
3352
|
+
});
|
|
3353
|
+
};
|
|
3354
|
+
//#endregion
|
|
3355
|
+
//#region ../admin/src/actions/composables/mutations/account/useUpdateAccountMutation.ts
|
|
3356
|
+
var useUpdateAccountMutation = () => {
|
|
3357
|
+
const queryClient = useQueryClient();
|
|
3358
|
+
const defaultMutationOptions = queryClient.defaultMutationOptions();
|
|
3359
|
+
const { translate } = useLanguage();
|
|
3360
|
+
return usePdkMutation(BackendEndpoint.UpdateAccount, async (input) => {
|
|
3361
|
+
return (await usePdkAdminApi().updateAccount({ body: formToBody(input?.form) }))[0];
|
|
3362
|
+
}, {
|
|
3363
|
+
...defaultMutationOptions,
|
|
3364
|
+
onSuccess(data) {
|
|
3365
|
+
queryClient.setQueryData([BackendEndpoint.FetchContext, AdminContextKey.Dynamic], data[AdminContextKey.Dynamic]);
|
|
3366
|
+
queryClient.setQueryData([BackendEndpoint.FetchContext, AdminContextKey.PluginSettingsView], data[AdminContextKey.PluginSettingsView]);
|
|
3367
|
+
},
|
|
3368
|
+
onError(error, variables, context) {
|
|
3369
|
+
if (!isOfType(error, "data")) defaultMutationOptions.onError?.(error, variables, context);
|
|
3370
|
+
const notificationStore = useNotificationStore();
|
|
3371
|
+
const translation = "error_invalid_api_key";
|
|
3372
|
+
notificationStore.add({
|
|
3373
|
+
category: NotificationCategory.General,
|
|
3374
|
+
content: translate(`${translation}_content`),
|
|
3375
|
+
title: translate(translation),
|
|
3376
|
+
timeout: false,
|
|
3377
|
+
variant: Variant.Error
|
|
3378
|
+
});
|
|
3379
|
+
}
|
|
3380
|
+
});
|
|
3381
|
+
};
|
|
3382
|
+
//#endregion
|
|
3383
|
+
//#region ../admin/src/actions/composables/mutations/debug/useDownloadLogsMutation.ts
|
|
3384
|
+
var useDownloadLogsMutation = () => {
|
|
3385
|
+
return usePdkMutation(BackendEndpoint.DownloadLogs, () => usePdkAdminApi().downloadLogs());
|
|
3386
|
+
};
|
|
3387
|
+
//#endregion
|
|
3388
|
+
//#region ../admin/src/actions/composables/mutations/debug/useSwitchToAcceptanceApiMutation.ts
|
|
3389
|
+
var useSwitchToAcceptanceApiMutation = () => {
|
|
3390
|
+
return usePdkMutation(BackendEndpoint.SwitchToAcceptanceApi, () => usePdkAdminApi().switchToAcceptanceApi());
|
|
3391
|
+
};
|
|
3392
|
+
//#endregion
|
|
3393
|
+
//#region ../admin/src/actions/composables/mutations/debug/useSwitchToProductionApiMutation.ts
|
|
3394
|
+
var useSwitchToProductionApiMutation = () => {
|
|
3395
|
+
return usePdkMutation(BackendEndpoint.SwitchToProductionApi, () => usePdkAdminApi().switchToProductionApi());
|
|
3396
|
+
};
|
|
3397
|
+
//#endregion
|
|
3398
|
+
//#region ../admin/src/actions/composables/mutations/settings/useUpdatePluginSettingsMutation.ts
|
|
3399
|
+
var useUpdatePluginSettingsMutation = () => {
|
|
3400
|
+
return usePdkMutation(BackendEndpoint.UpdatePluginSettings, ({ form }) => {
|
|
3401
|
+
return usePdkAdminApi().updatePluginSettings({ body: formToBody(form) });
|
|
3402
|
+
});
|
|
3403
|
+
};
|
|
3404
|
+
//#endregion
|
|
3405
|
+
//#region ../admin/src/actions/definitions/account.ts
|
|
3406
|
+
var updateAccountAction = defineAction({
|
|
3407
|
+
name: AdminAction.AccountUpdate,
|
|
3408
|
+
icon: AdminIcon.Save,
|
|
3409
|
+
label: "action_save",
|
|
3410
|
+
handler: createMutationHandler(BackendEndpoint.UpdateAccount),
|
|
3411
|
+
afterHandle(context) {
|
|
3412
|
+
if (!context.response?.[AdminContextKey.Dynamic]?.account) context.instance.logger.error("Account not found");
|
|
3413
|
+
return context.response;
|
|
3414
|
+
}
|
|
3415
|
+
});
|
|
3416
|
+
var refreshAccountAction = defineAction({
|
|
3417
|
+
...updateAccountAction,
|
|
3418
|
+
label: "action_update_account"
|
|
3419
|
+
});
|
|
3420
|
+
var deleteAccountAction = defineAction({
|
|
3421
|
+
name: AdminAction.AccountDelete,
|
|
3422
|
+
icon: AdminIcon.Delete,
|
|
3423
|
+
label: "action_delete",
|
|
3424
|
+
handler: createMutationHandler(BackendEndpoint.DeleteAccount)
|
|
3425
|
+
});
|
|
3426
|
+
//#endregion
|
|
3427
|
+
//#region ../admin/src/actions/definitions/context.ts
|
|
3428
|
+
var fetchDynamicContextAction = defineAction({
|
|
3429
|
+
name: AdminAction.ContextFetch,
|
|
3430
|
+
handler: createQueryHandler(BackendEndpoint.FetchContext, AdminContextKey.Dynamic)
|
|
3431
|
+
});
|
|
3432
|
+
var fetchPluginSettingsViewContextAction = defineAction({
|
|
3433
|
+
name: AdminAction.ContextFetch,
|
|
3434
|
+
handler: createQueryHandler(BackendEndpoint.FetchContext, AdminContextKey.PluginSettingsView)
|
|
3435
|
+
});
|
|
3436
|
+
//#endregion
|
|
3437
|
+
//#region ../admin/src/utils/downloadBlob.ts
|
|
3438
|
+
var downloadBlob = (blob, filename) => {
|
|
3439
|
+
const url = URL.createObjectURL(blob);
|
|
3440
|
+
downloadFileFromUrl(url, filename);
|
|
3441
|
+
URL.revokeObjectURL(url);
|
|
3442
|
+
};
|
|
3443
|
+
//#endregion
|
|
3444
|
+
//#region ../admin/src/actions/definitions/debug.ts
|
|
3445
|
+
var downloadLogsAction = defineAction({
|
|
3446
|
+
name: AdminAction.DownloadLogs,
|
|
3447
|
+
icon: AdminIcon.Download,
|
|
3448
|
+
label: "action_download_logs",
|
|
3449
|
+
handler: createMutationHandler(BackendEndpoint.DownloadLogs),
|
|
3450
|
+
afterHandle(response) {
|
|
3451
|
+
downloadBlob(response.response, "logs.zip");
|
|
3452
|
+
}
|
|
3453
|
+
});
|
|
3454
|
+
var switchToAcceptanceApiAction = defineAction({
|
|
3455
|
+
name: AdminAction.SwitchToAcceptanceApi,
|
|
3456
|
+
icon: AdminIcon.Refresh,
|
|
3457
|
+
label: "action_switch_to_acceptance_api",
|
|
3458
|
+
handler: createMutationHandler(BackendEndpoint.SwitchToAcceptanceApi)
|
|
3459
|
+
});
|
|
3460
|
+
var switchToProductionApiAction = defineAction({
|
|
3461
|
+
name: AdminAction.SwitchToProductionApi,
|
|
3462
|
+
icon: AdminIcon.Refresh,
|
|
3463
|
+
label: "action_switch_to_production_api",
|
|
3464
|
+
handler: createMutationHandler(BackendEndpoint.SwitchToProductionApi)
|
|
3465
|
+
});
|
|
3466
|
+
//#endregion
|
|
3467
|
+
//#region ../admin/src/actions/definitions/settings.ts
|
|
3468
|
+
var pluginSettingsUpdateAction = defineAction({
|
|
3469
|
+
name: AdminAction.PluginSettingsUpdate,
|
|
3470
|
+
icon: AdminIcon.Save,
|
|
3471
|
+
label: "action_save",
|
|
3472
|
+
handler: createMutationHandler(BackendEndpoint.UpdatePluginSettings)
|
|
3473
|
+
});
|
|
3474
|
+
//#endregion
|
|
3475
|
+
//#region ../admin/src/views/ChildProductSettings.vue?vue&type=script&setup=true&lang.ts
|
|
3476
|
+
var ChildProductSettings_vue_vue_type_script_setup_true_lang_default = /*#__PURE__*/ defineComponent({
|
|
3477
|
+
__name: "ChildProductSettings",
|
|
3478
|
+
setup(__props) {
|
|
3479
|
+
const productId = useInstanceContext(AdminInstanceContextKey.ProductIdentifier);
|
|
3480
|
+
return (_ctx, _cache) => {
|
|
3481
|
+
return openBlock(), createBlock(ProductSettings_default, {
|
|
3482
|
+
"form-key": unref(FORM_KEY_CHILD_PRODUCT_SETTINGS),
|
|
3483
|
+
"form-name": `${unref(FORM_KEY_CHILD_PRODUCT_SETTINGS)}--${unref(productId)}`
|
|
3484
|
+
}, null, 8, ["form-key", "form-name"]);
|
|
3485
|
+
};
|
|
3486
|
+
}
|
|
3487
|
+
});
|
|
3488
|
+
//#endregion
|
|
3489
|
+
//#region ../admin/src/views/ChildProductSettings.vue
|
|
3490
|
+
var ChildProductSettings_exports = /* @__PURE__ */ __exportAll({ default: () => ChildProductSettings_default });
|
|
3491
|
+
var ChildProductSettings_default = ChildProductSettings_vue_vue_type_script_setup_true_lang_default;
|
|
3492
|
+
//#endregion
|
|
3493
|
+
//#region ../admin/src/components/modals/ShipmentOptionsModal.vue
|
|
3494
|
+
var ShipmentOptionsModal_default = /* @__PURE__ */ defineComponent({
|
|
3495
|
+
__name: "ShipmentOptionsModal",
|
|
3496
|
+
setup(__props) {
|
|
3497
|
+
const ShipmentOptionsModalForm = defineAsyncComponent(() => import("./ShipmentOptionsModalForm-Eq6TGCE1.js"));
|
|
3498
|
+
const orderMode = useOrderMode();
|
|
3499
|
+
const ordersData = computed(() => useOrdersData());
|
|
3500
|
+
const orderIds = computed(() => toValue(ordersData).map((data) => toValue(data.order)?.externalIdentifier));
|
|
3501
|
+
const actions = computed(() => {
|
|
3502
|
+
const disabled = toValue(ordersData).some((data) => toValue(data.query.isLoading));
|
|
3503
|
+
return instantiateActions([
|
|
3504
|
+
modalCloseAction,
|
|
3505
|
+
ordersUpdateAction,
|
|
3506
|
+
...MODAL_MODE_ACTIONS[orderMode.value]
|
|
3507
|
+
], { disabled });
|
|
3508
|
+
});
|
|
3509
|
+
return (_ctx, _cache) => {
|
|
3510
|
+
const _component_PdkModal = resolveComponent("PdkModal");
|
|
3511
|
+
return openBlock(), createBlock(_component_PdkModal, {
|
|
3512
|
+
actions: actions.value,
|
|
3513
|
+
"modal-key": unref(AdminModalKey).ShipmentOptions,
|
|
3514
|
+
title: "shipment_options_title"
|
|
3515
|
+
}, {
|
|
3516
|
+
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(unref(ShipmentOptionsModalForm)), mergeProps({ key: JSON.stringify(orderIds.value) }, { order: orderIds.value }), null, 16))]),
|
|
3517
|
+
_: 1
|
|
3518
|
+
}, 8, ["actions", "modal-key"]);
|
|
3519
|
+
};
|
|
3520
|
+
}
|
|
3521
|
+
});
|
|
3522
|
+
//#endregion
|
|
3523
|
+
//#region ../admin/src/components/modals/PrintOptionsModal.vue
|
|
3524
|
+
var PrintOptionsModal_default = /* @__PURE__ */ defineComponent({
|
|
3525
|
+
__name: "PrintOptionsModal",
|
|
3526
|
+
setup(__props) {
|
|
3527
|
+
const modalKey = AdminModalKey.PrintOptions;
|
|
3528
|
+
const PrintOptionsModalForm = defineAsyncComponent(() => import("./PrintOptionsModalForm-BIGhMvHF.js"));
|
|
3529
|
+
useActionStore().register(modalSubmitFormAction);
|
|
3530
|
+
const actions = instantiateActions([modalCloseAction, modalSubmitFormAction]);
|
|
3531
|
+
return (_ctx, _cache) => {
|
|
3532
|
+
const _component_PdkModal = resolveComponent("PdkModal");
|
|
3533
|
+
return openBlock(), createBlock(_component_PdkModal, {
|
|
3534
|
+
actions: unref(actions),
|
|
3535
|
+
"modal-key": unref(modalKey),
|
|
3536
|
+
title: "print_options_title"
|
|
3537
|
+
}, {
|
|
3538
|
+
default: withCtx(() => [createVNode(unref(PrintOptionsModalForm))]),
|
|
3539
|
+
_: 1
|
|
3540
|
+
}, 8, ["actions", "modal-key"]);
|
|
3541
|
+
};
|
|
3542
|
+
}
|
|
3543
|
+
});
|
|
3544
|
+
//#endregion
|
|
3545
|
+
//#region ../admin/src/views/Modals.vue?vue&type=script&setup=true&lang.ts
|
|
3546
|
+
var Modals_vue_vue_type_script_setup_true_lang_default = /*#__PURE__*/ defineComponent({
|
|
3547
|
+
__name: "Modals",
|
|
3548
|
+
setup(__props) {
|
|
3549
|
+
useQueryStore().registerContextQueries();
|
|
3550
|
+
useActionStore().registerModalActions();
|
|
3551
|
+
const pluginSettings = usePluginSettings();
|
|
3552
|
+
return (_ctx, _cache) => {
|
|
3553
|
+
return openBlock(), createElementBlock("div", null, [(openBlock(), createBlock(KeepAlive, null, [unref(pluginSettings).label.prompt ? (openBlock(), createBlock(PrintOptionsModal_default, { key: 0 })) : createCommentVNode("", true)], 1024)), createVNode(ShipmentOptionsModal_default)]);
|
|
3554
|
+
};
|
|
3555
|
+
}
|
|
3556
|
+
});
|
|
3557
|
+
//#endregion
|
|
3558
|
+
//#region ../admin/src/views/Modals.vue
|
|
3559
|
+
var Modals_exports = /* @__PURE__ */ __exportAll({ default: () => Modals_default });
|
|
3560
|
+
var Modals_default = Modals_vue_vue_type_script_setup_true_lang_default;
|
|
3561
|
+
//#endregion
|
|
3562
|
+
//#region ../admin/src/views/Notifications.vue?vue&type=script&setup=true&lang.ts
|
|
3563
|
+
var Notifications_vue_vue_type_script_setup_true_lang_default = /*#__PURE__*/ defineComponent({
|
|
3564
|
+
__name: "Notifications",
|
|
3565
|
+
setup(__props) {
|
|
3566
|
+
return (_ctx, _cache) => {
|
|
3567
|
+
return openBlock(), createBlock(unref(NotificationContainer_default), { category: unref(NotificationCategory).General }, null, 8, ["category"]);
|
|
3568
|
+
};
|
|
3569
|
+
}
|
|
3570
|
+
});
|
|
3571
|
+
//#endregion
|
|
3572
|
+
//#region ../admin/src/views/Notifications.vue
|
|
3573
|
+
var Notifications_exports = /* @__PURE__ */ __exportAll({ default: () => Notifications_default });
|
|
3574
|
+
var Notifications_default = Notifications_vue_vue_type_script_setup_true_lang_default;
|
|
3575
|
+
//#endregion
|
|
3576
|
+
//#region ../admin/src/components/OrderBox/ShipmentOptionsBox.vue
|
|
3577
|
+
var ShipmentOptionsBox_default = /* @__PURE__ */ defineComponent({
|
|
3578
|
+
__name: "ShipmentOptionsBox",
|
|
3579
|
+
setup(__props) {
|
|
3580
|
+
const { order: data, loading } = useOrderData();
|
|
3581
|
+
const { translate } = useLanguage();
|
|
3582
|
+
const orderMode = useOrderMode();
|
|
3583
|
+
const isExported = computed(() => orderMode.value === OrderMode.OrderV1 && toValue(data)?.exported);
|
|
3584
|
+
const actions = computed(() => {
|
|
3585
|
+
if (isExported.value) return instantiateActions(orderViewInBackofficeAction);
|
|
3586
|
+
return instantiateActions([ordersUpdateAction, ...BOX_MODE_ACTIONS[orderMode.value]], { orderIds: toValue(data)?.externalIdentifier });
|
|
3587
|
+
});
|
|
3588
|
+
return (_ctx, _cache) => {
|
|
3589
|
+
const _component_PdkIcon = resolveComponent("PdkIcon");
|
|
3590
|
+
const _component_PdkCol = resolveComponent("PdkCol");
|
|
3591
|
+
const _component_PdkRow = resolveComponent("PdkRow");
|
|
3592
|
+
const _component_PdkConceptBoxWrapper = resolveComponent("PdkConceptBoxWrapper");
|
|
3593
|
+
return openBlock(), createBlock(_component_PdkConceptBoxWrapper, {
|
|
3594
|
+
actions: actions.value,
|
|
3595
|
+
loading: unref(loading)
|
|
3596
|
+
}, {
|
|
3597
|
+
header: withCtx(() => [createVNode(_component_PdkIcon, { icon: unref(AdminIcon).Shipment }, null, 8, ["icon"]), createBaseVNode("span", null, toDisplayString(unref(translate)("shipment_options_title")) + " #" + toDisplayString(unref(data)?.externalIdentifier), 1)]),
|
|
3598
|
+
default: withCtx(() => [createVNode(_component_PdkRow, null, {
|
|
3599
|
+
default: withCtx(() => [createVNode(_component_PdkCol, null, {
|
|
3600
|
+
default: withCtx(() => [isExported.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(unref(translate)("notification_order_exported")), 1)], 64)) : (openBlock(), createBlock(unref(ShipmentOptionsForm_default), {
|
|
3601
|
+
key: 1,
|
|
3602
|
+
order: unref(data)?.externalIdentifier
|
|
3603
|
+
}, null, 8, ["order"]))]),
|
|
3604
|
+
_: 1
|
|
3605
|
+
})]),
|
|
3606
|
+
_: 1
|
|
3607
|
+
}), createVNode(_component_PdkRow, null, {
|
|
3608
|
+
default: withCtx(() => [createVNode(_component_PdkCol, null, {
|
|
3609
|
+
default: withCtx(() => [createVNode(unref(NotificationContainer_default), { category: unref(NotificationCategory).Action }, null, 8, ["category"])]),
|
|
3610
|
+
_: 1
|
|
3611
|
+
})]),
|
|
3612
|
+
_: 1
|
|
3613
|
+
})]),
|
|
3614
|
+
_: 1
|
|
3615
|
+
}, 8, ["actions", "loading"]);
|
|
3616
|
+
};
|
|
3617
|
+
}
|
|
3618
|
+
});
|
|
3619
|
+
//#endregion
|
|
3620
|
+
//#region ../admin/src/views/OrderBox.vue?vue&type=script&setup=true&lang.ts
|
|
3621
|
+
var OrderBox_vue_vue_type_script_setup_true_lang_default = /*#__PURE__*/ defineComponent({
|
|
3622
|
+
__name: "OrderBox",
|
|
3623
|
+
setup(__props) {
|
|
3624
|
+
const ShipmentTableBox = defineAsyncComponent(() => import("./ShipmentTableBox-BLkFhAGr.js"));
|
|
3625
|
+
const queryStore = useQueryStore();
|
|
3626
|
+
queryStore.registerContextQueries();
|
|
3627
|
+
queryStore.registerOrderQueries();
|
|
3628
|
+
useActionStore().registerOrderActions();
|
|
3629
|
+
const orderMode = useOrderMode();
|
|
3630
|
+
const { query } = useOrderData();
|
|
3631
|
+
const data = computed(() => toValue(query.data));
|
|
3632
|
+
return (_ctx, _cache) => {
|
|
3633
|
+
return openBlock(), createElementBlock(Fragment, null, [createVNode(ShipmentOptionsBox_default), unref(orderMode) !== unref(OrderMode).OrderV1 && data.value?.shipments.some((item) => !item.deleted) ? (openBlock(), createBlock(unref(ShipmentTableBox), { key: 0 })) : createCommentVNode("", true)], 64);
|
|
3634
|
+
};
|
|
3635
|
+
}
|
|
3636
|
+
});
|
|
3637
|
+
//#endregion
|
|
3638
|
+
//#region ../admin/src/views/OrderBox.vue
|
|
3639
|
+
var OrderBox_exports = /* @__PURE__ */ __exportAll({ default: () => OrderBox_default });
|
|
3640
|
+
var OrderBox_default = OrderBox_vue_vue_type_script_setup_true_lang_default;
|
|
3641
|
+
//#endregion
|
|
3642
|
+
//#region ../admin/src/views/integrated/OrderBoxView.vue
|
|
3643
|
+
var OrderBoxView_default = /* @__PURE__ */ defineComponent({
|
|
3644
|
+
__name: "OrderBoxView",
|
|
3645
|
+
props: { orderIdentifier: {
|
|
3646
|
+
type: String,
|
|
3647
|
+
required: true
|
|
3648
|
+
} },
|
|
3649
|
+
setup(__props) {
|
|
3650
|
+
extendAdminInstance({ context: { orderIdentifier: toRefs(__props).orderIdentifier?.value } });
|
|
3651
|
+
return (_ctx, _cache) => {
|
|
3652
|
+
return openBlock(), createBlock(OrderBox_default);
|
|
3653
|
+
};
|
|
3654
|
+
}
|
|
3655
|
+
});
|
|
3656
|
+
//#endregion
|
|
3657
|
+
//#region ../admin/src/views/OrderListItem.vue?vue&type=script&setup=true&lang.ts
|
|
3658
|
+
var _hoisted_1$3 = { key: 0 };
|
|
3659
|
+
var OrderListItem_vue_vue_type_script_setup_true_lang_default = /*#__PURE__*/ defineComponent({
|
|
3660
|
+
__name: "OrderListItem",
|
|
3661
|
+
setup(__props) {
|
|
3662
|
+
const OrderModeOrderListItem = defineAsyncComponent(() => {
|
|
3663
|
+
return import("./OrderModeOrderListItem-lkgBZYlb.js");
|
|
3664
|
+
});
|
|
3665
|
+
const ShipmentModeOrderListItem = defineAsyncComponent(() => {
|
|
3666
|
+
return import("./ShipmentModeOrderListItem-C0gSveq1.js");
|
|
3667
|
+
});
|
|
3668
|
+
const queryStore = useQueryStore();
|
|
3669
|
+
queryStore.registerContextQueries();
|
|
3670
|
+
queryStore.registerOrderQueries();
|
|
3671
|
+
useActionStore().registerOrderActions();
|
|
3672
|
+
const orderMode = useOrderMode();
|
|
3673
|
+
const { query } = useOrderData();
|
|
3674
|
+
const notificationFilter = (notification) => {
|
|
3675
|
+
return notificationBelongsToOrder(notification, toValue(query.data)?.externalIdentifier);
|
|
3676
|
+
};
|
|
3677
|
+
return (_ctx, _cache) => {
|
|
3678
|
+
return openBlock(), createElementBlock(Fragment, null, [!unref(query).isLoading ? (openBlock(), createElementBlock("div", _hoisted_1$3, [unref(orderMode) === unref(OrderMode).OrderV1 || unref(orderMode) === unref(OrderMode).OrderV2 ? (openBlock(), createBlock(unref(OrderModeOrderListItem), { key: 0 })) : unref(orderMode) === unref(OrderMode).Shipments ? (openBlock(), createBlock(unref(ShipmentModeOrderListItem), { key: 1 })) : createCommentVNode("", true)])) : createCommentVNode("", true), createVNode(unref(NotificationContainer_default), {
|
|
3679
|
+
category: unref(NotificationCategory).Action,
|
|
3680
|
+
filter: notificationFilter
|
|
3681
|
+
}, null, 8, ["category"])], 64);
|
|
3682
|
+
};
|
|
3683
|
+
}
|
|
3684
|
+
});
|
|
3685
|
+
//#endregion
|
|
3686
|
+
//#region ../admin/src/views/OrderListItem.vue
|
|
3687
|
+
var OrderListItem_exports = /* @__PURE__ */ __exportAll({ default: () => OrderListItem_default });
|
|
3688
|
+
var OrderListItem_default = OrderListItem_vue_vue_type_script_setup_true_lang_default;
|
|
3689
|
+
//#endregion
|
|
3690
|
+
//#region ../admin/src/views/integrated/OrderListItemView.vue
|
|
3691
|
+
var OrderListItemView_default = /* @__PURE__ */ defineComponent({
|
|
3692
|
+
__name: "OrderListItemView",
|
|
3693
|
+
props: { orderIdentifier: {
|
|
3694
|
+
type: String,
|
|
3695
|
+
required: true
|
|
3696
|
+
} },
|
|
3697
|
+
setup(__props) {
|
|
3698
|
+
extendAdminInstance({ context: { orderIdentifier: toRefs(__props).orderIdentifier?.value } });
|
|
3699
|
+
return (_ctx, _cache) => {
|
|
3700
|
+
return openBlock(), createBlock(OrderListItem_default);
|
|
3701
|
+
};
|
|
3702
|
+
}
|
|
3703
|
+
});
|
|
3704
|
+
//#endregion
|
|
3705
|
+
//#region ../admin/src/components/PluginSettings/PluginSettingsForms.vue
|
|
3706
|
+
var PluginSettingsForms_default = /* @__PURE__ */ defineComponent({
|
|
3707
|
+
__name: "PluginSettingsForms",
|
|
3708
|
+
setup(__props) {
|
|
3709
|
+
const config = useAdminConfig();
|
|
3710
|
+
const orderMode = useOrderMode();
|
|
3711
|
+
const dynamicContextQuery = useStoreContextQuery();
|
|
3712
|
+
const pluginSettingsContextQuery = useStoreContextQuery(AdminContextKey.PluginSettingsView);
|
|
3713
|
+
const tabs = ref([]);
|
|
3714
|
+
const actionContext = createActionContext(pluginSettingsUpdateAction);
|
|
3715
|
+
const loading = computed(() => dynamicContextQuery.isLoading || pluginSettingsContextQuery.isLoading);
|
|
3716
|
+
watch(() => pluginSettingsContextQuery.dataUpdatedAt, () => {
|
|
3717
|
+
if (toValue(loading)) return;
|
|
3718
|
+
const rawPluginSettingsView = toValue(pluginSettingsContextQuery.data);
|
|
3719
|
+
const dynamicContext = toValue(dynamicContextQuery.data);
|
|
3720
|
+
if (!rawPluginSettingsView || !dynamicContext?.pluginSettings) {
|
|
3721
|
+
tabs.value = [];
|
|
3722
|
+
return;
|
|
3723
|
+
}
|
|
3724
|
+
const pluginSettingsView = filterPluginSettingsView(rawPluginSettingsView, orderMode.value);
|
|
3725
|
+
tabs.value = createPluginSettingsTabs(pluginSettingsView, {
|
|
3726
|
+
pluginSettings: dynamicContext.pluginSettings,
|
|
3727
|
+
actionContext,
|
|
3728
|
+
config
|
|
3729
|
+
});
|
|
3730
|
+
}, { immediate: true });
|
|
3731
|
+
return (_ctx, _cache) => {
|
|
3732
|
+
const _component_PdkLoader = resolveComponent("PdkLoader");
|
|
3733
|
+
return openBlock(), createElementBlock("div", null, [withDirectives(createVNode(_component_PdkLoader, null, null, 512), [[vShow, loading.value]]), withDirectives(createBaseVNode("div", null, [createVNode(unref(TabNavigation_default), { tabs: tabs.value }, null, 8, ["tabs"])], 512), [[vShow, !loading.value]])]);
|
|
3734
|
+
};
|
|
3735
|
+
}
|
|
3736
|
+
});
|
|
3737
|
+
//#endregion
|
|
3738
|
+
//#region ../admin/src/components/PluginSettings/WebhooksStatus.vue?vue&type=script&setup=true&lang.ts
|
|
3739
|
+
var _hoisted_1$2 = { key: 0 };
|
|
3740
|
+
var _hoisted_2$1 = ["textContent"];
|
|
3741
|
+
//#endregion
|
|
3742
|
+
//#region ../admin/src/components/PluginSettings/WebhooksStatus.vue
|
|
3743
|
+
var WebhooksStatus_default = /* @__PURE__ */ defineComponent({
|
|
3744
|
+
__name: "WebhooksStatus",
|
|
3745
|
+
setup(__props) {
|
|
3746
|
+
const { fetchWebhooks, createWebhooks, deleteWebhooks } = useQueryStore().registerWebhookQueries();
|
|
3747
|
+
useActionStore().registerWebhookActions();
|
|
3748
|
+
const data = computed(() => toValue(fetchWebhooks.data) ?? []);
|
|
3749
|
+
const webhooks = computed(() => {
|
|
3750
|
+
return data.value.map((webhook) => {
|
|
3751
|
+
let status = Status.Pending;
|
|
3752
|
+
if (!toValue(fetchWebhooks.isLoading) && !toValue(createWebhooks.isLoading) && !toValue(deleteWebhooks.isLoading)) status = webhook.connected ? Status.Success : Status.Error;
|
|
3753
|
+
return {
|
|
3754
|
+
...webhook,
|
|
3755
|
+
status
|
|
3756
|
+
};
|
|
3757
|
+
});
|
|
3758
|
+
});
|
|
3759
|
+
const webhookActions = computed(() => {
|
|
3760
|
+
const actions = [];
|
|
3761
|
+
const [connected, disconnected] = partitionArray(data.value, (webhook) => webhook.connected);
|
|
3762
|
+
if (disconnected.length) actions.push(instantiateAction(webhooksCreateAction, { hooks: disconnected.map(({ hook }) => hook) }));
|
|
3763
|
+
if (connected.length) actions.push(instantiateAction(webhooksDeleteAction, { hooks: connected.map(({ hook }) => hook) }));
|
|
3764
|
+
return actions;
|
|
3765
|
+
});
|
|
3766
|
+
const { translate } = useLanguage();
|
|
3767
|
+
return (_ctx, _cache) => {
|
|
3768
|
+
const _component_PdkHeading = resolveComponent("PdkHeading");
|
|
3769
|
+
const _component_PdkButtonGroup = resolveComponent("PdkButtonGroup");
|
|
3770
|
+
const _component_PdkLoader = resolveComponent("PdkLoader");
|
|
3771
|
+
return openBlock(), createElementBlock("div", null, [
|
|
3772
|
+
createVNode(_component_PdkHeading, { level: "2" }, {
|
|
3773
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("settings_webhook_title")), 1)]),
|
|
3774
|
+
_: 1
|
|
3775
|
+
}),
|
|
3776
|
+
createVNode(_component_PdkButtonGroup, null, {
|
|
3777
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(webhookActions.value, (action) => {
|
|
3778
|
+
return openBlock(), createBlock(unref(ActionButton_default), {
|
|
3779
|
+
key: action.id,
|
|
3780
|
+
action
|
|
3781
|
+
}, null, 8, ["action"]);
|
|
3782
|
+
}), 128))]),
|
|
3783
|
+
_: 1
|
|
3784
|
+
}),
|
|
3785
|
+
webhooks.value.length ? (openBlock(), createElementBlock("ul", _hoisted_1$2, [(openBlock(true), createElementBlock(Fragment, null, renderList(webhooks.value, (webhook) => {
|
|
3786
|
+
return openBlock(), createElementBlock("li", { key: webhook.hook }, [createVNode(unref(StatusIndicator_default), { status: webhook.status }, {
|
|
3787
|
+
default: withCtx(() => [createBaseVNode("code", { textContent: toDisplayString(webhook.hook) }, null, 8, _hoisted_2$1)]),
|
|
3788
|
+
_: 2
|
|
3789
|
+
}, 1032, ["status"])]);
|
|
3790
|
+
}), 128))])) : (openBlock(), createBlock(_component_PdkLoader, { key: 1 }))
|
|
3791
|
+
]);
|
|
3792
|
+
};
|
|
3793
|
+
}
|
|
3794
|
+
});
|
|
3795
|
+
//#endregion
|
|
3796
|
+
//#region ../admin/src/components/PluginSettings/EditApiKeyForm.vue?vue&type=script&setup=true&lang.ts
|
|
3797
|
+
var FIELD_API_KEY = "apiKey";
|
|
3798
|
+
var API_KEY_LABEL = "settings_account_api_key";
|
|
3799
|
+
//#endregion
|
|
3800
|
+
//#region ../admin/src/components/PluginSettings/EditApiKeyForm.vue
|
|
3801
|
+
var EditApiKeyForm_default = /* @__PURE__ */ defineComponent({
|
|
3802
|
+
__name: "EditApiKeyForm",
|
|
3803
|
+
emits: ["afterSubmit"],
|
|
3804
|
+
setup(__props) {
|
|
3805
|
+
const createForm = () => {
|
|
3806
|
+
const actionStore = useActionStore();
|
|
3807
|
+
const config = useAdminConfig();
|
|
3808
|
+
const pluginSettings = usePluginSettings();
|
|
3809
|
+
const apiKeyRef = ref(pluginSettings.account.apiKey);
|
|
3810
|
+
return Ne(FORM_KEY_ACCOUNT_SETTINGS, {
|
|
3811
|
+
...config.formConfigOverrides?.[FORM_KEY_ACCOUNT_SETTINGS],
|
|
3812
|
+
fields: [
|
|
3813
|
+
defineFormField({
|
|
3814
|
+
component: resolveFormComponent(AdminComponent.TextInput),
|
|
3815
|
+
label: API_KEY_LABEL,
|
|
3816
|
+
name: FIELD_API_KEY,
|
|
3817
|
+
optional: true,
|
|
3818
|
+
ref: apiKeyRef,
|
|
3819
|
+
readOnlyWhen: () => Boolean(hasAccount.value)
|
|
3820
|
+
}),
|
|
3821
|
+
Xe({
|
|
3822
|
+
name: "submitButton",
|
|
3823
|
+
component: SubmitButton_default,
|
|
3824
|
+
visibleWhen: () => !hasAccount.value,
|
|
3825
|
+
readOnlyWhen: () => !apiKeyRef.value
|
|
3826
|
+
}),
|
|
3827
|
+
Xe({
|
|
3828
|
+
name: "resetButton",
|
|
3829
|
+
component: ResetButton_default,
|
|
3830
|
+
attributes: {
|
|
3831
|
+
label: "action_delete",
|
|
3832
|
+
variant: Variant.Error,
|
|
3833
|
+
size: Size.Small
|
|
3834
|
+
},
|
|
3835
|
+
visibleWhen: () => Boolean(hasAccount.value),
|
|
3836
|
+
readOnlyWhen: () => !apiKeyRef.value
|
|
3837
|
+
})
|
|
3838
|
+
],
|
|
3839
|
+
[c.AfterSubmit]: async (form) => {
|
|
3840
|
+
await actionStore.dispatch(AdminAction.AccountUpdate, { form });
|
|
3841
|
+
},
|
|
3842
|
+
[c.AfterReset]: async () => {
|
|
3843
|
+
await actionStore.dispatch(AdminAction.AccountDelete);
|
|
3844
|
+
}
|
|
3845
|
+
});
|
|
3846
|
+
};
|
|
3847
|
+
const contextQuery = useStoreContextQuery();
|
|
3848
|
+
const form = ref();
|
|
3849
|
+
const hasAccount = computed(() => Boolean(toValue(contextQuery.data)?.account));
|
|
3850
|
+
watch(contextQuery.data, () => {
|
|
3851
|
+
form.value = markRaw(createForm());
|
|
3852
|
+
}, { immediate: true });
|
|
3853
|
+
return (_ctx, _cache) => {
|
|
3854
|
+
return openBlock(), createElementBlock("div", null, [createVNode(unref(xe), {
|
|
3855
|
+
form: form.value,
|
|
3856
|
+
onAfterSubmit: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("afterSubmit", $event))
|
|
3857
|
+
}, null, 8, ["form"]), createVNode(unref(NotificationContainer_default), { category: unref(NotificationCategory).Api }, null, 8, ["category"])]);
|
|
3858
|
+
};
|
|
3859
|
+
}
|
|
3860
|
+
});
|
|
3861
|
+
//#endregion
|
|
3862
|
+
//#region ../admin/src/components/PluginSettings/DebugOptions.vue?vue&type=script&setup=true&lang.ts
|
|
3863
|
+
var _hoisted_1$1 = ["textContent"];
|
|
3864
|
+
var _hoisted_2 = ["textContent"];
|
|
3865
|
+
var _hoisted_3 = { class: "debug-hidden" };
|
|
3866
|
+
var _hoisted_4 = ["textContent"];
|
|
3867
|
+
//#endregion
|
|
3868
|
+
//#region ../admin/src/components/PluginSettings/DebugOptions.vue
|
|
3869
|
+
var DebugOptions_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
3870
|
+
__name: "DebugOptions",
|
|
3871
|
+
setup(__props) {
|
|
3872
|
+
const { translate } = useLanguage();
|
|
3873
|
+
const queryStore = useQueryStore();
|
|
3874
|
+
const actionStore = useActionStore();
|
|
3875
|
+
const contextQuery = useStoreContextQuery();
|
|
3876
|
+
queryStore.register(BackendEndpoint.DownloadLogs, useDownloadLogsMutation());
|
|
3877
|
+
queryStore.register(BackendEndpoint.SwitchToAcceptanceApi, useSwitchToAcceptanceApiMutation());
|
|
3878
|
+
queryStore.register(BackendEndpoint.SwitchToProductionApi, useSwitchToProductionApiMutation());
|
|
3879
|
+
actionStore.register([
|
|
3880
|
+
updateAccountAction,
|
|
3881
|
+
downloadLogsAction,
|
|
3882
|
+
switchToAcceptanceApiAction,
|
|
3883
|
+
switchToProductionApiAction,
|
|
3884
|
+
refreshAccountAction
|
|
3885
|
+
]);
|
|
3886
|
+
const refreshAccountInstance = instantiateAction(refreshAccountAction);
|
|
3887
|
+
const downloadLogsInstance = instantiateAction(downloadLogsAction);
|
|
3888
|
+
const switchToAcceptanceApiInstance = instantiateAction(switchToAcceptanceApiAction);
|
|
3889
|
+
const switchToProductionApiInstance = instantiateAction(switchToProductionApiAction);
|
|
3890
|
+
const isConnectedToAcceptance = computed(() => {
|
|
3891
|
+
return toValue(contextQuery.data)?.pluginSettings?.account?.environment === "acceptance";
|
|
3892
|
+
});
|
|
3893
|
+
const switchButtonDescription = computed(() => {
|
|
3894
|
+
return isConnectedToAcceptance.value ? translate("debug_switch_to_production_api_description") : translate("debug_switch_to_acceptance_api_description");
|
|
3895
|
+
});
|
|
3896
|
+
return (_ctx, _cache) => {
|
|
3897
|
+
const _component_PdkHeading = resolveComponent("PdkHeading");
|
|
3898
|
+
return openBlock(), createElementBlock("div", null, [
|
|
3899
|
+
createVNode(_component_PdkHeading, { level: "2" }, {
|
|
3900
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("settings_debug_title")), 1)]),
|
|
3901
|
+
_: 1
|
|
3902
|
+
}),
|
|
3903
|
+
createBaseVNode("div", null, [createBaseVNode("p", { textContent: toDisplayString(unref(translate)("debug_refresh_description")) }, null, 8, _hoisted_1$1), createVNode(unref(ActionButton_default), { action: unref(refreshAccountInstance) }, null, 8, ["action"])]),
|
|
3904
|
+
createBaseVNode("div", null, [createBaseVNode("p", { textContent: toDisplayString(unref(translate)("debug_download_logs_description")) }, null, 8, _hoisted_2), createVNode(unref(ActionButton_default), { action: unref(downloadLogsInstance) }, null, 8, ["action"])]),
|
|
3905
|
+
createBaseVNode("div", _hoisted_3, [createBaseVNode("p", { textContent: toDisplayString(switchButtonDescription.value) }, null, 8, _hoisted_4), isConnectedToAcceptance.value ? (openBlock(), createBlock(unref(ActionButton_default), {
|
|
3906
|
+
key: 0,
|
|
3907
|
+
action: unref(switchToProductionApiInstance)
|
|
3908
|
+
}, null, 8, ["action"])) : (openBlock(), createBlock(unref(ActionButton_default), {
|
|
3909
|
+
key: 1,
|
|
3910
|
+
action: unref(switchToAcceptanceApiInstance)
|
|
3911
|
+
}, null, 8, ["action"]))])
|
|
3912
|
+
]);
|
|
3913
|
+
};
|
|
3914
|
+
}
|
|
3915
|
+
}), [["__scopeId", "data-v-9a3c93d5"]]);
|
|
3916
|
+
//#endregion
|
|
3917
|
+
//#region ../admin/src/components/PluginSettings/AccountSettings.vue?vue&type=script&setup=true&lang.ts
|
|
3918
|
+
var _hoisted_1 = { key: 0 };
|
|
3919
|
+
//#endregion
|
|
3920
|
+
//#region ../admin/src/components/PluginSettings/AccountSettings.vue
|
|
3921
|
+
var AccountSettings_default = /* @__PURE__ */ defineComponent({
|
|
3922
|
+
__name: "AccountSettings",
|
|
3923
|
+
setup(__props) {
|
|
3924
|
+
useActionStore().register([updateAccountAction, deleteAccountAction]);
|
|
3925
|
+
const contextQuery = useStoreContextQuery();
|
|
3926
|
+
const updateAccount = useUpdateAccountMutation();
|
|
3927
|
+
const deleteAccount = useDeleteAccountMutation();
|
|
3928
|
+
const loading = computed(() => toValue(contextQuery.isLoading) || toValue(updateAccount.isLoading)) || toValue(deleteAccount.isLoading);
|
|
3929
|
+
const hasApiKey = computed(() => Boolean(toValue(contextQuery.data)?.pluginSettings.account.apiKey));
|
|
3930
|
+
const hasAccount = computed(() => !toValue(loading) && hasApiKey.value && Boolean(toValue(contextQuery.data)?.account));
|
|
3931
|
+
const { translate } = useLanguage();
|
|
3932
|
+
const tabs = computed(() => {
|
|
3933
|
+
const array = [{
|
|
3934
|
+
name: "apiKey",
|
|
3935
|
+
component: EditApiKeyForm_default,
|
|
3936
|
+
label: "button_api_key_edit"
|
|
3937
|
+
}];
|
|
3938
|
+
if (toValue(hasAccount)) array.push({
|
|
3939
|
+
name: "webhooks",
|
|
3940
|
+
component: WebhooksStatus_default,
|
|
3941
|
+
label: "button_webhooks_edit"
|
|
3942
|
+
});
|
|
3943
|
+
array.push({
|
|
3944
|
+
name: "debug",
|
|
3945
|
+
component: DebugOptions_default,
|
|
3946
|
+
label: "button_debug"
|
|
3947
|
+
});
|
|
3948
|
+
return array;
|
|
3949
|
+
});
|
|
3950
|
+
return (_ctx, _cache) => {
|
|
3951
|
+
const _component_PdkBox = resolveComponent("PdkBox");
|
|
3952
|
+
return openBlock(), createBlock(_component_PdkBox, { loading: unref(loading) }, {
|
|
3953
|
+
default: withCtx(() => [hasAccount.value ? (openBlock(), createElementBlock("p", _hoisted_1, [createVNode(unref(StatusIndicator_default), { status: unref(Status).Success }, null, 8, ["status"]), createTextVNode("\xA0" + toDisplayString(unref(translate)("notification_account_connected")), 1)])) : createCommentVNode("", true), createVNode(unref(TabNavigation_default), {
|
|
3954
|
+
button: unref(prefixComponent)(unref(AdminComponent).Button),
|
|
3955
|
+
"button-wrapper": unref(prefixComponent)(unref(AdminComponent).ButtonGroup),
|
|
3956
|
+
closeable: hasAccount.value,
|
|
3957
|
+
"initial-tab": !hasAccount.value,
|
|
3958
|
+
tabs: tabs.value
|
|
3959
|
+
}, null, 8, [
|
|
3960
|
+
"button",
|
|
3961
|
+
"button-wrapper",
|
|
3962
|
+
"closeable",
|
|
3963
|
+
"initial-tab",
|
|
3964
|
+
"tabs"
|
|
3965
|
+
])]),
|
|
3966
|
+
_: 1
|
|
3967
|
+
}, 8, ["loading"]);
|
|
3968
|
+
};
|
|
3969
|
+
}
|
|
3970
|
+
});
|
|
3971
|
+
//#endregion
|
|
3972
|
+
//#region ../admin/src/views/PluginSettings.vue?vue&type=script&setup=true&lang.ts
|
|
3973
|
+
var PluginSettings_vue_vue_type_script_setup_true_lang_default = /*#__PURE__*/ defineComponent({
|
|
3974
|
+
__name: "PluginSettings",
|
|
3975
|
+
setup(__props) {
|
|
3976
|
+
const queryStore = useQueryStore();
|
|
3977
|
+
queryStore.registerContextQueries(AdminContextKey.PluginSettingsView);
|
|
3978
|
+
queryStore.register(BackendEndpoint.DeleteAccount, useDeleteAccountMutation());
|
|
3979
|
+
queryStore.register(BackendEndpoint.UpdateAccount, useUpdateAccountMutation());
|
|
3980
|
+
queryStore.register(BackendEndpoint.UpdatePluginSettings, useUpdatePluginSettingsMutation());
|
|
3981
|
+
useActionStore().register([
|
|
3982
|
+
pluginSettingsUpdateAction,
|
|
3983
|
+
fetchPluginSettingsViewContextAction,
|
|
3984
|
+
fetchDynamicContextAction
|
|
3985
|
+
]);
|
|
3986
|
+
const dynamicContextQuery = useStoreContextQuery();
|
|
3987
|
+
const hasAccount = computed(() => Boolean(toValue(dynamicContextQuery.data)?.account));
|
|
3988
|
+
return (_ctx, _cache) => {
|
|
3989
|
+
const _component_PdkPluginSettingsWrapper = resolveComponent("PdkPluginSettingsWrapper");
|
|
3990
|
+
return openBlock(), createBlock(_component_PdkPluginSettingsWrapper, null, {
|
|
3991
|
+
default: withCtx(() => [createVNode(AccountSettings_default), hasAccount.value ? (openBlock(), createBlock(PluginSettingsForms_default, { key: 0 })) : createCommentVNode("", true)]),
|
|
3992
|
+
_: 1
|
|
3993
|
+
});
|
|
3994
|
+
};
|
|
3995
|
+
}
|
|
3996
|
+
});
|
|
3997
|
+
//#endregion
|
|
3998
|
+
//#region ../admin/src/views/PluginSettings.vue
|
|
3999
|
+
var PluginSettings_exports = /* @__PURE__ */ __exportAll({ default: () => PluginSettings_default });
|
|
4000
|
+
var PluginSettings_default = PluginSettings_vue_vue_type_script_setup_true_lang_default;
|
|
4001
|
+
//#endregion
|
|
4002
|
+
export { ActionButton_default as ActionButton, AdminAction, AdminComponent, AdminContextKey, AdminIcon, AdminInstanceContextKey, AdminModalKey, AdminView, BOX_MODE_ACTIONS, BackendEndpoint, BulkSelectCheckbox_default as BulkSelectCheckbox, ChildProductSettings_default as ChildProductSettingsView, FORM_KEYS, FORM_KEY_ACCOUNT_SETTINGS, FORM_KEY_CHILD_PRODUCT_SETTINGS, FORM_KEY_MODAL, FORM_KEY_MODAL_PRINT_OPTIONS, FORM_KEY_MODAL_RETURN_OPTIONS, FORM_KEY_MODAL_SHIPMENT_OPTIONS, FORM_KEY_PLUGIN_SETTINGS, FORM_KEY_PRODUCT_SETTINGS, c as FormHook, FrontendEndpoint, INJECT_ADMIN_INSTANCE, INJECT_GLOBAL_PDK_ADMIN, LIST_ITEM_MODE_ACTIONS, LogLevel, MODAL_MODE_ACTIONS, Modals_default as ModalsView, NotificationCategory, NotificationContainer_default as NotificationContainer, Notifications_default as NotificationsView, ORDER_VIEW_IN_BACKOFFICE_ID, OrderBoxView_default as OrderBoxView, OrderListItemView_default as OrderListItemView, OrderMode, PackageType_default as PackageType, PdkAdmin, PlainElement_default as PlainElement, PluginSettings_default as PluginSettingsView, ProductSettings_default as ProductSettingsView, QUERY_KEY_ORDER, QUERY_KEY_SHIPMENT, ResetButton_default as ResetButton, ReturnsForm_default as ReturnsForm, STORE_MODE_ACTIONS, ShipmentBarcode_default as ShipmentBarcode, ShipmentOptionsForm_default as ShipmentOptionsForm, ShipmentStatus_default as ShipmentStatus, Size, SortType, Status, StatusIndicator_default as StatusIndicator, StopActionHandler, SubmitButton_default as SubmitButton, TabNavigation_default as TabNavigation, TriState, Variant, allAdminComponentNames, createAdminConfig, createFormElement, createHandlerWithParameters, createLogger, createMutationHandler, createOrdersMutationHandler, createPdkAdmin, createPdkAdminPlugin, createQueryHandler, createShipmentsMutationHandler, defineAction, deleteAccountAction, doMutate, downloadLogsAction, executeAction, executeAfterHandle, executeBeforeHandle, executeHandler, executeNextAction, fetchDynamicContextAction, fetchPluginSettingsViewContextAction, generateFieldId, getActionIdentifier, modalCloseAction, modalSubmitFormAction, openOrPrintPdf, optionalAdminActionContainerComponentNames, optionalAdminComponentNames, optionalAdminPlainWrapperComponentNames, orderExportAction, orderExportToShipmentsAction, orderViewInBackofficeAction, ordersEditAction, ordersExportPrintShipmentsAction, ordersFetchAction, ordersPrintAction, ordersUpdateAction, pluginSettingsUpdateAction, prefixComponent, refreshAccountAction, requiredAdminComponentNames, resolveFormComponent, resolveOrderParameters, resolvePrintParameters, resolveQuerySuffix, shipmentActions, shipmentsDeleteAction, shipmentsExportReturnAction, shipmentsPrintAction, shipmentsUpdateAction, switchToAcceptanceApiAction, switchToProductionApiAction, updateAccountAction, useActionStore, useAdminConfig, useAppInfo, useCheckboxGroupContext, useCreateWebhooksMutation, useDeleteAccountMutation, useDeleteShipmentsMutation, useDeleteWebhooksMutation, useDownloadLogsMutation, useDropOffInputContext, useDropdownButtonContext, useDropdownButtonContext as useDropdownData, Je as useElement, useElementContext, useElementOptions, useExportOrdersMutation, useExportReturnMutation, useFetchContextQuery, useFetchOrdersQuery, useFetchProductsQuery, useFetchShipmentsQuery, useFetchWebhooksQuery, M as useForm, ne as useFormBuilder, useFormatter, useGlobalContext, useGlobalPdkAdmin, useInputWithOptionsContext, useLanguage, useLoadMore, useLogger, useModalContext, useModalElementContext, useModalStore, useMultiSelectInputContext, useNotificationStore, useOrderData, useOrderMode, useOrdersData, usePdkMutation, usePrintOrdersMutation, usePrintShipmentsMutation, useProductData, useQueryStore, useRadioGroupContext, useSelectInputContext, useShippingMethodsInputContext, useStoreQuery, useSwitchToAcceptanceApiMutation, useSwitchToProductionApiMutation, useTableContext, useToggleInputContext, useTriStateInputContext, useUpdateAccountMutation, useUpdateOrdersMutation, useUpdatePluginSettingsMutation, useUpdateProductSettingsMutation, useUpdateShipmentsMutation, useWeekdays, waitForLabelPrompt, webhooksCreateAction, webhooksDeleteAction, webhooksFetchAction };
|