@myparcel-dev/pdk-admin-js 1.14.2 → 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-Df7qzieL.js → OrderModeOrderListItem-CnEBPTEC.js} +20 -15
  8. package/dist/PluginSettings-ymxANIm1.js +4 -0
  9. package/dist/{PrintOptionsModalForm-mNOwCJGu.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-LyXmsMB7.js → ShipmentLabel.vue_vue_type_script_setup_true_lang-CmhEHRaP.js} +2 -2
  12. package/dist/{ShipmentModeOrderListItem-1Fj_y2ET.js → ShipmentModeOrderListItem-BVzk32iG.js} +2 -2
  13. package/dist/{ShipmentOptionsModalForm-BJLbTAxc.js → ShipmentOptionsModalForm-INoRc2Gs.js} +1 -1
  14. package/dist/{ShipmentTableBox-DHjYGaMy.js → ShipmentTableBox-CzmZ6Xt4.js} +1 -1
  15. package/dist/{index-Dp-JKnen.js → index-BfK2d6Yu.js} +1218 -623
  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-BPyPkZXH.js +0 -4
  21. package/dist/Modals-9_68MyUT.js +0 -4
  22. package/dist/Notifications-D9VEVf0q.js +0 -4
  23. package/dist/OrderBox-DZEddeXm.js +0 -4
  24. package/dist/OrderListItem-SuUMLy47.js +0 -4
  25. package/dist/PluginSettings-BCJWQyay.js +0 -4
  26. package/dist/ProductSettings-BQXxM91a.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;
@@ -15526,45 +15528,6 @@ var toArray = (itemOrItems, separator) => {
15526
15528
  }
15527
15529
  return Array.isArray(itemOrItems) ? itemOrItems : [itemOrItems];
15528
15530
  };
15529
- var CarrierName = /* @__PURE__ */ ((CarrierName3) => {
15530
- CarrierName3["PostNl"] = "postnl";
15531
- CarrierName3["Bpost"] = "bpost";
15532
- CarrierName3["CheapCargo"] = "cheapcargo";
15533
- CarrierName3["Dpd"] = "dpd";
15534
- CarrierName3["Instabox"] = "instabox";
15535
- CarrierName3["Dhl"] = "dhl";
15536
- CarrierName3["Bol"] = "bol.com";
15537
- CarrierName3["BolCom"] = "bol.com";
15538
- CarrierName3["Ups"] = "ups";
15539
- CarrierName3["DhlForYou"] = "dhlforyou";
15540
- CarrierName3["DhlParcelConnect"] = "dhlparcelconnect";
15541
- CarrierName3["DhlEuroPlus"] = "dhleuroplus";
15542
- CarrierName3["UpsStandard"] = "upsstandard";
15543
- CarrierName3["UpsExpressSaver"] = "upsexpresssaver";
15544
- CarrierName3["Gls"] = "gls";
15545
- CarrierName3["Brt"] = "brt";
15546
- CarrierName3["Trunkrs"] = "trunkrs";
15547
- CarrierName3["InPost"] = "inpost";
15548
- return CarrierName3;
15549
- })(CarrierName || {});
15550
- var DeliveryTypeName = /* @__PURE__ */ ((DeliveryTypeName3) => {
15551
- DeliveryTypeName3["Morning"] = "morning";
15552
- DeliveryTypeName3["Standard"] = "standard";
15553
- DeliveryTypeName3["Evening"] = "evening";
15554
- DeliveryTypeName3["Pickup"] = "pickup";
15555
- DeliveryTypeName3["Express"] = "express";
15556
- return DeliveryTypeName3;
15557
- })(DeliveryTypeName || {});
15558
- var PackageTypeName = /* @__PURE__ */ ((PackageTypeName2) => {
15559
- PackageTypeName2["Package"] = "package";
15560
- PackageTypeName2["Mailbox"] = "mailbox";
15561
- PackageTypeName2["Letter"] = "letter";
15562
- PackageTypeName2["DigitalStamp"] = "digital_stamp";
15563
- PackageTypeName2["Pallet"] = "pallet";
15564
- PackageTypeName2["PackageSmall"] = "package_small";
15565
- PackageTypeName2["Envelope"] = "envelope";
15566
- return PackageTypeName2;
15567
- })(PackageTypeName || {});
15568
15531
  function createGlobalState(stateFactory) {
15569
15532
  let initialized2 = false;
15570
15533
  let state;
@@ -15580,8 +15543,76 @@ function createGlobalState(stateFactory) {
15580
15543
  function isDefined(v) {
15581
15544
  return unref(v) != null;
15582
15545
  }
15546
+ function toValue(r) {
15547
+ return typeof r === "function" ? r() : unref(r);
15548
+ }
15583
15549
  typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
15584
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
+ }
15585
15616
  function cloneFnJSON(source) {
15586
15617
  return JSON.parse(JSON.stringify(source));
15587
15618
  }
@@ -15875,6 +15906,35 @@ const BACKEND_ENDPOINTS_SHIPMENTS = [
15875
15906
  BackendEndpoint.SwitchToAcceptanceApi,
15876
15907
  BackendEndpoint.SwitchToProductionApi
15877
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
+ };
15878
15938
  var AdminView = /* @__PURE__ */ ((AdminView2) => {
15879
15939
  AdminView2["ChildProductSettings"] = "ChildProductSettings";
15880
15940
  AdminView2["Modals"] = "Modals";
@@ -16096,7 +16156,7 @@ const ee = Object.freeze(Object.values(c)), x2 = [
16096
16156
  const t = ref(false), e2 = M();
16097
16157
  if (!e2)
16098
16158
  throw new Error("Form not found");
16099
- 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));
16100
16160
  return (a, u2) => (openBlock(), createElementBlock(Fragment, null, [
16101
16161
  unref(e2) ? (openBlock(), createBlock(Suspense, {
16102
16162
  key: 0,
@@ -16148,7 +16208,7 @@ const He = /* @__PURE__ */ Pe(_e, [["render", Be]]), xe = /* @__PURE__ */ define
16148
16208
  setup(s, { emit: t }) {
16149
16209
  const e2 = ref(null), r = s, i = t, u2 = toRefs(r).form.value;
16150
16210
  return onMounted(() => {
16151
- const l = toValue(e2);
16211
+ const l = toValue$1(e2);
16152
16212
  l && (r.form.element = l);
16153
16213
  }), provide(re, u2), ee.forEach((l) => {
16154
16214
  r.form.on(l, (d) => {
@@ -16214,7 +16274,7 @@ class oe {
16214
16274
  const r = this.hooks.getAvailableHooks();
16215
16275
  if (Object.keys(e2).filter((i) => !r.includes(i)).forEach((i) => {
16216
16276
  this[i] = e2[i];
16217
- }), 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") {
16218
16278
  this.component = e2.component;
16219
16279
  return;
16220
16280
  }
@@ -16250,7 +16310,7 @@ class Ie extends oe {
16250
16310
  n(this, "validators", ref([]));
16251
16311
  n(this, "initialValue");
16252
16312
  n(this, "blur", async () => {
16253
- 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));
16254
16314
  });
16255
16315
  n(this, "focus", async (e3, r2) => {
16256
16316
  await this.hooks.execute("beforeFocus", this, r2), await this.hooks.execute("focus", this, r2), await this.hooks.execute("afterFocus", this, r2);
@@ -16260,26 +16320,26 @@ class Ie extends oe {
16260
16320
  });
16261
16321
  n(this, "validate", async () => {
16262
16322
  var h2;
16263
- if (this.resetValidation(), await this.hooks.execute("beforeValidate", this, toValue(this.ref)), toValue(this.isDisabled))
16264
- 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);
16265
16325
  const e3 = async (l) => {
16266
16326
  var I;
16267
- const d = await l.validate(this, toValue(this.ref));
16327
+ const d = await l.validate(this, toValue$1(this.ref));
16268
16328
  if (!d && l.errorMessage)
16269
16329
  if (this.errorsTarget) {
16270
- const S = toValue(this.form.fields).find(
16330
+ const S = toValue$1(this.form.fields).find(
16271
16331
  (ae) => ae.name === this.errorsTarget
16272
16332
  );
16273
- (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);
16274
16334
  } else
16275
- toValue(this.errors).push(l.errorMessage);
16335
+ toValue$1(this.errors).push(l.errorMessage);
16276
16336
  return d;
16277
- }, 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));
16278
- 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) ?? ""));
16279
16339
  const a2 = (await Promise.all(r2.map(e3))).every(Boolean), u3 = await asyncEvery(i2, e3);
16280
- 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);
16281
16341
  });
16282
- 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) => {
16283
16343
  await this.hooks.execute("beforeUpdate", this, h2, l), this.isDirty.value = true, await this.hooks.execute("afterUpdate", this, h2, l);
16284
16344
  }), watch(e2.stable, (h2) => {
16285
16345
  h2 && (r.disabledWhen && $(() => r.disabledWhen(this), this.isDisabled), r.optionalWhen && $(() => r.optionalWhen(this), this.isOptional), r.readOnlyWhen && $(() => r.readOnlyWhen(this), this.isReadOnly));
@@ -16318,39 +16378,39 @@ class We {
16318
16378
  n(this, "on");
16319
16379
  n(this, "stable", ref(false));
16320
16380
  n(this, "values");
16321
- 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));
16322
16382
  const { fields: r, ...i } = e2;
16323
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) => {
16324
16384
  const u2 = this.createFieldInstance(a, this);
16325
- toValue(this.fields).push(u2);
16326
- }), 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;
16327
16387
  }
16328
16388
  async addElement(t, e2, r = "after") {
16329
16389
  await this.hooks.execute(c.BeforeAddElement, this, t);
16330
- 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;
16331
16391
  if (e2 && i === -1) {
16332
16392
  console.error(`Field ${e2} not found in form ${this.name}`);
16333
16393
  return;
16334
16394
  }
16335
16395
  const a = r === "after" ? i + 1 : i, u2 = this.createFieldInstance(t, this);
16336
- 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;
16337
16397
  }
16338
16398
  getField(t) {
16339
16399
  return this.getFieldMemoized(t);
16340
16400
  }
16341
16401
  getValue(t) {
16342
16402
  const e2 = this.ensureGetField(t);
16343
- return toValue(e2.ref);
16403
+ return toValue$1(e2.ref);
16344
16404
  }
16345
16405
  getValues() {
16346
- return toValue(this.values);
16406
+ return toValue$1(this.values);
16347
16407
  }
16348
16408
  removeElement(t) {
16349
- const e2 = toValue(this.fields).findIndex((r) => r.name === t);
16350
- 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);
16351
16411
  }
16352
16412
  async reset() {
16353
- 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);
16354
16414
  }
16355
16415
  setValue(t, e2) {
16356
16416
  const r = this.getField(t);
@@ -16365,9 +16425,9 @@ class We {
16365
16425
  async validate() {
16366
16426
  await this.hooks.execute(c.BeforeValidate, this);
16367
16427
  const t = await Promise.all(
16368
- 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))
16369
16429
  );
16370
- 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);
16371
16431
  }
16372
16432
  ensureGetField(t) {
16373
16433
  const e2 = this.getField(t);
@@ -16391,8 +16451,8 @@ class We {
16391
16451
  }
16392
16452
  const i = new Ie(e2, r);
16393
16453
  return watch(i.ref, async (u2) => {
16394
- await this.hooks.execute(c.ElementChange, this, i, u2), toValue(i.isDisabled) || (this.values[r.name] = u2);
16395
- }), 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);
16396
16456
  }
