feeef 0.0.13 → 0.0.15
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 +1 -1
- package/src/core/core.ts +8 -8
- package/src/core/embadded/contact.ts +1 -0
- package/src/core/entities/order.ts +39 -39
- package/src/core/entities/shipping_method.ts +23 -23
- package/src/core/entities/store.ts +3 -2
- package/src/feeef/validators/helpers.ts +9 -16
- package/src/feeef/validators/stores.ts +9 -13
- package/src/feeef/validators/user_stores.ts +12 -11
- package/src/core/sdk/fif.ts +0 -3
package/package.json
CHANGED
package/src/core/core.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// entities
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
2
|
+
export * from "./entities/order.js";
|
|
3
|
+
export * from "./entities/store.js";
|
|
4
|
+
export * from "./entities/product.js";
|
|
5
|
+
export * from "./entities/user.js";
|
|
6
|
+
export * from "./entities/shipping_method.js";
|
|
7
7
|
// embaddeds
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
8
|
+
export * from "./embadded/address.js";
|
|
9
|
+
export * from "./embadded/category.js";
|
|
10
|
+
export * from "./embadded/contact.js";
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
export enum OrderStatus {
|
|
2
|
-
draft =
|
|
3
|
-
pending =
|
|
4
|
-
processing =
|
|
5
|
-
completed =
|
|
6
|
-
cancelled =
|
|
2
|
+
draft = 'draft',
|
|
3
|
+
pending = 'pending',
|
|
4
|
+
processing = 'processing',
|
|
5
|
+
completed = 'completed',
|
|
6
|
+
cancelled = 'cancelled',
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
// PaymentStatus
|
|
10
10
|
export enum PaymentStatus {
|
|
11
|
-
unpaid =
|
|
12
|
-
paid =
|
|
13
|
-
received =
|
|
11
|
+
unpaid = 'unpaid',
|
|
12
|
+
paid = 'paid',
|
|
13
|
+
received = 'received',
|
|
14
14
|
}
|
|
15
15
|
export enum DeliveryStatus {
|
|
16
|
-
pending =
|
|
17
|
-
delivering =
|
|
18
|
-
delivered =
|
|
19
|
-
returned =
|
|
16
|
+
pending = 'pending',
|
|
17
|
+
delivering = 'delivering',
|
|
18
|
+
delivered = 'delivered',
|
|
19
|
+
returned = 'returned',
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export interface OrderEntity {
|
|
23
|
-
id: string
|
|
24
|
-
customerName
|
|
25
|
-
customerPhone: string
|
|
26
|
-
customerIp
|
|
27
|
-
shippingAddress
|
|
28
|
-
shippingCity
|
|
29
|
-
shippingState
|
|
30
|
-
shippingMethodId
|
|
31
|
-
paymentMethodId
|
|
32
|
-
items: OrderItem[]
|
|
33
|
-
subtotal: number
|
|
34
|
-
shippingPrice: number
|
|
35
|
-
total: number
|
|
36
|
-
discount: number
|
|
37
|
-
coupon
|
|
38
|
-
storeId: string
|
|
39
|
-
metadata: any
|
|
40
|
-
status: OrderStatus
|
|
41
|
-
paymentStatus: PaymentStatus
|
|
42
|
-
deliveryStatus: DeliveryStatus
|
|
43
|
-
createdAt: any
|
|
44
|
-
updatedAt: any
|
|
23
|
+
id: string
|
|
24
|
+
customerName?: string | null
|
|
25
|
+
customerPhone: string
|
|
26
|
+
customerIp?: string | null
|
|
27
|
+
shippingAddress?: string | null
|
|
28
|
+
shippingCity?: string | null
|
|
29
|
+
shippingState?: string | null
|
|
30
|
+
shippingMethodId?: string | null
|
|
31
|
+
paymentMethodId?: string | null
|
|
32
|
+
items: OrderItem[]
|
|
33
|
+
subtotal: number
|
|
34
|
+
shippingPrice: number
|
|
35
|
+
total: number
|
|
36
|
+
discount: number
|
|
37
|
+
coupon?: string | null
|
|
38
|
+
storeId: string
|
|
39
|
+
metadata: any
|
|
40
|
+
status: OrderStatus
|
|
41
|
+
paymentStatus: PaymentStatus
|
|
42
|
+
deliveryStatus: DeliveryStatus
|
|
43
|
+
createdAt: any
|
|
44
|
+
updatedAt: any
|
|
45
45
|
}
|
|
46
46
|
export interface OrderItem {
|
|
47
|
-
productId: string
|
|
48
|
-
productName: string
|
|
49
|
-
variantPath?: string
|
|
50
|
-
quantity: number
|
|
51
|
-
price: number
|
|
47
|
+
productId: string
|
|
48
|
+
productName: string
|
|
49
|
+
variantPath?: string
|
|
50
|
+
quantity: number
|
|
51
|
+
price: number
|
|
52
52
|
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { OrderEntity } from
|
|
1
|
+
import { OrderEntity } from './order.js'
|
|
2
2
|
|
|
3
3
|
export interface ShippingMethodEntity {
|
|
4
|
-
id: string
|
|
5
|
-
name: string
|
|
6
|
-
description: string | null
|
|
7
|
-
logoUrl: string | null
|
|
8
|
-
ondarkLogoUrl: string | null
|
|
9
|
-
price: number
|
|
10
|
-
forks: number
|
|
11
|
-
sourceId: string
|
|
12
|
-
storeId: string
|
|
13
|
-
rates: (number | null)[]
|
|
14
|
-
status: ShippingMethodStatus
|
|
15
|
-
policy: ShippingMethodPolicy
|
|
16
|
-
verifiedAt: any
|
|
17
|
-
createdAt: any
|
|
18
|
-
updatedAt: any
|
|
19
|
-
orders: OrderEntity[]
|
|
20
|
-
source: ShippingMethodEntity | null
|
|
4
|
+
id: string
|
|
5
|
+
name: string
|
|
6
|
+
description: string | null
|
|
7
|
+
logoUrl: string | null
|
|
8
|
+
ondarkLogoUrl: string | null
|
|
9
|
+
price: number
|
|
10
|
+
forks: number
|
|
11
|
+
sourceId: string
|
|
12
|
+
storeId: string
|
|
13
|
+
rates: (number | null)[][] | null
|
|
14
|
+
status: ShippingMethodStatus
|
|
15
|
+
policy: ShippingMethodPolicy
|
|
16
|
+
verifiedAt: any
|
|
17
|
+
createdAt: any
|
|
18
|
+
updatedAt: any
|
|
19
|
+
orders: OrderEntity[]
|
|
20
|
+
source: ShippingMethodEntity | null
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export enum ShippingMethodStatus {
|
|
24
|
-
draft =
|
|
25
|
-
published =
|
|
26
|
-
archived =
|
|
24
|
+
draft = 'draft',
|
|
25
|
+
published = 'published',
|
|
26
|
+
archived = 'archived',
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export enum ShippingMethodPolicy {
|
|
30
|
-
private =
|
|
31
|
-
public =
|
|
30
|
+
private = 'private',
|
|
31
|
+
public = 'public',
|
|
32
32
|
}
|
|
@@ -56,15 +56,16 @@ export interface StoreDecoration {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
export interface StoreIntegration {
|
|
59
|
-
|
|
59
|
+
service: StoreIntegrations
|
|
60
60
|
// any
|
|
61
61
|
[key: string]: any
|
|
62
62
|
metadata: Record<string, any>
|
|
63
|
+
public: Record<string, any>
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
export enum StoreIntegrations {
|
|
66
67
|
telegram = 'telegram',
|
|
67
|
-
|
|
68
|
+
metaPixel = 'meta_pixel',
|
|
68
69
|
googleAnalytics = 'google_analytics',
|
|
69
70
|
googleSheet = 'google_sheet',
|
|
70
71
|
sms = 'sms',
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import vine from
|
|
1
|
+
import vine from '@vinejs/vine'
|
|
2
2
|
|
|
3
|
-
export const AvatarFileSchema = vine.any()
|
|
3
|
+
export const AvatarFileSchema = vine.any()
|
|
4
4
|
// .file({
|
|
5
5
|
// size: '1mb',
|
|
6
6
|
// extnames: ['jpg', 'jpeg', 'png', 'gif', 'webp'],
|
|
7
7
|
// })
|
|
8
8
|
|
|
9
|
-
export const ImageFileSchema = vine.any()
|
|
9
|
+
export const ImageFileSchema = vine.any()
|
|
10
10
|
// .file({
|
|
11
11
|
// size: '1mb',
|
|
12
12
|
// extnames: ['jpg', 'jpeg', 'png', 'gif', 'webp'],
|
|
@@ -16,7 +16,7 @@ export const DomainSchema = vine.object({
|
|
|
16
16
|
name: vine.string().minLength(3).maxLength(32),
|
|
17
17
|
verifiedAt: vine.date().optional(),
|
|
18
18
|
metadata: vine.object({}).optional(),
|
|
19
|
-
})
|
|
19
|
+
})
|
|
20
20
|
|
|
21
21
|
// decoration
|
|
22
22
|
export const StoreDecorationSchema = vine.object({
|
|
@@ -26,7 +26,7 @@ export const StoreDecorationSchema = vine.object({
|
|
|
26
26
|
logoFullHeight: vine.boolean().optional(),
|
|
27
27
|
showStoreNameInHeader: vine.boolean().optional(),
|
|
28
28
|
metadata: vine.any().optional(),
|
|
29
|
-
})
|
|
29
|
+
})
|
|
30
30
|
|
|
31
31
|
// export const EmbaddedImageSchema = vine.object({
|
|
32
32
|
// url: vine.string().url(),
|
|
@@ -43,7 +43,7 @@ export const EmbaddedCategorySchema = vine.object({
|
|
|
43
43
|
photoFile: AvatarFileSchema.optional(),
|
|
44
44
|
ondarkPhotoFile: AvatarFileSchema.optional(),
|
|
45
45
|
metadata: vine.object({}).optional(),
|
|
46
|
-
})
|
|
46
|
+
})
|
|
47
47
|
|
|
48
48
|
export const EmbaddedAddressSchema = vine.object({
|
|
49
49
|
country: vine.string().minLength(2).maxLength(32).optional(),
|
|
@@ -52,23 +52,16 @@ export const EmbaddedAddressSchema = vine.object({
|
|
|
52
52
|
street: vine.string().minLength(2).maxLength(32).optional(),
|
|
53
53
|
zip: vine.string().minLength(2).maxLength(32).optional(),
|
|
54
54
|
metadata: vine.object({}).optional().optional(),
|
|
55
|
-
})
|
|
55
|
+
})
|
|
56
56
|
|
|
57
57
|
export const EmbaddedContactSchema = vine.object({
|
|
58
58
|
type: vine.string().minLength(2).maxLength(32),
|
|
59
59
|
value: vine.string().minLength(2).maxLength(255),
|
|
60
60
|
metadata: vine.object({}).optional(),
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
export const ContactSchema = vine.object({
|
|
64
|
-
type: vine.string().minLength(2).maxLength(32),
|
|
65
|
-
value: vine.string().minLength(2).maxLength(255),
|
|
66
|
-
metadata: vine.object({}).optional(),
|
|
67
|
-
});
|
|
68
|
-
|
|
61
|
+
})
|
|
69
62
|
|
|
70
63
|
// StoreBunner
|
|
71
|
-
export const
|
|
64
|
+
export const StoreBunner = vine.object({
|
|
72
65
|
url: vine.string().url().optional(),
|
|
73
66
|
title: vine.string(),
|
|
74
67
|
enabled: vine.boolean().optional(),
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import vine from
|
|
1
|
+
import vine from '@vinejs/vine'
|
|
2
2
|
import {
|
|
3
3
|
AvatarFileSchema,
|
|
4
|
-
|
|
4
|
+
EmbaddedContactSchema,
|
|
5
5
|
DomainSchema,
|
|
6
6
|
EmbaddedAddressSchema,
|
|
7
7
|
EmbaddedCategorySchema,
|
|
8
8
|
StoreDecorationSchema,
|
|
9
|
-
} from
|
|
10
|
-
import { DefaultShippingRatesSchema } from
|
|
9
|
+
} from './helpers.js'
|
|
10
|
+
import { DefaultShippingRatesSchema } from './user_stores.js'
|
|
11
11
|
|
|
12
12
|
export const CreateStoreSchema = vine.object({
|
|
13
13
|
name: vine.string().minLength(2).maxLength(32),
|
|
@@ -51,15 +51,13 @@ export const CreateStoreSchema = vine.object({
|
|
|
51
51
|
})
|
|
52
52
|
)
|
|
53
53
|
.optional(),
|
|
54
|
-
shippingRates: vine
|
|
55
|
-
.array(vine.string().minLength(2).maxLength(48))
|
|
56
|
-
.optional(),
|
|
54
|
+
shippingRates: vine.array(vine.string().minLength(2).maxLength(48)).optional(),
|
|
57
55
|
verifiedAt: vine.date().optional(),
|
|
58
56
|
blockedAt: vine.date().optional(),
|
|
59
57
|
integrations: vine.array(vine.any()).optional(),
|
|
60
58
|
// default_shipping_rates
|
|
61
59
|
defaultShippingRates: DefaultShippingRatesSchema.optional(),
|
|
62
|
-
})
|
|
60
|
+
})
|
|
63
61
|
|
|
64
62
|
// UpdateStoreSchema
|
|
65
63
|
export const UpdateStoreSchema = vine.object({
|
|
@@ -92,14 +90,12 @@ export const UpdateStoreSchema = vine.object({
|
|
|
92
90
|
description: vine.string().minLength(2).maxLength(255).optional(),
|
|
93
91
|
addresses: vine.array(EmbaddedAddressSchema).optional(),
|
|
94
92
|
metadata: vine.object({}).optional(),
|
|
95
|
-
contacts: vine.array(
|
|
96
|
-
shippingRates: vine
|
|
97
|
-
.array(vine.string().minLength(2).maxLength(48))
|
|
98
|
-
.optional(),
|
|
93
|
+
contacts: vine.array(EmbaddedContactSchema).optional(),
|
|
94
|
+
shippingRates: vine.array(vine.string().minLength(2).maxLength(48)).optional(),
|
|
99
95
|
verifiedAt: vine.date().optional(),
|
|
100
96
|
blockedAt: vine.date().optional(),
|
|
101
97
|
// integrations
|
|
102
98
|
integrations: vine.array(vine.any()).optional(),
|
|
103
99
|
// default_shipping_rates
|
|
104
100
|
defaultShippingRates: DefaultShippingRatesSchema.optional(),
|
|
105
|
-
})
|
|
101
|
+
})
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import vine from
|
|
1
|
+
import vine from '@vinejs/vine'
|
|
2
2
|
import {
|
|
3
3
|
AvatarFileSchema,
|
|
4
|
-
|
|
4
|
+
EmbaddedContactSchema,
|
|
5
5
|
DomainSchema,
|
|
6
6
|
EmbaddedAddressSchema,
|
|
7
7
|
EmbaddedCategorySchema,
|
|
8
|
-
|
|
8
|
+
StoreBunner,
|
|
9
9
|
StoreDecorationSchema,
|
|
10
|
-
} from
|
|
10
|
+
} from './helpers.js'
|
|
11
11
|
// "defaultShippingRates.1"
|
|
12
12
|
export const DefaultShippingRatesSchema = vine.array(
|
|
13
|
-
vine.array(vine.number().min(0).max(
|
|
14
|
-
)
|
|
13
|
+
vine.array(vine.number().min(0).max(100000).nullable()).nullable()
|
|
14
|
+
)
|
|
15
15
|
|
|
16
16
|
export const CreateUserStoreSchema = vine.object({
|
|
17
17
|
name: vine.string().minLength(2).maxLength(32),
|
|
18
|
-
banner: StoreBunnerSchema.optional(),
|
|
19
18
|
slug: vine
|
|
20
19
|
.string()
|
|
21
20
|
.regex(/^[a-z0-9-]+$/)
|
|
@@ -31,6 +30,8 @@ export const CreateUserStoreSchema = vine.object({
|
|
|
31
30
|
})
|
|
32
31
|
.optional(),
|
|
33
32
|
decoration: StoreDecorationSchema.optional(),
|
|
33
|
+
|
|
34
|
+
banner: StoreBunner.optional(),
|
|
34
35
|
logoUrl: vine.string().optional(),
|
|
35
36
|
ondarkLogoUrl: vine.string().optional(),
|
|
36
37
|
logoFile: AvatarFileSchema.optional(),
|
|
@@ -51,7 +52,7 @@ export const CreateUserStoreSchema = vine.object({
|
|
|
51
52
|
.optional(),
|
|
52
53
|
defaultShippingRates: DefaultShippingRatesSchema.optional(),
|
|
53
54
|
integrations: vine.array(vine.any()).optional(),
|
|
54
|
-
})
|
|
55
|
+
})
|
|
55
56
|
|
|
56
57
|
// UpdateStoreSchema
|
|
57
58
|
export const UpdateUserStoreSchema = vine.object({
|
|
@@ -68,7 +69,7 @@ export const UpdateUserStoreSchema = vine.object({
|
|
|
68
69
|
.optional(),
|
|
69
70
|
domain: DomainSchema.optional(),
|
|
70
71
|
decoration: StoreDecorationSchema.optional(),
|
|
71
|
-
banner:
|
|
72
|
+
banner: StoreBunner.optional(),
|
|
72
73
|
logoUrl: vine.string().nullable().optional(),
|
|
73
74
|
ondarkLogoUrl: vine.string().nullable().optional(),
|
|
74
75
|
logoFile: AvatarFileSchema.optional(),
|
|
@@ -78,7 +79,7 @@ export const UpdateUserStoreSchema = vine.object({
|
|
|
78
79
|
description: vine.string().minLength(2).maxLength(255).optional(),
|
|
79
80
|
addresses: vine.array(EmbaddedAddressSchema).optional(),
|
|
80
81
|
metadata: vine.object({}).optional(),
|
|
81
|
-
contacts: vine.array(
|
|
82
|
+
contacts: vine.array(EmbaddedContactSchema).optional(),
|
|
82
83
|
defaultShippingRates: DefaultShippingRatesSchema.optional(),
|
|
83
84
|
integrations: vine.array(vine.any()).optional(),
|
|
84
|
-
})
|
|
85
|
+
})
|
package/src/core/sdk/fif.ts
DELETED