@yeverlibs/ds 1.1.1 → 1.1.3

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/index.d.mts CHANGED
@@ -736,9 +736,9 @@ type SelectProps = {
736
736
  label?: string
737
737
  placeholder?: string
738
738
  options: SelectOption[]
739
- onSelect: (option: SelectOption) => void
739
+ onSelect: (option: SelectOption | null) => void
740
740
  className?: string
741
- value?: SelectOption
741
+ value?: SelectOption | null
742
742
  tooltip?: string
743
743
  isClearable?: boolean
744
744
  }
@@ -913,6 +913,42 @@ interface ChartProps extends Omit<Partial<PieSvgProps<{
913
913
  }
914
914
  declare const PieChart: React.FC<ChartProps>;
915
915
 
916
+ type fetchServerSideProps<T = string | number | boolean | null | undefined | object> = {
917
+ urlRequest: string
918
+ parseData?: (data: string | number | boolean | null | undefined | object) => T
919
+ filtersAllowed?: string[]
920
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'
921
+ body?: string | number | boolean | null | undefined | object
922
+ }
923
+
924
+ declare const fetchServerSide: <T>({ urlRequest, parseData, filtersAllowed, method, body, }: fetchServerSideProps<T>) => Promise<{
925
+ props: {
926
+ pagination: PaginatedData | undefined;
927
+ data: T;
928
+ error?: undefined;
929
+ };
930
+ } | {
931
+ props: {
932
+ error: {
933
+ status: number;
934
+ message: string;
935
+ errors: Record<string, string[]>;
936
+ };
937
+ data: null;
938
+ pagination?: undefined;
939
+ };
940
+ } | {
941
+ props: {
942
+ error: {
943
+ status: number;
944
+ message: string | undefined;
945
+ errors: Record<string, string[]> | undefined;
946
+ };
947
+ pagination?: undefined;
948
+ data?: undefined;
949
+ };
950
+ }>;
951
+
916
952
  declare function Configuracoes(props: React$1.SVGProps<SVGSVGElement>): react_jsx_runtime.JSX.Element;
917
953
  declare const MemoConfiguracoes: React$1.MemoExoticComponent<typeof Configuracoes>;
918
954
 
@@ -1465,4 +1501,4 @@ declare const useCopyToClipboard: (successMessage?: string) => {
1465
1501
  copyToClipboard: (initialText: string) => void;
1466
1502
  };
1467
1503
 
