@myparcel-dev/pdk-admin-js 1.14.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/ChildProductSettings-s8z5afQ0.js +4 -0
  3. package/dist/Modals-WFWEKC20.js +4 -0
  4. package/dist/Notifications-mywk4f35.js +4 -0
  5. package/dist/OrderBox-CQNS7zO9.js +4 -0
  6. package/dist/OrderListItem-DH0iYnG8.js +4 -0
  7. package/dist/{OrderModeOrderListItem-DdktQjCM.js → OrderModeOrderListItem-CnEBPTEC.js} +20 -15
  8. package/dist/PluginSettings-ymxANIm1.js +4 -0
  9. package/dist/{PrintOptionsModalForm-f7Ze8uNa.js → PrintOptionsModalForm-BUGvrOwt.js} +1 -1
  10. package/dist/ProductSettings-CEHnUs2T.js +4 -0
  11. package/dist/{ShipmentLabel.vue_vue_type_script_setup_true_lang-jyif6XLw.js → ShipmentLabel.vue_vue_type_script_setup_true_lang-CmhEHRaP.js} +2 -2
  12. package/dist/{ShipmentModeOrderListItem-Ca1M2iy0.js → ShipmentModeOrderListItem-BVzk32iG.js} +2 -2
  13. package/dist/{ShipmentOptionsModalForm-ME-oncii.js → ShipmentOptionsModalForm-INoRc2Gs.js} +1 -1
  14. package/dist/{ShipmentTableBox-C0q9qBg1.js → ShipmentTableBox-CzmZ6Xt4.js} +1 -1
  15. package/dist/{index-CIMyA-y2.js → index-BfK2d6Yu.js} +1231 -631
  16. package/dist/index.js +164 -157
  17. package/package.json +2 -2
  18. package/src/__tests__/__snapshots__/exports.spec.ts.snap +8 -1
  19. package/tsconfig.base.json +3 -0
  20. package/dist/ChildProductSettings-rOdhioOc.js +0 -4
  21. package/dist/Modals-C8V_zTNK.js +0 -4
  22. package/dist/Notifications-Bax2ygnw.js +0 -4
  23. package/dist/OrderBox-B901YmGC.js +0 -4
  24. package/dist/OrderListItem-CvN_Uz7u.js +0 -4
  25. package/dist/PluginSettings-FphY6rec.js +0 -4
  26. package/dist/ProductSettings-COt7oF2i.js +0 -4
@@ -26,7 +26,7 @@ class Subscribable {
26
26
  }
27
27
  }
28
28
  const isServer = typeof window === "undefined" || "Deno" in window;