16397
16457
  registerElement(t, e2) {
16398
16458
  return isDefined(t) && (this.model[t] = e2, this.getFieldMemoized.delete(t)), e2;
@@ -16408,16 +16468,16 @@ const Le = "register", ne = () => (D ?? (D = ref({})), V ?? (V = ref(Oe())), R ?
16408
16468
  R.register(s, t);
16409
16469
  },
16410
16470
  getForm(s) {
16411
- return toValue(D)[s];
16471
+ return toValue$1(D)[s];
16412
16472
  },
16413
16473
  // @ts-expect-error todo
16414
16474
  register(s, t) {
16415
16475
  R.execute("beforeRegister");
16416
- const e2 = new We(s, U(toValue(V), t));
16417
- 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;
16418
16478
  },
16419
16479
  setDefaults(s) {
16420
- V.value = U(toValue(V), s);
16480
+ V.value = U(toValue$1(V), s);
16421
16481
  }
16422
16482
  }), U = (s, t) => {
16423
16483
  var e2, r, i, a, u2, h2;
@@ -19046,22 +19106,8 @@ const useActionStore = defineStore("actions", () => {
19046
19106
  register,
19047
19107
  dispatch,
19048
19108
  registerOrderActions: () => {
19049
- const pluginSettings = usePluginSettings();
19050
- register([
19051
- ordersEditAction,
19052
- ordersFetchAction,
19053
- ordersPrintAction,
19054
- ordersUpdateAction,
19055
- ...pluginSettings.order.orderMode ? [orderExportAction, orderViewInBackofficeAction] : [
19056
- orderExportToShipmentsAction,
19057
- ordersExportPrintShipmentsAction,
19058
- shipmentsExportReturnAction,
19059
- shipmentsExportReturnAction,
19060
- shipmentsDeleteAction,
19061
- shipmentsUpdateAction,
19062
- shipmentsPrintAction
19063
- ]
19064
- ]);
19109
+ const orderMode = useOrderMode();
19110
+ register([ordersEditAction, ordersFetchAction, ordersUpdateAction, ...STORE_MODE_ACTIONS[orderMode.value]]);
19065
19111
  },
19066
19112
  registerModalActions: () => {
19067
19113
  register([modalCloseAction, modalSubmitFormAction]);
@@ -19336,6 +19382,65 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
19336
19382
  };
19337
19383
  }
19338
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 || {});
19339
19444
  const _hoisted_1$7 = ["title", "textContent"];
19340
19445
  const _sfc_main$q = /* @__PURE__ */ defineComponent({
19341
19446
  __name: "PackageType",
@@ -19402,14 +19507,37 @@ const useMyParcelApi = () => {
19402
19507
  sdk = f(client, [new de(), new ce()]);
19403
19508
  return sdk;
19404
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
+ };
19405
19532
  const useFetchCarrier = (carrier) => {
19533
+ const resolved = carrier === void 0 ? void 0 : resolveCarrierIdentifier(carrier);
19406
19534
  const queryClient2 = useQueryClient();
19407
- const queryKey = ["carriers", { name: carrier }];
19535
+ const queryKey = ["carriers", { name: resolved }];
19408
19536
  return useQuery(
19409
19537
  queryKey,
19410
19538
  async () => {
19411
19539
  const sdk2 = useMyParcelApi();
19412
- const carriers = await sdk2.getCarrier(carrier ? { path: { carrier } } : void 0);
19540
+ const carriers = await sdk2.getCarrier(resolved === void 0 ? void 0 : { path: { carrier: resolved } });
19413
19541
  return carriers[0];
19414
19542
  },
19415
19543
  {
@@ -19425,14 +19553,18 @@ const usePdkAdminApi = createGlobalState(() => {
19425
19553
  baseUrl: globalContext.baseUrl
19426
19554
  });
19427
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;
19428
19558
  class PdkEndpoint extends AbstractPdkEndpoint {
19429
19559
  constructor() {
19430
19560
  super(...arguments);
19431
19561
  __publicField(this, "method", options.method.toUpperCase());
19432
19562
  __publicField(this, "name", endpointName);
19433
19563
  __publicField(this, "path", options.path);
19434
- __publicField(this, "property", options.property);
19435
- __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);
19436
19568
  }
19437
19569
  }
19438
19570
  return new PdkEndpoint({
@@ -19518,19 +19650,25 @@ const createValueGetter = (instance, prefix) => {
19518
19650
  if (target) {
19519
19651
  return instance.form.getValue(`${prefix}${target}`);
19520
19652
  }
19521
- return toValue(instance.ref);
19653
+ return toValue$1(instance.ref);
19522
19654
  };
19523
19655
  };
19656
+ const setFieldRef = (field, value) => {
19657
+ if (isRef(field.ref)) {
19658
+ field.ref.value = value;
19659
+ } else {
19660
+ field.ref = value;
19661
+ }
19662
+ };
19524
19663
  const createValueSetter = (instance, prefix) => {
19525
19664
  return (value, target) => {
19526
19665
  if (target) {
19527
- instance.form.setValue(`${prefix}${target}`, value);
19528
- } else {
19529
- if (isRef(instance.ref)) {
19530
- instance.ref.value = value;
19531
- return;
19666
+ const targetField = instance.form.getField(`${prefix}${target}`);
19667
+ if (targetField) {
19668
+ setFieldRef(targetField, value);
19532
19669
  }
19533
- instance.ref = value;
19670
+ } else {
19671
+ setFieldRef(instance, value);
19534
19672
  }
19535
19673
  };
19536
19674
  };
@@ -19690,24 +19828,86 @@ const FORM_KEYS = [
19690
19828
  FORM_KEY_PLUGIN_SETTINGS,
19691
19829
  FORM_KEY_PRODUCT_SETTINGS
19692
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
+ };
19693
19904
  const DELIVERY_OPTIONS_PREFIX = "deliveryOptions";
19694
19905
  const PHYSICAL_PROPERTIES_PREFIX = "physicalProperties";
19695
- const SHIPMENT_OPTIONS = `shipmentOptions`;
19696
- const SHIPMENT_OPTIONS_PREFIX = `${DELIVERY_OPTIONS_PREFIX}.${SHIPMENT_OPTIONS}`;
19906
+ const SHIPMENT_OPTIONS = "shipmentOptions";
19697
19907
  const CARRIER = "carrier";
19698
19908
  const LABEL_AMOUNT = "labelAmount";
19699
19909
  const PACKAGE_TYPE = "packageType";
19700
19910
  const DELIVERY_TYPE = "deliveryType";
19701
- const AGE_CHECK = "ageCheck";
19702
- const RECEIPT_CODE = "receiptCode";
19703
- const DIRECT_RETURN = "return";
19704
- const HIDE_SENDER = "hideSender";
19705
- const LARGE_FORMAT = "largeFormat";
19706
- const ONLY_RECIPIENT = "onlyRecipient";
19707
- const SAME_DAY_DELIVERY = "sameDayDelivery";
19708
- const SIGNATURE = "signature";
19709
- const INSURANCE = "insurance";
19710
- const PRIORITY_DELIVERY = "priorityDelivery";
19711
19911
  const MANUAL_WEIGHT = "manualWeight";
19712
19912
  const PROP_OPTIONS = "options";
19713
19913
  const KEY_DESCRIPTION = "description";
@@ -19716,52 +19916,311 @@ const FIELD_CARRIER = `${DELIVERY_OPTIONS_PREFIX}.${CARRIER}`;
19716
19916
  const FIELD_LABEL_AMOUNT = `${DELIVERY_OPTIONS_PREFIX}.${LABEL_AMOUNT}`;
19717
19917
  const FIELD_PACKAGE_TYPE = `${DELIVERY_OPTIONS_PREFIX}.${PACKAGE_TYPE}`;
19718
19918
  const FIELD_DELIVERY_TYPE = `${DELIVERY_OPTIONS_PREFIX}.${DELIVERY_TYPE}`;
19719
- const FIELD_AGE_CHECK = `${SHIPMENT_OPTIONS_PREFIX}.${AGE_CHECK}`;
19720
- const FIELD_DIRECT_RETURN = `${SHIPMENT_OPTIONS_PREFIX}.${DIRECT_RETURN}`;
19721
- const FIELD_HIDE_SENDER = `${SHIPMENT_OPTIONS_PREFIX}.${HIDE_SENDER}`;
19722
- const FIELD_LARGE_FORMAT = `${SHIPMENT_OPTIONS_PREFIX}.${LARGE_FORMAT}`;
19723
- const FIELD_ONLY_RECIPIENT = `${SHIPMENT_OPTIONS_PREFIX}.${ONLY_RECIPIENT}`;
19724
- const FIELD_SAME_DAY_DELIVERY = `${SHIPMENT_OPTIONS_PREFIX}.${SAME_DAY_DELIVERY}`;
19725
- const FIELD_SIGNATURE = `${SHIPMENT_OPTIONS_PREFIX}.${SIGNATURE}`;
19726
- const FIELD_INSURANCE = `${SHIPMENT_OPTIONS_PREFIX}.${INSURANCE}`;
19727
- const FIELD_PRIORITY_DELIVERY = `${SHIPMENT_OPTIONS_PREFIX}.${PRIORITY_DELIVERY}`;
19728
19919
  const FIELD_MANUAL_WEIGHT = `${PHYSICAL_PROPERTIES_PREFIX}.${MANUAL_WEIGHT}`;
19729
- const FIELD_RECEIPT_CODE = `${SHIPMENT_OPTIONS_PREFIX}.${RECEIPT_CODE}`;
19730
- const ALL_FIELDS = [
19731
- FIELD_AGE_CHECK,
19732
- FIELD_CARRIER,
19733
- FIELD_DIRECT_RETURN,
19734
- FIELD_HIDE_SENDER,
19735
- FIELD_INSURANCE,
19736
- FIELD_PRIORITY_DELIVERY,
19737
- FIELD_LABEL_AMOUNT,
19738
- FIELD_LARGE_FORMAT,
19739
- FIELD_ONLY_RECIPIENT,
19740
- FIELD_MANUAL_WEIGHT,
19741
- FIELD_PACKAGE_TYPE,
19742
- FIELD_DELIVERY_TYPE,
19743
- FIELD_SAME_DAY_DELIVERY,
19744
- FIELD_SIGNATURE,
19745
- FIELD_RECEIPT_CODE
19746
- ];
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
+ };
19747
20154
  const createRef = (refs, field, fallback) => {
19748
20155
  return ref(refs[field] ?? fallback);
19749
20156
  };
19750
20157
  const createShipmentOptionField = (refs, fieldName, config) => {
19751
20158
  const name = fieldName.split(".").pop() ?? fieldName;
20159
+ const capabilities = useFormCapabilities();
19752
20160
  return defineFormField({
19753
20161
  name: fieldName,
19754
20162
  component: resolveFormComponent(AdminComponent.TriStateInput),
19755
20163
  ref: createRef(refs, fieldName, TriState.Inherit),
19756
20164
  label: getFieldLabel(name),
19757
- visibleWhen: createHasShipmentOptionWatcher(name),
19758
- 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
+ },
19759
20221
  ...config
19760
20222
  });
19761
20223
  };
19762
- const createHideSenderField = (refs) => {
19763
- return createShipmentOptionField(refs, FIELD_HIDE_SENDER);
19764
- };
19765
20224
  const createDeliveryTypeField = (refs) => {
19766
20225
  return defineFormField({
19767
20226
  name: FIELD_DELIVERY_TYPE,
@@ -19771,89 +20230,94 @@ const createDeliveryTypeField = (refs) => {
19771
20230
  // options defined in afterUpdate of `createCarrierField`
19772
20231
  });
19773
20232
  };
19774
- const createAgeCheckField = (refs) => {
19775
- return createShipmentOptionField(refs, FIELD_AGE_CHECK, {
19776
- afterUpdate(field) {
19777
- const { form } = field;
19778
- setPostNlAgeCheckSubtext(field);
19779
- if (!triStateFieldIsEnabled(field.form, FIELD_AGE_CHECK)) {
19780
- return;
19781
- }
19782
- switch (getFormCarrierName(form)) {
19783
- case CarrierName.PostNl:
19784
- form.setValue(FIELD_SIGNATURE, TriState.On);
19785
- form.setValue(FIELD_ONLY_RECIPIENT, TriState.On);
19786
- break;
19787
- case CarrierName.DhlForYou:
19788
- form.setValue(FIELD_SIGNATURE, TriState.Off);
19789
- break;
19790
- }
19791
- }
19792
- });
19793
- };
19794
- const getCarrier = (form) => {
19795
- const dynamicContext = useContext(AdminContextKey.Dynamic);
19796
- const chosenCarrier = form.getValue(FIELD_CARRIER);
19797
- return dynamicContext.carriers.find((carrier) => carrier.externalIdentifier === chosenCarrier);
19798
- };
19799
- const getDeliveryTypes = (form) => {
19800
- let array = Object.values(DeliveryTypeName);
19801
- if (form) {
19802
- const carrier = getCarrier(form);
19803
- array = array.filter((name) => carrier == null ? void 0 : carrier.capabilities.deliveryTypes.includes(name));
19804
- }
19805
- return array.map((name) => ({
19806
- label: getDynamicTranslation("delivery_type", name),
19807
- value: name
19808
- }));
19809
- };
19810
20233
  const createCarrierField = (refs, inheritedDeliveryOptions) => {
19811
20234
  const dynamicContext = useContext(AdminContextKey.Dynamic);
19812
- 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;
19813
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
+ };
19814
20273
  return defineFormField({
19815
20274
  name: FIELD_CARRIER,
19816
20275
  label: "carrier",
19817
- ref: createRef(refs, FIELD_CARRIER, PackageTypeName.Package),
20276
+ ref: createRef(refs, FIELD_CARRIER, dynamicContext.shop.defaultCarrier ?? void 0),
19818
20277
  component: resolveFormComponent(AdminComponent.RadioGroup),
19819
20278
  props: {
19820
20279
  options: []
19821
20280
  },
19822
20281
  onBeforeMount: async (field) => {
19823
20282
  var _a;
19824
- const carrierSelectOptions = await Promise.all(
20283
+ await Promise.all(
19825
20284
  dynamicContext.carriers.map(async (carrier) => {
19826
- const query = useFetchCarrier(carrier.name);
20285
+ const query = useFetchCarrier(carrier.carrier);
19827
20286
  await query.suspense();
19828
- const apiCarrier = toValue(query.data);
19829
- let plainLabel = (apiCarrier == null ? void 0 : apiCarrier.human) ?? carrier.human ?? "";
19830
- if (!carrier.isDefault) {
19831
- plainLabel += ` ${carrier.label ?? translate2(`carrier_type_${carrier.type}`)}`;
19832
- }
19833
- return {
19834
- plainLabel,
19835
- 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)}`) ?? "",
19836
20290
  image: (apiCarrier == null ? void 0 : apiCarrier.meta.logo_svg) ? createAssetUrl(apiCarrier.meta.logo_svg) : void 0
19837
- };
20291
+ });
19838
20292
  })
19839
20293
  );
19840
- setFieldProp(field, PROP_OPTIONS, carrierSelectOptions);
19841
- await ((_a = field == null ? void 0 : field.afterUpdate) == null ? void 0 : _a.call(field, field, toValue(field.ref), void 0));
19842
- 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);
19843
20308
  },
19844
20309
  afterUpdate: (field, newCarrier) => {
19845
20310
  updateFieldsDefaults(newCarrier, field, inheritedDeliveryOptions);
19846
- setFieldProp(field.form, FIELD_INSURANCE, PROP_OPTIONS, getInsuranceOptions(field, formatter));
19847
- setFieldProp(field.form, FIELD_PACKAGE_TYPE, PROP_OPTIONS, getPackageTypes(field.form));
19848
- setFieldProp(field.form, FIELD_DELIVERY_TYPE, PROP_OPTIONS, getDeliveryTypes(field.form));
19849
- 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));
19850
20314
  }
19851
20315
  });
19852
20316
  };
19853
20317
  const createDigitalStampRangeField = (refs, order) => {
19854
20318
  var _a, _b;
19855
20319
  const pluginSettings = usePluginSettings();
19856
- const fallbackOrderData = order ? void 0 : toValue(useOrderData().order);
20320
+ const fallbackOrderData = order ? void 0 : toValue$1(useOrderData().order);
19857
20321
  const orderData = order ?? fallbackOrderData;
19858
20322
  const { initialWeight, manualWeight } = (orderData == null ? void 0 : orderData.physicalProperties) ?? {};
19859
20323
  const totalWeight = Number(initialWeight) + Number(pluginSettings.order.emptyDigitalStampWeight ?? 0);
@@ -19864,8 +20328,9 @@ const createDigitalStampRangeField = (refs, order) => {
19864
20328
  label: "weight_range",
19865
20329
  ref: ref(selectedValue ?? TriState.Inherit),
19866
20330
  component: resolveFormComponent(AdminComponent.SelectInput),
19867
- visibleWhen: (field) => PackageTypeName.DigitalStamp === field.form.getValue(FIELD_PACKAGE_TYPE),
19868
- 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",
19869
20334
  props: {
19870
20335
  subtext: {
19871
20336
  key: "order_weight",
@@ -19878,19 +20343,22 @@ const createDigitalStampRangeField = (refs, order) => {
19878
20343
  }
19879
20344
  });
19880
20345
  };
19881
- const createDirectReturnField = (refs) => {
19882
- return createShipmentOptionField(refs, FIELD_DIRECT_RETURN);
19883
- };
19884
- const createInsuranceField = (refs) => {
20346
+ const createInsuranceField = (refs, fieldName) => {
19885
20347
  const formatter = useLocalizedFormatter();
19886
- return createShipmentOptionField(refs, FIELD_INSURANCE, {
19887
- ref: createRef(refs, FIELD_INSURANCE, 0),
20348
+ const capabilities = useFormCapabilities();
20349
+ let stopWatcher;
20350
+ return createShipmentOptionField(refs, fieldName, {
20351
+ ref: createRef(refs, fieldName, 0),
19888
20352
  component: resolveFormComponent(AdminComponent.SelectInput),
19889
- visibleWhen: createHasShipmentOptionWatcher(INSURANCE, false, isPackageTypePackageOrSmall),
19890
- disabledWhen: createHasShipmentOptionWatcher(INSURANCE, true, isPackageTypePackageOrSmall),
19891
20353
  onBeforeMount(field) {
19892
- const insurancePossibilities = getInsuranceOptions(field, formatter);
19893
- 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
+ );
19894
20362
  }
19895
20363
  });
19896
20364
  };
@@ -19906,53 +20374,17 @@ const createLabelAmountField = (refs) => {
19906
20374
  }
19907
20375
  });
19908
20376
  };
19909
- const createLargeFormatField = (refs) => {
19910
- return createShipmentOptionField(refs, FIELD_LARGE_FORMAT);
19911
- };
19912
- const createOnlyRecipientField = (refs) => {
19913
- return createShipmentOptionField(refs, FIELD_ONLY_RECIPIENT, {
19914
- readOnlyWhen: ({ form }) => hasPostNlAgeCheck(form),
19915
- afterUpdate({ form }, value) {
19916
- if (!(CarrierName.DhlForYou === getFormCarrierName(form) && TriState.On === value)) {
19917
- return;
19918
- }
19919
- form.setValue(FIELD_AGE_CHECK, TriState.Off);
19920
- }
19921
- });
19922
- };
19923
20377
  const createPackageTypeField = (refs) => {
19924
20378
  return defineFormField({
19925
20379
  name: FIELD_PACKAGE_TYPE,
19926
20380
  label: snakeCase(`${SHIPMENT_OPTIONS}_package_type`),
19927
- ref: createRef(refs, FIELD_PACKAGE_TYPE, PackageTypeName.Package),
20381
+ ref: createRef(refs, FIELD_PACKAGE_TYPE, "PACKAGE"),
19928
20382
  component: resolveFormComponent(AdminComponent.RadioGroup)
19929
20383
  // options defined in afterUpdate of `createCarrierField`
19930
20384
  });
19931
20385
  };
19932
- const createPriorityDeliveryField = (refs) => {
19933
- return createShipmentOptionField(refs, FIELD_PRIORITY_DELIVERY, {
19934
- visibleWhen: createHasShipmentOptionWatcher(PRIORITY_DELIVERY, false, isPackageTypeMailbox),
19935
- disabledWhen: createHasShipmentOptionWatcher(PRIORITY_DELIVERY, true, isPackageTypeMailbox)
19936
- });
19937
- };
19938
- const createSameDayDeliveryField = (refs) => {
19939
- return createShipmentOptionField(refs, FIELD_SAME_DAY_DELIVERY);
19940
- };
19941
- const createSignatureField = (refs) => {
19942
- return createShipmentOptionField(refs, FIELD_SIGNATURE, {
19943
- readOnlyWhen: ({ form }) => hasPostNlAgeCheck(form)
19944
- });
19945
- };
19946
- const createReceiptCodeField = (refs) => {
19947
- return createShipmentOptionField(refs, FIELD_RECEIPT_CODE, {
19948
- readOnlyWhen: ({ form }) => hasPostNlAgeCheck(form),
19949
- afterUpdate({ form }, value) {
19950
- if (!(CarrierName.DhlForYou === getFormCarrierName(form) && TriState.On === value)) {
19951
- return;
19952
- }
19953
- form.setValue(FIELD_AGE_CHECK, TriState.Off);
19954
- }
19955
- });
20386
+ const fieldFactoryRegistry = {
20387
+ insurance: createInsuranceField
19956
20388
  };
19957
20389
  const createShipmentOptionsForm = (orders) => {
19958
20390
  var _a, _b;
@@ -19965,34 +20397,68 @@ const createShipmentOptionsForm = (orders) => {
19965
20397
  addBulkEditNotification(isModal);
19966
20398
  }
19967
20399
  const order = (isBulk ? void 0 : ordersArray[0]) ?? {};
19968
- const refs = ALL_FIELDS.reduce((acc, fieldName) => {
19969
- acc[fieldName] = get(order, fieldName);
19970
- return acc;
19971
- }, {});
19972
- refs[FIELD_CARRIER] = get(order, `${FIELD_CARRIER}.externalIdentifier`);
19973
- 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), {
19974
20404
  ...isModal ? (_a = config.formConfigOverrides) == null ? void 0 : _a.modal : null,
19975
20405
  ...(_b = config.formConfigOverrides) == null ? void 0 : _b.shipmentOptions,
19976
- fields: [
19977
- // General delivery options
19978
- createCarrierField(refs, order.inheritedDeliveryOptions),
19979
- createPackageTypeField(refs),
19980
- createDeliveryTypeField(refs),
19981
- createLabelAmountField(refs),
19982
- createDigitalStampRangeField(refs, order),
19983
- // Actual shipment options
19984
- createAgeCheckField(refs),
19985
- createSignatureField(refs),
19986
- createOnlyRecipientField(refs),
19987
- createDirectReturnField(refs),
19988
- createLargeFormatField(refs),
19989
- createHideSenderField(refs),
19990
- createSameDayDeliveryField(refs),
19991
- createReceiptCodeField(refs),
19992
- createInsuranceField(refs),
19993
- createPriorityDeliveryField(refs)
19994
- ]
20406
+ fields: createShipmentOptionsFields(refs, order, allOptionKeys)
19995
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];
19996
20462
  };
19997
20463
  const createLabel = (label, type) => {
19998
20464
  return label ? `${label}_${type}` : void 0;
@@ -20009,6 +20475,20 @@ const addBulkEditNotification = (isModal) => {
20009
20475
  timeout: false
20010
20476
  });
20011
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
+ };
20012
20492
  const createDefaultOption = (value) => ({
20013
20493
  label: {
20014
20494
  key: "option_inherit_value",
@@ -20018,16 +20498,6 @@ const createDefaultOption = (value) => ({
20018
20498
  },
20019
20499
  value: TriState.Inherit
20020
20500
  });
20021
- const isPackageTypePackage = (form) => {
20022
- return PackageTypeName.Package === form.getValue(FIELD_PACKAGE_TYPE);
20023
- };
20024
- const hasShipmentOption = (form, option) => {
20025
- const carrier = getCarrier(form);
20026
- return Boolean(carrier == null ? void 0 : carrier.capabilities.shipmentOptions[option]);
20027
- };
20028
- const createHasShipmentOptionWatcher = (shipmentOption, invert = false, validator = isPackageTypePackage) => {
20029
- return ({ form }) => (validator(form) && hasShipmentOption(form, shipmentOption)) !== invert;
20030
- };
20031
20501
  const defineFormField = (config) => {
20032
20502
  const { props, label } = config;
20033
20503
  return Xe({
@@ -20039,59 +20509,24 @@ const defineFormField = (config) => {
20039
20509
  }
20040
20510
  });
20041
20511
  };
20042
- const getFieldLabel = (name) => snakeCase(`${SHIPMENT_OPTIONS}_${name}`);
20043
- const getFormCarrierName = (form) => {
20044
- return resolveCarrier(form.getValue(FIELD_CARRIER));
20045
- };
20046
- const getInsuranceOptions = (field, formatter) => {
20047
- const carrier = getCarrier(field.form);
20048
- const insurancePossibilities = (carrier == null ? void 0 : carrier.capabilities.shipmentOptions.insurance) ?? [];
20049
- const carrierPossibilities = insurancePossibilities.map((amount) => ({
20050
- plainLabel: formatter.format(Format.Currency, amount / 100),
20051
- value: amount.toString()
20052
- }));
20053
- return [
20054
- {
20055
- label: "option_default",
20056
- value: TriState.Inherit
20057
- },
20058
- ...carrierPossibilities
20059
- ];
20060
- };
20061
- const getPackageTypes = (form) => {
20062
- let array = Object.values(PackageTypeName);
20063
- if (form) {
20064
- const carrier = getCarrier(form);
20065
- array = array.filter((name) => carrier == null ? void 0 : carrier.capabilities.packageTypes.includes(name));
20512
+ const getDeliveryTypes = (carrier) => {
20513
+ if (!carrier) {
20514
+ return [];
20066
20515
  }
20067
- return array.map((name) => ({
20068
- label: getPackageTypeTranslation(name),
20516
+ return carrier.deliveryTypes.map((name) => ({
20517
+ label: getDynamicTranslation("delivery_type", name),
20069
20518
  value: name
20070
20519
  }));
20071
20520
  };
20072
- const triStateFieldIsEnabled = (form, fieldName) => {
20073
- const field = form.getField(fieldName);
20074
- if (!field) {
20075
- return false;
20076
- }
20077
- const value = toValue(field.ref);
20078
- if (TriState.Inherit === value) {
20079
- return TriState.On === field.props.defaultValue;
20521
+ const getFieldLabel = (name) => snakeCase(`${SHIPMENT_OPTIONS}_${name}`);
20522
+ const getPackageTypes = (carrier) => {
20523
+ if (!carrier) {
20524
+ return [];
20080
20525
  }
20081
- return TriState.On === value;
20082
- };
20083
- const hasPostNlAgeCheck = (form) => {
20084
- const carrier = getFormCarrierName(form);
20085
- return CarrierName.PostNl === carrier && triStateFieldIsEnabled(form, FIELD_AGE_CHECK);
20086
- };
20087
- const isPackageTypeMailbox = (form) => {
20088
- return PackageTypeName.Mailbox === form.getValue(FIELD_PACKAGE_TYPE);
20089
- };
20090
- const isPackageTypeSmallPackage = (form) => {
20091
- return PackageTypeName.PackageSmall === form.getValue(FIELD_PACKAGE_TYPE);
20092
- };
20093
- const isPackageTypePackageOrSmall = (form) => {
20094
- return isPackageTypePackage(form) || isPackageTypeSmallPackage(form);
20526
+ return carrier.packageTypes.map((packageType) => ({
20527
+ label: getPackageTypeTranslation(packageType),
20528
+ value: packageType
20529
+ }));
20095
20530
  };
20096
20531
  const memoizedResolveFormComponent = memoize((componentName) => {
20097
20532
  return resolveComponent(prefixComponent(componentName));
@@ -20117,16 +20552,8 @@ const setFieldProp = (arg1, arg2, arg3, arg4) => {
20117
20552
  }
20118
20553
  field.props[key] = value;
20119
20554
  };
20120
- const setPostNlAgeCheckSubtext = ({ form }) => {
20121
- const defaultKey = createLabel(getFieldLabel(AGE_CHECK), KEY_SUBTEXT);
20122
- if (hasPostNlAgeCheck(form)) {
20123
- setFieldProp(form, FIELD_AGE_CHECK, KEY_SUBTEXT, `${defaultKey}_${CarrierName.PostNl}`);
20124
- } else {
20125
- setFieldProp(form, FIELD_AGE_CHECK, KEY_SUBTEXT, defaultKey);
20126
- }
20127
- };
20128
20555
  const updateFieldsDefaults = (carrier, { form, name }, inheritedDeliveryOptions) => {
20129
- toValue(form.fields).forEach((otherField) => {
20556
+ toValue$1(form.fields).forEach((otherField) => {
20130
20557
  if (otherField.name === name) {
20131
20558
  return;
20132
20559
  }
@@ -20135,6 +20562,71 @@ const updateFieldsDefaults = (carrier, { form, name }, inheritedDeliveryOptions)
20135
20562
  otherField.props.defaultValue = get(inheritedDeliveryOptions, [carrier, ...optionPathParts]);
20136
20563
  });
20137
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
+ };
20138
20630
  const createFormTab = (tab) => {
20139
20631
  const language = useLanguage();
20140
20632
  const children = [h$1("div", {}, h$1(xe, { form: tab.form }))];
@@ -20172,11 +20664,14 @@ const generateFormFields = ({ fields, values }, prefix = "") => {
20172
20664
  });
20173
20665
  });
20174
20666
  };
20667
+ const resolveSettingsValues = (pluginSettings, id) => {
20668
+ return get(pluginSettings, id) ?? get(pluginSettings, id.replace(/\.[^.]+$/, ".*"), {});
20669
+ };
20175
20670
  const createPluginSettingsForm = (id, view, context) => {
20176
20671
  var _a;
20177
20672
  const { pluginSettings, actionContext } = context;
20178
20673
  const mutation = useStoreQuery(BackendEndpoint.UpdatePluginSettings);
20179
- const values = get(pluginSettings, id, {});
20674
+ const values = resolveSettingsValues(pluginSettings, id);
20180
20675
  const generatedFields = generateFormFields({ fields: view.elements, values }, `${id}.`);
20181
20676
  return Ne(id, {
20182
20677
  ...(_a = context.config.formConfigOverrides) == null ? void 0 : _a.pluginSettings,
@@ -20236,6 +20731,48 @@ const createPluginSettingsTabs = (view, context) => {
20236
20731
  return { ...tab, component: markRaw(createPluginSettingsTabsComponent(id, view2, context)) };
20237
20732
  });
20238
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
+ };
20239
20776
  const _sfc_main$n = /* @__PURE__ */ defineComponent({
20240
20777
  name: "ReturnsForm",
20241
20778
  components: {
@@ -20318,7 +20855,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
20318
20855
  const props = __props;
20319
20856
  const propRefs = toRefs(props);
20320
20857
  const queries = useOrdersData(propRefs.order.value);
20321
- const shipmentOptionsForm = createShipmentOptionsForm(queries.map((data) => toValue(data.order)).filter(isDef));
20858
+ const shipmentOptionsForm = createShipmentOptionsForm(queries.map((data) => toValue$1(data.order)).filter(isDef));
20322
20859
  return (_ctx, _cache) => {
20323
20860
  return openBlock(), createBlock(unref(xe), { form: unref(shipmentOptionsForm) }, null, 8, ["form"]);
20324
20861
  };
@@ -20588,6 +21125,7 @@ const createRegisterComponentsPlugin = ({ config, logger }) => {
20588
21125
  });
20589
21126
  Object.entries(getOptionalComponents(app)).forEach(([componentName, component]) => {
20590
21127
  const componentToRegister = typeof component === "string" ? componentsFromConfig[component] : component;
21128
+ if (!componentToRegister) return;
20591
21129
  app.component(prefixComponent(componentName), markRaw(componentToRegister));
20592
21130
  });
20593
21131
  const { translate: translate2 } = useLanguage();
@@ -20684,13 +21222,13 @@ const setupAdminApp = (app, appConfig) => {
20684
21222
  app.directive("test", testIdDirective);
20685
21223
  };
20686
21224
  const renderMap = Object.freeze({
20687
- [AdminView.ChildProductSettings]: async () => import("./ChildProductSettings-BPyPkZXH.js"),
20688
- [AdminView.Modals]: async () => import("./Modals-9_68MyUT.js"),
20689
- [AdminView.Notifications]: async () => import("./Notifications-D9VEVf0q.js"),
20690
- [AdminView.OrderBox]: async () => import("./OrderBox-DZEddeXm.js"),
20691
- [AdminView.OrderListItem]: async () => import("./OrderListItem-SuUMLy47.js"),
20692
- [AdminView.PluginSettings]: async () => import("./PluginSettings-BCJWQyay.js"),
20693
- [AdminView.ProductSettings]: async () => import("./ProductSettings-BQXxM91a.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")
20694
21232
  });
20695
21233
  const renderViewComponent = async (componentName) => {
20696
21234
  const renderMethod = renderMap[componentName];
@@ -20840,11 +21378,21 @@ const createShipmentFormName = (orderId) => {
20840
21378
  }
20841
21379
  return `${AdminModalKey.ShipmentOptions}_${orderId}`;
20842
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
+ };
20843
21391
  const formToBody = (form) => {
20844
21392
  if (!isOfType$1(form, "getValues")) {
20845
21393
  return form ? form : {};
20846
21394
  }
20847
- const formValues = form.getValues();
21395
+ const formValues = getEnabledValues(form);
20848
21396
  return convertDotNotationToObject(formValues, (value) => {
20849
21397
  return typeof value === "boolean" ? Number(value) : value;
20850
21398
  });
@@ -20879,7 +21427,7 @@ const getOrderId = (instance) => {
20879
21427
  const getOrderShipmentIds = (orderIds) => {
20880
21428
  return useOrdersData(orderIds).map(({ order }) => {
20881
21429
  var _a;
20882
- return (_a = toValue(order)) == null ? void 0 : _a.shipments;
21430
+ return (_a = toValue$1(order)) == null ? void 0 : _a.shipments;
20883
21431
  }).flat().filter(isDef).map((shipment) => shipment.id);
20884
21432
  };
20885
21433
  const fakeLinkClick = (url, attributes) => {
@@ -20921,14 +21469,11 @@ const setQueryOrder = (queryClient2, order) => {
20921
21469
  const setQueryShipment = (queryClient2, shipment) => {
20922
21470
  setQueryData(queryClient2, [QUERY_KEY_SHIPMENT, { id: shipment.id }], shipment);
20923
21471
  };
20924
- const resolveCarrier = (carrierNameOrIdentifier) => {
20925
- return carrierNameOrIdentifier.split(":")[0];
20926
- };
20927
21472
  const getDynamicTranslation = (prefix, input) => {
20928
21473
  if (!input) {
20929
21474
  return prefix;
20930
21475
  }
20931
- return `${prefix}_${input}`;
21476
+ return `${prefix}_${input.toLowerCase()}`;
20932
21477
  };
20933
21478
  const getPackageTypeTranslation = (name) => getDynamicTranslation("package_type", name);
20934
21479
  const translateSelectOption = (option, translate2) => {
@@ -20984,6 +21529,12 @@ const useQueryStore = defineStore("query", () => {
20984
21529
  queries.value[key] = query;
20985
21530
  return query;
20986
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
+ };
20987
21538
  const registerShipmentQueries = (shipmentIds, orderIds) => {
20988
21539
  toArray(validateId(unref(orderIds) ?? getOrderId(), true)).forEach((orderId) => {
20989
21540
  toArray(unref(shipmentIds)).forEach((shipmentId) => {
@@ -21015,6 +21566,7 @@ const useQueryStore = defineStore("query", () => {
21015
21566
  get: get2,
21016
21567
  has: has2,
21017
21568
  register,
21569
+ unregister,
21018
21570
  registerShipmentQueries,
21019
21571
  /**
21020
21572
  * Register queries needed to render any order related component.
@@ -21024,7 +21576,7 @@ const useQueryStore = defineStore("query", () => {
21024
21576
  toArray(id).forEach((orderId2) => {
21025
21577
  var _a, _b;
21026
21578
  const ordersQuery = register(BackendEndpoint.FetchOrders, orderId2, useFetchOrdersQuery(orderId2));
21027
- (_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));
21028
21580
  register(BackendEndpoint.FetchOrders, orderId2, useFetchOrdersQuery(orderId2));
21029
21581
  register(BackendEndpoint.ExportOrders, orderId2, useExportOrdersMutation(orderId2, mode));
21030
21582
  register(BackendEndpoint.PrintOrders, orderId2, usePrintOrdersMutation(orderId2));
@@ -21069,7 +21621,7 @@ const useStoreContextQuery = (contextKey) => {
21069
21621
  };
21070
21622
  const useContext = (contextKey = AdminContextKey.Dynamic) => {
21071
21623
  const query = useStoreContextQuery(contextKey);
21072
- const data = toValue(query.data);
21624
+ const data = toValue$1(query.data);
21073
21625
  if (!data) {
21074
21626
  throw new Error(`Context ${contextKey} not found`);
21075
21627
  }
@@ -21130,6 +21682,16 @@ const useModalOrder = () => {
21130
21682
  }
21131
21683
  return null;
21132
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
+ };
21133
21695
  const usePluginSettings = () => {
21134
21696
  const context = useContext();
21135
21697
  if (!context.pluginSettings) {
@@ -21246,14 +21808,14 @@ const useInputWithOptionsContext = (props, emit2, multiple) => {
21246
21808
  watch(
21247
21809
  options,
21248
21810
  (newOptions) => {
21249
- const values = toArray(toValue(model));
21811
+ const values = toArray(toValue$1(model));
21250
21812
  const hasExistingValue = values.length && newOptions.some((option) => values.includes(option.value));
21251
21813
  if (hasExistingValue || newOptions.length === 0) {
21252
21814
  return;
21253
21815
  }
21254
21816
  model.value = multiple ? [newOptions[0].value] : newOptions[0].value;
21255
21817
  },
21256
- { immediate: Number((_a = toValue(options)) == null ? void 0 : _a.length) > 0 }
21818
+ { immediate: Number((_a = toValue$1(options)) == null ? void 0 : _a.length) > 0 }
21257
21819
  );
21258
21820
  });
21259
21821
  return { id, options, model };
@@ -21463,7 +22025,7 @@ const useDropdownButtonContext = (props) => {
21463
22025
  const propRefs = toRefs(props);
21464
22026
  return {
21465
22027
  dropdownActions: computed(() => {
21466
- const [standalone, hidden] = partitionArray(toValue(propRefs.actions), (action) => action.standalone === true);
22028
+ const [standalone, hidden] = partitionArray(toValue$1(propRefs.actions), (action) => action.standalone === true);
21467
22029
  return {
21468
22030
  standalone,
21469
22031
  hidden
@@ -21492,9 +22054,9 @@ const useMultiSelectInputContext = (props, emit2) => {
21492
22054
  const useRadioGroupContext = (props, emit2) => {
21493
22055
  const context = useInputWithOptionsContext(props, emit2);
21494
22056
  const elements = computed(() => {
21495
- const optionValues = (toValue(context.options) ?? []).map((option) => option.value);
22057
+ const optionValues = (toValue$1(context.options) ?? []).map((option) => option.value);
21496
22058
  return createObjectWithKeys(optionValues, (value) => {
21497
- const option = (toValue(context.options) ?? []).find((option2) => option2.value === value);
22059
+ const option = (toValue$1(context.options) ?? []).find((option2) => option2.value === value);
21498
22060
  return createFormElement({
21499
22061
  ref: context.model,
21500
22062
  name: `${props.element.name}${value.toString()}`,
@@ -21611,13 +22173,13 @@ const useTableContext = (props) => {
21611
22173
  return { transition };
21612
22174
  };
21613
22175
  const useToggleInputContext = (props, emit2) => {
21614
- const toggleModel = ref(triStateToBoolean(toValue(props.modelValue)));
22176
+ const toggleModel = ref(triStateToBoolean(toValue$1(props.modelValue)));
21615
22177
  const { id, model } = useElementContext(props, emit2);
21616
22178
  watch(toggleModel, (toggle) => {
21617
22179
  model.value = booleanToTriState(toggle);
21618
22180
  });
21619
- watch(model, (model2) => {
21620
- toggleModel.value = triStateToBoolean(model2);
22181
+ watch(model, (modelVal) => {
22182
+ toggleModel.value = triStateToBoolean(modelVal);
21621
22183
  });
21622
22184
  return {
21623
22185
  id,
@@ -21629,8 +22191,8 @@ const useToggleInputContext = (props, emit2) => {
21629
22191
  const useTriStateInputContext = (props, emit2) => {
21630
22192
  const { translate: translate2 } = useLanguage();
21631
22193
  const form = M();
21632
- const inheritModel = ref(TriState.Inherit === toValue(props.modelValue));
21633
- 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)));
21634
22196
  const { id, model } = useElementContext(props, emit2);
21635
22197
  const defaultValue = computed(() => {
21636
22198
  return props.element.props.defaultValue ?? TriState.Inherit;
@@ -21657,7 +22219,7 @@ const useTriStateInputContext = (props, emit2) => {
21657
22219
  name: `${props.element.name}__toggle`,
21658
22220
  ref: toggleModel,
21659
22221
  // The toggle is readonly when inherit is enabled or the element itself is set to readonly.
21660
- isReadOnly: markRaw(computed(() => toValue(inheritModel) || toValue(props.element.isReadOnly)))
22222
+ isReadOnly: markRaw(computed(() => toValue$1(inheritModel) || toValue$1(props.element.isReadOnly)))
21661
22223
  })
21662
22224
  );
21663
22225
  watch(toggleModel, (toggle) => {
@@ -21677,11 +22239,11 @@ const useTriStateInputContext = (props, emit2) => {
21677
22239
  model.value = TriState.Inherit;
21678
22240
  toggleModel.value = triStateToBoolean(defaultValue2 ?? TriState.Inherit);
21679
22241
  });
21680
- watch(model, (model2) => {
22242
+ watch(model, (modelVal) => {
21681
22243
  if (inheritModel.value) {
21682
22244
  return;
21683
22245
  }
21684
- toggleModel.value = triStateToBoolean(model2);
22246
+ toggleModel.value = triStateToBoolean(modelVal);
21685
22247
  });
21686
22248
  return {
21687
22249
  id,
@@ -21702,9 +22264,9 @@ const useOrderData = (externalIdentifier) => {
21702
22264
  const allQueries = queryStore.getQueriesForOrder(orderId);
21703
22265
  return {
21704
22266
  loading: computed(() => {
21705
- 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);
21706
22268
  }),
21707
- order: computed(() => toValue(fetchQuery.data)),
22269
+ order: computed(() => toValue$1(fetchQuery.data)),
21708
22270
  query: fetchQuery
21709
22271
  };
21710
22272
  };
@@ -21721,7 +22283,7 @@ const useProductData = (externalIdentifier) => {
21721
22283
  const productId = validateId(externalIdentifier ?? useInstanceContext(AdminInstanceContextKey.ProductIdentifier));
21722
22284
  const fetchQuery = useStoreQuery(BackendEndpoint.FetchProducts, productId);
21723
22285
  return {
21724
- product: computed(() => toValue(fetchQuery.data)),
22286
+ product: computed(() => toValue$1(fetchQuery.data)),
21725
22287
  query: fetchQuery
21726
22288
  };
21727
22289
  };
@@ -21733,13 +22295,13 @@ const useShipmentData = (id) => {
21733
22295
  const shipmentId = unref(id);
21734
22296
  const queryStore = useQueryStore();
21735
22297
  const fetchQuery = useShipment(shipmentId);
21736
- const shipment = computed(() => toValue(fetchQuery.data));
21737
- 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;
21738
22300
  const allQueries = [
21739
22301
  queryStore.getQueriesForShipment(shipmentId),
21740
22302
  orderId ? queryStore.getQueriesForOrder(orderId) : void 0
21741
22303
  ].filter(Boolean);
21742
- 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;
21743
22305
  const carriersQuery = carrierName ? useFetchCarrier(carrierName) : void 0;
21744
22306
  return {
21745
22307
  actions: instantiateActions(shipmentActions, {
@@ -21749,7 +22311,7 @@ const useShipmentData = (id) => {
21749
22311
  carrier: (carriersQuery == null ? void 0 : carriersQuery.data) ?? ref(),
21750
22312
  loading: computed(() => {
21751
22313
  return allQueries.some(
21752
- (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)
21753
22315
  );
21754
22316
  }),
21755
22317
  shipment
@@ -21759,7 +22321,7 @@ const useDigitalStampRanges = (weight, order) => {
21759
22321
  const fallbackOrder = order ? null : useOrderData().order;
21760
22322
  const allRanges = computed(() => {
21761
22323
  var _a;
21762
- return ((_a = toValue(order ?? fallbackOrder)) == null ? void 0 : _a.digitalStampRanges) ?? [];
22324
+ return ((_a = toValue$1(order ?? fallbackOrder)) == null ? void 0 : _a.digitalStampRanges) ?? [];
21763
22325
  });
21764
22326
  const ranges = computed(() => {
21765
22327
  return allRanges.value.map((range) => ({
@@ -21768,7 +22330,7 @@ const useDigitalStampRanges = (weight, order) => {
21768
22330
  }));
21769
22331
  });
21770
22332
  const currentRange = computed(() => {
21771
- const resolvedWeight = toValue(weight);
22333
+ const resolvedWeight = toValue$1(weight);
21772
22334
  const matchingRange = allRanges.value.find((range) => range.min <= resolvedWeight && range.max >= resolvedWeight);
21773
22335
  return ranges.value.find((range) => range.value === (matchingRange == null ? void 0 : matchingRange.average)) ?? ranges.value[0];
21774
22336
  });
@@ -21785,21 +22347,21 @@ const useGlobalPdkAdmin = () => {
21785
22347
  return pdkAdmin;
21786
22348
  };
21787
22349
  const useLoadMore = (options) => {
21788
- const loaded = ref(options.start ?? options.step ?? toValue(options.items).length - 1);
21789
- 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);
21790
22352
  const loadMore = () => {
21791
22353
  if (!hasMore.value) {
21792
22354
  return;
21793
22355
  }
21794
22356
  const step = options.step ?? 1;
21795
- const maxLength = toValue(options.items).length;
22357
+ const maxLength = toValue$1(options.items).length;
21796
22358
  if (loaded.value + step > maxLength) {
21797
22359
  loaded.value = maxLength;
21798
22360
  } else {
21799
22361
  loaded.value += step;
21800
22362
  }
21801
22363
  };
21802
- const items = computed(() => toValue(options.items).slice(0, loaded.value));
22364
+ const items = computed(() => toValue$1(options.items).slice(0, loaded.value));
21803
22365
  return {
21804
22366
  items,
21805
22367
  loaded,
@@ -22055,7 +22617,7 @@ const useExportOrdersMutation = (orderIds, mode = MutationMode.Default) => {
22055
22617
  var _a2;
22056
22618
  fillShipmentsQueryData(queryClient2, ((_a2 = order.shipments) == null ? void 0 : _a2.slice(-1)) ?? [], order);
22057
22619
  });
22058
- if (input.form) {
22620
+ if (mode === MutationMode.Modal && input.form) {
22059
22621
  await ((_a = input.form) == null ? void 0 : _a.reset());
22060
22622
  }
22061
22623
  }
@@ -22505,7 +23067,7 @@ const resolveOrderParameters = ({
22505
23067
  var _a;
22506
23068
  const formBuilder = ne();
22507
23069
  parameters.orderIds ?? (parameters.orderIds = getOrderId(instance));
22508
- 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)]);
22509
23071
  return Promise.resolve(parameters);
22510
23072
  };
22511
23073
  const updateAccountAction = defineAction({
@@ -22740,18 +23302,15 @@ const ordersPrintAction = defineAction({
22740
23302
  return context.response;
22741
23303
  }
22742
23304
  });
23305
+ const ORDER_VIEW_IN_BACKOFFICE_ID = "show-exported-order";
22743
23306
  const orderViewInBackofficeAction = defineAction({
22744
- id: "show-exported-order",
23307
+ id: ORDER_VIEW_IN_BACKOFFICE_ID,
22745
23308
  icon: AdminIcon.External,
22746
23309
  label: "order_view_in_backoffice",
22747
23310
  handler() {
22748
- const { platform } = useGlobalContext();
22749
- const backofficeUrls = {
22750
- NL: "https://backoffice.myparcel.nl/orders",
22751
- BE: "https://backoffice.sendmyparcel.be/orders"
22752
- };
22753
- const url = backofficeUrls[platform.localCountry] || backofficeUrls["NL"];
22754
- window.open(url, "_blank");
23311
+ const { proposition } = useGlobalContext();
23312
+ const baseUrl = proposition.backofficeUrl.replace(/\/$/, "");
23313
+ window.open(`${baseUrl}/orders`, "_blank");
22755
23314
  }
22756
23315
  });
22757
23316
  const pluginSettingsUpdateAction = defineAction({
@@ -22778,6 +23337,46 @@ const webhooksDeleteAction = defineAction({
22778
23337
  handler: createMutationHandler(BackendEndpoint.DeleteWebhooks),
22779
23338
  variant: Variant.Error
22780
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
+ };
22781
23380
  const _sfc_main$g = /* @__PURE__ */ defineComponent({
22782
23381
  __name: "ProductSettings",
22783
23382
  props: {
@@ -22796,15 +23395,15 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
22796
23395
  const adminConfig = useAdminConfig();
22797
23396
  const createProductSettingsForm = () => {
22798
23397
  var _a, _b, _c;
22799
- const resolvedProduct = toValue(product);
23398
+ const resolvedProduct = toValue$1(product);
22800
23399
  if (!resolvedProduct || !viewContext.view) {
22801
23400
  throw new Error("Product settings not loaded");
22802
23401
  }
22803
- const overrides = FORM_KEY_CHILD_PRODUCT_SETTINGS === toValue(propRefs.formKey) ? {
23402
+ const overrides = FORM_KEY_CHILD_PRODUCT_SETTINGS === toValue$1(propRefs.formKey) ? {
22804
23403
  ...(_a = adminConfig.formConfigOverrides) == null ? void 0 : _a[FORM_KEY_PRODUCT_SETTINGS],
22805
23404
  ...(_b = adminConfig.formConfigOverrides) == null ? void 0 : _b[FORM_KEY_CHILD_PRODUCT_SETTINGS]
22806
23405
  } : (_c = adminConfig.formConfigOverrides) == null ? void 0 : _c[FORM_KEY_PRODUCT_SETTINGS];
22807
- return Ne(toValue(propRefs.formName), {
23406
+ return Ne(toValue$1(propRefs.formName), {
22808
23407
  ...overrides,
22809
23408
  fields: [
22810
23409
  ...generateFormFields({
@@ -22842,22 +23441,16 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
22842
23441
  const _sfc_main$e = /* @__PURE__ */ defineComponent({
22843
23442
  __name: "ShipmentOptionsModal",
22844
23443
  setup(__props) {
22845
- const ShipmentOptionsModalForm = /* @__PURE__ */ defineAsyncComponent(() => import("./ShipmentOptionsModalForm-BJLbTAxc.js"));
22846
- const pluginSettings = usePluginSettings();
22847
- const { orderMode } = pluginSettings.order;
23444
+ const ShipmentOptionsModalForm = /* @__PURE__ */ defineAsyncComponent(() => import("./ShipmentOptionsModalForm-INoRc2Gs.js"));
23445
+ const orderMode = useOrderMode();
22848
23446
  const ordersData = computed(() => useOrdersData());
22849
- const orderIds = computed(() => toValue(ordersData).map((data) => {
23447
+ const orderIds = computed(() => toValue$1(ordersData).map((data) => {
22850
23448
  var _a;
22851
- return (_a = toValue(data.order)) == null ? void 0 : _a.externalIdentifier;
23449
+ return (_a = toValue$1(data.order)) == null ? void 0 : _a.externalIdentifier;
22852
23450
  }));
22853
23451
  const actions = computed(() => {
22854
- const disabled = toValue(ordersData).some((data) => toValue(data.query.isLoading));
22855
- const actions2 = [
22856
- modalCloseAction,
22857
- ordersUpdateAction,
22858
- ...orderMode ? [orderExportAction] : [orderExportToShipmentsAction, ordersExportPrintShipmentsAction]
22859
- ];
22860
- 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 });
22861
23454
  });
22862
23455
  return (_ctx, _cache) => {
22863
23456
  const _component_PdkModal = resolveComponent("PdkModal");
@@ -22880,7 +23473,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
22880
23473
  __name: "PrintOptionsModal",
22881
23474
  setup(__props) {
22882
23475
  const modalKey = AdminModalKey.PrintOptions;
22883
- const PrintOptionsModalForm = /* @__PURE__ */ defineAsyncComponent(() => import("./PrintOptionsModalForm-mNOwCJGu.js"));
23476
+ const PrintOptionsModalForm = /* @__PURE__ */ defineAsyncComponent(() => import("./PrintOptionsModalForm-BUGvrOwt.js"));
22884
23477
  const actionStore = useActionStore();
22885
23478
  actionStore.register(modalSubmitFormAction);
22886
23479
  const actions = instantiateActions([modalCloseAction, modalSubmitFormAction]);
@@ -22930,24 +23523,19 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
22930
23523
  setup(__props) {
22931
23524
  const { order: data, loading } = useOrderData();
22932
23525
  const { translate: translate2 } = useLanguage();
22933
- const pluginSettings = usePluginSettings();
22934
- const { orderMode } = pluginSettings.order;
23526
+ const orderMode = useOrderMode();
22935
23527
  const isExported = computed(() => {
22936
23528
  var _a;
22937
- 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);
22938
23530
  });
22939
23531
  const actions = computed(() => {
22940
23532
  var _a;
22941
23533
  if (isExported.value) {
22942
23534
  return instantiateActions(orderViewInBackofficeAction);
22943
23535
  }
22944
- return instantiateActions(
22945
- [
22946
- ordersUpdateAction,
22947
- ...orderMode ? [orderExportAction] : [orderExportToShipmentsAction, ordersPrintAction, ordersExportPrintShipmentsAction]
22948
- ],
22949
- { orderIds: (_a = toValue(data)) == null ? void 0 : _a.externalIdentifier }
22950
- );
23536
+ return instantiateActions([ordersUpdateAction, ...BOX_MODE_ACTIONS[orderMode.value]], {
23537
+ orderIds: (_a = toValue$1(data)) == null ? void 0 : _a.externalIdentifier
23538
+ });
22951
23539
  });
22952
23540
  return (_ctx, _cache) => {
22953
23541
  const _component_PdkIcon = resolveComponent("PdkIcon");
@@ -23009,21 +23597,20 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
23009
23597
  const _sfc_main$9 = /* @__PURE__ */ defineComponent({
23010
23598
  __name: "OrderBox",
23011
23599
  setup(__props) {
23012
- const ShipmentTableBox = /* @__PURE__ */ defineAsyncComponent(() => import("./ShipmentTableBox-DHjYGaMy.js"));
23600
+ const ShipmentTableBox = /* @__PURE__ */ defineAsyncComponent(() => import("./ShipmentTableBox-CzmZ6Xt4.js"));
23013
23601
  const queryStore = useQueryStore();
23014
23602
  queryStore.registerContextQueries();
23015
23603
  queryStore.registerOrderQueries();
23016
23604
  const actionStore = useActionStore();
23017
23605
  actionStore.registerOrderActions();
23018
- const pluginSettings = usePluginSettings();
23606
+ const orderMode = useOrderMode();
23019
23607
  const { query } = useOrderData();
23020
- const data = computed(() => toValue(query.data));
23021
- const { orderMode } = pluginSettings.order;
23608
+ const data = computed(() => toValue$1(query.data));
23022
23609
  return (_ctx, _cache) => {
23023
23610
  var _a;
23024
23611
  return openBlock(), createElementBlock(Fragment, null, [
23025
23612
  createVNode(_sfc_main$a),
23026
- !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)
23027
23614
  ], 64);
23028
23615
  };
23029
23616
  }
@@ -23051,27 +23638,26 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
23051
23638
  __name: "OrderListItem",
23052
23639
  setup(__props) {
23053
23640
  const OrderModeOrderListItem = /* @__PURE__ */ defineAsyncComponent(() => {
23054
- return import("./OrderModeOrderListItem-Df7qzieL.js");
23641
+ return import("./OrderModeOrderListItem-CnEBPTEC.js");
23055
23642
  });
23056
23643
  const ShipmentModeOrderListItem = /* @__PURE__ */ defineAsyncComponent(() => {
23057
- return import("./ShipmentModeOrderListItem-1Fj_y2ET.js");
23644
+ return import("./ShipmentModeOrderListItem-BVzk32iG.js");
23058
23645
  });
23059
23646
  const queryStore = useQueryStore();
23060
23647
  queryStore.registerContextQueries();
23061
23648
  queryStore.registerOrderQueries();
23062
23649
  const actionStore = useActionStore();
23063
23650
  actionStore.registerOrderActions();
23064
- const pluginSettings = usePluginSettings();
23065
- const { orderMode } = pluginSettings.order;
23651
+ const orderMode = useOrderMode();
23066
23652
  const { query } = useOrderData();
23067
23653
  const notificationFilter = (notification) => {
23068
23654
  var _a, _b;
23069
- 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);
23070
23656
  };
23071
23657
  return (_ctx, _cache) => {
23072
23658
  return openBlock(), createElementBlock(Fragment, null, [
23073
23659
  !unref(query).isLoading ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
23074
- 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)
23075
23661
  ])) : createCommentVNode("", true),
23076
23662
  createVNode(unref(_sfc_main$p), {
23077
23663
  category: unref(NotificationCategory).Action,
@@ -23103,6 +23689,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
23103
23689
  __name: "PluginSettingsForms",
23104
23690
  setup(__props) {
23105
23691
  const config = useAdminConfig();
23692
+ const orderMode = useOrderMode();
23106
23693
  const dynamicContextQuery = useStoreContextQuery();
23107
23694
  const pluginSettingsContextQuery = useStoreContextQuery(AdminContextKey.PluginSettingsView);
23108
23695
  const tabs = ref([]);
@@ -23111,15 +23698,16 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
23111
23698
  watch(
23112
23699
  () => pluginSettingsContextQuery.dataUpdatedAt,
23113
23700
  () => {
23114
- if (toValue(loading)) {
23701
+ if (toValue$1(loading)) {
23115
23702
  return;
23116
23703
  }
23117
- const pluginSettingsView = toValue(pluginSettingsContextQuery.data);
23118
- const dynamicContext = toValue(dynamicContextQuery.data);
23119
- 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)) {
23120
23707
  tabs.value = [];
23121
23708
  return;
23122
23709
  }
23710
+ const pluginSettingsView = filterPluginSettingsView(rawPluginSettingsView, orderMode.value);
23123
23711
  tabs.value = createPluginSettingsTabs(pluginSettingsView, {
23124
23712
  pluginSettings: dynamicContext.pluginSettings,
23125
23713
  actionContext,
@@ -23150,11 +23738,11 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
23150
23738
  setup(__props) {
23151
23739
  const { fetchWebhooks, createWebhooks, deleteWebhooks } = useQueryStore().registerWebhookQueries();
23152
23740
  useActionStore().registerWebhookActions();
23153
- const data = computed(() => toValue(fetchWebhooks.data) ?? []);
23741
+ const data = computed(() => toValue$1(fetchWebhooks.data) ?? []);
23154
23742
  const webhooks = computed(() => {
23155
23743
  return data.value.map((webhook) => {
23156
23744
  let status = Status.Pending;
23157
- if (!toValue(fetchWebhooks.isLoading) && !toValue(createWebhooks.isLoading) && !toValue(deleteWebhooks.isLoading)) {
23745
+ if (!toValue$1(fetchWebhooks.isLoading) && !toValue$1(createWebhooks.isLoading) && !toValue$1(deleteWebhooks.isLoading)) {
23158
23746
  status = webhook.connected ? Status.Success : Status.Error;
23159
23747
  }
23160
23748
  return { ...webhook, status };
@@ -23269,7 +23857,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
23269
23857
  const form = ref();
23270
23858
  const hasAccount = computed(() => {
23271
23859
  var _a;
23272
- return Boolean((_a = toValue(contextQuery.data)) == null ? void 0 : _a.account);
23860
+ return Boolean((_a = toValue$1(contextQuery.data)) == null ? void 0 : _a.account);
23273
23861
  });
23274
23862
  watch(
23275
23863
  contextQuery.data,
@@ -23318,7 +23906,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
23318
23906
  const switchToProductionApiInstance = instantiateAction(switchToProductionApiAction);
23319
23907
  const isConnectedToAcceptance = computed(() => {
23320
23908
  var _a, _b;
23321
- const context = toValue(contextQuery.data);
23909
+ const context = toValue$1(contextQuery.data);
23322
23910
  const environment = (_b = (_a = context == null ? void 0 : context.pluginSettings) == null ? void 0 : _a.account) == null ? void 0 : _b.environment;
23323
23911
  return environment === "acceptance";
23324
23912
  });
@@ -23372,14 +23960,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23372
23960
  const contextQuery = useStoreContextQuery();
23373
23961
  const updateAccount = useUpdateAccountMutation();
23374
23962
  const deleteAccount = useDeleteAccountMutation();
23375
- 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);
23376
23964
  const hasApiKey = computed(() => {
23377
23965
  var _a;
23378
- 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);
23379
23967
  });
23380
23968
  const hasAccount = computed(() => {
23381
23969
  var _a;
23382
- 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);
23383
23971
  });
23384
23972
  const { translate: translate2 } = useLanguage();
23385
23973
  const tabs = computed(() => {
@@ -23390,7 +23978,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
23390
23978
  label: "button_api_key_edit"
23391
23979
  }
23392
23980
  ];
23393
- if (toValue(hasAccount)) {
23981
+ if (toValue$1(hasAccount)) {
23394
23982
  array.push({
23395
23983
  name: "webhooks",
23396
23984
  component: _sfc_main$4,
@@ -23440,7 +24028,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
23440
24028
  const dynamicContextQuery = useStoreContextQuery();
23441
24029
  const hasAccount = computed(() => {
23442
24030
  var _a;
23443
- return Boolean((_a = toValue(dynamicContextQuery.data)) == null ? void 0 : _a.account);
24031
+ return Boolean((_a = toValue$1(dynamicContextQuery.data)) == null ? void 0 : _a.account);
23444
24032
  });
23445
24033
  return (_ctx, _cache) => {
23446
24034
  const _component_PdkPluginSettingsWrapper = resolveComponent("PdkPluginSettingsWrapper");
@@ -23455,7 +24043,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
23455
24043
  }
23456
24044
  });
23457
24045
  export {
23458
- ordersPrintAction as $,
24046
+ Size as $,
23459
24047
  AdminModalKey as A,
23460
24048
  _sfc_main$m as B,
23461
24049
  _sfc_main$k as C,
@@ -23476,175 +24064,182 @@ export {
23476
24064
  shipmentActions as R,
23477
24065
  AdminIcon as S,
23478
24066
  isDef as T,
23479
- instantiateAction as U,
23480
- orderViewInBackofficeAction as V,
23481
- ordersEditAction as W,
23482
- orderExportAction as X,
23483
- _sfc_main$t as Y,
23484
- 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,
23485
24073
  _sfc_main$l as _,
23486
24074
  createBlock as a,
23487
- useNotificationStore as a$,
23488
- ordersFetchAction as a0,
23489
- ordersExportPrintShipmentsAction as a1,
23490
- TransitionGroup as a2,
23491
- useDigitalStampRanges as a3,
23492
- isOfType$1 as a4,
23493
- _sfc_main$q as a5,
23494
- PackageTypeName as a6,
23495
- useFetchCarrier as a7,
23496
- _sfc_main$r as a8,
23497
- getDynamicTranslation as a9,
23498
- FORM_KEY_ACCOUNT_SETTINGS as aA,
23499
- FORM_KEY_CHILD_PRODUCT_SETTINGS as aB,
23500
- FORM_KEY_MODAL as aC,
23501
- FORM_KEY_MODAL_PRINT_OPTIONS as aD,
23502
- FORM_KEY_MODAL_RETURN_OPTIONS as aE,
23503
- FORM_KEY_MODAL_SHIPMENT_OPTIONS as aF,
23504
- FORM_KEY_PLUGIN_SETTINGS as aG,
23505
- FORM_KEY_PRODUCT_SETTINGS as aH,
23506
- resolveFormComponent as aI,
23507
- c as aJ,
23508
- Je as aK,
23509
- M as aL,
23510
- ne as aM,
23511
- INJECT_ADMIN_INSTANCE as aN,
23512
- INJECT_GLOBAL_PDK_ADMIN as aO,
23513
- LogLevel as aP,
23514
- getActionIdentifier as aQ,
23515
- PdkAdmin as aR,
23516
- createPdkAdmin as aS,
23517
- createAdminConfig as aT,
23518
- createPdkAdminPlugin as aU,
23519
- createFormElement as aV,
23520
- createLogger as aW,
23521
- generateFieldId as aX,
23522
- prefixComponent as aY,
23523
- useActionStore as aZ,
23524
- useModalStore as a_,
23525
- withModifiers as aa,
23526
- _sfc_main$f as ab,
23527
- _sfc_main$c as ac,
23528
- _sfc_main$b as ad,
23529
- _sfc_main$9 as ae,
23530
- _sfc_main$7 as af,
23531
- _sfc_main as ag,
23532
- _sfc_main$g as ah,
23533
- _sfc_main$p as ai,
23534
- PlainElement as aj,
23535
- _sfc_main$o as ak,
23536
- ReturnsForm as al,
23537
- _sfc_main$j as am,
23538
- _sfc_main$i as an,
23539
- _sfc_main$h as ao,
23540
- AdminAction as ap,
23541
- AdminComponent as aq,
23542
- AdminInstanceContextKey as ar,
23543
- AdminView as as,
23544
- NotificationCategory as at,
23545
- allAdminComponentNames as au,
23546
- optionalAdminActionContainerComponentNames as av,
23547
- optionalAdminComponentNames as aw,
23548
- optionalAdminPlainWrapperComponentNames as ax,
23549
- requiredAdminComponentNames as ay,
23550
- 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,
23551
24139
  unref as b,
23552
- shipmentsUpdateAction as b$,
23553
- useAppInfo as b0,
23554
- useCheckboxGroupContext as b1,
23555
- useDropOffInputContext as b2,
23556
- useDropdownButtonContext as b3,
23557
- useElementContext as b4,
23558
- useElementOptions as b5,
23559
- useFormatter as b6,
23560
- useGlobalContext as b7,
23561
- useGlobalPdkAdmin as b8,
23562
- useInputWithOptionsContext as b9,
23563
- usePrintShipmentsMutation as bA,
23564
- useUpdateShipmentsMutation as bB,
23565
- usePdkMutation as bC,
23566
- useCreateWebhooksMutation as bD,
23567
- useDeleteWebhooksMutation as bE,
23568
- useFetchContextQuery as bF,
23569
- useFetchOrdersQuery as bG,
23570
- useFetchProductsQuery as bH,
23571
- QUERY_KEY_ORDER as bI,
23572
- QUERY_KEY_SHIPMENT as bJ,
23573
- useFetchShipmentsQuery as bK,
23574
- useFetchWebhooksQuery as bL,
23575
- defineAction as bM,
23576
- updateAccountAction as bN,
23577
- refreshAccountAction as bO,
23578
- deleteAccountAction as bP,
23579
- fetchDynamicContextAction as bQ,
23580
- fetchPluginSettingsViewContextAction as bR,
23581
- downloadLogsAction as bS,
23582
- switchToAcceptanceApiAction as bT,
23583
- switchToProductionApiAction as bU,
23584
- modalCloseAction as bV,
23585
- modalSubmitFormAction as bW,
23586
- orderExportToShipmentsAction as bX,
23587
- ordersUpdateAction as bY,
23588
- pluginSettingsUpdateAction as bZ,
23589
- shipmentsExportReturnAction as b_,
23590
- useLoadMore as ba,
23591
- useLogger as bb,
23592
- useModalContext as bc,
23593
- useModalElementContext as bd,
23594
- useMultiSelectInputContext as be,
23595
- useProductData as bf,
23596
- useRadioGroupContext as bg,
23597
- useSelectInputContext as bh,
23598
- useShippingMethodsInputContext as bi,
23599
- useStoreQuery as bj,
23600
- useTableContext as bk,
23601
- useToggleInputContext as bl,
23602
- useTriStateInputContext as bm,
23603
- useWeekdays as bn,
23604
- useDeleteAccountMutation as bo,
23605
- useUpdateAccountMutation as bp,
23606
- useDownloadLogsMutation as bq,
23607
- useSwitchToAcceptanceApiMutation as br,
23608
- useSwitchToProductionApiMutation as bs,
23609
- useExportOrdersMutation as bt,
23610
- usePrintOrdersMutation as bu,
23611
- useUpdateOrdersMutation as bv,
23612
- useUpdatePluginSettingsMutation as bw,
23613
- useUpdateProductSettingsMutation as bx,
23614
- useDeleteShipmentsMutation as by,
23615
- 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,
23616
24204
  computed as c,
23617
- shipmentsDeleteAction as c0,
23618
- shipmentsPrintAction as c1,
23619
- webhooksFetchAction as c2,
23620
- webhooksCreateAction as c3,
23621
- webhooksDeleteAction as c4,
23622
- createHandlerWithParameters as c5,
23623
- createMutationHandler as c6,
23624
- createOrdersMutationHandler as c7,
23625
- createQueryHandler as c8,
23626
- createShipmentsMutationHandler as c9,
23627
- doMutate as ca,
23628
- executeAction as cb,
23629
- executeAfterHandle as cc,
23630
- executeBeforeHandle as cd,
23631
- executeHandler as ce,
23632
- executeNextAction as cf,
23633
- resolveOrderParameters as cg,
23634
- resolveQuerySuffix as ch,
23635
- openOrPrintPdf as ci,
23636
- resolvePrintParameters as cj,
23637
- waitForLabelPrompt as ck,
23638
- StopActionHandler as cl,
23639
- _sfc_main$8 as cm,
23640
- _sfc_main$6 as cn,
23641
- Variant as co,
23642
- Status as cp,
23643
- TriState as cq,
23644
- SortType as cr,
23645
- AdminContextKey as cs,
23646
- BackendEndpoint as ct,
23647
- 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,
23648
24243
  defineComponent as d,
23649
24244
  createCommentVNode as e,
23650
24245
  useContext as f,
@@ -23661,7 +24256,7 @@ export {
23661
24256
  useVModel as q,
23662
24257
  ref as r,
23663
24258
  resolveComponent as s,
23664
- toValue as t,
24259
+ toValue$1 as t,
23665
24260
  useOrdersData as u,
23666
24261
  withCtx as v,
23667
24262
  watch as w,