@escapenavigator/services 1.2.7 → 1.3.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.
Files changed (226) hide show
  1. package/README.md +1 -1
  2. package/dist/api/admins-api/get-profile-token.js +3 -3
  3. package/dist/api/admins-api/index.js +4 -4
  4. package/dist/api/admins-api/login.js +8 -5
  5. package/dist/api/admins-api/logout.js +2 -2
  6. package/dist/api/admins-api/me.js +2 -2
  7. package/dist/api/agb-api/get-one.js +3 -3
  8. package/dist/api/agb-api/index.js +2 -2
  9. package/dist/api/agb-api/update.js +8 -5
  10. package/dist/api/cashboxes-api/create.js +8 -5
  11. package/dist/api/cashboxes-api/get-one.js +3 -3
  12. package/dist/api/cashboxes-api/index.js +5 -5
  13. package/dist/api/cashboxes-api/query.js +2 -2
  14. package/dist/api/cashboxes-api/recover.js +3 -3
  15. package/dist/api/cashboxes-api/remove.js +3 -3
  16. package/dist/api/cashboxes-api/update.js +8 -5
  17. package/dist/api/certificates-api/create.js +8 -5
  18. package/dist/api/certificates-api/get-one.js +3 -3
  19. package/dist/api/certificates-api/index.js +6 -6
  20. package/dist/api/certificates-api/query.js +2 -2
  21. package/dist/api/certificates-api/recover.js +3 -3
  22. package/dist/api/certificates-api/remove.js +3 -3
  23. package/dist/api/certificates-api/update.js +8 -5
  24. package/dist/api/certificatesales-api/annul.js +8 -5
  25. package/dist/api/certificatesales-api/create.js +8 -5
  26. package/dist/api/certificatesales-api/get-one-by-code.js +3 -3
  27. package/dist/api/certificatesales-api/get-one.js +3 -3
  28. package/dist/api/certificatesales-api/index.js +9 -9
  29. package/dist/api/certificatesales-api/paginate.js +3 -3
  30. package/dist/api/certificatesales-api/query.js +3 -3
  31. package/dist/api/certificatesales-api/update-expire-date.js +8 -5
  32. package/dist/api/certificatesales-api/update-status.js +8 -5
  33. package/dist/api/certificatesales-api/update.js +8 -5
  34. package/dist/api/cities-api/get-cities-by-country.js +2 -2
  35. package/dist/api/cities-api/get-city-by-ip.js +2 -2
  36. package/dist/api/cities-api/get-city-by-slug.js +2 -2
  37. package/dist/api/cities-api/get-one.js +3 -3
  38. package/dist/api/cities-api/get-popular-cities-near.js +2 -2
  39. package/dist/api/cities-api/index.js +7 -7
  40. package/dist/api/cities-api/query.js +3 -3
  41. package/dist/api/cities-api/remove.js +3 -3
  42. package/dist/api/cities-api/update.js +8 -5
  43. package/dist/api/clients-api/create-from-widget.js +8 -5
  44. package/dist/api/clients-api/create.js +8 -5
  45. package/dist/api/clients-api/get-all.js +3 -3
  46. package/dist/api/clients-api/get-one.js +3 -3
  47. package/dist/api/clients-api/index.js +6 -6
  48. package/dist/api/clients-api/query.js +3 -3
  49. package/dist/api/clients-api/update.js +8 -5
  50. package/dist/api/emails-api/index.js +1 -1
  51. package/dist/api/emails-api/query.js +3 -3
  52. package/dist/api/financeitems-api/create.js +8 -5
  53. package/dist/api/financeitems-api/get-all.js +3 -3
  54. package/dist/api/financeitems-api/get-one.js +3 -3
  55. package/dist/api/financeitems-api/index.js +5 -5
  56. package/dist/api/financeitems-api/query.js +3 -3
  57. package/dist/api/financeitems-api/remove.js +3 -3
  58. package/dist/api/images-api/create.js +8 -5
  59. package/dist/api/images-api/index.js +1 -1
  60. package/dist/api/index.js +71 -20
  61. package/dist/api/init-client-api.js +33 -33
  62. package/dist/api/locations-api/create.js +8 -5
  63. package/dist/api/locations-api/get-by-coordinates.js +3 -3
  64. package/dist/api/locations-api/get-one.js +3 -3
  65. package/dist/api/locations-api/index.js +7 -7
  66. package/dist/api/locations-api/query.js +3 -3
  67. package/dist/api/locations-api/recover.js +3 -3
  68. package/dist/api/locations-api/remove.js +3 -3
  69. package/dist/api/locations-api/update.js +8 -5
  70. package/dist/api/order-discounts-api/create.js +8 -5
  71. package/dist/api/order-discounts-api/index.js +2 -2
  72. package/dist/api/order-discounts-api/remove.js +3 -3
  73. package/dist/api/order-penalties-api/create.js +8 -5
  74. package/dist/api/order-penalties-api/index.js +2 -2
  75. package/dist/api/order-penalties-api/remove.js +3 -3
  76. package/dist/api/order-upsellings-api/create.js +8 -5
  77. package/dist/api/order-upsellings-api/index.js +2 -2
  78. package/dist/api/order-upsellings-api/remove.js +3 -3
  79. package/dist/api/orders-api/add-certificate.js +8 -5
  80. package/dist/api/orders-api/create-from-widget.js +8 -5
  81. package/dist/api/orders-api/create.js +8 -5
  82. package/dist/api/orders-api/get-one.js +3 -3
  83. package/dist/api/orders-api/index.js +11 -11
  84. package/dist/api/orders-api/paginate.js +3 -3
  85. package/dist/api/orders-api/query.js +3 -3
  86. package/dist/api/orders-api/remove-certificate.js +8 -5
  87. package/dist/api/orders-api/remove.js +3 -3
  88. package/dist/api/orders-api/update-slot.js +8 -5
  89. package/dist/api/orders-api/update-status.js +8 -5
  90. package/dist/api/orders-api/update.js +8 -5
  91. package/dist/api/partners-api/create.js +8 -5
  92. package/dist/api/partners-api/get-all.js +3 -3
  93. package/dist/api/partners-api/get-one.js +3 -3
  94. package/dist/api/partners-api/index.js +7 -7
  95. package/dist/api/partners-api/query.js +3 -3
  96. package/dist/api/partners-api/recover.js +3 -3
  97. package/dist/api/partners-api/remove.js +3 -3
  98. package/dist/api/partners-api/update.js +8 -5
  99. package/dist/api/profiles-api/create.js +8 -5
  100. package/dist/api/profiles-api/current.js +2 -2
  101. package/dist/api/profiles-api/get-by-slug.js +3 -3
  102. package/dist/api/profiles-api/get-one.js +3 -3
  103. package/dist/api/profiles-api/index.js +7 -7
  104. package/dist/api/profiles-api/query.js +3 -3
  105. package/dist/api/profiles-api/remove.js +3 -3
  106. package/dist/api/profiles-api/update-current.js +8 -5
  107. package/dist/api/profiles-api/update.js +8 -5
  108. package/dist/api/questrooms-api/create.js +8 -5
  109. package/dist/api/questrooms-api/get-by-coordinates.js +3 -3
  110. package/dist/api/questrooms-api/get-by-location.js +3 -3
  111. package/dist/api/questrooms-api/get-by-slug.js +3 -3
  112. package/dist/api/questrooms-api/get-by-title.js +3 -3
  113. package/dist/api/questrooms-api/get-one.js +3 -3
  114. package/dist/api/questrooms-api/index.js +9 -9
  115. package/dist/api/questrooms-api/query.js +3 -3
  116. package/dist/api/questrooms-api/recover.js +3 -3
  117. package/dist/api/questrooms-api/remove.js +3 -3
  118. package/dist/api/questrooms-api/update.js +8 -5
  119. package/dist/api/registration-requests-api/create.js +8 -5
  120. package/dist/api/registration-requests-api/get-one.js +3 -3
  121. package/dist/api/registration-requests-api/index.js +5 -5
  122. package/dist/api/registration-requests-api/query.js +3 -3
  123. package/dist/api/registration-requests-api/remove.js +3 -3
  124. package/dist/api/registration-requests-api/update.js +8 -5
  125. package/dist/api/roles-api/create.js +8 -5
  126. package/dist/api/roles-api/get-one.js +3 -3
  127. package/dist/api/roles-api/index.js +5 -5
  128. package/dist/api/roles-api/query.js +3 -3
  129. package/dist/api/roles-api/remove.js +3 -3
  130. package/dist/api/roles-api/update.js +8 -5
  131. package/dist/api/slot-templates-api/get.js +3 -3
  132. package/dist/api/slot-templates-api/index.js +2 -2
  133. package/dist/api/slot-templates-api/update.js +8 -5
  134. package/dist/api/slots-api/add-breaks.js +8 -5
  135. package/dist/api/slots-api/add-or-remove-break.js +8 -5
  136. package/dist/api/slots-api/calendar.js +3 -3
  137. package/dist/api/slots-api/create.js +8 -5
  138. package/dist/api/slots-api/daily.js +3 -3
  139. package/dist/api/slots-api/index.js +8 -8
  140. package/dist/api/slots-api/remove-breaks.js +8 -5
  141. package/dist/api/slots-api/remove.js +3 -3
  142. package/dist/api/slots-api/weekly.js +3 -3
  143. package/dist/api/support/create.js +8 -5
  144. package/dist/api/support/index.js +1 -1
  145. package/dist/api/tariffs-api/create.js +8 -5
  146. package/dist/api/tariffs-api/get-one.js +3 -3
  147. package/dist/api/tariffs-api/index.js +5 -5
  148. package/dist/api/tariffs-api/query.js +3 -3
  149. package/dist/api/tariffs-api/remove.js +3 -3
  150. package/dist/api/tariffs-api/update.js +8 -5
  151. package/dist/api/transactions-api/create-certificate-payment.js +8 -5
  152. package/dist/api/transactions-api/create-certificate-refund.js +8 -5
  153. package/dist/api/transactions-api/create-order-payment.js +8 -5
  154. package/dist/api/transactions-api/create-order-refund.js +8 -5
  155. package/dist/api/transactions-api/create.js +8 -5
  156. package/dist/api/transactions-api/get-one.js +3 -3
  157. package/dist/api/transactions-api/index.js +13 -13
  158. package/dist/api/transactions-api/query.js +3 -3
  159. package/dist/api/transactions-api/remove-certificate-payment.js +3 -3
  160. package/dist/api/transactions-api/remove-certificate-refund.js +3 -3
  161. package/dist/api/transactions-api/remove-order-payment.js +3 -3
  162. package/dist/api/transactions-api/remove-order-refund.js +3 -3
  163. package/dist/api/transactions-api/remove.js +3 -3
  164. package/dist/api/transactions-api/update.js +8 -5
  165. package/dist/api/uploads-api/index.js +1 -1
  166. package/dist/api/uploads-api/upload-image.js +12 -9
  167. package/dist/api/upsellings-api/create.js +8 -5
  168. package/dist/api/upsellings-api/get-one.js +3 -3
  169. package/dist/api/upsellings-api/index.js +5 -5
  170. package/dist/api/upsellings-api/query.js +3 -3
  171. package/dist/api/upsellings-api/remove.js +3 -3
  172. package/dist/api/upsellings-api/update.js +8 -5
  173. package/dist/api/user-messages-api/create.js +8 -5
  174. package/dist/api/user-messages-api/get-one.js +3 -3
  175. package/dist/api/user-messages-api/index.js +4 -4
  176. package/dist/api/user-messages-api/query.js +3 -3
  177. package/dist/api/user-messages-api/remove.js +3 -3
  178. package/dist/api/users-api/check-token.js +7 -4
  179. package/dist/api/users-api/create.js +8 -5
  180. package/dist/api/users-api/current-update-password.js +8 -5
  181. package/dist/api/users-api/current-update.js +8 -5
  182. package/dist/api/users-api/get-one.js +3 -3
  183. package/dist/api/users-api/index.js +15 -15
  184. package/dist/api/users-api/login.js +8 -5
  185. package/dist/api/users-api/logout.js +2 -2
  186. package/dist/api/users-api/me.js +2 -2
  187. package/dist/api/users-api/query.js +3 -3
  188. package/dist/api/users-api/recover.js +3 -3
  189. package/dist/api/users-api/remove.js +3 -3
  190. package/dist/api/users-api/send-invite.js +3 -3
  191. package/dist/api/users-api/send-recover-link.js +3 -3
  192. package/dist/api/users-api/update-password.js +8 -5
  193. package/dist/api/users-api/update.js +8 -5
  194. package/dist/api/widgets-api/create.js +8 -5
  195. package/dist/api/widgets-api/get-one.js +3 -3
  196. package/dist/api/widgets-api/index.js +5 -5
  197. package/dist/api/widgets-api/query.js +3 -3
  198. package/dist/api/widgets-api/remove.js +3 -3
  199. package/dist/api/widgets-api/update.js +8 -5
  200. package/dist/api/widgets-openapi/create-certificate.d.ts +9 -0
  201. package/dist/api/widgets-openapi/create-certificate.js +12 -0
  202. package/dist/api/widgets-openapi/create-order.d.ts +9 -0
  203. package/dist/api/widgets-openapi/create-order.js +12 -0
  204. package/dist/api/widgets-openapi/find-certificate.d.ts +6 -0
  205. package/dist/api/widgets-openapi/find-certificate.js +8 -0
  206. package/dist/api/widgets-openapi/get-widget-info.js +3 -3
  207. package/dist/api/widgets-openapi/index.d.ts +6 -0
  208. package/dist/api/widgets-openapi/index.js +9 -3
  209. package/dist/api/widgets-openapi/widget-daily.js +3 -3
  210. package/dist/api/widgets-openapi/widget-weekly.d.ts +2 -2
  211. package/dist/api/widgets-openapi/widget-weekly.js +3 -3
  212. package/dist/hooks/use-api-method/actions/creators/api.js +9 -9
  213. package/dist/hooks/use-api-method/index.js +83 -43
  214. package/dist/hooks/use-api-method/reducers/api.js +17 -5
  215. package/dist/utils/convert-to-options.js +3 -3
  216. package/dist/utils/define-status.js +4 -4
  217. package/dist/utils/enum-to-options.js +3 -3
  218. package/dist/utils/get-handled-error-message.js +1 -1
  219. package/dist/utils/get-many.js +4 -3
  220. package/dist/utils/get-one.js +3 -2
  221. package/dist/utils/get-service-error.js +18 -17
  222. package/dist/utils/is-network-error.js +3 -3
  223. package/dist/utils/redirect.js +1 -1
  224. package/dist/utils/serialize-record.js +4 -2
  225. package/dist/utils/validate-by-dto.js +8 -7
  226. package/package.json +4 -4
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.recover = void 0;
4
- const recover = (id) => ({
5
- url: `/users/recover/${id}`,
4
+ var recover = function (id) { return ({
5
+ url: "/users/recover/".concat(id),
6
6
  method: 'PATCH',
7
- });
7
+ }); };
8
8
  exports.recover = recover;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.remove = void 0;