29
- function noop$1() {
29
+ function noop$2() {
30
30
  return void 0;
31
31
  }
32
32
  function functionalUpdate(updater, input) {
@@ -634,7 +634,7 @@ class Query extends Removable {
634
634
  var _this$retryer;
635
635
  const promise = this.promise;
636
636
  (_this$retryer = this.retryer) == null ? void 0 : _this$retryer.cancel(options);
637
- return promise ? promise.then(noop$1).catch(noop$1) : Promise.resolve();
637
+ return promise ? promise.then(noop$2).catch(noop$2) : Promise.resolve();
638
638
  }
639
639
  destroy() {
640
640
  super.destroy();
@@ -1359,7 +1359,7 @@ let MutationCache$1 = class MutationCache extends Subscribable {
1359
1359
  var _this$resuming;
1360
1360
  this.resuming = ((_this$resuming = this.resuming) != null ? _this$resuming : Promise.resolve()).then(() => {
1361
1361
  const pausedMutations = this.mutations.filter((x3) => x3.state.isPaused);
1362
- return notifyManager.batch(() => pausedMutations.reduce((promise, mutation) => promise.then(() => mutation.continue().catch(noop$1)), Promise.resolve()));
1362
+ return notifyManager.batch(() => pausedMutations.reduce((promise, mutation) => promise.then(() => mutation.continue().catch(noop$2)), Promise.resolve()));
1363
1363
  }).then(() => {
1364
1364
  this.resuming = void 0;
1365
1365
  });
@@ -1604,7 +1604,7 @@ let QueryClient$1 = class QueryClient {
1604
1604
  cancelOptions.revert = true;
1605
1605
  }
1606
1606
  const promises = notifyManager.batch(() => this.queryCache.findAll(filters).map((query) => query.cancel(cancelOptions)));
1607
- return Promise.all(promises).then(noop$1).catch(noop$1);
1607
+ return Promise.all(promises).then(noop$2).catch(noop$2);
1608
1608
  }
1609
1609
  /**
1610
1610
  * @deprecated This method should be used with only one object argument.
@@ -1641,9 +1641,9 @@ let QueryClient$1 = class QueryClient {
1641
1641
  }
1642
1642
  });
1643
1643
  }));
1644
- let promise = Promise.all(promises).then(noop$1);
1644
+ let promise = Promise.all(promises).then(noop$2);
1645
1645
  if (!(options != null && options.throwOnError)) {
1646
- promise = promise.catch(noop$1);
1646
+ promise = promise.catch(noop$2);
1647
1647
  }
1648
1648
  return promise;
1649
1649
  }
@@ -1663,7 +1663,7 @@ let QueryClient$1 = class QueryClient {
1663
1663
  * @deprecated This method should be used with only one object argument.
1664
1664
  */
1665
1665
  prefetchQuery(arg1, arg2, arg3) {
1666
- return this.fetchQuery(arg1, arg2, arg3).then(noop$1).catch(noop$1);
1666
+ return this.fetchQuery(arg1, arg2, arg3).then(noop$2).catch(noop$2);
1667
1667
  }
1668
1668
  /**
1669
1669
  * @deprecated This method should be used with only one object argument.
@@ -1677,7 +1677,7 @@ let QueryClient$1 = class QueryClient {
1677
1677
  * @deprecated This method should be used with only one object argument.
1678
1678
  */
1679
1679
  prefetchInfiniteQuery(arg1, arg2, arg3) {
1680
- return this.fetchInfiniteQuery(arg1, arg2, arg3).then(noop$1).catch(noop$1);
1680
+ return this.fetchInfiniteQuery(arg1, arg2, arg3).then(noop$2).catch(noop$2);
1681
1681
  }
1682
1682
  resumePausedMutations() {
1683
1683
  return this.mutationCache.resumePausedMutations();
@@ -1920,7 +1920,7 @@ class QueryObserver extends Subscribable {
1920
1920
  this.updateQuery();
1921
1921
  let promise = this.currentQuery.fetch(this.options, fetchOptions);
1922
1922
  if (!(fetchOptions != null && fetchOptions.throwOnError)) {
1923
- promise = promise.catch(noop$1);
1923
+ promise = promise.catch(noop$2);
1924
1924
  }
1925
1925
  return promise;
1926
1926
  }
@@ -3701,7 +3701,7 @@ function triggerRef(ref2) {
3701
3701
  function unref(ref2) {
3702
3702
  return isRef(ref2) ? ref2.value : ref2;
3703
3703
  }
3704
- function toValue(source) {
3704
+ function toValue$1(source) {
3705
3705
  return isFunction$1(source) ? source() : unref(source);
3706
3706
  }
3707
3707
  const shallowUnwrapHandlers = {
@@ -13696,7 +13696,7 @@ const he = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
13696
13696
  toRaw,
13697
13697
  toRef,
13698
13698
  toRefs,
13699
- toValue,
13699
+ toValue: toValue$1,
13700
13700
  transformVNodeArgs,
13701
13701
  triggerRef,
13702
13702
  unref,
@@ -15221,12 +15221,14 @@ var BackendEndpoint = /* @__PURE__ */ ((BackendEndpoint2) => {
15221
15221
  BackendEndpoint2["DownloadLogs"] = "downloadLogs";
15222
15222
  BackendEndpoint2["SwitchToAcceptanceApi"] = "switchToAcceptanceApi";
15223
15223
  BackendEndpoint2["SwitchToProductionApi"] = "switchToProductionApi";
15224
+ BackendEndpoint2["ProxyCapabilities"] = "proxyCapabilities";
15224
15225
  return BackendEndpoint2;
15225
15226
  })(BackendEndpoint || {});
15226
15227
  var FrontendEndpoint = /* @__PURE__ */ ((FrontendEndpoint2) => {
15227
15228
  FrontendEndpoint2["FetchCheckoutContext"] = "fetchCheckoutContext";
15228
15229
  FrontendEndpoint2["ProxyAddressesList"] = "proxyAddressList";
15229
15230
  FrontendEndpoint2["ProxyAddressValidate"] = "proxyAddressValidate";
15231
+ FrontendEndpoint2["ProxyCapabilities"] = "proxyCapabilities";
15230
15232
  return FrontendEndpoint2;
15231
15233
  })(FrontendEndpoint || {});
15232
15234
  var T = Object.defineProperty;
@@ -15268,8 +15270,8 @@ const _ = (s, t) => {
15268
15270
  r.length && (s += `?${r.join("&")}`);
15269
15271
  }
15270
15272
  return s;
15271
- }, C = "https://api.myparcel.nl", A = ["POST", "PUT"];
15272
- class k {
15273
+ }, C = "https://api.myparcel.nl", E$1 = ["POST", "PUT"];
15274
+ class A {
15273
15275
  constructor(t) {
15274
15276
  e(this, "interceptors");
15275
15277
  e(this, "baseUrl");
@@ -15302,7 +15304,7 @@ class k {
15302
15304
  return this.getResponseBody(t, i);
15303
15305
  }
15304
15306
  getResponseBody(t, r) {
15305
- if (!u(r, "data"))
15307
+ if (!t.getUseDataEnvelope() || !u(r, "data"))
15306
15308
  return r;
15307
15309
  const a = t.getResponseProperty();
15308
15310
  if (!a)
@@ -15384,7 +15386,7 @@ class k {
15384
15386
  ...t.getParameters()
15385
15387
  },
15386
15388
  headers: {
15387
- ...A.includes(t.method) ? { "Content-Type": "application/json" } : {},
15389
+ ...E$1.includes(t.method) ? { "Content-Type": "application/json" } : {},
15388
15390
  ...this.getHeaders(),
15389
15391
  ...r.headers,
15390
15392
  ...t.getHeaders()
@@ -15394,23 +15396,23 @@ class k {
15394
15396
  const i = t.getProperty();
15395
15397
  if (r.body instanceof FormData)
15396
15398
  return a.body = r.body, delete a.headers["Content-Type"], a;
15397
- i === void 0 ? a.body = {
15399
+ t.getUseDataEnvelope() ? i === void 0 ? a.body = {
15398
15400
  data: r.body
15399
15401
  } : a.body = {
15400
15402
  data: { [i]: r.body }
15401
- };
15403
+ } : a.body = r.body;
15402
15404
  }
15403
15405
  return a;
15404
15406
  }
15405
15407
  }
15406
- const w = (s) => {
15408
+ const k = (s) => {
15407
15409
  try {
15408
15410
  return JSON.parse(s), true;
15409
15411
  } catch {
15410
15412
  return false;
15411
15413
  }
15412
15414
  };
15413
- class H extends k {
15415
+ class H extends A {
15414
15416
  constructor(r) {
15415
15417
  super(r);
15416
15418
  e(this, "request", async (r2, a) => {
@@ -15432,7 +15434,7 @@ class H extends k {
15432
15434
  if ((b = c2.headers.get("Content-Disposition")) != null && b.includes("attachment") || (g = c2.headers.get("Content-Type")) != null && g.includes("application/pdf"))
15433
15435
  return c2.blob();
15434
15436
  const l = await c2.text();
15435
- return (S = c2.headers.get("Content-Type")) != null && S.includes("application/json") && w(l) ? JSON.parse(l) : l;
15437
+ return (S = c2.headers.get("Content-Type")) != null && S.includes("application/json") && k(l) ? JSON.parse(l) : l;
15436
15438
  }
15437
15439
  } finally {
15438
15440
  d && clearTimeout(d);
@@ -15446,6 +15448,7 @@ let x$1 = class x {
15446
15448
  e(this, "property");
15447
15449
  e(this, "responseProperty");
15448
15450
  e(this, "timeout");
15451
+ e(this, "useDataEnvelope", true);
15449
15452
  e(this, "headers");
15450
15453
  e(this, "parameters");
15451
15454
  this.headers = (t == null ? void 0 : t.headers) ?? {}, this.parameters = (t == null ? void 0 : t.parameters) ?? {};
@@ -15468,6 +15471,9 @@ let x$1 = class x {
15468
15471
  getTimeout() {
15469
15472
  return this.timeout;
15470
15473
  }
15474
+ getUseDataEnvelope() {
15475
+ return this.useDataEnvelope;
15476
+ }
15471
15477
  };
15472
15478
  class m extends x$1 {
15473
15479
  }
@@ -15522,44 +15528,6 @@ var toArray = (itemOrItems, separator) => {
15522
15528
  }
15523
15529
  return Array.isArray(itemOrItems) ? itemOrItems : [itemOrItems];
15524
15530
  };
15525
- var CarrierName = /* @__PURE__ */ ((CarrierName3) => {
15526
- CarrierName3["PostNl"] = "postnl";
15527
- CarrierName3["Bpost"] = "bpost";
15528
- CarrierName3["CheapCargo"] = "cheapcargo";
15529
- CarrierName3["Dpd"] = "dpd";
15530
- CarrierName3["Instabox"] = "instabox";
15531
- CarrierName3["Dhl"] = "dhl";
15532
- CarrierName3["Bol"] = "bol.com";
15533
- CarrierName3["BolCom"] = "bol.com";
15534
- CarrierName3["Ups"] = "ups";
15535
- CarrierName3["DhlForYou"] = "dhlforyou";
15536
- CarrierName3["DhlParcelConnect"] = "dhlparcelconnect";
15537
- CarrierName3["DhlEuroPlus"] = "dhleuroplus";
15538
- CarrierName3["UpsStandard"] = "upsstandard";
15539
- CarrierName3["UpsExpressSaver"] = "upsexpresssaver";
15540
- CarrierName3["Gls"] = "gls";
15541
- CarrierName3["Brt"] = "brt";
15542
- CarrierName3["Trunkrs"] = "trunkrs";
15543
- CarrierName3["InPost"] = "inpost";
15544
- return CarrierName3;
15545
- })(CarrierName || {});
15546
- var DeliveryTypeName = /* @__PURE__ */ ((DeliveryTypeName3) => {
15547
- DeliveryTypeName3["Morning"] = "morning";
15548
- DeliveryTypeName3["Standard"] = "standard";
15549
- DeliveryTypeName3["Evening"] = "evening";
15550
- DeliveryTypeName3["Pickup"] = "pickup";
15551
- DeliveryTypeName3["Express"] = "express";
15552
- return DeliveryTypeName3;
15553
- })(DeliveryTypeName || {});
15554
- var PackageTypeName = /* @__PURE__ */ ((PackageTypeName2) => {
15555
- PackageTypeName2["Package"] = "package";
15556
- PackageTypeName2["Mailbox"] = "mailbox";
15557
- PackageTypeName2["Letter"] = "letter";
15558
- PackageTypeName2["DigitalStamp"] = "digital_stamp";
15559
- PackageTypeName2["Pallet"] = "pallet";
15560
- PackageTypeName2["PackageSmall"] = "package_small";
15561
- return PackageTypeName2;
15562
- })(PackageTypeName || {});
15563
15531
  function createGlobalState(stateFactory) {
15564
15532
  let initialized2 = false;
15565
15533
  let state;
@@ -15575,8 +15543,76 @@ function createGlobalState(stateFactory) {
15575
15543
  function isDefined(v) {
15576
15544
  return unref(v) != null;
15577
15545
  }
15546
+ function toValue(r) {
15547
+ return typeof r === "function" ? r() : unref(r);
15548
+ }
15578
15549
  typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
15579
15550
  const isDef = (val) => typeof val !== "undefined";
15551
+ const noop$1 = () => {
15552
+ };
15553
+ function createFilterWrapper(filter, fn) {
15554
+ function wrapper(...args) {
15555
+ return new Promise((resolve2, reject) => {
15556
+ Promise.resolve(filter(() => fn.apply(this, args), { fn, thisArg: this, args })).then(resolve2).catch(reject);
15557
+ });
15558
+ }
15559
+ return wrapper;
15560
+ }
15561
+ function debounceFilter(ms, options = {}) {
15562
+ let timer;
15563
+ let maxTimer;
15564
+ let lastRejector = noop$1;
15565
+ const _clearTimeout = (timer2) => {
15566
+ clearTimeout(timer2);
15567
+ lastRejector();
15568
+ lastRejector = noop$1;
15569
+ };
15570
+ const filter = (invoke) => {
15571
+ const duration = toValue(ms);
15572
+ const maxDuration = toValue(options.maxWait);
15573
+ if (timer)
15574
+ _clearTimeout(timer);
15575
+ if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
15576
+ if (maxTimer) {
15577
+ _clearTimeout(maxTimer);
15578
+ maxTimer = null;
15579
+ }
15580
+ return Promise.resolve(invoke());
15581
+ }
15582
+ return new Promise((resolve2, reject) => {
15583
+ lastRejector = options.rejectOnCancel ? reject : resolve2;
15584
+ if (maxDuration && !maxTimer) {
15585
+ maxTimer = setTimeout(() => {
15586
+ if (timer)
15587
+ _clearTimeout(timer);
15588
+ maxTimer = null;
15589
+ resolve2(invoke());
15590
+ }, maxDuration);
15591
+ }
15592
+ timer = setTimeout(() => {
15593
+ if (maxTimer)
15594
+ _clearTimeout(maxTimer);
15595
+ maxTimer = null;
15596
+ resolve2(invoke());
15597
+ }, duration);
15598
+ });
15599
+ };
15600
+ return filter;
15601
+ }
15602
+ function useDebounceFn(fn, ms = 200, options = {}) {
15603
+ return createFilterWrapper(
15604
+ debounceFilter(ms, options),
15605
+ fn
15606
+ );
15607
+ }
15608
+ function refDebounced(value, ms = 200, options = {}) {
15609
+ const debounced = ref(value.value);
15610
+ const updater = useDebounceFn(() => {
15611
+ debounced.value = value.value;
15612
+ }, ms, options);
15613
+ watch(value, () => updater());
15614
+ return debounced;
15615
+ }
15580
15616
  function cloneFnJSON(source) {
15581
15617
  return JSON.parse(JSON.stringify(source));
15582
15618
  }
@@ -15870,6 +15906,35 @@ const BACKEND_ENDPOINTS_SHIPMENTS = [
15870
15906
  BackendEndpoint.SwitchToAcceptanceApi,
15871
15907
  BackendEndpoint.SwitchToProductionApi
15872
15908
  ];
15909
+ var OrderMode = /* @__PURE__ */ ((OrderMode2) => {
15910
+ OrderMode2["Shipments"] = "Shipments";
15911
+ OrderMode2["OrderV1"] = "OrderV1";
15912
+ OrderMode2["OrderV2"] = "OrderV2";
15913
+ return OrderMode2;
15914
+ })(OrderMode || {});
15915
+ const ORDER_MODE_BY_NUMERIC = {
15916
+ 0: "Shipments",
15917
+ 1: "OrderV1",
15918
+ 2: "OrderV2"
15919
+ /* OrderV2 */
15920
+ };
15921
+ const orderModeFromContextValue = (value) => {
15922
+ if (typeof value === "number" && value in ORDER_MODE_BY_NUMERIC) {
15923
+ return ORDER_MODE_BY_NUMERIC[value];
15924
+ }
15925
+ return void 0;
15926
+ };
15927
+ const resolveOrderMode = (features) => {
15928
+ if (features.includes(
15929
+ "ORDER_MANAGEMENT"
15930
+ /* OrderManagement */
15931
+ )) return "OrderV2";
15932
+ if (features.includes(
15933
+ "LEGACY_ORDER_MANAGEMENT"
15934
+ /* LegacyOrderManagement */
15935
+ )) return "OrderV1";
15936
+ return "Shipments";
15937
+ };
15873
15938
  var AdminView = /* @__PURE__ */ ((AdminView2) => {
15874
15939
  AdminView2["ChildProductSettings"] = "ChildProductSettings";
15875
15940
  AdminView2["Modals"] = "Modals";
@@ -16091,7 +16156,7 @@ const ee = Object.freeze(Object.values(c)), x2 = [
16091
16156
  const t = ref(false), e2 = M();
16092
16157
  if (!e2)
16093
16158
  throw new Error("Form not found");
16094
- const r = computed(() => toValue(e2.fields).filter((a) => !a.teleportSelector)), i = computed(() => toValue(e2.fields).filter((a) => !!a.teleportSelector));
16159
+ const r = computed(() => toValue$1(e2.fields).filter((a) => !a.teleportSelector)), i = computed(() => toValue$1(e2.fields).filter((a) => !!a.teleportSelector));
16095
16160
  return (a, u2) => (openBlock(), createElementBlock(Fragment, null, [
16096
16161
  unref(e2) ? (openBlock(), createBlock(Suspense, {
16097
16162
  key: 0,
@@ -16143,7 +16208,7 @@ const He = /* @__PURE__ */ Pe(_e, [["render", Be]]), xe = /* @__PURE__ */ define
16143
16208
  setup(s, { emit: t }) {
16144
16209
  const e2 = ref(null), r = s, i = t, u2 = toRefs(r).form.value;
16145
16210
  return onMounted(() => {
16146
- const l = toValue(e2);
16211
+ const l = toValue$1(e2);
16147
16212
  l && (r.form.element = l);
16148
16213
  }), provide(re, u2), ee.forEach((l) => {
16149
16214
  r.form.on(l, (d) => {
@@ -16209,7 +16274,7 @@ class oe {
16209
16274
  const r = this.hooks.getAvailableHooks();
16210
16275
  if (Object.keys(e2).filter((i) => !r.includes(i)).forEach((i) => {
16211
16276
  this[i] = e2[i];
16212
- }), this.props = reactive(e2.props ?? {}), this.attributes = reactive(e2.attributes ?? {}), this.config = e2, this.form = t, this.name = e2.name, this.wrapper = e2.wrapper ?? true, this.setVisible(e2.visible ?? true), this.formattedErrors = computed(() => toValue(this.errors).map((i) => typeof i == "function" ? i() : i)), "visibleWhen" in e2 && $(() => this.config.visibleWhen(this), this.isVisible), typeof e2.component == "string") {
16277
+ }), this.props = reactive(e2.props ?? {}), this.attributes = reactive(e2.attributes ?? {}), this.config = e2, this.form = t, this.name = e2.name, this.wrapper = e2.wrapper ?? true, this.setVisible(e2.visible ?? true), this.formattedErrors = computed(() => toValue$1(this.errors).map((i) => typeof i == "function" ? i() : i)), "visibleWhen" in e2 && $(() => this.config.visibleWhen(this), this.isVisible), typeof e2.component == "string") {
16213
16278
  this.component = e2.component;
16214
16279
  return;
16215
16280
  }
@@ -16245,7 +16310,7 @@ class Ie extends oe {
16245
16310
  n(this, "validators", ref([]));
16246
16311
  n(this, "initialValue");
16247
16312
  n(this, "blur", async () => {
16248
- await this.hooks.execute("beforeBlur", this, toValue(this.ref)), this.isSuspended.value = true, this.ref.value = await this.hooks.execute("sanitize", this, toValue(this.ref)) ?? toValue(this.ref), toValue(this.isDirty) && await this.validate(), this.isTouched.value = true, this.isSuspended.value = false, await this.hooks.execute("afterBlur", this, toValue(this.ref));
16313
+ await this.hooks.execute("beforeBlur", this, toValue$1(this.ref)), this.isSuspended.value = true, this.ref.value = await this.hooks.execute("sanitize", this, toValue$1(this.ref)) ?? toValue$1(this.ref), toValue$1(this.isDirty) && await this.validate(), this.isTouched.value = true, this.isSuspended.value = false, await this.hooks.execute("afterBlur", this, toValue$1(this.ref));
16249
16314
  });
16250
16315
  n(this, "focus", async (e3, r2) => {
16251
16316
  await this.hooks.execute("beforeFocus", this, r2), await this.hooks.execute("focus", this, r2), await this.hooks.execute("afterFocus", this, r2);
@@ -16255,26 +16320,26 @@ class Ie extends oe {
16255
16320
  });
16256
16321
  n(this, "validate", async () => {
16257
16322
  var h2;
16258
- if (this.resetValidation(), await this.hooks.execute("beforeValidate", this, toValue(this.ref)), toValue(this.isDisabled))
16259
- return this.isValid.value = true, toValue(this.isValid);
16323
+ if (this.resetValidation(), await this.hooks.execute("beforeValidate", this, toValue$1(this.ref)), toValue$1(this.isDisabled))
16324
+ return this.isValid.value = true, toValue$1(this.isValid);
16260
16325
  const e3 = async (l) => {
16261
16326
  var I;
16262
- const d = await l.validate(this, toValue(this.ref));
16327
+ const d = await l.validate(this, toValue$1(this.ref));
16263
16328
  if (!d && l.errorMessage)
16264
16329
  if (this.errorsTarget) {
16265
- const S = toValue(this.form.fields).find(
16330
+ const S = toValue$1(this.form.fields).find(
16266
16331
  (ae) => ae.name === this.errorsTarget
16267
16332
  );
16268
- (I = toValue(S == null ? void 0 : S.errors)) == null || I.push(l.errorMessage);
16333
+ (I = toValue$1(S == null ? void 0 : S.errors)) == null || I.push(l.errorMessage);
16269
16334
  } else
16270
- toValue(this.errors).push(l.errorMessage);
16335
+ toValue$1(this.errors).push(l.errorMessage);
16271
16336
  return d;
16272
- }, r2 = toValue(this.validators).filter((l) => !l.precedence), i2 = toValue(this.validators).filter((l) => isOfType(l, "precedence")).sort((l, d) => (l.precedence ?? 0) - (d.precedence ?? 0));
16273
- toValue(this.isOptional) || r2.push(Te(((h2 = this.form.config.validationMessages) == null ? void 0 : h2.required) ?? ""));
16337
+ }, r2 = toValue$1(this.validators).filter((l) => !l.precedence), i2 = toValue$1(this.validators).filter((l) => isOfType(l, "precedence")).sort((l, d) => (l.precedence ?? 0) - (d.precedence ?? 0));
16338
+ toValue$1(this.isOptional) || r2.push(Te(((h2 = this.form.config.validationMessages) == null ? void 0 : h2.required) ?? ""));
16274
16339
  const a2 = (await Promise.all(r2.map(e3))).every(Boolean), u3 = await asyncEvery(i2, e3);
16275
- return this.isValid.value = a2 && u3, await this.hooks.execute("afterValidate", this, toValue(this.ref), toValue(this.isValid)), toValue(this.isValid);
16340
+ return this.isValid.value = a2 && u3, await this.hooks.execute("afterValidate", this, toValue$1(this.ref), toValue$1(this.isValid)), toValue$1(this.isValid);
16276
16341
  });
16277
- this.ref = r.ref, (i = e2.config.initialValues) != null && i.hasOwnProperty(r.name) && (this.ref.value = e2.config.initialValues[r.name]), this.initialValue = toValue(this.ref), this.lazy = r.lazy ?? false, this.errorsTarget = r.errorsTarget, this.label = r.label ? ((u2 = (a = e2.config).renderLabel) == null ? void 0 : u2.call(a, r.label)) ?? r.label : void 0, this.isDisabled.value = r.disabled ?? false, this.isOptional.value = r.optional ?? false, this.isReadOnly.value = r.readOnly ?? false, this.createValidators(r), watch(this.ref, async (h2, l) => {
16342
+ this.ref = r.ref, (i = e2.config.initialValues) != null && i.hasOwnProperty(r.name) && (this.ref.value = e2.config.initialValues[r.name]), this.initialValue = toValue$1(this.ref), this.lazy = r.lazy ?? false, this.errorsTarget = r.errorsTarget, this.label = r.label ? ((u2 = (a = e2.config).renderLabel) == null ? void 0 : u2.call(a, r.label)) ?? r.label : void 0, this.isDisabled.value = r.disabled ?? false, this.isOptional.value = r.optional ?? false, this.isReadOnly.value = r.readOnly ?? false, this.createValidators(r), watch(this.ref, async (h2, l) => {
16278
16343
  await this.hooks.execute("beforeUpdate", this, h2, l), this.isDirty.value = true, await this.hooks.execute("afterUpdate", this, h2, l);
16279
16344
  }), watch(e2.stable, (h2) => {
16280
16345
  h2 && (r.disabledWhen && $(() => r.disabledWhen(this), this.isDisabled), r.optionalWhen && $(() => r.optionalWhen(this), this.isOptional), r.readOnlyWhen && $(() => r.readOnlyWhen(this), this.isReadOnly));
@@ -16313,39 +16378,39 @@ class We {
16313
16378
  n(this, "on");
16314
16379
  n(this, "stable", ref(false));
16315
16380
  n(this, "values");
16316
- n(this, "getFieldMemoized", useMemoize((t2) => toValue(this.fields).find((r2) => r2.name === t2) ?? null));
16381
+ n(this, "getFieldMemoized", useMemoize((t2) => toValue$1(this.fields).find((r2) => r2.name === t2) ?? null));
16317
16382
  const { fields: r, ...i } = e2;
16318
16383
  e2.hookNames = [...ee, ...e2.hookNames ?? []], this.hooks = Z(e2), this.on = this.hooks.register.bind(this.hooks), this.off = this.hooks.unregister.bind(this.hooks), this.name = t, this.config = i, this.values = reactive({}), E(this.config.field.wrapper), E(this.config.fieldDefaults.wrapper), r.forEach((a) => {
16319
16384
  const u2 = this.createFieldInstance(a, this);
16320
- toValue(this.fields).push(u2);
16321
- }), this.interactiveFields = computed(() => toValue(this.fields).filter((a) => isOfType(a, "ref"))), this.isDirty = computed(() => toValue(this.interactiveFields).some((a) => toValue(a.isDirty))), this.stable.value = true;
16385
+ toValue$1(this.fields).push(u2);
16386
+ }), this.interactiveFields = computed(() => toValue$1(this.fields).filter((a) => isOfType(a, "ref"))), this.isDirty = computed(() => toValue$1(this.interactiveFields).some((a) => toValue$1(a.isDirty))), this.stable.value = true;
16322
16387
  }
16323
16388
  async addElement(t, e2, r = "after") {
16324
16389
  await this.hooks.execute(c.BeforeAddElement, this, t);
16325
- const i = e2 ? toValue(this.fields).findIndex((h2) => h2.name === e2) : toValue(this.fields).length;
16390
+ const i = e2 ? toValue$1(this.fields).findIndex((h2) => h2.name === e2) : toValue$1(this.fields).length;
16326
16391
  if (e2 && i === -1) {
16327
16392
  console.error(`Field ${e2} not found in form ${this.name}`);
16328
16393
  return;
16329
16394
  }
16330
16395
  const a = r === "after" ? i + 1 : i, u2 = this.createFieldInstance(t, this);
16331
- return toValue(this.fields).splice(a, 0, u2), await this.hooks.execute(c.AfterAddElement, this, t), u2;
16396
+ return toValue$1(this.fields).splice(a, 0, u2), await this.hooks.execute(c.AfterAddElement, this, t), u2;
16332
16397
  }
16333
16398
  getField(t) {
16334
16399
  return this.getFieldMemoized(t);
16335
16400
  }
16336
16401
  getValue(t) {
16337
16402
  const e2 = this.ensureGetField(t);
16338
- return toValue(e2.ref);
16403
+ return toValue$1(e2.ref);
16339
16404
  }
16340
16405
  getValues() {
16341
- return toValue(this.values);
16406
+ return toValue$1(this.values);
16342
16407
  }
16343
16408
  removeElement(t) {
16344
- const e2 = toValue(this.fields).findIndex((r) => r.name === t);
16345
- toValue(this.fields).splice(e2, 1), this.getFieldMemoized.delete(t);
16409
+ const e2 = toValue$1(this.fields).findIndex((r) => r.name === t);
16410
+ toValue$1(this.fields).splice(e2, 1), this.getFieldMemoized.delete(t);
16346
16411
  }
16347
16412
  async reset() {
16348
- await this.hooks.execute(c.BeforeReset, this), await Promise.all(toValue(this.interactiveFields).map((t) => t.reset())), await this.hooks.execute(c.AfterReset, this);
16413
+ await this.hooks.execute(c.BeforeReset, this), await Promise.all(toValue$1(this.interactiveFields).map((t) => t.reset())), await this.hooks.execute(c.AfterReset, this);
16349
16414
  }
16350
16415
  setValue(t, e2) {
16351
16416
  const r = this.getField(t);
@@ -16360,9 +16425,9 @@ class We {
16360
16425
  async validate() {
16361
16426
  await this.hooks.execute(c.BeforeValidate, this);
16362
16427
  const t = await Promise.all(
16363
- toValue(this.fields).map((e2) => isOfType(e2, "ref") ? e2.validate() : (e2.resetValidation(), true))
16428
+ toValue$1(this.fields).map((e2) => isOfType(e2, "ref") ? e2.validate() : (e2.resetValidation(), true))
16364
16429
  );
16365
- return this.isValid.value = t.every(Boolean), await this.hooks.execute(c.AfterValidate, this), toValue(this.isValid);
16430
+ return this.isValid.value = t.every(Boolean), await this.hooks.execute(c.AfterValidate, this), toValue$1(this.isValid);
16366
16431
  }
16367
16432
  ensureGetField(t) {
16368
16433
  const e2 = this.getField(t);
@@ -16386,8 +16451,8 @@ class We {
16386
16451
  }
16387
16452
  const i = new Ie(e2, r);
16388
16453
  return watch(i.ref, async (u2) => {
16389
- await this.hooks.execute(c.ElementChange, this, i, u2), toValue(i.isDisabled) || (this.values[r.name] = u2);
16390
- }), toValue(i.isDisabled) || (this.values[r.name] = unref(i.ref)), this.registerElement(r.name, i);
16454
+ await this.hooks.execute(c.ElementChange, this, i, u2), toValue$1(i.isDisabled) || (this.values[r.name] = u2);
16455
+ }), toValue$1(i.isDisabled) || (this.values[r.name] = unref(i.ref)), this.registerElement(r.name, i);
16391
16456
  }
16392
16457
  registerElement(t, e2) {
16393
16458
  return isDefined(t) && (this.model[t] = e2, this.getFieldMemoized.delete(t)), e2;
@@ -16403,16 +16468,16 @@ const Le = "register", ne = () => (D ?? (D = ref({})), V ?? (V = ref(Oe())), R ?
16403
16468
  R.register(s, t);
16404
16469
  },
16405
16470
  getForm(s) {
16406
- return toValue(D)[s];
16471
+ return toValue$1(D)[s];
16407
16472
  },
16408
16473
  // @ts-expect-error todo
16409
16474
  register(s, t) {
16410
16475
  R.execute("beforeRegister");
16411
- const e2 = new We(s, U(toValue(V), t));
16412
- return toValue(D)[s] = e2, R.execute("afterRegister", e2), e2;
16476
+ const e2 = new We(s, U(toValue$1(V), t));
16477
+ return toValue$1(D)[s] = e2, R.execute("afterRegister", e2), e2;
16413
16478
  },
16414
16479
  setDefaults(s) {
16415
- V.value = U(toValue(V), s);
16480
+ V.value = U(toValue$1(V), s);
16416
16481
  }
16417
16482
  }), U = (s, t) => {
16418
16483
  var e2, r, i, a, u2, h2;
@@ -19041,22 +19106,8 @@ const useActionStore = defineStore("actions", () => {
19041
19106
  register,
19042
19107
  dispatch,
19043
19108
  registerOrderActions: () => {
19044
- const pluginSettings = usePluginSettings();
19045
- register([
19046
- ordersEditAction,
19047
- ordersFetchAction,
19048
- ordersPrintAction,
19049
- ordersUpdateAction,
19050
- ...pluginSettings.order.orderMode ? [orderExportAction, orderViewInBackofficeAction] : [
19051
- orderExportToShipmentsAction,
19052
- ordersExportPrintShipmentsAction,
19053
- shipmentsExportReturnAction,
19054
- shipmentsExportReturnAction,
19055
- shipmentsDeleteAction,
19056
- shipmentsUpdateAction,
19057
- shipmentsPrintAction
19058
- ]
19059
- ]);
19109
+ const orderMode = useOrderMode();
19110
+ register([ordersEditAction, ordersFetchAction, ordersUpdateAction, ...STORE_MODE_ACTIONS[orderMode.value]]);
19060
19111
  },
19061
19112
  registerModalActions: () => {
19062
19113
  register([modalCloseAction, modalSubmitFormAction]);
@@ -19331,6 +19382,65 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
19331
19382
  };
19332
19383
  }
19333
19384
  });
19385
+ var CarrierId = /* @__PURE__ */ ((CarrierId3) => {
19386
+ CarrierId3[CarrierId3["PostNl"] = 1] = "PostNl";
19387
+ CarrierId3[CarrierId3["Bpost"] = 2] = "Bpost";
19388
+ CarrierId3[CarrierId3["CheapCargo"] = 3] = "CheapCargo";
19389
+ CarrierId3[CarrierId3["Dpd"] = 4] = "Dpd";
19390
+ CarrierId3[CarrierId3["Instabox"] = 5] = "Instabox";
19391
+ CarrierId3[CarrierId3["Dhl"] = 6] = "Dhl";
19392
+ CarrierId3[CarrierId3["Bol"] = 7] = "Bol";
19393
+ CarrierId3[CarrierId3["BolCom"] = 7] = "BolCom";
19394
+ CarrierId3[CarrierId3["Ups"] = 8] = "Ups";
19395
+ CarrierId3[CarrierId3["DhlForYou"] = 9] = "DhlForYou";
19396
+ CarrierId3[CarrierId3["DhlParcelConnect"] = 10] = "DhlParcelConnect";
19397
+ CarrierId3[CarrierId3["DhlEuroPlus"] = 11] = "DhlEuroPlus";
19398
+ CarrierId3[CarrierId3["UpsStandard"] = 12] = "UpsStandard";
19399
+ CarrierId3[CarrierId3["UpsExpressSaver"] = 13] = "UpsExpressSaver";
19400
+ CarrierId3[CarrierId3["Gls"] = 14] = "Gls";
19401
+ CarrierId3[CarrierId3["Brt"] = 15] = "Brt";
19402
+ CarrierId3[CarrierId3["Trunkrs"] = 16] = "Trunkrs";
19403
+ CarrierId3[CarrierId3["InPost"] = 17] = "InPost";
19404
+ return CarrierId3;
19405
+ })(CarrierId || {});
19406
+ var CarrierName = /* @__PURE__ */ ((CarrierName3) => {
19407
+ CarrierName3["PostNl"] = "postnl";
19408
+ CarrierName3["Bpost"] = "bpost";
19409
+ CarrierName3["CheapCargo"] = "cheapcargo";
19410
+ CarrierName3["Dpd"] = "dpd";
19411
+ CarrierName3["Instabox"] = "instabox";
19412
+ CarrierName3["Dhl"] = "dhl";
19413
+ CarrierName3["Bol"] = "bol.com";
19414
+ CarrierName3["BolCom"] = "bol.com";
19415
+ CarrierName3["Ups"] = "ups";
19416
+ CarrierName3["DhlForYou"] = "dhlforyou";
19417
+ CarrierName3["DhlParcelConnect"] = "dhlparcelconnect";
19418
+ CarrierName3["DhlEuroPlus"] = "dhleuroplus";
19419
+ CarrierName3["UpsStandard"] = "upsstandard";
19420
+ CarrierName3["UpsExpressSaver"] = "upsexpresssaver";
19421
+ CarrierName3["Gls"] = "gls";
19422
+ CarrierName3["Brt"] = "brt";
19423
+ CarrierName3["Trunkrs"] = "trunkrs";
19424
+ CarrierName3["InPost"] = "inpost";
19425
+ return CarrierName3;
19426
+ })(CarrierName || {});
19427
+ var DeliveryTypeName = /* @__PURE__ */ ((DeliveryTypeName3) => {
19428
+ DeliveryTypeName3["Morning"] = "morning";
19429
+ DeliveryTypeName3["Standard"] = "standard";
19430
+ DeliveryTypeName3["Evening"] = "evening";
19431
+ DeliveryTypeName3["Pickup"] = "pickup";
19432
+ DeliveryTypeName3["Express"] = "express";
19433
+ return DeliveryTypeName3;
19434
+ })(DeliveryTypeName || {});
19435
+ var PackageTypeName = /* @__PURE__ */ ((PackageTypeName2) => {
19436
+ PackageTypeName2["Package"] = "package";
19437
+ PackageTypeName2["Mailbox"] = "mailbox";
19438
+ PackageTypeName2["Letter"] = "letter";
19439
+ PackageTypeName2["DigitalStamp"] = "digital_stamp";
19440
+ PackageTypeName2["Pallet"] = "pallet";
19441
+ PackageTypeName2["PackageSmall"] = "package_small";
19442
+ return PackageTypeName2;
19443
+ })(PackageTypeName || {});
19334
19444
  const _hoisted_1$7 = ["title", "textContent"];
19335
19445
  const _sfc_main$q = /* @__PURE__ */ defineComponent({
19336
19446
  __name: "PackageType",
@@ -19397,14 +19507,37 @@ const useMyParcelApi = () => {
19397
19507
  sdk = f(client, [new de(), new ce()]);
19398
19508
  return sdk;
19399
19509
  };
19510
+ const KNOWN_CARRIER_NAMES = new Set(Object.values(CarrierName));
19511
+ const KNOWN_CARRIER_IDS = new Set(
19512
+ Object.values(CarrierId).filter((value) => typeof value === "number")
19513
+ );
19514
+ const resolveCarrierIdentifier = (input) => {
19515
+ if (typeof input === "number") {
19516
+ if (KNOWN_CARRIER_IDS.has(input)) {
19517
+ return input;
19518
+ }
19519
+ console.warn(`[useFetchCarrier] Unknown carrier ID "${input}", it may cause issues.`);
19520
+ return input;
19521
+ }
19522
+ if (KNOWN_CARRIER_NAMES.has(input)) {
19523
+ return input;
19524
+ }
19525
+ const normalized = input.replace(/_/g, "").toLowerCase();
19526
+ if (KNOWN_CARRIER_NAMES.has(normalized)) {
19527
+ return normalized;
19528
+ }
19529
+ console.warn(`[useFetchCarrier] Unknown carrier identifier "${input}", it may cause issues.`);
19530
+ return input;
19531
+ };
19400
19532
  const useFetchCarrier = (carrier) => {
19533
+ const resolved = carrier === void 0 ? void 0 : resolveCarrierIdentifier(carrier);
19401
19534
  const queryClient2 = useQueryClient();
19402
- const queryKey = ["carriers", { name: carrier }];
19535
+ const queryKey = ["carriers", { name: resolved }];
19403
19536
  return useQuery(
19404
19537
  queryKey,
19405
19538
  async () => {
19406
19539
  const sdk2 = useMyParcelApi();
19407
- const carriers = await sdk2.getCarrier(carrier ? { path: { carrier } } : void 0);
19540
+ const carriers = await sdk2.getCarrier(resolved === void 0 ? void 0 : { path: { carrier: resolved } });
19408
19541
  return carriers[0];
19409
19542
  },
19410
19543
  {
@@ -19420,14 +19553,18 @@ const usePdkAdminApi = createGlobalState(() => {
19420
19553
  baseUrl: globalContext.baseUrl
19421
19554
  });
19422
19555
  const pdkEndpoints = Object.entries(globalContext.endpoints).map(([endpointName, options]) => {
19556
+ const property = typeof options.property === "string" ? options.property : void 0;
19557
+ const responseProperty = typeof options.responseProperty === "string" ? options.responseProperty : void 0;
19423
19558
  class PdkEndpoint extends AbstractPdkEndpoint {
19424
19559
  constructor() {
19425
19560
  super(...arguments);
19426
19561
  __publicField(this, "method", options.method.toUpperCase());
19427
19562
  __publicField(this, "name", endpointName);
19428
19563
  __publicField(this, "path", options.path);
19429
- __publicField(this, "property", options.property);
19430
- __publicField(this, "responseProperty", options.responseProperty ?? options.property);
19564
+ __publicField(this, "property", property);
19565
+ // If this is undefined, the SDK falls back to the endpoint instance's `property` value above.
19566
+ __publicField(this, "responseProperty", responseProperty);
19567
+ __publicField(this, "useDataEnvelope", typeof options.useDataEnvelope === "undefined" ? true : options.useDataEnvelope);
19431
19568
  }
19432
19569
  }
19433
19570
  return new PdkEndpoint({
@@ -19513,19 +19650,25 @@ const createValueGetter = (instance, prefix) => {
19513
19650
  if (target) {
19514
19651
  return instance.form.getValue(`${prefix}${target}`);
19515
19652
  }
19516
- return toValue(instance.ref);
19653
+ return toValue$1(instance.ref);
19517
19654
  };
19518
19655
  };
19656
+ const setFieldRef = (field, value) => {
19657
+ if (isRef(field.ref)) {
19658
+ field.ref.value = value;
19659
+ } else {
19660
+ field.ref = value;
19661
+ }
19662
+ };
19519
19663
  const createValueSetter = (instance, prefix) => {
19520
19664
  return (value, target) => {
19521
19665
  if (target) {
19522
- instance.form.setValue(`${prefix}${target}`, value);
19523
- } else {
19524
- if (isRef(instance.ref)) {
19525
- instance.ref.value = value;
19526
- return;
19666
+ const targetField = instance.form.getField(`${prefix}${target}`);
19667
+ if (targetField) {
19668
+ setFieldRef(targetField, value);
19527
19669
  }
19528
- instance.ref = value;
19670
+ } else {
19671
+ setFieldRef(instance, value);
19529
19672
  }
19530
19673
  };
19531
19674
  };
@@ -19685,24 +19828,86 @@ const FORM_KEYS = [
19685
19828
  FORM_KEY_PLUGIN_SETTINGS,
19686
19829
  FORM_KEY_PRODUCT_SETTINGS
19687
19830
  ];
19831
+ const useShipmentCapabilitiesQuery = (selection) => {
19832
+ const enabled = computed(
19833
+ () => Boolean(
19834
+ selection.value.cc && selection.value.carrier && selection.value.packageType && selection.value.deliveryType
19835
+ )
19836
+ );
19837
+ const queryKey = computed(() => [BackendEndpoint.ProxyCapabilities, "shipment", selection.value]);
19838
+ return useQuery(
19839
+ queryKey,
19840
+ async () => {
19841
+ const { cc, weight, carrier, packageType, deliveryType } = selection.value;
19842
+ if (!cc || !carrier || !packageType || !deliveryType) return [];
19843
+ const pdk = usePdkAdminApi();
19844
+ const proxyCapabilities = pdk.proxyCapabilities;
19845
+ const body = {
19846
+ recipient: { countryCode: cc },
19847
+ // PDK orders carry physical-properties weight in grams (see WeightServiceInterface::UNIT_GRAMS),
19848
+ // and the SDK's PhysicalPropertiesWeightV2 expects a {value, unit} object — not a primitive.
19849
+ ...weight !== void 0 ? { physicalProperties: { weight: { value: weight, unit: "g" } } } : null,
19850
+ carrier,
19851
+ packageType,
19852
+ deliveryType
19853
+ };
19854
+ const response = await proxyCapabilities({ body, parameters: { filterSupported: true } });
19855
+ return response.results ?? [];
19856
+ },
19857
+ {
19858
+ enabled,
19859
+ refetchOnWindowFocus: false,
19860
+ refetchOnMount: false,
19861
+ refetchOnReconnect: false,
19862
+ onError: (error) => {
19863
+ globalLogger.error("shipment-capabilities-query", "request failed", error);
19864
+ }
19865
+ }
19866
+ );
19867
+ };
19868
+ const useOrderCapabilitiesQuery = (input) => {
19869
+ const enabled = computed(() => Boolean(input.value.cc));
19870
+ const queryKey = computed(() => [BackendEndpoint.ProxyCapabilities, "order", input.value]);
19871
+ return useQuery(
19872
+ queryKey,
19873
+ async () => {
19874
+ const { cc, weight } = input.value;
19875
+ if (!cc) return [];
19876
+ const pdk = usePdkAdminApi();
19877
+ const proxyCapabilities = pdk.proxyCapabilities;
19878
+ const body = {
19879
+ recipient: { countryCode: cc },
19880
+ ...weight !== void 0 ? { physicalProperties: { weight: { value: weight, unit: "g" } } } : null
19881
+ };
19882
+ const response = await proxyCapabilities({ body, parameters: { filterSupported: true } });
19883
+ return response.results ?? [];
19884
+ },
19885
+ {
19886
+ enabled,
19887
+ refetchOnWindowFocus: false,
19888
+ refetchOnMount: false,
19889
+ refetchOnReconnect: false,
19890
+ onError: (error) => {
19891
+ globalLogger.error("order-capabilities-query", "request failed", error);
19892
+ }
19893
+ }
19894
+ );
19895
+ };
19896
+ const DEBOUNCE_MS = 100;
19897
+ const useCapabilitiesWatcher = (order, form) => {
19898
+ const merged = computed(() => ({
19899
+ ...toValue$1(order),
19900
+ ...toValue$1(form)
19901
+ }));
19902
+ return refDebounced(merged, DEBOUNCE_MS);
19903
+ };
19688
19904
  const DELIVERY_OPTIONS_PREFIX = "deliveryOptions";
19689
19905
  const PHYSICAL_PROPERTIES_PREFIX = "physicalProperties";
19690
- const SHIPMENT_OPTIONS = `shipmentOptions`;
19691
- const SHIPMENT_OPTIONS_PREFIX = `${DELIVERY_OPTIONS_PREFIX}.${SHIPMENT_OPTIONS}`;
19906
+ const SHIPMENT_OPTIONS = "shipmentOptions";
19692
19907
  const CARRIER = "carrier";
19693
19908
  const LABEL_AMOUNT = "labelAmount";
19694
19909
  const PACKAGE_TYPE = "packageType";
19695
19910
  const DELIVERY_TYPE = "deliveryType";
19696
- const AGE_CHECK = "ageCheck";
19697
- const RECEIPT_CODE = "receiptCode";
19698
- const DIRECT_RETURN = "return";
19699
- const HIDE_SENDER = "hideSender";
19700
- const LARGE_FORMAT = "largeFormat";
19701
- const ONLY_RECIPIENT = "onlyRecipient";
19702
- const SAME_DAY_DELIVERY = "sameDayDelivery";
19703
- const SIGNATURE = "signature";
19704
- const INSURANCE = "insurance";
19705
- const PRIORITY_DELIVERY = "priorityDelivery";
19706
19911
  const MANUAL_WEIGHT = "manualWeight";
19707
19912
  const PROP_OPTIONS = "options";
19708
19913
  const KEY_DESCRIPTION = "description";
@@ -19711,52 +19916,311 @@ const FIELD_CARRIER = `${DELIVERY_OPTIONS_PREFIX}.${CARRIER}`;
19711
19916
  const FIELD_LABEL_AMOUNT = `${DELIVERY_OPTIONS_PREFIX}.${LABEL_AMOUNT}`;
19712
19917
  const FIELD_PACKAGE_TYPE = `${DELIVERY_OPTIONS_PREFIX}.${PACKAGE_TYPE}`;
19713
19918
  const FIELD_DELIVERY_TYPE = `${DELIVERY_OPTIONS_PREFIX}.${DELIVERY_TYPE}`;
19714
- const FIELD_AGE_CHECK = `${SHIPMENT_OPTIONS_PREFIX}.${AGE_CHECK}`;
19715
- const FIELD_DIRECT_RETURN = `${SHIPMENT_OPTIONS_PREFIX}.${DIRECT_RETURN}`;
19716
- const FIELD_HIDE_SENDER = `${SHIPMENT_OPTIONS_PREFIX}.${HIDE_SENDER}`;
19717
- const FIELD_LARGE_FORMAT = `${SHIPMENT_OPTIONS_PREFIX}.${LARGE_FORMAT}`;
19718
- const FIELD_ONLY_RECIPIENT = `${SHIPMENT_OPTIONS_PREFIX}.${ONLY_RECIPIENT}`;
19719
- const FIELD_SAME_DAY_DELIVERY = `${SHIPMENT_OPTIONS_PREFIX}.${SAME_DAY_DELIVERY}`;
19720
- const FIELD_SIGNATURE = `${SHIPMENT_OPTIONS_PREFIX}.${SIGNATURE}`;
19721
- const FIELD_INSURANCE = `${SHIPMENT_OPTIONS_PREFIX}.${INSURANCE}`;
19722
- const FIELD_PRIORITY_DELIVERY = `${SHIPMENT_OPTIONS_PREFIX}.${PRIORITY_DELIVERY}`;
19723
19919
  const FIELD_MANUAL_WEIGHT = `${PHYSICAL_PROPERTIES_PREFIX}.${MANUAL_WEIGHT}`;
19724
- const FIELD_RECEIPT_CODE = `${SHIPMENT_OPTIONS_PREFIX}.${RECEIPT_CODE}`;
19725
- const ALL_FIELDS = [
19726
- FIELD_AGE_CHECK,
19727
- FIELD_CARRIER,
19728
- FIELD_DIRECT_RETURN,
19729
- FIELD_HIDE_SENDER,
19730
- FIELD_INSURANCE,
19731
- FIELD_PRIORITY_DELIVERY,
19732
- FIELD_LABEL_AMOUNT,
19733
- FIELD_LARGE_FORMAT,
19734
- FIELD_ONLY_RECIPIENT,
19735
- FIELD_MANUAL_WEIGHT,
19736
- FIELD_PACKAGE_TYPE,
19737
- FIELD_DELIVERY_TYPE,
19738
- FIELD_SAME_DAY_DELIVERY,
19739
- FIELD_SIGNATURE,
19740
- FIELD_RECEIPT_CODE
19741
- ];
19920
+ const FIELD_SHIPMENT_OPTIONS_PREFIX = `${DELIVERY_OPTIONS_PREFIX}.${SHIPMENT_OPTIONS}`;
19921
+ const wireProxyCapabilities = (form, order) => {
19922
+ const orderId = order.externalIdentifier;
19923
+ if (!orderId) {
19924
+ globalLogger.debug("wireProxyCapabilities", "skipped — order has no externalIdentifier", { order });
19925
+ return void 0;
19926
+ }
19927
+ const orderModifier = `${orderId}.order`;
19928
+ const shipmentModifier = `${orderId}.shipment`;
19929
+ const orderInput = computed(() => {
19930
+ var _a, _b;
19931
+ const manualWeightRaw = form.getValue(FIELD_MANUAL_WEIGHT);
19932
+ const manualWeight = typeof manualWeightRaw === "number" && manualWeightRaw > 0 ? manualWeightRaw : void 0;
19933
+ return {
19934
+ cc: (_a = order.shippingAddress) == null ? void 0 : _a.cc,
19935
+ weight: manualWeight ?? ((_b = order.physicalProperties) == null ? void 0 : _b.initialWeight)
19936
+ };
19937
+ });
19938
+ const formInput = computed(() => ({
19939
+ carrier: form.getValue(FIELD_CARRIER),
19940
+ packageType: form.getValue(FIELD_PACKAGE_TYPE),
19941
+ deliveryType: form.getValue(FIELD_DELIVERY_TYPE)
19942
+ }));
19943
+ const selection = useCapabilitiesWatcher(orderInput, formInput);
19944
+ const orderInputForQuery = computed(() => ({
19945
+ cc: selection.value.cc,
19946
+ weight: selection.value.weight
19947
+ }));
19948
+ const orderQuery = useOrderCapabilitiesQuery(orderInputForQuery);
19949
+ const shipmentQuery = useShipmentCapabilitiesQuery(selection);
19950
+ const queryStore = useQueryStore();
19951
+ queryStore.register(BackendEndpoint.ProxyCapabilities, orderModifier, orderQuery);
19952
+ queryStore.register(BackendEndpoint.ProxyCapabilities, shipmentModifier, shipmentQuery);
19953
+ onScopeDispose(() => {
19954
+ queryStore.unregister(BackendEndpoint.ProxyCapabilities, orderModifier);
19955
+ queryStore.unregister(BackendEndpoint.ProxyCapabilities, shipmentModifier);
19956
+ });
19957
+ return { selection };
19958
+ };
19959
+ const FIELD_TO_LABEL_KEY = {
19960
+ [FIELD_CARRIER]: "carrier",
19961
+ [FIELD_PACKAGE_TYPE]: snakeCase(`${SHIPMENT_OPTIONS}_package_type`),
19962
+ [FIELD_DELIVERY_TYPE]: snakeCase(`${SHIPMENT_OPTIONS}_delivery_type`)
19963
+ };
19964
+ const optionFieldName = (key) => `${FIELD_SHIPMENT_OPTIONS_PREFIX}.${key}`;
19965
+ const optionLabelKey = (key) => snakeCase(`${SHIPMENT_OPTIONS}_${key}`);
19966
+ const setFieldValue = (form, fieldName, value) => {
19967
+ const field = form.getField(fieldName);
19968
+ if (!field) return;
19969
+ setFieldRef(field, value);
19970
+ };
19971
+ const readShipmentSnapshot = (selection, queryStore, orderId) => {
19972
+ const modifier = `${orderId}.shipment`;
19973
+ if (!queryStore.has(BackendEndpoint.ProxyCapabilities, modifier)) return { state: "pending" };
19974
+ const query = queryStore.get(BackendEndpoint.ProxyCapabilities, modifier);
19975
+ if (toValue$1(query.status) !== "success") return { state: "pending" };
19976
+ const carriers = toValue$1(query.data) ?? [];
19977
+ const queryCarrier = selection.value.carrier;
19978
+ const matched = carriers.find((carrier) => carrier.carrier === queryCarrier);
19979
+ return matched ? { state: "matched", carrier: matched } : { state: "invalid_combo" };
19980
+ };
19981
+ const useCapabilitiesAutoClear = (form, allOptionKeys, orderId, inheritedDeliveryOptions, selection) => {
19982
+ const queryStore = useQueryStore();
19983
+ const notificationStore = useNotificationStore();
19984
+ const { translate: translate2 } = useLanguage();
19985
+ const { getCarrierCapabilitiesForOrder } = useFormCapabilities();
19986
+ let lastModifiedAxis;
19987
+ let lastModifiedPreviousValue;
19988
+ let suppressTracking = false;
19989
+ const setSilently = (fieldName, value) => {
19990
+ if (form.getValue(fieldName) === value) return false;
19991
+ suppressTracking = true;
19992
+ try {
19993
+ setFieldValue(form, fieldName, value);
19994
+ } finally {
19995
+ suppressTracking = false;
19996
+ }
19997
+ return true;
19998
+ };
19999
+ const previousAxisValues = {
20000
+ [FIELD_CARRIER]: form.getValue(FIELD_CARRIER),
20001
+ [FIELD_PACKAGE_TYPE]: form.getValue(FIELD_PACKAGE_TYPE),
20002
+ [FIELD_DELIVERY_TYPE]: form.getValue(FIELD_DELIVERY_TYPE)
20003
+ };
20004
+ watch(
20005
+ [
20006
+ () => form.getValue(FIELD_CARRIER),
20007
+ () => form.getValue(FIELD_PACKAGE_TYPE),
20008
+ () => form.getValue(FIELD_DELIVERY_TYPE),
20009
+ ...allOptionKeys.map((key) => () => form.getValue(optionFieldName(key)))
20010
+ ],
20011
+ () => {
20012
+ notificationStore.remove(CAPABILITIES_CLEARED_NOTIFICATION_ID);
20013
+ },
20014
+ { flush: "sync" }
20015
+ );
20016
+ watch(
20017
+ [
20018
+ () => form.getValue(FIELD_CARRIER),
20019
+ () => form.getValue(FIELD_PACKAGE_TYPE),
20020
+ () => form.getValue(FIELD_DELIVERY_TYPE)
20021
+ ],
20022
+ ([carrierValue, packageTypeValue, deliveryTypeValue]) => {
20023
+ if (!suppressTracking) {
20024
+ if (carrierValue !== previousAxisValues[FIELD_CARRIER]) {
20025
+ lastModifiedAxis = FIELD_CARRIER;
20026
+ lastModifiedPreviousValue = previousAxisValues[FIELD_CARRIER];
20027
+ } else if (packageTypeValue !== previousAxisValues[FIELD_PACKAGE_TYPE]) {
20028
+ lastModifiedAxis = FIELD_PACKAGE_TYPE;
20029
+ lastModifiedPreviousValue = previousAxisValues[FIELD_PACKAGE_TYPE];
20030
+ } else if (deliveryTypeValue !== previousAxisValues[FIELD_DELIVERY_TYPE]) {
20031
+ lastModifiedAxis = FIELD_DELIVERY_TYPE;
20032
+ lastModifiedPreviousValue = previousAxisValues[FIELD_DELIVERY_TYPE];
20033
+ }
20034
+ }
20035
+ previousAxisValues[FIELD_CARRIER] = carrierValue;
20036
+ previousAxisValues[FIELD_PACKAGE_TYPE] = packageTypeValue;
20037
+ previousAxisValues[FIELD_DELIVERY_TYPE] = deliveryTypeValue;
20038
+ },
20039
+ // `sync` flush is essential here: `suppressTracking` is set inside `setSilently`'s
20040
+ // `try`/`finally`, which is synchronous. With Vue's default (`pre`) flush, the watcher
20041
+ // callback runs LATER — by which time `suppressTracking` has been reset to `false`, and
20042
+ // the silent write gets attributed to the user. That makes `lastModifiedPreviousValue`
20043
+ // capture the value the auto-clear just overwrote, and the next `revertAxis` reverts to
20044
+ // it — producing a flip-flop cycle visible to the merchant. Sync flush fires the callback
20045
+ // inside the ref setter so it observes `suppressTracking === true`.
20046
+ { flush: "sync" }
20047
+ );
20048
+ const revertAxis = (axis) => {
20049
+ const target = lastModifiedAxis === axis ? lastModifiedPreviousValue : void 0;
20050
+ const changed = setSilently(axis, target);
20051
+ return { restored: target !== void 0, changed };
20052
+ };
20053
+ const inheritedDefault = (carrierName, axis) => {
20054
+ const defaults = inheritedDeliveryOptions[carrierName];
20055
+ if (!defaults) return void 0;
20056
+ return axis === FIELD_PACKAGE_TYPE ? defaults.packageType : defaults.deliveryType;
20057
+ };
20058
+ const applyCarrierDefaults = () => {
20059
+ const carrierName = form.getValue(FIELD_CARRIER);
20060
+ const pkgDefault = carrierName ? inheritedDefault(carrierName, FIELD_PACKAGE_TYPE) : void 0;
20061
+ const dtDefault = carrierName ? inheritedDefault(carrierName, FIELD_DELIVERY_TYPE) : void 0;
20062
+ if (pkgDefault !== void 0) {
20063
+ setSilently(FIELD_PACKAGE_TYPE, pkgDefault);
20064
+ }
20065
+ if (dtDefault !== void 0) {
20066
+ setSilently(FIELD_DELIVERY_TYPE, dtDefault);
20067
+ }
20068
+ };
20069
+ const lineForAxisClear = (axis, restored) => {
20070
+ const fieldLabel = translate2(FIELD_TO_LABEL_KEY[axis]);
20071
+ return restored ? translate2({ key: "capabilities_cleared_field_reverted", args: { field: fieldLabel } }) : translate2({ key: "capabilities_cleared_field_cleared", args: { field: fieldLabel } });
20072
+ };
20073
+ const lineForOptionClear = (optionKey) => {
20074
+ const fieldLabel = translate2(optionLabelKey(optionKey));
20075
+ return translate2({ key: "capabilities_cleared_option_cleared", args: { field: fieldLabel } });
20076
+ };
20077
+ const notifyClears = (lines) => {
20078
+ if (lines.length === 0) return;
20079
+ addCapabilitiesClearNotification(notificationStore, translate2("capabilities_cleared"), lines);
20080
+ };
20081
+ const resolveInvalidCombo = () => {
20082
+ if (lastModifiedAxis === FIELD_CARRIER) {
20083
+ applyCarrierDefaults();
20084
+ return [];
20085
+ }
20086
+ if (lastModifiedAxis === FIELD_PACKAGE_TYPE || lastModifiedAxis === FIELD_DELIVERY_TYPE) {
20087
+ const { restored, changed } = revertAxis(lastModifiedAxis);
20088
+ return changed ? [lineForAxisClear(lastModifiedAxis, restored)] : [];
20089
+ }
20090
+ const wrote = setSilently(FIELD_DELIVERY_TYPE, void 0);
20091
+ return wrote ? [lineForAxisClear(FIELD_DELIVERY_TYPE, false)] : [];
20092
+ };
20093
+ watch(
20094
+ () => {
20095
+ const carrier = getCarrierCapabilitiesForOrder(form);
20096
+ const packageType = form.getValue(FIELD_PACKAGE_TYPE);
20097
+ const deliveryType = form.getValue(FIELD_DELIVERY_TYPE);
20098
+ return {
20099
+ carrierName: carrier == null ? void 0 : carrier.carrier,
20100
+ packageTypesInCarrier: (carrier == null ? void 0 : carrier.packageTypes) ?? [],
20101
+ deliveryTypesInCarrier: (carrier == null ? void 0 : carrier.deliveryTypes) ?? [],
20102
+ packageType,
20103
+ deliveryType
20104
+ };
20105
+ },
20106
+ ({ carrierName, packageTypesInCarrier, deliveryTypesInCarrier, packageType, deliveryType }) => {
20107
+ if (!carrierName) return;
20108
+ const packageTypeInvalid = Boolean(packageType) && !packageTypesInCarrier.includes(packageType);
20109
+ const deliveryTypeInvalid = Boolean(deliveryType) && !deliveryTypesInCarrier.includes(deliveryType);
20110
+ if (!packageTypeInvalid && !deliveryTypeInvalid) return;
20111
+ if (lastModifiedAxis === FIELD_CARRIER) {
20112
+ applyCarrierDefaults();
20113
+ return;
20114
+ }
20115
+ const lines = [];
20116
+ if (packageTypeInvalid) {
20117
+ const { restored, changed } = revertAxis(FIELD_PACKAGE_TYPE);
20118
+ if (changed) lines.push(lineForAxisClear(FIELD_PACKAGE_TYPE, restored));
20119
+ }
20120
+ if (deliveryTypeInvalid) {
20121
+ const { restored, changed } = revertAxis(FIELD_DELIVERY_TYPE);
20122
+ if (changed) lines.push(lineForAxisClear(FIELD_DELIVERY_TYPE, restored));
20123
+ }
20124
+ notifyClears(lines);
20125
+ },
20126
+ { deep: true }
20127
+ );
20128
+ watch(
20129
+ () => readShipmentSnapshot(selection, queryStore, orderId),
20130
+ (snapshot) => {
20131
+ if (snapshot.state === "pending") return;
20132
+ if (snapshot.state === "invalid_combo") {
20133
+ notifyClears(resolveInvalidCombo());
20134
+ return;
20135
+ }
20136
+ const availableOptionKeys = Object.keys(snapshot.carrier.options);
20137
+ const lines = [];
20138
+ const silent = lastModifiedAxis === FIELD_CARRIER;
20139
+ for (const optionKey of allOptionKeys) {
20140
+ const fieldName = optionFieldName(optionKey);
20141
+ const value = form.getValue(fieldName);
20142
+ const isActive = value !== void 0 && value !== TriState.Inherit && Boolean(value);
20143
+ if (!isActive) continue;
20144
+ if (availableOptionKeys.includes(optionKey)) continue;
20145
+ setSilently(fieldName, TriState.Inherit);
20146
+ if (!silent) {
20147
+ lines.push(lineForOptionClear(optionKey));
20148
+ }
20149
+ }
20150
+ notifyClears(lines);
20151
+ }
20152
+ );
20153
+ };
19742
20154
  const createRef = (refs, field, fallback) => {
19743
20155
  return ref(refs[field] ?? fallback);
19744
20156
  };
19745
20157
  const createShipmentOptionField = (refs, fieldName, config) => {
19746
20158
  const name = fieldName.split(".").pop() ?? fieldName;
20159
+ const capabilities = useFormCapabilities();
19747
20160
  return defineFormField({
19748
20161
  name: fieldName,
19749
20162
  component: resolveFormComponent(AdminComponent.TriStateInput),
19750
20163
  ref: createRef(refs, fieldName, TriState.Inherit),
19751
20164
  label: getFieldLabel(name),
19752
- visibleWhen: createHasShipmentOptionWatcher(name),
19753
- disabledWhen: createHasShipmentOptionWatcher(name, true),
20165
+ visibleWhen: ({ form }) => capabilities.hasShipmentOption(form, name),
20166
+ // Disabled when the carrier doesn't support this option.
20167
+ // Required options use readOnlyWhen instead, keeping them enabled
20168
+ // so their value is included in the form body by getEnabledValues().
20169
+ disabledWhen: ({ form }) => !capabilities.hasShipmentOption(form, name),
20170
+ // Read-only prevents the TriState "inherit" toggle from being used,
20171
+ // fully locking the field when the carrier requires this option.
20172
+ readOnlyWhen: ({ form }) => {
20173
+ var _a, _b, _c;
20174
+ return ((_c = (_b = (_a = capabilities.getCarrierCapabilitiesForShipment(form)) == null ? void 0 : _a.options) == null ? void 0 : _b[name]) == null ? void 0 : _c.isRequired) === true;
20175
+ },
20176
+ afterUpdate(field, value) {
20177
+ var _a, _b, _c, _d, _e2;
20178
+ const carrier = capabilities.getCarrierCapabilitiesForShipment(field.form);
20179
+ const option = (_a = carrier == null ? void 0 : carrier.options) == null ? void 0 : _a[name];
20180
+ if (!option) {
20181
+ return;
20182
+ }
20183
+ if (option.isRequired === true && value !== TriState.On) {
20184
+ setFieldRef(field, TriState.On);
20185
+ return;
20186
+ }
20187
+ const isEnabled = TriState.On === value;
20188
+ for (const requiredOption of option.requires ?? []) {
20189
+ const targetFieldName = `${FIELD_SHIPMENT_OPTIONS_PREFIX}.${requiredOption}`;
20190
+ const targetField = field.form.getField(targetFieldName);
20191
+ if (!targetField) {
20192
+ continue;
20193
+ }
20194
+ if (isEnabled) {
20195
+ setFieldRef(targetField, TriState.On);
20196
+ targetField.props.readOnly = true;
20197
+ } else {
20198
+ const isRequiredByCarrier = ((_c = (_b = carrier == null ? void 0 : carrier.options) == null ? void 0 : _b[requiredOption]) == null ? void 0 : _c.isRequired) === true;
20199
+ if (!isRequiredByCarrier) {
20200
+ targetField.props.readOnly = false;
20201
+ }
20202
+ }
20203
+ }
20204
+ for (const excludedOption of option.excludes ?? []) {
20205
+ const targetFieldName = `${FIELD_SHIPMENT_OPTIONS_PREFIX}.${excludedOption}`;
20206
+ const targetField = field.form.getField(targetFieldName);
20207
+ if (!targetField) {
20208
+ continue;
20209
+ }
20210
+ if (isEnabled) {
20211
+ setFieldRef(targetField, TriState.Off);
20212
+ targetField.props.readOnly = true;
20213
+ } else {
20214
+ const isRequiredByCarrier = ((_e2 = (_d = carrier == null ? void 0 : carrier.options) == null ? void 0 : _d[excludedOption]) == null ? void 0 : _e2.isRequired) === true;
20215
+ if (!isRequiredByCarrier) {
20216
+ targetField.props.readOnly = false;
20217
+ }
20218
+ }
20219
+ }
20220
+ },
19754
20221
  ...config
19755
20222
  });
19756
20223
  };
19757
- const createHideSenderField = (refs) => {
19758
- return createShipmentOptionField(refs, FIELD_HIDE_SENDER);
19759
- };
19760
20224
  const createDeliveryTypeField = (refs) => {
19761
20225
  return defineFormField({
19762
20226
  name: FIELD_DELIVERY_TYPE,
@@ -19766,89 +20230,94 @@ const createDeliveryTypeField = (refs) => {
19766
20230
  // options defined in afterUpdate of `createCarrierField`
19767
20231
  });
19768
20232
  };
19769
- const createAgeCheckField = (refs) => {
19770
- return createShipmentOptionField(refs, FIELD_AGE_CHECK, {
19771
- afterUpdate(field) {
19772
- const { form } = field;
19773
- setPostNlAgeCheckSubtext(field);
19774
- if (!triStateFieldIsEnabled(field.form, FIELD_AGE_CHECK)) {
19775
- return;
19776
- }
19777
- switch (getFormCarrierName(form)) {
19778
- case CarrierName.PostNl:
19779
- form.setValue(FIELD_SIGNATURE, TriState.On);
19780
- form.setValue(FIELD_ONLY_RECIPIENT, TriState.On);
19781
- break;
19782
- case CarrierName.DhlForYou:
19783
- form.setValue(FIELD_SIGNATURE, TriState.Off);
19784
- break;
19785
- }
19786
- }
19787
- });
19788
- };
19789
- const getCarrier = (form) => {
19790
- const dynamicContext = useContext(AdminContextKey.Dynamic);
19791
- const chosenCarrier = form.getValue(FIELD_CARRIER);
19792
- return dynamicContext.carriers.find((carrier) => carrier.externalIdentifier === chosenCarrier);
19793
- };
19794
- const getDeliveryTypes = (form) => {
19795
- let array = Object.values(DeliveryTypeName);
19796
- if (form) {
19797
- const carrier = getCarrier(form);
19798
- array = array.filter((name) => carrier == null ? void 0 : carrier.capabilities.deliveryTypes.includes(name));
19799
- }
19800
- return array.map((name) => ({
19801
- label: getDynamicTranslation("delivery_type", name),
19802
- value: name
19803
- }));
19804
- };
19805
20233
  const createCarrierField = (refs, inheritedDeliveryOptions) => {
19806
20234
  const dynamicContext = useContext(AdminContextKey.Dynamic);
19807
- const formatter = useLocalizedFormatter();
20235
+ const capabilities = useFormCapabilities();
20236
+ const queryStore = useQueryStore();
20237
+ const orderId = getOrderId();
20238
+ const orderModifier = typeof orderId === "string" ? `${orderId}.order` : void 0;
19808
20239
  const { translate: translate2 } = useLanguage();
20240
+ const staticMeta = /* @__PURE__ */ new Map();
20241
+ const readOrderCarriers = () => {
20242
+ if (!orderModifier || !queryStore.has(BackendEndpoint.ProxyCapabilities, orderModifier)) {
20243
+ return void 0;
20244
+ }
20245
+ const query = queryStore.get(BackendEndpoint.ProxyCapabilities, orderModifier);
20246
+ const status = toValue$1(query.status);
20247
+ const fetchStatus = toValue$1(query.fetchStatus);
20248
+ if (status === "success") {
20249
+ return toValue$1(query.data) ?? [];
20250
+ }
20251
+ if (status === "error") {
20252
+ return void 0;
20253
+ }
20254
+ if (fetchStatus === "idle") {
20255
+ return void 0;
20256
+ }
20257
+ return "loading";
20258
+ };
20259
+ const computeOptions = (state) => {
20260
+ if (state === "loading") return [];
20261
+ const validCarrierNames = Array.isArray(state) ? new Set(state.map((c2) => c2.carrier)) : null;
20262
+ const carriersToRender = validCarrierNames ? dynamicContext.carriers.filter((carrier) => validCarrierNames.has(carrier.carrier ?? "")) : dynamicContext.carriers;
20263
+ return carriersToRender.map((carrier) => {
20264
+ const name = carrier.carrier ?? "";
20265
+ const meta = staticMeta.get(name);
20266
+ return {
20267
+ plainLabel: (meta == null ? void 0 : meta.label) ?? name,
20268
+ value: name,
20269
+ image: meta == null ? void 0 : meta.image
20270
+ };
20271
+ });
20272
+ };
19809
20273
  return defineFormField({
19810
20274
  name: FIELD_CARRIER,
19811
20275
  label: "carrier",
19812
- ref: createRef(refs, FIELD_CARRIER, PackageTypeName.Package),
20276
+ ref: createRef(refs, FIELD_CARRIER, dynamicContext.shop.defaultCarrier ?? void 0),
19813
20277
  component: resolveFormComponent(AdminComponent.RadioGroup),
19814
20278
  props: {
19815
20279
  options: []
19816
20280
  },
19817
20281
  onBeforeMount: async (field) => {
19818
20282
  var _a;
19819
- const carrierSelectOptions = await Promise.all(
20283
+ await Promise.all(
19820
20284
  dynamicContext.carriers.map(async (carrier) => {
19821
- const query = useFetchCarrier(carrier.name);
20285
+ const query = useFetchCarrier(carrier.carrier);
19822
20286
  await query.suspense();
19823
- const apiCarrier = toValue(query.data);
19824
- let plainLabel = (apiCarrier == null ? void 0 : apiCarrier.human) ?? carrier.human ?? "";
19825
- if (!carrier.isDefault) {
19826
- plainLabel += ` ${carrier.label ?? translate2(`carrier_type_${carrier.type}`)}`;
19827
- }
19828
- return {
19829
- plainLabel,
19830
- value: carrier.externalIdentifier ?? (apiCarrier == null ? void 0 : apiCarrier.name) ?? "",
20287
+ const apiCarrier = toValue$1(query.data);
20288
+ staticMeta.set(carrier.carrier ?? "", {
20289
+ label: (apiCarrier == null ? void 0 : apiCarrier.human) ?? translate2(`carrier_${snakeCase(carrier.carrier)}`) ?? "",
19831
20290
  image: (apiCarrier == null ? void 0 : apiCarrier.meta.logo_svg) ? createAssetUrl(apiCarrier.meta.logo_svg) : void 0
19832
- };
20291
+ });
19833
20292
  })
19834
20293
  );
19835
- setFieldProp(field, PROP_OPTIONS, carrierSelectOptions);
19836
- await ((_a = field == null ? void 0 : field.afterUpdate) == null ? void 0 : _a.call(field, field, toValue(field.ref), void 0));
19837
- updateFieldsDefaults(toValue(field.ref), field, inheritedDeliveryOptions);
20294
+ watch(
20295
+ () => readOrderCarriers(),
20296
+ (state) => {
20297
+ setFieldProp(field, PROP_OPTIONS, computeOptions(state));
20298
+ const carrier = capabilities.getCarrierCapabilitiesForOrder(field.form);
20299
+ if (carrier) {
20300
+ setFieldProp(field.form, FIELD_PACKAGE_TYPE, PROP_OPTIONS, getPackageTypes(carrier));
20301
+ setFieldProp(field.form, FIELD_DELIVERY_TYPE, PROP_OPTIONS, getDeliveryTypes(carrier));
20302
+ }
20303
+ },
20304
+ { immediate: true }
20305
+ );
20306
+ await ((_a = field == null ? void 0 : field.afterUpdate) == null ? void 0 : _a.call(field, field, toValue$1(field.ref), void 0));
20307
+ updateFieldsDefaults(toValue$1(field.ref), field, inheritedDeliveryOptions);
19838
20308
  },
19839
20309
  afterUpdate: (field, newCarrier) => {
19840
20310
  updateFieldsDefaults(newCarrier, field, inheritedDeliveryOptions);
19841
- setFieldProp(field.form, FIELD_INSURANCE, PROP_OPTIONS, getInsuranceOptions(field, formatter));
19842
- setFieldProp(field.form, FIELD_PACKAGE_TYPE, PROP_OPTIONS, getPackageTypes(field.form));
19843
- setFieldProp(field.form, FIELD_DELIVERY_TYPE, PROP_OPTIONS, getDeliveryTypes(field.form));
19844
- setPostNlAgeCheckSubtext(field);
20311
+ const carrier = capabilities.getCarrierCapabilitiesForOrder(field.form);
20312
+ setFieldProp(field.form, FIELD_PACKAGE_TYPE, PROP_OPTIONS, getPackageTypes(carrier));
20313
+ setFieldProp(field.form, FIELD_DELIVERY_TYPE, PROP_OPTIONS, getDeliveryTypes(carrier));
19845
20314
  }
19846
20315
  });
19847
20316
  };
19848
20317
  const createDigitalStampRangeField = (refs, order) => {
19849
20318
  var _a, _b;
19850
20319
  const pluginSettings = usePluginSettings();
19851
- const fallbackOrderData = order ? void 0 : toValue(useOrderData().order);
20320
+ const fallbackOrderData = order ? void 0 : toValue$1(useOrderData().order);
19852
20321
  const orderData = order ?? fallbackOrderData;
19853
20322
  const { initialWeight, manualWeight } = (orderData == null ? void 0 : orderData.physicalProperties) ?? {};
19854
20323
  const totalWeight = Number(initialWeight) + Number(pluginSettings.order.emptyDigitalStampWeight ?? 0);
@@ -19859,8 +20328,9 @@ const createDigitalStampRangeField = (refs, order) => {
19859
20328
  label: "weight_range",
19860
20329
  ref: ref(selectedValue ?? TriState.Inherit),
19861
20330
  component: resolveFormComponent(AdminComponent.SelectInput),
19862
- visibleWhen: (field) => PackageTypeName.DigitalStamp === field.form.getValue(FIELD_PACKAGE_TYPE),
19863
- disabledWhen: (field) => PackageTypeName.DigitalStamp !== field.form.getValue(FIELD_PACKAGE_TYPE),
20331
+ // @TODO Remove package type checks when the context provides visibility restrictions per option.
20332
+ visibleWhen: (field) => field.form.getValue(FIELD_PACKAGE_TYPE) === "DIGITAL_STAMP",
20333
+ disabledWhen: (field) => field.form.getValue(FIELD_PACKAGE_TYPE) !== "DIGITAL_STAMP",
19864
20334
  props: {
19865
20335
  subtext: {
19866
20336
  key: "order_weight",
@@ -19873,19 +20343,22 @@ const createDigitalStampRangeField = (refs, order) => {
19873
20343
  }
19874
20344
  });
19875
20345
  };
19876
- const createDirectReturnField = (refs) => {
19877
- return createShipmentOptionField(refs, FIELD_DIRECT_RETURN);
19878
- };
19879
- const createInsuranceField = (refs) => {
20346
+ const createInsuranceField = (refs, fieldName) => {
19880
20347
  const formatter = useLocalizedFormatter();
19881
- return createShipmentOptionField(refs, FIELD_INSURANCE, {
19882
- ref: createRef(refs, FIELD_INSURANCE, 0),
20348
+ const capabilities = useFormCapabilities();
20349
+ let stopWatcher;
20350
+ return createShipmentOptionField(refs, fieldName, {
20351
+ ref: createRef(refs, fieldName, 0),
19883
20352
  component: resolveFormComponent(AdminComponent.SelectInput),
19884
- visibleWhen: createHasShipmentOptionWatcher(INSURANCE, false, isPackageTypePackageOrSmall),
19885
- disabledWhen: createHasShipmentOptionWatcher(INSURANCE, true, isPackageTypePackageOrSmall),
19886
20353
  onBeforeMount(field) {
19887
- const insurancePossibilities = getInsuranceOptions(field, formatter);
19888
- setFieldProp(field, PROP_OPTIONS, insurancePossibilities);
20354
+ stopWatcher == null ? void 0 : stopWatcher();
20355
+ stopWatcher = watch(
20356
+ () => capabilities.getCarrierCapabilitiesForShipment(field.form),
20357
+ () => {
20358
+ setFieldProp(field, PROP_OPTIONS, capabilities.getInsuranceOptions(field.form, formatter));
20359
+ },
20360
+ { immediate: true }
20361
+ );
19889
20362
  }
19890
20363
  });
19891
20364
  };
@@ -19901,53 +20374,17 @@ const createLabelAmountField = (refs) => {
19901
20374
  }
19902
20375
  });
19903
20376
  };
19904
- const createLargeFormatField = (refs) => {
19905
- return createShipmentOptionField(refs, FIELD_LARGE_FORMAT);
19906
- };
19907
- const createOnlyRecipientField = (refs) => {
19908
- return createShipmentOptionField(refs, FIELD_ONLY_RECIPIENT, {
19909
- readOnlyWhen: ({ form }) => hasPostNlAgeCheck(form),
19910
- afterUpdate({ form }, value) {
19911
- if (!(CarrierName.DhlForYou === getFormCarrierName(form) && TriState.On === value)) {
19912
- return;
19913
- }
19914
- form.setValue(FIELD_AGE_CHECK, TriState.Off);
19915
- }
19916
- });
19917
- };
19918
20377
  const createPackageTypeField = (refs) => {
19919
20378
  return defineFormField({
19920
20379
  name: FIELD_PACKAGE_TYPE,
19921
20380
  label: snakeCase(`${SHIPMENT_OPTIONS}_package_type`),
19922
- ref: createRef(refs, FIELD_PACKAGE_TYPE, PackageTypeName.Package),
20381
+ ref: createRef(refs, FIELD_PACKAGE_TYPE, "PACKAGE"),
19923
20382
  component: resolveFormComponent(AdminComponent.RadioGroup)
19924
20383
  // options defined in afterUpdate of `createCarrierField`
19925
20384
  });
19926
20385
  };
19927
- const createPriorityDeliveryField = (refs) => {
19928
- return createShipmentOptionField(refs, FIELD_PRIORITY_DELIVERY, {
19929
- visibleWhen: createHasShipmentOptionWatcher(PRIORITY_DELIVERY, false, isPackageTypeMailbox),
19930
- disabledWhen: createHasShipmentOptionWatcher(PRIORITY_DELIVERY, true, isPackageTypeMailbox)
19931
- });
19932
- };
19933
- const createSameDayDeliveryField = (refs) => {
19934
- return createShipmentOptionField(refs, FIELD_SAME_DAY_DELIVERY);
19935
- };
19936
- const createSignatureField = (refs) => {
19937
- return createShipmentOptionField(refs, FIELD_SIGNATURE, {
19938
- readOnlyWhen: ({ form }) => hasPostNlAgeCheck(form)
19939
- });
19940
- };
19941
- const createReceiptCodeField = (refs) => {
19942
- return createShipmentOptionField(refs, FIELD_RECEIPT_CODE, {
19943
- readOnlyWhen: ({ form }) => hasPostNlAgeCheck(form),
19944
- afterUpdate({ form }, value) {
19945
- if (!(CarrierName.DhlForYou === getFormCarrierName(form) && TriState.On === value)) {
19946
- return;
19947
- }
19948
- form.setValue(FIELD_AGE_CHECK, TriState.Off);
19949
- }
19950
- });
20386
+ const fieldFactoryRegistry = {
20387
+ insurance: createInsuranceField
19951
20388
  };
19952
20389
  const createShipmentOptionsForm = (orders) => {
19953
20390
  var _a, _b;
@@ -19960,34 +20397,68 @@ const createShipmentOptionsForm = (orders) => {
19960
20397
  addBulkEditNotification(isModal);
19961
20398
  }
19962
20399
  const order = (isBulk ? void 0 : ordersArray[0]) ?? {};
19963
- const refs = ALL_FIELDS.reduce((acc, fieldName) => {
19964
- acc[fieldName] = get(order, fieldName);
19965
- return acc;
19966
- }, {});
19967
- refs[FIELD_CARRIER] = get(order, `${FIELD_CARRIER}.externalIdentifier`);
19968
- return Ne(createShipmentFormName(order.externalIdentifier), {
20400
+ const dynamicContext = useContext(AdminContextKey.Dynamic);
20401
+ const allOptionKeys = collectAllOptionKeys(dynamicContext.carriers);
20402
+ const refs = buildDynamicRefs(order, allOptionKeys);
20403
+ const form = Ne(createShipmentFormName(order.externalIdentifier), {
19969
20404
  ...isModal ? (_a = config.formConfigOverrides) == null ? void 0 : _a.modal : null,
19970
20405
  ...(_b = config.formConfigOverrides) == null ? void 0 : _b.shipmentOptions,
19971
- fields: [
19972
- // General delivery options
19973
- createCarrierField(refs, order.inheritedDeliveryOptions),
19974
- createPackageTypeField(refs),
19975
- createDeliveryTypeField(refs),
19976
- createLabelAmountField(refs),
19977
- createDigitalStampRangeField(refs, order),
19978
- // Actual shipment options
19979
- createAgeCheckField(refs),
19980
- createSignatureField(refs),
19981
- createOnlyRecipientField(refs),
19982
- createDirectReturnField(refs),
19983
- createLargeFormatField(refs),
19984
- createHideSenderField(refs),
19985
- createSameDayDeliveryField(refs),
19986
- createReceiptCodeField(refs),
19987
- createInsuranceField(refs),
19988
- createPriorityDeliveryField(refs)
19989
- ]
20406
+ fields: createShipmentOptionsFields(refs, order, allOptionKeys)
19990
20407
  });
20408
+ if (!isBulk && order.externalIdentifier) {
20409
+ const wired = wireProxyCapabilities(form, order);
20410
+ if (wired) {
20411
+ useCapabilitiesAutoClear(
20412
+ form,
20413
+ allOptionKeys,
20414
+ order.externalIdentifier,
20415
+ order.inheritedDeliveryOptions,
20416
+ wired.selection
20417
+ );
20418
+ }
20419
+ }
20420
+ return form;
20421
+ };
20422
+ const collectAllOptionKeys = (carriers) => {
20423
+ const keys = /* @__PURE__ */ new Set();
20424
+ for (const carrier of carriers) {
20425
+ if (!carrier.options) continue;
20426
+ for (const key of Object.keys(carrier.options)) {
20427
+ keys.add(key);
20428
+ }
20429
+ }
20430
+ return [...keys];
20431
+ };
20432
+ const buildDynamicRefs = (order, optionKeys) => {
20433
+ const refs = {};
20434
+ refs[FIELD_CARRIER] = get(order, `${FIELD_CARRIER}.carrier`);
20435
+ refs[FIELD_LABEL_AMOUNT] = get(order, FIELD_LABEL_AMOUNT);
20436
+ refs[FIELD_PACKAGE_TYPE] = get(order, FIELD_PACKAGE_TYPE);
20437
+ refs[FIELD_DELIVERY_TYPE] = get(order, FIELD_DELIVERY_TYPE);
20438
+ refs[FIELD_MANUAL_WEIGHT] = get(order, FIELD_MANUAL_WEIGHT);
20439
+ for (const key of optionKeys) {
20440
+ const fieldName = `${FIELD_SHIPMENT_OPTIONS_PREFIX}.${key}`;
20441
+ refs[fieldName] = get(order, fieldName);
20442
+ }
20443
+ return refs;
20444
+ };
20445
+ const createShipmentOptionsFields = (refs, order, optionKeys) => {
20446
+ const staticFields = [
20447
+ createCarrierField(refs, order.inheritedDeliveryOptions),
20448
+ createPackageTypeField(refs),
20449
+ createDeliveryTypeField(refs),
20450
+ createLabelAmountField(refs),
20451
+ createDigitalStampRangeField(refs, order)
20452
+ ];
20453
+ const dynamicFields = optionKeys.map((key) => {
20454
+ const fieldName = `${FIELD_SHIPMENT_OPTIONS_PREFIX}.${key}`;
20455
+ const factory = fieldFactoryRegistry[key];
20456
+ if (factory) {
20457
+ return factory(refs, fieldName);
20458
+ }
20459
+ return createShipmentOptionField(refs, fieldName);
20460
+ });
20461
+ return [...staticFields, ...dynamicFields];
19991
20462
  };
19992
20463
  const createLabel = (label, type) => {
19993
20464
  return label ? `${label}_${type}` : void 0;
@@ -20004,6 +20475,20 @@ const addBulkEditNotification = (isModal) => {
20004
20475
  timeout: false
20005
20476
  });
20006
20477
  };
20478
+ const CAPABILITIES_CLEARED_NOTIFICATION_ID = "capabilities_cleared";
20479
+ const addCapabilitiesClearNotification = (notificationStore, title, lines) => {
20480
+ if (lines.length === 0) return;
20481
+ const isModal = AdminModalKey.ShipmentOptions === useModalStore().opened;
20482
+ notificationStore.remove(CAPABILITIES_CLEARED_NOTIFICATION_ID);
20483
+ notificationStore.add({
20484
+ id: CAPABILITIES_CLEARED_NOTIFICATION_ID,
20485
+ variant: Variant.Warning,
20486
+ title,
20487
+ content: lines,
20488
+ category: isModal ? NotificationCategory.Modal : NotificationCategory.Action,
20489
+ timeout: false
20490
+ });
20491
+ };
20007
20492
  const createDefaultOption = (value) => ({
20008
20493
  label: {
20009
20494
  key: "option_inherit_value",
@@ -20013,16 +20498,6 @@ const createDefaultOption = (value) => ({
20013
20498
  },
20014
20499
  value: TriState.Inherit
20015
20500
  });
20016
- const isPackageTypePackage = (form) => {
20017
- return PackageTypeName.Package === form.getValue(FIELD_PACKAGE_TYPE);
20018
- };
20019
- const hasShipmentOption = (form, option) => {
20020
- const carrier = getCarrier(form);
20021
- return Boolean(carrier == null ? void 0 : carrier.capabilities.shipmentOptions[option]);
20022
- };
20023
- const createHasShipmentOptionWatcher = (shipmentOption, invert = false, validator = isPackageTypePackage) => {
20024
- return ({ form }) => (validator(form) && hasShipmentOption(form, shipmentOption)) !== invert;
20025
- };
20026
20501
  const defineFormField = (config) => {
20027
20502
  const { props, label } = config;
20028
20503
  return Xe({
@@ -20034,59 +20509,24 @@ const defineFormField = (config) => {
20034
20509
  }
20035
20510
  });
20036
20511
  };
20037
- const getFieldLabel = (name) => snakeCase(`${SHIPMENT_OPTIONS}_${name}`);
20038
- const getFormCarrierName = (form) => {
20039
- return resolveCarrier(form.getValue(FIELD_CARRIER));
20040
- };
20041
- const getInsuranceOptions = (field, formatter) => {
20042
- const carrier = getCarrier(field.form);
20043
- const insurancePossibilities = (carrier == null ? void 0 : carrier.capabilities.shipmentOptions.insurance) ?? [];
20044
- const carrierPossibilities = insurancePossibilities.map((amount) => ({
20045
- plainLabel: formatter.format(Format.Currency, amount / 100),
20046
- value: amount.toString()
20047
- }));
20048
- return [
20049
- {
20050
- label: "option_default",
20051
- value: TriState.Inherit
20052
- },
20053
- ...carrierPossibilities
20054
- ];
20055
- };
20056
- const getPackageTypes = (form) => {
20057
- let array = Object.values(PackageTypeName);
20058
- if (form) {
20059
- const carrier = getCarrier(form);
20060
- array = array.filter((name) => carrier == null ? void 0 : carrier.capabilities.packageTypes.includes(name));
20512
+ const getDeliveryTypes = (carrier) => {
20513
+ if (!carrier) {
20514
+ return [];
20061
20515
  }
20062
- return array.map((name) => ({
20063
- label: getPackageTypeTranslation(name),
20516
+ return carrier.deliveryTypes.map((name) => ({
20517
+ label: getDynamicTranslation("delivery_type", name),
20064
20518
  value: name
20065
20519
  }));
20066
20520
  };
20067
- const triStateFieldIsEnabled = (form, fieldName) => {
20068
- const field = form.getField(fieldName);
20069
- if (!field) {
20070
- return false;
20071
- }
20072
- const value = toValue(field.ref);
20073
- if (TriState.Inherit === value) {
20074
- return TriState.On === field.props.defaultValue;
20521
+ const getFieldLabel = (name) => snakeCase(`${SHIPMENT_OPTIONS}_${name}`);
20522
+ const getPackageTypes = (carrier) => {
20523
+ if (!carrier) {
20524
+ return [];
20075
20525
  }
20076
- return TriState.On === value;
20077
- };
20078
- const hasPostNlAgeCheck = (form) => {
20079
- const carrier = getFormCarrierName(form);
20080
- return CarrierName.PostNl === carrier && triStateFieldIsEnabled(form, FIELD_AGE_CHECK);
20081
- };
20082
- const isPackageTypeMailbox = (form) => {
20083
- return PackageTypeName.Mailbox === form.getValue(FIELD_PACKAGE_TYPE);
20084
- };
20085
- const isPackageTypeSmallPackage = (form) => {
20086
- return PackageTypeName.PackageSmall === form.getValue(FIELD_PACKAGE_TYPE);
20087
- };
20088
- const isPackageTypePackageOrSmall = (form) => {
20089
- return isPackageTypePackage(form) || isPackageTypeSmallPackage(form);
20526
+ return carrier.packageTypes.map((packageType) => ({
20527
+ label: getPackageTypeTranslation(packageType),
20528
+ value: packageType
20529
+ }));
20090
20530
  };
20091
20531
  const memoizedResolveFormComponent = memoize((componentName) => {
20092
20532
  return resolveComponent(prefixComponent(componentName));
@@ -20112,16 +20552,8 @@ const setFieldProp = (arg1, arg2, arg3, arg4) => {
20112
20552
  }
20113
20553
  field.props[key] = value;
20114
20554
  };
20115
- const setPostNlAgeCheckSubtext = ({ form }) => {
20116
- const defaultKey = createLabel(getFieldLabel(AGE_CHECK), KEY_SUBTEXT);
20117
- if (hasPostNlAgeCheck(form)) {
20118
- setFieldProp(form, FIELD_AGE_CHECK, KEY_SUBTEXT, `${defaultKey}_${CarrierName.PostNl}`);
20119
- } else {
20120
- setFieldProp(form, FIELD_AGE_CHECK, KEY_SUBTEXT, defaultKey);
20121
- }
20122
- };
20123
20555
  const updateFieldsDefaults = (carrier, { form, name }, inheritedDeliveryOptions) => {
20124
- toValue(form.fields).forEach((otherField) => {
20556
+ toValue$1(form.fields).forEach((otherField) => {
20125
20557
  if (otherField.name === name) {
20126
20558
  return;
20127
20559
  }
@@ -20130,6 +20562,71 @@ const updateFieldsDefaults = (carrier, { form, name }, inheritedDeliveryOptions)
20130
20562
  otherField.props.defaultValue = get(inheritedDeliveryOptions, [carrier, ...optionPathParts]);
20131
20563
  });
20132
20564
  };
20565
+ const useFormCapabilities = () => {
20566
+ const queryStore = useQueryStore();
20567
+ const dynamicContextQuery = queryStore.get(BackendEndpoint.FetchContext, AdminContextKey.Dynamic);
20568
+ const orderId = getOrderId();
20569
+ const orderModifier = typeof orderId === "string" ? `${orderId}.order` : void 0;
20570
+ const shipmentModifier = typeof orderId === "string" ? `${orderId}.shipment` : void 0;
20571
+ const carriersFromQuery = (modifier) => {
20572
+ if (!queryStore.has(BackendEndpoint.ProxyCapabilities, modifier)) return void 0;
20573
+ const query = queryStore.get(BackendEndpoint.ProxyCapabilities, modifier);
20574
+ if (toValue$1(query.status) !== "success") return void 0;
20575
+ return toValue$1(query.data) ?? [];
20576
+ };
20577
+ const liveDynamicCarriers = () => {
20578
+ const data = toValue$1(dynamicContextQuery.data);
20579
+ return (data == null ? void 0 : data.carriers) ?? [];
20580
+ };
20581
+ const getCarrierCapabilitiesForOrder = (form) => {
20582
+ const chosenCarrier = form.getValue(FIELD_CARRIER);
20583
+ if (orderModifier) {
20584
+ const carriers = carriersFromQuery(orderModifier);
20585
+ const fromQuery = carriers == null ? void 0 : carriers.find((carrier) => carrier.carrier === chosenCarrier);
20586
+ if (fromQuery) return fromQuery;
20587
+ }
20588
+ return liveDynamicCarriers().find((carrier) => carrier.carrier === chosenCarrier);
20589
+ };
20590
+ const getCarrierCapabilitiesForShipment = (form) => {
20591
+ if (!shipmentModifier) return getCarrierCapabilitiesForOrder(form);
20592
+ const carriers = carriersFromQuery(shipmentModifier);
20593
+ if (!carriers) return getCarrierCapabilitiesForOrder(form);
20594
+ const chosenCarrier = form.getValue(FIELD_CARRIER);
20595
+ return carriers.find((carrier) => carrier.carrier === chosenCarrier);
20596
+ };
20597
+ const hasShipmentOption = (form, option) => {
20598
+ const carrier = getCarrierCapabilitiesForShipment(form);
20599
+ return Object.hasOwn((carrier == null ? void 0 : carrier.options) ?? {}, option);
20600
+ };
20601
+ const getInsuranceOptions = (form, formatter) => {
20602
+ var _a, _b, _c;
20603
+ const STEP_BELOW_THRESHOLD = 250;
20604
+ const STEP_ABOVE_THRESHOLD = 500;
20605
+ const STEP_THRESHOLD = 500;
20606
+ const carrier = getCarrierCapabilitiesForShipment(form);
20607
+ const insuranceData = ((_a = carrier == null ? void 0 : carrier.options) == null ? void 0 : _a.insurance) ?? {};
20608
+ const min = ((_b = insuranceData.insuredAmount) == null ? void 0 : _b.min.amount) ? insuranceData.insuredAmount.min.amount / 100 : 0;
20609
+ const max = ((_c = insuranceData.insuredAmount) == null ? void 0 : _c.max.amount) ? insuranceData.insuredAmount.max.amount / 100 : 0;
20610
+ if (max === 0) return [];
20611
+ const insurancePossibilities = [];
20612
+ for (let i = min; i <= max; i += i < STEP_THRESHOLD ? STEP_BELOW_THRESHOLD : STEP_ABOVE_THRESHOLD) {
20613
+ insurancePossibilities.push(i * 100);
20614
+ }
20615
+ return [
20616
+ { label: "option_default", value: TriState.Inherit },
20617
+ ...insurancePossibilities.map((amount) => ({
20618
+ plainLabel: formatter.format(Format.Currency, amount / 100),
20619
+ value: amount.toString()
20620
+ }))
20621
+ ];
20622
+ };
20623
+ return {
20624
+ getCarrierCapabilitiesForOrder,
20625
+ getCarrierCapabilitiesForShipment,
20626
+ hasShipmentOption,
20627
+ getInsuranceOptions
20628
+ };
20629
+ };
20133
20630
  const createFormTab = (tab) => {
20134
20631
  const language = useLanguage();
20135
20632
  const children = [h$1("div", {}, h$1(xe, { form: tab.form }))];
@@ -20167,11 +20664,14 @@ const generateFormFields = ({ fields, values }, prefix = "") => {
20167
20664
  });
20168
20665
  });
20169
20666
  };
20667
+ const resolveSettingsValues = (pluginSettings, id) => {
20668
+ return get(pluginSettings, id) ?? get(pluginSettings, id.replace(/\.[^.]+$/, ".*"), {});
20669
+ };
20170
20670
  const createPluginSettingsForm = (id, view, context) => {
20171
20671
  var _a;
20172
20672
  const { pluginSettings, actionContext } = context;
20173
20673
  const mutation = useStoreQuery(BackendEndpoint.UpdatePluginSettings);
20174
- const values = get(pluginSettings, id, {});
20674
+ const values = resolveSettingsValues(pluginSettings, id);
20175
20675
  const generatedFields = generateFormFields({ fields: view.elements, values }, `${id}.`);
20176
20676
  return Ne(id, {
20177
20677
  ...(_a = context.config.formConfigOverrides) == null ? void 0 : _a.pluginSettings,
@@ -20231,6 +20731,48 @@ const createPluginSettingsTabs = (view, context) => {
20231
20731
  return { ...tab, component: markRaw(createPluginSettingsTabsComponent(id, view2, context)) };
20232
20732
  });
20233
20733
  };
20734
+ const GENERAL_SECTION_HEADING = "settings_order_general_title";
20735
+ const SHIPMENT_EXPORT_FIELDS = /* @__PURE__ */ new Set(["conceptShipments", "saveCustomerAddress"]);
20736
+ const isSettingsDivider = (field) => {
20737
+ return field.$component === "SettingsDivider";
20738
+ };
20739
+ const isGeneralDivider = (field) => {
20740
+ return isSettingsDivider(field) && field.heading === GENERAL_SECTION_HEADING;
20741
+ };
20742
+ const filterOrderElements = (elements, orderMode) => {
20743
+ let inGeneralSection = false;
20744
+ return elements.filter((field) => {
20745
+ if (isGeneralDivider(field)) {
20746
+ inGeneralSection = true;
20747
+ } else if (isSettingsDivider(field)) {
20748
+ inGeneralSection = false;
20749
+ }
20750
+ if (!inGeneralSection) {
20751
+ return true;
20752
+ }
20753
+ if (SHIPMENT_EXPORT_FIELDS.has(field.name ?? "")) {
20754
+ return orderMode !== OrderMode.OrderV1;
20755
+ }
20756
+ return true;
20757
+ });
20758
+ };
20759
+ const filterPluginSettingsView = (view, orderMode) => {
20760
+ const entries = Object.entries(view);
20761
+ return Object.fromEntries(
20762
+ entries.map(([tabId, tabView]) => {
20763
+ if (tabId !== "order" || !tabView.elements) {
20764
+ return [tabId, tabView];
20765
+ }
20766
+ return [
20767
+ tabId,
20768
+ {
20769
+ ...tabView,
20770
+ elements: filterOrderElements(tabView.elements, orderMode)
20771
+ }
20772
+ ];
20773
+ })
20774
+ );
20775
+ };
20234
20776
  const _sfc_main$n = /* @__PURE__ */ defineComponent({
20235
20777
  name: "ReturnsForm",
20236
20778
  components: {
@@ -20313,7 +20855,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
20313
20855
  const props = __props;
20314
20856
  const propRefs = toRefs(props);
20315
20857
  const queries = useOrdersData(propRefs.order.value);
20316
- const shipmentOptionsForm = createShipmentOptionsForm(queries.map((data) => toValue(data.order)).filter(isDef));
20858
+ const shipmentOptionsForm = createShipmentOptionsForm(queries.map((data) => toValue$1(data.order)).filter(isDef));
20317
20859
  return (_ctx, _cache) => {
20318
20860
  return openBlock(), createBlock(unref(xe), { form: unref(shipmentOptionsForm) }, null, 8, ["form"]);
20319
20861
  };
@@ -20583,6 +21125,7 @@ const createRegisterComponentsPlugin = ({ config, logger }) => {
20583
21125
  });
20584
21126
  Object.entries(getOptionalComponents(app)).forEach(([componentName, component]) => {
20585
21127
  const componentToRegister = typeof component === "string" ? componentsFromConfig[component] : component;
21128
+ if (!componentToRegister) return;
20586
21129
  app.component(prefixComponent(componentName), markRaw(componentToRegister));
20587
21130
  });
20588
21131
  const { translate: translate2 } = useLanguage();
@@ -20679,13 +21222,13 @@ const setupAdminApp = (app, appConfig) => {
20679
21222
  app.directive("test", testIdDirective);
20680
21223
  };
20681
21224
  const renderMap = Object.freeze({
20682
- [AdminView.ChildProductSettings]: async () => import("./ChildProductSettings-rOdhioOc.js"),
20683
- [AdminView.Modals]: async () => import("./Modals-C8V_zTNK.js"),
20684
- [AdminView.Notifications]: async () => import("./Notifications-Bax2ygnw.js"),
20685
- [AdminView.OrderBox]: async () => import("./OrderBox-B901YmGC.js"),
20686
- [AdminView.OrderListItem]: async () => import("./OrderListItem-CvN_Uz7u.js"),
20687
- [AdminView.PluginSettings]: async () => import("./PluginSettings-FphY6rec.js"),
20688
- [AdminView.ProductSettings]: async () => import("./ProductSettings-COt7oF2i.js")
21225
+ [AdminView.ChildProductSettings]: async () => import("./ChildProductSettings-s8z5afQ0.js"),
21226
+ [AdminView.Modals]: async () => import("./Modals-WFWEKC20.js"),
21227
+ [AdminView.Notifications]: async () => import("./Notifications-mywk4f35.js"),
21228
+ [AdminView.OrderBox]: async () => import("./OrderBox-CQNS7zO9.js"),
21229
+ [AdminView.OrderListItem]: async () => import("./OrderListItem-DH0iYnG8.js"),
21230
+ [AdminView.PluginSettings]: async () => import("./PluginSettings-ymxANIm1.js"),
21231
+ [AdminView.ProductSettings]: async () => import("./ProductSettings-CEHnUs2T.js")
20689
21232
  });
20690
21233
  const renderViewComponent = async (componentName) => {
20691
21234
  const renderMethod = renderMap[componentName];
@@ -20835,11 +21378,21 @@ const createShipmentFormName = (orderId) => {
20835
21378
  }
20836
21379
  return `${AdminModalKey.ShipmentOptions}_${orderId}`;
20837
21380
  };
21381
+ const getEnabledValues = (form) => {
21382
+ const values = {};
21383
+ for (const field of toValue$1(form.interactiveFields)) {
21384
+ if (toValue$1(field.isDisabled)) {
21385
+ continue;
21386
+ }
21387
+ values[field.name] = toValue$1(field.ref);
21388
+ }
21389
+ return values;
21390
+ };
20838
21391
  const formToBody = (form) => {
20839
21392
  if (!isOfType$1(form, "getValues")) {
20840
21393
  return form ? form : {};
20841
21394
  }
20842
- const formValues = form.getValues();
21395
+ const formValues = getEnabledValues(form);
20843
21396
  return convertDotNotationToObject(formValues, (value) => {
20844
21397
  return typeof value === "boolean" ? Number(value) : value;
20845
21398
  });
@@ -20874,7 +21427,7 @@ const getOrderId = (instance) => {
20874
21427
  const getOrderShipmentIds = (orderIds) => {
20875
21428
  return useOrdersData(orderIds).map(({ order }) => {
20876
21429
  var _a;
20877
- return (_a = toValue(order)) == null ? void 0 : _a.shipments;
21430
+ return (_a = toValue$1(order)) == null ? void 0 : _a.shipments;
20878
21431
  }).flat().filter(isDef).map((shipment) => shipment.id);
20879
21432
  };
20880
21433
  const fakeLinkClick = (url, attributes) => {
@@ -20916,14 +21469,11 @@ const setQueryOrder = (queryClient2, order) => {
20916
21469
  const setQueryShipment = (queryClient2, shipment) => {
20917
21470
  setQueryData(queryClient2, [QUERY_KEY_SHIPMENT, { id: shipment.id }], shipment);
20918
21471
  };
20919
- const resolveCarrier = (carrierNameOrIdentifier) => {
20920
- return carrierNameOrIdentifier.split(":")[0];
20921
- };
20922
21472
  const getDynamicTranslation = (prefix, input) => {
20923
21473
  if (!input) {
20924
21474
  return prefix;
20925
21475
  }
20926
- return `${prefix}_${input}`;
21476
+ return `${prefix}_${input.toLowerCase()}`;
20927
21477
  };
20928
21478
  const getPackageTypeTranslation = (name) => getDynamicTranslation("package_type", name);
20929
21479
  const translateSelectOption = (option, translate2) => {
@@ -20979,6 +21529,12 @@ const useQueryStore = defineStore("query", () => {
20979
21529
  queries.value[key] = query;
20980
21530
  return query;
20981
21531
  };
21532
+ const unregister = (endpoint, modifier) => {
21533
+ const key = createQueryCacheKey(endpoint, modifier);
21534
+ if (queries.value[key] === void 0) return;
21535
+ globalLogger.debug(`Unregistering query ${key}`);
21536
+ delete queries.value[key];
21537
+ };
20982
21538
  const registerShipmentQueries = (shipmentIds, orderIds) => {
20983
21539
  toArray(validateId(unref(orderIds) ?? getOrderId(), true)).forEach((orderId) => {
20984
21540
  toArray(unref(shipmentIds)).forEach((shipmentId) => {
@@ -21010,6 +21566,7 @@ const useQueryStore = defineStore("query", () => {
21010
21566
  get: get2,
21011
21567
  has: has2,
21012
21568
  register,
21569
+ unregister,
21013
21570
  registerShipmentQueries,
21014
21571
  /**
21015
21572
  * Register queries needed to render any order related component.
@@ -21019,7 +21576,7 @@ const useQueryStore = defineStore("query", () => {
21019
21576
  toArray(id).forEach((orderId2) => {
21020
21577
  var _a, _b;
21021
21578
  const ordersQuery = register(BackendEndpoint.FetchOrders, orderId2, useFetchOrdersQuery(orderId2));
21022
- (_b = (_a = toValue(ordersQuery.data)) == null ? void 0 : _a.shipments) == null ? void 0 : _b.forEach((shipment) => registerShipmentQueries(shipment.id, orderId2));
21579
+ (_b = (_a = toValue$1(ordersQuery.data)) == null ? void 0 : _a.shipments) == null ? void 0 : _b.forEach((shipment) => registerShipmentQueries(shipment.id, orderId2));
21023
21580
  register(BackendEndpoint.FetchOrders, orderId2, useFetchOrdersQuery(orderId2));
21024
21581
  register(BackendEndpoint.ExportOrders, orderId2, useExportOrdersMutation(orderId2, mode));
21025
21582
  register(BackendEndpoint.PrintOrders, orderId2, usePrintOrdersMutation(orderId2));
@@ -21064,7 +21621,7 @@ const useStoreContextQuery = (contextKey) => {
21064
21621
  };
21065
21622
  const useContext = (contextKey = AdminContextKey.Dynamic) => {
21066
21623
  const query = useStoreContextQuery(contextKey);
21067
- const data = toValue(query.data);
21624
+ const data = toValue$1(query.data);
21068
21625
  if (!data) {
21069
21626
  throw new Error(`Context ${contextKey} not found`);
21070
21627
  }
@@ -21125,6 +21682,16 @@ const useModalOrder = () => {
21125
21682
  }
21126
21683
  return null;
21127
21684
  };
21685
+ const useOrderMode = () => {
21686
+ const context = useContext();
21687
+ return computed(() => {
21688
+ var _a, _b;
21689
+ const effective = orderModeFromContextValue(
21690
+ (_a = context.account) == null ? void 0 : _a.effectiveOrderMode
21691
+ );
21692
+ return effective ?? resolveOrderMode(((_b = context.account) == null ? void 0 : _b.subscriptionFeatures) ?? []);
21693
+ });
21694
+ };
21128
21695
  const usePluginSettings = () => {
21129
21696
  const context = useContext();
21130
21697
  if (!context.pluginSettings) {
@@ -21241,14 +21808,14 @@ const useInputWithOptionsContext = (props, emit2, multiple) => {
21241
21808
  watch(
21242
21809
  options,
21243
21810
  (newOptions) => {
21244
- const values = toArray(toValue(model));
21811
+ const values = toArray(toValue$1(model));
21245
21812
  const hasExistingValue = values.length && newOptions.some((option) => values.includes(option.value));
21246
21813
  if (hasExistingValue || newOptions.length === 0) {
21247
21814
  return;
21248
21815
  }
21249
21816
  model.value = multiple ? [newOptions[0].value] : newOptions[0].value;
21250
21817
  },
21251
- { immediate: Number((_a = toValue(options)) == null ? void 0 : _a.length) > 0 }
21818
+ { immediate: Number((_a = toValue$1(options)) == null ? void 0 : _a.length) > 0 }
21252
21819
  );
21253
21820
  });
21254
21821
  return { id, options, model };
@@ -21458,7 +22025,7 @@ const useDropdownButtonContext = (props) => {
21458
22025
  const propRefs = toRefs(props);
21459
22026
  return {
21460
22027
  dropdownActions: computed(() => {
21461
- const [standalone, hidden] = partitionArray(toValue(propRefs.actions), (action) => action.standalone === true);
22028
+ const [standalone, hidden] = partitionArray(toValue$1(propRefs.actions), (action) => action.standalone === true);
21462
22029
  return {
21463
22030
  standalone,
21464
22031
  hidden
@@ -21487,9 +22054,9 @@ const useMultiSelectInputContext = (props, emit2) => {
21487
22054
  const useRadioGroupContext = (props, emit2) => {
21488
22055
  const context = useInputWithOptionsContext(props, emit2);
21489
22056
  const elements = computed(() => {
21490
- const optionValues = (toValue(context.options) ?? []).map((option) => option.value);
22057
+ const optionValues = (toValue$1(context.options) ?? []).map((option) => option.value);
21491
22058
  return createObjectWithKeys(optionValues, (value) => {
21492
- const option = (toValue(context.options) ?? []).find((option2) => option2.value === value);
22059
+ const option = (toValue$1(context.options) ?? []).find((option2) => option2.value === value);
21493
22060
  return createFormElement({
21494
22061
  ref: context.model,
21495
22062
  name: `${props.element.name}${value.toString()}`,
@@ -21606,13 +22173,13 @@ const useTableContext = (props) => {
21606
22173
  return { transition };
21607
22174
  };
21608
22175
  const useToggleInputContext = (props, emit2) => {
21609
- const toggleModel = ref(triStateToBoolean(toValue(props.modelValue)));
22176
+ const toggleModel = ref(triStateToBoolean(toValue$1(props.modelValue)));
21610
22177
  const { id, model } = useElementContext(props, emit2);
21611
22178
  watch(toggleModel, (toggle) => {
21612
22179
  model.value = booleanToTriState(toggle);
21613
22180
  });
21614
- watch(model, (model2) => {
21615
- toggleModel.value = triStateToBoolean(model2);
22181
+ watch(model, (modelVal) => {
22182
+ toggleModel.value = triStateToBoolean(modelVal);
21616
22183
  });
21617
22184
  return {
21618
22185
  id,
@@ -21624,8 +22191,8 @@ const useToggleInputContext = (props, emit2) => {
21624
22191
  const useTriStateInputContext = (props, emit2) => {
21625
22192
  const { translate: translate2 } = useLanguage();
21626
22193
  const form = M();
21627
- const inheritModel = ref(TriState.Inherit === toValue(props.modelValue));
21628
- const toggleModel = ref(triStateToBoolean(toValue(props.modelValue)));
22194
+ const inheritModel = ref(TriState.Inherit === toValue$1(props.modelValue));
22195
+ const toggleModel = ref(triStateToBoolean(toValue$1(props.modelValue)));
21629
22196
  const { id, model } = useElementContext(props, emit2);
21630
22197
  const defaultValue = computed(() => {
21631
22198
  return props.element.props.defaultValue ?? TriState.Inherit;
@@ -21652,7 +22219,7 @@ const useTriStateInputContext = (props, emit2) => {
21652
22219
  name: `${props.element.name}__toggle`,
21653
22220
  ref: toggleModel,
21654
22221
  // The toggle is readonly when inherit is enabled or the element itself is set to readonly.
21655
- isReadOnly: markRaw(computed(() => toValue(inheritModel) || toValue(props.element.isReadOnly)))
22222
+ isReadOnly: markRaw(computed(() => toValue$1(inheritModel) || toValue$1(props.element.isReadOnly)))
21656
22223
  })
21657
22224
  );
21658
22225
  watch(toggleModel, (toggle) => {
@@ -21672,11 +22239,11 @@ const useTriStateInputContext = (props, emit2) => {
21672
22239
  model.value = TriState.Inherit;
21673
22240
  toggleModel.value = triStateToBoolean(defaultValue2 ?? TriState.Inherit);
21674
22241
  });
21675
- watch(model, (model2) => {
22242
+ watch(model, (modelVal) => {
21676
22243
  if (inheritModel.value) {
21677
22244
  return;
21678
22245
  }
21679
- toggleModel.value = triStateToBoolean(model2);
22246
+ toggleModel.value = triStateToBoolean(modelVal);
21680
22247
  });
21681
22248
  return {
21682
22249
  id,
@@ -21697,9 +22264,9 @@ const useOrderData = (externalIdentifier) => {
21697
22264
  const allQueries = queryStore.getQueriesForOrder(orderId);
21698
22265
  return {
21699
22266
  loading: computed(() => {
21700
- return Object.values(toValue(allQueries)).some((item) => item ? toValue(item.isLoading) : false);
22267
+ return Object.values(toValue$1(allQueries)).some((item) => item ? toValue$1(item.isLoading) : false);
21701
22268
  }),
21702
- order: computed(() => toValue(fetchQuery.data)),
22269
+ order: computed(() => toValue$1(fetchQuery.data)),
21703
22270
  query: fetchQuery
21704
22271
  };
21705
22272
  };
@@ -21716,7 +22283,7 @@ const useProductData = (externalIdentifier) => {
21716
22283
  const productId = validateId(externalIdentifier ?? useInstanceContext(AdminInstanceContextKey.ProductIdentifier));
21717
22284
  const fetchQuery = useStoreQuery(BackendEndpoint.FetchProducts, productId);
21718
22285
  return {
21719
- product: computed(() => toValue(fetchQuery.data)),
22286
+ product: computed(() => toValue$1(fetchQuery.data)),
21720
22287
  query: fetchQuery
21721
22288
  };
21722
22289
  };
@@ -21728,13 +22295,13 @@ const useShipmentData = (id) => {
21728
22295
  const shipmentId = unref(id);
21729
22296
  const queryStore = useQueryStore();
21730
22297
  const fetchQuery = useShipment(shipmentId);
21731
- const shipment = computed(() => toValue(fetchQuery.data));
21732
- const orderId = (_a = toValue(shipment)) == null ? void 0 : _a.orderId;
22298
+ const shipment = computed(() => toValue$1(fetchQuery.data));
22299
+ const orderId = (_a = toValue$1(shipment)) == null ? void 0 : _a.orderId;
21733
22300
  const allQueries = [
21734
22301
  queryStore.getQueriesForShipment(shipmentId),
21735
22302
  orderId ? queryStore.getQueriesForOrder(orderId) : void 0
21736
22303
  ].filter(Boolean);
21737
- const carrierName = (_c = (_b = shipment.value) == null ? void 0 : _b.carrier) == null ? void 0 : _c.name;
22304
+ const carrierName = (_c = (_b = shipment.value) == null ? void 0 : _b.carrier) == null ? void 0 : _c.carrier;
21738
22305
  const carriersQuery = carrierName ? useFetchCarrier(carrierName) : void 0;
21739
22306
  return {
21740
22307
  actions: instantiateActions(shipmentActions, {
@@ -21744,7 +22311,7 @@ const useShipmentData = (id) => {
21744
22311
  carrier: (carriersQuery == null ? void 0 : carriersQuery.data) ?? ref(),
21745
22312
  loading: computed(() => {
21746
22313
  return allQueries.some(
21747
- (obj) => Object.values(toValue(obj) ?? {}).some((item) => item ? toValue(item.isLoading) : false)
22314
+ (obj) => Object.values(toValue$1(obj) ?? {}).some((item) => item ? toValue$1(item.isLoading) : false)
21748
22315
  );
21749
22316
  }),
21750
22317
  shipment
@@ -21754,7 +22321,7 @@ const useDigitalStampRanges = (weight, order) => {
21754
22321
  const fallbackOrder = order ? null : useOrderData().order;
21755
22322
  const allRanges = computed(() => {
21756
22323
  var _a;
21757
- return ((_a = toValue(order ?? fallbackOrder)) == null ? void 0 : _a.digitalStampRanges) ?? [];
22324
+ return ((_a = toValue$1(order ?? fallbackOrder)) == null ? void 0 : _a.digitalStampRanges) ?? [];
21758
22325
  });
21759
22326
  const ranges = computed(() => {
21760
22327
  return allRanges.value.map((range) => ({
@@ -21763,7 +22330,7 @@ const useDigitalStampRanges = (weight, order) => {
21763
22330
  }));
21764
22331
  });
21765
22332
  const currentRange = computed(() => {
21766
- const resolvedWeight = toValue(weight);
22333
+ const resolvedWeight = toValue$1(weight);
21767
22334
  const matchingRange = allRanges.value.find((range) => range.min <= resolvedWeight && range.max >= resolvedWeight);
21768
22335
  return ranges.value.find((range) => range.value === (matchingRange == null ? void 0 : matchingRange.average)) ?? ranges.value[0];
21769
22336
  });
@@ -21780,21 +22347,21 @@ const useGlobalPdkAdmin = () => {
21780
22347
  return pdkAdmin;
21781
22348
  };
21782
22349
  const useLoadMore = (options) => {
21783
- const loaded = ref(options.start ?? options.step ?? toValue(options.items).length - 1);
21784
- const hasMore = computed(() => loaded.value < toValue(options.items).length - 1);
22350
+ const loaded = ref(options.start ?? options.step ?? toValue$1(options.items).length - 1);
22351
+ const hasMore = computed(() => loaded.value < toValue$1(options.items).length - 1);
21785
22352
  const loadMore = () => {
21786
22353
  if (!hasMore.value) {
21787
22354
  return;
21788
22355
  }
21789
22356
  const step = options.step ?? 1;
21790
- const maxLength = toValue(options.items).length;
22357
+ const maxLength = toValue$1(options.items).length;
21791
22358
  if (loaded.value + step > maxLength) {
21792
22359
  loaded.value = maxLength;
21793
22360
  } else {
21794
22361
  loaded.value += step;
21795
22362
  }
21796
22363
  };
21797
- const items = computed(() => toValue(options.items).slice(0, loaded.value));
22364
+ const items = computed(() => toValue$1(options.items).slice(0, loaded.value));
21798
22365
  return {
21799
22366
  items,
21800
22367
  loaded,
@@ -22050,7 +22617,7 @@ const useExportOrdersMutation = (orderIds, mode = MutationMode.Default) => {
22050
22617
  var _a2;
22051
22618
  fillShipmentsQueryData(queryClient2, ((_a2 = order.shipments) == null ? void 0 : _a2.slice(-1)) ?? [], order);
22052
22619
  });
22053
- if (input.form) {
22620
+ if (mode === MutationMode.Modal && input.form) {
22054
22621
  await ((_a = input.form) == null ? void 0 : _a.reset());
22055
22622
  }
22056
22623
  }
@@ -22500,7 +23067,7 @@ const resolveOrderParameters = ({
22500
23067
  var _a;
22501
23068
  const formBuilder = ne();
22502
23069
  parameters.orderIds ?? (parameters.orderIds = getOrderId(instance));
22503
- parameters.form ?? (parameters.form = (_a = toValue(formBuilder.forms)) == null ? void 0 : _a[createShipmentFormName(parameters.orderIds)]);
23070
+ parameters.form ?? (parameters.form = (_a = toValue$1(formBuilder.forms)) == null ? void 0 : _a[createShipmentFormName(parameters.orderIds)]);
22504
23071
  return Promise.resolve(parameters);
22505
23072
  };
22506
23073
  const updateAccountAction = defineAction({
@@ -22735,18 +23302,15 @@ const ordersPrintAction = defineAction({
22735
23302
  return context.response;
22736
23303
  }
22737
23304
  });
23305
+ const ORDER_VIEW_IN_BACKOFFICE_ID = "show-exported-order";
22738
23306
  const orderViewInBackofficeAction = defineAction({
22739
- id: "show-exported-order",
23307
+ id: ORDER_VIEW_IN_BACKOFFICE_ID,
22740
23308
  icon: AdminIcon.External,
22741
23309
  label: "order_view_in_backoffice",
22742
23310
  handler() {
22743
- const { platform } = useGlobalContext();
22744
- const backofficeUrls = {
22745
- NL: "https://backoffice.myparcel.nl/orders",
22746
- BE: "https://backoffice.sendmyparcel.be/orders"
22747
- };
22748
- const url = backofficeUrls[platform.localCountry] || backofficeUrls["NL"];
22749
- window.open(url, "_blank");
23311
+ const { proposition } = useGlobalContext();
23312
+ const baseUrl = proposition.backofficeUrl.replace(/\/$/, "");
23313
+ window.open(`${baseUrl}/orders`, "_blank");
22750
23314
  }
22751
23315
  });
22752
23316
  const pluginSettingsUpdateAction = defineAction({
@@ -22773,6 +23337,46 @@ const webhooksDeleteAction = defineAction({
22773
23337
  handler: createMutationHandler(BackendEndpoint.DeleteWebhooks),
22774
23338
  variant: Variant.Error
22775
23339
  });
23340
+ const STORE_MODE_ACTIONS = {
23341
+ [OrderMode.OrderV1]: [orderExportAction, orderViewInBackofficeAction],
23342
+ [OrderMode.Shipments]: [
23343
+ ordersPrintAction,
23344
+ orderExportToShipmentsAction,
23345
+ ordersExportPrintShipmentsAction,
23346
+ shipmentsExportReturnAction,
23347
+ shipmentsDeleteAction,
23348
+ shipmentsUpdateAction,
23349
+ shipmentsPrintAction
23350
+ ],
23351
+ // @TODO INT-1590: empty this array again once sales-channel detection gates V2.
23352
+ [OrderMode.OrderV2]: [
23353
+ ordersPrintAction,
23354
+ orderExportToShipmentsAction,
23355
+ ordersExportPrintShipmentsAction,
23356
+ shipmentsExportReturnAction,
23357
+ shipmentsDeleteAction,
23358
+ shipmentsUpdateAction,
23359
+ shipmentsPrintAction
23360
+ ]
23361
+ };
23362
+ const BOX_MODE_ACTIONS = {
23363
+ [OrderMode.OrderV1]: [orderExportAction],
23364
+ [OrderMode.Shipments]: [orderExportToShipmentsAction, ordersPrintAction, ordersExportPrintShipmentsAction],
23365
+ // @TODO INT-1590: empty this array again once sales-channel detection gates V2.
23366
+ [OrderMode.OrderV2]: [orderExportToShipmentsAction, ordersPrintAction, ordersExportPrintShipmentsAction]
23367
+ };
23368
+ const MODAL_MODE_ACTIONS = {
23369
+ [OrderMode.OrderV1]: [orderExportAction],
23370
+ [OrderMode.Shipments]: [orderExportToShipmentsAction, ordersExportPrintShipmentsAction],
23371
+ // @TODO INT-1590: empty this array again once sales-channel detection gates V2.
23372
+ [OrderMode.OrderV2]: [orderExportToShipmentsAction, ordersExportPrintShipmentsAction]
23373
+ };
23374
+ const LIST_ITEM_MODE_ACTIONS = {
23375
+ [OrderMode.OrderV1]: [ordersEditAction, orderExportAction],
23376
+ // @TODO INT-1590: drop orderExportToShipmentsAction once sales-channel detection gates V2.
23377
+ [OrderMode.OrderV2]: [ordersEditAction, orderExportToShipmentsAction],
23378
+ [OrderMode.Shipments]: []
23379
+ };
22776
23380
  const _sfc_main$g = /* @__PURE__ */ defineComponent({
22777
23381
  __name: "ProductSettings",
22778
23382
  props: {
@@ -22791,15 +23395,15 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
22791
23395
  const adminConfig = useAdminConfig();
22792
23396
  const createProductSettingsForm = () => {
22793
23397
  var _a, _b, _c;
22794
- const resolvedProduct = toValue(product);
23398
+ const resolvedProduct = toValue$1(product);
22795
23399
  if (!resolvedProduct || !viewContext.view) {
22796
23400
  throw new Error("Product settings not loaded");
22797
23401
  }
22798
- const overrides = FORM_KEY_CHILD_PRODUCT_SETTINGS === toValue(propRefs.formKey) ? {
23402
+ const overrides = FORM_KEY_CHILD_PRODUCT_SETTINGS === toValue$1(propRefs.formKey) ? {
22799
23403
  ...(_a = adminConfig.formConfigOverrides) == null ? void 0 : _a[FORM_KEY_PRODUCT_SETTINGS],
22800
23404
  ...(_b = adminConfig.formConfigOverrides) == null ? void 0 : _b[FORM_KEY_CHILD_PRODUCT_SETTINGS]
22801
23405
  } : (_c = adminConfig.formConfigOverrides) == null ? void 0 : _c[FORM_KEY_PRODUCT_SETTINGS];
22802
- return Ne(toValue(propRefs.formName), {
23406
+ return Ne(toValue$1(propRefs.formName), {
22803
23407
  ...overrides,
22804
23408
  fields: [
22805
23409
  ...generateFormFields({
@@ -22837,22 +23441,16 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
22837
23441
  const _sfc_main$e = /* @__PURE__ */ defineComponent({
22838
23442
  __name: "ShipmentOptionsModal",
22839
23443
  setup(__props) {
22840
- const ShipmentOptionsModalForm = /* @__PURE__ */ defineAsyncComponent(() => import("./ShipmentOptionsModalForm-ME-oncii.js"));
22841
- const pluginSettings = usePluginSettings();
22842
- const { orderMode } = pluginSettings.order;
23444
+ const ShipmentOptionsModalForm = /* @__PURE__ */ defineAsyncComponent(() => import("./ShipmentOptionsModalForm-INoRc2Gs.js"));
23445
+ const orderMode = useOrderMode();
22843
23446
  const ordersData = computed(() => useOrdersData());
22844
- const orderIds = computed(() => toValue(ordersData).map((data) => {
23447
+ const orderIds = computed(() => toValue$1(ordersData).map((data) => {
22845
23448
  var _a;
22846
- return (_a = toValue(data.order)) == null ? void 0 : _a.externalIdentifier;
23449
+ return (_a = toValue$1(data.order)) == null ? void 0 : _a.externalIdentifier;
22847
23450
  }));
22848
23451
  const actions = computed(() => {
22849
- const disabled = toValue(ordersData).some((data) => toValue(data.query.isLoading));
22850
- const actions2 = [
22851
- modalCloseAction,
22852
- ordersUpdateAction,
22853
- ...orderMode ? [orderExportAction] : [orderExportToShipmentsAction, ordersExportPrintShipmentsAction]
22854
- ];
22855
- return instantiateActions(actions2, { disabled });
23452
+ const disabled = toValue$1(ordersData).some((data) => toValue$1(data.query.isLoading));
23453
+ return instantiateActions([modalCloseAction, ordersUpdateAction, ...MODAL_MODE_ACTIONS[orderMode.value]], { disabled });
22856
23454
  });
22857
23455
  return (_ctx, _cache) => {
22858
23456
  const _component_PdkModal = resolveComponent("PdkModal");
@@ -22875,7 +23473,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
22875
23473
  __name: "PrintOptionsModal",
22876
23474
  setup(__props) {
22877
23475
  const modalKey = AdminModalKey.PrintOptions;
22878
- const PrintOptionsModalForm = /* @__PURE__ */ defineAsyncComponent(() => import("./PrintOptionsModalForm-f7Ze8uNa.js"));
23476
+ const PrintOptionsModalForm = /* @__PURE__ */ defineAsyncComponent(() => import("./PrintOptionsModalForm-BUGvrOwt.js"));
22879
23477
  const actionStore = useActionStore();
22880
23478
  actionStore.register(modalSubmitFormAction);
22881
23479
  const actions = instantiateActions([modalCloseAction, modalSubmitFormAction]);
@@ -22925,24 +23523,19 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
22925
23523
  setup(__props) {
22926
23524
  const { order: data, loading } = useOrderData();
22927
23525
  const { translate: translate2 } = useLanguage();
22928
- const pluginSettings = usePluginSettings();
22929
- const { orderMode } = pluginSettings.order;
23526
+ const orderMode = useOrderMode();
22930
23527
  const isExported = computed(() => {
22931
23528
  var _a;
22932
- return pluginSettings.order.orderMode && ((_a = toValue(data)) == null ? void 0 : _a.exported);
23529
+ return orderMode.value === OrderMode.OrderV1 && ((_a = toValue$1(data)) == null ? void 0 : _a.exported);
22933
23530
  });
22934
23531
  const actions = computed(() => {
22935
23532
  var _a;
22936
23533
  if (isExported.value) {
22937
23534
  return instantiateActions(orderViewInBackofficeAction);
22938
23535
  }
22939
- return instantiateActions(
22940
- [
22941
- ordersUpdateAction,
22942
- ...orderMode ? [orderExportAction] : [orderExportToShipmentsAction, ordersPrintAction, ordersExportPrintShipmentsAction]
22943
- ],
22944
- { orderIds: (_a = toValue(data)) == null ? void 0 : _a.externalIdentifier }
22945
- );
23536
+ return instantiateActions([ordersUpdateAction, ...BOX_MODE_ACTIONS[orderMode.value]], {
23537
+ orderIds: (_a = toValue$1(data)) == null ? void 0 : _a.externalIdentifier
23538
+ });
22946
23539
  });
22947
23540
  return (_ctx, _cache) => {
22948
23541
  const _component_PdkIcon = resolveComponent("PdkIcon");
@@ -23004,21 +23597,20 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
23004
23597
  const _sfc_main$9 = /* @__PURE__ */ defineComponent({
23005
23598
  __name: "OrderBox",
23006
23599
  setup(__props) {
23007
- const ShipmentTableBox = /* @__PURE__ */ defineAsyncComponent(() => import("./ShipmentTableBox-C0q9qBg1.js"));
23600
+ const ShipmentTableBox = /* @__PURE__ */ defineAsyncComponent(() => import("./ShipmentTableBox-CzmZ6Xt4.js"));
23008
23601
  const queryStore = useQueryStore();
23009
23602
  queryStore.registerContextQueries();
23010
23603
  queryStore.registerOrderQueries();
23011
23604
  const actionStore = useActionStore();
23012
23605
  actionStore.registerOrderActions();
23013
- const pluginSettings = usePluginSettings();
23606
+ const orderMode = useOrderMode();
23014
23607
  const { query } = useOrderData();
23015
- const data = computed(() => toValue(query.data));
23016
- const { orderMode } = pluginSettings.order;
23608
+ const data = computed(() => toValue$1(query.data));
23017
23609
  return (_ctx, _cache) => {
23018
23610
  var _a;
23019
23611
  return openBlock(), createElementBlock(Fragment, null, [
23020
23612
  createVNode(_sfc_main$a),
23021
- !unref(orderMode) && ((_a = data.value) == null ? void 0 : _a.shipments.some((item) => !item.deleted)) ? (openBlock(), createBlock(unref(ShipmentTableBox), { key: 0 })) : createCommentVNode("", true)
23613
+ unref(orderMode) !== unref(OrderMode).OrderV1 && ((_a = data.value) == null ? void 0 : _a.shipments.some((item) => !item.deleted)) ? (openBlock(), createBlock(unref(ShipmentTableBox), { key: 0 })) : createCommentVNode("", true)
23022
23614
  ], 64);
23023
23615
  };
23024
23616
  }
@@ -23046,27 +23638,26 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
23046
23638
  __name: "OrderListItem",
23047
23639
  setup(__props) {
23048
23640
  const OrderModeOrderListItem = /* @__PURE__ */ defineAsyncComponent(() => {
23049
- return import("./OrderModeOrderListItem-DdktQjCM.js");
23641
+ return import("./OrderModeOrderListItem-CnEBPTEC.js");
23050
23642
  });
23051
23643
  const ShipmentModeOrderListItem = /* @__PURE__ */ defineAsyncComponent(() => {
23052
- return import("./ShipmentModeOrderListItem-Ca1M2iy0.js");
23644
+ return import("./ShipmentModeOrderListItem-BVzk32iG.js");
23053
23645
  });
23054
23646
  const queryStore = useQueryStore();
23055
23647
  queryStore.registerContextQueries();
23056
23648
  queryStore.registerOrderQueries();
23057
23649
  const actionStore = useActionStore();
23058
23650
  actionStore.registerOrderActions();
23059
- const pluginSettings = usePluginSettings();
23060
- const { orderMode } = pluginSettings.order;
23651
+ const orderMode = useOrderMode();
23061
23652
  const { query } = useOrderData();
23062
23653
  const notificationFilter = (notification) => {
23063
23654
  var _a, _b;
23064
- return ((_a = notification.tags) == null ? void 0 : _a.orderIds) === ((_b = toValue(query.data)) == null ? void 0 : _b.externalIdentifier);
23655
+ return ((_a = notification.tags) == null ? void 0 : _a.orderIds) === ((_b = toValue$1(query.data)) == null ? void 0 : _b.externalIdentifier);
23065
23656
  };
23066
23657
  return (_ctx, _cache) => {
23067
23658
  return openBlock(), createElementBlock(Fragment, null, [
23068
23659
  !unref(query).isLoading ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
23069
- unref(orderMode) ? (openBlock(), createBlock(unref(OrderModeOrderListItem), { key: 0 })) : (openBlock(), createBlock(unref(ShipmentModeOrderListItem), { key: 1 }))
23660
+ 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)
23070
23661
  ])) : createCommentVNode("", true),
23071
23662
  createVNode(unref(_sfc_main$p), {
23072
23663
  category: unref(NotificationCategory).Action,
@@ -23098,6 +23689,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
23098
23689
  __name: "PluginSettingsForms",
23099
23690
  setup(__props) {
23100
23691
  const config = useAdminConfig();
23692
+ const orderMode = useOrderMode();
23101
23693
  const dynamicContextQuery = useStoreContextQuery();
23102
23694
  const pluginSettingsContextQuery = useStoreContextQuery(AdminContextKey.PluginSettingsView);
23103
23695
  const tabs = ref([]);
@@ -23106,15 +23698,16 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
23106
23698
  watch(
23107
23699
  () => pluginSettingsContextQuery.dataUpdatedAt,
23108
23700
  () => {
23109
- if (toValue(loading)) {
23701
+ if (toValue$1(loading)) {
23110
23702
  return;
23111
23703
  }
23112
- const pluginSettingsView = toValue(pluginSettingsContextQuery.data);
23113
- const dynamicContext = toValue(dynamicContextQuery.data);
23114
- if (!pluginSettingsView || !(dynamicContext == null ? void 0 : dynamicContext.pluginSettings)) {
23704
+ const rawPluginSettingsView = toValue$1(pluginSettingsContextQuery.data);
23705
+ const dynamicContext = toValue$1(dynamicContextQuery.data);
23706
+ if (!rawPluginSettingsView || !(dynamicContext == null ? void 0 : dynamicContext.pluginSettings)) {
23115
23707
  tabs.value = [];
23116
23708
  return;
23117
23709
  }
23710
+ const pluginSettingsView = filterPluginSettingsView(rawPluginSettingsView, orderMode.value);
23118
23711
  tabs.value = createPluginSettingsTabs(pluginSettingsView, {
23119
23712
  pluginSettings: dynamicContext.pluginSettings,
23120
23713
  actionContext,
@@ -23145,11 +23738,11 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
23145
23738
  setup(__props) {
23146
23739
  const { fetchWebhooks, createWebhooks, deleteWebhooks } = useQueryStore().registerWebhookQueries();
23147
23740
  useActionStore().registerWebhookActions();
23148
- const data = computed(() => toValue(fetchWebhooks.data) ?? []);
23741
+ const data = computed(() => toValue$1(fetchWebhooks.data) ?? []);
23149
23742
  const webhooks = computed(() => {
23150
23743
  return data.value.map((webhook) => {
23151
23744
  let status = Status.Pending;
23152
- if (!toValue(fetchWebhooks.isLoading) && !toValue(createWebhooks.isLoading) && !toValue(deleteWebhooks.isLoading)) {
23745
+ if (!toValue$1(fetchWebhooks.isLoading) && !toValue$1(createWebhooks.isLoading) && !toValue$1(deleteWebhooks.isLoading)) {
23153
23746
  status = webhook.connected ? Status.Success : Status.Error;
23154
23747
  }
23155
23748
  return { ...webhook, status };
@@ -23264,7 +23857,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
23264
23857
  const form = ref();
23265
23858
  const hasAccount = computed(() => {
23266
23859
  var _a;
23267
- return Boolean((_a = toValue(contextQuery.data)) == null ? void 0 : _a.account);
23860
+ return Boolean((_a = toValue$1(contextQuery.data)) == null ? void 0 : _a.account);
23268
23861
  });
23269
23862
  watch(
23270
23863
  contextQuery.data,
@@ -23313,7 +23906,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
23313
23906
  const switchToProductionApiInstance = instantiateAction(switchToProductionApiAction);
23314
23907
  const isConnectedToAcceptance = computed(() => {
23315
23908
  var _a, _b;
23316
- const context = toValue(contextQuery.data);
23909
+ const context = toValue$1(contextQuery.data);
23317
23910
  const environment = (_b = (_a = context == null ? void 0 : context.pluginSettings) == null ? void 0 : _a.account) == null ? void 0 : _b.environment;
23318
23911
  return environment === "acceptance";
23319
23912
  });
@@ -23367,14 +23960,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23367
23960
  const contextQuery = useStoreContextQuery();
23368
23961
  const updateAccount = useUpdateAccountMutation();
23369
23962
  const deleteAccount = useDeleteAccountMutation();
23370
- const loading = computed(() => toValue(contextQuery.isLoading) || toValue(updateAccount.isLoading)) || toValue(deleteAccount.isLoading);
23963
+ const loading = computed(() => toValue$1(contextQuery.isLoading) || toValue$1(updateAccount.isLoading)) || toValue$1(deleteAccount.isLoading);
23371
23964
  const hasApiKey = computed(() => {
23372
23965
  var _a;
23373
- return Boolean((_a = toValue(contextQuery.data)) == null ? void 0 : _a.pluginSettings.account.apiKey);
23966
+ return Boolean((_a = toValue$1(contextQuery.data)) == null ? void 0 : _a.pluginSettings.account.apiKey);
23374
23967
  });
23375
23968
  const hasAccount = computed(() => {
23376
23969
  var _a;
23377
- return !toValue(loading) && hasApiKey.value && Boolean((_a = toValue(contextQuery.data)) == null ? void 0 : _a.account);
23970
+ return !toValue$1(loading) && hasApiKey.value && Boolean((_a = toValue$1(contextQuery.data)) == null ? void 0 : _a.account);
23378
23971
  });
23379
23972
  const { translate: translate2 } = useLanguage();
23380
23973
  const tabs = computed(() => {
@@ -23385,7 +23978,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23385
23978
  label: "button_api_key_edit"
23386
23979
  }
23387
23980
  ];
23388
- if (toValue(hasAccount)) {
23981
+ if (toValue$1(hasAccount)) {
23389
23982
  array.push({
23390
23983
  name: "webhooks",
23391
23984
  component: _sfc_main$4,
@@ -23435,7 +24028,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
23435
24028
  const dynamicContextQuery = useStoreContextQuery();
23436
24029
  const hasAccount = computed(() => {
23437
24030
  var _a;
23438
- return Boolean((_a = toValue(dynamicContextQuery.data)) == null ? void 0 : _a.account);
24031
+ return Boolean((_a = toValue$1(dynamicContextQuery.data)) == null ? void 0 : _a.account);
23439
24032
  });
23440
24033
  return (_ctx, _cache) => {
23441
24034
  const _component_PdkPluginSettingsWrapper = resolveComponent("PdkPluginSettingsWrapper");
@@ -23450,7 +24043,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
23450
24043
  }
23451
24044
  });
23452
24045
  export {
23453
- ordersPrintAction as $,
24046
+ Size as $,
23454
24047
  AdminModalKey as A,
23455
24048
  _sfc_main$m as B,
23456
24049
  _sfc_main$k as C,
@@ -23471,175 +24064,182 @@ export {
23471
24064
  shipmentActions as R,
23472
24065
  AdminIcon as S,
23473
24066
  isDef as T,
23474
- instantiateAction as U,
23475
- orderViewInBackofficeAction as V,
23476
- ordersEditAction as W,
23477
- orderExportAction as X,
23478
- _sfc_main$t as Y,
23479
- Size as Z,
24067
+ useOrderMode as U,
24068
+ instantiateAction as V,
24069
+ orderViewInBackofficeAction as W,
24070
+ LIST_ITEM_MODE_ACTIONS as X,
24071
+ OrderMode as Y,
24072
+ _sfc_main$t as Z,
23480
24073
  _sfc_main$l as _,
23481
24074
  createBlock as a,
23482
- useNotificationStore as a$,
23483
- ordersFetchAction as a0,
23484
- ordersExportPrintShipmentsAction as a1,
23485
- TransitionGroup as a2,
23486
- useDigitalStampRanges as a3,
23487
- isOfType$1 as a4,
23488
- _sfc_main$q as a5,
23489
- PackageTypeName as a6,
23490
- useFetchCarrier as a7,
23491
- _sfc_main$r as a8,
23492
- getDynamicTranslation as a9,
23493
- FORM_KEY_ACCOUNT_SETTINGS as aA,
23494
- FORM_KEY_CHILD_PRODUCT_SETTINGS as aB,
23495
- FORM_KEY_MODAL as aC,
23496
- FORM_KEY_MODAL_PRINT_OPTIONS as aD,
23497
- FORM_KEY_MODAL_RETURN_OPTIONS as aE,
23498
- FORM_KEY_MODAL_SHIPMENT_OPTIONS as aF,
23499
- FORM_KEY_PLUGIN_SETTINGS as aG,
23500
- FORM_KEY_PRODUCT_SETTINGS as aH,
23501
- resolveFormComponent as aI,
23502
- c as aJ,
23503
- Je as aK,
23504
- M as aL,
23505
- ne as aM,
23506
- INJECT_ADMIN_INSTANCE as aN,
23507
- INJECT_GLOBAL_PDK_ADMIN as aO,
23508
- LogLevel as aP,
23509
- getActionIdentifier as aQ,
23510
- PdkAdmin as aR,
23511
- createPdkAdmin as aS,
23512
- createAdminConfig as aT,
23513
- createPdkAdminPlugin as aU,
23514
- createFormElement as aV,
23515
- createLogger as aW,
23516
- generateFieldId as aX,
23517
- prefixComponent as aY,
23518
- useActionStore as aZ,
23519
- useModalStore as a_,
23520
- withModifiers as aa,
23521
- _sfc_main$f as ab,
23522
- _sfc_main$c as ac,
23523
- _sfc_main$b as ad,
23524
- _sfc_main$9 as ae,
23525
- _sfc_main$7 as af,
23526
- _sfc_main as ag,
23527
- _sfc_main$g as ah,
23528
- _sfc_main$p as ai,
23529
- PlainElement as aj,
23530
- _sfc_main$o as ak,
23531
- ReturnsForm as al,
23532
- _sfc_main$j as am,
23533
- _sfc_main$i as an,
23534
- _sfc_main$h as ao,
23535
- AdminAction as ap,
23536
- AdminComponent as aq,
23537
- AdminInstanceContextKey as ar,
23538
- AdminView as as,
23539
- NotificationCategory as at,
23540
- allAdminComponentNames as au,
23541
- optionalAdminActionContainerComponentNames as av,
23542
- optionalAdminComponentNames as aw,
23543
- optionalAdminPlainWrapperComponentNames as ax,
23544
- requiredAdminComponentNames as ay,
23545
- FORM_KEYS as az,
24075
+ prefixComponent as a$,
24076
+ ordersPrintAction as a0,
24077
+ ordersFetchAction as a1,
24078
+ orderExportAction as a2,
24079
+ ordersExportPrintShipmentsAction as a3,
24080
+ ordersEditAction as a4,
24081
+ TransitionGroup as a5,
24082
+ useDigitalStampRanges as a6,
24083
+ isOfType$1 as a7,
24084
+ _sfc_main$q as a8,
24085
+ PackageTypeName as a9,
24086
+ optionalAdminPlainWrapperComponentNames as aA,
24087
+ requiredAdminComponentNames as aB,
24088
+ FORM_KEYS as aC,
24089
+ FORM_KEY_ACCOUNT_SETTINGS as aD,
24090
+ FORM_KEY_CHILD_PRODUCT_SETTINGS as aE,
24091
+ FORM_KEY_MODAL as aF,
24092
+ FORM_KEY_MODAL_PRINT_OPTIONS as aG,
24093
+ FORM_KEY_MODAL_RETURN_OPTIONS as aH,
24094
+ FORM_KEY_MODAL_SHIPMENT_OPTIONS as aI,
24095
+ FORM_KEY_PLUGIN_SETTINGS as aJ,
24096
+ FORM_KEY_PRODUCT_SETTINGS as aK,
24097
+ resolveFormComponent as aL,
24098
+ c as aM,
24099
+ Je as aN,
24100
+ M as aO,
24101
+ ne as aP,
24102
+ INJECT_ADMIN_INSTANCE as aQ,
24103
+ INJECT_GLOBAL_PDK_ADMIN as aR,
24104
+ LogLevel as aS,
24105
+ getActionIdentifier as aT,
24106
+ PdkAdmin as aU,
24107
+ createPdkAdmin as aV,
24108
+ createAdminConfig as aW,
24109
+ createPdkAdminPlugin as aX,
24110
+ createFormElement as aY,
24111
+ createLogger as aZ,
24112
+ generateFieldId as a_,
24113
+ useFetchCarrier as aa,
24114
+ _sfc_main$r as ab,
24115
+ getDynamicTranslation as ac,
24116
+ withModifiers as ad,
24117
+ _sfc_main$f as ae,
24118
+ _sfc_main$c as af,
24119
+ _sfc_main$b as ag,
24120
+ _sfc_main$9 as ah,
24121
+ _sfc_main$7 as ai,
24122
+ _sfc_main as aj,
24123
+ _sfc_main$g as ak,
24124
+ _sfc_main$p as al,
24125
+ PlainElement as am,
24126
+ _sfc_main$o as an,
24127
+ ReturnsForm as ao,
24128
+ _sfc_main$j as ap,
24129
+ _sfc_main$i as aq,
24130
+ _sfc_main$h as ar,
24131
+ AdminAction as as,
24132
+ AdminComponent as at,
24133
+ AdminInstanceContextKey as au,
24134
+ AdminView as av,
24135
+ NotificationCategory as aw,
24136
+ allAdminComponentNames as ax,
24137
+ optionalAdminActionContainerComponentNames as ay,
24138
+ optionalAdminComponentNames as az,
23546
24139
  unref as b,
23547
- shipmentsUpdateAction as b$,
23548
- useAppInfo as b0,
23549
- useCheckboxGroupContext as b1,
23550
- useDropOffInputContext as b2,
23551
- useDropdownButtonContext as b3,
23552
- useElementContext as b4,
23553
- useElementOptions as b5,
23554
- useFormatter as b6,
23555
- useGlobalContext as b7,
23556
- useGlobalPdkAdmin as b8,
23557
- useInputWithOptionsContext as b9,
23558
- usePrintShipmentsMutation as bA,
23559
- useUpdateShipmentsMutation as bB,
23560
- usePdkMutation as bC,
23561
- useCreateWebhooksMutation as bD,
23562
- useDeleteWebhooksMutation as bE,
23563
- useFetchContextQuery as bF,
23564
- useFetchOrdersQuery as bG,
23565
- useFetchProductsQuery as bH,
23566
- QUERY_KEY_ORDER as bI,
23567
- QUERY_KEY_SHIPMENT as bJ,
23568
- useFetchShipmentsQuery as bK,
23569
- useFetchWebhooksQuery as bL,
23570
- defineAction as bM,
23571
- updateAccountAction as bN,
23572
- refreshAccountAction as bO,
23573
- deleteAccountAction as bP,
23574
- fetchDynamicContextAction as bQ,
23575
- fetchPluginSettingsViewContextAction as bR,
23576
- downloadLogsAction as bS,
23577
- switchToAcceptanceApiAction as bT,
23578
- switchToProductionApiAction as bU,
23579
- modalCloseAction as bV,
23580
- modalSubmitFormAction as bW,
23581
- orderExportToShipmentsAction as bX,
23582
- ordersUpdateAction as bY,
23583
- pluginSettingsUpdateAction as bZ,
23584
- shipmentsExportReturnAction as b_,
23585
- useLoadMore as ba,
23586
- useLogger as bb,
23587
- useModalContext as bc,
23588
- useModalElementContext as bd,
23589
- useMultiSelectInputContext as be,
23590
- useProductData as bf,
23591
- useRadioGroupContext as bg,
23592
- useSelectInputContext as bh,
23593
- useShippingMethodsInputContext as bi,
23594
- useStoreQuery as bj,
23595
- useTableContext as bk,
23596
- useToggleInputContext as bl,
23597
- useTriStateInputContext as bm,
23598
- useWeekdays as bn,
23599
- useDeleteAccountMutation as bo,
23600
- useUpdateAccountMutation as bp,
23601
- useDownloadLogsMutation as bq,
23602
- useSwitchToAcceptanceApiMutation as br,
23603
- useSwitchToProductionApiMutation as bs,
23604
- useExportOrdersMutation as bt,
23605
- usePrintOrdersMutation as bu,
23606
- useUpdateOrdersMutation as bv,
23607
- useUpdatePluginSettingsMutation as bw,
23608
- useUpdateProductSettingsMutation as bx,
23609
- useDeleteShipmentsMutation as by,
23610
- useExportReturnMutation as bz,
24140
+ ordersUpdateAction as b$,
24141
+ useActionStore as b0,
24142
+ useModalStore as b1,
24143
+ useNotificationStore as b2,
24144
+ useAppInfo as b3,
24145
+ useCheckboxGroupContext as b4,
24146
+ useDropOffInputContext as b5,
24147
+ useDropdownButtonContext as b6,
24148
+ useElementContext as b7,
24149
+ useElementOptions as b8,
24150
+ useFormatter as b9,
24151
+ useUpdateProductSettingsMutation as bA,
24152
+ useDeleteShipmentsMutation as bB,
24153
+ useExportReturnMutation as bC,
24154
+ usePrintShipmentsMutation as bD,
24155
+ useUpdateShipmentsMutation as bE,
24156
+ usePdkMutation as bF,
24157
+ useCreateWebhooksMutation as bG,
24158
+ useDeleteWebhooksMutation as bH,
24159
+ useFetchContextQuery as bI,
24160
+ useFetchOrdersQuery as bJ,
24161
+ useFetchProductsQuery as bK,
24162
+ QUERY_KEY_ORDER as bL,
24163
+ QUERY_KEY_SHIPMENT as bM,
24164
+ useFetchShipmentsQuery as bN,
24165
+ useFetchWebhooksQuery as bO,
24166
+ defineAction as bP,
24167
+ updateAccountAction as bQ,
24168
+ refreshAccountAction as bR,
24169
+ deleteAccountAction as bS,
24170
+ fetchDynamicContextAction as bT,
24171
+ fetchPluginSettingsViewContextAction as bU,
24172
+ downloadLogsAction as bV,
24173
+ switchToAcceptanceApiAction as bW,
24174
+ switchToProductionApiAction as bX,
24175
+ modalCloseAction as bY,
24176
+ modalSubmitFormAction as bZ,
24177
+ orderExportToShipmentsAction as b_,
24178
+ useGlobalContext as ba,
24179
+ useGlobalPdkAdmin as bb,
24180
+ useInputWithOptionsContext as bc,
24181
+ useLoadMore as bd,
24182
+ useLogger as be,
24183
+ useModalContext as bf,
24184
+ useModalElementContext as bg,
24185
+ useMultiSelectInputContext as bh,
24186
+ useProductData as bi,
24187
+ useRadioGroupContext as bj,
24188
+ useSelectInputContext as bk,
24189
+ useShippingMethodsInputContext as bl,
24190
+ useStoreQuery as bm,
24191
+ useTableContext as bn,
24192
+ useToggleInputContext as bo,
24193
+ useTriStateInputContext as bp,
24194
+ useWeekdays as bq,
24195
+ useDeleteAccountMutation as br,
24196
+ useUpdateAccountMutation as bs,
24197
+ useDownloadLogsMutation as bt,
24198
+ useSwitchToAcceptanceApiMutation as bu,
24199
+ useSwitchToProductionApiMutation as bv,
24200
+ useExportOrdersMutation as bw,
24201
+ usePrintOrdersMutation as bx,
24202
+ useUpdateOrdersMutation as by,
24203
+ useUpdatePluginSettingsMutation as bz,
23611
24204
  computed as c,
23612
- shipmentsDeleteAction as c0,
23613
- shipmentsPrintAction as c1,
23614
- webhooksFetchAction as c2,
23615
- webhooksCreateAction as c3,
23616
- webhooksDeleteAction as c4,
23617
- createHandlerWithParameters as c5,
23618
- createMutationHandler as c6,
23619
- createOrdersMutationHandler as c7,
23620
- createQueryHandler as c8,
23621
- createShipmentsMutationHandler as c9,
23622
- doMutate as ca,
23623
- executeAction as cb,
23624
- executeAfterHandle as cc,
23625
- executeBeforeHandle as cd,
23626
- executeHandler as ce,
23627
- executeNextAction as cf,
23628
- resolveOrderParameters as cg,
23629
- resolveQuerySuffix as ch,
23630
- openOrPrintPdf as ci,
23631
- resolvePrintParameters as cj,
23632
- waitForLabelPrompt as ck,
23633
- StopActionHandler as cl,
23634
- _sfc_main$8 as cm,
23635
- _sfc_main$6 as cn,
23636
- Variant as co,
23637
- Status as cp,
23638
- TriState as cq,
23639
- SortType as cr,
23640
- AdminContextKey as cs,
23641
- BackendEndpoint as ct,
23642
- FrontendEndpoint as cu,
24205
+ ORDER_VIEW_IN_BACKOFFICE_ID as c0,
24206
+ pluginSettingsUpdateAction as c1,
24207
+ shipmentsExportReturnAction as c2,
24208
+ shipmentsUpdateAction as c3,
24209
+ shipmentsDeleteAction as c4,
24210
+ shipmentsPrintAction as c5,
24211
+ webhooksFetchAction as c6,
24212
+ webhooksCreateAction as c7,
24213
+ webhooksDeleteAction as c8,
24214
+ createHandlerWithParameters as c9,
24215
+ BackendEndpoint as cA,
24216
+ FrontendEndpoint as cB,
24217
+ createMutationHandler as ca,
24218
+ createOrdersMutationHandler as cb,
24219
+ createQueryHandler as cc,
24220
+ createShipmentsMutationHandler as cd,
24221
+ doMutate as ce,
24222
+ executeAction as cf,
24223
+ executeAfterHandle as cg,
24224
+ executeBeforeHandle as ch,
24225
+ executeHandler as ci,
24226
+ executeNextAction as cj,
24227
+ resolveOrderParameters as ck,
24228
+ resolveQuerySuffix as cl,
24229
+ STORE_MODE_ACTIONS as cm,
24230
+ BOX_MODE_ACTIONS as cn,
24231
+ MODAL_MODE_ACTIONS as co,
24232
+ openOrPrintPdf as cp,
24233
+ resolvePrintParameters as cq,
24234
+ waitForLabelPrompt as cr,
24235
+ StopActionHandler as cs,
24236
+ _sfc_main$8 as ct,
24237
+ _sfc_main$6 as cu,
24238
+ Variant as cv,
24239
+ Status as cw,
24240
+ TriState as cx,
24241
+ SortType as cy,
24242
+ AdminContextKey as cz,
23643
24243
  defineComponent as d,
23644
24244
  createCommentVNode as e,
23645
24245
  useContext as f,
@@ -23656,7 +24256,7 @@ export {
23656
24256
  useVModel as q,
23657
24257
  ref as r,
23658
24258
  resolveComponent as s,
23659
- toValue as t,
24259
+ toValue$1 as t,
23660
24260
  useOrdersData as u,
23661
24261
  withCtx as v,
23662
24262
  watch as w,