@navservice/assinatura 1.53.0 → 1.55.0

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.
@@ -1,6 +1,5 @@
1
1
  interface VisualizarCreditosProps {
2
- usuario_id: string;
3
2
  label?: string;
4
3
  }
5
- export declare function VisualizarCreditos({ usuario_id, label }: VisualizarCreditosProps): import("react/jsx-runtime").JSX.Element;
4
+ export declare function VisualizarCreditos({ label }: VisualizarCreditosProps): import("react/jsx-runtime").JSX.Element;
6
5
  export {};
@@ -2,4 +2,5 @@ export { CheckoutStripe } from "./componentes/checkout/Stripe";
2
2
  export { CheckoutAssinaturaStripe } from "./componentes/checkout/CheckoutAssinaturaStripe";
3
3
  export { default as TypesAssinatura } from "../../shared/types";
4
4
  export { contexto_assinatura } from "./contexto/contexto_assinatura";
5
+ export { contexto_creditos } from "./contexto/contexto_creditos";
5
6
  export { VisualizarCreditos } from "./componentes/geral/VisualizarCreditos";
package/build/es/index.js CHANGED
@@ -19728,112 +19728,69 @@ const contexto_creditos = new class {
19728
19728
  });
19729
19729
  };
19730
19730
  };
19731
- function VisualizarCreditos({ usuario_id, label = "Seus créditos" }) {
19731
+ function VisualizarCreditos({ label = "Créditos" }) {
19732
19732
  const { quantidade, loading } = contexto_creditos.get_jsx;
19733
+ const usuario_id = src_utils.session_sorage.usuario_auth?.data?.usuario?._id;
19733
19734
  useEffect(()=>{
19734
19735
  if (!usuario_id) return;
19735
- contexto_creditos.api.buscar_pelo_usuario_id(usuario_id);
19736
+ contexto_creditos.api.buscar_pelo_usuario_id(src_utils.session_sorage.usuario_auth?.data?.usuario?._id);
19736
19737
  }, [
19737
19738
  usuario_id
19738
19739
  ]);
19739
- return /*#__PURE__*/ jsx("div", {
19740
- className: "w-full max-w-sm",
19741
- children: /*#__PURE__*/ jsxs("div", {
19742
- className: " relative bg-white rounded-xl border border-gray-200 p-4 transition-all duration-200 hover:border-blue-300 hover:shadow-md ",
19743
- children: [
19744
- /*#__PURE__*/ jsxs("div", {
19745
- className: "flex items-center justify-between mb-3",
19740
+ return /*#__PURE__*/ jsxs("div", {
19741
+ className: "flex items-center gap-2 bg-gradient-to-r transition-all duration-200",
19742
+ children: [
19743
+ /*#__PURE__*/ jsx("div", {
19744
+ className: "flex items-center justify-center w-6 h-6 rounded-md bg-gradient-to-br from-blue-500 to-cyan-500 shadow-sm",
19745
+ children: /*#__PURE__*/ jsx("svg", {
19746
+ className: "w-3.5 h-3.5 text-white",
19747
+ fill: "none",
19748
+ stroke: "currentColor",
19749
+ viewBox: "0 0 24 24",
19750
+ children: /*#__PURE__*/ jsx("path", {
19751
+ strokeLinecap: "round",
19752
+ strokeLinejoin: "round",
19753
+ strokeWidth: 2.5,
19754
+ d: "M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
19755
+ })
19756
+ })
19757
+ }),
19758
+ /*#__PURE__*/ jsx("div", {
19759
+ className: "flex items-center gap-2",
19760
+ children: loading ? /*#__PURE__*/ jsx("div", {
19761
+ className: "w-12 h-5 bg-blue-200/50 rounded animate-pulse"
19762
+ }) : /*#__PURE__*/ jsxs(Fragment, {
19746
19763
  children: [
19747
19764
  /*#__PURE__*/ jsxs("div", {
19748
- className: "flex items-center gap-2",
19765
+ className: "flex items-baseline gap-1",
19749
19766
  children: [
19750
- /*#__PURE__*/ jsx("div", {
19751
- className: "w-8 h-8 rounded-lg bg-gradient-to-br from-blue-500 to-cyan-500 flex items-center justify-center",
19752
- children: /*#__PURE__*/ jsx("svg", {
19753
- className: "w-4 h-4 text-white",
19754
- fill: "none",
19755
- stroke: "currentColor",
19756
- viewBox: "0 0 24 24",
19757
- children: /*#__PURE__*/ jsx("path", {
19758
- strokeLinecap: "round",
19759
- strokeLinejoin: "round",
19760
- strokeWidth: 2,
19761
- d: "M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
19762
- })
19763
- })
19767
+ /*#__PURE__*/ jsx("span", {
19768
+ className: "text-lg font-bold bg-gradient-to-r from-blue-600 to-cyan-600 bg-clip-text text-transparent leading-none",
19769
+ children: quantidade.toLocaleString("pt-BR")
19764
19770
  }),
19765
19771
  /*#__PURE__*/ jsx("span", {
19766
- className: "text-sm font-medium text-gray-700",
19772
+ className: "text-xs text-gray-500 font-medium hidden sm:inline",
19767
19773
  children: label
19768
19774
  })
19769
19775
  ]
19770
19776
  }),
19771
- loading && /*#__PURE__*/ jsx("div", {
19772
- className: "w-4 h-4 rounded-full border-2 border-gray-200 border-t-blue-500 animate-spin"
19777
+ 0 === quantidade && /*#__PURE__*/ jsx("svg", {
19778
+ className: "w-4 h-4 text-amber-500 sm:hidden",
19779
+ fill: "currentColor",
19780
+ viewBox: "0 0 20 20",
19781
+ children: /*#__PURE__*/ jsx("path", {
19782
+ fillRule: "evenodd",
19783
+ d: "M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",
19784
+ clipRule: "evenodd"
19785
+ })
19773
19786
  })
19774
19787
  ]
19775
- }),
19776
- /*#__PURE__*/ jsx("div", {
19777
- className: "flex items-baseline gap-2 mb-2",
19778
- children: loading ? /*#__PURE__*/ jsx("div", {
19779
- className: "h-9 w-20 bg-gray-100 rounded animate-pulse"
19780
- }) : /*#__PURE__*/ jsxs(Fragment, {
19781
- children: [
19782
- /*#__PURE__*/ jsx("span", {
19783
- className: "text-3xl font-bold bg-gradient-to-r from-blue-600 to-cyan-600 bg-clip-text text-transparent",
19784
- children: quantidade.toLocaleString("pt-BR")
19785
- }),
19786
- /*#__PURE__*/ jsx("span", {
19787
- className: "text-sm text-gray-500 font-medium",
19788
- children: 1 === quantidade ? "crédito" : "créditos"
19789
- })
19790
- ]
19791
- })
19792
- }),
19793
- !loading && /*#__PURE__*/ jsx(Fragment, {
19794
- children: 0 === quantidade ? /*#__PURE__*/ jsxs("div", {
19795
- className: "flex items-center gap-1.5 text-xs text-gray-500",
19796
- children: [
19797
- /*#__PURE__*/ jsx("svg", {
19798
- className: "w-3.5 h-3.5",
19799
- fill: "none",
19800
- stroke: "currentColor",
19801
- viewBox: "0 0 24 24",
19802
- children: /*#__PURE__*/ jsx("path", {
19803
- strokeLinecap: "round",
19804
- strokeLinejoin: "round",
19805
- strokeWidth: 2,
19806
- d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
19807
- })
19808
- }),
19809
- /*#__PURE__*/ jsx("span", {
19810
- children: "Nenhum cr\xe9dito dispon\xedvel"
19811
- })
19812
- ]
19813
- }) : /*#__PURE__*/ jsxs("div", {
19814
- className: "flex items-center gap-2",
19815
- children: [
19816
- /*#__PURE__*/ jsx("div", {
19817
- className: "flex-1 h-1 bg-gray-100 rounded-full overflow-hidden",
19818
- children: /*#__PURE__*/ jsx("div", {
19819
- className: "h-full bg-gradient-to-r from-blue-500 to-cyan-500 rounded-full transition-all duration-500",
19820
- style: {
19821
- width: Math.min(quantidade / 100 * 100, 100) + "%"
19822
- }
19823
- })
19824
- }),
19825
- quantidade < 100 && /*#__PURE__*/ jsxs("span", {
19826
- className: "text-xs font-medium text-gray-400",
19827
- children: [
19828
- quantidade,
19829
- "%"
19830
- ]
19831
- })
19832
- ]
19833
- })
19834
19788
  })
19835
- ]
19836
- })
19789
+ }),
19790
+ loading && /*#__PURE__*/ jsx("div", {
19791
+ className: "w-3.5 h-3.5 rounded-full border-2 border-blue-200 border-t-blue-600 animate-spin"
19792
+ })
19793
+ ]
19837
19794
  });
19838
19795
  }
19839
- export { CheckoutAssinaturaStripe, CheckoutStripe, shared_types as TypesAssinatura, VisualizarCreditos, contexto_assinatura };
19796
+ export { CheckoutAssinaturaStripe, CheckoutStripe, shared_types as TypesAssinatura, VisualizarCreditos, contexto_assinatura, contexto_creditos };
@@ -32,6 +32,7 @@ declare namespace t {
32
32
  Bindings: Geral.Env;
33
33
  Variables: {
34
34
  usuario_auth: TypesCore.Controller.Usuario.TokenPayload;
35
+ token: string;
35
36
  };
36
37
  };
37
38
  type Context = HonoContext<Env>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navservice/assinatura",
3
- "version": "1.53.0",
3
+ "version": "1.55.0",
4
4
  "description": "Service de autenticação de usuários unificado",
5
5
  "type": "module",
6
6
  "main": "./build/lib/index.js",