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