@zauru-sdk/services 1.0.44 → 1.0.46

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 (70) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +3 -3
  3. package/dist/common.server.d.ts +0 -55
  4. package/dist/common.server.js +0 -222
  5. package/dist/sessions/sessions.server.d.ts +0 -2
  6. package/dist/sessions/sessions.server.js +0 -13
  7. package/dist/sessions/upstash.server.d.ts +0 -1
  8. package/dist/sessions/upstash.server.js +0 -52
  9. package/dist/zauru/httpGraphQL.server.d.ts +0 -2
  10. package/dist/zauru/httpGraphQL.server.js +0 -37
  11. package/dist/zauru/httpOauth.server.d.ts +0 -2
  12. package/dist/zauru/httpOauth.server.js +0 -37
  13. package/dist/zauru/httpZauru.server.d.ts +0 -2
  14. package/dist/zauru/httpZauru.server.js +0 -37
  15. package/dist/zauru/zauru-agencies.server.d.ts +0 -8
  16. package/dist/zauru/zauru-agencies.server.js +0 -20
  17. package/dist/zauru/zauru-automatic-numbers.server.d.ts +0 -8
  18. package/dist/zauru/zauru-automatic-numbers.server.js +0 -21
  19. package/dist/zauru/zauru-bookings.server.d.ts +0 -28
  20. package/dist/zauru/zauru-bookings.server.js +0 -80
  21. package/dist/zauru/zauru-bundles.server.d.ts +0 -28
  22. package/dist/zauru/zauru-bundles.server.js +0 -93
  23. package/dist/zauru/zauru-cases.server.d.ts +0 -6
  24. package/dist/zauru/zauru-cases.server.js +0 -23
  25. package/dist/zauru/zauru-consolidated.server.d.ts +0 -36
  26. package/dist/zauru/zauru-consolidated.server.js +0 -71
  27. package/dist/zauru/zauru-currencies.server.d.ts +0 -6
  28. package/dist/zauru/zauru-currencies.server.js +0 -20
  29. package/dist/zauru/zauru-deliveries.server.d.ts +0 -22
  30. package/dist/zauru/zauru-deliveries.server.js +0 -44
  31. package/dist/zauru/zauru-discharges.server.d.ts +0 -26
  32. package/dist/zauru/zauru-discharges.server.js +0 -46
  33. package/dist/zauru/zauru-employees.server.d.ts +0 -6
  34. package/dist/zauru/zauru-employees.server.js +0 -23
  35. package/dist/zauru/zauru-forms.server.d.ts +0 -96
  36. package/dist/zauru/zauru-forms.server.js +0 -343
  37. package/dist/zauru/zauru-invoices.server.d.ts +0 -26
  38. package/dist/zauru/zauru-invoices.server.js +0 -94
  39. package/dist/zauru/zauru-items.server.d.ts +0 -97
  40. package/dist/zauru/zauru-items.server.js +0 -272
  41. package/dist/zauru/zauru-lote-record.server.d.ts +0 -8
  42. package/dist/zauru/zauru-lote-record.server.js +0 -26
  43. package/dist/zauru/zauru-lotes.server.d.ts +0 -91
  44. package/dist/zauru/zauru-lotes.server.js +0 -294
  45. package/dist/zauru/zauru-motivos-rechazo.server.d.ts +0 -9
  46. package/dist/zauru/zauru-motivos-rechazo.server.js +0 -49
  47. package/dist/zauru/zauru-payees.server.d.ts +0 -97
  48. package/dist/zauru/zauru-payees.server.js +0 -227
  49. package/dist/zauru/zauru-payment-terms.server.d.ts +0 -20
  50. package/dist/zauru/zauru-payment-terms.server.js +0 -65
  51. package/dist/zauru/zauru-price-lists.server.d.ts +0 -22
  52. package/dist/zauru/zauru-price-lists.server.js +0 -40
  53. package/dist/zauru/zauru-profiles.server.d.ts +0 -28
  54. package/dist/zauru/zauru-profiles.server.js +0 -69
  55. package/dist/zauru/zauru-purchase-orders.server.d.ts +0 -160
  56. package/dist/zauru/zauru-purchase-orders.server.js +0 -414
  57. package/dist/zauru/zauru-receptions.server.d.ts +0 -33
  58. package/dist/zauru/zauru-receptions.server.js +0 -94
  59. package/dist/zauru/zauru-shipments.server.d.ts +0 -20
  60. package/dist/zauru/zauru-shipments.server.js +0 -53
  61. package/dist/zauru/zauru-suggested-prices.server.d.ts +0 -31
  62. package/dist/zauru/zauru-suggested-prices.server.js +0 -84
  63. package/dist/zauru/zauru-tags.server.d.ts +0 -7
  64. package/dist/zauru/zauru-tags.server.js +0 -13
  65. package/dist/zauru/zauru-templates.server.d.ts +0 -7
  66. package/dist/zauru/zauru-templates.server.js +0 -15
  67. package/dist/zauru/zauru-variables.server.d.ts +0 -14
  68. package/dist/zauru/zauru-variables.server.js +0 -48
  69. package/dist/zauru/zauru-web-app-tables.server.d.ts +0 -55
  70. package/dist/zauru/zauru-web-app-tables.server.js +0 -154