4
- const remove = (id) => ({
5
- url: `/users/${id}`,
4
+ var remove = function (id) { return ({
5
+ url: "/users/".concat(id),
6
6
  method: 'DELETE',
7
- });
7
+ }); };
8
8
  exports.remove = remove;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sendInvite = void 0;
4
- const sendInvite = (id) => ({
5
- url: `/users/send-invite-link/${id}`,
4
+ var sendInvite = function (id) { return ({
5
+ url: "/users/send-invite-link/".concat(id),
6
6
  method: 'GET',
7
- });
7
+ }); };
8
8
  exports.sendInvite = sendInvite;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sendRecoverLink = void 0;
4
- const sendRecoverLink = (email) => ({
5
- url: `/users/send-recover-link/${email}`,
4
+ var sendRecoverLink = function (email) { return ({
5
+ url: "/users/send-recover-link/".concat(email),
6
6
  method: 'GET',
7
- });
7
+ }); };
8
8
  exports.sendRecoverLink = sendRecoverLink;
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updatePassword = void 0;
4
- const updatePassword = ({ token, data }) => ({
5
- url: `/users/update-password/${token}`,
6
- method: 'PATCH',
7
- data,
8
- });
4
+ var updatePassword = function (_a) {
5
+ var token = _a.token, data = _a.data;
6
+ return ({
7
+ url: "/users/update-password/".concat(token),
8
+ method: 'PATCH',
9
+ data: data,
10
+ });
11
+ };
9
12
  exports.updatePassword = updatePassword;
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.update = void 0;
4
- const update = ({ id, data }) => ({
5
- url: `/users/${id}`,
6
- method: 'PATCH',
7
- data,
8
- });
4
+ var update = function (_a) {
5
+ var id = _a.id, data = _a.data;
6
+ return ({
7
+ url: "/users/".concat(id),
8
+ method: 'PATCH',
9
+ data: data,
10
+ });
11
+ };
9
12
  exports.update = update;
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.create = void 0;
4
- const create = ({ data }) => ({
5
- url: '/widgets',
6
- method: 'POST',
7
- data,
8
- });
4
+ var create = function (_a) {
5
+ var data = _a.data;
6
+ return ({
7
+ url: '/widgets',
8
+ method: 'POST',
9
+ data: data,
10
+ });
11
+ };
9
12
  exports.create = create;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getOne = void 0;
