@navservice/assinatura 1.51.0 → 1.53.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.
@@ -43,25 +43,6 @@ export declare const schema_assinatura: import("drizzle-orm/sqlite-core").SQLite
43
43
  }, {}, {
44
44
  length: number | undefined;
45
45
  }>;
46
- usuario_tipo: import("drizzle-orm/sqlite-core").SQLiteColumn<{
47
- name: "usuario_tipo";
48
- tableName: "assinatura";
49
- dataType: "string";
50
- columnType: "SQLiteText";
51
- data: "padrao";
52
- driverParam: string;
53
- notNull: true;
54
- hasDefault: false;
55
- isPrimaryKey: false;
56
- isAutoincrement: false;
57
- hasRuntimeDefault: false;
58
- enumValues: ["padrao"];
59
- baseColumn: never;
60
- identity: undefined;
61
- generated: undefined;
62
- }, {}, {
63
- length: number | undefined;
64
- }>;
65
46
  app: import("drizzle-orm/sqlite-core").SQLiteColumn<{
66
47
  name: "app";
67
48
  tableName: "assinatura";
@@ -223,6 +204,25 @@ export declare const schema_assinatura: import("drizzle-orm/sqlite-core").SQLite
223
204
  }, {}, {
224
205
  length: number | undefined;
225
206
  }>;
207
+ plano_name: import("drizzle-orm/sqlite-core").SQLiteColumn<{
208
+ name: "plano_name";
209
+ tableName: "assinatura";
210
+ dataType: "string";
211
+ columnType: "SQLiteText";
212
+ data: "FREE" | "ESSENTIAL" | "BUSINESS" | "ENTERPRISE";
213
+ driverParam: string;
214
+ notNull: true;
215
+ hasDefault: true;
216
+ isPrimaryKey: false;
217
+ isAutoincrement: false;
218
+ hasRuntimeDefault: false;
219
+ enumValues: ["FREE", "ESSENTIAL", "BUSINESS", "ENTERPRISE"];
220
+ baseColumn: never;
221
+ identity: undefined;
222
+ generated: undefined;
223
+ }, {}, {
224
+ length: number | undefined;
225
+ }>;
226
226
  gateway_subscription_id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
227
227
  name: "gateway_subscription_id";
228
228
  tableName: "assinatura";
@@ -0,0 +1,6 @@
1
+ interface VisualizarCreditosProps {
2
+ usuario_id: string;
3
+ label?: string;
4
+ }
5
+ export declare function VisualizarCreditos({ usuario_id, label }: VisualizarCreditosProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,15 @@
1
+ import t from "../../../shared/types";
2
+ interface CreditosState {
3
+ creditos: t.Controller.Creditos.BuscarPeloUsuarioId.Output | undefined;
4
+ quantidade: number;
5
+ loading: boolean;
6
+ }
7
+ export declare const contexto_creditos: {
8
+ api: {
9
+ buscar_pelo_usuario_id: (usuario_id: string) => Promise<number | null>;
10
+ };
11
+ get get_jsx(): CreditosState;
12
+ get get_state(): CreditosState;
13
+ set_state: (updater: (state: CreditosState) => void) => void;
14
+ };
15
+ export {};
@@ -2,3 +2,4 @@ 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 { VisualizarCreditos } from "./componentes/geral/VisualizarCreditos";
package/build/es/index.js CHANGED
@@ -2791,7 +2791,7 @@ class Doc {
2791
2791
  const versions_version = {
2792
2792
  major: 4,
2793
2793
  minor: 3,
2794
- patch: 5
2794
+ patch: 6
2795
2795
  };
2796
2796
  const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def)=>{
2797
2797
  var _a;
@@ -3976,7 +3976,7 @@ const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def)=>{
3976
3976
  issues: []
3977
3977
  }, ctx);
3978
3978
  if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
