@myparcel-dev/pdk-admin 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +459 -0
- package/dist/__tests__/doComponentTestSetup.d.ts +2 -0
- package/dist/__tests__/doComponentTestTeardown.d.ts +1 -0
- package/dist/__tests__/index.d.ts +3 -0
- package/dist/__tests__/mocks/index.d.ts +14 -0
- package/dist/__tests__/mocks/mockDefaultAccount.d.ts +2 -0
- package/dist/__tests__/mocks/mockDefaultAppConfig.d.ts +2 -0
- package/dist/__tests__/mocks/mockDefaultAppInfo.d.ts +2 -0
- package/dist/__tests__/mocks/mockDefaultCarriers.d.ts +2 -0
- package/dist/__tests__/mocks/mockDefaultConfig.d.ts +2 -0
- package/dist/__tests__/mocks/mockDefaultDynamicContext.d.ts +2 -0
- package/dist/__tests__/mocks/mockDefaultEndpoints.d.ts +2 -0
- package/dist/__tests__/mocks/mockDefaultGlobalContext.d.ts +2 -0
- package/dist/__tests__/mocks/mockDefaultLogger.d.ts +1 -0
- package/dist/__tests__/mocks/mockDefaultPlatform.d.ts +2 -0
- package/dist/__tests__/mocks/mockDefaultPluginSettings.d.ts +2 -0
- package/dist/__tests__/mocks/mockDefaultPrintOptionsView.d.ts +2 -0
- package/dist/__tests__/mocks/mockDefaultShop.d.ts +2 -0
- package/dist/__tests__/mocks/mockDefaultTranslations.d.ts +2 -0
- package/dist/actions/composables/index.d.ts +2 -0
- package/dist/actions/composables/mutations/account/index.d.ts +2 -0
- package/dist/actions/composables/mutations/account/useDeleteAccountMutation.d.ts +3 -0
- package/dist/actions/composables/mutations/account/useUpdateAccountMutation.d.ts +3 -0
- package/dist/actions/composables/mutations/debug/index.d.ts +3 -0
- package/dist/actions/composables/mutations/debug/useDownloadLogsMutation.d.ts +3 -0
- package/dist/actions/composables/mutations/debug/useSwitchToAcceptanceApiMutation.d.ts +3 -0
- package/dist/actions/composables/mutations/debug/useSwitchToProductionApiMutation.d.ts +3 -0
- package/dist/actions/composables/mutations/index.d.ts +7 -0
- package/dist/actions/composables/mutations/orders/index.d.ts +3 -0
- package/dist/actions/composables/mutations/orders/useExportOrdersMutation.d.ts +5 -0
- package/dist/actions/composables/mutations/orders/usePrintOrdersMutation.d.ts +4 -0
- package/dist/actions/composables/mutations/orders/useUpdateOrdersMutation.d.ts +4 -0
- package/dist/actions/composables/mutations/settings/index.d.ts +2 -0
- package/dist/actions/composables/mutations/settings/useUpdatePluginSettingsMutation.d.ts +3 -0
- package/dist/actions/composables/mutations/settings/useUpdateProductSettingsMutation.d.ts +3 -0
- package/dist/actions/composables/mutations/shipments/index.d.ts +4 -0
- package/dist/actions/composables/mutations/shipments/useDeleteShipmentsMutation.d.ts +4 -0
- package/dist/actions/composables/mutations/shipments/useExportReturnMutation.d.ts +4 -0
- package/dist/actions/composables/mutations/shipments/usePrintShipmentsMutation.d.ts +4 -0
- package/dist/actions/composables/mutations/shipments/useUpdateShipmentsMutation.d.ts +4 -0
- package/dist/actions/composables/mutations/usePdkMutation.d.ts +15 -0
- package/dist/actions/composables/mutations/webhooks/index.d.ts +2 -0
- package/dist/actions/composables/mutations/webhooks/useCreateWebhooksMutation.d.ts +1 -0
- package/dist/actions/composables/mutations/webhooks/useDeleteWebhooksMutation.d.ts +3 -0
- package/dist/actions/composables/queries/account/index.d.ts +1 -0
- package/dist/actions/composables/queries/account/useFetchContextQuery.d.ts +3 -0
- package/dist/actions/composables/queries/index.d.ts +6 -0
- package/dist/actions/composables/queries/orders/index.d.ts +1 -0
- package/dist/actions/composables/queries/orders/useFetchOrdersQuery.d.ts +3 -0
- package/dist/actions/composables/queries/products/index.d.ts +1 -0
- package/dist/actions/composables/queries/products/useFetchProductsQuery.d.ts +3 -0
- package/dist/actions/composables/queries/queryKeys.d.ts +2 -0
- package/dist/actions/composables/queries/shipments/index.d.ts +1 -0
- package/dist/actions/composables/queries/shipments/useFetchShipmentsQuery.d.ts +4 -0
- package/dist/actions/composables/queries/webhooks/index.d.ts +1 -0
- package/dist/actions/composables/queries/webhooks/useFetchWebhooksQuery.d.ts +3 -0
- package/dist/actions/defineAction.d.ts +8 -0
- package/dist/actions/definitions/account.d.ts +13 -0
- package/dist/actions/definitions/context.d.ts +6 -0
- package/dist/actions/definitions/debug.d.ts +13 -0
- package/dist/actions/definitions/index.d.ts +8 -0
- package/dist/actions/definitions/modal.d.ts +17 -0
- package/dist/actions/definitions/orders.d.ts +38 -0
- package/dist/actions/definitions/settings.d.ts +2 -0
- package/dist/actions/definitions/shipments.d.ts +15 -0
- package/dist/actions/definitions/webhooks.d.ts +4 -0
- package/dist/actions/executors/createHandlerWithParameters.d.ts +5 -0
- package/dist/actions/executors/createMutationHandler.d.ts +3 -0
- package/dist/actions/executors/createOrdersMutationHandler.d.ts +2 -0
- package/dist/actions/executors/createQueryHandler.d.ts +3 -0
- package/dist/actions/executors/createShipmentsMutationHandler.d.ts +2 -0
- package/dist/actions/executors/doMutate.d.ts +4 -0
- package/dist/actions/executors/executeAction.d.ts +6 -0
- package/dist/actions/executors/executeAfterHandle.d.ts +3 -0
- package/dist/actions/executors/executeBeforeHandle.d.ts +4 -0
- package/dist/actions/executors/executeHandler.d.ts +3 -0
- package/dist/actions/executors/executeNextAction.d.ts +6 -0
- package/dist/actions/executors/index.d.ts +14 -0
- package/dist/actions/executors/resolveOrderParameters.d.ts +3 -0
- package/dist/actions/executors/resolveQuerySuffix.d.ts +3 -0
- package/dist/actions/executors/types.d.ts +19 -0
- package/dist/actions/index.d.ts +6 -0
- package/dist/actions/print/index.d.ts +3 -0
- package/dist/actions/print/openOrPrintPdf.d.ts +3 -0
- package/dist/actions/print/resolvePrintParameters.d.ts +3 -0
- package/dist/actions/print/waitForLabelPrompt.d.ts +3 -0
- package/dist/actions/stopActionHandler.d.ts +2 -0
- package/dist/components/OrderBox/OrderShipmentsTable.vue.d.ts +6 -0
- package/dist/components/OrderBox/OrderShipmentsTableRow.vue.d.ts +21 -0
- package/dist/components/OrderBox/ShipmentOptionsBox.vue.d.ts +2 -0
- package/dist/components/OrderBox/ShipmentTableBox.vue.d.ts +2 -0
- package/dist/components/OrderListItem/OrderModeOrderListItem.vue.d.ts +2 -0
- package/dist/components/OrderListItem/ShipmentLabel.vue.d.ts +15 -0
- package/dist/components/OrderListItem/ShipmentModeOrderListItem.vue.d.ts +2 -0
- package/dist/components/PluginSettings/AccountSettings.vue.d.ts +2 -0
- package/dist/components/PluginSettings/DebugOptions.vue.d.ts +2 -0
- package/dist/components/PluginSettings/EditApiKeyForm.vue.d.ts +7 -0
- package/dist/components/PluginSettings/PluginSettingsForms.vue.d.ts +2 -0
- package/dist/components/PluginSettings/WebhooksStatus.vue.d.ts +2 -0
- package/dist/components/PluginSettings/createUpdateAccountSettingsValidator.d.ts +4 -0
- package/dist/components/common/ActionButton.vue.d.ts +52 -0
- package/dist/components/common/BulkSelectCheckbox.vue.d.ts +22 -0
- package/dist/components/common/CarrierLogo.vue.d.ts +16 -0
- package/dist/components/common/DateRelative.vue.d.ts +16 -0
- package/dist/components/common/DeliveryOptionsDeliveryType.vue.d.ts +16 -0
- package/dist/components/common/DeliveryOptionsExcerpt.vue.d.ts +2 -0
- package/dist/components/common/DeliveryOptionsExcerptCarrierName.vue.d.ts +16 -0
- package/dist/components/common/DeliveryOptionsPackageType.vue.d.ts +16 -0
- package/dist/components/common/DigitalStampWeightRange.vue.d.ts +15 -0
- package/dist/components/common/NotificationContainer.vue.d.ts +19 -0
- package/dist/components/common/PackageType.vue.d.ts +16 -0
- package/dist/components/common/PlainElement.d.ts +2 -0
- package/dist/components/common/ResetButton.vue.d.ts +15 -0
- package/dist/components/common/ReturnsForm.vue.d.ts +14 -0
- package/dist/components/common/ShipmentBarcode.vue.d.ts +15 -0
- package/dist/components/common/ShipmentOptionsForm.vue.d.ts +16 -0
- package/dist/components/common/ShipmentStatus.vue.d.ts +15 -0
- package/dist/components/common/StatusIndicator.vue.d.ts +23 -0
- package/dist/components/common/SubmitButton.vue.d.ts +15 -0
- package/dist/components/common/TabNavigation.vue.d.ts +66 -0
- package/dist/components/common/index.d.ts +20 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/modals/PrintOptionsModal.vue.d.ts +2 -0
- package/dist/components/modals/PrintOptionsModalForm.vue.d.ts +2 -0
- package/dist/components/modals/ShipmentOptionsModal.vue.d.ts +2 -0
- package/dist/components/modals/ShipmentOptionsModalForm.vue.d.ts +16 -0
- package/dist/composables/components/index.d.ts +15 -0
- package/dist/composables/components/useBulkSelectCheckbox.d.ts +9 -0
- package/dist/composables/components/useCheckboxGroupContext.d.ts +4 -0
- package/dist/composables/components/useDropOffInputContext.d.ts +13 -0
- package/dist/composables/components/useDropdownButtonContext.d.ts +15 -0
- package/dist/composables/components/useElementContext.d.ts +7 -0
- package/dist/composables/components/useElementOptions.d.ts +6 -0
- package/dist/composables/components/useInputWithOptionsContext.d.ts +10 -0
- package/dist/composables/components/useModalElementContext.d.ts +11 -0
- package/dist/composables/components/useMultiSelectInputContext.d.ts +4 -0
- package/dist/composables/components/useRadioGroupContext.d.ts +10 -0
- package/dist/composables/components/useSelectInputContext.d.ts +4 -0
- package/dist/composables/components/useShippingMethodsInputContext.d.ts +13 -0
- package/dist/composables/components/useTableContext.d.ts +7 -0
- package/dist/composables/components/useToggleInputContext.d.ts +11 -0
- package/dist/composables/components/useTriStateInputContext.d.ts +17 -0
- package/dist/composables/context/index.d.ts +7 -0
- package/dist/composables/context/useAppInfo.d.ts +2 -0
- package/dist/composables/context/useContext.d.ts +3 -0
- package/dist/composables/context/useGlobalContext.d.ts +2 -0
- package/dist/composables/context/useInstanceContext.d.ts +8 -0
- package/dist/composables/context/useModalContext.d.ts +11 -0
- package/dist/composables/context/useModalOrder.d.ts +1 -0
- package/dist/composables/context/usePluginSettings.d.ts +2 -0
- package/dist/composables/formatter/default/createCurrencyFormat.d.ts +1 -0
- package/dist/composables/formatter/default/createLongDateFormat.d.ts +1 -0
- package/dist/composables/formatter/default/createRelativeTimeFormat.d.ts +1 -0
- package/dist/composables/formatter/default/defaultCurrencyFormatters.d.ts +2 -0
- package/dist/composables/formatter/default/defaultDateFormatters.d.ts +4 -0
- package/dist/composables/formatter/default/index.d.ts +6 -0
- package/dist/composables/formatter/default/parseDate.d.ts +1 -0
- package/dist/composables/formatter/formatter.types.d.ts +23 -0
- package/dist/composables/formatter/index.d.ts +4 -0
- package/dist/composables/formatter/useFormatter.d.ts +2 -0
- package/dist/composables/formatter/useLocalizedFormatter.d.ts +2 -0
- package/dist/composables/index.d.ts +17 -0
- package/dist/composables/language/index.d.ts +4 -0
- package/dist/composables/language/resolveTranslatedString.d.ts +3 -0
- package/dist/composables/language/resolveTranslationKey.d.ts +2 -0
- package/dist/composables/language/types.d.ts +1 -0
- package/dist/composables/language/useLanguage.d.ts +23 -0
- package/dist/composables/orders/index.d.ts +3 -0
- package/dist/composables/orders/useOrder.d.ts +3 -0
- package/dist/composables/orders/useOrderData.d.ts +9 -0
- package/dist/composables/orders/useOrdersData.d.ts +3 -0
- package/dist/composables/products/index.d.ts +1 -0
- package/dist/composables/products/useProductData.d.ts +8 -0
- package/dist/composables/shipments/index.d.ts +3 -0
- package/dist/composables/shipments/useShipment.d.ts +3 -0
- package/dist/composables/shipments/useShipmentData.d.ts +12 -0
- package/dist/composables/shipments/useShipmentsData.d.ts +2 -0
- package/dist/composables/useAdminConfig.d.ts +2 -0
- package/dist/composables/useAdminInstance.d.ts +2 -0
- package/dist/composables/useDigitalStampRanges.d.ts +9 -0
- package/dist/composables/useGlobalPdkAdmin.d.ts +2 -0
- package/dist/composables/useLoadMore.d.ts +14 -0
- package/dist/composables/useLoading.d.ts +10 -0
- package/dist/composables/useLogger.d.ts +2 -0
- package/dist/composables/useStoreContextQuery.d.ts +3 -0
- package/dist/composables/useStoreQuery.d.ts +4 -0
- package/dist/composables/useWeekdays.d.ts +9 -0
- package/dist/data/components.d.ts +195 -0
- package/dist/data/constants.d.ts +63 -0
- package/dist/data/endpoints.d.ts +5 -0
- package/dist/data/index.d.ts +4 -0
- package/dist/data/view.d.ts +9 -0
- package/dist/deprecated.d.ts +6 -0
- package/dist/forms/createReturnsForm.d.ts +1 -0
- package/dist/forms/form-builder/builders/buildAfterUpdate.d.ts +3 -0
- package/dist/forms/form-builder/builders/buildFormStateWatcher.d.ts +3 -0
- package/dist/forms/form-builder/builders/index.d.ts +2 -0
- package/dist/forms/form-builder/conditions/index.d.ts +3 -0
- package/dist/forms/form-builder/conditions/validateIfCondition.d.ts +2 -0
- package/dist/forms/form-builder/conditions/validateIfConditions.d.ts +2 -0
- package/dist/forms/form-builder/conditions/validateIsTruthy.d.ts +2 -0
- package/dist/forms/form-builder/index.d.ts +5 -0
- package/dist/forms/form-builder/operations/executeCustomOperationHandlers.d.ts +2 -0
- package/dist/forms/form-builder/operations/executeOperation.d.ts +2 -0
- package/dist/forms/form-builder/operations/executeOperations.d.ts +2 -0
- package/dist/forms/form-builder/operations/executeSetPropOperation.d.ts +2 -0
- package/dist/forms/form-builder/operations/executeSetValueOperation.d.ts +2 -0
- package/dist/forms/form-builder/operations/index.d.ts +5 -0
- package/dist/forms/form-builder/operations/parseBuilders.d.ts +3 -0
- package/dist/forms/form-builder/types/FormCondition.types.d.ts +36 -0
- package/dist/forms/form-builder/types/FormOperations.types.d.ts +16 -0
- package/dist/forms/form-builder/types/SubOperationBuilder.types.d.ts +13 -0
- package/dist/forms/form-builder/types/common.types.d.ts +21 -0
- package/dist/forms/form-builder/types/index.d.ts +4 -0
- package/dist/forms/form-builder/utils/createPropSetter.d.ts +4 -0
- package/dist/forms/form-builder/utils/createValueGetter.d.ts +4 -0
- package/dist/forms/form-builder/utils/createValueSetter.d.ts +4 -0
- package/dist/forms/form-builder/utils/index.d.ts +4 -0
- package/dist/forms/formKeys.d.ts +10 -0
- package/dist/forms/helpers/addBulkEditNotification.d.ts +1 -0
- package/dist/forms/helpers/createDefaultOption.d.ts +3 -0
- package/dist/forms/helpers/createHasShipmentOptionWatcher.d.ts +3 -0
- package/dist/forms/helpers/createLabel.d.ts +1 -0
- package/dist/forms/helpers/defineFormField.d.ts +2 -0
- package/dist/forms/helpers/getCarrier.d.ts +3 -0
- package/dist/forms/helpers/getDeliveryTypes.d.ts +3 -0
- package/dist/forms/helpers/getFieldLabel.d.ts +2 -0
- package/dist/forms/helpers/getFormCarrierName.d.ts +2 -0
- package/dist/forms/helpers/getInsuranceOptions.d.ts +3 -0
- package/dist/forms/helpers/getPackageTypes.d.ts +3 -0
- package/dist/forms/helpers/hasPostNlAgeCheck.d.ts +2 -0
- package/dist/forms/helpers/hasShipmentOption.d.ts +3 -0
- package/dist/forms/helpers/index.d.ts +20 -0
- package/dist/forms/helpers/isPackageTypePackage.d.ts +2 -0
- package/dist/forms/helpers/isPackageTypePackageOrSmall.d.ts +2 -0
- package/dist/forms/helpers/isPackageTypeSmallPackage.d.ts +2 -0
- package/dist/forms/helpers/resolveFormComponent.d.ts +3 -0
- package/dist/forms/helpers/setFieldProp.d.ts +8 -0
- package/dist/forms/helpers/setPostNlAgeCheckSubtext.d.ts +2 -0
- package/dist/forms/helpers/triStateFieldIsEnabled.d.ts +2 -0
- package/dist/forms/helpers/updateFieldsDefaults.d.ts +6 -0
- package/dist/forms/index.d.ts +6 -0
- package/dist/forms/pluginSettings/createFormTab.d.ts +3 -0
- package/dist/forms/pluginSettings/createPluginSettingsForm.d.ts +4 -0
- package/dist/forms/pluginSettings/createPluginSettingsTabs.d.ts +4 -0
- package/dist/forms/pluginSettings/createPluginSettingsTabsComponent.d.ts +4 -0
- package/dist/forms/pluginSettings/generateFormFields.d.ts +8 -0
- package/dist/forms/pluginSettings/index.d.ts +6 -0
- package/dist/forms/pluginSettings/types.d.ts +13 -0
- package/dist/forms/shipmentOptions/createShipmentOptionsForm.d.ts +4 -0
- package/dist/forms/shipmentOptions/field.d.ts +34 -0
- package/dist/forms/shipmentOptions/fields/createAgeCheckField.d.ts +3 -0
- package/dist/forms/shipmentOptions/fields/createCarrierField.d.ts +4 -0
- package/dist/forms/shipmentOptions/fields/createDeliveryTypeField.d.ts +3 -0
- package/dist/forms/shipmentOptions/fields/createDigitalStampRangeField.d.ts +3 -0
- package/dist/forms/shipmentOptions/fields/createDirectReturnField.d.ts +3 -0
- package/dist/forms/shipmentOptions/fields/createHideSenderField.d.ts +3 -0
- package/dist/forms/shipmentOptions/fields/createInsuranceField.d.ts +3 -0
- package/dist/forms/shipmentOptions/fields/createLabelAmountField.d.ts +3 -0
- package/dist/forms/shipmentOptions/fields/createLargeFormatField.d.ts +3 -0
- package/dist/forms/shipmentOptions/fields/createOnlyRecipientField.d.ts +3 -0
- package/dist/forms/shipmentOptions/fields/createPackageTypeField.d.ts +3 -0
- package/dist/forms/shipmentOptions/fields/createReceiptCodeField.d.ts +3 -0
- package/dist/forms/shipmentOptions/fields/createRef.d.ts +3 -0
- package/dist/forms/shipmentOptions/fields/createSameDayDeliveryField.d.ts +3 -0
- package/dist/forms/shipmentOptions/fields/createShipmentOptionField.d.ts +4 -0
- package/dist/forms/shipmentOptions/fields/createSignatureField.d.ts +3 -0
- package/dist/forms/shipmentOptions/fields/index.d.ts +14 -0
- package/dist/forms/shipmentOptions/index.d.ts +4 -0
- package/dist/forms/shipmentOptions/types.d.ts +2 -0
- package/dist/index.d.ts +19 -0
- package/dist/pdk/PdkAdmin.d.ts +18 -0
- package/dist/pdk/boot.d.ts +3 -0
- package/dist/pdk/createAdminConfig.d.ts +2 -0
- package/dist/pdk/createPdkAdmin.d.ts +8 -0
- package/dist/pdk/createPdkAdminPlugin.d.ts +3 -0
- package/dist/pdk/fillShipmentsQueryData.d.ts +4 -0
- package/dist/pdk/index.d.ts +11 -0
- package/dist/pdk/instance/createInstanceContext.d.ts +5 -0
- package/dist/pdk/instance/createQueryClient.d.ts +2 -0
- package/dist/pdk/instance/index.d.ts +3 -0
- package/dist/pdk/instance/plugins/createContextPlugin.d.ts +2 -0
- package/dist/pdk/instance/plugins/createLoggerPlugin.d.ts +2 -0
- package/dist/pdk/instance/plugins/createRegisterComponentsPlugin.d.ts +5 -0
- package/dist/pdk/instance/plugins/createStorePlugin.d.ts +2 -0
- package/dist/pdk/instance/plugins/createVueQueryPlugin.d.ts +5 -0
- package/dist/pdk/instance/plugins/index.d.ts +6 -0
- package/dist/pdk/instance/plugins/plugins.types.d.ts +3 -0
- package/dist/pdk/renderMap.d.ts +3 -0
- package/dist/pdk/sendBootEvent.d.ts +3 -0
- package/dist/pdk/setupAdminApp.d.ts +3 -0
- package/dist/pdk/testIdDirective.d.ts +5 -0
- package/dist/sdk/PdkFetchClient.d.ts +11 -0
- package/dist/sdk/composables/api/index.d.ts +1 -0
- package/dist/sdk/composables/api/useFetchCarrier.d.ts +2 -0
- package/dist/sdk/composables/index.d.ts +3 -0
- package/dist/sdk/composables/useMyParcelApi.d.ts +5 -0
- package/dist/sdk/composables/usePdkAdminApi.d.ts +6 -0
- package/dist/sdk/endpoints/abstractPdkEndpoint.d.ts +7 -0
- package/dist/sdk/endpoints/index.d.ts +1 -0
- package/dist/sdk/index.d.ts +3 -0
- package/dist/services/actions/createAction.d.ts +4 -0
- package/dist/services/actions/createActionContext.d.ts +3 -0
- package/dist/services/actions/downloadFile.d.ts +4 -0
- package/dist/services/actions/getActionIdentifier.d.ts +2 -0
- package/dist/services/actions/index.d.ts +4 -0
- package/dist/services/addErrorToNotifications.d.ts +2 -0
- package/dist/services/context/getElementContext.d.ts +2 -0
- package/dist/services/context/index.d.ts +1 -0
- package/dist/services/createNotification.d.ts +5 -0
- package/dist/services/index.d.ts +9 -0
- package/dist/services/instantiateAction.d.ts +2 -0
- package/dist/services/instantiateActions.d.ts +8 -0
- package/dist/services/logger.d.ts +19 -0
- package/dist/services/mutations/getCallbackForMutationMode.d.ts +4 -0
- package/dist/services/mutations/getModalMutationOptions.d.ts +2 -0
- package/dist/services/mutations/index.d.ts +3 -0
- package/dist/services/mutations/mutationMode.d.ts +4 -0
- package/dist/services/print/index.d.ts +1 -0
- package/dist/services/print/openPdfInNewWindow.d.ts +4 -0
- package/dist/stores/createQueryCacheKey.d.ts +3 -0
- package/dist/stores/index.d.ts +6 -0
- package/dist/stores/types.d.ts +13 -0
- package/dist/stores/useActionStore.d.ts +25 -0
- package/dist/stores/useModalStore.d.ts +16 -0
- package/dist/stores/useNotificationStore.d.ts +60 -0
- package/dist/stores/useQueryStore.d.ts +77 -0
- package/dist/symbols.d.ts +5 -0
- package/dist/testing.d.ts +1 -0
- package/dist/types/actions/actions.types.d.ts +31 -0
- package/dist/types/actions/endpoints.types.d.ts +9 -0
- package/dist/types/actions/index.d.ts +4 -0
- package/dist/types/actions/parameters.types.d.ts +55 -0
- package/dist/types/actions/response.types.d.ts +7 -0
- package/dist/types/actions.types.d.ts +45 -0
- package/dist/types/admin.types.d.ts +26 -0
- package/dist/types/common.types.d.ts +53 -0
- package/dist/types/components-form.types.d.ts +107 -0
- package/dist/types/components.types.d.ts +273 -0
- package/dist/types/configuration.types.d.ts +95 -0
- package/dist/types/context.types.d.ts +20 -0
- package/dist/types/endpoints.types.d.ts +7 -0
- package/dist/types/form.types.d.ts +39 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/language.types.d.ts +9 -0
- package/dist/types/sdk.types.d.ts +155 -0
- package/dist/utils/booleanToTriState.d.ts +2 -0
- package/dist/utils/convertDotNotationToObject.d.ts +1 -0
- package/dist/utils/createAssetUrl.d.ts +1 -0
- package/dist/utils/createClasses.d.ts +8 -0
- package/dist/utils/createObjectWithKeys.d.ts +3 -0
- package/dist/utils/decodeHtmlEntities.d.ts +7 -0
- package/dist/utils/downloadBlob.d.ts +1 -0
- package/dist/utils/downloadFileFromUrl.d.ts +1 -0
- package/dist/utils/encodeArrayParameter.d.ts +2 -0
- package/dist/utils/extendAdminInstance.d.ts +2 -0
- package/dist/utils/fakeLinkClick.d.ts +4 -0
- package/dist/utils/forms/createFormElement.d.ts +3 -0
- package/dist/utils/forms/createShipmentFormName.d.ts +1 -0
- package/dist/utils/forms/formToBody.d.ts +2 -0
- package/dist/utils/forms/generateFieldId.d.ts +3 -0
- package/dist/utils/forms/index.d.ts +4 -0
- package/dist/utils/generateLabelFilename.d.ts +3 -0
- package/dist/utils/getOrderId.d.ts +3 -0
- package/dist/utils/getOrderShipmentIds.d.ts +2 -0
- package/dist/utils/index.d.ts +22 -0
- package/dist/utils/openUrlInNewTab.d.ts +1 -0
- package/dist/utils/prefixComponent.d.ts +3 -0
- package/dist/utils/query/index.d.ts +3 -0
- package/dist/utils/query/setQueryData.d.ts +2 -0
- package/dist/utils/query/setQueryOrder.d.ts +10 -0
- package/dist/utils/query/setQueryShipment.d.ts +3 -0
- package/dist/utils/resolveCarrier.d.ts +1 -0
- package/dist/utils/translations/getDeliveryTypeTranslation.d.ts +2 -0
- package/dist/utils/translations/getDynamicTranslation.d.ts +1 -0
- package/dist/utils/translations/getPackageTypeTranslation.d.ts +2 -0
- package/dist/utils/translations/index.d.ts +4 -0
- package/dist/utils/translations/translateSelectOption.d.ts +3 -0
- package/dist/utils/triStateToBoolean.d.ts +2 -0
- package/dist/utils/unprefixComponent.d.ts +3 -0
- package/dist/utils/validateId.d.ts +2 -0
- package/dist/views/ChildProductSettings.vue.d.ts +2 -0
- package/dist/views/Modals.vue.d.ts +2 -0
- package/dist/views/Notifications.vue.d.ts +2 -0
- package/dist/views/OrderBox.vue.d.ts +2 -0
- package/dist/views/OrderListItem.vue.d.ts +2 -0
- package/dist/views/PluginSettings.vue.d.ts +2 -0
- package/dist/views/ProductSettings.vue.d.ts +35 -0
- package/dist/views/integrated/OrderBoxView.vue.d.ts +12 -0
- package/dist/views/integrated/OrderListItemView.vue.d.ts +12 -0
- package/dist/views/integrated/index.d.ts +7 -0
- package/package.json +70 -0
- package/src/__tests__/__snapshots__/exports.spec.ts.snap +195 -0
- package/src/__tests__/doComponentTestSetup.ts +54 -0
- package/src/__tests__/doComponentTestTeardown.ts +6 -0
- package/src/__tests__/exports.spec.ts +13 -0
- package/src/__tests__/getElementContext.spec.ts +18 -0
- package/src/__tests__/index.ts +3 -0
- package/src/__tests__/mocks/index.ts +14 -0
- package/src/__tests__/mocks/mockDefaultAccount.ts +18 -0
- package/src/__tests__/mocks/mockDefaultAppConfig.ts +21 -0
- package/src/__tests__/mocks/mockDefaultAppInfo.ts +12 -0
- package/src/__tests__/mocks/mockDefaultCarriers.ts +4 -0
- package/src/__tests__/mocks/mockDefaultConfig.ts +11 -0
- package/src/__tests__/mocks/mockDefaultDynamicContext.ts +17 -0
- package/src/__tests__/mocks/mockDefaultEndpoints.ts +19 -0
- package/src/__tests__/mocks/mockDefaultGlobalContext.ts +21 -0
- package/src/__tests__/mocks/mockDefaultLogger.ts +4 -0
- package/src/__tests__/mocks/mockDefaultPlatform.ts +14 -0
- package/src/__tests__/mocks/mockDefaultPluginSettings.ts +15 -0
- package/src/__tests__/mocks/mockDefaultPrintOptionsView.ts +13 -0
- package/src/__tests__/mocks/mockDefaultShop.ts +20 -0
- package/src/__tests__/mocks/mockDefaultTranslations.ts +4 -0
- package/src/__tests__/render.spec.ts +53 -0
- package/src/__tests__/utils/mockLinkElement.ts +20 -0
- package/src/actions/composables/index.ts +2 -0
- package/src/actions/composables/mutations/account/index.ts +2 -0
- package/src/actions/composables/mutations/account/useDeleteAccountMutation.ts +30 -0
- package/src/actions/composables/mutations/account/useUpdateAccountMutation.ts +60 -0
- package/src/actions/composables/mutations/debug/index.ts +3 -0
- package/src/actions/composables/mutations/debug/useDownloadLogsMutation.ts +8 -0
- package/src/actions/composables/mutations/debug/useSwitchToAcceptanceApiMutation.ts +10 -0
- package/src/actions/composables/mutations/debug/useSwitchToProductionApiMutation.ts +10 -0
- package/src/actions/composables/mutations/index.ts +7 -0
- package/src/actions/composables/mutations/orders/index.ts +3 -0
- package/src/actions/composables/mutations/orders/useExportOrdersMutation.ts +51 -0
- package/src/actions/composables/mutations/orders/usePrintOrdersMutation.ts +23 -0
- package/src/actions/composables/mutations/orders/useUpdateOrdersMutation.ts +36 -0
- package/src/actions/composables/mutations/settings/index.ts +2 -0
- package/src/actions/composables/mutations/settings/useUpdatePluginSettingsMutation.ts +16 -0
- package/src/actions/composables/mutations/settings/useUpdateProductSettingsMutation.ts +22 -0
- package/src/actions/composables/mutations/shipments/index.ts +4 -0
- package/src/actions/composables/mutations/shipments/useDeleteShipmentsMutation.ts +65 -0
- package/src/actions/composables/mutations/shipments/useExportReturnMutation.ts +36 -0
- package/src/actions/composables/mutations/shipments/usePrintShipmentsMutation.ts +39 -0
- package/src/actions/composables/mutations/shipments/useUpdateShipmentsMutation.ts +36 -0
- package/src/actions/composables/mutations/usePdkMutation.ts +41 -0
- package/src/actions/composables/mutations/webhooks/index.ts +2 -0
- package/src/actions/composables/mutations/webhooks/useCreateWebhooksMutation.ts +20 -0
- package/src/actions/composables/mutations/webhooks/useDeleteWebhooksMutation.ts +20 -0
- package/src/actions/composables/queries/account/index.ts +1 -0
- package/src/actions/composables/queries/account/useFetchContextQuery.ts +43 -0
- package/src/actions/composables/queries/index.ts +6 -0
- package/src/actions/composables/queries/orders/index.ts +1 -0
- package/src/actions/composables/queries/orders/useFetchOrdersQuery.ts +35 -0
- package/src/actions/composables/queries/products/index.ts +1 -0
- package/src/actions/composables/queries/products/useFetchProductsQuery.ts +20 -0
- package/src/actions/composables/queries/queryKeys.ts +3 -0
- package/src/actions/composables/queries/shipments/index.ts +1 -0
- package/src/actions/composables/queries/shipments/useFetchShipmentsQuery.ts +44 -0
- package/src/actions/composables/queries/webhooks/index.ts +1 -0
- package/src/actions/composables/queries/webhooks/useFetchWebhooksQuery.ts +24 -0
- package/src/actions/defineAction.ts +10 -0
- package/src/actions/definitions/account.ts +39 -0
- package/src/actions/definitions/context.ts +17 -0
- package/src/actions/definitions/debug.ts +39 -0
- package/src/actions/definitions/index.ts +8 -0
- package/src/actions/definitions/modal.ts +32 -0
- package/src/actions/definitions/orders.ts +128 -0
- package/src/actions/definitions/settings.ts +11 -0
- package/src/actions/definitions/shipments.ts +61 -0
- package/src/actions/definitions/webhooks.ts +25 -0
- package/src/actions/executors/createHandlerWithParameters.ts +29 -0
- package/src/actions/executors/createMutationHandler.ts +10 -0
- package/src/actions/executors/createOrdersMutationHandler.ts +12 -0
- package/src/actions/executors/createQueryHandler.ts +19 -0
- package/src/actions/executors/createShipmentsMutationHandler.ts +12 -0
- package/src/actions/executors/doMutate.ts +16 -0
- package/src/actions/executors/executeAction.ts +35 -0
- package/src/actions/executors/executeAfterHandle.ts +23 -0
- package/src/actions/executors/executeBeforeHandle.ts +29 -0
- package/src/actions/executors/executeHandler.ts +34 -0
- package/src/actions/executors/executeNextAction.ts +34 -0
- package/src/actions/executors/index.ts +14 -0
- package/src/actions/executors/resolveOrderParameters.ts +19 -0
- package/src/actions/executors/resolveQuerySuffix.ts +10 -0
- package/src/actions/executors/types.ts +45 -0
- package/src/actions/index.ts +6 -0
- package/src/actions/print/index.ts +3 -0
- package/src/actions/print/openOrPrintPdf.ts +16 -0
- package/src/actions/print/resolvePrintParameters.ts +24 -0
- package/src/actions/print/waitForLabelPrompt.ts +39 -0
- package/src/actions/stopActionHandler.ts +1 -0
- package/src/components/OrderBox/OrderShipmentsTable.vue +53 -0
- package/src/components/OrderBox/OrderShipmentsTableRow.vue +81 -0
- package/src/components/OrderBox/ShipmentOptionsBox.vue +74 -0
- package/src/components/OrderBox/ShipmentTableBox.vue +51 -0
- package/src/components/OrderListItem/OrderModeOrderListItem.vue +45 -0
- package/src/components/OrderListItem/ShipmentLabel.vue +44 -0
- package/src/components/OrderListItem/ShipmentModeOrderListItem.vue +67 -0
- package/src/components/PluginSettings/AccountSettings.vue +81 -0
- package/src/components/PluginSettings/DebugOptions.vue +89 -0
- package/src/components/PluginSettings/EditApiKeyForm.vue +89 -0
- package/src/components/PluginSettings/PluginSettingsForms.vue +56 -0
- package/src/components/PluginSettings/WebhooksStatus.vue +73 -0
- package/src/components/PluginSettings/createUpdateAccountSettingsValidator.ts +21 -0
- package/src/components/common/ActionButton.vue +53 -0
- package/src/components/common/BulkSelectCheckbox.vue +46 -0
- package/src/components/common/CarrierLogo.vue +14 -0
- package/src/components/common/DateRelative.vue +20 -0
- package/src/components/common/DeliveryOptionsDeliveryType.vue +23 -0
- package/src/components/common/DeliveryOptionsExcerpt.vue +39 -0
- package/src/components/common/DeliveryOptionsExcerptCarrierName.vue +21 -0
- package/src/components/common/DeliveryOptionsPackageType.vue +30 -0
- package/src/components/common/DigitalStampWeightRange.vue +14 -0
- package/src/components/common/NotificationContainer.vue +35 -0
- package/src/components/common/PackageType.vue +16 -0
- package/src/components/common/PlainElement.ts +8 -0
- package/src/components/common/ResetButton.vue +26 -0
- package/src/components/common/ReturnsForm.vue +31 -0
- package/src/components/common/ShipmentBarcode.vue +41 -0
- package/src/components/common/ShipmentOptionsForm.vue +22 -0
- package/src/components/common/ShipmentStatus.vue +23 -0
- package/src/components/common/StatusIndicator.vue +46 -0
- package/src/components/common/SubmitButton.vue +30 -0
- package/src/components/common/TabNavigation.vue +134 -0
- package/src/components/common/index.ts +39 -0
- package/src/components/index.ts +1 -0
- package/src/components/modals/PrintOptionsModal.vue +32 -0
- package/src/components/modals/PrintOptionsModalForm.vue +33 -0
- package/src/components/modals/ShipmentOptionsModal.vue +56 -0
- package/src/components/modals/ShipmentOptionsModalForm.vue +21 -0
- package/src/composables/components/index.ts +15 -0
- package/src/composables/components/useBulkSelectCheckbox.ts +39 -0
- package/src/composables/components/useCheckboxGroupContext.ts +10 -0
- package/src/composables/components/useDropOffInputContext.ts +74 -0
- package/src/composables/components/useDropdownButtonContext.ts +42 -0
- package/src/composables/components/useElementContext.ts +27 -0
- package/src/composables/components/useElementOptions.ts +48 -0
- package/src/composables/components/useInputWithOptionsContext.ts +46 -0
- package/src/composables/components/useModalElementContext.ts +27 -0
- package/src/composables/components/useMultiSelectInputContext.ts +11 -0
- package/src/composables/components/useRadioGroupContext.ts +56 -0
- package/src/composables/components/useSelectInputContext.ts +11 -0
- package/src/composables/components/useShippingMethodsInputContext.spec.ts +93 -0
- package/src/composables/components/useShippingMethodsInputContext.ts +130 -0
- package/src/composables/components/useTableContext.ts +17 -0
- package/src/composables/components/useToggleInputContext.ts +35 -0
- package/src/composables/components/useTriStateInputContext.ts +117 -0
- package/src/composables/context/index.ts +7 -0
- package/src/composables/context/useAppInfo.ts +6 -0
- package/src/composables/context/useContext.ts +18 -0
- package/src/composables/context/useGlobalContext.ts +7 -0
- package/src/composables/context/useInstanceContext.ts +15 -0
- package/src/composables/context/useModalContext.ts +52 -0
- package/src/composables/context/useModalOrder.ts +13 -0
- package/src/composables/context/usePluginSettings.ts +12 -0
- package/src/composables/formatter/default/createCurrencyFormat.ts +6 -0
- package/src/composables/formatter/default/createLongDateFormat.ts +7 -0
- package/src/composables/formatter/default/createRelativeTimeFormat.ts +5 -0
- package/src/composables/formatter/default/defaultCurrencyFormatters.ts +16 -0
- package/src/composables/formatter/default/defaultDateFormatters.ts +83 -0
- package/src/composables/formatter/default/index.ts +6 -0
- package/src/composables/formatter/default/parseDate.ts +12 -0
- package/src/composables/formatter/formatter.types.ts +32 -0
- package/src/composables/formatter/index.ts +4 -0
- package/src/composables/formatter/useFormatter.spec.ts +147 -0
- package/src/composables/formatter/useFormatter.ts +51 -0
- package/src/composables/formatter/useLocalizedFormatter.ts +11 -0
- package/src/composables/index.ts +17 -0
- package/src/composables/language/index.ts +4 -0
- package/src/composables/language/resolveTranslatedString.ts +30 -0
- package/src/composables/language/resolveTranslationKey.ts +5 -0
- package/src/composables/language/types.ts +1 -0
- package/src/composables/language/useLanguage.spec.ts +124 -0
- package/src/composables/language/useLanguage.ts +117 -0
- package/src/composables/orders/index.ts +3 -0
- package/src/composables/orders/useOrder.ts +8 -0
- package/src/composables/orders/useOrderData.ts +29 -0
- package/src/composables/orders/useOrdersData.ts +14 -0
- package/src/composables/products/index.ts +1 -0
- package/src/composables/products/useProductData.ts +23 -0
- package/src/composables/shipments/index.ts +3 -0
- package/src/composables/shipments/useShipment.ts +7 -0
- package/src/composables/shipments/useShipmentData.ts +52 -0
- package/src/composables/shipments/useShipmentsData.ts +5 -0
- package/src/composables/useAdminConfig.ts +8 -0
- package/src/composables/useAdminInstance.ts +13 -0
- package/src/composables/useDigitalStampRanges.ts +38 -0
- package/src/composables/useGlobalPdkAdmin.ts +13 -0
- package/src/composables/useLoadMore.spec.ts +69 -0
- package/src/composables/useLoadMore.ts +46 -0
- package/src/composables/useLoading.spec.ts +20 -0
- package/src/composables/useLoading.ts +18 -0
- package/src/composables/useLogger.ts +8 -0
- package/src/composables/useStoreContextQuery.ts +9 -0
- package/src/composables/useStoreQuery.ts +9 -0
- package/src/composables/useWeekdays.ts +24 -0
- package/src/data/components.ts +289 -0
- package/src/data/constants.ts +76 -0
- package/src/data/endpoints.ts +28 -0
- package/src/data/index.ts +4 -0
- package/src/data/view.ts +9 -0
- package/src/deprecated.ts +9 -0
- package/src/forms/createReturnsForm.ts +8 -0
- package/src/forms/form-builder/builders/buildAfterUpdate.spec.ts +48 -0
- package/src/forms/form-builder/builders/buildAfterUpdate.ts +26 -0
- package/src/forms/form-builder/builders/buildFormStateWatcher.spec.ts +206 -0
- package/src/forms/form-builder/builders/buildFormStateWatcher.ts +15 -0
- package/src/forms/form-builder/builders/index.ts +2 -0
- package/src/forms/form-builder/conditions/index.ts +3 -0
- package/src/forms/form-builder/conditions/validateIfCondition.spec.ts +69 -0
- package/src/forms/form-builder/conditions/validateIfCondition.ts +43 -0
- package/src/forms/form-builder/conditions/validateIfConditions.spec.ts +238 -0
- package/src/forms/form-builder/conditions/validateIfConditions.ts +31 -0
- package/src/forms/form-builder/conditions/validateIsTruthy.ts +15 -0
- package/src/forms/form-builder/index.ts +5 -0
- package/src/forms/form-builder/operations/executeCustomOperationHandlers.ts +18 -0
- package/src/forms/form-builder/operations/executeOperation.ts +27 -0
- package/src/forms/form-builder/operations/executeOperations.spec.ts +63 -0
- package/src/forms/form-builder/operations/executeOperations.ts +10 -0
- package/src/forms/form-builder/operations/executeSetPropOperation.spec.ts +164 -0
- package/src/forms/form-builder/operations/executeSetPropOperation.ts +15 -0
- package/src/forms/form-builder/operations/executeSetValueOperation.spec.ts +203 -0
- package/src/forms/form-builder/operations/executeSetValueOperation.ts +15 -0
- package/src/forms/form-builder/operations/index.ts +5 -0
- package/src/forms/form-builder/operations/parseBuilders.spec.ts +70 -0
- package/src/forms/form-builder/operations/parseBuilders.ts +39 -0
- package/src/forms/form-builder/types/FormCondition.types.ts +57 -0
- package/src/forms/form-builder/types/FormOperations.types.ts +21 -0
- package/src/forms/form-builder/types/SubOperationBuilder.types.ts +18 -0
- package/src/forms/form-builder/types/common.types.ts +35 -0
- package/src/forms/form-builder/types/index.ts +4 -0
- package/src/forms/form-builder/utils/createPropSetter.ts +19 -0
- package/src/forms/form-builder/utils/createValueGetter.ts +16 -0
- package/src/forms/form-builder/utils/createValueSetter.ts +21 -0
- package/src/forms/form-builder/utils/index.ts +6 -0
- package/src/forms/formKeys.ts +28 -0
- package/src/forms/helpers/addBulkEditNotification.ts +21 -0
- package/src/forms/helpers/createDefaultOption.ts +12 -0
- package/src/forms/helpers/createHasShipmentOptionWatcher.ts +12 -0
- package/src/forms/helpers/createLabel.ts +3 -0
- package/src/forms/helpers/defineFormField.ts +19 -0
- package/src/forms/helpers/getCarrier.ts +11 -0
- package/src/forms/helpers/getDeliveryTypes.ts +19 -0
- package/src/forms/helpers/getFieldLabel.ts +6 -0
- package/src/forms/helpers/getFormCarrierName.ts +7 -0
- package/src/forms/helpers/getInsuranceOptions.ts +23 -0
- package/src/forms/helpers/getPackageTypes.ts +19 -0
- package/src/forms/helpers/hasPostNlAgeCheck.ts +11 -0
- package/src/forms/helpers/hasShipmentOption.ts +8 -0
- package/src/forms/helpers/index.ts +20 -0
- package/src/forms/helpers/isPackageTypePackage.ts +7 -0
- package/src/forms/helpers/isPackageTypePackageOrSmall.ts +7 -0
- package/src/forms/helpers/isPackageTypeSmallPackage.ts +7 -0
- package/src/forms/helpers/resolveFormComponent.ts +12 -0
- package/src/forms/helpers/setFieldProp.ts +32 -0
- package/src/forms/helpers/setPostNlAgeCheckSubtext.ts +17 -0
- package/src/forms/helpers/triStateFieldIsEnabled.ts +20 -0
- package/src/forms/helpers/updateFieldsDefaults.ts +26 -0
- package/src/forms/index.ts +6 -0
- package/src/forms/pluginSettings/__snapshots__/generateFormFields.spec.ts.snap +37 -0
- package/src/forms/pluginSettings/createFormTab.ts +19 -0
- package/src/forms/pluginSettings/createPluginSettingsForm.ts +39 -0
- package/src/forms/pluginSettings/createPluginSettingsTabs.ts +35 -0
- package/src/forms/pluginSettings/createPluginSettingsTabsComponent.ts +42 -0
- package/src/forms/pluginSettings/generateFormFields.spec.ts +54 -0
- package/src/forms/pluginSettings/generateFormFields.ts +50 -0
- package/src/forms/pluginSettings/index.ts +6 -0
- package/src/forms/pluginSettings/types.ts +15 -0
- package/src/forms/shipmentOptions/createShipmentOptionsForm.ts +83 -0
- package/src/forms/shipmentOptions/field.ts +90 -0
- package/src/forms/shipmentOptions/fields/createAgeCheckField.ts +33 -0
- package/src/forms/shipmentOptions/fields/createCarrierField.ts +83 -0
- package/src/forms/shipmentOptions/fields/createDeliveryTypeField.ts +18 -0
- package/src/forms/shipmentOptions/fields/createDigitalStampRangeField.ts +48 -0
- package/src/forms/shipmentOptions/fields/createDirectReturnField.ts +8 -0
- package/src/forms/shipmentOptions/fields/createHideSenderField.ts +8 -0
- package/src/forms/shipmentOptions/fields/createInsuranceField.ts +31 -0
- package/src/forms/shipmentOptions/fields/createLabelAmountField.ts +20 -0
- package/src/forms/shipmentOptions/fields/createLargeFormatField.ts +8 -0
- package/src/forms/shipmentOptions/fields/createOnlyRecipientField.ts +21 -0
- package/src/forms/shipmentOptions/fields/createPackageTypeField.ts +18 -0
- package/src/forms/shipmentOptions/fields/createReceiptCodeField.ts +21 -0
- package/src/forms/shipmentOptions/fields/createRef.ts +6 -0
- package/src/forms/shipmentOptions/fields/createSameDayDeliveryField.ts +8 -0
- package/src/forms/shipmentOptions/fields/createShipmentOptionField.ts +25 -0
- package/src/forms/shipmentOptions/fields/createSignatureField.ts +11 -0
- package/src/forms/shipmentOptions/fields/index.ts +14 -0
- package/src/forms/shipmentOptions/index.ts +4 -0
- package/src/forms/shipmentOptions/types.ts +3 -0
- package/src/index.ts +114 -0
- package/src/pdk/PdkAdmin.ts +82 -0
- package/src/pdk/boot.ts +14 -0
- package/src/pdk/createAdminConfig.ts +29 -0
- package/src/pdk/createPdkAdmin.ts +39 -0
- package/src/pdk/createPdkAdminPlugin.ts +18 -0
- package/src/pdk/fillShipmentsQueryData.ts +44 -0
- package/src/pdk/index.ts +11 -0
- package/src/pdk/instance/createInstanceContext.ts +23 -0
- package/src/pdk/instance/createQueryClient.ts +31 -0
- package/src/pdk/instance/index.ts +3 -0
- package/src/pdk/instance/plugins/createContextPlugin.ts +17 -0
- package/src/pdk/instance/plugins/createLoggerPlugin.ts +13 -0
- package/src/pdk/instance/plugins/createRegisterComponentsPlugin.spec.ts +58 -0
- package/src/pdk/instance/plugins/createRegisterComponentsPlugin.ts +87 -0
- package/src/pdk/instance/plugins/createStorePlugin.ts +23 -0
- package/src/pdk/instance/plugins/createVueQueryPlugin.ts +48 -0
- package/src/pdk/instance/plugins/index.ts +6 -0
- package/src/pdk/instance/plugins/plugins.types.ts +4 -0
- package/src/pdk/renderMap.ts +27 -0
- package/src/pdk/sendBootEvent.ts +12 -0
- package/src/pdk/setupAdminApp.ts +20 -0
- package/src/pdk/testIdDirective.spec.ts +42 -0
- package/src/pdk/testIdDirective.ts +28 -0
- package/src/sdk/PdkFetchClient.ts +70 -0
- package/src/sdk/composables/api/index.ts +1 -0
- package/src/sdk/composables/api/useFetchCarrier.ts +23 -0
- package/src/sdk/composables/index.ts +3 -0
- package/src/sdk/composables/useMyParcelApi.ts +18 -0
- package/src/sdk/composables/usePdkAdminApi.ts +34 -0
- package/src/sdk/endpoints/abstractPdkEndpoint.ts +10 -0
- package/src/sdk/endpoints/index.ts +1 -0
- package/src/sdk/index.ts +3 -0
- package/src/services/actions/createAction.ts +24 -0
- package/src/services/actions/createActionContext.ts +49 -0
- package/src/services/actions/downloadFile.ts +16 -0
- package/src/services/actions/getActionIdentifier.ts +7 -0
- package/src/services/actions/index.ts +4 -0
- package/src/services/addErrorToNotifications.ts +35 -0
- package/src/services/context/getElementContext.ts +17 -0
- package/src/services/context/index.ts +1 -0
- package/src/services/createNotification.ts +35 -0
- package/src/services/index.ts +9 -0
- package/src/services/instantiateAction.ts +11 -0
- package/src/services/instantiateActions.ts +14 -0
- package/src/services/logger.spec.ts +70 -0
- package/src/services/logger.ts +118 -0
- package/src/services/mutations/getCallbackForMutationMode.ts +18 -0
- package/src/services/mutations/getModalMutationOptions.ts +24 -0
- package/src/services/mutations/index.ts +3 -0
- package/src/services/mutations/mutationMode.ts +4 -0
- package/src/services/print/index.ts +1 -0
- package/src/services/print/openPdfInNewWindow.ts +11 -0
- package/src/stores/createQueryCacheKey.ts +6 -0
- package/src/stores/index.ts +6 -0
- package/src/stores/types.ts +35 -0
- package/src/stores/useActionStore.ts +94 -0
- package/src/stores/useModalStore.ts +65 -0
- package/src/stores/useNotificationStore.ts +65 -0
- package/src/stores/useQueryStore.ts +184 -0
- package/src/symbols.ts +7 -0
- package/src/testing.ts +1 -0
- package/src/types/actions/actions.types.ts +42 -0
- package/src/types/actions/endpoints.types.ts +32 -0
- package/src/types/actions/index.ts +4 -0
- package/src/types/actions/parameters.types.ts +80 -0
- package/src/types/actions/response.types.ts +12 -0
- package/src/types/actions.types.ts +57 -0
- package/src/types/admin.types.ts +47 -0
- package/src/types/common.types.ts +66 -0
- package/src/types/components-form.types.ts +183 -0
- package/src/types/components.types.ts +349 -0
- package/src/types/configuration.types.ts +116 -0
- package/src/types/context.types.ts +25 -0
- package/src/types/endpoints.types.ts +17 -0
- package/src/types/form.types.ts +65 -0
- package/src/types/index.ts +12 -0
- package/src/types/language.types.ts +12 -0
- package/src/types/sdk.types.ts +213 -0
- package/src/utils/booleanToTriState.spec.ts +13 -0
- package/src/utils/booleanToTriState.ts +5 -0
- package/src/utils/convertDotNotationToObject.ts +15 -0
- package/src/utils/createAssetUrl.ts +9 -0
- package/src/utils/createClasses.ts +18 -0
- package/src/utils/createObjectWithKeys.ts +10 -0
- package/src/utils/decodeHtmlEntities.ts +11 -0
- package/src/utils/downloadBlob.ts +9 -0
- package/src/utils/downloadFileFromUrl.spec.ts +29 -0
- package/src/utils/downloadFileFromUrl.ts +5 -0
- package/src/utils/encodeArrayParameter.ts +6 -0
- package/src/utils/extendAdminInstance.ts +10 -0
- package/src/utils/fakeLinkClick.ts +17 -0
- package/src/utils/forms/createFormElement.ts +20 -0
- package/src/utils/forms/createShipmentFormName.ts +9 -0
- package/src/utils/forms/formToBody.ts +16 -0
- package/src/utils/forms/generateFieldId.ts +17 -0
- package/src/utils/forms/index.ts +4 -0
- package/src/utils/generateLabelFilename.spec.ts +24 -0
- package/src/utils/generateLabelFilename.ts +26 -0
- package/src/utils/getOrderId.ts +12 -0
- package/src/utils/getOrderShipmentIds.ts +12 -0
- package/src/utils/index.ts +23 -0
- package/src/utils/openUrlInNewTab.spec.ts +29 -0
- package/src/utils/openUrlInNewTab.ts +5 -0
- package/src/utils/prefixComponent.spec.ts +15 -0
- package/src/utils/prefixComponent.ts +10 -0
- package/src/utils/query/index.ts +3 -0
- package/src/utils/query/setQueryData.ts +8 -0
- package/src/utils/query/setQueryOrder.ts +26 -0
- package/src/utils/query/setQueryShipment.ts +8 -0
- package/src/utils/resolveCarrier.spec.ts +11 -0
- package/src/utils/resolveCarrier.ts +3 -0
- package/src/utils/translations/getDeliveryTypeTranslation.ts +5 -0
- package/src/utils/translations/getDynamicTranslation.ts +7 -0
- package/src/utils/translations/getPackageTypeTranslation.ts +5 -0
- package/src/utils/translations/index.ts +4 -0
- package/src/utils/translations/translateSelectOption.ts +15 -0
- package/src/utils/triStateToBoolean.spec.ts +13 -0
- package/src/utils/triStateToBoolean.ts +5 -0
- package/src/utils/unprefixComponent.spec.ts +13 -0
- package/src/utils/unprefixComponent.ts +6 -0
- package/src/utils/validateId.spec.ts +20 -0
- package/src/utils/validateId.ts +16 -0
- package/src/views/ChildProductSettings.vue +14 -0
- package/src/views/Modals.vue +22 -0
- package/src/views/Notifications.vue +9 -0
- package/src/views/OrderBox.vue +32 -0
- package/src/views/OrderListItem.vue +52 -0
- package/src/views/PluginSettings.vue +43 -0
- package/src/views/ProductSettings.vue +76 -0
- package/src/views/integrated/OrderBoxView.vue +20 -0
- package/src/views/integrated/OrderListItemView.vue +20 -0
- package/src/views/integrated/index.ts +13 -0
- package/src/vue-form-builder.d.ts +14 -0
- package/src/vue.shims.d.ts +11 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {type Variant} from '@myparcel-dev/pdk-common';
|
|
2
|
+
import {type PdkNotification} from '../types';
|
|
3
|
+
import {NotificationCategory} from '../data';
|
|
4
|
+
import {useLanguage} from '../composables';
|
|
5
|
+
|
|
6
|
+
const PREFIX = 'notification_';
|
|
7
|
+
|
|
8
|
+
export const createNotification = (
|
|
9
|
+
variant: Variant,
|
|
10
|
+
options?: Partial<PdkNotification> & {identifier?: string},
|
|
11
|
+
): undefined | PdkNotification => {
|
|
12
|
+
const language = useLanguage();
|
|
13
|
+
const {identifier, ...rest} = options ?? {};
|
|
14
|
+
|
|
15
|
+
const notification: PdkNotification = {
|
|
16
|
+
timeout: true,
|
|
17
|
+
variant,
|
|
18
|
+
...rest,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
if (options?.content || options?.title) {
|
|
22
|
+
return notification;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const title = `${PREFIX}${identifier ?? options?.category ?? NotificationCategory.General}_${variant}`;
|
|
26
|
+
const contentKey = `${title}_body`;
|
|
27
|
+
|
|
28
|
+
const content = language.has(contentKey) ? language.translate(contentKey) : undefined;
|
|
29
|
+
|
|
30
|
+
if (!language.has(title) && !content) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return {...notification, title, content};
|
|
35
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './actions';
|
|
2
|
+
export * from './addErrorToNotifications';
|
|
3
|
+
export * from './context';
|
|
4
|
+
export * from './createNotification';
|
|
5
|
+
export * from './instantiateAction';
|
|
6
|
+
export * from './instantiateActions';
|
|
7
|
+
export * from './logger';
|
|
8
|
+
export * from './mutations';
|
|
9
|
+
export * from './print';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {type ActionDefinition, type ActionParameters, type AnyActionDefinition, type MaybeAdminAction} from '../types';
|
|
2
|
+
import {getActionIdentifier} from './actions';
|
|
3
|
+
|
|
4
|
+
export const instantiateAction = <A extends MaybeAdminAction>(
|
|
5
|
+
action: AnyActionDefinition<A>,
|
|
6
|
+
parameters?: ActionParameters<A>,
|
|
7
|
+
): ActionDefinition<A> => ({
|
|
8
|
+
...action,
|
|
9
|
+
id: getActionIdentifier(action),
|
|
10
|
+
parameters,
|
|
11
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {toArray} from '@myparcel-dev/ts-utils';
|
|
2
|
+
import {type ActionDefinition, type ActionParameters, type AnyActionDefinition} from '../types';
|
|
3
|
+
import {type AdminAction} from '../data';
|
|
4
|
+
import {instantiateAction} from './instantiateAction';
|
|
5
|
+
|
|
6
|
+
type InstantiateActions = {
|
|
7
|
+
(action: AnyActionDefinition, parameters?: ActionParameters<AdminAction>): ActionDefinition[];
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/unified-signatures
|
|
9
|
+
(actions: AnyActionDefinition[], parameters?: ActionParameters<AdminAction>): ActionDefinition[];
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const instantiateActions: InstantiateActions = (actions, parameters) => {
|
|
13
|
+
return toArray(actions).map((action) => instantiateAction(action, parameters));
|
|
14
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {afterAll, afterEach, describe, expect, it, vi} from 'vitest';
|
|
2
|
+
import {createLogger, globalLogger, LogLevel, type PdkLogger} from './logger';
|
|
3
|
+
|
|
4
|
+
type ExtractRecord<T extends Record<any, any>, U> = {
|
|
5
|
+
[P in keyof T]: T[P] extends U ? P : never;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
type ExtractRecordKeys<T extends Record<any, any>, U> = ExtractRecord<T, U>[keyof T];
|
|
9
|
+
|
|
10
|
+
type PdkLoggerMethod = ExtractRecordKeys<PdkLogger, (...args: any[]) => void>;
|
|
11
|
+
|
|
12
|
+
describe('logger', () => {
|
|
13
|
+
const spies = {
|
|
14
|
+
log: vi.spyOn(console, 'log'),
|
|
15
|
+
warn: vi.spyOn(console, 'warn'),
|
|
16
|
+
error: vi.spyOn(console, 'error'),
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const logMethodsMap = [
|
|
20
|
+
['debug', 'log'],
|
|
21
|
+
['info', 'log'],
|
|
22
|
+
['warn', 'warn'],
|
|
23
|
+
['error', 'error'],
|
|
24
|
+
] as [PdkLoggerMethod, keyof typeof spies][];
|
|
25
|
+
|
|
26
|
+
afterEach(() => {
|
|
27
|
+
Object.values(spies).forEach((spy) => spy.mockReset());
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
afterAll(() => {
|
|
31
|
+
Object.values(spies).forEach((spy) => spy.mockRestore());
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe('global', () => {
|
|
35
|
+
it.each(logMethodsMap)('can use %s', (method, consoleMethod) => {
|
|
36
|
+
globalLogger[method]('test');
|
|
37
|
+
|
|
38
|
+
expect(spies[consoleMethod]).toHaveBeenCalledTimes(1);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('scoped', () => {
|
|
43
|
+
it.each(logMethodsMap)('can use %s', (method, consoleMethod) => {
|
|
44
|
+
const logger = createLogger('test');
|
|
45
|
+
|
|
46
|
+
logger[method]('test');
|
|
47
|
+
|
|
48
|
+
expect(spies[consoleMethod]).toHaveBeenCalledTimes(1);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it.each([
|
|
52
|
+
{logLevel: LogLevel.Off, logs: 0, warns: 0, errors: 0},
|
|
53
|
+
{logLevel: LogLevel.Error, logs: 0, warns: 0, errors: 1},
|
|
54
|
+
{logLevel: LogLevel.Warn, logs: 0, warns: 1, errors: 1},
|
|
55
|
+
{logLevel: LogLevel.Info, logs: 1, warns: 1, errors: 1},
|
|
56
|
+
{logLevel: LogLevel.Debug, logs: 2, warns: 1, errors: 1},
|
|
57
|
+
])('honors log level $logLevel', ({logLevel, logs, warns, errors}) => {
|
|
58
|
+
const logger = createLogger('test', logLevel);
|
|
59
|
+
|
|
60
|
+
logger.debug('debug');
|
|
61
|
+
logger.info('info');
|
|
62
|
+
logger.warn('warn');
|
|
63
|
+
logger.error('error');
|
|
64
|
+
|
|
65
|
+
expect(spies.log).toHaveBeenCalledTimes(logs);
|
|
66
|
+
expect(spies.warn).toHaveBeenCalledTimes(warns);
|
|
67
|
+
expect(spies.error).toHaveBeenCalledTimes(errors);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any,no-console */
|
|
2
|
+
|
|
3
|
+
export enum LogLevel {
|
|
4
|
+
Debug = 1,
|
|
5
|
+
Info = 2,
|
|
6
|
+
Warn = 3,
|
|
7
|
+
Error = 4,
|
|
8
|
+
Off = 5,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const logLevelNameMap: Partial<Record<LogLevel, string>> = {
|
|
12
|
+
[LogLevel.Error]: 'error',
|
|
13
|
+
[LogLevel.Warn]: 'warn',
|
|
14
|
+
[LogLevel.Info]: 'info',
|
|
15
|
+
[LogLevel.Debug]: 'debug',
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const backgroundColors: Partial<Record<LogLevel, string>> = {
|
|
19
|
+
[LogLevel.Debug]: '#9E9E9E',
|
|
20
|
+
[LogLevel.Info]: '#2196F3',
|
|
21
|
+
[LogLevel.Warn]: '#FFB562',
|
|
22
|
+
[LogLevel.Error]: '#F87474',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export interface PdkLogger {
|
|
26
|
+
level: LogLevel;
|
|
27
|
+
scope: string | null;
|
|
28
|
+
|
|
29
|
+
debug(...messages: any[]): void;
|
|
30
|
+
|
|
31
|
+
error(...messages: any[]): void;
|
|
32
|
+
|
|
33
|
+
info(...messages: any[]): void;
|
|
34
|
+
|
|
35
|
+
log(level: LogLevel, ...messages: any[]): void;
|
|
36
|
+
|
|
37
|
+
setScope(scope: string | null): void;
|
|
38
|
+
|
|
39
|
+
warn(...messages: any[]): void;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const globalLogger: PdkLogger = {
|
|
43
|
+
level: LogLevel.Debug,
|
|
44
|
+
|
|
45
|
+
scope: null,
|
|
46
|
+
|
|
47
|
+
log(level: LogLevel, ...messages: any[]): void {
|
|
48
|
+
if (level < this.level) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const scope = this.scope ?? 'PDK';
|
|
53
|
+
|
|
54
|
+
if (process.env.NODE_ENV === 'production') {
|
|
55
|
+
console.log(`[${scope}] ${level}`, ...messages);
|
|
56
|
+
} else {
|
|
57
|
+
const background = this.scope ? '#002621' : '#0F5C47';
|
|
58
|
+
const levelName = logLevelNameMap[level];
|
|
59
|
+
let method;
|
|
60
|
+
|
|
61
|
+
// define console method based on level
|
|
62
|
+
switch (level) {
|
|
63
|
+
case LogLevel.Error:
|
|
64
|
+
method = console.error;
|
|
65
|
+
break;
|
|
66
|
+
|
|
67
|
+
case LogLevel.Warn:
|
|
68
|
+
method = console.warn;
|
|
69
|
+
break;
|
|
70
|
+
|
|
71
|
+
default:
|
|
72
|
+
method = console.log;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
method(
|
|
76
|
+
...[
|
|
77
|
+
`%c${scope}%c${levelName?.toUpperCase()}`,
|
|
78
|
+
[`background: ${background}`, 'border-radius: 3px 0 0 3px', 'padding: 2px 4px', 'color: #ccc'].join(';'),
|
|
79
|
+
[
|
|
80
|
+
`background: ${backgroundColors[level]}`,
|
|
81
|
+
'border-radius: 0 3px 3px 0',
|
|
82
|
+
'padding: 2px 4px',
|
|
83
|
+
'color: #222',
|
|
84
|
+
].join(';'),
|
|
85
|
+
...messages,
|
|
86
|
+
],
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
debug(...messages: any[]): void {
|
|
92
|
+
this.log(LogLevel.Debug, ...messages);
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
info(...messages: any[]): void {
|
|
96
|
+
this.log(LogLevel.Info, ...messages);
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
warn(...messages: any[]): void {
|
|
100
|
+
this.log(LogLevel.Warn, ...messages);
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
error(...messages: any[]): void {
|
|
104
|
+
this.log(LogLevel.Error, ...messages);
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
setScope(scope: string | null): void {
|
|
108
|
+
this.scope = scope;
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const createLogger = (scope: string | null = null, logLevel: LogLevel | null = null): PdkLogger => {
|
|
113
|
+
const loggerInstance = {...globalLogger};
|
|
114
|
+
loggerInstance.setScope(scope);
|
|
115
|
+
loggerInstance.level = logLevel ?? globalLogger.level;
|
|
116
|
+
|
|
117
|
+
return loggerInstance;
|
|
118
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {useModalStore, useNotificationStore} from '../../stores';
|
|
2
|
+
import {NotificationCategory} from '../../data';
|
|
3
|
+
import {MutationMode} from './mutationMode';
|
|
4
|
+
|
|
5
|
+
type Callback = (() => void) | undefined;
|
|
6
|
+
|
|
7
|
+
export const getCallbackForMutationMode = (mode: MutationMode): Callback => {
|
|
8
|
+
switch (mode) {
|
|
9
|
+
case MutationMode.Modal:
|
|
10
|
+
return () => {
|
|
11
|
+
useModalStore().loading = true;
|
|
12
|
+
useNotificationStore().remove(NotificationCategory.Modal);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
default:
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import {type MutationOptions} from '@tanstack/vue-query';
|
|
3
|
+
import {addErrorToNotifications} from '../addErrorToNotifications';
|
|
4
|
+
import {useModalStore} from '../../stores';
|
|
5
|
+
import {NotificationCategory} from '../../data';
|
|
6
|
+
|
|
7
|
+
export const getModalMutationOptions = <
|
|
8
|
+
TData = unknown,
|
|
9
|
+
TError = unknown,
|
|
10
|
+
TVariables = void,
|
|
11
|
+
TContext = unknown,
|
|
12
|
+
>(): MutationOptions<TData, TError, TVariables, TContext> => {
|
|
13
|
+
return {
|
|
14
|
+
onSuccess() {
|
|
15
|
+
useModalStore().close();
|
|
16
|
+
},
|
|
17
|
+
onSettled() {
|
|
18
|
+
useModalStore().loading = false;
|
|
19
|
+
},
|
|
20
|
+
onError(error) {
|
|
21
|
+
addErrorToNotifications(error, NotificationCategory.Modal);
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './openPdfInNewWindow';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {openUrlInNewTab} from '../../utils';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Opens a new window with the given base64 encoded pdf.
|
|
5
|
+
*/
|
|
6
|
+
export const openPdfInNewWindow = async (pdf: string): Promise<void> => {
|
|
7
|
+
const blob = await (await fetch(`data:application/pdf;base64,${pdf}`)).blob();
|
|
8
|
+
const url = URL.createObjectURL(blob);
|
|
9
|
+
|
|
10
|
+
openUrlInNewTab(url);
|
|
11
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import {type BackendEndpoint} from '@myparcel-dev/pdk-common';
|
|
2
|
+
import {type PlainModifier} from '../actions';
|
|
3
|
+
|
|
4
|
+
export const createQueryCacheKey = <E extends BackendEndpoint>(endpoint: E, modifier?: PlainModifier): string => {
|
|
5
|
+
return modifier ? `${endpoint}.${modifier}` : endpoint;
|
|
6
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {type UseMutationReturnType, type UseQueryReturnType} from '@tanstack/vue-query';
|
|
2
|
+
import {type AdminContextKey, type BackendEndpoint} from '@myparcel-dev/pdk-common';
|
|
3
|
+
import {type ApiException} from '@myparcel-dev/sdk';
|
|
4
|
+
import {
|
|
5
|
+
type ActionInput,
|
|
6
|
+
type AdminContext,
|
|
7
|
+
type BackendEndpointResponse,
|
|
8
|
+
type BackendMutationEndpoints,
|
|
9
|
+
type BackendQueryEndpoints,
|
|
10
|
+
} from '../types';
|
|
11
|
+
import {type QueryModifier} from '../actions';
|
|
12
|
+
|
|
13
|
+
type EndpointQuery<E extends BackendEndpoint> = E extends BackendMutationEndpoints
|
|
14
|
+
? UseMutationReturnType<BackendEndpointResponse<E>, ApiException, ActionInput<E>, unknown>
|
|
15
|
+
: E extends BackendQueryEndpoints
|
|
16
|
+
? UseQueryReturnType<BackendEndpointResponse<E>, ApiException>
|
|
17
|
+
: never;
|
|
18
|
+
|
|
19
|
+
export type ContextQuery<C extends AdminContextKey = AdminContextKey.Dynamic> = UseQueryReturnType<
|
|
20
|
+
AdminContext<C>,
|
|
21
|
+
ApiException
|
|
22
|
+
>;
|
|
23
|
+
|
|
24
|
+
export type ResolvedQuery<E extends BackendEndpoint = BackendEndpoint> = E extends BackendEndpoint
|
|
25
|
+
? EndpointQuery<E>
|
|
26
|
+
: never;
|
|
27
|
+
|
|
28
|
+
export type RegisterQuery = {
|
|
29
|
+
<E extends BackendEndpoint, Q extends ResolvedQuery<E> = ResolvedQuery<E>>(endpoint: E, query: Q, arg3?: never): Q;
|
|
30
|
+
<E extends BackendEndpoint, Q extends ResolvedQuery<E> = ResolvedQuery<E>>(
|
|
31
|
+
endpoint: E,
|
|
32
|
+
modifier: QueryModifier<E>,
|
|
33
|
+
query: Q,
|
|
34
|
+
): Q;
|
|
35
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {ref} from 'vue';
|
|
2
|
+
import {defineStore} from 'pinia';
|
|
3
|
+
import {type OneOrMore, type PromiseOr, toArray} from '@myparcel-dev/ts-utils';
|
|
4
|
+
import {type ActionParameters, type AnyActionDefinition, type ResolvedAction} from '../types';
|
|
5
|
+
import {createAction, getActionIdentifier} from '../services';
|
|
6
|
+
import {type AdminAction} from '../data';
|
|
7
|
+
import {usePluginSettings} from '../composables';
|
|
8
|
+
import {
|
|
9
|
+
modalCloseAction,
|
|
10
|
+
modalSubmitFormAction,
|
|
11
|
+
orderExportAction,
|
|
12
|
+
orderExportToShipmentsAction,
|
|
13
|
+
ordersEditAction,
|
|
14
|
+
ordersExportPrintShipmentsAction,
|
|
15
|
+
ordersFetchAction,
|
|
16
|
+
ordersPrintAction,
|
|
17
|
+
ordersUpdateAction,
|
|
18
|
+
orderViewInBackofficeAction,
|
|
19
|
+
shipmentsDeleteAction,
|
|
20
|
+
shipmentsExportReturnAction,
|
|
21
|
+
shipmentsPrintAction,
|
|
22
|
+
shipmentsUpdateAction,
|
|
23
|
+
webhooksCreateAction,
|
|
24
|
+
webhooksDeleteAction,
|
|
25
|
+
webhooksFetchAction,
|
|
26
|
+
} from '../actions';
|
|
27
|
+
|
|
28
|
+
// eslint-disable-next-line max-lines-per-function
|
|
29
|
+
export const useActionStore = defineStore('actions', () => {
|
|
30
|
+
const actions = ref<ResolvedAction[]>([]);
|
|
31
|
+
|
|
32
|
+
const register = (action: OneOrMore<AnyActionDefinition>) => {
|
|
33
|
+
toArray(action)
|
|
34
|
+
.filter((action) => !get(getActionIdentifier(action)))
|
|
35
|
+
.forEach((action) => {
|
|
36
|
+
const resolvedAction = createAction(action);
|
|
37
|
+
|
|
38
|
+
// @ts-expect-error todo
|
|
39
|
+
actions.value.push(resolvedAction);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const get = (action: string | AdminAction): ResolvedAction | undefined => {
|
|
44
|
+
return actions.value.find((a) => a.id === action);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const dispatch = <A extends string | AdminAction>(action: A, parameters?: ActionParameters<A>): PromiseOr<void> => {
|
|
48
|
+
const resolvedAction = get(action);
|
|
49
|
+
|
|
50
|
+
if (!resolvedAction) {
|
|
51
|
+
throw new Error(`Action ${action} is not registered.`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return resolvedAction.handler(parameters) as PromiseOr<void>;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
get,
|
|
59
|
+
|
|
60
|
+
register,
|
|
61
|
+
|
|
62
|
+
dispatch,
|
|
63
|
+
|
|
64
|
+
registerOrderActions: () => {
|
|
65
|
+
const pluginSettings = usePluginSettings();
|
|
66
|
+
|
|
67
|
+
register([
|
|
68
|
+
ordersEditAction,
|
|
69
|
+
ordersFetchAction,
|
|
70
|
+
ordersPrintAction,
|
|
71
|
+
ordersUpdateAction,
|
|
72
|
+
...(pluginSettings.order.orderMode
|
|
73
|
+
? [orderExportAction, orderViewInBackofficeAction]
|
|
74
|
+
: [
|
|
75
|
+
orderExportToShipmentsAction,
|
|
76
|
+
ordersExportPrintShipmentsAction,
|
|
77
|
+
shipmentsExportReturnAction,
|
|
78
|
+
shipmentsExportReturnAction,
|
|
79
|
+
shipmentsDeleteAction,
|
|
80
|
+
shipmentsUpdateAction,
|
|
81
|
+
shipmentsPrintAction,
|
|
82
|
+
]),
|
|
83
|
+
]);
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
registerModalActions: () => {
|
|
87
|
+
register([modalCloseAction, modalSubmitFormAction]);
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
registerWebhookActions: () => {
|
|
91
|
+
register([webhooksCreateAction, webhooksDeleteAction, webhooksFetchAction]);
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {ref, type Ref, type UnwrapNestedRefs} from 'vue';
|
|
2
|
+
import {defineStore} from 'pinia';
|
|
3
|
+
import {type AdminModalContext} from '../types';
|
|
4
|
+
import {type AdminModalKey, NotificationCategory} from '../data';
|
|
5
|
+
import {useLoading} from '../composables';
|
|
6
|
+
import {useNotificationStore} from './useNotificationStore';
|
|
7
|
+
|
|
8
|
+
type ModalOpenFn = <K extends AdminModalKey>(modal: K, context?: AdminModalContext<K>) => void;
|
|
9
|
+
|
|
10
|
+
type ModalCloseFn = <K extends AdminModalKey>(modal: K) => void;
|
|
11
|
+
|
|
12
|
+
type ModalStore = {
|
|
13
|
+
loading: Ref<boolean>;
|
|
14
|
+
opened: Ref<AdminModalKey | null>;
|
|
15
|
+
context: Ref<UnwrapNestedRefs<AdminModalContext>>;
|
|
16
|
+
onOpen(callback: ModalOpenFn): void;
|
|
17
|
+
onClose(callback: ModalCloseFn): void;
|
|
18
|
+
open<K extends AdminModalKey>(modal: K, newContext?: AdminModalContext<K>): void;
|
|
19
|
+
close(): void;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const useModalStore = defineStore('modal', (): ModalStore => {
|
|
23
|
+
const {loading} = useLoading();
|
|
24
|
+
|
|
25
|
+
const opened = ref<AdminModalKey | null>(null);
|
|
26
|
+
const context = ref<AdminModalContext>(null);
|
|
27
|
+
|
|
28
|
+
const openHooks = ref<ModalOpenFn[]>([]);
|
|
29
|
+
const closeHooks = ref<ModalCloseFn[]>([]);
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
loading,
|
|
33
|
+
|
|
34
|
+
opened,
|
|
35
|
+
|
|
36
|
+
context,
|
|
37
|
+
|
|
38
|
+
onOpen(callback) {
|
|
39
|
+
openHooks.value.push(callback);
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
onClose(callback) {
|
|
43
|
+
closeHooks.value.push(callback);
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
open(modal, newContext) {
|
|
47
|
+
// TODO: fix excessive depth error
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
49
|
+
// @ts-ignore
|
|
50
|
+
context.value = newContext;
|
|
51
|
+
opened.value = modal;
|
|
52
|
+
|
|
53
|
+
openHooks.value.forEach((hook) => hook(modal, newContext));
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
close() {
|
|
57
|
+
useNotificationStore().remove(NotificationCategory.Modal);
|
|
58
|
+
const modal = opened.value as AdminModalKey;
|
|
59
|
+
|
|
60
|
+
opened.value = null;
|
|
61
|
+
context.value = null;
|
|
62
|
+
closeHooks.value.forEach((hook) => hook(modal));
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {ref} from 'vue';
|
|
2
|
+
import {defineStore} from 'pinia';
|
|
3
|
+
import {isEnumValue} from '@myparcel-dev/ts-utils';
|
|
4
|
+
import {type NotificationId, type PdkNotification, type ResolvedNotification} from '../types';
|
|
5
|
+
import {NotificationSource} from '../data';
|
|
6
|
+
|
|
7
|
+
let autoId = 0;
|
|
8
|
+
|
|
9
|
+
const DEFAULT_TIMEOUT = 5000;
|
|
10
|
+
|
|
11
|
+
export const useNotificationStore = defineStore('notifications', () => {
|
|
12
|
+
const notifications = ref<ResolvedNotification[]>([]);
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
notifications,
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Add a notification to the store.
|
|
19
|
+
*/
|
|
20
|
+
add(notification: PdkNotification, tags?: object | Record<string, string>) {
|
|
21
|
+
const resolvedNotification: ResolvedNotification = {
|
|
22
|
+
timeout: true,
|
|
23
|
+
dismissible: notification.timeout === false,
|
|
24
|
+
id: notification.id ?? autoId++,
|
|
25
|
+
...notification,
|
|
26
|
+
tags: {
|
|
27
|
+
...notification.tags,
|
|
28
|
+
...tags,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const {id} = resolvedNotification;
|
|
33
|
+
|
|
34
|
+
if (notifications.value.some((notification) => notification.id === id)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (notification.timeout !== false) {
|
|
39
|
+
const timeout =
|
|
40
|
+
typeof resolvedNotification.timeout === 'number' ? resolvedNotification.timeout : DEFAULT_TIMEOUT;
|
|
41
|
+
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
this.remove(id);
|
|
44
|
+
}, timeout);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
notifications.value.push(resolvedNotification);
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Remove one or more notifications from the store by tag or id.
|
|
52
|
+
*/
|
|
53
|
+
remove(input: NotificationId | NotificationSource) {
|
|
54
|
+
let filter: (notification: ResolvedNotification) => boolean;
|
|
55
|
+
|
|
56
|
+
if (isEnumValue(input, NotificationSource)) {
|
|
57
|
+
filter = (notification) => notification.tags?.source === input;
|
|
58
|
+
} else {
|
|
59
|
+
filter = (notification) => notification.id !== input;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
notifications.value = notifications.value.filter(filter);
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
});
|