4
- const getOne = (id) => ({
5
- url: `/widgets/${id}`,
4
+ var getOne = function (id) { return ({
5
+ url: "/widgets/".concat(id),
6
6
  method: 'GET',
7
- });
7
+ }); };
8
8
  exports.getOne = getOne;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.widgetsApiDeclaration = void 0;
4
- const create_1 = require("./create");
5
- const get_one_1 = require("./get-one");
6
- const query_1 = require("./query");
7
- const remove_1 = require("./remove");
8
- const update_1 = require("./update");
4
+ var create_1 = require("./create");
5
+ var get_one_1 = require("./get-one");
6
+ var query_1 = require("./query");
7
+ var remove_1 = require("./remove");
8
+ var update_1 = require("./update");
9
9
  exports.widgetsApiDeclaration = {
10
10
  create: create_1.create,
11
11
  remove: remove_1.remove,
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.query = void 0;
4
- const query = (params) => ({
4
+ var query = function (params) { return ({
5
5
  url: '/widgets',
6
6
  method: 'GET',
7
- params,
8
- });
7
+ params: params,
8
+ }); };
9
9
  exports.query = query;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.remove = void 0;
4
- const remove = (id) => ({
5
- url: `/widgets/${id}`,
4
+ var remove = function (id) { return ({
5
+ url: "/widgets/".concat(id),
6
6
  method: 'DELETE',
7
- });
7
+ }); };
8
8
  exports.remove = remove;
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.update = void 0;
4
- const update = ({ id, data }) => ({
5
- url: `/widgets/${id}`,
6
- method: 'PATCH',
7
- data,
8
- });
4
+ var update = function (_a) {
5
+ var id = _a.id, data = _a.data;
6
+ return ({
7
+ url: "/widgets/".concat(id),
8
+ method: 'PATCH',
9
+ data: data,
10
+ });
11
+ };
9
12
  exports.update = update;
@@ -0,0 +1,9 @@
1
+ import { WidgetOpenapiCertificateResponseObject } from '@escapenavigator/types/dist/widget-openapi/widget-openapi-certificate.ro';
2
+ import { WidgetOpenapiCreateCertificateDto } from '@escapenavigator/types/dist/widget-openapi/widget-openapi-create-certificate.dto';
3
+ import { ApiMethodDeclaration } from '..';
4
+ declare type ParamsData = {
5
+ data: WidgetOpenapiCreateCertificateDto;
6
+ };
7
+ declare type ResponseData = WidgetOpenapiCertificateResponseObject;
8
+ export declare const createCertificate: ApiMethodDeclaration<ParamsData, ResponseData>;
9
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createCertificate = void 0;
4
+ var createCertificate = function (_a) {
5
+ var data = _a.data;
6
+ return ({
7
+ url: "/widget/openapi/certificate",
8
+ method: 'POST',
9
+ data: data
10
+ });
11
+ };
12
+ exports.createCertificate = createCertificate;
@@ -0,0 +1,9 @@
1
+ import { WidgetOpenapiOrderResponseObject } from '@escapenavigator/types/dist/widget-openapi/widget-openapi-order.ro';
2
+ import { WidgetOpenapiCreateOrderDto } from '@escapenavigator/types/dist/widget-openapi/widget-openapi-create-order.dto';
3
+ import { ApiMethodDeclaration } from '..';
4
+ declare type ParamsData = {
5
+ data: WidgetOpenapiCreateOrderDto;
6
+ };
7
+ declare type ResponseData = WidgetOpenapiOrderResponseObject;
8
+ export declare const createOrder: ApiMethodDeclaration<ParamsData, ResponseData>;
9
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createOrder = void 0;
4
+ var createOrder = function (_a) {
5
+ var data = _a.data;
6
+ return ({
7
+ url: "/widget/openapi/order",
8
+ method: 'POST',
9
+ data: data
10
+ });
11
+ };
12
+ exports.createOrder = createOrder;
@@ -0,0 +1,6 @@
1
+ import { WidgetOpenapiFindedCertificateResponseObject } from '@escapenavigator/types/dist/widget-openapi/widget-openapi-finded-certificate.ro';
2
+ import { ApiMethodDeclaration } from '..';
3
+ declare type ParamsData = string;
4
+ declare type ResponseData = WidgetOpenapiFindedCertificateResponseObject;
5
+ export declare const findCertificate: ApiMethodDeclaration<ParamsData, ResponseData>;
6
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findCertificate = void 0;
4
+ var findCertificate = function (code) { return ({
5
+ url: "/widget/openapi/certificate/" + code,
6
+ method: 'GET'
7
+ }); };
8
+ exports.findCertificate = findCertificate;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getWidgetInfo = void 0;
4
- const getWidgetInfo = (uid) => ({
5
- url: `/widget/openapi/info/${uid}`,
4
+ var getWidgetInfo = function (uid) { return ({
5
+ url: "/widget/openapi/info/".concat(uid),
6
6
  method: 'GET',
7
- });
7
+ }); };
8
8
  exports.getWidgetInfo = getWidgetInfo;
@@ -1,10 +1,16 @@
1
1
  import { getWidgetInfo } from './get-widget-info';
2
2
  import { daily } from './widget-daily';
3
3
  import { weekly } from './widget-weekly';
4
+ import { createOrder } from './create-order';
5
+ import { createCertificate } from './create-certificate';
6
+ import { findCertificate } from './find-certificate';
4
7
  declare type ApiDeclaration = {
5
8
  getWidgetInfo: typeof getWidgetInfo;
6
9
  daily: typeof daily;
7
10
  weekly: typeof weekly;
11
+ createOrder: typeof createOrder;
12
+ createCertificate: typeof createCertificate;
13
+ findCertificate: typeof findCertificate;
8
14
  };
9
15
  export declare const widgetsOpenApiDeclaration: ApiDeclaration;
10
16
  export {};
@@ -1,11 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.widgetsOpenApiDeclaration = void 0;
4
- const get_widget_info_1 = require("./get-widget-info");
5
- const widget_daily_1 = require("./widget-daily");
6
- const widget_weekly_1 = require("./widget-weekly");
4
+ var get_widget_info_1 = require("./get-widget-info");
5
+ var widget_daily_1 = require("./widget-daily");
6
+ var widget_weekly_1 = require("./widget-weekly");
7
+ var create_order_1 = require("./create-order");
8
+ var create_certificate_1 = require("./create-certificate");
9
+ var find_certificate_1 = require("./find-certificate");
7
10
  exports.widgetsOpenApiDeclaration = {
8
11
  getWidgetInfo: get_widget_info_1.getWidgetInfo,
9
12
  daily: widget_daily_1.daily,
10
13
  weekly: widget_weekly_1.weekly,
14
+ createOrder: create_order_1.createOrder,
15
+ createCertificate: create_certificate_1.createCertificate,
16
+ findCertificate: find_certificate_1.findCertificate
11
17
  };
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.daily = void 0;
4
- const daily = (params) => ({
4
+ var daily = function (params) { return ({
5
5
  url: '/widget/openapi/daily',
6
6
  method: 'GET',
7
- params,
8
- });
7
+ params: params,
8
+ }); };
9
9
  exports.daily = daily;
@@ -1,7 +1,7 @@
1
1
  import { WidgetOpenapiScheduleQueryDto } from '@escapenavigator/types/dist/widget-openapi/widget-openapi-schedule-query.dto';
2
2
  import { WidgetOpenapiSlotResponseObject } from '@escapenavigator/types/dist/widget-openapi/widget-openapi-slot.ro';
3
3
  import { ApiMethodDeclaration } from '..';
4
- declare type ParamsData = WidgetOpenapiSlotResponseObject;
5
- declare type ResponseData = WidgetOpenapiScheduleQueryDto[];
4
+ declare type ParamsData = WidgetOpenapiScheduleQueryDto;
5
+ declare type ResponseData = WidgetOpenapiSlotResponseObject[];
6
6
  export declare const weekly: ApiMethodDeclaration<ParamsData, ResponseData>;
7
7
  export {};
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.weekly = void 0;
4
- const weekly = (params) => ({
4
+ var weekly = function (params) { return ({
5
5
  url: '/widget/openapi/weekly',
6
6
  method: 'GET',
7
- params,
8
- });
7
+ params: params,
8
+ }); };
9
9
  exports.weekly = weekly;
@@ -1,22 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fetchFailure = exports.fetchSuccess = exports.fetchStart = void 0;
4
- const api_1 = require("../types/api");
5
- const fetchStart = () => ({
4
+ var api_1 = require("../types/api");
5
+ var fetchStart = function () { return ({
6
6
  type: api_1.ActionTypes.FETCH_START,
7
- });
7
+ }); };
8
8
  exports.fetchStart = fetchStart;
9
- const fetchSuccess = (response) => ({
9
+ var fetchSuccess = function (response) { return ({
10
10
  type: api_1.ActionTypes.FETCH_SUCCESS,
11
11
  payload: {
12
- response,
12
+ response: response,
13
13
  },
14
- });
14
+ }); };
15
15
  exports.fetchSuccess = fetchSuccess;
16
- const fetchFailure = (error) => ({
16
+ var fetchFailure = function (error) { return ({
17
17
  type: api_1.ActionTypes.FETCH_FAILURE,
18
18
  payload: {
19
- error,
19
+ error: error,
20
20
  },
21
- });
21
+ }); };
22
22
  exports.fetchFailure = fetchFailure;
@@ -8,60 +8,100 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
11
38
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
39
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
40
  };
