@omniumretail/shared-resources 0.3.39 → 0.3.41

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.
@@ -0,0 +1,9 @@
1
+ import { UseQueryOptions } from "@tanstack/react-query";
2
+ import { VoucherTemplates, ResponseList } from "../../../interfaces";
3
+ export interface VoucherTemplatesQuery extends UseQueryOptions<ResponseList<"VoucherTemplates", VoucherTemplates>> {
4
+ page?: number;
5
+ records?: number;
6
+ sortBy?: string;
7
+ sortDirection?: string;
8
+ }
9
+ export declare const getVoucherTemplatesQueryHook: ({ page, records, sortBy, sortDirection, ...options }: VoucherTemplatesQuery) => import("@tanstack/react-query").UseQueryResult<ResponseList<"VoucherTemplates", VoucherTemplates>, unknown>;
@@ -0,0 +1,2 @@
1
+ import { CreateVoucherTemplatesPayload, VoucherTemplates } from '../../../interfaces';
2
+ export declare const postCreateVoucherTemplates: () => import("@tanstack/react-query").UseMutationResult<VoucherTemplates, unknown, CreateVoucherTemplatesPayload, unknown>;
@@ -0,0 +1,2 @@
1
+ import { VoucherTemplates } from "../../../interfaces";
2
+ export declare const useDisableVoucherTemplate: () => import("@tanstack/react-query").UseMutationResult<VoucherTemplates, unknown, VoucherTemplates, unknown>;
@@ -290,11 +290,14 @@ export * from "./BigWin/others/importABWGQuery.hook";
290
290
  export * from "./Acls/get/getVoucherLoyaltyQuery.hook";
291
291
  export * from "./Acls/get/getCustomersLoyaltyQuery.hook";
292
292
  export * from "./Acls/get/getVoucherSitooQuery.hook";
293
+ export * from "./Acls/get/getVoucherTemplatesQuery.hook";
293
294
  export * from "./Acls/mutate/postSaldoVoucherQuery.hook";
294
295
  export * from "./Acls/mutate/postSalesAssociationQuery.hook";
295
296
  export * from "./Acls/mutate/postVoucherSitooQuery.hook";
296
297
  export * from "./Acls/mutate/postVerificationEmailQuery.hook";
297
298
  export * from "./Acls/mutate/postVerificationUserQuery.hook";
299
+ export * from "./Acls/mutate/updateDisabledVoucherTemplates.hook";
300
+ export * from "./Acls/mutate/postCreateVoucherTemplates.hook";
298
301
  export * from "./OSUA/get/documentos/getGngDocumentos.hook";
299
302
  export * from "./OSUA/get/documentos/getSitooDocumentos.hook";
300
303
  export * from "./OSUA/get/vouchers/getGngVoucher.hook";
@@ -53,3 +53,26 @@ export interface CustomerAcul {
53
53
  AcceptsTermsAndConditions: boolean;
54
54
  Verified: boolean;
55
55
  }
