feeef 0.0.12 → 0.0.14
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,84 +1,85 @@
|
|
|
1
|
-
import { EmbaddedAddress } from
|
|
2
|
-
import { EmbaddedCategory } from
|
|
3
|
-
import { EmbaddedContact } from
|
|
1
|
+
import { EmbaddedAddress } from "../embadded/address.js";
|
|
2
|
+
import { EmbaddedCategory } from "../embadded/category.js";
|
|
3
|
+
import { EmbaddedContact } from "../embadded/contact.js";
|
|
4
4
|
// import { OrderEntity } from "./order.js";
|
|
5
5
|
// import { ShippingMethodEntity } from "./shipping_method.js";
|
|
6
|
-
import { UserEntity } from
|
|
6
|
+
import { UserEntity } from "./user.js";
|
|
7
7
|
|
|
8
8
|
export interface StoreEntity {
|
|
9
|
-
id: string
|
|
10
|
-
slug: string
|
|
11
|
-
banner: StoreBanner | null
|
|
12
|
-
action: StoreAction | null
|
|
13
|
-
domain: StoreDomain | null
|
|
14
|
-
decoration: StoreDecoration | null
|
|
15
|
-
name: string
|
|
16
|
-
logoUrl: string | null
|
|
17
|
-
ondarkLogoUrl: string | null
|
|
18
|
-
userId: string
|
|
19
|
-
categories: EmbaddedCategory[]
|
|
20
|
-
title: string | null
|
|
21
|
-
description: string | null
|
|
22
|
-
addresses: EmbaddedAddress[]
|
|
23
|
-
metadata: Record<string, any
|
|
24
|
-
contacts: EmbaddedContact[]
|
|
25
|
-
integrations: StoreIntegration[]
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
9
|
+
id: string;
|
|
10
|
+
slug: string;
|
|
11
|
+
banner: StoreBanner | null;
|
|
12
|
+
action: StoreAction | null;
|
|
13
|
+
domain: StoreDomain | null;
|
|
14
|
+
decoration: StoreDecoration | null;
|
|
15
|
+
name: string;
|
|
16
|
+
logoUrl: string | null;
|
|
17
|
+
ondarkLogoUrl: string | null;
|
|
18
|
+
userId: string;
|
|
19
|
+
categories: EmbaddedCategory[];
|
|
20
|
+
title: string | null;
|
|
21
|
+
description: string | null;
|
|
22
|
+
addresses: EmbaddedAddress[];
|
|
23
|
+
metadata: Record<string, any>;
|
|
24
|
+
contacts: EmbaddedContact[];
|
|
25
|
+
integrations: StoreIntegration[];
|
|
26
|
+
publicIntegrations: any[];
|
|
27
|
+
verifiedAt: any | null;
|
|
28
|
+
blockedAt: any | null;
|
|
29
|
+
createdAt: any;
|
|
30
|
+
updatedAt: any;
|
|
30
31
|
// products: ProductEntity[];
|
|
31
|
-
user: UserEntity
|
|
32
|
+
user: UserEntity;
|
|
32
33
|
// orders: OrderEntity[];
|
|
33
34
|
// shippingMethods: ShippingMethodEntity[];
|
|
34
|
-
defaultShippingRates: (number | null)[][] | null
|
|
35
|
+
defaultShippingRates: (number | null)[][] | null;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
export interface StoreDomain {
|
|
38
|
-
name: string
|
|
39
|
-
verifiedAt: any | null
|
|
40
|
-
metadata: Record<string, any
|
|
39
|
+
name: string;
|
|
40
|
+
verifiedAt: any | null;
|
|
41
|
+
metadata: Record<string, any>;
|
|
41
42
|
}
|
|
42
43
|
export interface StoreBanner {
|
|
43
|
-
title: string
|
|
44
|
-
url?: string | null
|
|
45
|
-
enabled: boolean
|
|
46
|
-
metadata: Record<string, any
|
|
44
|
+
title: string;
|
|
45
|
+
url?: string | null;
|
|
46
|
+
enabled: boolean;
|
|
47
|
+
metadata: Record<string, any>;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
export interface StoreDecoration {
|
|
50
|
-
primary: number
|
|
51
|
-
onPrimary?: number
|
|
52
|
-
showStoreLogoInHeader?: boolean
|
|
53
|
-
logoFullHeight?: boolean
|
|
54
|
-
showStoreNameInHeader?: boolean
|
|
55
|
-
metadata?: Record<string, any
|
|
51
|
+
primary: number;
|
|
52
|
+
onPrimary?: number;
|
|
53
|
+
showStoreLogoInHeader?: boolean;
|
|
54
|
+
logoFullHeight?: boolean;
|
|
55
|
+
showStoreNameInHeader?: boolean;
|
|
56
|
+
metadata?: Record<string, any>;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
export interface StoreIntegration {
|
|
59
|
-
type: StoreIntegrations
|
|
60
|
+
type: StoreIntegrations;
|
|
60
61
|
// any
|
|
61
|
-
[key: string]: any
|
|
62
|
-
metadata: Record<string, any
|
|
62
|
+
[key: string]: any;
|
|
63
|
+
metadata: Record<string, any>;
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
export enum StoreIntegrations {
|
|
66
|
-
telegram =
|
|
67
|
-
facebookPixel =
|
|
68
|
-
googleAnalytics =
|
|
69
|
-
googleSheet =
|
|
70
|
-
sms =
|
|
67
|
+
telegram = "telegram",
|
|
68
|
+
facebookPixel = "facebook_pixel",
|
|
69
|
+
googleAnalytics = "google_analytics",
|
|
70
|
+
googleSheet = "google_sheet",
|
|
71
|
+
sms = "sms",
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
export interface StoreAction {
|
|
74
|
-
label: string
|
|
75
|
-
url: string
|
|
76
|
-
type: StoreActionType
|
|
75
|
+
label: string;
|
|
76
|
+
url: string;
|
|
77
|
+
type: StoreActionType;
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
export enum StoreActionType {
|
|
80
|
-
link =
|
|
81
|
-
whatsapp =
|
|
82
|
-
telegram =
|
|
83
|
-
phone =
|
|
81
|
+
link = "link",
|
|
82
|
+
whatsapp = "whatsapp",
|
|
83
|
+
telegram = "telegram",
|
|
84
|
+
phone = "phone",
|
|
84
85
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import vine from
|
|
1
|
+
import vine from "@vinejs/vine";
|
|
2
2
|
import {
|
|
3
3
|
AvatarFileSchema,
|
|
4
4
|
ContactSchema,
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
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),
|
|
@@ -15,12 +15,11 @@ export const CreateStoreSchema = vine.object({
|
|
|
15
15
|
.string()
|
|
16
16
|
.regex(/^[a-z0-9-]+$/)
|
|
17
17
|
.minLength(2)
|
|
18
|
-
.maxLength(32)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
,
|
|
18
|
+
.maxLength(32),
|
|
19
|
+
// .unique(async (db, value, field) => {
|
|
20
|
+
// const store = await db.from('stores').where('slug', value).first()
|
|
21
|
+
// return !store
|
|
22
|
+
// })
|
|
24
23
|
domain: vine
|
|
25
24
|
.object({
|
|
26
25
|
name: vine.string().minLength(2).maxLength(32),
|
|
@@ -28,22 +27,16 @@ export const CreateStoreSchema = vine.object({
|
|
|
28
27
|
metadata: vine.object({}).optional(),
|
|
29
28
|
})
|
|
30
29
|
.optional(),
|
|
31
|
-
decoration:
|
|
32
|
-
.object({
|
|
33
|
-
primaryColor: vine.number().min(0x0).max(0xffffffff),
|
|
34
|
-
metadata: vine.any().optional(),
|
|
35
|
-
})
|
|
36
|
-
.optional(),
|
|
30
|
+
decoration: StoreDecorationSchema.optional(),
|
|
37
31
|
logoUrl: vine.string().optional(),
|
|
38
32
|
ondarkLogoUrl: vine.string().optional(),
|
|
39
33
|
logoFile: AvatarFileSchema.optional(),
|
|
40
34
|
ondarkLogoFile: AvatarFileSchema.optional(),
|
|
41
|
-
userId: vine.string()
|
|
35
|
+
userId: vine.string(),
|
|
42
36
|
// .exists(async (db, value, field) => {
|
|
43
37
|
// const user = await db.from('users').where('id', value).first()
|
|
44
38
|
// return !!user
|
|
45
39
|
// })
|
|
46
|
-
,
|
|
47
40
|
categories: vine.array(EmbaddedCategorySchema).optional(),
|
|
48
41
|
title: vine.string().minLength(2).maxLength(255).optional(),
|
|
49
42
|
description: vine.string().minLength(2).maxLength(255).optional(),
|
|
@@ -58,13 +51,15 @@ export const CreateStoreSchema = vine.object({
|
|
|
58
51
|
})
|
|
59
52
|
)
|
|
60
53
|
.optional(),
|
|
61
|
-
shippingRates: vine
|
|
54
|
+
shippingRates: vine
|
|
55
|
+
.array(vine.string().minLength(2).maxLength(48))
|
|
56
|
+
.optional(),
|
|
62
57
|
verifiedAt: vine.date().optional(),
|
|
63
58
|
blockedAt: vine.date().optional(),
|
|
64
59
|
integrations: vine.array(vine.any()).optional(),
|
|
65
60
|
// default_shipping_rates
|
|
66
61
|
defaultShippingRates: DefaultShippingRatesSchema.optional(),
|
|
67
|
-
})
|
|
62
|
+
});
|
|
68
63
|
|
|
69
64
|
// UpdateStoreSchema
|
|
70
65
|
export const UpdateStoreSchema = vine.object({
|
|
@@ -98,11 +93,13 @@ export const UpdateStoreSchema = vine.object({
|
|
|
98
93
|
addresses: vine.array(EmbaddedAddressSchema).optional(),
|
|
99
94
|
metadata: vine.object({}).optional(),
|
|
100
95
|
contacts: vine.array(ContactSchema).optional(),
|
|
101
|
-
shippingRates: vine
|
|
96
|
+
shippingRates: vine
|
|
97
|
+
.array(vine.string().minLength(2).maxLength(48))
|
|
98
|
+
.optional(),
|
|
102
99
|
verifiedAt: vine.date().optional(),
|
|
103
100
|
blockedAt: vine.date().optional(),
|
|
104
101
|
// integrations
|
|
105
102
|
integrations: vine.array(vine.any()).optional(),
|
|
106
103
|
// default_shipping_rates
|
|
107
104
|
defaultShippingRates: DefaultShippingRatesSchema.optional(),
|
|
108
|
-
})
|
|
105
|
+
});
|
|
@@ -30,12 +30,7 @@ export const CreateUserStoreSchema = vine.object({
|
|
|
30
30
|
name: vine.string().minLength(2).maxLength(32),
|
|
31
31
|
})
|
|
32
32
|
.optional(),
|
|
33
|
-
decoration:
|
|
34
|
-
.object({
|
|
35
|
-
primaryColor: vine.number().min(0x0).max(0xffffffff),
|
|
36
|
-
})
|
|
37
|
-
.optional(),
|
|
38
|
-
|
|
33
|
+
decoration: StoreDecorationSchema.optional(),
|
|
39
34
|
logoUrl: vine.string().optional(),
|
|
40
35
|
ondarkLogoUrl: vine.string().optional(),
|
|
41
36
|
logoFile: AvatarFileSchema.optional(),
|