14
41
  Object.defineProperty(exports, "__esModule", { value: true });
15
42
  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 = (0, react_1.useRef)(false);
23
- const source = (0, react_1.useRef)(null);
24
- const [state, dispatch] = (0, react_1.useReducer)(api_2.apiReducer, api_2.initialState);
25
- const fetch = (0, 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((0, 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((0, api_1.fetchSuccess)(response));
37
- }, delta);
38
- }
39
- catch (error) {
40
- if (!mounted.current)
41
- return;
42
- const err = (0, get_service_error_1.getServiceError)(error);
43
- if (errorCallback)
44
- errorCallback(err);
45
- dispatch((0, api_1.fetchFailure)(err));
46
- throw error;
47
- }
48
- }), [api, successCallback, errorCallback, delay]);
49
- (0, react_1.useEffect)(() => {
43
+ var react_1 = require("react");
44
+ var axios_1 = __importDefault(require("axios"));
45
+ var get_service_error_1 = require("../../utils/get-service-error");
46
+ var api_1 = require("./actions/creators/api");
47
+ var api_2 = require("./reducers/api");
48
+ var useApiMethod = function (_a) {
49
+ var _b;
50
+ var api = _a.api, successCallback = _a.successCallback, errorCallback = _a.errorCallback, delay = _a.delay;
51
+ var mounted = (0, react_1.useRef)(false);
52
+ var source = (0, react_1.useRef)(null);
53
+ var _c = (0, react_1.useReducer)(api_2.apiReducer, api_2.initialState), state = _c[0], dispatch = _c[1];
54
+ var fetch = (0, react_1.useCallback)(function (params) { return __awaiter(void 0, void 0, void 0, function () {
55
+ var startTime, response_1, deltaTime, delta, error_1, err;
56
+ return __generator(this, function (_a) {
57
+ switch (_a.label) {
58
+ case 0:
59
+ source.current = axios_1.default.CancelToken.source();
60
+ startTime = Date.now();
61
+ _a.label = 1;
62
+ case 1:
63
+ _a.trys.push([1, 3, , 4]);
64
+ dispatch((0, api_1.fetchStart)());
65
+ return [4 /*yield*/, api(params)];
66
+ case 2:
67
+ response_1 = _a.sent();
68
+ deltaTime = Date.now() - startTime;
69
+ delta = delay && deltaTime < delay ? 500 - deltaTime : 0;
70
+ setTimeout(function () {
71
+ if (successCallback)
72
+ successCallback(response_1);
73
+ dispatch((0, api_1.fetchSuccess)(response_1));
74
+ }, delta);
75
+ return [3 /*break*/, 4];
76
+ case 3:
77
+ error_1 = _a.sent();
78
+ if (!mounted.current)
79
+ return [2 /*return*/];
80
+ err = (0, get_service_error_1.getServiceError)(error_1);
81
+ if (errorCallback)
82
+ errorCallback(err);
83
+ dispatch((0, api_1.fetchFailure)(err));
84
+ throw error_1;
85
+ case 4: return [2 /*return*/];
86
+ }
87
+ });
88
+ }); }, [api, successCallback, errorCallback, delay]);
89
+ (0, react_1.useEffect)(function () {
50
90
  mounted.current = true;
51
- return () => {
91
+ return function () {
52
92
  var _a;
53
93
  mounted.current = false;
54
94
  (_a = source.current) === null || _a === void 0 ? void 0 : _a.cancel();
55
95
  };
56
96
  }, [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
- };
97
+ var name = api.displayName;
98
+ var res = (_b = {},
99
+ _b["".concat(name, "Fetch")] = fetch,
100
+ _b["".concat(name, "Data")] = state.data,
101
+ _b["".concat(name, "Loading")] = state.loading,
102
+ _b["".concat(name, "Error")] = state.error,
103
+ _b["".concat(name, "StatusOk")] = state.statusOk,
104
+ _b);
65
105
  return res;
66
106
  };
67
107
  exports.useApiMethod = useApiMethod;
@@ -1,7 +1,18 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.apiReducer = exports.initialState = void 0;
4
- const api_1 = require("../actions/types/api");
15
+ var api_1 = require("../actions/types/api");
5
16
  exports.initialState = {
6
17
  data: null,
7
18
  loading: false,
@@ -9,14 +20,15 @@ exports.initialState = {
9
20
  response: null,
10
21
  statusOk: null,
11
22
  };
12
- const apiReducer = (state = exports.initialState, action) => {
23
+ var apiReducer = function (state, action) {
24
+ if (state === void 0) { state = exports.initialState; }
13
25
  switch (action.type) {
14
26
  case api_1.ActionTypes.FETCH_START:
15
- return Object.assign(Object.assign({}, exports.initialState), { loading: true });
27
+ return __assign(__assign({}, exports.initialState), { loading: true });
16
28
  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 });
29
+ return __assign(__assign({}, state), { loading: false, data: action.payload.response.data, response: action.payload.response, statusOk: true });
18
30
  case api_1.ActionTypes.FETCH_FAILURE:
19
- return Object.assign(Object.assign({}, state), { loading: false, error: action.payload.error, statusOk: false });
31
+ return __assign(__assign({}, state), { loading: false, error: action.payload.error, statusOk: false });
20
32
  default:
21
33
  return state;
22
34
  }
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convertToOptions = void 0;
4
- const convertToOptions = (data, field) => data.map((item) => ({
4
+ var convertToOptions = function (data, field) { return data.map(function (item) { return ({
5
5
  key: item.id,
6
- content: (field && item[field]) || item.title || item.name,
7
- }));
6
+ content: (field && item[field]) || item.title || item.surname ? "".concat(item.name, " ").concat(item.surname) : item.name,
7
+ }); }); };
8
8
  exports.convertToOptions = convertToOptions;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defineStatusForOrder = exports.defineStatusForCertificate = void 0;
4
- const defineStatusForCertificate = (t) => ({
4
+ var defineStatusForCertificate = function (t) { return ({
5
5
  new: {
6
6
  view: 'accent',
7
7
  text: t('statusComponent.new'),
@@ -26,9 +26,9 @@ const defineStatusForCertificate = (t) => ({
26
26
  view: 'negative',
27
27
  text: t('statusComponent.expired'),
28
28
  },
29
- });
29
+ }); };
30
30
  exports.defineStatusForCertificate = defineStatusForCertificate;
31
- const defineStatusForOrder = (t) => ({
31
+ var defineStatusForOrder = function (t) { return ({
32
32
  new: {
33
33
  view: 'accent',
34
34
  text: t('statusComponent.new'),
@@ -53,5 +53,5 @@ const defineStatusForOrder = (t) => ({
53
53
  view: 'negative',
54
54
  text: t('statusComponent.failed_payment'),
55
55
  },
56
- });
56
+ }); };
57
57
  exports.defineStatusForOrder = defineStatusForOrder;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.enumToOptions = void 0;
4
- const enumToOptions = (options, t, modelName) => Object.values(options).map((option) => ({
4
+ var enumToOptions = function (options, t, modelName) { return Object.values(options).map(function (option) { return ({
5
5
  key: option,
6
- content: t(`options.${modelName}.${option}`),
7
- }));
6
+ content: t("options.".concat(modelName, ".").concat(option)),
7
+ }); }); };
8
8
  exports.enumToOptions = enumToOptions;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getHandledErrorMessage = void 0;
4
- const getHandledErrorMessage = (error) => (error.response ? error.response.data.message : error.message);
4
+ var getHandledErrorMessage = function (error) { return (error.response ? error.response.data.message : error.message); };
5
5
  exports.getHandledErrorMessage = getHandledErrorMessage;