@nicefer/types 1.0.194 → 1.0.196

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/package.json CHANGED
@@ -1,22 +1,19 @@
1
1
  {
2
2
  "name": "@nicefer/types",
3
- "version": "1.0.194",
3
+ "version": "1.0.196",
4
4
  "description": "Tipos compartidos para Nicefer",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "files": [
9
- "dist",
10
- "*.d.ts"
9
+ "dist"
11
10
  ],
12
11
  "exports": {
13
12
  ".": {
14
- "import": "./dist/index.js",
15
13
  "types": "./dist/index.d.ts"
16
14
  },
17
15
  "./org": {
18
- "import": "./dist/org.js",
19
- "types": "./dist/org.d.ts"
16
+ "types": "./dist/types/org/index.d.ts"
20
17
  }
21
18
  },
22
19
  "scripts": {
package/dist/src/api.d.ts DELETED
@@ -1,11 +0,0 @@
1
- export interface ApiRequest {
2
- route: string;
3
- auth?: boolean;
4
- params?: any;
5
- page?: number;
6
- }
7
- export interface ApiResponse<Data, ErrorCodes = string> {
8
- ok: boolean;
9
- error?: ErrorCodes;
10
- data?: Data;
11
- }
package/dist/src/api.js DELETED
@@ -1,3 +0,0 @@
1
- ;
2
- ;
3
- export {};
package/dist/src/bag.d.ts DELETED
@@ -1,35 +0,0 @@
1
- import { OrderDiscountApplied } from "./orders";
2
- import { PaymentInDB } from "./payments";
3
- import { CategoryType } from "./product-category";
4
- import { ProductVariantInDB } from "./products";
5
- export interface Bag {
6
- subtotalPrice: number;
7
- subtotalWithDiscount: number;
8
- totalPrice: number;
9
- shippingPrice: number;
10
- discounts?: OrderDiscountApplied[];
11
- ccy: PaymentInDB['ccy'];
12
- products: ProductWithVariantInBag[];
13
- }
14
- /**
15
- * En la bolsa cada variante será independiente,
16
- * @example Si un producto tiene 3 variantes y el usuario
17
- * agrega cada variante, entonces se tomará como 3 productos independientes.
18
- */
19
- export interface ProductWithVariantInBag {
20
- productId: string;
21
- productName: string;
22
- /** Heredado de {@link ProductInDB} */
23
- weightLbs: number;
24
- imgFullUrl: string | undefined;
25
- categoryType: CategoryType['type'];
26
- ccy: PaymentInDB['ccy'];
27
- variantId: string;
28
- warehouseId: string;
29
- selectedOptions: ProductVariantInDB['selectedOptions'];
30
- variantQty: number;
31
- variantPrice: number;
32
- variantPriceWithDiscount?: number;
33
- createdAt: string;
34
- updatedAt?: string;
35
- }
package/dist/src/bag.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,20 +0,0 @@
1
- import { Country, Region } from "./countries";
2
- export interface BranchInDB {
3
- id: string;
4
- name: string;
5
- address: string;
6
- secondLineAddress?: string;
7
- city: string;
8
- region: Region;
9
- zipcode: number;
10
- country: Country;
11
- status: 'active' | 'tmpClosed' | 'closed';
12
- createdAt: string;
13
- }
14
- /**
15
- * Enlace de la sucursal en otro documento
16
- */
17
- export interface BranchFK {
18
- id: string;
19
- name: string;
20
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- export interface Company {
2
- id: string;
3
- displayName: string;
4
- verfied: boolean;
5
- createdAt: string;
6
- }
7
- export interface CompanyFK {
8
- id: string;
9
- displayName: string;
10
- }
@@ -1,2 +0,0 @@
1
- ;
2
- export {};
@@ -1,31 +0,0 @@
1
- import { PaymentInDB } from "./payments";
2
- export interface Country {
3
- id: 'HN' | 'US' | 'SV' | 'CN';
4
- name: string;
5
- ccy: PaymentInDB['ccy'];
6
- code: number | null | undefined;
7
- }
8
- export interface City {
9
- id: string;
10
- name: string;
11
- regionId: string;
12
- }
13
- export interface Region {
14
- id: string;
15
- name: string;
16
- cities?: City[];
17
- }
18
- export declare const Countries: Country[];
19
- export declare const Regions: {
20
- [countryId in Country['id']]: Region[];
21
- };
22
- export declare function getRegionsByCountryId(id: 'HN' | 'US' | 'SV'): Region[] | any[];
23
- /**
24
- * Usado en el atributo [compareWith] de los mat-select's
25
- * de los formularios que manejan paises y regiones.
26
- * @param c1
27
- * @param c2
28
- * @returns
29
- */
30
- export declare const compareCountries: (c1: Country, c2: Country) => boolean;
31
- export declare const compareRegions: (r1: Region, r2: Region) => boolean;
@@ -1,195 +0,0 @@
1
- export const Countries = [
2
- {
3
- id: 'HN',
4
- name: 'Honduras',
5
- code: 504,
6
- ccy: 'HNL'
7
- },
8
- {
9
- id: 'SV',
10
- name: 'El Salvador',
11
- code: 503,
12
- ccy: 'USD'
13
- },
14
- {
15
- id: 'US',
16
- name: 'Estados Unidos',
17
- code: 1,
18
- ccy: 'USD',
19
- },
20
- {
21
- id: 'CN',
22
- name: 'China',
23
- code: 56,
24
- ccy: 'USD'
25
- },
26
- ];
27
- export const Regions = {
28
- HN: [
29
- {
30
- id: "AT",
31
- name: "Atlántida",
32
- cities: [
33
- { id: "LCB", name: "La Ceiba", regionId: "AT" },
34
- { id: "ELP", name: "El Porvenir", regionId: "AT" },
35
- { id: "ESP", name: "Esparta", regionId: "AT" },
36
- { id: "JUT", name: "Jutiapa", regionId: "AT" },
37
- { id: "LAM", name: "La Masica", regionId: "AT" },
38
- { id: "SFR", name: "San Francisco", regionId: "AT" },
39
- { id: "TEL", name: "Tela", regionId: "AT" },
40
- { id: "ARI", name: "Arizona", regionId: "AT" }
41
- ]
42
- },
43
- {
44
- id: "CH",
45
- name: "Choluteca",
46
- cities: []
47
- },
48
- { id: "CL", name: "Colón" },
49
- { id: "CM", name: "Comayagua" },
50
- { id: "CP", name: "Copán" },
51
- { id: "CR", name: "Cortés" },
52
- { id: "EP", name: "El Paraíso" },
53
- {
54
- id: "FM",
55
- name: "Francisco Morazán",
56
- cities: [
57
- { id: "TGU", name: "Tegucigalpa", regionId: "FM" },
58
- { id: "AMA", name: "Amarateca", regionId: "FM" },
59
- { id: "AZA", name: "Azacualpa", regionId: "FM" },
60
- { id: "CAR", name: "Carpinteron", regionId: "FM" },
61
- { id: "CEN", name: "Cerro Grande", regionId: "FM" },
62
- { id: "COA", name: "Coa Abajo", regionId: "FM" },
63
- { id: "COU", name: "Coa Arriba", regionId: "FM" }, // id corregido
64
- { id: "COF", name: "Cofradía", regionId: "FM" },
65
- { id: "CON", name: "Concepción de Río Grande", regionId: "FM" },
66
- { id: "ELN", name: "El Naranjal", regionId: "FM" },
67
- { id: "EPI", name: "El Piliguín", regionId: "FM" },
68
- { id: "TIZ", name: "El Tizatillo", regionId: "FM" },
69
- { id: "GER", name: "Germania", regionId: "FM" },
70
- { id: "GUA", name: "Guangololo", regionId: "FM" },
71
- { id: "GUS", name: "Guasculile", regionId: "FM" },
72
- { id: "JAC", name: "Jacaleapa", regionId: "FM" },
73
- { id: "JUT", name: "Jutiapa", regionId: "FM" },
74
- { id: "CAL", name: "La Calera", regionId: "FM" },
75
- { id: "CU2", name: "La Cuesta No.2", regionId: "FM" },
76
- { id: "MON", name: "La Montañita", regionId: "FM" },
77
- { id: "SAB", name: "La Sábana", regionId: "FM" },
78
- { id: "VEN", name: "La Venta", regionId: "FM" },
79
- { id: "CAS", name: "Las Casitas", regionId: "FM" },
80
- { id: "FLO", name: "Las Flores", regionId: "FM" },
81
- { id: "TAP", name: "Las Tapias", regionId: "FM" },
82
- { id: "JUT2", name: "Los Jutes", regionId: "FM" },
83
- { id: "MAT", name: "Mateo", regionId: "FM" },
84
- { id: "RED", name: "Monte Redondo", regionId: "FM" },
85
- { id: "NAL", name: "Nueva Aldea", regionId: "FM" },
86
- { id: "RAB", name: "Río Abajo", regionId: "FM" },
87
- { id: "RHO", name: "Río Hondo", regionId: "FM" },
88
- { id: "SOR", name: "San Francisco de Soroguara", regionId: "FM" },
89
- { id: "SJC", name: "San Juancito", regionId: "FM" },
90
- { id: "SJR", name: "San Juan del Rancho", regionId: "FM" },
91
- { id: "SRG", name: "San Juan del Río Grande", regionId: "FM" },
92
- { id: "SMT", name: "San Matías", regionId: "FM" },
93
- { id: "SCA", name: "Santa Cruz Abajo", regionId: "FM" },
94
- { id: "SCR", name: "Santa Cruz Arriba", regionId: "FM" },
95
- { id: "SAR", name: "Santa Rosa", regionId: "FM" },
96
- { id: "SRO", name: "Soroguara", regionId: "FM" },
97
- { id: "TAM", name: "Támara", regionId: "FM" },
98
- { id: "VNU", name: "Villa Nueva", regionId: "FM" },
99
- { id: "YAG", name: "Yaguacire", regionId: "FM" },
100
- { id: "ZAM", name: "Zambrano", regionId: "FM" }
101
- ]
102
- },
103
- { id: "GD", name: "Gracias a Dios" },
104
- { id: "IN", name: "Intibucá" },
105
- { id: "IB", name: "Islas de la Bahía" },
106
- { id: "LP", name: "La Paz" },
107
- { id: "LE", name: "Lempira" },
108
- { id: "OC", name: "Ocotepeque" },
109
- { id: "OL", name: "Olancho" },
110
- { id: "SB", name: "Santa Bárbara" },
111
- { id: "VA", name: "Valle" },
112
- { id: "YO", name: "Yoro" }
113
- ],
114
- US: [
115
- { id: "AL", name: "Alabama" },
116
- { id: "AK", name: "Alaska" },
117
- { id: "AZ", name: "Arizona" },
118
- { id: "AR", name: "Arkansas" },
119
- { id: "CA", name: "California" },
120
- { id: "CO", name: "Colorado" },
121
- { id: "CT", name: "Connecticut" },
122
- { id: "DE", name: "Delaware" },
123
- { id: "FL", name: "Florida" },
124
- { id: "GA", name: "Georgia" },
125
- { id: "HI", name: "Hawaii" },
126
- { id: "ID", name: "Idaho" },
127
- { id: "IL", name: "Illinois" },
128
- { id: "IN", name: "Indiana" },
129
- { id: "IA", name: "Iowa" },
130
- { id: "KS", name: "Kansas" },
131
- { id: "KY", name: "Kentucky" },
132
- { id: "LA", name: "Louisiana" },
133
- { id: "ME", name: "Maine" },
134
- { id: "MD", name: "Maryland" },
135
- { id: "MA", name: "Massachusetts" },
136
- { id: "MI", name: "Michigan" },
137
- { id: "MN", name: "Minnesota" },
138
- { id: "MS", name: "Mississippi" },
139
- { id: "MO", name: "Missouri" },
140
- { id: "MT", name: "Montana" },
141
- { id: "NE", name: "Nebraska" },
142
- { id: "NV", name: "Nevada" },
143
- { id: "NH", name: "New Hampshire" },
144
- { id: "NJ", name: "New Jersey" },
145
- { id: "NM", name: "New Mexico" },
146
- { id: "NY", name: "New York" },
147
- { id: "NC", name: "North Carolina" },
148
- { id: "ND", name: "North Dakota" },
149
- { id: "OH", name: "Ohio" },
150
- { id: "OK", name: "Oklahoma" },
151
- { id: "OR", name: "Oregon" },
152
- { id: "PA", name: "Pennsylvania" },
153
- { id: "RI", name: "Rhode Island" },
154
- { id: "SC", name: "South Carolina" },
155
- { id: "SD", name: "South Dakota" },
156
- { id: "TN", name: "Tennessee" },
157
- { id: "TX", name: "Texas" },
158
- { id: "UT", name: "Utah" },
159
- { id: "VT", name: "Vermont" },
160
- { id: "VA", name: "Virginia" },
161
- { id: "WA", name: "Washington" },
162
- { id: "WV", name: "West Virginia" },
163
- { id: "WI", name: "Wisconsin" },
164
- { id: "WY", name: "Wyoming" }
165
- ],
166
- SV: [
167
- { id: "AH", name: "Ahuachapán" },
168
- { id: "CA", name: "Cabañas" },
169
- { id: "CH", name: "Chalatenango" },
170
- { id: "CU", name: "Cuscatlán" },
171
- { id: "LI", name: "La Libertad" },
172
- { id: "PA", name: "La Paz" },
173
- { id: "ONU", name: "La Unión" },
174
- { id: "MO", name: "Morazán" },
175
- { id: "SM", name: "San Miguel" },
176
- { id: "SS", name: "San Salvador" },
177
- { id: "SV", name: "San Vicente" },
178
- { id: "SA", name: "Santa Ana" },
179
- { id: "SO", name: "Sonsonate" },
180
- { id: "US", name: "Usulutan" }
181
- ],
182
- CN: []
183
- };
184
- export function getRegionsByCountryId(id) {
185
- return Regions[id];
186
- }
187
- /**
188
- * Usado en el atributo [compareWith] de los mat-select's
189
- * de los formularios que manejan paises y regiones.
190
- * @param c1
191
- * @param c2
192
- * @returns
193
- */
194
- export const compareCountries = (c1, c2) => c1 && c2 ? c1.id === c2.id : false;
195
- export const compareRegions = (r1, r2) => r1 && r2 ? r1.id === r2.id : false;
@@ -1,15 +0,0 @@
1
- /** ID único para un usuario */
2
- export * from './api';
3
- export * from './bag';
4
- export * from './branch';
5
- export * from './countries';
6
- export * from './orders';
7
- export * from './stats';
8
- export * from './payments';
9
- export * from './product-category';
10
- export * from './products';
11
- export * from './replenishment';
12
- export * from './users';
13
- export * from './warehouses';
14
- export * from './translations';
15
- export * from './company';
package/dist/src/index.js DELETED
@@ -1,17 +0,0 @@
1
- // src/index.ts
2
- /** ID único para un usuario */
3
- // export type UserId = string & { __brand: 'UserId' };
4
- export * from './api';
5
- export * from './bag';
6
- export * from './branch';
7
- export * from './countries';
8
- export * from './orders';
9
- export * from './stats';
10
- export * from './payments';
11
- export * from './product-category';
12
- export * from './products';
13
- export * from './replenishment';
14
- export * from './users';
15
- export * from './warehouses';
16
- export * from './translations';
17
- export * from './company';
@@ -1,96 +0,0 @@
1
- import { PaymentIntent } from "@stripe/stripe-js";
2
- export interface NiceEvent {
3
- id: string;
4
- title: string;
5
- description: string;
6
- inPerson: boolean;
7
- organizerName: string;
8
- createdBy: {
9
- id: string;
10
- name: string;
11
- };
12
- location: string;
13
- coverUrl?: string;
14
- startDate: Date;
15
- endDate: Date;
16
- createdAt: string;
17
- updatedAt?: string;
18
- }
19
- export type Currency = 'HNL' | 'EUR' | 'USD';
20
- export type DonationStatus = 'pending_pay' | 'pending' | 'payment_error' | 'processing' | 'resolve' | 'rejected' | 'expired' | 'used';
21
- /**
22
- * Tipos de donaciones usadas en el radar
23
- *
24
- * Valores posibles:
25
- * - `direct_donation`: Donación directa a una persona
26
- * - `event`: Evento
27
- * - `operating_expenses`: Gastos operativos
28
- */
29
- export type UsedIn = 'direct_donation' | 'event' | 'operating_expenses';
30
- /**
31
- * Tipos de movimientos del radar
32
- *
33
- * Valores posibles:
34
- * - `info`: Movimiento informativo
35
- * - `cash_converted_to_hnl`: Convertido a lempiras
36
- * - `cash_income`: Ingreso
37
- * - `cash_expense`: Gasto
38
- * - `cash_refund`: Reembolso
39
- * - `cash_reversion`: Reversión
40
- *
41
- * @remarks
42
- * El reembolso es para el cliente, mientras que la reversión
43
- * es para devolver el dinero a la donación original.
44
- */
45
- export type FlowType = 'info' | 'cash_converted_to_hnl' | 'cash_income' | 'cash_expense' | 'cash_refund' | 'cash_reversion';
46
- export interface Movement {
47
- id: string;
48
- title: string;
49
- desc?: string;
50
- /**
51
- * Tipos de donaciones usadas en el radar
52
- *
53
- * Valores posibles:
54
- * - `direct_donation`: Donación directa a una persona
55
- * - `event`: Evento
56
- * - `operating_expenses`: Gastos operativos
57
- */
58
- usedIn: UsedIn;
59
- icon: 'ok' | 'error' | 'info' | 'waiting';
60
- type: FlowType;
61
- /**
62
- * Monto involucrado en el movimiento,
63
- * se debe proporcionar `0` cuándo {@link FlowType} sea `none`.
64
- * Ej. `amount: 0`
65
- */
66
- amount: number;
67
- createdAt: string;
68
- }
69
- export interface DonationCharges {
70
- subtotal: number;
71
- fees: number;
72
- total: number;
73
- }
74
- /**
75
- * La donación se puede recibir en HNL, USD o EUR,
76
- * pero se deberá convertir a lempiras antes de ser usada.
77
- */
78
- export interface Donation {
79
- id: string;
80
- donorId: string;
81
- fullname: string;
82
- anonymous: boolean;
83
- charges: DonationCharges;
84
- /**
85
- * Cuándo se reciba en una moneda distinta de HNL, se convertirá a HNL.
86
- * De lo contrario será `undefined`
87
- */
88
- chargesInHNL?: DonationCharges;
89
- status: DonationStatus;
90
- mainCcy: Currency;
91
- paymentStatus?: PaymentIntent.Status;
92
- radar?: {
93
- [movementId: string]: Movement;
94
- };
95
- createdAt?: string;
96
- }
@@ -1,3 +0,0 @@
1
- ;
2
- ;
3
- export {};
@@ -1,103 +0,0 @@
1
- import { PaymentIntent } from "@stripe/stripe-js";
2
- import { ProductWithVariantInBag } from "./bag";
3
- import { UserAddressInDB } from "./users";
4
- import { Country } from "./countries";
5
- import { CategoryType } from "./product-category";
6
- import { DeliveryMethod } from "./warehouses";
7
- export interface Gift {
8
- fullname: string;
9
- msg?: string | null | undefined;
10
- }
11
- export interface OrderDiscount {
12
- id: string;
13
- name: string;
14
- subtitle: string;
15
- code: string;
16
- automatic?: boolean;
17
- amount: number;
18
- isPercent: boolean;
19
- condition: 'first_order' | 'delivery_free' | 'none' | 'student' | 'share_5_friends';
20
- conditionDescription: string;
21
- categoriesTypes?: CategoryType['type'][];
22
- minOrderAmount?: number;
23
- dueDate: string;
24
- public?: boolean;
25
- }
26
- export interface OrderDiscountApplied extends OrderDiscount {
27
- amountInCurrentCcy?: number;
28
- }
29
- export interface ProductPrepared {
30
- productId: string;
31
- variantId: string;
32
- qty: number;
33
- }
34
- /**
35
- * Indicará qué productos de {@link OrderInDB.products} fueron ordenados y cuales fueron preparados
36
- */
37
- export interface ProductCheckedAfterPrepared {
38
- productId: string;
39
- variantId: string;
40
- qtyOrdered: number;
41
- qtyPrepared: number;
42
- }
43
- export interface OrderInDB {
44
- id: string;
45
- customerName: string;
46
- customerId: string;
47
- customerCountry: Country;
48
- products: ProductWithVariantInBag[];
49
- /**
50
- * Indicará qué productos de {@link products} fueron preparados y cuantas unidades.
51
- */
52
- productsPrepared?: ProductPrepared[];
53
- subtotalPrice: number;
54
- subtotalWithDiscount: number;
55
- totalPrice: number;
56
- shippingPrice: number;
57
- discounts?: OrderDiscountApplied[];
58
- status: 'pending' | 'payment_error' | 'processing' | 'prepared' | 'shipped' | 'delivered' | 'canceled';
59
- orderDate: string;
60
- deliveryAddress: UserAddressInDB;
61
- paymentStatus?: PaymentIntent.Status;
62
- paymentMethod: 'credit_card' | 'paypal' | 'bank_transfer' | 'cash_on_delivery';
63
- shippingMethod: DeliveryMethod;
64
- gift?: Gift;
65
- notes?: string;
66
- }
67
- export type OrderErrorCodes = 'ERR_CREATE_ORDER' | 'ERR_ORDER_INFO' | 'ERR_CHANGE_ORDER_STATUS';
68
- /**
69
- * Interfaz para comunicación con la API
70
- */
71
- export interface ConfirmOrderPayload {
72
- orderReadyToPay: OrderReady;
73
- customerCountry: Country;
74
- paymentMethod: OrderInDB['paymentMethod'];
75
- shippingMethod: OrderInDB['shippingMethod'];
76
- deliveryAddress: OrderInDB['deliveryAddress'];
77
- gift?: Gift;
78
- }
79
- /**
80
- * Orden lista para que el usuario decida pagar
81
- */
82
- export interface OrderReady {
83
- warehouseId: string;
84
- warehouseCountryId: Country['id'];
85
- products: ProductWithVariantInBag[];
86
- paymentMethod?: OrderInDB['paymentMethod'];
87
- shippingMethod?: DeliveryMethod;
88
- deliveryAddress?: UserAddressInDB;
89
- gift?: {
90
- fullname: string;
91
- msg?: string | null | undefined;
92
- };
93
- subtotalPrice: number;
94
- shippingPrice: number;
95
- subtotalWithDiscount: number;
96
- totalPrice: number;
97
- }
98
- /**
99
- * Ordenes listas para que el usuario decida pagar
100
- */
101
- export interface OrdersReady {
102
- [warehouseId: string]: OrderReady;
103
- }
@@ -1,9 +0,0 @@
1
- ;
2
- ;
3
- ;
4
- ;
5
- ;
6
- ;
7
- ;
8
- ;
9
- export {};
@@ -1,70 +0,0 @@
1
- import { Metadata, PaymentIntent } from "@stripe/stripe-js";
2
- /**
3
- * Payment como está registrado en la base de datos
4
- */
5
- export interface PaymentInDB {
6
- /**
7
- * @property {string} `id`
8
- * mismo que `Stripe.PaymentIntent.id`
9
- */
10
- id: string;
11
- /**
12
- * @property {@link Issuer} `recipientMap`
13
- * Quién pagó
14
- */
15
- issuerMap: {
16
- id: string;
17
- displayName: string;
18
- };
19
- /**
20
- * @property {number} `amount`
21
- * Monto a pagar, incluyendo impuestos, tarifas y comisiones.
22
- */
23
- amount: number;
24
- /**
25
- * @property {number} `tax`
26
- * Impuesto de la transacción, basado en EEUU.
27
- */
28
- tax: 8.25;
29
- /**
30
- * @property ccy {@link PaymentCCY}
31
- * Moneda en la que se ejecutará el pago.
32
- */
33
- ccy: 'HNL' | 'USD' | 'EUR';
34
- /**
35
- * @property {Timestamp} `createdAt`
36
- * Fecha y hora en que se generó la transacción,
37
- * igual que `Stripe.PaymentIntent.created`.
38
- */
39
- createdAt: string;
40
- }
41
- /**
42
- * Parámetros que se enviarán al servidor,
43
- * y así registrar el PaymentIntent con stripe.
44
- */
45
- export interface StripePaymentIntentParams {
46
- cardHolder: string | string | null | undefined;
47
- billingAddressLine1: string | string | null | undefined;
48
- billingAddressCity: string | string | null | undefined;
49
- amount: number;
50
- currency: string;
51
- metadata: PaymentInStripeMetadata;
52
- }
53
- export interface PaymentInStripeMetadata {
54
- /** Ej. users/{userId}/orders/{orderId} */
55
- refDB: string;
56
- issuerId: string;
57
- issuerName: string;
58
- }
59
- /**
60
- * Respuesta de la API Ivife cuándo se busca un PaymentIntent por su {@link StripeMetadata.refId}
61
- */
62
- export interface StripePaymentIntentResponse {
63
- metadata: PaymentInStripeMetadata | Metadata;
64
- status: PaymentIntent.Status;
65
- amount: number;
66
- amount_capturable: number;
67
- amount_received: number;
68
- currency: string;
69
- }
70
- export type PaymentErrorCodes = 'ERR_PAYMENT' | 'ERR_REINTENT_PAYMENT' | 'authentication_required' | 'requires_action';
@@ -1 +0,0 @@
1
- export {};
@@ -1,29 +0,0 @@
1
- import { Country } from "./countries";
2
- import { Translations } from "./translations";
3
- export interface Category {
4
- id: string;
5
- title: string;
6
- translations?: Translations<string>;
7
- icon?: string;
8
- subcategories?: SubCategory[];
9
- hidden?: boolean;
10
- adultsOnly?: boolean;
11
- }
12
- export interface SubCategory {
13
- id: string;
14
- title: string;
15
- translations?: Translations<string>;
16
- }
17
- export interface CategoryType {
18
- title: string;
19
- type: 'clothes' | 'gifts' | 'perfumes' | 'electric' | 'electronics' | 'handmade-jewelry' | 'jewelry' | 'home' | 'beauty' | 'health' | 'books' | 'shoes' | 'bags';
20
- translations?: Translations<string>;
21
- icon?: string;
22
- categories: Category[];
23
- countries: Country['id'][];
24
- hidden?: boolean;
25
- }
26
- export interface ProductCategoryInDB {
27
- id: string;
28
- subcategory: string;
29
- }
@@ -1,2 +0,0 @@
1
- ;
2
- export {};
@@ -1,141 +0,0 @@
1
- import { CompanyFK } from "./company";
2
- import { Country } from "./countries";
3
- import { CategoryType, ProductCategoryInDB } from "./product-category";
4
- import { RProduct, RSupplier } from "./replenishment";
5
- import { Translations } from "./translations";
6
- export interface ProductFirstOptionTypeValue {
7
- value: string;
8
- codeColor?: string;
9
- }
10
- export interface ProductOptionValue {
11
- value: string;
12
- code?: string;
13
- }
14
- type clothesOptions = 'talla' | 'color';
15
- type giftsOptions = 'color' | 'tipo de flor';
16
- export interface ProductOptionToSelect {
17
- option: clothesOptions | giftsOptions;
18
- valuesAllowed: ProductOptionValue[];
19
- }
20
- /**
21
- * Igual que store-product-in-db.ts del proyecto `Zavafa`
22
- */
23
- export interface ProductInDB {
24
- id: string;
25
- name: string;
26
- nameTranslations?: Translations<string>;
27
- description: string;
28
- descriptionTranslations?: Translations<string>;
29
- category: ProductCategoryInDB;
30
- brand: string | null | undefined;
31
- coverImg?: ProductVariantImage;
32
- type: CategoryType['type'];
33
- soldBy: CompanyFK;
34
- adultsOnly?: boolean;
35
- shipmentsTo?: {
36
- [countryId in Country['id']]: boolean;
37
- };
38
- countries?: {
39
- [key: string]: boolean;
40
- };
41
- warrantyInDays?: number;
42
- /**
43
- * Opciones con las que se identificará cada variante de este producto,
44
- * serán establecidas por el usuario.
45
- *
46
- * Máximo 2.
47
- * @example: Talla, Color, Onzas, etc. Y todos sus valores posibles.
48
- */
49
- optionsToSelect: ProductOptionToSelect[];
50
- /** Peso en libras */
51
- weightLbs?: number;
52
- status: 'active' | 'inactive' | 'discontinued';
53
- tags: string[];
54
- createdAt: any;
55
- updatedAt?: string;
56
- createdBy: {
57
- id: string;
58
- displayName: string;
59
- };
60
- updatedBy?: {
61
- id: string;
62
- displayName: string;
63
- };
64
- }
65
- /**
66
- * /products/{productId}/variants/{sku}
67
- */
68
- export interface ProductVariantImage {
69
- url: string;
70
- path: string;
71
- }
72
- export interface ProductVariantInDB {
73
- /** Este es el SKU */
74
- id?: string;
75
- supplier: RSupplier;
76
- supplierVariantId: RProduct['supplierVariantId'];
77
- productId?: string;
78
- images?: ProductVariantImage[];
79
- barcode?: string;
80
- /**
81
- * Packages dónde está la variante
82
- */
83
- inPackages?: {
84
- packageId: string;
85
- orderId: string;
86
- }[];
87
- /**
88
- * Warehouses dónde está disponible esta variante.
89
- * Cada ```key``` del objeto es el id del warehouse y su valor será {@link VariantWarehouseFK}.
90
- *
91
- * @note Se usa esta nueva manera para poder usar los FieldValue (serverTimestamp, etc) de Firestore,
92
- * ya que en los arrays no funcionan.
93
- */
94
- warehouses: {
95
- [key: string]: VariantWarehouseFK;
96
- };
97
- /**
98
- * Opciones de la variante, por ejemplo una prenda tiene color y talla.
99
- * Obligatoriamente tiene que tener al menos una opción.
100
- *
101
- * @note {@link secondOptionType} NO puede ser de tipo 'color'
102
- */
103
- selectedOptions: {
104
- option: ProductOptionToSelect['option'];
105
- value: {
106
- value: string;
107
- code?: string;
108
- };
109
- }[];
110
- }
111
- /**
112
- * La forma en que se enlaza información del producto en determinada warehouse,
113
- * esta información va adentro de la variante.
114
- *
115
- * /products/{id}/variants/{id}
116
- */
117
- export interface VariantWarehouseFK {
118
- id: string;
119
- name: string;
120
- stock: number;
121
- price: number;
122
- priceUSD: number;
123
- lastPrice?: number;
124
- lastPriceUSD?: number;
125
- supplierPriceUSD: number;
126
- supplierPriceHNL: number;
127
- profitMarginUSD: number;
128
- profitMarginHNL: number;
129
- profitMarginPercent: number;
130
- }
131
- /**
132
- * Para poder mostrar las variantes agrupadas
133
- *
134
- * Ej. Verde / S, Verde / M, etc
135
- */
136
- export interface ProductGroupVariant {
137
- variant: ProductVariantInDB;
138
- /** Indica si la información se cargó desde el servidor o se creó automaticamente */
139
- dataFromServer: boolean;
140
- }
141
- export {};
@@ -1,6 +0,0 @@
1
- ;
2
- ;
3
- ;
4
- ;
5
- ;
6
- export {};
@@ -1,99 +0,0 @@
1
- import { ProductVariantInDB } from "./products";
2
- import { WarehouseInDB } from "./warehouses";
3
- export interface RSupplier {
4
- id: string;
5
- name: string;
6
- }
7
- /**
8
- * Productos de la orden de reabastecimiento realizada al proveedor
9
- */
10
- export interface RProduct {
11
- id?: string;
12
- productId: string;
13
- variantId: string;
14
- packageId: string;
15
- selectedOptions: ProductVariantInDB['selectedOptions'];
16
- newStock: number;
17
- supplier: RSupplier;
18
- /** Id que usa el proveedor para manejar este producto en su sistema */
19
- supplierVariantId: string;
20
- /**
21
- * Fecha de registro de el paquete en el sistema
22
- */
23
- createdAt?: string;
24
- /**
25
- * Si no tiene rPackageId se considera un
26
- * producto de la misma orden pero huérfano
27
- */
28
- rPackageId?: string;
29
- }
30
- export interface ROrder {
31
- /**
32
- * Id único interno
33
- */
34
- id?: string;
35
- /**
36
- * Número de orden del proveedor
37
- *
38
- * Este es el número de orden con el que
39
- * el proveedor da seguimiento a la orden.
40
- */
41
- supplierOrderId: string;
42
- supplier: RSupplier;
43
- totalValue: number;
44
- packsQty: number;
45
- /**
46
- * Almacén final que recibirá la orden.
47
- * Es donde se pondrán en venta los productos o desde dónde
48
- * se distribuirán al resto de almacenes.
49
- */
50
- warehouseDestination: Pick<WarehouseInDB, 'id' | 'name'>;
51
- /**
52
- * Moneda siempre será USD
53
- */
54
- ccy: 'USD';
55
- createdAt: string;
56
- }
57
- export interface RPackageHistory {
58
- title: string;
59
- /**
60
- * Si esta en el JSON, entonces ya se llegó al `ROrder['warehouseDestination']` requerido.
61
- */
62
- warehouseDestination?: ROrder['warehouseDestination'];
63
- mode: 'on-the-way' | 'arrived' | 'info';
64
- /**
65
- * Nombre de la empresa que realiza el envío desde {@link from}
66
- * @example UPS, FedEx, SerCargo, etc
67
- */
68
- shippingCompany?: string | null;
69
- trackingURL?: string | null;
70
- icon?: string;
71
- /**
72
- * Fecha en la que se registró el evento
73
- */
74
- createdAt: string;
75
- }
76
- export interface RPackage {
77
- id: string;
78
- /**
79
- * Id de {@link ROrder}
80
- */
81
- orderId: string;
82
- itemsQty: number;
83
- historyTracking: RPackageHistory[];
84
- /**
85
- * Detalles adicionales sobre el paquete
86
- */
87
- notes?: string;
88
- /**
89
- * Usuario que registró el paquete
90
- */
91
- createdBy: {
92
- id: string;
93
- displayName: string;
94
- };
95
- /**
96
- * Fecha de registro de el paquete en el sistema
97
- */
98
- createdAt: string;
99
- }
@@ -1,5 +0,0 @@
1
- ;
2
- ;
3
- ;
4
- ;
5
- export {};
@@ -1,13 +0,0 @@
1
- export interface OrdersStats {
2
- total?: number;
3
- canceled?: number;
4
- delivered?: number;
5
- }
6
- export interface UserStats {
7
- orders?: {
8
- total?: number;
9
- canceled?: number;
10
- delivered?: number;
11
- };
12
- qtyReferrals?: number;
13
- }
package/dist/src/stats.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- export interface Translations<T = any> {
2
- [key: string]: T;
3
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,84 +0,0 @@
1
- import { Country } from "./countries";
2
- export interface User {
3
- uid: string;
4
- displayName: string;
5
- email: string;
6
- stripeCustomerId?: string;
7
- userDevices?: UserDevice[];
8
- phoneNumber?: string;
9
- photoURL?: string;
10
- referralBy?: {
11
- uid: string;
12
- displayName: string;
13
- referredAt: string;
14
- };
15
- tags: string[];
16
- createdAt: string;
17
- updatedAt?: string;
18
- }
19
- export interface UserDevice {
20
- id: string;
21
- FCMToken?: string;
22
- /**
23
- * ios | android | web
24
- */
25
- platform: string;
26
- /**
27
- * Iphone 12 | Pixel 5
28
- */
29
- model: string;
30
- /**
31
- * ios | android
32
- */
33
- operatingSystem: string;
34
- /**
35
- * 13 | 10
36
- */
37
- osVersion: string;
38
- /**
39
- * Apple | Google | Microsoft | Samsung
40
- */
41
- manufacturer: string;
42
- /**
43
- * ``true`` si es un emulador
44
- */
45
- isVirtual: boolean;
46
- /**
47
- * ``es`` | ``en``
48
- */
49
- language: string;
50
- /**
51
- * Versión de la app
52
- */
53
- appVersion: string;
54
- appBuild: string;
55
- lastLogin: string;
56
- ipSecurity?: {
57
- ip: string;
58
- type: 'IPv4' | 'IPv6';
59
- country: string;
60
- country_code: string;
61
- region: string;
62
- city: string;
63
- isp: string;
64
- };
65
- }
66
- export interface UserAddressInDB {
67
- id: string;
68
- isDefault?: boolean;
69
- fullname: string;
70
- phone: string;
71
- address: string;
72
- references: string;
73
- region: string;
74
- city: string;
75
- country: Country | null | undefined;
76
- }
77
- export interface UserSearch {
78
- id: string;
79
- displayName: string;
80
- uid?: string;
81
- k: string;
82
- tags: string[];
83
- createdAt: string;
84
- }
package/dist/src/users.js DELETED
@@ -1,3 +0,0 @@
1
- ;
2
- ;
3
- export {};
@@ -1,47 +0,0 @@
1
- import { Country, Region } from "./countries";
2
- export interface WarehouseInDB {
3
- id?: string;
4
- name: string;
5
- address: string;
6
- secondLineAddress?: string | null;
7
- city: string;
8
- region?: Region | null;
9
- zipcode: number;
10
- country: Country;
11
- status: 'active' | 'tmpClosed' | 'closed';
12
- /**
13
- * `key` es el id del país al que se entrega. Ej. `US`
14
- */
15
- shipmentsTo: {
16
- [countryId in Country['id']]: WarehouseDeliveryTime;
17
- };
18
- createdAt: string;
19
- }
20
- /**
21
- * Tiempo de entrega en días hábiles de un país a otro
22
- */
23
- export interface WarehouseDeliveryTime {
24
- countryId: Country['id'];
25
- countryName: string;
26
- deliveryMethods: {
27
- [deliveryMethodId in DeliveryMethod['id']]: DeliveryMethod;
28
- };
29
- }
30
- export interface DeliveryMethod {
31
- id: 'standard' | 'express' | 'weekend';
32
- name: string;
33
- /**
34
- * Número de días hábiles que tarda la entrega,
35
- * se calcula y llena en `client`.
36
- */
37
- deliveryRange?: string;
38
- inBusinessDays: `${number}-${number}`;
39
- deliveryFeeInUSD: number;
40
- deliveryFeeInHNL: number;
41
- /**
42
- * El cargo en {@link deliveryFeeInUSD} y {@link deliveryFeeInHNL}
43
- * permitirá un máximo de lo indicado aquí. Si se supera el máximo,
44
- * se cobrará
45
- */
46
- maxLbPerFee: number;
47
- }
@@ -1,2 +0,0 @@
1
- ;
2
- export {};
package/org.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./src/index.org";