@escapenavigator/services 1.0.17 → 1.1.1
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/dist/api/admins-api/get-profile-token.d.ts +8 -0
- package/dist/api/admins-api/get-profile-token.js +8 -1
- package/dist/api/admins-api/index.d.ts +12 -0
- package/dist/api/admins-api/index.js +13 -1
- package/dist/api/admins-api/login.d.ts +9 -0
- package/dist/api/admins-api/login.js +9 -1
- package/dist/api/admins-api/logout.d.ts +5 -0
- package/dist/api/admins-api/logout.js +8 -1
- package/dist/api/admins-api/me.d.ts +5 -0
- package/dist/api/admins-api/me.js +8 -1
- package/dist/api/agb-api/get-one.d.ts +7 -0
- package/dist/api/agb-api/get-one.js +8 -1
- package/dist/api/agb-api/index.d.ts +8 -0
- package/dist/api/agb-api/index.js +9 -1
- package/dist/api/agb-api/update.d.ts +9 -0
- package/dist/api/agb-api/update.js +9 -1
- package/dist/api/cashboxes-api/create.d.ts +9 -0
- package/dist/api/cashboxes-api/create.js +9 -1
- package/dist/api/cashboxes-api/get-one.d.ts +6 -0
- package/dist/api/cashboxes-api/get-one.js +8 -1
- package/dist/api/cashboxes-api/index.d.ts +14 -0
- package/dist/api/cashboxes-api/index.js +15 -1
- package/dist/api/cashboxes-api/query.d.ts +6 -0
- package/dist/api/cashboxes-api/query.js +8 -1
- package/dist/api/cashboxes-api/recover.d.ts +7 -0
- package/dist/api/cashboxes-api/recover.js +8 -1
- package/dist/api/cashboxes-api/remove.d.ts +7 -0
- package/dist/api/cashboxes-api/remove.js +8 -1
- package/dist/api/cashboxes-api/update.d.ts +10 -0
- package/dist/api/cashboxes-api/update.js +9 -0
- package/dist/api/certificates-api/create.d.ts +9 -0
- package/dist/api/certificates-api/create.js +9 -1
- package/dist/api/certificates-api/get-one.d.ts +7 -0
- package/dist/api/certificates-api/get-one.js +8 -1
- package/dist/api/certificates-api/index.d.ts +15 -0
- package/dist/api/certificates-api/index.js +17 -1
- package/dist/api/certificates-api/query.d.ts +6 -0
- package/dist/api/certificates-api/query.js +8 -1
- package/dist/api/certificates-api/recover.d.ts +7 -0
- package/dist/api/certificates-api/recover.js +8 -1
- package/dist/api/certificates-api/remove.d.ts +7 -0
- package/dist/api/certificates-api/remove.js +8 -1
- package/dist/api/certificates-api/update.d.ts +10 -0
- package/dist/api/certificates-api/update.js +9 -1
- package/dist/api/certificatesales-api/annul.d.ts +10 -0
- package/dist/api/certificatesales-api/annul.js +9 -1
- package/dist/api/certificatesales-api/create.d.ts +9 -0
- package/dist/api/certificatesales-api/create.js +9 -1
- package/dist/api/certificatesales-api/get-one-by-code.d.ts +7 -0
- package/dist/api/certificatesales-api/get-one-by-code.js +8 -0
- package/dist/api/certificatesales-api/get-one.d.ts +7 -0
- package/dist/api/certificatesales-api/get-one.js +8 -1
- package/dist/api/certificatesales-api/index.d.ts +22 -0
- package/dist/api/certificatesales-api/index.js +23 -1
- package/dist/api/certificatesales-api/paginate.d.ts +7 -0
- package/dist/api/certificatesales-api/paginate.js +9 -0
- package/dist/api/certificatesales-api/query.d.ts +7 -0
- package/dist/api/certificatesales-api/query.js +9 -1
- package/dist/api/certificatesales-api/update-expire-date.d.ts +10 -0
- package/dist/api/certificatesales-api/update-expire-date.js +9 -1
- package/dist/api/certificatesales-api/update-status.d.ts +10 -0
- package/dist/api/certificatesales-api/update-status.js +9 -1
- package/dist/api/certificatesales-api/update.d.ts +10 -0
- package/dist/api/certificatesales-api/update.js +9 -1
- package/dist/api/clients-api/create-from-widget.d.ts +9 -0
- package/dist/api/clients-api/create-from-widget.js +9 -0
- package/dist/api/clients-api/create.d.ts +9 -0
- package/dist/api/clients-api/create.js +9 -1
- package/dist/api/clients-api/get-all.d.ts +6 -0
- package/dist/api/clients-api/get-all.js +9 -0
- package/dist/api/clients-api/get-one.d.ts +7 -0
- package/dist/api/clients-api/get-one.js +8 -1
- package/dist/api/clients-api/index.d.ts +16 -0
- package/dist/api/clients-api/index.js +17 -1
- package/dist/api/clients-api/query.d.ts +7 -0
- package/dist/api/clients-api/query.js +9 -1
- package/dist/api/clients-api/update.d.ts +10 -0
- package/dist/api/clients-api/update.js +9 -1
- package/dist/api/emails-api/index.d.ts +6 -0
- package/dist/api/emails-api/index.js +7 -0
- package/dist/api/emails-api/query.d.ts +7 -0
- package/dist/api/emails-api/query.js +9 -0
- package/dist/api/financeitems-api/create.d.ts +9 -0
- package/dist/api/financeitems-api/create.js +9 -1
- package/dist/api/financeitems-api/get-all.d.ts +6 -0
- package/dist/api/financeitems-api/get-all.js +9 -0
- package/dist/api/financeitems-api/get-one.d.ts +7 -0
- package/dist/api/financeitems-api/get-one.js +8 -1
- package/dist/api/financeitems-api/index.d.ts +14 -0
- package/dist/api/financeitems-api/index.js +15 -1
- package/dist/api/financeitems-api/query.d.ts +6 -0
- package/dist/api/financeitems-api/query.js +9 -1
- package/dist/api/financeitems-api/remove.d.ts +7 -0
- package/dist/api/financeitems-api/remove.js +8 -1
- package/dist/api/images-api/create.d.ts +9 -0
- package/dist/api/images-api/create.js +9 -1
- package/dist/api/images-api/index.d.ts +6 -0
- package/dist/api/images-api/index.js +7 -1
- package/dist/api/index.d.ts +27 -0
- package/dist/api/index.js +45 -1
- package/dist/api/init-client-api.d.ts +63 -0
- package/dist/api/init-client-api.js +71 -1
- package/dist/api/locations-api/create.d.ts +9 -0
- package/dist/api/locations-api/create.js +9 -1
- package/dist/api/locations-api/get-one.d.ts +7 -0
- package/dist/api/locations-api/get-one.js +8 -1
- package/dist/api/locations-api/index.d.ts +16 -0
- package/dist/api/locations-api/index.js +17 -1
- package/dist/api/locations-api/query.d.ts +6 -0
- package/dist/api/locations-api/query.js +9 -1
- package/dist/api/locations-api/recover.d.ts +7 -0
- package/dist/api/locations-api/recover.js +8 -1
- package/dist/api/locations-api/remove.d.ts +7 -0
- package/dist/api/locations-api/remove.js +8 -1
- package/dist/api/locations-api/update.d.ts +10 -0
- package/dist/api/locations-api/update.js +9 -1
- package/dist/api/order-discounts-api/create.d.ts +9 -0
- package/dist/api/order-discounts-api/create.js +9 -1
- package/dist/api/order-discounts-api/index.d.ts +8 -0
- package/dist/api/order-discounts-api/index.js +9 -1
- package/dist/api/order-discounts-api/remove.d.ts +7 -0
- package/dist/api/order-discounts-api/remove.js +8 -1
- package/dist/api/order-penalties-api/create.d.ts +9 -0
- package/dist/api/order-penalties-api/create.js +9 -1
- package/dist/api/order-penalties-api/index.d.ts +8 -0
- package/dist/api/order-penalties-api/index.js +9 -1
- package/dist/api/order-penalties-api/remove.d.ts +7 -0
- package/dist/api/order-penalties-api/remove.js +8 -1
- package/dist/api/order-upsellings-api/create.d.ts +9 -0
- package/dist/api/order-upsellings-api/create.js +9 -1
- package/dist/api/order-upsellings-api/index.d.ts +8 -0
- package/dist/api/order-upsellings-api/index.js +9 -1
- package/dist/api/order-upsellings-api/remove.d.ts +7 -0
- package/dist/api/order-upsellings-api/remove.js +8 -1
- package/dist/api/orders-api/add-certificate.d.ts +9 -0
- package/dist/api/orders-api/add-certificate.js +9 -1
- package/dist/api/orders-api/create-from-widget.d.ts +8 -0
- package/dist/api/orders-api/create-from-widget.js +9 -1
- package/dist/api/orders-api/create.d.ts +9 -0
- package/dist/api/orders-api/create.js +9 -1
- package/dist/api/orders-api/get-one.d.ts +7 -0
- package/dist/api/orders-api/get-one.js +8 -1
- package/dist/api/orders-api/index.d.ts +26 -0
- package/dist/api/orders-api/index.js +27 -1
- package/dist/api/orders-api/paginate.d.ts +7 -0
- package/dist/api/orders-api/paginate.js +9 -0
- package/dist/api/orders-api/query.d.ts +7 -0
- package/dist/api/orders-api/query.js +9 -1
- package/dist/api/orders-api/remove-certificate.d.ts +9 -0
- package/dist/api/orders-api/remove-certificate.js +9 -1
- package/dist/api/orders-api/remove.d.ts +7 -0
- package/dist/api/orders-api/remove.js +8 -1
- package/dist/api/orders-api/update-slot.d.ts +10 -0
- package/dist/api/orders-api/update-slot.js +9 -1
- package/dist/api/orders-api/update-status.d.ts +10 -0
- package/dist/api/orders-api/update-status.js +9 -1
- package/dist/api/orders-api/update.d.ts +10 -0
- package/dist/api/orders-api/update.js +9 -1
- package/dist/api/partners-api/create.d.ts +9 -0
- package/dist/api/partners-api/create.js +9 -1
- package/dist/api/partners-api/get-all.d.ts +6 -0
- package/dist/api/partners-api/get-all.js +9 -0
- package/dist/api/partners-api/get-one.d.ts +7 -0
- package/dist/api/partners-api/get-one.js +8 -1
- package/dist/api/partners-api/index.d.ts +18 -0
- package/dist/api/partners-api/index.js +19 -1
- package/dist/api/partners-api/query.d.ts +6 -0
- package/dist/api/partners-api/query.js +9 -1
- package/dist/api/partners-api/recover.d.ts +7 -0
- package/dist/api/partners-api/recover.js +8 -1
- package/dist/api/partners-api/remove.d.ts +7 -0
- package/dist/api/partners-api/remove.js +8 -1
- package/dist/api/partners-api/update.d.ts +10 -0
- package/dist/api/partners-api/update.js +9 -1
- package/dist/api/profiles-api/create.d.ts +9 -0
- package/dist/api/profiles-api/create.js +9 -1
- package/dist/api/profiles-api/current.d.ts +7 -0
- package/dist/api/profiles-api/current.js +8 -0
- package/dist/api/profiles-api/get-one.d.ts +7 -0
- package/dist/api/profiles-api/get-one.js +8 -1
- package/dist/api/profiles-api/index.d.ts +16 -0
- package/dist/api/profiles-api/index.js +17 -1
- package/dist/api/profiles-api/query.d.ts +8 -0
- package/dist/api/profiles-api/query.js +9 -1
- package/dist/api/profiles-api/remove.d.ts +7 -0
- package/dist/api/profiles-api/remove.js +8 -1
- package/dist/api/profiles-api/update-current.d.ts +9 -0
- package/dist/api/profiles-api/update-current.js +9 -0
- package/dist/api/profiles-api/update.d.ts +10 -0
- package/dist/api/profiles-api/update.js +9 -1
- package/dist/api/questrooms-api/create.d.ts +9 -0
- package/dist/api/questrooms-api/create.js +9 -1
- package/dist/api/questrooms-api/get-one.d.ts +7 -0
- package/dist/api/questrooms-api/get-one.js +8 -1
- package/dist/api/questrooms-api/index.d.ts +16 -0
- package/dist/api/questrooms-api/index.js +17 -1
- package/dist/api/questrooms-api/query.d.ts +6 -0
- package/dist/api/questrooms-api/query.js +9 -1
- package/dist/api/questrooms-api/recover.d.ts +7 -0
- package/dist/api/questrooms-api/recover.js +8 -1
- package/dist/api/questrooms-api/remove.d.ts +7 -0
- package/dist/api/questrooms-api/remove.js +8 -1
- package/dist/api/questrooms-api/update.d.ts +10 -0
- package/dist/api/questrooms-api/update.js +9 -1
- package/dist/api/registration-requests-api/create.d.ts +9 -0
- package/dist/api/registration-requests-api/create.js +9 -0
- package/dist/api/registration-requests-api/get-one.d.ts +7 -0
- package/dist/api/registration-requests-api/get-one.js +8 -0
- package/dist/api/registration-requests-api/index.d.ts +14 -0
- package/dist/api/registration-requests-api/index.js +15 -0
- package/dist/api/registration-requests-api/query.d.ts +8 -0
- package/dist/api/registration-requests-api/query.js +9 -0
- package/dist/api/registration-requests-api/remove.d.ts +7 -0
- package/dist/api/registration-requests-api/remove.js +8 -0
- package/dist/api/registration-requests-api/update.d.ts +10 -0
- package/dist/api/registration-requests-api/update.js +9 -0
- package/dist/api/roles-api/create.d.ts +9 -0
- package/dist/api/roles-api/create.js +9 -1
- package/dist/api/roles-api/get-one.d.ts +7 -0
- package/dist/api/roles-api/get-one.js +8 -1
- package/dist/api/roles-api/index.d.ts +14 -0
- package/dist/api/roles-api/index.js +15 -1
- package/dist/api/roles-api/query.d.ts +6 -0
- package/dist/api/roles-api/query.js +9 -1
- package/dist/api/roles-api/remove.d.ts +7 -0
- package/dist/api/roles-api/remove.js +8 -1
- package/dist/api/roles-api/update.d.ts +10 -0
- package/dist/api/roles-api/update.js +9 -1
- package/dist/api/slot-templates-api/get.d.ts +8 -0
- package/dist/api/slot-templates-api/get.js +8 -0
- package/dist/api/slot-templates-api/index.d.ts +8 -0
- package/dist/api/slot-templates-api/index.js +9 -0
- package/dist/api/slot-templates-api/update.d.ts +12 -0
- package/dist/api/slot-templates-api/update.js +9 -0
- package/dist/api/slots-api/add-breaks.d.ts +9 -0
- package/dist/api/slots-api/add-breaks.js +9 -0
- package/dist/api/slots-api/add-or-remove-break.d.ts +11 -0
- package/dist/api/slots-api/add-or-remove-break.js +9 -0
- package/dist/api/slots-api/calendar.d.ts +7 -0
- package/dist/api/slots-api/calendar.js +9 -0
- package/dist/api/slots-api/create.d.ts +9 -0
- package/dist/api/slots-api/create.js +9 -0
- package/dist/api/slots-api/daily.d.ts +7 -0
- package/dist/api/slots-api/daily.js +9 -0
- package/dist/api/slots-api/index.d.ts +20 -0
- package/dist/api/slots-api/index.js +21 -1
- package/dist/api/slots-api/remove-breaks.d.ts +9 -0
- package/dist/api/slots-api/remove-breaks.js +9 -0
- package/dist/api/slots-api/remove.d.ts +7 -0
- package/dist/api/slots-api/remove.js +8 -0
- package/dist/api/slots-api/weekly.d.ts +7 -0
- package/dist/api/slots-api/weekly.js +9 -0
- package/dist/api/support/create.d.ts +9 -0
- package/dist/api/support/create.js +9 -1
- package/dist/api/support/index.d.ts +6 -0
- package/dist/api/support/index.js +7 -1
- package/dist/api/tariffs-api/create.d.ts +9 -0
- package/dist/api/tariffs-api/create.js +9 -1
- package/dist/api/tariffs-api/get-one.d.ts +7 -0
- package/dist/api/tariffs-api/get-one.js +8 -1
- package/dist/api/tariffs-api/index.d.ts +14 -0
- package/dist/api/tariffs-api/index.js +15 -1
- package/dist/api/tariffs-api/query.d.ts +6 -0
- package/dist/api/tariffs-api/query.js +9 -1
- package/dist/api/tariffs-api/remove.d.ts +7 -0
- package/dist/api/tariffs-api/remove.js +8 -1
- package/dist/api/tariffs-api/update.d.ts +10 -0
- package/dist/api/tariffs-api/update.js +9 -1
- package/dist/api/transactions-api/create-certificate-payment.d.ts +9 -0
- package/dist/api/transactions-api/create-certificate-payment.js +9 -1
- package/dist/api/transactions-api/create-certificate-refund.d.ts +9 -0
- package/dist/api/transactions-api/create-certificate-refund.js +9 -1
- package/dist/api/transactions-api/create-order-payment.d.ts +9 -0
- package/dist/api/transactions-api/create-order-payment.js +9 -1
- package/dist/api/transactions-api/create-order-refund.d.ts +9 -0
- package/dist/api/transactions-api/create-order-refund.js +9 -1
- package/dist/api/transactions-api/create.d.ts +9 -0
- package/dist/api/transactions-api/create.js +9 -1
- package/dist/api/transactions-api/get-one.d.ts +7 -0
- package/dist/api/transactions-api/get-one.js +8 -1
- package/dist/api/transactions-api/index.d.ts +30 -0
- package/dist/api/transactions-api/index.js +31 -1
- package/dist/api/transactions-api/query.d.ts +7 -0
- package/dist/api/transactions-api/query.js +9 -1
- package/dist/api/transactions-api/remove-certificate-payment.d.ts +7 -0
- package/dist/api/transactions-api/remove-certificate-payment.js +8 -1
- package/dist/api/transactions-api/remove-certificate-refund.d.ts +7 -0
- package/dist/api/transactions-api/remove-certificate-refund.js +8 -1
- package/dist/api/transactions-api/remove-order-payment.d.ts +7 -0
- package/dist/api/transactions-api/remove-order-payment.js +8 -1
- package/dist/api/transactions-api/remove-order-refund.d.ts +7 -0
- package/dist/api/transactions-api/remove-order-refund.js +8 -1
- package/dist/api/transactions-api/remove.d.ts +7 -0
- package/dist/api/transactions-api/remove.js +8 -1
- package/dist/api/transactions-api/update.d.ts +10 -0
- package/dist/api/transactions-api/update.js +9 -1
- package/dist/api/uploads-api/index.d.ts +6 -0
- package/dist/api/uploads-api/index.js +7 -0
- package/dist/api/uploads-api/upload-image.d.ts +9 -0
- package/dist/api/uploads-api/upload-image.js +13 -0
- package/dist/api/upsellings-api/create.d.ts +9 -0
- package/dist/api/upsellings-api/create.js +9 -0
- package/dist/api/upsellings-api/get-one.d.ts +7 -0
- package/dist/api/upsellings-api/get-one.js +8 -0
- package/dist/api/upsellings-api/index.d.ts +14 -0
- package/dist/api/upsellings-api/index.js +15 -0
- package/dist/api/upsellings-api/query.d.ts +6 -0
- package/dist/api/upsellings-api/query.js +9 -0
- package/dist/api/upsellings-api/remove.d.ts +7 -0
- package/dist/api/upsellings-api/remove.js +8 -0
- package/dist/api/upsellings-api/update.d.ts +10 -0
- package/dist/api/upsellings-api/update.js +9 -0
- package/dist/api/user-messages-api/create.d.ts +9 -0
- package/dist/api/user-messages-api/create.js +9 -0
- package/dist/api/user-messages-api/get-one.d.ts +7 -0
- package/dist/api/user-messages-api/get-one.js +8 -0
- package/dist/api/user-messages-api/index.d.ts +12 -0
- package/dist/api/user-messages-api/index.js +13 -0
- package/dist/api/user-messages-api/query.d.ts +7 -0
- package/dist/api/user-messages-api/query.js +9 -0
- package/dist/api/user-messages-api/remove.d.ts +7 -0
- package/dist/api/user-messages-api/remove.js +8 -0
- package/dist/api/users-api/check-token.d.ts +7 -0
- package/dist/api/users-api/check-token.js +8 -1
- package/dist/api/users-api/create.d.ts +9 -0
- package/dist/api/users-api/create.js +9 -0
- package/dist/api/users-api/current-update-password.d.ts +9 -0
- package/dist/api/users-api/current-update-password.js +9 -0
- package/dist/api/users-api/current-update.d.ts +9 -0
- package/dist/api/users-api/current-update.js +9 -0
- package/dist/api/users-api/get-one.d.ts +7 -0
- package/dist/api/users-api/get-one.js +8 -1
- package/dist/api/users-api/index.d.ts +34 -0
- package/dist/api/users-api/index.js +35 -1
- package/dist/api/users-api/login.d.ts +9 -0
- package/dist/api/users-api/login.js +9 -1
- package/dist/api/users-api/logout.d.ts +6 -0
- package/dist/api/users-api/logout.js +8 -1
- package/dist/api/users-api/me.d.ts +6 -0
- package/dist/api/users-api/me.js +8 -1
- package/dist/api/users-api/query.d.ts +6 -0
- package/dist/api/users-api/query.js +9 -1
- package/dist/api/users-api/recover.d.ts +7 -0
- package/dist/api/users-api/recover.js +8 -1
- package/dist/api/users-api/remove.d.ts +7 -0
- package/dist/api/users-api/remove.js +8 -1
- package/dist/api/users-api/send-invite.d.ts +6 -0
- package/dist/api/users-api/send-invite.js +8 -1
- package/dist/api/users-api/send-recover-link.d.ts +8 -0
- package/dist/api/users-api/send-recover-link.js +8 -1
- package/dist/api/users-api/update-password.d.ts +10 -0
- package/dist/api/users-api/update-password.js +9 -1
- package/dist/api/users-api/update.d.ts +10 -0
- package/dist/api/users-api/update.js +9 -1
- package/dist/api/widgets-api/create.d.ts +9 -0
- package/dist/api/widgets-api/create.js +9 -1
- package/dist/api/widgets-api/get-info.d.ts +7 -0
- package/dist/api/widgets-api/get-info.js +8 -1
- package/dist/api/widgets-api/get-one.d.ts +7 -0
- package/dist/api/widgets-api/get-one.js +8 -1
- package/dist/api/widgets-api/index.d.ts +16 -0
- package/dist/api/widgets-api/index.js +17 -1
- package/dist/api/widgets-api/query.d.ts +6 -0
- package/dist/api/widgets-api/query.js +9 -1
- package/dist/api/widgets-api/remove.d.ts +7 -0
- package/dist/api/widgets-api/remove.js +8 -1
- package/dist/api/widgets-api/update.d.ts +10 -0
- package/dist/api/widgets-api/update.js +9 -1
- package/dist/api/widgets-openapi/widget-daily.d.ts +7 -0
- package/dist/api/widgets-openapi/widget-daily.js +9 -0
- package/dist/api/widgets-openapi/widget-weekly.d.ts +7 -0
- package/dist/api/widgets-openapi/widget-weekly.js +9 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +13 -0
- package/dist/hooks/use-api-method/actions/creators/api.d.ts +18 -0
- package/dist/hooks/use-api-method/actions/creators/api.js +22 -0
- package/dist/hooks/use-api-method/actions/types/api.d.ts +5 -0
- package/dist/hooks/use-api-method/actions/types/api.js +9 -0
- package/dist/hooks/use-api-method/actions/types.d.ts +6 -0
- package/dist/hooks/use-api-method/actions/types.js +2 -0
- package/dist/hooks/use-api-method/index.d.ts +24 -0
- package/dist/hooks/use-api-method/index.js +67 -0
- package/dist/hooks/use-api-method/reducers/api.d.ts +23 -0
- package/dist/hooks/use-api-method/reducers/api.js +24 -0
- package/dist/utils/convert-to-options.d.ts +13 -0
- package/dist/utils/convert-to-options.js +8 -1
- package/dist/utils/define-status.d.ts +14 -0
- package/dist/utils/define-status.js +57 -1
- package/dist/utils/enum-to-options.d.ts +5 -0
- package/dist/utils/enum-to-options.js +8 -0
- package/dist/utils/get-handled-error-message.d.ts +1 -0
- package/dist/utils/get-handled-error-message.js +5 -0
- package/dist/utils/get-many.d.ts +1 -0
- package/dist/utils/get-many.js +12 -1
- package/dist/utils/get-one.d.ts +1 -0
- package/dist/utils/get-one.js +12 -1
- package/dist/utils/get-service-error.d.ts +18 -0
- package/dist/utils/get-service-error.js +66 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +15 -0
- package/dist/utils/is-axios-error.d.ts +6 -0
- package/dist/utils/is-axios-error.js +11 -0
- package/dist/utils/is-network-error.d.ts +5 -0
- package/dist/utils/is-network-error.js +18 -0
- package/dist/utils/redirect.d.ts +1 -0
- package/dist/utils/redirect.js +7 -0
- package/dist/utils/serialize-record.d.ts +2 -0
- package/dist/utils/serialize-record.js +6 -0
- package/dist/utils/validate-by-dto.d.ts +1 -0
- package/dist/utils/validate-by-dto.js +16 -0
- package/package.json +9 -46
- package/dist/api/certificatesales-api/recover.js +0 -1
- package/dist/api/certificatesales-api/remove.js +0 -1
- package/dist/api/clients-api/remove.js +0 -1
- package/dist/api/financeitems-api/recover.js +0 -1
- package/dist/api/options-api/create.js +0 -1
- package/dist/api/options-api/get-one.js +0 -1
- package/dist/api/options-api/index.js +0 -1
- package/dist/api/options-api/query.js +0 -1
- package/dist/api/options-api/recover.js +0 -1
- package/dist/api/options-api/remove.js +0 -1
- package/dist/api/options-api/update.js +0 -1
- package/dist/api/order-comments-api/create.js +0 -1
- package/dist/api/order-comments-api/index.js +0 -1
- package/dist/api/order-comments-api/remove.js +0 -1
- package/dist/api/orders-api/update-players.js +0 -1
- package/dist/api/roles-api/recover.js +0 -1
- package/dist/api/slots-api/daily-schedule.js +0 -1
- package/dist/api/tariffs-api/recover.js +0 -1
- package/dist/api/widgets-api/recover.js +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { WidgetResponseObject } from '@escapenavigator/types/dist/widget/widget.ro';
|
|
2
|
+
import { ApiMethodDeclaration } from '..';
|
|
3
|
+
declare type ParamsData = undefined;
|
|
4
|
+
declare type ResponseData = WidgetResponseObject[];
|
|
5
|
+
export declare const query: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
6
|
+
export {};
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.query = void 0;
|
|
4
|
+
const query = (params) => ({
|
|
5
|
+
url: '/widgets',
|
|
6
|
+
method: 'GET',
|
|
7
|
+
params,
|
|
8
|
+
});
|
|
9
|
+
exports.query = query;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WidgetResponseObject } from '@escapenavigator/types/dist/widget/widget.ro';
|
|
2
|
+
import { ApiMethodDeclaration } from '..';
|
|
3
|
+
/** ID виджета */
|
|
4
|
+
declare type ParamsData = number;
|
|
5
|
+
declare type ResponseData = WidgetResponseObject;
|
|
6
|
+
export declare const remove: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
7
|
+
export {};
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.remove = void 0;
|
|
4
|
+
const remove = (id) => ({
|
|
5
|
+
url: `/widgets/${id}`,
|
|
6
|
+
method: 'DELETE',
|
|
7
|
+
});
|
|
8
|
+
exports.remove = remove;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UpdateWidgetDto } from '@escapenavigator/types/dist/widget/update-widget.dto';
|
|
2
|
+
import { WidgetResponseObject } from '@escapenavigator/types/dist/widget/widget.ro';
|
|
3
|
+
import { ApiMethodDeclaration } from '..';
|
|
4
|
+
declare type ParamsData = {
|
|
5
|
+
id: number;
|
|
6
|
+
data: UpdateWidgetDto;
|
|
7
|
+
};
|
|
8
|
+
declare type ResponseData = WidgetResponseObject;
|
|
9
|
+
export declare const update: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
10
|
+
export {};
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.update = void 0;
|
|
4
|
+
const update = ({ id, data }) => ({
|
|
5
|
+
url: `/widgets/${id}`,
|
|
6
|
+
method: 'PATCH',
|
|
7
|
+
data,
|
|
8
|
+
});
|
|
9
|
+
exports.update = update;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WidgetScheduleQueryDto } from '@escapenavigator/types/dist/widget-api/widget-schedule-query.dto';
|
|
2
|
+
import { WidgetSlotResponseObject } from '@escapenavigator/types/dist/widget-api/widget-slot.ro';
|
|
3
|
+
import { ApiMethodDeclaration } from '..';
|
|
4
|
+
declare type ParamsData = WidgetScheduleQueryDto;
|
|
5
|
+
declare type ResponseData = WidgetSlotResponseObject[];
|
|
6
|
+
export declare const weekly: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WidgetScheduleQueryDto } from '@escapenavigator/types/dist/widget-api/widget-schedule-query.dto';
|
|
2
|
+
import { WidgetSlotResponseObject } from '@escapenavigator/types/dist/widget-api/widget-slot.ro';
|
|
3
|
+
import { ApiMethodDeclaration } from '..';
|
|
4
|
+
declare type ParamsData = WidgetScheduleQueryDto;
|
|
5
|
+
declare type ResponseData = WidgetSlotResponseObject[];
|
|
6
|
+
export declare const weekly: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-api-method';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./use-api-method"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { ServiceError } from '../../../../utils/get-service-error';
|
|
3
|
+
import { ActionTypes } from '../types/api';
|
|
4
|
+
export declare const fetchStart: () => {
|
|
5
|
+
type: ActionTypes.FETCH_START;
|
|
6
|
+
};
|
|
7
|
+
export declare const fetchSuccess: <R extends AxiosResponse<any>>(response: R) => {
|
|
8
|
+
type: ActionTypes.FETCH_SUCCESS;
|
|
9
|
+
payload: {
|
|
10
|
+
response: R;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const fetchFailure: (error: ServiceError) => {
|
|
14
|
+
type: ActionTypes.FETCH_FAILURE;
|
|
15
|
+
payload: {
|
|
16
|
+
error: ServiceError;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchFailure = exports.fetchSuccess = exports.fetchStart = void 0;
|
|
4
|
+
const api_1 = require("../types/api");
|
|
5
|
+
const fetchStart = () => ({
|
|
6
|
+
type: api_1.ActionTypes.FETCH_START,
|
|
7
|
+
});
|
|
8
|
+
exports.fetchStart = fetchStart;
|
|
9
|
+
const fetchSuccess = (response) => ({
|
|
10
|
+
type: api_1.ActionTypes.FETCH_SUCCESS,
|
|
11
|
+
payload: {
|
|
12
|
+
response,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
exports.fetchSuccess = fetchSuccess;
|
|
16
|
+
const fetchFailure = (error) => ({
|
|
17
|
+
type: api_1.ActionTypes.FETCH_FAILURE,
|
|
18
|
+
payload: {
|
|
19
|
+
error,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
exports.fetchFailure = fetchFailure;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActionTypes = void 0;
|
|
4
|
+
var ActionTypes;
|
|
5
|
+
(function (ActionTypes) {
|
|
6
|
+
ActionTypes["FETCH_START"] = "FETCH_START";
|
|
7
|
+
ActionTypes["FETCH_FAILURE"] = "FETCH_FAILURE";
|
|
8
|
+
ActionTypes["FETCH_SUCCESS"] = "FETCH_SUCCESS";
|
|
9
|
+
})(ActionTypes = exports.ActionTypes || (exports.ActionTypes = {}));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AxiosPromise, AxiosResponse } from 'axios';
|
|
2
|
+
import { ServiceError } from '../../utils/get-service-error';
|
|
3
|
+
declare type ApiMethod<P, T, R, DisplayName> = {
|
|
4
|
+
(params: P, transportConfig?: T): AxiosPromise<R>;
|
|
5
|
+
displayName: DisplayName;
|
|
6
|
+
};
|
|
7
|
+
declare type BaseResult<P, T, R, DisplayName extends string> = {
|
|
8
|
+
fetch: ApiMethod<P, T, R, DisplayName>;
|
|
9
|
+
data: R | null;
|
|
10
|
+
loading: boolean;
|
|
11
|
+
error: ServiceError | null;
|
|
12
|
+
statusOk: boolean | null;
|
|
13
|
+
};
|
|
14
|
+
declare type Result<P, T, R, DisplayName extends string> = {
|
|
15
|
+
[K in keyof BaseResult<P, T, R, DisplayName> as `${DisplayName}${Capitalize<K>}`]: BaseResult<P, T, R, DisplayName>[K];
|
|
16
|
+
};
|
|
17
|
+
declare type Props<P, T, R, DisplayName extends string> = {
|
|
18
|
+
api: ApiMethod<P, T, R, DisplayName>;
|
|
19
|
+
successCallback?: (data: AxiosResponse<R>) => void;
|
|
20
|
+
errorCallback?: (error: any) => void;
|
|
21
|
+
delay?: number;
|
|
22
|
+
};
|
|
23
|
+
export declare const useApiMethod: <P, T, R, DisplayName extends string>({ api, successCallback, errorCallback, delay, }: Props<P, T, R, DisplayName>) => Result<P, T, R, DisplayName>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.useApiMethod = void 0;
|
|
16
|
+
const react_1 = require("react");
|
|
17
|
+
const axios_1 = __importDefault(require("axios"));
|
|
18
|
+
const get_service_error_1 = require("../../utils/get-service-error");
|
|
19
|
+
const api_1 = require("./actions/creators/api");
|
|
20
|
+
const api_2 = require("./reducers/api");
|
|
21
|
+
const useApiMethod = ({ api, successCallback, errorCallback, delay, }) => {
|
|
22
|
+
const mounted = react_1.useRef(false);
|
|
23
|
+
const source = react_1.useRef(null);
|
|
24
|
+
const [state, dispatch] = react_1.useReducer(api_2.apiReducer, api_2.initialState);
|
|
25
|
+
const fetch = react_1.useCallback((params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
+
source.current = axios_1.default.CancelToken.source();
|
|
27
|
+
const startTime = Date.now();
|
|
28
|
+
try {
|
|
29
|
+
dispatch(api_1.fetchStart());
|
|
30
|
+
const response = yield api(params);
|
|
31
|
+
const deltaTime = Date.now() - startTime;
|
|
32
|
+
const delta = delay && deltaTime < delay ? 500 - deltaTime : 0;
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
if (successCallback)
|
|
35
|
+
successCallback(response);
|
|
36
|
+
dispatch(api_1.fetchSuccess(response));
|
|
37
|
+
}, delta);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (errorCallback)
|
|
41
|
+
errorCallback(error);
|
|
42
|
+
if (!mounted.current)
|
|
43
|
+
return;
|
|
44
|
+
const err = get_service_error_1.getServiceError(error);
|
|
45
|
+
dispatch(api_1.fetchFailure(err));
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
}), [api, successCallback, errorCallback, delay]);
|
|
49
|
+
react_1.useEffect(() => {
|
|
50
|
+
mounted.current = true;
|
|
51
|
+
return () => {
|
|
52
|
+
var _a;
|
|
53
|
+
mounted.current = false;
|
|
54
|
+
(_a = source.current) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
55
|
+
};
|
|
56
|
+
}, [mounted]);
|
|
57
|
+
const name = api.displayName;
|
|
58
|
+
const res = {
|
|
59
|
+
[`${name}Fetch`]: fetch,
|
|
60
|
+
[`${name}Data`]: state.data,
|
|
61
|
+
[`${name}Loading`]: state.loading,
|
|
62
|
+
[`${name}Error`]: state.error,
|
|
63
|
+
[`${name}StatusOk`]: state.statusOk,
|
|
64
|
+
};
|
|
65
|
+
return res;
|
|
66
|
+
};
|
|
67
|
+
exports.useApiMethod = useApiMethod;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Reducer } from 'react';
|
|
2
|
+
import { AxiosResponse } from 'axios';
|
|
3
|
+
import { ServiceError } from '../../../utils/get-service-error';
|
|
4
|
+
import * as actions from '../actions/creators/api';
|
|
5
|
+
import { GenericActionCreator } from '../actions/types';
|
|
6
|
+
declare type Action = GenericActionCreator<typeof actions>;
|
|
7
|
+
export declare type State<R> = {
|
|
8
|
+
data: R | null;
|
|
9
|
+
loading: boolean;
|
|
10
|
+
error: ServiceError | null;
|
|
11
|
+
response: AxiosResponse<R> | null;
|
|
12
|
+
statusOk: boolean | null;
|
|
13
|
+
};
|
|
14
|
+
export declare const initialState: {
|
|
15
|
+
data: any;
|
|
16
|
+
loading: boolean;
|
|
17
|
+
error: any;
|
|
18
|
+
response: any;
|
|
19
|
+
statusOk: any;
|
|
20
|
+
};
|
|
21
|
+
export declare type ApiReducer<R> = Reducer<State<R>, Action>;
|
|
22
|
+
export declare const apiReducer: <R>(state: State<R>, action: Action) => State<R>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.apiReducer = exports.initialState = void 0;
|
|
4
|
+
const api_1 = require("../actions/types/api");
|
|
5
|
+
exports.initialState = {
|
|
6
|
+
data: null,
|
|
7
|
+
loading: false,
|
|
8
|
+
error: null,
|
|
9
|
+
response: null,
|
|
10
|
+
statusOk: null,
|
|
11
|
+
};
|
|
12
|
+
const apiReducer = (state = exports.initialState, action) => {
|
|
13
|
+
switch (action.type) {
|
|
14
|
+
case api_1.ActionTypes.FETCH_START:
|
|
15
|
+
return Object.assign(Object.assign({}, exports.initialState), { loading: true });
|
|
16
|
+
case api_1.ActionTypes.FETCH_SUCCESS:
|
|
17
|
+
return Object.assign(Object.assign({}, state), { loading: false, data: action.payload.response.data, response: action.payload.response, statusOk: true });
|
|
18
|
+
case api_1.ActionTypes.FETCH_FAILURE:
|
|
19
|
+
return Object.assign(Object.assign({}, state), { loading: false, error: action.payload.error, statusOk: false });
|
|
20
|
+
default:
|
|
21
|
+
return state;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.apiReducer = apiReducer;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare type OptionsType<T> = Array<{
|
|
2
|
+
key: T;
|
|
3
|
+
content: any;
|
|
4
|
+
}>;
|
|
5
|
+
declare type ConvertToOptions = <T extends {
|
|
6
|
+
id: string | number;
|
|
7
|
+
[field: string]: any;
|
|
8
|
+
}>(data: T[], field?: string) => Array<{
|
|
9
|
+
key: T['id'];
|
|
10
|
+
content: any;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const convertToOptions: ConvertToOptions;
|
|
13
|
+
export {};
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertToOptions = void 0;
|
|
4
|
+
const convertToOptions = (data, field) => data.map((item) => ({
|
|
5
|
+
key: item.id,
|
|
6
|
+
content: (field && item[field]) || item.title || item.name,
|
|
7
|
+
}));
|
|
8
|
+
exports.convertToOptions = convertToOptions;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CertificateSaleResponseObject } from '@escapenavigator/types/dist/certificate-sale/certificate-sale.ro';
|
|
2
|
+
import { OrderResponseObject } from '@escapenavigator/types/dist/order/order.ro';
|
|
3
|
+
declare type TFunction = (value: string, options?: {
|
|
4
|
+
count?: number | null;
|
|
5
|
+
}) => string;
|
|
6
|
+
declare type Status = {
|
|
7
|
+
text: string;
|
|
8
|
+
view: 'negative' | 'positive' | 'secondary' | 'accent' | 'attention';
|
|
9
|
+
};
|
|
10
|
+
declare type DefineCertificateFunction = (t: TFunction) => Record<CertificateSaleResponseObject['status'], Status>;
|
|
11
|
+
declare type DefineOrderFunction = (t: TFunction) => Record<OrderResponseObject['status'], Status>;
|
|
12
|
+
export declare const defineStatusForCertificate: DefineCertificateFunction;
|
|
13
|
+
export declare const defineStatusForOrder: DefineOrderFunction;
|
|
14
|
+
export {};
|
|
@@ -1 +1,57 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defineStatusForOrder = exports.defineStatusForCertificate = void 0;
|
|
4
|
+
const defineStatusForCertificate = (t) => ({
|
|
5
|
+
new: {
|
|
6
|
+
view: 'accent',
|
|
7
|
+
text: t('statusComponent.new'),
|
|
8
|
+
},
|
|
9
|
+
sended: {
|
|
10
|
+
view: 'attention',
|
|
11
|
+
text: t('statusComponent.sended'),
|
|
12
|
+
},
|
|
13
|
+
used: {
|
|
14
|
+
view: 'positive',
|
|
15
|
+
text: t('statusComponent.used'),
|
|
16
|
+
},
|
|
17
|
+
annul: {
|
|
18
|
+
view: 'negative',
|
|
19
|
+
text: t('statusComponent.annul'),
|
|
20
|
+
},
|
|
21
|
+
hold: {
|
|
22
|
+
view: 'secondary',
|
|
23
|
+
text: t('statusComponent.hold'),
|
|
24
|
+
},
|
|
25
|
+
expired: {
|
|
26
|
+
view: 'negative',
|
|
27
|
+
text: t('statusComponent.expired'),
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
exports.defineStatusForCertificate = defineStatusForCertificate;
|
|
31
|
+
const defineStatusForOrder = (t) => ({
|
|
32
|
+
new: {
|
|
33
|
+
view: 'accent',
|
|
34
|
+
text: t('statusComponent.new'),
|
|
35
|
+
},
|
|
36
|
+
accepted: {
|
|
37
|
+
view: 'attention',
|
|
38
|
+
text: t('statusComponent.accepted'),
|
|
39
|
+
},
|
|
40
|
+
success: {
|
|
41
|
+
view: 'positive',
|
|
42
|
+
text: t('statusComponent.success'),
|
|
43
|
+
},
|
|
44
|
+
canceled: {
|
|
45
|
+
view: 'negative',
|
|
46
|
+
text: t('statusComponent.canceled'),
|
|
47
|
+
},
|
|
48
|
+
pending: {
|
|
49
|
+
view: 'secondary',
|
|
50
|
+
text: t('statusComponent.pending'),
|
|
51
|
+
},
|
|
52
|
+
failed_payment: {
|
|
53
|
+
view: 'negative',
|
|
54
|
+
text: t('statusComponent.failed_payment'),
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
exports.defineStatusForOrder = defineStatusForOrder;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enumToOptions = void 0;
|
|
4
|
+
const enumToOptions = (options, t, modelName) => Object.values(options).map((option) => ({
|
|
5
|
+
key: option,
|
|
6
|
+
content: t(`options.${modelName}.${option}`),
|
|
7
|
+
}));
|
|
8
|
+
exports.enumToOptions = enumToOptions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getHandledErrorMessage: (error: any) => any;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHandledErrorMessage = void 0;
|
|
4
|
+
const getHandledErrorMessage = (error) => (error.response ? error.response.data.message : error.message);
|
|
5
|
+
exports.getHandledErrorMessage = getHandledErrorMessage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getMany(ids: any, records: any, field?: string): any[];
|
package/dist/utils/get-many.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMany = void 0;
|
|
4
|
+
function getMany(ids, records, field = 'title') {
|
|
5
|
+
if (!Array.isArray(ids) || !Array.isArray(records))
|
|
6
|
+
return null;
|
|
7
|
+
const filtred = records.filter((r) => ids.includes(r.id));
|
|
8
|
+
if (!filtred.length)
|
|
9
|
+
return null;
|
|
10
|
+
return filtred.map((r) => r[field] || r.title);
|
|
11
|
+
}
|
|
12
|
+
exports.getMany = getMany;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getOne(id: any, records: any, field?: string): any;
|
package/dist/utils/get-one.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOne = void 0;
|
|
4
|
+
function getOne(id, records, field = 'title') {
|
|
5
|
+
if (!id || !Array.isArray(records))
|
|
6
|
+
return null;
|
|
7
|
+
const [record] = records.filter((r) => r.id === id);
|
|
8
|
+
if (!record)
|
|
9
|
+
return null;
|
|
10
|
+
return record[field] || record.title;
|
|
11
|
+
}
|
|
12
|
+
exports.getOne = getOne;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AxiosError } from 'axios';
|
|
2
|
+
import { ErrorData } from '../api';
|
|
3
|
+
export declare enum ErrorType {
|
|
4
|
+
NETWORK = "NETWORK",
|
|
5
|
+
BUSINESS = "BUSINESS",
|
|
6
|
+
INTERNAL = "INTERNAL"
|
|
7
|
+
}
|
|
8
|
+
export declare type ServiceError = {
|
|
9
|
+
code: string;
|
|
10
|
+
message: string;
|
|
11
|
+
errorType: ErrorType;
|
|
12
|
+
originalError: unknown | AxiosError<ErrorData>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Возвращает обработанную ошибку с дополнительной информацией.
|
|
16
|
+
* @param error Ошибка от сервиса
|
|
17
|
+
*/
|
|
18
|
+
export declare function getServiceError(error: unknown): ServiceError;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getServiceError = exports.ErrorType = void 0;
|
|
4
|
+
const is_axios_error_1 = require("./is-axios-error");
|
|
5
|
+
const is_network_error_1 = require("./is-network-error");
|
|
6
|
+
var ErrorType;
|
|
7
|
+
(function (ErrorType) {
|
|
8
|
+
ErrorType["NETWORK"] = "NETWORK";
|
|
9
|
+
ErrorType["BUSINESS"] = "BUSINESS";
|
|
10
|
+
ErrorType["INTERNAL"] = "INTERNAL";
|
|
11
|
+
})(ErrorType = exports.ErrorType || (exports.ErrorType = {}));
|
|
12
|
+
const ERROR_CODES = {
|
|
13
|
+
[ErrorType.INTERNAL]: 'INTERNAL_ERROR',
|
|
14
|
+
[ErrorType.NETWORK]: 'NETWORK_ERROR',
|
|
15
|
+
};
|
|
16
|
+
const ERROR_MESSAGES = {
|
|
17
|
+
[ErrorType.INTERNAL]: 'Пожалуйста, попробуйте ещё раз позже.',
|
|
18
|
+
[ErrorType.NETWORK]: 'Проверьте подключение и попробуйте ещё раз позже.',
|
|
19
|
+
};
|
|
20
|
+
const INTERNAL_SERVICE_ERROR_CODES = [
|
|
21
|
+
'BAD_REQUEST',
|
|
22
|
+
'INTERNAL_SERVER_ERROR',
|
|
23
|
+
'INTERNAL_ERROR',
|
|
24
|
+
'WS_ERROR',
|
|
25
|
+
'DEFAULT',
|
|
26
|
+
];
|
|
27
|
+
/**
|
|
28
|
+
* Возвращает обработанную ошибку с дополнительной информацией.
|
|
29
|
+
* @param error Ошибка от сервиса
|
|
30
|
+
*/
|
|
31
|
+
function getServiceError(error) {
|
|
32
|
+
if (is_network_error_1.isNetworkError(error)) {
|
|
33
|
+
return {
|
|
34
|
+
code: ERROR_CODES[ErrorType.NETWORK],
|
|
35
|
+
message: ERROR_MESSAGES[ErrorType.NETWORK],
|
|
36
|
+
errorType: ErrorType.NETWORK,
|
|
37
|
+
originalError: error,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (is_axios_error_1.isAxiosError(error)) {
|
|
41
|
+
const { errorCode, originalErrorCode, message } = error.response.data;
|
|
42
|
+
let code = errorCode;
|
|
43
|
+
let errorType = ErrorType.BUSINESS;
|
|
44
|
+
if (INTERNAL_SERVICE_ERROR_CODES.includes(code)) {
|
|
45
|
+
if (typeof originalErrorCode === 'undefined') {
|
|
46
|
+
errorType = ErrorType.INTERNAL;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
code = originalErrorCode;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
code,
|
|
54
|
+
message,
|
|
55
|
+
errorType,
|
|
56
|
+
originalError: error,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
code: ERROR_CODES[ErrorType.INTERNAL],
|
|
61
|
+
message: ERROR_MESSAGES[ErrorType.INTERNAL],
|
|
62
|
+
errorType: ErrorType.INTERNAL,
|
|
63
|
+
originalError: error,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
exports.getServiceError = getServiceError;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./serialize-record"), exports);
|
|
14
|
+
__exportStar(require("./validate-by-dto"), exports);
|
|
15
|
+
__exportStar(require("./get-handled-error-message"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAxiosError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Возвращает `true`, если ошибка была выброшена axios
|
|
6
|
+
* @param error Ошибка от сервиса
|
|
7
|
+
*/
|
|
8
|
+
function isAxiosError(error) {
|
|
9
|
+
return Boolean(error.isAxiosError);
|
|
10
|
+
}
|
|
11
|
+
exports.isAxiosError = isAxiosError;
|