@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,206 @@
|
|
|
1
|
+
import {ref} from 'vue';
|
|
2
|
+
import {describe, expect, it} from 'vitest';
|
|
3
|
+
import {type FormInstance, type InteractiveElementInstance} from '@myparcel-dev/vue-form-builder';
|
|
4
|
+
import {type OperationArguments} from '../types';
|
|
5
|
+
import {buildFormStateWatcher} from './buildFormStateWatcher';
|
|
6
|
+
|
|
7
|
+
const createFakeElementInstance = (): InteractiveElementInstance => {
|
|
8
|
+
const createFakeField = (name: string, value: unknown) => {
|
|
9
|
+
return {
|
|
10
|
+
name,
|
|
11
|
+
ref: ref(value),
|
|
12
|
+
component: 'input',
|
|
13
|
+
form: fakeForm,
|
|
14
|
+
} as InteractiveElementInstance;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const createFakeFields = () => {
|
|
18
|
+
return [createFakeField('field1', 'hi'), createFakeField('field2', false), createFakeField('field3', 12)];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const fields: InteractiveElementInstance[] = [];
|
|
22
|
+
|
|
23
|
+
const fakeForm = {
|
|
24
|
+
name: 'fake',
|
|
25
|
+
getValue(name: string) {
|
|
26
|
+
return fields.find((field) => field.name === name)?.ref.value;
|
|
27
|
+
},
|
|
28
|
+
} as unknown as FormInstance;
|
|
29
|
+
|
|
30
|
+
fields.push(...createFakeFields());
|
|
31
|
+
|
|
32
|
+
return fields[0];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
describe('buildFormStateWatcher', () => {
|
|
36
|
+
it('should return a function', () => {
|
|
37
|
+
const result = buildFormStateWatcher({}, '');
|
|
38
|
+
|
|
39
|
+
expect(result).toBeInstanceOf(Function);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it.each([
|
|
43
|
+
{
|
|
44
|
+
$if: [
|
|
45
|
+
{
|
|
46
|
+
$target: 'field3',
|
|
47
|
+
$gt: 2,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
$if: [
|
|
53
|
+
{
|
|
54
|
+
$target: 'field1',
|
|
55
|
+
$in: ['hi', 'ciao'],
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
$if: [
|
|
61
|
+
{
|
|
62
|
+
$target: 'field2',
|
|
63
|
+
$eq: false,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
$if: [
|
|
69
|
+
{
|
|
70
|
+
$target: 'field2',
|
|
71
|
+
$eq: false,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
$target: 'field1',
|
|
75
|
+
$in: ['hi', 'ciao'],
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
$if: [
|
|
81
|
+
{
|
|
82
|
+
$and: [
|
|
83
|
+
{
|
|
84
|
+
$target: 'field2',
|
|
85
|
+
$eq: false,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
$target: 'field1',
|
|
89
|
+
$nin: ['bye', 'hello'],
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
$if: [
|
|
97
|
+
{
|
|
98
|
+
$or: [
|
|
99
|
+
{
|
|
100
|
+
$target: 'field2',
|
|
101
|
+
$eq: true,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
$target: 'field3',
|
|
105
|
+
$gt: 10,
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
$if: [
|
|
113
|
+
{
|
|
114
|
+
$and: [{$target: 'field1'}, {$target: 'field3'}],
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
] satisfies OperationArguments[])('should return true if the condition is true', (input) => {
|
|
119
|
+
const result = buildFormStateWatcher(input, '')(createFakeElementInstance());
|
|
120
|
+
|
|
121
|
+
expect(result).toBe(true);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it.each([
|
|
125
|
+
{
|
|
126
|
+
$if: [
|
|
127
|
+
{
|
|
128
|
+
$target: 'field3',
|
|
129
|
+
$lt: 2,
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
$if: [
|
|
135
|
+
{
|
|
136
|
+
$target: 'field1',
|
|
137
|
+
$in: ['bye', 'hello'],
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
$if: [
|
|
143
|
+
{
|
|
144
|
+
$target: 'field2',
|
|
145
|
+
$eq: true,
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
$if: [
|
|
151
|
+
{
|
|
152
|
+
$target: 'field2',
|
|
153
|
+
$eq: true,
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
$target: 'field1',
|
|
157
|
+
$in: ['hi', 'ciao'],
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
$if: [
|
|
163
|
+
{
|
|
164
|
+
$and: [
|
|
165
|
+
{
|
|
166
|
+
$target: 'field2',
|
|
167
|
+
$eq: true,
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
$target: 'field1',
|
|
171
|
+
$nin: ['hi', 'ciao'],
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
{
|
|
179
|
+
$if: [
|
|
180
|
+
{
|
|
181
|
+
$or: [
|
|
182
|
+
{
|
|
183
|
+
$target: 'field2',
|
|
184
|
+
$eq: true,
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
$target: 'field3',
|
|
188
|
+
$lt: 10,
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
$if: [
|
|
196
|
+
{
|
|
197
|
+
$and: [{$target: 'field1'}, {$target: 'field2'}],
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
},
|
|
201
|
+
] satisfies OperationArguments[])('should return false if the condition is false', (input) => {
|
|
202
|
+
const result = buildFormStateWatcher(input, '')(createFakeElementInstance());
|
|
203
|
+
|
|
204
|
+
expect(result).toBe(false);
|
|
205
|
+
});
|
|
206
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {type InteractiveElementInstance} from '@myparcel-dev/vue-form-builder';
|
|
2
|
+
import {createValueGetter} from '../utils';
|
|
3
|
+
import {type WhenArguments} from '../types';
|
|
4
|
+
import {validateIfConditions} from '../conditions';
|
|
5
|
+
|
|
6
|
+
export const buildFormStateWatcher = (
|
|
7
|
+
input: WhenArguments,
|
|
8
|
+
prefix: string,
|
|
9
|
+
): ((instance: InteractiveElementInstance) => boolean) => {
|
|
10
|
+
return (instance: InteractiveElementInstance): boolean => {
|
|
11
|
+
const getValue = createValueGetter(instance, prefix);
|
|
12
|
+
|
|
13
|
+
return validateIfConditions(input, getValue);
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {describe, expect, it} from 'vitest';
|
|
2
|
+
import {validateIfCondition} from './validateIfCondition';
|
|
3
|
+
|
|
4
|
+
describe('validateIfCondition', () => {
|
|
5
|
+
it.each([
|
|
6
|
+
['hi', 'hi', true],
|
|
7
|
+
['hi', 'ciao', false],
|
|
8
|
+
])('should return %s === %s', (value, $eq, expected) => {
|
|
9
|
+
expect(validateIfCondition({$eq}, () => value)).toBe(expected);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it.each([
|
|
13
|
+
[10, 5, true],
|
|
14
|
+
[10, 10, false],
|
|
15
|
+
])('should return %s > %s', (value, $gt, expected) => {
|
|
16
|
+
expect(validateIfCondition({$gt}, () => value)).toBe(expected);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it.each([
|
|
20
|
+
[10, 5, true],
|
|
21
|
+
[10, 10, true],
|
|
22
|
+
[10, 15, false],
|
|
23
|
+
])('should return %s >= %s', (value, $gte, expected) => {
|
|
24
|
+
expect(validateIfCondition({$gte}, () => value)).toBe(expected);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it.each([
|
|
28
|
+
['hi', ['hi', 'ciao'], true],
|
|
29
|
+
['hi', ['ciao', 'bye'], false],
|
|
30
|
+
])('should return %s in %s', (value, $in, expected) => {
|
|
31
|
+
expect(validateIfCondition({$in}, () => value)).toBe(expected);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it.each([
|
|
35
|
+
[5, 10, true],
|
|
36
|
+
[10, 10, false],
|
|
37
|
+
])('should return %s < %s', (value, $lt, expected) => {
|
|
38
|
+
expect(validateIfCondition({$lt}, () => value)).toBe(expected);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it.each([
|
|
42
|
+
[5, 10, true],
|
|
43
|
+
[10, 10, true],
|
|
44
|
+
[15, 10, false],
|
|
45
|
+
])('should return %s <= %s', (value, $lte, expected) => {
|
|
46
|
+
expect(validateIfCondition({$lte}, () => value)).toBe(expected);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it.each([
|
|
50
|
+
['hi', 'ciao', true],
|
|
51
|
+
['hi', 'hi', false],
|
|
52
|
+
])('should return %s !== %s', (value, $ne, expected) => {
|
|
53
|
+
expect(validateIfCondition({$ne}, () => value)).toBe(expected);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it.each([
|
|
57
|
+
['hi', ['ciao', 'bye'], true],
|
|
58
|
+
['hi', ['hi', 'bye'], false],
|
|
59
|
+
])('should return %s not in %s', (value, $nin, expected) => {
|
|
60
|
+
expect(validateIfCondition({$nin}, () => value)).toBe(expected);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it.each([
|
|
64
|
+
['hi', 'ciao', true],
|
|
65
|
+
['hi', 'hi', false],
|
|
66
|
+
])('should return %s !== %s', (value, $ne, expected) => {
|
|
67
|
+
expect(validateIfCondition({$ne}, () => value)).toBe(expected);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {isOfType} from '@myparcel-dev/ts-utils';
|
|
2
|
+
import {
|
|
3
|
+
type AnyVal,
|
|
4
|
+
type EqualMatcher,
|
|
5
|
+
type GreaterThanMatcher,
|
|
6
|
+
type GreaterThanOrEqualMatcher,
|
|
7
|
+
type InMatcher,
|
|
8
|
+
type LessThanMatcher,
|
|
9
|
+
type LessThanOrEqualMatcher,
|
|
10
|
+
type NotEqualMatcher,
|
|
11
|
+
type NotInMatcher,
|
|
12
|
+
type SingleIfMatcher,
|
|
13
|
+
type WithTarget,
|
|
14
|
+
} from '../types';
|
|
15
|
+
import {validateIsTruthy} from './validateIsTruthy';
|
|
16
|
+
|
|
17
|
+
export const validateIfCondition = ($if: SingleIfMatcher, getValue: (target?: string) => AnyVal): boolean => {
|
|
18
|
+
const value = getValue($if.$target);
|
|
19
|
+
|
|
20
|
+
let matches = false;
|
|
21
|
+
|
|
22
|
+
if (isOfType<EqualMatcher>($if, '$eq')) {
|
|
23
|
+
matches = value === $if.$eq;
|
|
24
|
+
} else if (isOfType<GreaterThanMatcher>($if, '$gt')) {
|
|
25
|
+
matches = Number(value) > $if.$gt;
|
|
26
|
+
} else if (isOfType<GreaterThanOrEqualMatcher>($if, '$gte')) {
|
|
27
|
+
matches = Number(value) >= $if.$gte;
|
|
28
|
+
} else if (isOfType<InMatcher>($if, '$in')) {
|
|
29
|
+
matches = $if.$in.includes(value);
|
|
30
|
+
} else if (isOfType<LessThanMatcher>($if, '$lt')) {
|
|
31
|
+
matches = Number(value) < $if.$lt;
|
|
32
|
+
} else if (isOfType<LessThanOrEqualMatcher>($if, '$lte')) {
|
|
33
|
+
matches = Number(value) <= $if.$lte;
|
|
34
|
+
} else if (isOfType<NotEqualMatcher>($if, '$ne')) {
|
|
35
|
+
matches = value !== $if.$ne;
|
|
36
|
+
} else if (isOfType<NotInMatcher>($if, '$nin')) {
|
|
37
|
+
matches = !$if.$nin.includes(value);
|
|
38
|
+
} else if (isOfType<WithTarget>($if, '$target')) {
|
|
39
|
+
matches = validateIsTruthy($if, getValue);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return matches;
|
|
43
|
+
};
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import {describe, expect, it} from 'vitest';
|
|
2
|
+
import {type IfAndMatcher} from '../types';
|
|
3
|
+
import {validateIfConditions} from './validateIfConditions';
|
|
4
|
+
|
|
5
|
+
describe('validateIfConditions', () => {
|
|
6
|
+
it('should return true if no conditions are passed', () => {
|
|
7
|
+
const result = validateIfConditions({}, () => '');
|
|
8
|
+
|
|
9
|
+
expect(result).toBe(true);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('should return true if the condition is true', () => {
|
|
13
|
+
const result = validateIfConditions(
|
|
14
|
+
{
|
|
15
|
+
$if: [
|
|
16
|
+
{
|
|
17
|
+
$target: 'field1',
|
|
18
|
+
$eq: true,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
() => true,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
expect(result).toBe(true);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should return false if the condition is false', () => {
|
|
29
|
+
const result = validateIfConditions(
|
|
30
|
+
{
|
|
31
|
+
$if: [
|
|
32
|
+
{
|
|
33
|
+
$target: 'field1',
|
|
34
|
+
$eq: true,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
() => false,
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
expect(result).toBe(false);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it.each([[true], [1], ['hello']])(
|
|
45
|
+
'should return true if only a target is passed and its value is truthy (%s)',
|
|
46
|
+
(value) => {
|
|
47
|
+
const result = validateIfConditions({$target: 'field1'}, () => value);
|
|
48
|
+
|
|
49
|
+
expect(result).toBe(true);
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
it.each([
|
|
54
|
+
{
|
|
55
|
+
$and: [
|
|
56
|
+
{
|
|
57
|
+
$target: 'field1',
|
|
58
|
+
$eq: true,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
$target: 'field2',
|
|
62
|
+
$eq: true,
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
$and: [
|
|
68
|
+
{
|
|
69
|
+
$target: 'field1',
|
|
70
|
+
$ne: false,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
$target: 'field2',
|
|
74
|
+
$eq: true,
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
$and: [{$target: 'field1'}, {$target: 'field3'}],
|
|
80
|
+
},
|
|
81
|
+
] satisfies IfAndMatcher[])('should return true if all and conditions are true', ($and) => {
|
|
82
|
+
const result = validateIfConditions({$if: [$and]}, () => true);
|
|
83
|
+
|
|
84
|
+
expect(result).toBe(true);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it.each([
|
|
88
|
+
{
|
|
89
|
+
$and: [
|
|
90
|
+
{
|
|
91
|
+
$target: 'field1',
|
|
92
|
+
$eq: true,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
$target: 'field2',
|
|
96
|
+
$eq: false,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
$and: [
|
|
102
|
+
{
|
|
103
|
+
$target: 'field1',
|
|
104
|
+
$eq: true,
|
|
105
|
+
},
|
|
106
|
+
{$target: 'field2'},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
$and: [
|
|
111
|
+
{
|
|
112
|
+
$target: 'field1',
|
|
113
|
+
$ne: false,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
$target: 'field3',
|
|
117
|
+
$ne: false,
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
] satisfies IfAndMatcher[])('should return false if any and condition is false', ($and) => {
|
|
122
|
+
const result = validateIfConditions({$if: [$and]}, () => false);
|
|
123
|
+
|
|
124
|
+
expect(result).toBe(false);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('should return true if one or condition is true', () => {
|
|
128
|
+
const result = validateIfConditions(
|
|
129
|
+
{
|
|
130
|
+
$if: [
|
|
131
|
+
{
|
|
132
|
+
$or: [
|
|
133
|
+
{
|
|
134
|
+
$target: 'field1',
|
|
135
|
+
$eq: true,
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
$target: 'field2',
|
|
139
|
+
$eq: true,
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
() => true,
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
expect(result).toBe(true);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('should return false if all or conditions are false', () => {
|
|
152
|
+
const result = validateIfConditions(
|
|
153
|
+
{
|
|
154
|
+
$if: [
|
|
155
|
+
{
|
|
156
|
+
$or: [
|
|
157
|
+
{
|
|
158
|
+
$target: 'field1',
|
|
159
|
+
$eq: true,
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
$target: 'field2',
|
|
163
|
+
$eq: true,
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
},
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
() => false,
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
expect(result).toBe(false);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it('should return true if all and and or conditions are true', () => {
|
|
176
|
+
const result = validateIfConditions(
|
|
177
|
+
{
|
|
178
|
+
$if: [
|
|
179
|
+
{
|
|
180
|
+
$and: [
|
|
181
|
+
{
|
|
182
|
+
$target: 'field1',
|
|
183
|
+
$eq: true,
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
$or: [
|
|
189
|
+
{
|
|
190
|
+
$target: 'field2',
|
|
191
|
+
$eq: true,
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
$target: 'field3',
|
|
195
|
+
$eq: true,
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
},
|
|
201
|
+
() => true,
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
expect(result).toBe(true);
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it('should return false if one and and or condition is false', () => {
|
|
208
|
+
const result = validateIfConditions(
|
|
209
|
+
{
|
|
210
|
+
$if: [
|
|
211
|
+
{
|
|
212
|
+
$and: [
|
|
213
|
+
{
|
|
214
|
+
$target: 'field1',
|
|
215
|
+
$eq: true,
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
$or: [
|
|
221
|
+
{
|
|
222
|
+
$target: 'field2',
|
|
223
|
+
$eq: true,
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
$target: 'field3',
|
|
227
|
+
$eq: true,
|
|
228
|
+
},
|
|
229
|
+
],
|
|
230
|
+
},
|
|
231
|
+
],
|
|
232
|
+
},
|
|
233
|
+
() => false,
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
expect(result).toBe(false);
|
|
237
|
+
});
|
|
238
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {isOfType} from '@myparcel-dev/ts-utils';
|
|
2
|
+
import {type AnyVal, type IfAndMatcher, type IfOrMatcher, type WithCondition, type WithTarget} from '../types';
|
|
3
|
+
import {validateIsTruthy} from './validateIsTruthy';
|
|
4
|
+
import {validateIfCondition} from './validateIfCondition';
|
|
5
|
+
|
|
6
|
+
export const validateIfConditions = (
|
|
7
|
+
input: Partial<WithCondition | WithTarget>,
|
|
8
|
+
getValue: (target?: string) => AnyVal,
|
|
9
|
+
): boolean => {
|
|
10
|
+
if (!isOfType<WithCondition>(input, '$if')) {
|
|
11
|
+
if (isOfType<WithTarget>(input, '$target')) {
|
|
12
|
+
return validateIsTruthy(input, getValue);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return input.$if.every((condition) => {
|
|
19
|
+
let matches = true;
|
|
20
|
+
|
|
21
|
+
if (isOfType<IfOrMatcher>(condition, '$or')) {
|
|
22
|
+
matches = matches && condition.$or.some((condition) => validateIfCondition(condition, getValue));
|
|
23
|
+
} else if (isOfType<IfAndMatcher>(condition, '$and')) {
|
|
24
|
+
matches = matches && condition.$and.every((condition) => validateIfCondition(condition, getValue));
|
|
25
|
+
} else {
|
|
26
|
+
matches = validateIfCondition(condition, getValue);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return matches;
|
|
30
|
+
});
|
|
31
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {type AnyVal, type WithCondition, type WithTarget} from '../types';
|
|
2
|
+
import {validateIfCondition} from './validateIfCondition';
|
|
3
|
+
|
|
4
|
+
export const validateIsTruthy = (
|
|
5
|
+
$if: Partial<WithCondition> & WithTarget,
|
|
6
|
+
getValue: (target?: string) => AnyVal,
|
|
7
|
+
): boolean => {
|
|
8
|
+
return validateIfCondition(
|
|
9
|
+
{
|
|
10
|
+
...$if,
|
|
11
|
+
$nin: [false, 0],
|
|
12
|
+
},
|
|
13
|
+
getValue,
|
|
14
|
+
);
|
|
15
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {type FormOperation, type FormOperationMethods, type HandlerDefinition} from '../types';
|
|
2
|
+
import {validateIfConditions} from '../conditions';
|
|
3
|
+
|
|
4
|
+
export const executeCustomOperationHandlers = (
|
|
5
|
+
operation: FormOperation,
|
|
6
|
+
methods: FormOperationMethods,
|
|
7
|
+
customHandlers: HandlerDefinition[] = [],
|
|
8
|
+
): void => {
|
|
9
|
+
customHandlers.forEach((handler) => {
|
|
10
|
+
const matchingOperation = operation[handler.name] as FormOperation | undefined;
|
|
11
|
+
|
|
12
|
+
if (!matchingOperation || !validateIfConditions(matchingOperation, methods.getValue)) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
handler.callback(matchingOperation, methods);
|
|
17
|
+
});
|
|
18
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {isOfType} from '@myparcel-dev/ts-utils';
|
|
2
|
+
import {
|
|
3
|
+
type FormOperation,
|
|
4
|
+
type FormOperationMethods,
|
|
5
|
+
type FormSetPropOperation,
|
|
6
|
+
type FormSetValueOperation,
|
|
7
|
+
type HandlerDefinition,
|
|
8
|
+
} from '../types';
|
|
9
|
+
import {executeSetValueOperation} from './executeSetValueOperation';
|
|
10
|
+
import {executeSetPropOperation} from './executeSetPropOperation';
|
|
11
|
+
import {executeCustomOperationHandlers} from './executeCustomOperationHandlers';
|
|
12
|
+
|
|
13
|
+
export const executeOperation = (
|
|
14
|
+
operation: FormOperation,
|
|
15
|
+
methods: FormOperationMethods,
|
|
16
|
+
customHandlers: HandlerDefinition[] = [],
|
|
17
|
+
): void => {
|
|
18
|
+
if (isOfType<FormSetValueOperation>(operation, '$setValue')) {
|
|
19
|
+
executeSetValueOperation(operation, methods);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (isOfType<FormSetPropOperation>(operation, '$setProp')) {
|
|
23
|
+
executeSetPropOperation(operation, methods);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
executeCustomOperationHandlers(operation, methods, customHandlers);
|
|
27
|
+
};
|