@@ -1,9 +0,0 @@
1
- import type { Session } from "@remix-run/node";
2
- import { AxiosUtilsResponse, MotivoRechazo, RegisterMotivosRechazoBody, WebAppRowGraphQL, WebAppTableUpdateResponse } from "@zauru-sdk/types";
3
- export declare function getMotivosRechazo(headers: any, session: Session): Promise<AxiosUtilsResponse<WebAppRowGraphQL<MotivoRechazo>[]>>;
4
- export declare function deleteMotivosRechazo(headers: any, session: Session, id: number): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
5
- export declare function createMotivoRechazo(headers: any, session: Session, body: MotivoRechazo): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
6
- export declare function updateMotivosRechazo(headers: any, session: Session, id: number): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
7
- export declare function saveMotivosDeRechazoByPurchase(headers: any, session: Session, body: RegisterMotivosRechazoBody, extraBody: {
8
- temp_purchase_order_id: string;
9
- }): Promise<AxiosUtilsResponse<any>>;
@@ -1,49 +0,0 @@
1
- import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
- import { getVariablesByName } from "../common.server.js";
3
- import { createWebAppTableRegister, deleteWebAppTableRegister, getWebAppTableRegisters, } from "./zauru-web-app-tables.server.js";
4
- export async function getMotivosRechazo(headers, session) {
5
- return handlePossibleAxiosErrors(async () => {
6
- const { recepciones_rejection_types_webapp_table_id } = await getVariablesByName(headers, session, [
7
- "recepciones_rejection_types_webapp_table_id",
8
- ]);
9
- const response = await getWebAppTableRegisters(session, recepciones_rejection_types_webapp_table_id);
10
- if (response.error || !response.data) {
11
- throw new Error(response.userMsg);
12
- }
13
- return response?.data;
14
- });
15
- }
16
- export async function deleteMotivosRechazo(headers, session, id) {
17
- return handlePossibleAxiosErrors(async () => {
18
- const { recepciones_rejection_types_webapp_table_id } = await getVariablesByName(headers, session, [
19
- "recepciones_rejection_types_webapp_table_id",
20
- ]);
21
- const response = await deleteWebAppTableRegister(headers, recepciones_rejection_types_webapp_table_id, id);
22
- return response;
23
- });
24
- }
25
- export async function createMotivoRechazo(headers, session, body) {
26
- return handlePossibleAxiosErrors(async () => {
27
- const { recepciones_rejection_types_webapp_table_id } = await getVariablesByName(headers, session, [
28
- "recepciones_rejection_types_webapp_table_id",
29
- ]);
30
- const response = await createWebAppTableRegister(headers, recepciones_rejection_types_webapp_table_id, body);
31
- return response;
32
- });
33
- }
34
- export async function updateMotivosRechazo(headers, session, id) {
35
- return handlePossibleAxiosErrors(async () => {
36
- const { recepciones_rejection_types_webapp_table_id } = await getVariablesByName(headers, session, [
37
- "recepciones_rejection_types_webapp_table_id",
38
- ]);
39
- const response = await deleteWebAppTableRegister(headers, recepciones_rejection_types_webapp_table_id, id);
40
- return response;
41
- });
42
- }
43
- export async function saveMotivosDeRechazoByPurchase(headers, session, body, extraBody) {
44
- return handlePossibleAxiosErrors(async () => {
45
- const { qc_rejections_webapp_table_id } = await getVariablesByName(headers, session, ["qc_rejections_webapp_table_id"]);
46
- const response = await createWebAppTableRegister(headers, qc_rejections_webapp_table_id, body, extraBody);
47
- return response.data;
48
- });
49
- }
@@ -1,97 +0,0 @@
1
- import type { Session } from "@remix-run/node";
2
- import { AxiosUtilsResponse, PayeeCategoryGraphQL, PayeeGraphQL } from "@zauru-sdk/types";
3
- /**
4
- * getPayees
5
- * @param headers
6
- * @returns
7
- */
8
- export declare function getPayees(session: Session): Promise<AxiosUtilsResponse<PayeeGraphQL[]>>;
9
- /**
10
- * getProviders
11
- * @param headers
12
- * @returns
13
- */
14
- export declare function getProviders(session: Session): Promise<AxiosUtilsResponse<PayeeGraphQL[]>>;
15
- /**
16
- * getPayee
17
- * @param session
18
- * @param id
19
- */
20
- export declare function getPayee(session: Session, id: number | string): Promise<AxiosUtilsResponse<PayeeGraphQL | undefined>>;
21
- /**
22
- * getPayeesByCategoryId
23
- * @param session
24
- * @param categoryId
25
- * @returns
26
- */
27
- export declare function getPayeesByCategoryId(session: Session, id: number | string): Promise<AxiosUtilsResponse<PayeeGraphQL[]>>;
28
- /**
29
- * getPayeeCategoriesByNotesMatch
30
- * @param session
31
- * @param match
32
- * @returns
33
- */
34
- export declare function getPayeeCategoriesByNotesMatch(session: Session, match: string): Promise<AxiosUtilsResponse<PayeeCategoryGraphQL[]>>;
35
- /**
36
- * getPayeeCategories
37
- * @param session
38
- * @param match
39
- * @returns
40
- */
41
- export declare function getPayeeCategories(session: Session): Promise<AxiosUtilsResponse<PayeeCategoryGraphQL[]>>;
42
- /**
43
- * getProviderCategories
44
- * @param session
45
- * @param match
46
- * @returns
47
- */
48
- export declare function getProviderCategories(session: Session): Promise<AxiosUtilsResponse<PayeeCategoryGraphQL[]>>;
49
- /**
50
- * getProviderCategories
51
- * @param session
52
- * @param match
53
- * @returns
54
- */
55
- export declare function getClientCategories(session: Session): Promise<AxiosUtilsResponse<PayeeCategoryGraphQL[]>>;
56
- /**
57
- * createPayee
58
- * @param session
59
- * @param headers
60
- * @returns
61
- */
62
- export declare function createPayee(headers: any, body: Partial<PayeeGraphQL>): Promise<AxiosUtilsResponse<boolean>>;
63
- /**
64
- * deletePayee
65
- * @param headers
66
- * @param id
67
- * @returns
68
- */
69
- export declare function deletePayee(headers: any, id: string | number): Promise<AxiosUtilsResponse<boolean>>;
70
- /**
71
- * updatePayee
72
- * @param session
73
- * @param headers
74
- * @returns
75
- */
76
- export declare function updatePayee(headers: any, body: Partial<PayeeGraphQL>): Promise<AxiosUtilsResponse<boolean>>;
77
- /**
78
- * createPayeeCategory
79
- * @param session
80
- * @param headers
81
- * @returns
82
- */
83
- export declare function createPayeeCategory(headers: any, body: Partial<PayeeCategoryGraphQL>): Promise<AxiosUtilsResponse<PayeeCategoryGraphQL>>;
84
- /**
85
- * updatePayeeCategory
86
- * @param session
87
- * @param headers
88
- * @returns
89
- */
90
- export declare function updatePayeeCategory(headers: any, body: Partial<PayeeCategoryGraphQL>): Promise<AxiosUtilsResponse<boolean>>;
91
- /**
92
- * deletePayeeCategory
93
- * @param headers
94
- * @param id
95
- * @returns
96
- */
97
- export declare function deletePayeeCategory(headers: any, id: string | number): Promise<AxiosUtilsResponse<boolean>>;
@@ -1,227 +0,0 @@
1
- import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
- import httpGraphQLAPI from "./httpGraphQL.server.js";
3
- import { getGraphQLAPIHeaders } from "../common.server.js";
4
- import { getClientCategoriesStringQuery, getPayeeByIdStringQuery, getPayeeCategoriesByNotesMatchStringQuery, getPayeeCategoriesStringQuery, getPayeeCategoryByIdStringQuery, getPayeesStringQuery, getProviderCategoriesStringQuery, getProvidersStringQuery, } from "@zauru-sdk/graphql";
5
- import httpZauru from "./httpZauru.server.js";
6
- /**
7
- * getPayees
8
- * @param headers
9
- * @returns
10
- */
11
- export async function getPayees(session) {
12
- return handlePossibleAxiosErrors(async () => {
13
- const headers = await getGraphQLAPIHeaders(session);
14
- const response = await httpGraphQLAPI.post(``, {
15
- query: getPayeesStringQuery,
16
- }, {
17
- headers,
18
- });
19
- return response.data?.data.payees;
20
- });
21
- }
22
- /**
23
- * getProviders
24
- * @param headers
25
- * @returns
26
- */
27
- export async function getProviders(session) {
28
- return handlePossibleAxiosErrors(async () => {
29
- const headers = await getGraphQLAPIHeaders(session);
30
- const response = await httpGraphQLAPI.post(``, {
31
- query: getProvidersStringQuery,
32
- }, {
33
- headers,
34
- });
35
- return response.data?.data.payees;
36
- });
37
- }
38
- /**
39
- * getPayee
40
- * @param session
41
- * @param id
42
- */
43
- export async function getPayee(session, id) {
44
- return handlePossibleAxiosErrors(async () => {
45
- const headers = await getGraphQLAPIHeaders(session);
46
- const responsePayee = await httpGraphQLAPI.post("", {
47
- query: getPayeeByIdStringQuery,
48
- variables: {
49
- id,
50
- },
51
- }, { headers });
52
- if (!responsePayee?.data?.data?.payees[0]) {
53
- throw new Error("No se encontró el beneficiario indicado");
54
- }
55
- return responsePayee?.data?.data?.payees[0];
56
- });
57
- }
58
- /**
59
- * getPayeesByCategoryId
60
- * @param session
61
- * @param categoryId
62
- * @returns
63
- */
64
- export async function getPayeesByCategoryId(session, id) {
65
- return handlePossibleAxiosErrors(async () => {
66
- const headers = await getGraphQLAPIHeaders(session);
67
- const response = await httpGraphQLAPI.post(``, {
68
- query: getPayeeCategoryByIdStringQuery,
69
- variables: { id },
70
- }, { headers });
71
- if (response.data.errors) {
72
- throw new Error(response.data.errors.map((x) => x.message).join(";"));
73
- }
74
- if (!response?.data?.data?.payee_categories[0]) {
75
- return [];
76
- }
77
- return response.data?.data?.payee_categories[0]?.payees;
78
- });
79
- }
80
- /**
81
- * getPayeeCategoriesByNotesMatch
82
- * @param session
83
- * @param match
84
- * @returns
85
- */
86
- export async function getPayeeCategoriesByNotesMatch(session, match) {
87
- return handlePossibleAxiosErrors(async () => {
88
- const headers = await getGraphQLAPIHeaders(session);
89
- const response = await httpGraphQLAPI.post(``, {
90
- query: getPayeeCategoriesByNotesMatchStringQuery(match),
91
- }, { headers });
92
- if (response.data.errors) {
93
- throw new Error(response.data.errors.map((x) => x.message).join(";"));
94
- }
95
- return response.data?.data?.payee_categories;
96
- });
97
- }
98
- /**
99
- * getPayeeCategories
100
- * @param session
101
- * @param match
102
- * @returns
103
- */
104
- export async function getPayeeCategories(session) {
105
- return handlePossibleAxiosErrors(async () => {
106
- const headers = await getGraphQLAPIHeaders(session);
107
- const response = await httpGraphQLAPI.post(``, {
108
- query: getPayeeCategoriesStringQuery,
109
- }, { headers });
110
- if (response.data.errors) {
111
- throw new Error(response.data.errors.map((x) => x.message).join(";"));
112
- }
113
- return response.data?.data?.payee_categories;
114
- });
115
- }
116
- /**
117
- * getProviderCategories
118
- * @param session
119
- * @param match
120
- * @returns
121
- */
122
- export async function getProviderCategories(session) {
123
- return handlePossibleAxiosErrors(async () => {
124
- const headers = await getGraphQLAPIHeaders(session);
125
- const response = await httpGraphQLAPI.post(``, {
126
- query: getProviderCategoriesStringQuery,
127
- }, { headers });
128
- if (response.data.errors) {
129
- throw new Error(response.data.errors.map((x) => x.message).join(";"));
130
- }
131
- return response.data?.data?.payee_categories;
132
- });
133
- }
134
- /**
135
- * getProviderCategories
136
- * @param session
137
- * @param match
138
- * @returns
139
- */
140
- export async function getClientCategories(session) {
141
- return handlePossibleAxiosErrors(async () => {
142
- const headers = await getGraphQLAPIHeaders(session);
143
- const response = await httpGraphQLAPI.post(``, {
144
- query: getClientCategoriesStringQuery,
145
- }, { headers });
146
- if (response.data.errors) {
147
- throw new Error(response.data.errors.map((x) => x.message).join(";"));
148
- }
149
- return response.data?.data?.payee_categories;
150
- });
151
- }
152
- /**
153
- * createPayee
154
- * @param session
155
- * @param headers
156
- * @returns
157
- */
158
- export async function createPayee(headers, body) {
159
- return handlePossibleAxiosErrors(async () => {
160
- await httpZauru.post("/settings/payees", { payee: body }, { headers });
161
- return true;
162
- });
163
- }
164
- /**
165
- * deletePayee
166
- * @param headers
167
- * @param id
168
- * @returns
169
- */
170
- export async function deletePayee(headers, id) {
171
- return handlePossibleAxiosErrors(async () => {
172
- await httpZauru.delete(`/settings/payees/${id}?destroy=true`, {
173
- headers,
174
- });
175
- return true;
176
- });
177
- }
178
- /**
179
- * updatePayee
180
- * @param session
181
- * @param headers
182
- * @returns
183
- */
184
- export async function updatePayee(headers, body) {
185
- return handlePossibleAxiosErrors(async () => {
186
- await httpZauru.patch(`/settings/payees/${body.id}`, { payee: body }, { headers });
187
- return true;
188
- });
189
- }
190
- /**
191
- * createPayeeCategory
192
- * @param session
193
- * @param headers
194
- * @returns
195
- */
196
- export async function createPayeeCategory(headers, body) {
197
- return handlePossibleAxiosErrors(async () => {
198
- const response = await httpZauru.post("/settings/payees/payee_categories", { payee_category: body }, { headers });
199
- return response.data;
200
- });
201
- }
202
- /**
203
- * updatePayeeCategory
204
- * @param session
205
- * @param headers
206
- * @returns
207
- */
208
- export async function updatePayeeCategory(headers, body) {
209
- return handlePossibleAxiosErrors(async () => {
210
- await httpZauru.patch(`/settings/payees/payee_categories/${body.id}`, { payee_category: body }, { headers });
211
- return true;
212
- });
213
- }
214
- /**
215
- * deletePayeeCategory
216
- * @param headers
217
- * @param id
218
- * @returns
219
- */
220
- export async function deletePayeeCategory(headers, id) {
221
- return handlePossibleAxiosErrors(async () => {
222
- await httpZauru.delete(`/settings/payees/payee_categories/${id}?destroy=true`, {
223
- headers,
224
- });
225
- return true;
226
- });
227
- }
@@ -1,20 +0,0 @@
1
- import type { Session } from "@remix-run/node";
2
- import { AxiosUtilsResponse, PaymentTermGraphQL } from "@zauru-sdk/types";
3
- /**
4
- * getPaymentTerms
5
- */
6
- export declare function getPaymentTerms(session: Session): Promise<AxiosUtilsResponse<PaymentTermGraphQL[]>>;
7
- /**
8
- * getPaymentTermById
9
- */
10
- export declare function getPaymentTermById(session: Session, id: string | number): Promise<AxiosUtilsResponse<PaymentTermGraphQL>>;
11
- /**
12
- * createPaymentTerm
13
- * @param headers
14
- */
15
- export declare function createPaymentTerm(headers: any, payment_term: PaymentTermGraphQL): Promise<AxiosUtilsResponse<PaymentTermGraphQL>>;
16
- /**
17
- * updatePaymentTerm
18
- * @param headers
19
- */
20
- export declare function updatePaymentTerm(headers: any, payment_term: Partial<PaymentTermGraphQL> & any): Promise<AxiosUtilsResponse<PaymentTermGraphQL>>;
@@ -1,65 +0,0 @@
1
- import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
- import { getGraphQLAPIHeaders } from "../common.server.js";
3
- import httpGraphQLAPI from "./httpGraphQL.server.js";
4
- import { getPaymentTermByIdStringQuery, getPaymentTermsStringQuery, } from "@zauru-sdk/graphql";
5
- import httpZauru from "./httpZauru.server.js";
6
- /**
7
- * getPaymentTerms
8
- */
9
- export async function getPaymentTerms(session) {
10
- return handlePossibleAxiosErrors(async () => {
11
- const headers = await getGraphQLAPIHeaders(session);
12
- const response = await httpGraphQLAPI.post("", {
13
- query: getPaymentTermsStringQuery,
14
- }, { headers });
15
- if (response.data.errors) {
16
- throw new Error(response.data.errors.map((x) => x.message).join(";"));
17
- }
18
- const registers = response?.data?.data?.payment_terms;
19
- return registers;
20
- });
21
- }
22
- /**
23
- * getPaymentTermById
24
- */
25
- export async function getPaymentTermById(session, id) {
26
- return handlePossibleAxiosErrors(async () => {
27
- const headers = await getGraphQLAPIHeaders(session);
28
- const response = await httpGraphQLAPI.post("", {
29
- query: getPaymentTermByIdStringQuery,
30
- variables: { id },
31
- }, { headers });
32
- if (response.data.errors) {
33
- throw new Error(response.data.errors.map((x) => x.message).join(";"));
34
- }
35
- if (!response?.data?.data?.payment_terms[0]) {
36
- throw new Error("No se encontró ningún método de pago con este id: " + id);
37
- }
38
- const registers = response?.data?.data?.payment_terms[0] ?? [];
39
- return registers;
40
- });
41
- }
42
- /**
43
- * createPaymentTerm
44
- * @param headers
45
- */
46
- export async function createPaymentTerm(headers, payment_term) {
47
- return handlePossibleAxiosErrors(async () => {
48
- const response = await httpZauru.patch(`/sales/settings/payment_terms.json`, {
49
- payment_term,
50
- }, { headers });
51
- return response.data;
52
- });
53
- }
54
- /**
55
- * updatePaymentTerm
56
- * @param headers
57
- */
58
- export async function updatePaymentTerm(headers, payment_term) {
59
- return handlePossibleAxiosErrors(async () => {
60
- const response = await httpZauru.patch(`/sales/settings/payment_terms/${payment_term.id}.json`, {
61
- payment_term,
62
- }, { headers });
63
- return response.data;
64
- });
65
- }
@@ -1,22 +0,0 @@
1
- import { AxiosUtilsResponse, CreatePriceListBody, PriceListGraphQL } from "@zauru-sdk/types";
2
- /**
3
- * createPriceList
4
- * @param session
5
- * @param headers
6
- * @returns
7
- */
8
- export declare function createPriceList(headers: any, body: CreatePriceListBody): Promise<AxiosUtilsResponse<PriceListGraphQL>>;
9
- /**
10
- * deletePriceList
11
- * @param headers
12
- * @param id
13
- * @returns
14
- */
15
- export declare function deletePriceList(headers: any, id: string | number): Promise<AxiosUtilsResponse<boolean>>;
16
- /**
17
- * updatePriceList
18
- * @param session
19
- * @param headers
20
- * @returns
21
- */
22
- export declare function updatePriceList(headers: any, body: Partial<PriceListGraphQL>): Promise<AxiosUtilsResponse<boolean>>;
@@ -1,40 +0,0 @@
1
- import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
- import httpZauru from "./httpZauru.server.js";
3
- /**
4
- * createPriceList
5
- * @param session
6
- * @param headers
7
- * @returns
8
- */
9
- export async function createPriceList(headers, body) {
10
- return handlePossibleAxiosErrors(async () => {
11
- const response = await httpZauru.post("/sales/settings/price_lists", { price_list: body }, { headers });
12
- return response.data;
13
- });
14
- }
15
- /**
16
- * deletePriceList
17
- * @param headers
18
- * @param id
19
- * @returns
20
- */
21
- export async function deletePriceList(headers, id) {
22
- return handlePossibleAxiosErrors(async () => {
23
- await httpZauru.delete(`/sales/settings/price_lists/${id}?destroy=true`, {
24
- headers,
25
- });
26
- return true;
27
- });
28
- }
29
- /**
30
- * updatePriceList
31
- * @param session
32
- * @param headers
33
- * @returns
34
- */
35
- export async function updatePriceList(headers, body) {
36
- return handlePossibleAxiosErrors(async () => {
37
- await httpZauru.patch(`/sales/settings/price_lists/${body.id}`, { price_list: body }, { headers });
38
- return true;
39
- });
40
- }
@@ -1,28 +0,0 @@
1
- import type { Session } from "@remix-run/node";
2
- import { AgencyGraphQL, EmployeeGraphQL, OauthProfile, ProfileResponse, AxiosUtilsResponse } from "@zauru-sdk/types";
3
- /**
4
- * getOauthUserInfo
5
- * @param codeValue
6
- * @returns
7
- */
8
- export declare const getOauthUserInfo: (codeValue: string) => Promise<AxiosUtilsResponse<OauthProfile>>;
9
- /**
10
- *
11
- * @param employeeId
12
- * @param headers
13
- * @returns
14
- */
15
- export declare const getEmployeeInfo: (id: number, headers: any) => Promise<AxiosUtilsResponse<EmployeeGraphQL>>;
16
- /**
17
- * getProfileInformation
18
- * @param headers
19
- * @returns
20
- */
21
- export declare const getProfileInformation: (headers: any) => Promise<AxiosUtilsResponse<ProfileResponse>>;
22
- export declare const changeEntity: (headers: any, entityId: string) => Promise<any>;
23
- /**
24
- *
25
- * @param headers
26
- * @returns
27
- */
28
- export declare const getAgencyInfo: (headers: any, session: Session) => Promise<AxiosUtilsResponse<AgencyGraphQL>>;
@@ -1,69 +0,0 @@
1
- import httpZauru from "./httpZauru.server.js";
2
- import httpOauth from "./httpOauth.server.js";
3
- import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
4
- import { config } from "@zauru-sdk/config";
5
- /**
6
- * getOauthUserInfo
7
- * @param codeValue
8
- * @returns
9
- */
10
- export const getOauthUserInfo = async (codeValue) => {
11
- return handlePossibleAxiosErrors(async () => {
12
- const response = await httpOauth.get(`/api/userinfo`, {
13
- headers: {
14
- Authorization: `Bearer ${codeValue}`,
15
- },
16
- });
17
- return response.data;
18
- });
19
- };
20
- /**
21
- *
22
- * @param employeeId
23
- * @param headers
24
- * @returns
25
- */
26
- export const getEmployeeInfo = async (id, headers) => {
27
- return handlePossibleAxiosErrors(async () => {
28
- const employeeInfo = await httpZauru.get(`/settings/employees/${id}.json`, { headers });
29
- return employeeInfo.data;
30
- });
31
- };
32
- /**
33
- * getProfileInformation
34
- * @param headers
35
- * @returns
36
- */
37
- export const getProfileInformation = async (headers) => {
38
- return handlePossibleAxiosErrors(async () => {
39
- const response = await httpZauru.get(`/profile.json`, {
40
- headers,
41
- });
42
- return response.data;
43
- });
44
- };
45
- export const changeEntity = async (headers, entityId) => {
46
- const changeEntityFetch = await httpZauru.patch(`${config.zauruBaseURL}/company.json`, JSON.stringify({
47
- selected_entity_id: entityId,
48
- }), {
49
- headers,
50
- });
51
- return changeEntityFetch.data;
52
- };
53
- /**
54
- *
55
- * @param headers
56
- * @returns
57
- */
58
- export const getAgencyInfo = async (headers, session) => {
59
- return handlePossibleAxiosErrors(async () => {
60
- const agency_id = session.get("agency_id");
61
- if (!agency_id) {
62
- throw new Error("No hay una agencia asignada para este usuario... Contacte con su administrador.");
63
- }
64
- const response = await httpZauru.get(`/settings/agencies/${agency_id}.json`, {
65
- headers,
66
- });
67
- return response?.data;
68
- });
69
- };