1468
- export { Alert, MemoAlertDefault as AlertDefault, MemoAlertError as AlertError, MemoAlertGuard as AlertGuard, MemoAlertInfo as AlertInfo, MemoAlertWarning as AlertWarning, MemoApi as Api, MemoArrowLeft as ArrowLeft, MemoArrowNarrowUpRight as ArrowNarrowUpRight, Avatar, BarChart, MemoBoleto as Boleto, Box, Button, type ButtonProps, ButtonToggleGroup, type ButtonToggleGroupProps, CSV, MemoCalendar as Calendar, MemoCard as Card, MemoCarrFree as CarrFree, MemoCarretDown as CarretDown, MemoCarretSingleRight as CarretSingleRight, CarrinhoAbandonado, MemoCart as Cart, MemoChargeback as Chargeback, MemoCheck as Check, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxOption, MemoCheckout as Checkout, MemoChevronDown as ChevronDown, MemoChevronLeftDouble as ChevronLeftDouble, MemoCloseCheckbox as CloseCheckbox, MemoCloseIcon as CloseIcon, MemoCloud as Cloud, MemoCodeCircle as CodeCircle, type Column, MemoConfiguracoes as Configuracoes, MemoCopy as Copy, MemoCopyLink as CopyLink, Counter, MemoCreditCard as CreditCard, MemoCupom as Cupom, CurrencyInput, CustomSelect, MemoDashboard as Dashboard, DatePicker, type DatePickerProps, type DateStateProps, DeleteModal, MemoDelivery as Delivery, MemoDepoimentos as Depoimentos, MemoDistribuicao as Distribuicao, MemoDistribution as Distribution, MemoDominios as Dominios, MemoDownloadArrow as DownloadArrow, MemoDrag as Drag, DropdownContext, DropdownItens, DropdownTrigger, DrowpdownButton, MemoEdit as Edit, Emails, MemoExtrato as Extrato, MemoEyeInput as EyeInput, MemoEyeOff as EyeOff, FeedbackBadge, MemoFileMinus as FileMinus, FileUploadWithDisplayName as FileUpload, FilterDrawer, MemoFilterLines as FilterLines, FilterList, FilterListContext, FilterTrigger, MemoFinanceiro as Financeiro, FormWrapper, MemoFrete as Frete, MemoFreteGratis as FreteGratis, GeneralPageLinks, MemoGestao as Gestao, MemoGlobe as Globe, GlobeVariant, Grid, GridColumn, Guard, Heading, MemoHeadphones as Headphones, MemoHelp as Help, MemoHelpCircle as HelpCircle, Home, MemoInfoCircle as InfoCircle, Input, MemoIntegracoes as Integracoes, LineChart, Link$1 as Link, MemoLink as LinkIcon, type LinkProps, MemoLoadingSpinner as LoadingSpinner, MemoLock as Lock, MemoLockInput as LockInput, Logistica, MemoLoja as Loja, LojaAlert, LojaAlertSuccess, MemoMail as Mail, MemoMailInput as MailInput, MemoMarkerPin as MarkerPin, MemoMarketing as Marketing, MediumRisk, MemoMessage as Message, Modal, MemoMoney as Money, MultiSelect, NewIcons, MemoNewMessage as NewMessage, MemoNewNotification as NewNotification, MemoNotificacoes as Notificacoes, MemoNotification as Notification, NotificationItem, MemoNotifications as Notifications, type OpenAsBlobOptions, MemoOrderBump as OrderBump, PageContainer, type PaginatedData, PaymentCard, MemoPermissaoDeAcesso as PermissaoDeAcesso, PhoneCall, PieChart, MemoPix as Pix, MemoPixels as Pixels, Planilha, MemoPlus as Plus, MemoPrechargeback as Prechargeback, PrefetchLink, PreviewPhone, MemoProduto as Produto, MemoProdutos as Produtos, MemoPromocoes as Promocoes, RecuperacaoDeCarrinho, MemoRefresh as Refresh, MemoRelatorios as Relatorios, MemoRestricaoDeAcesso as RestricaoDeAcesso, Ribbon, MemoRisco as Risco, MemoSac as Sac, MemoSearchMd as SearchMd, SelectableOption, Separator, MemoSignout as Signout, SliderInput, SlidingPanel, Spinner$1 as Spinner, MemoSpinner as SpinnerIcon, StatusBadge, MemoStore as Store, Switch$1 as Switch, MemoSwitch as SwitchIcon, type SwitchProps, Table, Tabs, Text, Textarea, TimeInput, TimerCounter, type CounterInputProps$1 as TimerCounterProps, TimerCounterWithoutSeconds, type CounterInputProps as TimerCounterWithoutSecondsProps, Tooltip, MemoTransfer as Transfer, MemoTrash as Trash, MemoTruck as Truck, MemoUpsell as Upsell, MemoUser as User, MemoUsers as Users, MemoVerticalPoints as VerticalPoints, MemoWarning as Warning, MemoWebhook as Webhook, MemoWebhook$1 as WebhookConfig, MemoWhatsapp as Whatsapp, Xlsx, MemoYever as Yever, calculateCurrencyOperation, cn, colors, fontFamily, formatCNPJ, formatCNPJCPF, formatCPF, formatCurrency, formatCurrencyShort, formatDate, formatDateAndReturnPassedHours, formatDateGeneric, formatDateInPassedDays, formatDateTime, formatDateToISO, formatIP, formatName, formatNumberToCurrency, formatPhone, formatPostalCode, formatRawDigitsToCurrency, formatTime$1 as formatTimeWithSeconds, formatTime as formatTimeWithoutSeconds, getDates, handleFormSubmission, nextReplaceUrl, parseFormattedCurrency, parseParametersIntoUrl, shadow, transformDateToAmericanFormat, transformToCurrency, transformToNumber, transformToPercentage, truncateString, useCopyToClipboard };
1504
+ export { Alert, MemoAlertDefault as AlertDefault, MemoAlertError as AlertError, MemoAlertGuard as AlertGuard, MemoAlertInfo as AlertInfo, MemoAlertWarning as AlertWarning, MemoApi as Api, MemoArrowLeft as ArrowLeft, MemoArrowNarrowUpRight as ArrowNarrowUpRight, Avatar, BarChart, MemoBoleto as Boleto, Box, Button, type ButtonProps, ButtonToggleGroup, type ButtonToggleGroupProps, CSV, MemoCalendar as Calendar, MemoCard as Card, MemoCarrFree as CarrFree, MemoCarretDown as CarretDown, MemoCarretSingleRight as CarretSingleRight, CarrinhoAbandonado, MemoCart as Cart, MemoChargeback as Chargeback, MemoCheck as Check, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxOption, MemoCheckout as Checkout, MemoChevronDown as ChevronDown, MemoChevronLeftDouble as ChevronLeftDouble, MemoCloseCheckbox as CloseCheckbox, MemoCloseIcon as CloseIcon, MemoCloud as Cloud, MemoCodeCircle as CodeCircle, type Column, MemoConfiguracoes as Configuracoes, MemoCopy as Copy, MemoCopyLink as CopyLink, Counter, MemoCreditCard as CreditCard, MemoCupom as Cupom, CurrencyInput, CustomSelect, MemoDashboard as Dashboard, DatePicker, type DatePickerProps, type DateStateProps, DeleteModal, MemoDelivery as Delivery, MemoDepoimentos as Depoimentos, MemoDistribuicao as Distribuicao, MemoDistribution as Distribution, MemoDominios as Dominios, MemoDownloadArrow as DownloadArrow, MemoDrag as Drag, DropdownContext, DropdownItens, DropdownTrigger, DrowpdownButton, MemoEdit as Edit, Emails, MemoExtrato as Extrato, MemoEyeInput as EyeInput, MemoEyeOff as EyeOff, FeedbackBadge, MemoFileMinus as FileMinus, FileUploadWithDisplayName as FileUpload, FilterDrawer, MemoFilterLines as FilterLines, FilterList, FilterListContext, FilterTrigger, MemoFinanceiro as Financeiro, FormWrapper, MemoFrete as Frete, MemoFreteGratis as FreteGratis, GeneralPageLinks, MemoGestao as Gestao, MemoGlobe as Globe, GlobeVariant, Grid, GridColumn, Guard, Heading, MemoHeadphones as Headphones, MemoHelp as Help, MemoHelpCircle as HelpCircle, Home, MemoInfoCircle as InfoCircle, Input, MemoIntegracoes as Integracoes, LineChart, Link$1 as Link, MemoLink as LinkIcon, type LinkProps, MemoLoadingSpinner as LoadingSpinner, MemoLock as Lock, MemoLockInput as LockInput, Logistica, MemoLoja as Loja, LojaAlert, LojaAlertSuccess, MemoMail as Mail, MemoMailInput as MailInput, MemoMarkerPin as MarkerPin, MemoMarketing as Marketing, MediumRisk, MemoMessage as Message, Modal, MemoMoney as Money, MultiSelect, NewIcons, MemoNewMessage as NewMessage, MemoNewNotification as NewNotification, MemoNotificacoes as Notificacoes, MemoNotification as Notification, NotificationItem, MemoNotifications as Notifications, type OpenAsBlobOptions, MemoOrderBump as OrderBump, PageContainer, type PaginatedData, PaymentCard, MemoPermissaoDeAcesso as PermissaoDeAcesso, PhoneCall, PieChart, MemoPix as Pix, MemoPixels as Pixels, Planilha, MemoPlus as Plus, MemoPrechargeback as Prechargeback, PrefetchLink, PreviewPhone, MemoProduto as Produto, MemoProdutos as Produtos, MemoPromocoes as Promocoes, RecuperacaoDeCarrinho, MemoRefresh as Refresh, MemoRelatorios as Relatorios, MemoRestricaoDeAcesso as RestricaoDeAcesso, Ribbon, MemoRisco as Risco, MemoSac as Sac, MemoSearchMd as SearchMd, SelectableOption, Separator, MemoSignout as Signout, SliderInput, SlidingPanel, Spinner$1 as Spinner, MemoSpinner as SpinnerIcon, StatusBadge, MemoStore as Store, Switch$1 as Switch, MemoSwitch as SwitchIcon, type SwitchProps, Table, Tabs, Text, Textarea, TimeInput, TimerCounter, type CounterInputProps$1 as TimerCounterProps, TimerCounterWithoutSeconds, type CounterInputProps as TimerCounterWithoutSecondsProps, Tooltip, MemoTransfer as Transfer, MemoTrash as Trash, MemoTruck as Truck, MemoUpsell as Upsell, MemoUser as User, MemoUsers as Users, MemoVerticalPoints as VerticalPoints, MemoWarning as Warning, MemoWebhook as Webhook, MemoWebhook$1 as WebhookConfig, MemoWhatsapp as Whatsapp, Xlsx, MemoYever as Yever, calculateCurrencyOperation, cn, colors, fetchServerSide, fontFamily, formatCNPJ, formatCNPJCPF, formatCPF, formatCurrency, formatCurrencyShort, formatDate, formatDateAndReturnPassedHours, formatDateGeneric, formatDateInPassedDays, formatDateTime, formatDateToISO, formatIP, formatName, formatNumberToCurrency, formatPhone, formatPostalCode, formatRawDigitsToCurrency, formatTime$1 as formatTimeWithSeconds, formatTime as formatTimeWithoutSeconds, getDates, handleFormSubmission, nextReplaceUrl, parseFormattedCurrency, parseParametersIntoUrl, shadow, transformDateToAmericanFormat, transformToCurrency, transformToNumber, transformToPercentage, truncateString, useCopyToClipboard };
package/dist/index.d.ts CHANGED
@@ -736,9 +736,9 @@ type SelectProps = {
736
736
  label?: string
737
737
  placeholder?: string
738
738
  options: SelectOption[]
739
- onSelect: (option: SelectOption) => void
739
+ onSelect: (option: SelectOption | null) => void
740
740
  className?: string
741
- value?: SelectOption
741
+ value?: SelectOption | null
742
742
  tooltip?: string
743
743
  isClearable?: boolean
744
744
  }