3979
- const checkNumericKey = "string" == typeof key && regexes_number.test(key) && keyResult.issues.length && keyResult.issues.some((iss)=>"invalid_type" === iss.code && "number" === iss.expected);
3979
+ const checkNumericKey = "string" == typeof key && regexes_number.test(key) && keyResult.issues.length;
3980
3980
  if (checkNumericKey) {
3981
3981
  const retryResult = def.keyType._zod.run({
3982
3982
  value: Number(key),
@@ -11532,7 +11532,7 @@ function finalize(ctx, schema) {
11532
11532
  if (!(key in _cached)) delete schema[key];
11533
11533
  }
11534
11534
  }
11535
- if (refSchema.$ref) {
11535
+ if (refSchema.$ref && refSeen.def) {
11536
11536
  for(const key in schema)if ("$ref" !== key && "allOf" !== key) {
11537
11537
  if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) delete schema[key];
11538
11538
  }
@@ -13776,23 +13776,23 @@ const kindOfTest = (type)=>{
13776
13776
  };
13777
13777
  const typeOfTest = (type)=>(thing)=>typeof thing === type;
13778
13778
  const { isArray: utils_isArray } = Array;
13779
- const isUndefined = typeOfTest('undefined');
13779
+ const isUndefined = typeOfTest("undefined");
13780
13780
  function isBuffer(val) {
13781
13781
  return null !== val && !isUndefined(val) && null !== val.constructor && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
13782
13782
  }
13783
- const isArrayBuffer = kindOfTest('ArrayBuffer');
13783
+ const isArrayBuffer = kindOfTest("ArrayBuffer");
13784
13784
  function isArrayBufferView(val) {
13785
13785
  let result;
13786
- result = 'undefined' != typeof ArrayBuffer && ArrayBuffer.isView ? ArrayBuffer.isView(val) : val && val.buffer && isArrayBuffer(val.buffer);
13786
+ result = "undefined" != typeof ArrayBuffer && ArrayBuffer.isView ? ArrayBuffer.isView(val) : val && val.buffer && isArrayBuffer(val.buffer);
13787
13787
  return result;
13788
13788
  }
13789
- const isString = typeOfTest('string');
13790
- const isFunction = typeOfTest('function');
13791
- const isNumber = typeOfTest('number');
13792
- const utils_isObject = (thing)=>null !== thing && 'object' == typeof thing;
13789
+ const isString = typeOfTest("string");
13790
+ const isFunction = typeOfTest("function");
13791
+ const isNumber = typeOfTest("number");
13792
+ const utils_isObject = (thing)=>null !== thing && "object" == typeof thing;
13793
13793
  const isBoolean = (thing)=>true === thing || false === thing;
13794
13794
  const utils_isPlainObject = (val)=>{
13795
- if ('object' !== kindOf(val)) return false;
13795
+ if ("object" !== kindOf(val)) return false;
13796
13796
  const prototype = getPrototypeOf(val);
13797
13797
  return (null === prototype || prototype === Object.prototype || null === Object.getPrototypeOf(prototype)) && !(toStringTag in val) && !(utils_iterator in val);
13798
13798
  };
@@ -13804,28 +13804,28 @@ const isEmptyObject = (val)=>{
13804
13804
  return false;
13805
13805
  }
13806
13806
  };
13807
- const utils_isDate = kindOfTest('Date');
13808
- const isFile = kindOfTest('File');
13809
- const isBlob = kindOfTest('Blob');
13810
- const utils_isFileList = kindOfTest('FileList');
13807
+ const utils_isDate = kindOfTest("Date");
13808
+ const isFile = kindOfTest("File");
13809
+ const isBlob = kindOfTest("Blob");
13810
+ const utils_isFileList = kindOfTest("FileList");
13811
13811
  const isStream = (val)=>utils_isObject(val) && isFunction(val.pipe);
13812
13812
  const utils_isFormData = (thing)=>{
13813
13813
  let kind;
13814
- return thing && ('function' == typeof FormData && thing instanceof FormData || isFunction(thing.append) && ('formdata' === (kind = kindOf(thing)) || 'object' === kind && isFunction(thing.toString) && '[object FormData]' === thing.toString()));
13814
+ return thing && ("function" == typeof FormData && thing instanceof FormData || isFunction(thing.append) && ("formdata" === (kind = kindOf(thing)) || "object" === kind && isFunction(thing.toString) && "[object FormData]" === thing.toString()));
13815
13815
  };
13816
- const isURLSearchParams = kindOfTest('URLSearchParams');
13816
+ const isURLSearchParams = kindOfTest("URLSearchParams");
13817
13817
  const [isReadableStream, isRequest, isResponse, isHeaders] = [
13818
- 'ReadableStream',
13819
- 'Request',
13820
- 'Response',
13821
- 'Headers'
13818
+ "ReadableStream",
13819
+ "Request",
13820
+ "Response",
13821
+ "Headers"
13822
13822
  ].map(kindOfTest);
13823
- const trim = (str)=>str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
13823
+ const trim = (str)=>str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
13824
13824
  function forEach(obj, fn, { allOwnKeys = false } = {}) {
13825
13825
  if (null == obj) return;
13826
13826
  let i;
13827
13827
  let l;
13828
- if ('object' != typeof obj) obj = [
13828
+ if ("object" != typeof obj) obj = [
13829
13829
  obj
13830
13830
  ];
13831
13831
  if (utils_isArray(obj)) for(i = 0, l = obj.length; i < l; i++)fn.call(null, obj[i], i, obj);
@@ -13854,13 +13854,14 @@ function findKey(obj, key) {
13854
13854
  }
13855
13855
  const _global = (()=>{
13856
13856
  if ("undefined" != typeof globalThis) return globalThis;
13857
- return "undefined" != typeof self ? self : 'undefined' != typeof window ? window : global;
13857
+ return "undefined" != typeof self ? self : "undefined" != typeof window ? window : global;
13858
13858
  })();
13859
13859
  const isContextDefined = (context)=>!isUndefined(context) && context !== _global;
13860
13860
  function utils_merge() {
13861
13861
  const { caseless, skipUndefined } = isContextDefined(this) && this || {};
13862
13862
  const result = {};
13863
13863
  const assignValue = (val, key)=>{
13864
+ if ("__proto__" === key || "constructor" === key || "prototype" === key) return;
13864
13865
  const targetKey = caseless && findKey(result, key) || key;
13865
13866
  if (utils_isPlainObject(result[targetKey]) && utils_isPlainObject(val)) result[targetKey] = utils_merge(result[targetKey], val);
13866
13867
  else if (utils_isPlainObject(val)) result[targetKey] = utils_merge({}, val);
@@ -13872,21 +13873,36 @@ function utils_merge() {
13872
13873
  }
13873
13874
  const utils_extend = (a, b, thisArg, { allOwnKeys } = {})=>{
13874
13875
  forEach(b, (val, key)=>{
13875
- if (thisArg && isFunction(val)) a[key] = bind(val, thisArg);
13876
- else a[key] = val;
13876
+ if (thisArg && isFunction(val)) Object.defineProperty(a, key, {
13877
+ value: bind(val, thisArg),
13878
+ writable: true,
13879
+ enumerable: true,
13880
+ configurable: true
13881
+ });
13882
+ else Object.defineProperty(a, key, {
13883
+ value: val,
13884
+ writable: true,
13885
+ enumerable: true,
13886
+ configurable: true
13887
+ });
13877
13888
  }, {
13878
13889
  allOwnKeys
13879
13890
  });
13880
13891
  return a;
13881
13892
  };
13882
13893
  const stripBOM = (content)=>{
13883
- if (0xFEFF === content.charCodeAt(0)) content = content.slice(1);
13894
+ if (0xfeff === content.charCodeAt(0)) content = content.slice(1);
13884
13895
  return content;
13885
13896
  };
13886
13897
  const inherits = (constructor, superConstructor, props, descriptors)=>{
13887
13898
  constructor.prototype = Object.create(superConstructor.prototype, descriptors);
13888
- constructor.prototype.constructor = constructor;
13889
- Object.defineProperty(constructor, 'super', {
13899
+ Object.defineProperty(constructor.prototype, "constructor", {
13900
+ value: constructor,
13901
+ writable: true,
13902
+ enumerable: false,
13903
+ configurable: true
13904
+ });
13905
+ Object.defineProperty(constructor, "super", {
13890
13906
  value: superConstructor.prototype
13891
13907
  });
13892
13908
  props && Object.assign(constructor.prototype, props);
@@ -13928,7 +13944,7 @@ const toArray = (thing)=>{
13928
13944
  while(i-- > 0)arr[i] = thing[i];
13929
13945
  return arr;
13930
13946
  };
13931
- const isTypedArray = ((TypedArray)=>(thing)=>TypedArray && thing instanceof TypedArray)('undefined' != typeof Uint8Array && getPrototypeOf(Uint8Array));
13947
+ const isTypedArray = ((TypedArray)=>(thing)=>TypedArray && thing instanceof TypedArray)("undefined" != typeof Uint8Array && getPrototypeOf(Uint8Array));
13932
13948
  const forEachEntry = (obj, fn)=>{
13933
13949
  const generator = obj && obj[utils_iterator];
13934
13950
  const _iterator = generator.call(obj);
@@ -13944,12 +13960,12 @@ const matchAll = (regExp, str)=>{
13944
13960
  while(null !== (matches = regExp.exec(str)))arr.push(matches);
13945
13961
  return arr;
13946
13962
  };
13947
- const isHTMLForm = kindOfTest('HTMLFormElement');
13963
+ const isHTMLForm = kindOfTest("HTMLFormElement");
13948
13964
  const utils_toCamelCase = (str)=>str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function(m, p1, p2) {
13949
13965
  return p1.toUpperCase() + p2;
13950
13966
  });
13951
13967
  const utils_hasOwnProperty = (({ hasOwnProperty })=>(obj, prop)=>hasOwnProperty.call(obj, prop))(Object.prototype);
13952
- const isRegExp = kindOfTest('RegExp');
13968
+ const isRegExp = kindOfTest("RegExp");
13953
13969
  const reduceDescriptors = (obj, reducer)=>{
13954
13970
  const descriptors = Object.getOwnPropertyDescriptors(obj);
13955
13971
  const reducedDescriptors = {};
@@ -13962,19 +13978,19 @@ const reduceDescriptors = (obj, reducer)=>{
13962
13978
  const freezeMethods = (obj)=>{
13963
13979
  reduceDescriptors(obj, (descriptor, name)=>{
13964
13980
  if (isFunction(obj) && -1 !== [
13965
- 'arguments',
13966
- 'caller',
13967
- 'callee'
13981
+ "arguments",
13982
+ "caller",
13983
+ "callee"
13968
13984
  ].indexOf(name)) return false;
13969
13985
  const value = obj[name];
13970
13986
  if (!isFunction(value)) return;
13971
13987
  descriptor.enumerable = false;
13972
- if ('writable' in descriptor) {
13988
+ if ("writable" in descriptor) {
13973
13989
  descriptor.writable = false;
13974
13990
  return;
13975
13991
  }
13976
13992
  if (!descriptor.set) descriptor.set = ()=>{
13977
- throw Error('Can not rewrite read-only method \'' + name + '\'');
13993
+ throw Error("Can not rewrite read-only method '" + name + "'");
13978
13994
  };
13979
13995
  });
13980
13996
  };
@@ -13991,7 +14007,7 @@ const toObjectSet = (arrayOrString, delimiter)=>{
13991
14007
  const noop = ()=>{};
13992
14008
  const toFiniteNumber = (value, defaultValue)=>null != value && Number.isFinite(value *= 1) ? value : defaultValue;
13993
14009
  function isSpecCompliantForm(thing) {
13994
- return !!(thing && isFunction(thing.append) && 'FormData' === thing[toStringTag] && thing[utils_iterator]);
14010
+ return !!(thing && isFunction(thing.append) && "FormData" === thing[toStringTag] && thing[utils_iterator]);
13995
14011
  }
13996
14012
  const toJSONObject = (obj)=>{
13997
14013
  const stack = new Array(10);
@@ -13999,7 +14015,7 @@ const toJSONObject = (obj)=>{
13999
14015
  if (utils_isObject(source)) {
14000
14016
  if (stack.indexOf(source) >= 0) return;
14001
14017
  if (isBuffer(source)) return source;
14002
- if (!('toJSON' in source)) {
14018
+ if (!("toJSON" in source)) {
14003
14019
  stack[i] = source;
14004
14020
  const target = utils_isArray(source) ? [] : {};
14005
14021
  forEach(source, (value, key)=>{
@@ -14014,7 +14030,7 @@ const toJSONObject = (obj)=>{
14014
14030
  };
14015
14031
  return visit(obj, 0);
14016
14032
  };
14017
- const isAsyncFn = kindOfTest('AsyncFunction');
14033
+ const isAsyncFn = kindOfTest("AsyncFunction");
14018
14034
  const isThenable = (thing)=>thing && (utils_isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
14019
14035
  const _setImmediate = ((setImmediateSupported, postMessageSupported)=>{
14020
14036
  if (setImmediateSupported) return setImmediate;
@@ -14027,8 +14043,8 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported)=>{
14027
14043
  _global.postMessage(token, "*");
14028
14044
  };
14029
14045
  })(`axios@${Math.random()}`, []) : (cb)=>setTimeout(cb);
14030
- })('function' == typeof setImmediate, isFunction(_global.postMessage));
14031
- const asap = 'undefined' != typeof queueMicrotask ? queueMicrotask.bind(_global) : 'undefined' != typeof process && process.nextTick || _setImmediate;
14046
+ })("function" == typeof setImmediate, isFunction(_global.postMessage));
14047
+ const asap = "undefined" != typeof queueMicrotask ? queueMicrotask.bind(_global) : "undefined" != typeof process && process.nextTick || _setImmediate;
14032
14048
  const isIterable = (thing)=>null != thing && isFunction(thing[utils_iterator]);
14033
14049
  const utils = {
14034
14050
  isArray: utils_isArray,
@@ -14089,22 +14105,27 @@ const utils = {
14089
14105
  asap,
14090
14106
  isIterable
14091
14107
  };
14092
- function AxiosError(message, code, config, request, response) {
14093
- Error.call(this);
14094
- if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
14095
- else this.stack = new Error().stack;
14096
- this.message = message;
14097
- this.name = 'AxiosError';
14098
- code && (this.code = code);
14099
- config && (this.config = config);
14100
- request && (this.request = request);
14101
- if (response) {
14102
- this.response = response;
14103
- this.status = response.status ? response.status : null;
14104
- }
14105
- }
14106
- utils.inherits(AxiosError, Error, {
14107
- toJSON: function() {
14108
+ class AxiosError extends Error {
14109
+ static from(error, code, config, request, response, customProps) {
14110
+ const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
14111
+ axiosError.cause = error;
14112
+ axiosError.name = error.name;
14113
+ customProps && Object.assign(axiosError, customProps);
14114
+ return axiosError;
14115
+ }
14116
+ constructor(message, code, config, request, response){
14117
+ super(message);
14118
+ this.name = 'AxiosError';
14119
+ this.isAxiosError = true;
14120
+ code && (this.code = code);
14121
+ config && (this.config = config);
14122
+ request && (this.request = request);
14123
+ if (response) {
14124
+ this.response = response;
14125
+ this.status = response.status;
14126
+ }
14127
+ }
14128
+ toJSON() {
14108
14129
  return {
14109
14130
  message: this.message,
14110
14131
  name: this.name,
@@ -14119,47 +14140,19 @@ utils.inherits(AxiosError, Error, {
14119
14140
  status: this.status
14120
14141
  };
14121
14142
  }
14122
- });
14123
- const AxiosError_prototype = AxiosError.prototype;
14124
- const AxiosError_descriptors = {};
14125
- [
14126
- 'ERR_BAD_OPTION_VALUE',
14127
- 'ERR_BAD_OPTION',
14128
- 'ECONNABORTED',
14129
- 'ETIMEDOUT',
14130
- 'ERR_NETWORK',
14131
- 'ERR_FR_TOO_MANY_REDIRECTS',
14132
- 'ERR_DEPRECATED',
14133
- 'ERR_BAD_RESPONSE',
14134
- 'ERR_BAD_REQUEST',
14135
- 'ERR_CANCELED',
14136
- 'ERR_NOT_SUPPORT',
14137
- 'ERR_INVALID_URL'
14138
- ].forEach((code)=>{
14139
- AxiosError_descriptors[code] = {
14140
- value: code
14141
- };
14142
- });
14143
- Object.defineProperties(AxiosError, AxiosError_descriptors);
14144
- Object.defineProperty(AxiosError_prototype, 'isAxiosError', {
14145
- value: true
14146
- });
14147
- AxiosError.from = (error, code, config, request, response, customProps)=>{
14148
- const axiosError = Object.create(AxiosError_prototype);
14149
- utils.toFlatObject(error, axiosError, function(obj) {
14150
- return obj !== Error.prototype;
14151
- }, (prop)=>'isAxiosError' !== prop);
14152
- const msg = error && error.message ? error.message : 'Error';
14153
- const errCode = null == code && error ? error.code : code;
14154
- AxiosError.call(axiosError, msg, errCode, config, request, response);
14155
- if (error && null == axiosError.cause) Object.defineProperty(axiosError, 'cause', {
14156
- value: error,
14157
- configurable: true
14158
- });
14159
- axiosError.name = error && error.name || 'Error';
14160
- customProps && Object.assign(axiosError, customProps);
14161
- return axiosError;
14162
- };
14143
+ }
14144
+ AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
14145
+ AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
14146
+ AxiosError.ECONNABORTED = 'ECONNABORTED';
14147
+ AxiosError.ETIMEDOUT = 'ETIMEDOUT';
14148
+ AxiosError.ERR_NETWORK = 'ERR_NETWORK';
14149
+ AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
14150
+ AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
14151
+ AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
14152
+ AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
14153
+ AxiosError.ERR_CANCELED = 'ERR_CANCELED';
14154
+ AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
14155
+ AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
14163
14156
  const core_AxiosError = AxiosError;
14164
14157
  const helpers_null = null;
14165
14158
  function isVisitable(thing) {
@@ -14291,12 +14284,12 @@ function buildURL_encode(val) {
14291
14284
  function buildURL(url, params, options) {
14292
14285
  if (!params) return url;
14293
14286
  const _encode = options && options.encode || buildURL_encode;
14294
- if (utils.isFunction(options)) options = {
14287
+ const _options = utils.isFunction(options) ? {
14295
14288
  serialize: options
14296
- };
14297
- const serializeFn = options && options.serialize;
14289
+ } : options;
14290
+ const serializeFn = _options && _options.serialize;
14298
14291
  let serializedParams;
14299
- serializedParams = serializeFn ? serializeFn(params, options) : utils.isURLSearchParams(params) ? params.toString() : new helpers_AxiosURLSearchParams(params, options).toString(_encode);
14292
+ serializedParams = serializeFn ? serializeFn(params, _options) : utils.isURLSearchParams(params) ? params.toString() : new helpers_AxiosURLSearchParams(params, _options).toString(_encode);
14300
14293
  if (serializedParams) {
14301
14294
  const hashmarkIndex = url.indexOf("#");
14302
14295
  if (-1 !== hashmarkIndex) url = url.slice(0, hashmarkIndex);
@@ -14333,7 +14326,8 @@ const core_InterceptorManager = InterceptorManager;
14333
14326
  const defaults_transitional = {
14334
14327
  silentJSONParsing: true,
14335
14328
  forcedJSONParsing: true,
14336
- clarifyTimeoutError: false
14329
+ clarifyTimeoutError: false,
14330
+ legacyInterceptorReqResOrdering: true
14337
14331
  };
14338
14332
  const classes_URLSearchParams = 'undefined' != typeof URLSearchParams ? URLSearchParams : helpers_AxiosURLSearchParams;
14339
14333
  const classes_FormData = 'undefined' != typeof FormData ? FormData : null;
@@ -14780,13 +14774,13 @@ function transformData(fns, response) {
14780
14774
  function isCancel(value) {
14781
14775
  return !!(value && value.__CANCEL__);
14782
14776
  }
14783
- function CanceledError(message, config, request) {
14784
- core_AxiosError.call(this, null == message ? 'canceled' : message, core_AxiosError.ERR_CANCELED, config, request);
14785
- this.name = 'CanceledError';
14777
+ class CanceledError extends core_AxiosError {
14778
+ constructor(message, config, request){
14779
+ super(null == message ? 'canceled' : message, core_AxiosError.ERR_CANCELED, config, request);
14780
+ this.name = 'CanceledError';
14781
+ this.__CANCEL__ = true;
14782
+ }
14786
14783
  }
14787
- utils.inherits(CanceledError, core_AxiosError, {
14788
- __CANCEL__: true
14789
- });
14790
14784
  const cancel_CanceledError = CanceledError;
14791
14785
  function settle(resolve, reject, response) {
14792
14786
  const validateStatus = response.config.validateStatus;
@@ -14930,6 +14924,7 @@ const cookies = platform.hasStandardBrowserEnv ? {
14930
14924
  remove () {}
14931
14925
  };
14932
14926
  function isAbsoluteURL(url) {
14927
+ if ('string' != typeof url) return false;
14933
14928
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
14934
14929
  }
14935
14930
  function combineURLs(baseURL, relativeURL) {
@@ -15004,7 +14999,8 @@ function mergeConfig(config1, config2) {
15004
14999
  ...config1,
15005
15000
  ...config2
15006
15001
  }), function(prop) {
15007
- const merge = mergeMap[prop] || mergeDeepProperties;
15002
+ if ("__proto__" === prop || "constructor" === prop || "prototype" === prop) return;
15003
+ const merge = utils.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
15008
15004
  const configValue = merge(config1[prop], config2[prop], prop);
15009
15005
  utils.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
15010
15006
  });
@@ -15148,7 +15144,7 @@ const composeSignals = (signals, timeout)=>{
15148
15144
  };
15149
15145
  let timer = timeout && setTimeout(()=>{
15150
15146
  timer = null;
15151
- onabort(new core_AxiosError(`timeout ${timeout} of ms exceeded`, core_AxiosError.ETIMEDOUT));
15147
+ onabort(new core_AxiosError(`timeout of ${timeout}ms exceeded`, core_AxiosError.ETIMEDOUT));
15152
15148
  }, timeout);
15153
15149
  const unsubscribe = ()=>{
15154
15150
  if (signals) {
@@ -15378,10 +15374,10 @@ const factory = (env)=>{
15378
15374
  });
15379
15375
  } catch (err) {
15380
15376
  unsubscribe && unsubscribe();
15381
- if (err && 'TypeError' === err.name && /Load failed|fetch/i.test(err.message)) throw Object.assign(new core_AxiosError('Network Error', core_AxiosError.ERR_NETWORK, config, request), {
15377
+ if (err && 'TypeError' === err.name && /Load failed|fetch/i.test(err.message)) throw Object.assign(new core_AxiosError('Network Error', core_AxiosError.ERR_NETWORK, config, request, err && err.response), {
15382
15378
  cause: err.cause || err
15383
15379
  });
15384
- throw core_AxiosError.from(err, err && err.code, config, request);
15380
+ throw core_AxiosError.from(err, err && err.code, config, request, err && err.response);
15385
15381
  }
15386
15382
  };
15387
15383
  };
@@ -15501,7 +15497,7 @@ const validators = {};
15501
15497
  const deprecatedWarnings = {};
15502
15498
  validators.transitional = function(validator, version, message) {
15503
15499
  function formatMessage(opt, desc) {
15504
- return "[Axios v1.13.2] Transitional option '" + opt + '\'' + desc + (message ? '. ' + message : '');
15500
+ return "[Axios v1.13.5] Transitional option '" + opt + '\'' + desc + (message ? '. ' + message : '');
15505
15501
  }
15506
15502
  return (value, opt, opts)=>{
15507
15503
  if (false === validator) throw new core_AxiosError(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), core_AxiosError.ERR_DEPRECATED);
@@ -15574,7 +15570,8 @@ class Axios {
15574
15570
  if (void 0 !== transitional) helpers_validator.assertOptions(transitional, {
15575
15571
  silentJSONParsing: Axios_validators.transitional(Axios_validators.boolean),
15576
15572
  forcedJSONParsing: Axios_validators.transitional(Axios_validators.boolean),
15577
- clarifyTimeoutError: Axios_validators.transitional(Axios_validators.boolean)
15573
+ clarifyTimeoutError: Axios_validators.transitional(Axios_validators.boolean),
15574
+ legacyInterceptorReqResOrdering: Axios_validators.transitional(Axios_validators.boolean)
15578
15575
  }, false);
15579
15576
  if (null != paramsSerializer) if (utils.isFunction(paramsSerializer)) config.paramsSerializer = {
15580
15577
  serialize: paramsSerializer
@@ -15609,7 +15606,10 @@ class Axios {
15609
15606
  this.interceptors.request.forEach(function(interceptor) {
15610
15607
  if ('function' == typeof interceptor.runWhen && false === interceptor.runWhen(config)) return;
15611
15608
  synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
15612
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
15609
+ const transitional = config.transitional || defaults_transitional;
15610
+ const legacyInterceptorReqResOrdering = transitional && transitional.legacyInterceptorReqResOrdering;
15611
+ if (legacyInterceptorReqResOrdering) requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
15612
+ else requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
15613
15613
  });
15614
15614
  const responseInterceptorChain = [];
15615
15615
  this.interceptors.response.forEach(function(interceptor) {
@@ -15862,7 +15862,7 @@ axios.Axios = core_Axios;
15862
15862
  axios.CanceledError = cancel_CanceledError;
15863
15863
  axios.CancelToken = cancel_CancelToken;
15864
15864
  axios.isCancel = isCancel;
15865
- axios.VERSION = "1.13.2";
15865
+ axios.VERSION = "1.13.5";
15866
15866
  axios.toFormData = helpers_toFormData;
15867
15867
  axios.AxiosError = core_AxiosError;
15868
15868
  axios.Cancel = axios.CanceledError;
@@ -15883,7 +15883,7 @@ const lib_axios = axios;
15883
15883
  "FREE",
15884
15884
  "ESSENTIAL",
15885
15885
  "BUSINESS",
15886
- "ULTIMATE"
15886
+ "ENTERPRISE"
15887
15887
  ];
15888
15888
  TypeControllerUsuario.AppEnum = [
15889
15889
  "service-usuario",
@@ -18751,9 +18751,6 @@ const AssinaturaStatusEnum = [
18751
18751
  sqliteTable('assinatura', {
18752
18752
  _id: text_text("_id").primaryKey().$defaultFn(()=>dist_v4()),
18753
18753
  usuario_id: text_text('usuario_id').notNull(),
18754
- usuario_tipo: text_text('usuario_tipo', {
18755
- enum: es_types.Controller.Usuario.UsuarioTipoEnum
18756
- }).notNull(),
18757
18754
  app: text_text('app', {
18758
18755
  enum: es_types.Controller.Usuario.AppEnum
18759
18756
  }).notNull(),
@@ -18767,22 +18764,26 @@ sqliteTable('assinatura', {
18767
18764
  valor: integer_integer('valor').notNull(),
18768
18765
  moeda: text_text('moeda').default("usd").notNull(),
18769
18766
  plano_id: text_text('plano_id'),
18767
+ plano_name: text_text('plano_name', {
18768
+ enum: es_types.Controller.Usuario.PlanNameEnum
18769
+ }).default("FREE").notNull(),
18770
18770
  gateway_subscription_id: text_text("gateway_subscription_id"),
18771
18771
  gateway_customer_id: text_text("gateway_customer_id"),
18772
18772
  ativo: integer_integer('ativo').default(1).notNull().$type(),
18773
18773
  price_id: text_text("price_id"),
18774
18774
  stripe_latest_invoice_id: text_text("stripe_latest_invoice_id")
18775
18775
  }, (table)=>[
18776
- uniqueIndex("assinatura_unica_por_app").on(table.app, table.usuario_id)
18776
+ uniqueIndex("assinatura_unica_por_app").on(table.app, table.usuario_id),
18777
+ uniqueIndex("assinatura_gateway_por_app").on(table.app, table.gateway_customer_id)
18777
18778
  ]);
18778
18779
  (function(TypeControllerAssinatura) {
18779
18780
  const AppEnumZod = v4["enum"](es_types.Controller.Usuario.AppEnum);
18780
18781
  const UsuarioTipoEnumZod = v4["enum"](es_types.Controller.Usuario.UsuarioTipoEnum);
18781
18782
  const AssinaturaStatusZod = v4["enum"](AssinaturaStatusEnum);
18783
+ const PlanNameEnum = v4["enum"](es_types.Controller.Usuario.PlanNameEnum);
18782
18784
  TypeControllerAssinatura.AssinaturaBaseSchema = v4.object({
18783
18785
  _id: v4.string(),
18784
18786
  usuario_id: v4.string(),
18785
- usuario_tipo: UsuarioTipoEnumZod,
18786
18787
  app: AppEnumZod,
18787
18788
  data_criacao: v4.number(),
18788
18789
  data_atualizacao: v4.number().nullable().optional(),
@@ -18792,6 +18793,7 @@ sqliteTable('assinatura', {
18792
18793
  valor: v4.number(),
18793
18794
  moeda: v4.string(),
18794
18795
  plano_id: v4.string().nullable().optional(),
18796
+ plano_name: PlanNameEnum,
18795
18797
  gateway_subscription_id: v4.string().nullable().optional(),
18796
18798
  gateway_customer_id: v4.string().nullable().optional(),
18797
18799
  price_id: v4.string().nullable().optional(),
@@ -18809,6 +18811,7 @@ sqliteTable('assinatura', {
18809
18811
  usuario_id: v4.uuidv4(),
18810
18812
  usuario_tipo: UsuarioTipoEnumZod,
18811
18813
  app: AppEnumZod,
18814
+ plano_name: PlanNameEnum,
18812
18815
  plano_id: v4.string().nullable().optional(),
18813
18816
  gateway_subscription_id: v4.string().nullable().optional(),
18814
18817
  gateway_customer_id: v4.string().nullable().optional(),
@@ -18862,6 +18865,7 @@ sqliteTable('assinatura', {
18862
18865
  assinatura: v4.object({
18863
18866
  usuario_id: v4.uuidv4(),
18864
18867
  plano_id: v4.string().nullable().optional(),
18868
+ plano_name: PlanNameEnum.nullable().optional(),
18865
18869
  status: AssinaturaStatusZod.optional(),
18866
18870
  valor: v4.number().optional(),
18867
18871
  moeda: v4.string().optional(),
@@ -18936,7 +18940,9 @@ var assinatura_TypeControllerAssinatura;
18936
18940
  client_stripe_id: v4.string(),
18937
18941
  nome: v4.string(),
18938
18942
  email: v4.string(),
18939
- data_criacao: v4.number()
18943
+ data_criacao: v4.number(),
18944
+ creditos: v4.number(),
18945
+ data_ultimo_incremento_creditos: v4.number()
18940
18946
  });
18941
18947
  (function(Criar) {
18942
18948
  Criar.route = "/api/cliente";
@@ -18965,14 +18971,14 @@ var assinatura_TypeControllerAssinatura;
18965
18971
  })
18966
18972
  });
18967
18973
  })(TypeControllerCliente.BuscarPeloFiltro || (TypeControllerCliente.BuscarPeloFiltro = {}));
18968
- (function(BuscarPeloId) {
18969
- BuscarPeloId.route = "/api/cliente/:id";
18970
- BuscarPeloId.InputSchema = v4.object({
18974
+ (function(BuscarPeloAppEUsuarioId) {
18975
+ BuscarPeloAppEUsuarioId.route = "/api/cliente/:id";
18976
+ BuscarPeloAppEUsuarioId.InputSchema = v4.object({
18971
18977
  data: v4.object({
18972
18978
  usuario_id: v4.string()
18973
18979
  })
18974
18980
  });
18975
- })(TypeControllerCliente.BuscarPeloId || (TypeControllerCliente.BuscarPeloId = {}));
18981
+ })(TypeControllerCliente.BuscarPeloAppEUsuarioId || (TypeControllerCliente.BuscarPeloAppEUsuarioId = {}));
18976
18982
  (function(AtualizarPeloId) {
18977
18983
  AtualizarPeloId.route = "/api/cliente/:id";
18978
18984
  AtualizarPeloId.InputSchema = v4.object({
@@ -18981,22 +18987,67 @@ var assinatura_TypeControllerAssinatura;
18981
18987
  _id: v4.string(),
18982
18988
  client_stripe_id: v4.string().optional(),
18983
18989
  nome: v4.string().optional(),
18984
- email: v4.string().email().optional()
18990
+ email: v4.email().optional(),
18991
+ data_ultimo_incremento_creditos: v4.number().nullable().optional(),
18992
+ creditos: v4.number().nullable().optional()
18985
18993
  })
18986
18994
  })
18987
18995
  });
18988
18996
  })(TypeControllerCliente.AtualizarPeloId || (TypeControllerCliente.AtualizarPeloId = {}));
18989
- (function(DeletarPeloId) {
18990
- DeletarPeloId.route = "/api/cliente/:id";
18991
- DeletarPeloId.InputSchema = v4.object({
18992
- data: v4.object({
18993
- _id: v4.string()
18994
- })
18995
- });
18996
- })(TypeControllerCliente.DeletarPeloId || (TypeControllerCliente.DeletarPeloId = {}));
18997
18997
  })(cliente_TypeControllerCliente || (cliente_TypeControllerCliente = {}));
18998
18998
  const cliente = cliente_TypeControllerCliente;
18999
18999
  var cliente_TypeControllerCliente;
19000
+ (function(TypeControllerCreditos) {
19001
+ TypeControllerCreditos.TipoEnum = [
19002
+ "entrada",
19003
+ "saida",
19004
+ "bonus"
19005
+ ];
19006
+ TypeControllerCreditos.PontosBaseSchema = v4.object({
19007
+ _id: v4.string(),
19008
+ usuario_id: v4.string(),
19009
+ app: v4["enum"](es_types.Controller.Usuario.AppEnum),
19010
+ tipo: v4["enum"](TypeControllerCreditos.TipoEnum),
19011
+ quantidade: v4.number(),
19012
+ valor: v4.number(),
19013
+ data_criacao: v4.number(),
19014
+ data_atualizacao: v4.number().optional().nullable()
19015
+ });
19016
+ (function(BuscarPeloUsuarioId) {
19017
+ BuscarPeloUsuarioId.route = "/api/creditos/usuario/:id";
19018
+ BuscarPeloUsuarioId.InputSchema = v4.object({
19019
+ data: v4.object({
19020
+ creditos: v4.object({
19021
+ usuario_id: v4.string()
19022
+ })
19023
+ })
19024
+ });
19025
+ })(TypeControllerCreditos.BuscarPeloUsuarioId || (TypeControllerCreditos.BuscarPeloUsuarioId = {}));
19026
+ (function(UsarCreditosDoUsuario) {
19027
+ UsarCreditosDoUsuario.route = "/api/creditos/usuario/usar";
19028
+ UsarCreditosDoUsuario.InputSchema = v4.object({
19029
+ data: v4.object({
19030
+ creditos: v4.object({
19031
+ usuario_id: v4.string(),
19032
+ quantidade: v4.number().int().positive()
19033
+ })
19034
+ })
19035
+ });
19036
+ })(TypeControllerCreditos.UsarCreditosDoUsuario || (TypeControllerCreditos.UsarCreditosDoUsuario = {}));
19037
+ (function(CriarCheckoutCreditos) {
19038
+ CriarCheckoutCreditos.route = "/api/creditos/checkout";
19039
+ CriarCheckoutCreditos.InputSchema = v4.object({
19040
+ data: v4.object({
19041
+ checkout: v4.object({
19042
+ price: v4.int(),
19043
+ success_url: v4.url()
19044
+ })
19045
+ })
19046
+ });
19047
+ })(TypeControllerCreditos.CriarCheckoutCreditos || (TypeControllerCreditos.CriarCheckoutCreditos = {}));
19048
+ })(creditos_TypeControllerCreditos || (creditos_TypeControllerCreditos = {}));
19049
+ const creditos = creditos_TypeControllerCreditos;
19050
+ var creditos_TypeControllerCreditos;
19000
19051
  (function(TypeControllerResponse) {
19001
19052
  const StatusSchema = v4.union([
19002
19053
  v4.literal(200),
@@ -19081,6 +19132,7 @@ var type_response_TypeControllerResponse;
19081
19132
  (function(Controller) {
19082
19133
  Controller.Assinatura = assinatura;
19083
19134
  Controller.Cliente = cliente;
19135
+ Controller.Creditos = creditos;
19084
19136
  })(t.Controller || (t.Controller = {}));
19085
19137
  (function(Geral) {
19086
19138
  Geral.Response = type_response;
@@ -19630,4 +19682,158 @@ function CheckoutAssinaturaStripe() {
19630
19682
  ]
19631
19683
  });
19632
19684
  }
19633
- export { CheckoutAssinaturaStripe, CheckoutStripe, shared_types as TypesAssinatura, contexto_assinatura };
19685
+ const contexto_creditos_criar_estado_inicial = ()=>({
19686
+ creditos: void 0,
19687
+ quantidade: 0,
19688
+ loading: false
19689
+ });
19690
+ const contexto_creditos_store = react_create()(immer_immer(()=>({
19691
+ states: contexto_creditos_criar_estado_inicial()
19692
+ })));
19693
+ const contexto_creditos = new class {
19694
+ api = {
19695
+ buscar_pelo_usuario_id: async (usuario_id)=>{
19696
+ try {
19697
+ this.set_state((s)=>{
19698
+ s.loading = true;
19699
+ });
19700
+ const response = await src_utils.api.servidor_pricipal.get({
19701
+ baseURLKey: "PUBLIC_BASE_URL_SERVICE_ASSINATURA",
19702
+ url: shared_types.Controller.Creditos.BuscarPeloUsuarioId.route.replace(":id", usuario_id)
19703
+ });
19704
+ const data = response?.data?.results?.data ?? null;
19705
+ if (data?.creditos?.quantidade !== void 0) {
19706
+ this.set_state((s)=>{
19707
+ s.quantidade = data.creditos.quantidade;
19708
+ });
19709
+ return data.creditos.quantidade;
19710
+ }
19711
+ return null;
19712
+ } finally{
19713
+ this.set_state((s)=>{
19714
+ s.loading = false;
19715
+ });
19716
+ }
19717
+ }
19718
+ };
19719
+ get get_jsx() {
19720
+ return contexto_creditos_store().states;
19721
+ }
19722
+ get get_state() {
19723
+ return contexto_creditos_store.getState().states;
19724
+ }
19725
+ set_state = (updater)=>{
19726
+ contexto_creditos_store.setState((s)=>{
19727
+ updater(s.states);
19728
+ });
19729
+ };
19730
+ };
19731
+ function VisualizarCreditos({ usuario_id, label = "Seus créditos" }) {
19732
+ const { quantidade, loading } = contexto_creditos.get_jsx;
19733
+ useEffect(()=>{
19734
+ if (!usuario_id) return;
19735
+ contexto_creditos.api.buscar_pelo_usuario_id(usuario_id);
19736
+ }, [
19737
+ usuario_id
19738
+ ]);
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",
19746
+ children: [
19747
+ /*#__PURE__*/ jsxs("div", {
19748
+ className: "flex items-center gap-2",
19749
+ 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
+ })
19764
+ }),
19765
+ /*#__PURE__*/ jsx("span", {
19766
+ className: "text-sm font-medium text-gray-700",
19767
+ children: label
19768
+ })
19769
+ ]
19770
+ }),
19771
+ loading && /*#__PURE__*/ jsx("div", {
19772
+ className: "w-4 h-4 rounded-full border-2 border-gray-200 border-t-blue-500 animate-spin"
19773
+ })
19774
+ ]
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
+ })
19835
+ ]
19836
+ })
19837
+ });
19838
+ }
19839
+ export { CheckoutAssinaturaStripe, CheckoutStripe, shared_types as TypesAssinatura, VisualizarCreditos, contexto_assinatura };
@@ -2,14 +2,11 @@ import { AxiosResponse } from "axios";
2
2
  import Stripe from "stripe";
3
3
  import z4 from "zod/v4";
4
4
  import t from "..";
5
+ import { TypesCore } from "@navservice/core";
5
6
  declare namespace TypeControllerAssinatura {
6
- export type PlanName = "FREE" | "ESSENTIAL" | "BUSINESS" | "ULTIMATE";
7
7
  export const AssinaturaBaseSchema: z4.ZodObject<{
8
8
  _id: z4.ZodString;
9
9
  usuario_id: z4.ZodString;
10
- usuario_tipo: z4.ZodEnum<{
11
- padrao: "padrao";
12
- }>;
13
10
  app: z4.ZodEnum<{
14
11
  "service-usuario": "service-usuario";
15
12
  "service-pages": "service-pages";
@@ -33,6 +30,12 @@ declare namespace TypeControllerAssinatura {
33
30
  valor: z4.ZodNumber;
34
31
  moeda: z4.ZodString;
35
32
  plano_id: z4.ZodOptional<z4.ZodNullable<z4.ZodString>>;
33
+ plano_name: z4.ZodEnum<{
34
+ FREE: "FREE";
35
+ ESSENTIAL: "ESSENTIAL";
36
+ BUSINESS: "BUSINESS";
37
+ ENTERPRISE: "ENTERPRISE";
38
+ }>;
36
39
  gateway_subscription_id: z4.ZodOptional<z4.ZodNullable<z4.ZodString>>;
37
40
  gateway_customer_id: z4.ZodOptional<z4.ZodNullable<z4.ZodString>>;
38
41
  price_id: z4.ZodOptional<z4.ZodNullable<z4.ZodString>>;
@@ -55,6 +58,12 @@ declare namespace TypeControllerAssinatura {
55
58
  "service-assinatura": "service-assinatura";
56
59
  "service-bucket": "service-bucket";
57
60
  }>;
61
+ plano_name: z4.ZodEnum<{
62
+ FREE: "FREE";
63
+ ESSENTIAL: "ESSENTIAL";
64
+ BUSINESS: "BUSINESS";
65
+ ENTERPRISE: "ENTERPRISE";
66
+ }>;
58
67
  plano_id: z4.ZodOptional<z4.ZodNullable<z4.ZodString>>;
59
68
  gateway_subscription_id: z4.ZodOptional<z4.ZodNullable<z4.ZodString>>;
60
69
  gateway_customer_id: z4.ZodOptional<z4.ZodNullable<z4.ZodString>>;
@@ -146,7 +155,7 @@ declare namespace TypeControllerAssinatura {
146
155
  data: {
147
156
  assinatura: {
148
157
  status: AssinaturaBase["status"];
149
- plano: PlanName;
158
+ plano: TypesCore.Controller.Usuario.TokenPayload['plano_name'];
150
159
  };
151
160
  };
152
161
  };
@@ -159,6 +168,12 @@ declare namespace TypeControllerAssinatura {
159
168
  assinatura: z4.ZodObject<{
160
169
  usuario_id: z4.ZodUUID;
161
170
  plano_id: z4.ZodOptional<z4.ZodNullable<z4.ZodString>>;
171
+ plano_name: z4.ZodOptional<z4.ZodNullable<z4.ZodEnum<{
172
+ FREE: "FREE";
173
+ ESSENTIAL: "ESSENTIAL";
174
+ BUSINESS: "BUSINESS";
175
+ ENTERPRISE: "ENTERPRISE";
176
+ }>>>;
162
177
  status: z4.ZodOptional<z4.ZodEnum<{
163
178
  canceled: "canceled";
164
179
  incomplete: "incomplete";
@@ -9,6 +9,8 @@ declare namespace TypeControllerCliente {
9
9
  nome: z4.ZodString;
10
10
  email: z4.ZodString;
11
11
  data_criacao: z4.ZodNumber;
12
+ creditos: z4.ZodNumber;
13
+ data_ultimo_incremento_creditos: z4.ZodNumber;
12
14
  }, z4.core.$strip>;
13
15
  type Cliente = z4.infer<typeof ClienteBaseSchema>;
14
16
  namespace Criar {
@@ -58,7 +60,7 @@ declare namespace TypeControllerCliente {
58
60
  };
59
61
  type Response = AxiosResponse<t.Geral.Response.C.Output<Output>>;
60
62
  }
61
- namespace BuscarPeloId {
63
+ namespace BuscarPeloAppEUsuarioId {
62
64
  const route: "/api/cliente/:id";
63
65
  const InputSchema: z4.ZodObject<{
64
66
  data: z4.ZodObject<{
@@ -81,7 +83,9 @@ declare namespace TypeControllerCliente {
81
83
  _id: z4.ZodString;
82
84
  client_stripe_id: z4.ZodOptional<z4.ZodString>;
83
85
  nome: z4.ZodOptional<z4.ZodString>;
84
- email: z4.ZodOptional<z4.ZodString>;
86
+ email: z4.ZodOptional<z4.ZodEmail>;
87
+ data_ultimo_incremento_creditos: z4.ZodOptional<z4.ZodNullable<z4.ZodNumber>>;
88
+ creditos: z4.ZodOptional<z4.ZodNullable<z4.ZodNumber>>;
85
89
  }, z4.core.$strip>;
86
90
  }, z4.core.$strip>;
87
91
  }, z4.core.$strip>;
@@ -93,20 +97,5 @@ declare namespace TypeControllerCliente {
93
97
  };
94
98
  type Response = AxiosResponse<t.Geral.Response.C.Output<Output>>;
95
99
  }
96
- namespace DeletarPeloId {
97
- const route: "/api/cliente/:id";
98
- const InputSchema: z4.ZodObject<{
99
- data: z4.ZodObject<{
100
- _id: z4.ZodString;
101
- }, z4.core.$strip>;
102
- }, z4.core.$strip>;
103
- type Input = z4.infer<typeof InputSchema>;
104
- type Output = {
105
- data: {
106
- cliente: {};
107
- };
108
- };
109
- type Response = AxiosResponse<t.Geral.Response.C.Output<Output>>;
110
- }
111
100
  }
112
101
  export default TypeControllerCliente;
@@ -0,0 +1,87 @@
1
+ import { AxiosResponse } from "axios";
2
+ import z4 from "zod/v4";
3
+ import t from "../index";
4
+ declare namespace TypeControllerCreditos {
5
+ const TipoEnum: readonly ["entrada", "saida", "bonus"];
6
+ const PontosBaseSchema: z4.ZodObject<{
7
+ _id: z4.ZodString;
8
+ usuario_id: z4.ZodString;
9
+ app: z4.ZodEnum<{
10
+ "service-usuario": "service-usuario";
11
+ "service-pages": "service-pages";
12
+ "service-assinatura": "service-assinatura";
13
+ "service-bucket": "service-bucket";
14
+ }>;
15
+ tipo: z4.ZodEnum<{
16
+ entrada: "entrada";
17
+ saida: "saida";
18
+ bonus: "bonus";
19
+ }>;
20
+ quantidade: z4.ZodNumber;
21
+ valor: z4.ZodNumber;
22
+ data_criacao: z4.ZodNumber;
23
+ data_atualizacao: z4.ZodNullable<z4.ZodOptional<z4.ZodNumber>>;
24
+ }, z4.core.$strip>;
25
+ type Pontos = z4.infer<typeof PontosBaseSchema>;
26
+ namespace BuscarPeloUsuarioId {
27
+ const route: "/api/creditos/usuario/:id";
28
+ const InputSchema: z4.ZodObject<{
29
+ data: z4.ZodObject<{
30
+ creditos: z4.ZodObject<{
31
+ usuario_id: z4.ZodString;
32
+ }, z4.core.$strip>;
33
+ }, z4.core.$strip>;
34
+ }, z4.core.$strip>;
35
+ type Input = z4.infer<typeof InputSchema>;
36
+ type Output = {
37
+ data: {
38
+ creditos: {
39
+ quantidade: number;
40
+ proporcao_credito_para_reais: 100;
41
+ };
42
+ };
43
+ };
44
+ type Response = AxiosResponse<t.Geral.Response.C.Output<Output>>;
45
+ }
46
+ namespace UsarCreditosDoUsuario {
47
+ const route: "/api/creditos/usuario/usar";
48
+ const InputSchema: z4.ZodObject<{
49
+ data: z4.ZodObject<{
50
+ creditos: z4.ZodObject<{
51
+ usuario_id: z4.ZodString;
52
+ quantidade: z4.ZodNumber;
53
+ }, z4.core.$strip>;
54
+ }, z4.core.$strip>;
55
+ }, z4.core.$strip>;
56
+ type Input = z4.infer<typeof InputSchema>;
57
+ type Output = {
58
+ data: {
59
+ creditos: {
60
+ quantidade: number;
61
+ };
62
+ };
63
+ };
64
+ type Response = AxiosResponse<t.Geral.Response.C.Output<Output>>;
65
+ }
66
+ namespace CriarCheckoutCreditos {
67
+ const route: "/api/creditos/checkout";
68
+ const InputSchema: z4.ZodObject<{
69
+ data: z4.ZodObject<{
70
+ checkout: z4.ZodObject<{
71
+ price: z4.ZodInt;
72
+ success_url: z4.ZodURL;
73
+ }, z4.core.$strip>;
74
+ }, z4.core.$strip>;
75
+ }, z4.core.$strip>;
76
+ type Input = z4.infer<typeof InputSchema>;
77
+ type Output = {
78
+ data: {
79
+ checkout: {
80
+ url: string;
81
+ };
82
+ };
83
+ };
84
+ type Response = AxiosResponse<t.Geral.Response.C.Output<Output>>;
85
+ }
86
+ }
87
+ export default TypeControllerCreditos;
@@ -3,11 +3,13 @@ import type { D1Database, Fetcher } from "@cloudflare/workers-types";
3
3
  import { TypesCore } from "@navservice/core";
4
4
  import TypeControllerAssinatura from "./controller/assinatura";
5
5
  import TypeControllerCliente from "./controller/cliente";
6
+ import TypeControllerCreditos from "./controller/creditos";
6
7
  import TypeResponse from "./geral/type_response";
7
8
  declare namespace t {
8
9
  namespace Controller {
9
10
  export import Assinatura = TypeControllerAssinatura;
10
11
  export import Cliente = TypeControllerCliente;
12
+ export import Creditos = TypeControllerCreditos;
11
13
  }
12
14
  namespace Integrations {
13
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navservice/assinatura",
3
- "version": "1.51.0",
3
+ "version": "1.53.0",
4
4
  "description": "Service de autenticação de usuários unificado",
5
5
  "type": "module",
6
6
  "main": "./build/lib/index.js",