56
+ export interface VoucherTemplates {
57
+ Id: string;
58
+ Name: string;
59
+ ShortDscId: string;
60
+ DiscountValue: number;
61
+ CoinExchange: string;
62
+ DurationInDays: number;
63
+ RulesTextId: string;
64
+ HowToTextId: string;
65
+ Status: string;
66
+ CreateDate: number;
67
+ UpdateDate: number;
68
+ }
69
+ export interface CreateVoucherTemplatesPayload {
70
+ Name: string;
71
+ Description: string;
72
+ DiscountValue: number;
73
+ CoinExchange: string;
74
+ ExpirationDays: number;
75
+ Rules: string;
76
+ HowTo: string;
77
+ Status: string;
78
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/shared-resources",
3
- "version": "0.3.39",
3
+ "version": "0.3.41",
4
4
  "private": false,
5
5
  "description": "Shared Components and services or utils to the frontend versions",
6
6
  "main": "dist/bundle.js",
package/src/a2ai.scss CHANGED
@@ -41,8 +41,11 @@ body.a2aiStyle {
41
41
  --color-orange: #A9D046;
42
42
  --color-orange-rgb: 169, 208, 70;
43
43
 
44
- --color-blue: #324A6D;
45
- --color-blue-rgb: 50, 74, 109;
44
+ --color-blue: #09168B;
45
+ --color-blue-rgb: 9, 22, 139;
46
+
47
+ --color-purple-blue: #324A6D;
48
+ --color-purple-blue-rgb: 50, 74, 109;
46
49
 
47
50
  --color-dark-blue: #1C244B;
48
51
  --color-dark-blue-rgb: 28, 36, 75;
@@ -99,7 +102,7 @@ body.a2aiStyle {
99
102
  --button-default-text-color: var(--color-white);
100
103
  --button-default-background-hover-color: rgba(var(--color-orange-rgb), .9);
101
104
  --button-default-text-hover-color: var(--color-white);
102
- --button-default-background-focus-color: var(--color-grey-dark);
105
+ --button-default-background-focus-color: var(--color-orange-rgb);
103
106
  --button-default-text-focus-color: rgba(var(--color-white-rgb), .8);
104
107
 
105
108
  // Button Style 1
@@ -111,7 +114,7 @@ body.a2aiStyle {
111
114
  --button-style-1-text-focus-color: rgba(var(--color-white-rgb), .8);
112
115
 
113
116
  // Button Disabled
114
- --button-disabled-background-color: var(--color-grey-dark);
117
+ --button-disabled-background-color: var(--color-grey);
115
118
  --button-disabled-default-text-color: var(--color-white);
116
119
 
117
120
  // Link
@@ -0,0 +1,29 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { VoucherTemplates, ResponseList } from "../../../interfaces";
3
+ import { getAuth0 } from "../../../services/ApiService";
4
+
5
+ export interface VoucherTemplatesQuery extends UseQueryOptions<ResponseList<"VoucherTemplates", VoucherTemplates>> {
6
+ page?: number;
7
+ records?: number;
8
+ sortBy?: string;
9
+ sortDirection?: string;
10
+
11
+ }
12
+
13
+ export const getVoucherTemplatesQueryHook = ({ page, records, sortBy, sortDirection, ...options}: VoucherTemplatesQuery) => {
14
+ return useQuery(
15
+ ['CONFIG_VOUCHER_TEMPLATES', page, records, sortBy, sortDirection],
16
+ () => getAuth0<ResponseList<"VoucherTemplates", VoucherTemplates>>(`/ACUL/VoucherTemplates`, {
17
+ pPage: page || 1,
18
+ pSortField: sortBy || "Name",
19
+ pSortOrder: sortDirection || "asc",
20
+ pRecords: records || 50,
21
+
22
+ }),
23
+ {
24
+ keepPreviousData: true,
25
+ retry: false,
26
+ ...options
27
+ }
28
+ );
29
+ }
@@ -0,0 +1,19 @@
1
+
2
+ import { useMutation, useQueryClient } from '@tanstack/react-query'
3
+ import { post } from '../../../services/ApiService'
4
+ import { CreateVoucherTemplatesPayload, VoucherTemplates } from '../../../interfaces'
5
+
6
+ export const postCreateVoucherTemplates = () => {
7
+ const queryClient = useQueryClient()
8
+
9
+ return useMutation<VoucherTemplates, unknown, CreateVoucherTemplatesPayload>(
10
+ (data) =>
11
+ post<VoucherTemplates>('/ACUL/VoucherTemplates', data),
12
+ {
13
+ onSuccess: (newTemplate) => {
14
+ // Invalida a lista de templates para refetch
15
+ queryClient.invalidateQueries(['CONFIG_VOUCHER_TEMPLATES'])
16
+ },
17
+ }
18
+ )
19
+ }
@@ -0,0 +1,25 @@
1
+ // src/hooks/vouchers/useDisableVoucherTemplate.hook.ts
2
+
3
+ import { useMutation, useQueryClient } from "@tanstack/react-query"
4
+ import { putWithParameters } from "../../../services/ApiService"
5
+ import { VoucherTemplates } from "../../../interfaces"
6
+
7
+ export const useDisableVoucherTemplate = () => {
8
+ const queryClient = useQueryClient()
9
+
10
+ return useMutation<VoucherTemplates, unknown, VoucherTemplates>(
11
+ (data: VoucherTemplates) =>
12
+ putWithParameters<VoucherTemplates>(
13
+ `/ACUL/VoucherTemplates/Disable?`,
14
+ {
15
+ pVoucherTemplateId: data.Id,
16
+ }
17
+ ),
18
+ {
19
+ onSuccess: () => {
20
+ // invalida a lista para refetch
21
+ queryClient.invalidateQueries(["CONFIG_VOUCHER_TEMPLATES"])
22
+ },
23
+ }
24
+ )
25
+ }
@@ -14,7 +14,7 @@ export const updateErrorHistory = () => {
14
14
  pMessage: data.ErrorMessage,
15
15
  pDate: data.CreateDate,
16
16
 
17
- });
17
+ }, {});
18
18
  },
19
19
  {
20
20
  onSuccess: (data: ErrorHistoryItem) => {
@@ -334,11 +334,14 @@ export * from "./BigWin/others/importABWGQuery.hook";
334
334
  export * from "./Acls/get/getVoucherLoyaltyQuery.hook";
335
335
  export * from "./Acls/get/getCustomersLoyaltyQuery.hook";
336
336
  export * from "./Acls/get/getVoucherSitooQuery.hook";
337
+ export * from "./Acls/get/getVoucherTemplatesQuery.hook";
337
338
  export * from "./Acls/mutate/postSaldoVoucherQuery.hook";
338
339
  export * from "./Acls/mutate/postSalesAssociationQuery.hook";
339
340
  export * from "./Acls/mutate/postVoucherSitooQuery.hook";
340
341
  export * from "./Acls/mutate/postVerificationEmailQuery.hook";
341
342
  export * from "./Acls/mutate/postVerificationUserQuery.hook";
343
+ export * from "./Acls/mutate/updateDisabledVoucherTemplates.hook";
344
+ export * from "./Acls/mutate/postCreateVoucherTemplates.hook";
342
345
 
343
346
  //OSUA
344
347
  export * from "./OSUA/get/documentos/getGngDocumentos.hook";
@@ -58,3 +58,27 @@ export interface CustomerAcul {
58
58
  AcceptsTermsAndConditions: boolean;
59
59
  Verified: boolean;
60
60
  }
61
+
62
+ export interface VoucherTemplates {
63
+ Id: string
64
+ Name: string
65
+ ShortDscId: string
66
+ DiscountValue: number
67
+ CoinExchange: string
68
+ DurationInDays: number
69
+ RulesTextId: string
70
+ HowToTextId: string
71
+ Status: string
72
+ CreateDate: number
73
+ UpdateDate: number
74
+ }
75
+ export interface CreateVoucherTemplatesPayload {
76
+ Name: string
77
+ Description: string
78
+ DiscountValue: number
79
+ CoinExchange: string
80
+ ExpirationDays: number
81
+ Rules: string
82
+ HowTo: string
83
+ Status: string
84
+ }