@@ -913,6 +913,42 @@ interface ChartProps extends Omit<Partial<PieSvgProps<{
913
913
  }
914
914
  declare const PieChart: React.FC<ChartProps>;
915
915
 
916
+ type fetchServerSideProps<T = string | number | boolean | null | undefined | object> = {
917
+ urlRequest: string
918
+ parseData?: (data: string | number | boolean | null | undefined | object) => T
919
+ filtersAllowed?: string[]
920
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'
921
+ body?: string | number | boolean | null | undefined | object
922
+ }
923
+
924
+ declare const fetchServerSide: <T>({ urlRequest, parseData, filtersAllowed, method, body, }: fetchServerSideProps<T>) => Promise<{
925
+ props: {
926
+ pagination: PaginatedData | undefined;
927
+ data: T;
928
+ error?: undefined;
929
+ };
930
+ } | {
931
+ props: {
932
+ error: {
933
+ status: number;
934
+ message: string;
935
+ errors: Record<string, string[]>;
936
+ };
937
+ data: null;
938
+ pagination?: undefined;
939
+ };
940
+ } | {
941
+ props: {
942
+ error: {
943
+ status: number;
944
+ message: string | undefined;
945
+ errors: Record<string, string[]> | undefined;
946
+ };
947
+ pagination?: undefined;
948
+ data?: undefined;
949
+ };
950
+ }>;
951
+
916
952
  declare function Configuracoes(props: React$1.SVGProps<SVGSVGElement>): react_jsx_runtime.JSX.Element;
917
953
  declare const MemoConfiguracoes: React$1.MemoExoticComponent<typeof Configuracoes>;
918
954
 
@@ -1465,4 +1501,4 @@ declare const useCopyToClipboard: (successMessage?: string) => {
1465
1501
  copyToClipboard: (initialText: string) => void;
1466
1502
  };
1467
1503
 
1468
- export { Alert, MemoAlertDefault as AlertDefault, MemoAlertError as AlertError, MemoAlertGuard as AlertGuard, MemoAlertInfo as AlertInfo, MemoAlertWarning as AlertWarning, MemoApi as Api, MemoArrowLeft as ArrowLeft, MemoArrowNarrowUpRight as ArrowNarrowUpRight, Avatar, BarChart, MemoBoleto as Boleto, Box, Button, type ButtonProps, ButtonToggleGroup, type ButtonToggleGroupProps, CSV, MemoCalendar as Calendar, MemoCard as Card, MemoCarrFree as CarrFree, MemoCarretDown as CarretDown, MemoCarretSingleRight as CarretSingleRight, CarrinhoAbandonado, MemoCart as Cart, MemoChargeback as Chargeback, MemoCheck as Check, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxOption, MemoCheckout as Checkout, MemoChevronDown as ChevronDown, MemoChevronLeftDouble as ChevronLeftDouble, MemoCloseCheckbox as CloseCheckbox, MemoCloseIcon as CloseIcon, MemoCloud as Cloud, MemoCodeCircle as CodeCircle, type Column, MemoConfiguracoes as Configuracoes, MemoCopy as Copy, MemoCopyLink as CopyLink, Counter, MemoCreditCard as CreditCard, MemoCupom as Cupom, CurrencyInput, CustomSelect, MemoDashboard as Dashboard, DatePicker, type DatePickerProps, type DateStateProps, DeleteModal, MemoDelivery as Delivery, MemoDepoimentos as Depoimentos, MemoDistribuicao as Distribuicao, MemoDistribution as Distribution, MemoDominios as Dominios, MemoDownloadArrow as DownloadArrow, MemoDrag as Drag, DropdownContext, DropdownItens, DropdownTrigger, DrowpdownButton, MemoEdit as Edit, Emails, MemoExtrato as Extrato, MemoEyeInput as EyeInput, MemoEyeOff as EyeOff, FeedbackBadge, MemoFileMinus as FileMinus, FileUploadWithDisplayName as FileUpload, FilterDrawer, MemoFilterLines as FilterLines, FilterList, FilterListContext, FilterTrigger, MemoFinanceiro as Financeiro, FormWrapper, MemoFrete as Frete, MemoFreteGratis as FreteGratis, GeneralPageLinks, MemoGestao as Gestao, MemoGlobe as Globe, GlobeVariant, Grid, GridColumn, Guard, Heading, MemoHeadphones as Headphones, MemoHelp as Help, MemoHelpCircle as HelpCircle, Home, MemoInfoCircle as InfoCircle, Input, MemoIntegracoes as Integracoes, LineChart, Link$1 as Link, MemoLink as LinkIcon, type LinkProps, MemoLoadingSpinner as LoadingSpinner, MemoLock as Lock, MemoLockInput as LockInput, Logistica, MemoLoja as Loja, LojaAlert, LojaAlertSuccess, MemoMail as Mail, MemoMailInput as MailInput, MemoMarkerPin as MarkerPin, MemoMarketing as Marketing, MediumRisk, MemoMessage as Message, Modal, MemoMoney as Money, MultiSelect, NewIcons, MemoNewMessage as NewMessage, MemoNewNotification as NewNotification, MemoNotificacoes as Notificacoes, MemoNotification as Notification, NotificationItem, MemoNotifications as Notifications, type OpenAsBlobOptions, MemoOrderBump as OrderBump, PageContainer, type PaginatedData, PaymentCard, MemoPermissaoDeAcesso as PermissaoDeAcesso, PhoneCall, PieChart, MemoPix as Pix, MemoPixels as Pixels, Planilha, MemoPlus as Plus, MemoPrechargeback as Prechargeback, PrefetchLink, PreviewPhone, MemoProduto as Produto, MemoProdutos as Produtos, MemoPromocoes as Promocoes, RecuperacaoDeCarrinho, MemoRefresh as Refresh, MemoRelatorios as Relatorios, MemoRestricaoDeAcesso as RestricaoDeAcesso, Ribbon, MemoRisco as Risco, MemoSac as Sac, MemoSearchMd as SearchMd, SelectableOption, Separator, MemoSignout as Signout, SliderInput, SlidingPanel, Spinner$1 as Spinner, MemoSpinner as SpinnerIcon, StatusBadge, MemoStore as Store, Switch$1 as Switch, MemoSwitch as SwitchIcon, type SwitchProps, Table, Tabs, Text, Textarea, TimeInput, TimerCounter, type CounterInputProps$1 as TimerCounterProps, TimerCounterWithoutSeconds, type CounterInputProps as TimerCounterWithoutSecondsProps, Tooltip, MemoTransfer as Transfer, MemoTrash as Trash, MemoTruck as Truck, MemoUpsell as Upsell, MemoUser as User, MemoUsers as Users, MemoVerticalPoints as VerticalPoints, MemoWarning as Warning, MemoWebhook as Webhook, MemoWebhook$1 as WebhookConfig, MemoWhatsapp as Whatsapp, Xlsx, MemoYever as Yever, calculateCurrencyOperation, cn, colors, fontFamily, formatCNPJ, formatCNPJCPF, formatCPF, formatCurrency, formatCurrencyShort, formatDate, formatDateAndReturnPassedHours, formatDateGeneric, formatDateInPassedDays, formatDateTime, formatDateToISO, formatIP, formatName, formatNumberToCurrency, formatPhone, formatPostalCode, formatRawDigitsToCurrency, formatTime$1 as formatTimeWithSeconds, formatTime as formatTimeWithoutSeconds, getDates, handleFormSubmission, nextReplaceUrl, parseFormattedCurrency, parseParametersIntoUrl, shadow, transformDateToAmericanFormat, transformToCurrency, transformToNumber, transformToPercentage, truncateString, useCopyToClipboard };
1504
+ export { Alert, MemoAlertDefault as AlertDefault, MemoAlertError as AlertError, MemoAlertGuard as AlertGuard, MemoAlertInfo as AlertInfo, MemoAlertWarning as AlertWarning, MemoApi as Api, MemoArrowLeft as ArrowLeft, MemoArrowNarrowUpRight as ArrowNarrowUpRight, Avatar, BarChart, MemoBoleto as Boleto, Box, Button, type ButtonProps, ButtonToggleGroup, type ButtonToggleGroupProps, CSV, MemoCalendar as Calendar, MemoCard as Card, MemoCarrFree as CarrFree, MemoCarretDown as CarretDown, MemoCarretSingleRight as CarretSingleRight, CarrinhoAbandonado, MemoCart as Cart, MemoChargeback as Chargeback, MemoCheck as Check, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxOption, MemoCheckout as Checkout, MemoChevronDown as ChevronDown, MemoChevronLeftDouble as ChevronLeftDouble, MemoCloseCheckbox as CloseCheckbox, MemoCloseIcon as CloseIcon, MemoCloud as Cloud, MemoCodeCircle as CodeCircle, type Column, MemoConfiguracoes as Configuracoes, MemoCopy as Copy, MemoCopyLink as CopyLink, Counter, MemoCreditCard as CreditCard, MemoCupom as Cupom, CurrencyInput, CustomSelect, MemoDashboard as Dashboard, DatePicker, type DatePickerProps, type DateStateProps, DeleteModal, MemoDelivery as Delivery, MemoDepoimentos as Depoimentos, MemoDistribuicao as Distribuicao, MemoDistribution as Distribution, MemoDominios as Dominios, MemoDownloadArrow as DownloadArrow, MemoDrag as Drag, DropdownContext, DropdownItens, DropdownTrigger, DrowpdownButton, MemoEdit as Edit, Emails, MemoExtrato as Extrato, MemoEyeInput as EyeInput, MemoEyeOff as EyeOff, FeedbackBadge, MemoFileMinus as FileMinus, FileUploadWithDisplayName as FileUpload, FilterDrawer, MemoFilterLines as FilterLines, FilterList, FilterListContext, FilterTrigger, MemoFinanceiro as Financeiro, FormWrapper, MemoFrete as Frete, MemoFreteGratis as FreteGratis, GeneralPageLinks, MemoGestao as Gestao, MemoGlobe as Globe, GlobeVariant, Grid, GridColumn, Guard, Heading, MemoHeadphones as Headphones, MemoHelp as Help, MemoHelpCircle as HelpCircle, Home, MemoInfoCircle as InfoCircle, Input, MemoIntegracoes as Integracoes, LineChart, Link$1 as Link, MemoLink as LinkIcon, type LinkProps, MemoLoadingSpinner as LoadingSpinner, MemoLock as Lock, MemoLockInput as LockInput, Logistica, MemoLoja as Loja, LojaAlert, LojaAlertSuccess, MemoMail as Mail, MemoMailInput as MailInput, MemoMarkerPin as MarkerPin, MemoMarketing as Marketing, MediumRisk, MemoMessage as Message, Modal, MemoMoney as Money, MultiSelect, NewIcons, MemoNewMessage as NewMessage, MemoNewNotification as NewNotification, MemoNotificacoes as Notificacoes, MemoNotification as Notification, NotificationItem, MemoNotifications as Notifications, type OpenAsBlobOptions, MemoOrderBump as OrderBump, PageContainer, type PaginatedData, PaymentCard, MemoPermissaoDeAcesso as PermissaoDeAcesso, PhoneCall, PieChart, MemoPix as Pix, MemoPixels as Pixels, Planilha, MemoPlus as Plus, MemoPrechargeback as Prechargeback, PrefetchLink, PreviewPhone, MemoProduto as Produto, MemoProdutos as Produtos, MemoPromocoes as Promocoes, RecuperacaoDeCarrinho, MemoRefresh as Refresh, MemoRelatorios as Relatorios, MemoRestricaoDeAcesso as RestricaoDeAcesso, Ribbon, MemoRisco as Risco, MemoSac as Sac, MemoSearchMd as SearchMd, SelectableOption, Separator, MemoSignout as Signout, SliderInput, SlidingPanel, Spinner$1 as Spinner, MemoSpinner as SpinnerIcon, StatusBadge, MemoStore as Store, Switch$1 as Switch, MemoSwitch as SwitchIcon, type SwitchProps, Table, Tabs, Text, Textarea, TimeInput, TimerCounter, type CounterInputProps$1 as TimerCounterProps, TimerCounterWithoutSeconds, type CounterInputProps as TimerCounterWithoutSecondsProps, Tooltip, MemoTransfer as Transfer, MemoTrash as Trash, MemoTruck as Truck, MemoUpsell as Upsell, MemoUser as User, MemoUsers as Users, MemoVerticalPoints as VerticalPoints, MemoWarning as Warning, MemoWebhook as Webhook, MemoWebhook$1 as WebhookConfig, MemoWhatsapp as Whatsapp, Xlsx, MemoYever as Yever, calculateCurrencyOperation, cn, colors, fetchServerSide, fontFamily, formatCNPJ, formatCNPJCPF, formatCPF, formatCurrency, formatCurrencyShort, formatDate, formatDateAndReturnPassedHours, formatDateGeneric, formatDateInPassedDays, formatDateTime, formatDateToISO, formatIP, formatName, formatNumberToCurrency, formatPhone, formatPostalCode, formatRawDigitsToCurrency, formatTime$1 as formatTimeWithSeconds, formatTime as formatTimeWithoutSeconds, getDates, handleFormSubmission, nextReplaceUrl, parseFormattedCurrency, parseParametersIntoUrl, shadow, transformDateToAmericanFormat, transformToCurrency, transformToNumber, transformToPercentage, truncateString, useCopyToClipboard };
package/dist/index.js CHANGED
@@ -19,6 +19,8 @@ var Select2 = require('react-select');
19
19
  var bar = require('@nivo/bar');
20
20
  var line = require('@nivo/line');
21
21
  var pie = require('@nivo/pie');
22
+ var headers = require('next/headers');
23
+ var Cookies = require('js-cookie');
22
24
  var currency = require('currency.js');
23
25
 
24
26
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -48,6 +50,7 @@ var ReactDOM__default = /*#__PURE__*/_interopDefault(ReactDOM);
48
50
  var dynamic__default = /*#__PURE__*/_interopDefault(dynamic);
49
51
  var Link2__default = /*#__PURE__*/_interopDefault(Link2);
50
52
  var Select2__default = /*#__PURE__*/_interopDefault(Select2);
53
+ var Cookies__default = /*#__PURE__*/_interopDefault(Cookies);
51
54
  var currency__default = /*#__PURE__*/_interopDefault(currency);
52
55
 
53
56
  // src/lib/utils.ts
@@ -6199,18 +6202,13 @@ var TableContent = ({
6199
6202
  const [itemsPerPage, setItemsPerPage] = React107.useState(10);
6200
6203
  const [selectedRows, setSelectedRows] = React107.useState(/* @__PURE__ */ new Set());
6201
6204
  const searchParams = navigation.useSearchParams();
6205
+ const isFirstRender = React107.useRef(true);
6202
6206
  const perPage = Number(searchParams?.get("perPage")) || 10;
6203
6207
  const page = Number(searchParams?.get("page")) || 1;
6204
6208
  const searchParam = searchParams?.get("search") || "";
6205
6209
  React107.useEffect(() => {
6206
6210
  setCurrentPage(page);
6207
6211
  }, [page]);
6208
- React107.useEffect(() => {
6209
- const searchParams2 = new URLSearchParams(window.location.search);
6210
- if (searchParams2.toString().length > 0) {
6211
- onPaginateAction?.();
6212
- }
6213
- }, []);
6214
6212
  React107.useEffect(() => {
6215
6213
  const shouldReset = document.cookie.includes("reset-table-params=true");
6216
6214
  if (shouldReset) {
@@ -6228,23 +6226,18 @@ var TableContent = ({
6228
6226
  window.history.replaceState({}, "", url);
6229
6227
  }
6230
6228
  }, [pathname]);
6229
+ React107.useEffect(() => {
6230
+ isFirstRender.current = false;
6231
+ }, []);
6231
6232
  React107.useEffect(() => {
6232
6233
  if (!pathname) return;
6233
- let shouldPaginate = false;
6234
6234
  if (searchParams?.has("perPage")) {
6235
6235
  setItemsPerPage(perPage);
6236
- nextReplaceUrl("perPage", String(perPage), pathname);
6237
- shouldPaginate = true;
6238
6236
  }
6239
6237
  if (searchParams?.has("search")) {
6240
6238
  setSearchQuery(searchParam);
6241
- nextReplaceUrl("search", searchParam, pathname);
6242
- shouldPaginate = true;
6243
- }
6244
- if (shouldPaginate) {
6245
- handlePagination();
6246
6239
  }
6247
- }, [perPage, searchParam]);
6240
+ }, [perPage, searchParam, pathname, searchParams]);
6248
6241
  const handlePagination = async () => {
6249
6242
  if (!onPaginateAction) return;
6250
6243
  setIsLoading(true);
@@ -6262,6 +6255,7 @@ var TableContent = ({
6262
6255
  if (!pathname) return;
6263
6256
  nextReplaceUrl("search", searchQuery, pathname);
6264
6257
  nextReplaceUrl("page", "1", pathname);
6258
+ handlePagination();
6265
6259
  };
6266
6260
  const handleClickOutside = React107.useCallback((event) => {
6267
6261
  if (actionMenuRef.current && !actionMenuRef.current.contains(event.target)) {
@@ -6541,6 +6535,7 @@ var TableContent = ({
6541
6535
  setCurrentPage(RESET_PAGE);
6542
6536
  nextReplaceUrl("page", "1", pathname);
6543
6537
  nextReplaceUrl("perPage", String(newPerPage), pathname);
6538
+ await handlePagination();
6544
6539
  },
6545
6540
  className: "block h-8 w-full cursor-pointer appearance-none rounded border border-gray-300 bg-white p-2 text-sm leading-tight text-gray-700 focus:border-gray-500 focus:bg-white focus:outline-none",
6546
6541
  children: [
@@ -6571,15 +6566,15 @@ var TableContent = ({
6571
6566
  var Table = (props) => {
6572
6567
  return /* @__PURE__ */ jsxRuntime.jsx(React107.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(TableContent, { ...props }) });
6573
6568
  };
6574
- var Tabs = ({ headers, children, noGap, active, alignDiv = "full" }) => {
6569
+ var Tabs = ({ headers: headers2, children, noGap, active, alignDiv = "full" }) => {
6575
6570
  const [activeTab, setActiveTab] = React107.useState(active || 0);
6576
- const flattenHeaders = (headers2) => {
6577
- if (Array.isArray(headers2[0])) {
6578
- return headers2.flat();
6571
+ const flattenHeaders = (headers3) => {
6572
+ if (Array.isArray(headers3[0])) {
6573
+ return headers3.flat();
6579
6574
  }
6580
- return headers2;
6575
+ return headers3;
6581
6576
  };
6582
- const flattenedHeaders = flattenHeaders(headers);
6577
+ const flattenedHeaders = flattenHeaders(headers2);
6583
6578
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col", noGap ? "" : "gap-4"), children: [
6584
6579
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-4 overflow-x-auto overflow-y-hidden border-b border-gray-300", children: flattenedHeaders.map((header, index) => /* @__PURE__ */ jsxRuntime.jsx(
6585
6580
  "button",
@@ -7047,9 +7042,7 @@ var CustomSelect = ({
7047
7042
  isClearable = true
7048
7043
  }) => {
7049
7044
  const handleChange = (option) => {
7050
- if (option) {
7051
- onSelect(option);
7052
- }
7045
+ onSelect(option);
7053
7046
  };
7054
7047
  const formatOptionLabel = (option) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center", children: [
7055
7048
  option.icon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative mr-2 flex h-[24px] max-h-[24px] w-[24px] max-w-[24px] items-center justify-center rounded border border-gray-300", children: /* @__PURE__ */ jsxRuntime.jsx(Image4__default.default, { src: option.icon, alt: option.label, fill: true, className: "p-1", quality: 100 }) }),
@@ -8102,6 +8095,245 @@ var PieChart = ({
8102
8095
  }
8103
8096
  );
8104
8097
  };
8098
+ async function getCsrfToken() {
8099
+ const baseURL = process.env.NEXT_PUBLIC_API_URL ?? "";
8100
+ const response = await fetch(`${baseURL}/sanctum/csrf-cookie`, {
8101
+ credentials: "include",
8102
+ headers: {
8103
+ "X-Requested-With": "XMLHttpRequest"
8104
+ }
8105
+ });
8106
+ if (!response.ok) {
8107
+ throw new Error("Falha ao obter token CSRF");
8108
+ }
8109
+ await new Promise((resolve) => setTimeout(resolve, 100));
8110
+ }
8111
+ async function apiFetch(options) {
8112
+ const baseURL = process.env.NEXT_PUBLIC_API_URL ?? "";
8113
+ const isAbsolute = /^https?:\/\//i.test(options.url);
8114
+ const url = isAbsolute ? options.url : `${baseURL}${options.url}`;
8115
+ const method = (options.method ?? "GET").toString().toLowerCase();
8116
+ const needsCSRFToken = ["post", "put", "delete"].includes(method);
8117
+ const hasCSRFCookie = Cookies__default.default.get("XSRF-TOKEN");
8118
+ if (needsCSRFToken && !hasCSRFCookie) {
8119
+ await getCsrfToken();
8120
+ }
8121
+ const defaultHeaders = {
8122
+ "X-Requested-With": "XMLHttpRequest",
8123
+ Accept: "application/json"
8124
+ };
8125
+ if (!(options.body instanceof FormData)) {
8126
+ defaultHeaders["Content-Type"] = "application/json";
8127
+ }
8128
+ const finalHeaders = new Headers(defaultHeaders);
8129
+ if (options.headers) {
8130
+ if (options.headers instanceof Headers) {
8131
+ options.headers.forEach((v, k) => finalHeaders.set(k, v));
8132
+ } else {
8133
+ Object.entries(options.headers).forEach(([k, v]) => {
8134
+ if (v !== void 0) finalHeaders.set(k, v);
8135
+ });
8136
+ }
8137
+ }
8138
+ const csrfToken = Cookies__default.default.get("XSRF-TOKEN");
8139
+ if (csrfToken) {
8140
+ finalHeaders.set("X-XSRF-TOKEN", csrfToken);
8141
+ }
8142
+ let finalOptions = options;
8143
+ if (options.body) {
8144
+ finalOptions = {
8145
+ ...options,
8146
+ body: options.body instanceof FormData ? options.body : JSON.stringify(options.body)
8147
+ };
8148
+ }
8149
+ let response = await fetch(url, {
8150
+ credentials: "include",
8151
+ headers: finalHeaders,
8152
+ ...finalOptions
8153
+ });
8154
+ if (response.status === 419) {
8155
+ Cookies__default.default.remove("XSRF-TOKEN");
8156
+ await getCsrfToken();
8157
+ const newToken = Cookies__default.default.get("XSRF-TOKEN");
8158
+ if (newToken) {
8159
+ finalHeaders.set("X-XSRF-TOKEN", newToken);
8160
+ }
8161
+ response = await fetch(url, {
8162
+ credentials: "include",
8163
+ headers: finalHeaders,
8164
+ ...options
8165
+ });
8166
+ if (!response.ok) {
8167
+ Cookies__default.default.remove("XSRF-TOKEN");
8168
+ Cookies__default.default.remove("yeverClientUser");
8169
+ window.location.href = "/login";
8170
+ return Promise.reject(new Error("CSRF token expirado"));
8171
+ }
8172
+ }
8173
+ const headers2 = {};
8174
+ response.headers.forEach((value, key) => {
8175
+ headers2[key] = value;
8176
+ });
8177
+ if (!response.ok) {
8178
+ const data2 = await response.json().catch(() => null);
8179
+ const errorMessage = typeof data2 === "object" && data2 !== null && "message" in data2 ? data2.message : "Request failed";
8180
+ const error = new Error(errorMessage);
8181
+ error.status = response.status;
8182
+ error.response = {
8183
+ data: data2,
8184
+ status: response.status
8185
+ };
8186
+ throw error;
8187
+ }
8188
+ let data = null;
8189
+ if (options.responseType === "blob") {
8190
+ data = await response.blob().catch(() => null);
8191
+ } else {
8192
+ data = await response.json().catch(() => null);
8193
+ }
8194
+ return {
8195
+ status: response.status,
8196
+ statusText: response.statusText,
8197
+ data,
8198
+ headers: headers2
8199
+ };
8200
+ }
8201
+
8202
+ // src/utils/parse-parameters-into-url/index.tsx
8203
+ var parseParametersIntoUrl = (url, query, filtersAllowed) => {
8204
+ let urlFiltered = url;
8205
+ for (const key in query) {
8206
+ if (query && Object.keys(query).length > 0) {
8207
+ urlFiltered = urlFiltered.replace(`/${key}/`, `/${query[key]}/`);
8208
+ urlFiltered = urlFiltered.replace(`/${key}`, `/${query[key]}`);
8209
+ if (filtersAllowed && filtersAllowed.includes(key)) {
8210
+ if (urlFiltered.includes("?")) {
8211
+ if (key === "searchNew") {
8212
+ urlFiltered = urlFiltered + `&${key}=${atob(query[key])}`;
8213
+ } else {
8214
+ urlFiltered = urlFiltered + `&${key}=${query[key]}`;
8215
+ }
8216
+ } else {
8217
+ if (key === "searchNew") {
8218
+ urlFiltered = urlFiltered + `?${key}=${atob(query[key])}`;
8219
+ } else {
8220
+ urlFiltered = urlFiltered + `?${key}=${query[key]}`;
8221
+ }
8222
+ }
8223
+ }
8224
+ }
8225
+ }
8226
+ return urlFiltered;
8227
+ };
8228
+
8229
+ // src/lib/fetch-server-side/index.ts
8230
+ var fetchServerSide = async ({
8231
+ urlRequest,
8232
+ parseData,
8233
+ filtersAllowed,
8234
+ method = "GET",
8235
+ body
8236
+ }) => {
8237
+ "use server";
8238
+ try {
8239
+ const headersObject = Object.fromEntries((await headers.headers()).entries());
8240
+ const searchParams = new URLSearchParams(headersObject.referer ? new URL(headersObject.referer).search : "");
8241
+ const query = Array.from(searchParams.entries()).reduce((acc, [key, value]) => {
8242
+ acc[key] = value;
8243
+ return acc;
8244
+ }, {});
8245
+ const url = parseParametersIntoUrl(urlRequest, query, filtersAllowed);
8246
+ const origin = headersObject.host;
8247
+ const cookie = headersObject.cookie;
8248
+ const xsrfToken = cookie?.match(/XSRF-TOKEN=([^;]+)/)?.[1];
8249
+ const requestHeaders = {
8250
+ Cookie: cookie,
8251
+ origin
8252
+ };
8253
+ if (xsrfToken) {
8254
+ requestHeaders["X-XSRF-TOKEN"] = decodeURIComponent(xsrfToken);
8255
+ }
8256
+ let pagination;
8257
+ const res = await apiFetch({
8258
+ url,
8259
+ method,
8260
+ body,
8261
+ headers: requestHeaders,
8262
+ cache: "no-store"
8263
+ });
8264
+ if (res?.data && typeof res.data === "object" && "paginate" in res.data) {
8265
+ pagination = res.data.paginate;
8266
+ }
8267
+ const parsedData = parseData ? parseData(res) : res;
8268
+ return {
8269
+ props: {
8270
+ pagination,
8271
+ data: parsedData
8272
+ }
8273
+ };
8274
+ } catch (error) {
8275
+ const apiError = error;
8276
+ switch (apiError.response?.status) {
8277
+ case 401:
8278
+ navigation.redirect("/login");
8279
+ case 403:
8280
+ return {
8281
+ props: {
8282
+ error: {
8283
+ status: 403,
8284
+ message: "Voc\xEA n\xE3o tem permiss\xE3o para executar essa a\xE7\xE3o",
8285
+ errors: {}
8286
+ },
8287
+ data: null
8288
+ }
8289
+ };
8290
+ case 404:
8291
+ return {
8292
+ props: {
8293
+ error: {
8294
+ status: 404,
8295
+ message: apiError.response.data?.message || "Recurso n\xE3o encontrado",
8296
+ errors: apiError.response?.data?.errors || {}
8297
+ },
8298
+ data: null
8299
+ }
8300
+ };
8301
+ case 422:
8302
+ return {
8303
+ props: {
8304
+ error: {
8305
+ status: 422,
8306
+ message: apiError.response.data?.message || "Erro de valida\xE7\xE3o",
8307
+ errors: apiError.response?.data?.errors
8308
+ }
8309
+ }
8310
+ };
8311
+ case 500:
8312
+ return {
8313
+ props: {
8314
+ error: {
8315
+ status: 500,
8316
+ message: apiError.response.data?.message || "Ocorreu um erro durante o processamento dessa requisi\xE7\xE3o. A Yever foi notificada e estamos atuando para sanar o problema.",
8317
+ errors: {}
8318
+ }
8319
+ }
8320
+ };
8321
+ default:
8322
+ if (apiError.response?.data?.errors || apiError.response?.data?.message) {
8323
+ return {
8324
+ props: {
8325
+ error: {
8326
+ status: apiError.response.status,
8327
+ message: apiError.response.data?.message,
8328
+ errors: apiError.response.data?.errors
8329
+ }
8330
+ }
8331
+ };
8332
+ }
8333
+ navigation.redirect("/500");
8334
+ }
8335
+ }
8336
+ };
8105
8337
  var Dropshiping = (props) => {
8106
8338
  return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: 25, height: 25, viewBox: "0 0 25 25", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
8107
8339
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -9624,33 +9856,6 @@ var shadow = {
9624
9856
  store: "0px 4px 8px 3px rgba(0, 0, 0, 0.04)"
9625
9857
  };
9626
9858
  var shadow_default = shadow;
9627
-
9628
- // src/utils/parse-parameters-into-url/index.tsx
9629
- var parseParametersIntoUrl = (url, query, filtersAllowed) => {
9630
- let urlFiltered = url;
9631
- for (const key in query) {
9632
- if (query && Object.keys(query).length > 0) {
9633
- urlFiltered = urlFiltered.replace(`/${key}/`, `/${query[key]}/`);
9634
- urlFiltered = urlFiltered.replace(`/${key}`, `/${query[key]}`);
9635
- if (filtersAllowed && filtersAllowed.includes(key)) {
9636
- if (urlFiltered.includes("?")) {
9637
- if (key === "searchNew") {
9638
- urlFiltered = urlFiltered + `&${key}=${atob(query[key])}`;
9639
- } else {
9640
- urlFiltered = urlFiltered + `&${key}=${query[key]}`;
9641
- }
9642
- } else {
9643
- if (key === "searchNew") {
9644
- urlFiltered = urlFiltered + `?${key}=${atob(query[key])}`;
9645
- } else {
9646
- urlFiltered = urlFiltered + `?${key}=${query[key]}`;
9647
- }
9648
- }
9649
- }
9650
- }
9651
- }
9652
- return urlFiltered;
9653
- };
9654
9859
  var useCopyToClipboard = (successMessage) => {
9655
9860
  const copyToClipboard = (initialText) => {
9656
9861
  const textArea = document.createElement("textarea");
@@ -9837,6 +10042,7 @@ exports.Yever = Yever_default;
9837
10042
  exports.calculateCurrencyOperation = calculateCurrencyOperation;
9838
10043
  exports.cn = cn;
9839
10044
  exports.colors = colors_default;
10045
+ exports.fetchServerSide = fetchServerSide;
9840
10046
  exports.fontFamily = font_family_default;
9841
10047
  exports.formatCNPJ = formatCNPJ;
9842
10048
  exports.formatCNPJCPF = formatCNPJCPF;