feeef 0.0.25 → 0.0.27
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 +4 -2
- package/src/core/entities/store.ts +102 -85
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "feeef sdk for the web",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.27",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"dev": "vite --host",
|
|
@@ -14,9 +14,11 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@vinejs/vine": "^2.0.0",
|
|
16
16
|
"axios": "^1.6.8",
|
|
17
|
-
"axios-cache-interceptor": "^1.5.1"
|
|
17
|
+
"axios-cache-interceptor": "^1.5.1",
|
|
18
|
+
"luxon": "^3.5.0"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
21
|
+
"@types/luxon": "^3.4.2",
|
|
20
22
|
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
21
23
|
"@typescript-eslint/parser": "^6.0.0",
|
|
22
24
|
"@vitejs/plugin-react-swc": "^3.3.2",
|
|
@@ -1,138 +1,155 @@
|
|
|
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
|
|
7
|
-
import { DateTime } from
|
|
6
|
+
import { UserEntity } from "./user.js";
|
|
7
|
+
import { DateTime } from "luxon";
|
|
8
8
|
|
|
9
9
|
export interface StoreEntity {
|
|
10
|
-
id: string
|
|
11
|
-
slug: string
|
|
12
|
-
banner: StoreBanner | null
|
|
13
|
-
action: StoreAction | null
|
|
14
|
-
domain: StoreDomain | null
|
|
15
|
-
decoration: StoreDecoration | null
|
|
16
|
-
name: string
|
|
17
|
-
logoUrl: string | null
|
|
18
|
-
ondarkLogoUrl: string | null
|
|
19
|
-
userId: string
|
|
20
|
-
categories: EmbaddedCategory[]
|
|
21
|
-
title: string | null
|
|
22
|
-
description: string | null
|
|
23
|
-
addresses: EmbaddedAddress[]
|
|
24
|
-
metadata: Record<string, any
|
|
25
|
-
contacts: EmbaddedContact[]
|
|
26
|
-
integrations: StoreIntegrations
|
|
27
|
-
verifiedAt: any | null
|
|
28
|
-
blockedAt: any | null
|
|
29
|
-
createdAt: any
|
|
30
|
-
updatedAt: any
|
|
10
|
+
id: string;
|
|
11
|
+
slug: string;
|
|
12
|
+
banner: StoreBanner | null;
|
|
13
|
+
action: StoreAction | null;
|
|
14
|
+
domain: StoreDomain | null;
|
|
15
|
+
decoration: StoreDecoration | null;
|
|
16
|
+
name: string;
|
|
17
|
+
logoUrl: string | null;
|
|
18
|
+
ondarkLogoUrl: string | null;
|
|
19
|
+
userId: string;
|
|
20
|
+
categories: EmbaddedCategory[];
|
|
21
|
+
title: string | null;
|
|
22
|
+
description: string | null;
|
|
23
|
+
addresses: EmbaddedAddress[];
|
|
24
|
+
metadata: Record<string, any>;
|
|
25
|
+
contacts: EmbaddedContact[];
|
|
26
|
+
integrations: StoreIntegrations;
|
|
27
|
+
verifiedAt: any | null;
|
|
28
|
+
blockedAt: any | null;
|
|
29
|
+
createdAt: any;
|
|
30
|
+
updatedAt: any;
|
|
31
31
|
// products: ProductEntity[];
|
|
32
|
-
user?: UserEntity
|
|
32
|
+
user?: UserEntity;
|
|
33
33
|
// orders: OrderEntity[];
|
|
34
34
|
// shippingMethods: ShippingMethodEntity[];
|
|
35
|
-
defaultShippingRates: (number | null)[][] | null
|
|
35
|
+
defaultShippingRates: (number | null)[][] | null;
|
|
36
36
|
|
|
37
37
|
// subscription
|
|
38
|
-
|
|
39
|
-
due?: number
|
|
38
|
+
subscription?: any;
|
|
39
|
+
due?: number;
|
|
40
40
|
|
|
41
41
|
// StoreConfigs
|
|
42
|
-
configs?: StoreConfigs
|
|
42
|
+
configs?: StoreConfigs;
|
|
43
|
+
|
|
44
|
+
// metaPixelIds
|
|
45
|
+
metaPixelIds?: string[];
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
export interface StoreConfigs {
|
|
46
|
-
currencies: StoreCurrencyConfig[]
|
|
47
|
-
defaultCurrency: number
|
|
49
|
+
currencies: StoreCurrencyConfig[];
|
|
50
|
+
defaultCurrency: number;
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
export interface StoreCurrencyConfig {
|
|
51
|
-
code: string
|
|
52
|
-
symbol: string
|
|
53
|
-
precision: number
|
|
54
|
-
rate: number
|
|
54
|
+
code: string;
|
|
55
|
+
symbol: string;
|
|
56
|
+
precision: number;
|
|
57
|
+
rate: number;
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
export interface StoreDomain {
|
|
58
|
-
name: string
|
|
59
|
-
verifiedAt: any | null
|
|
60
|
-
metadata: Record<string, any
|
|
61
|
+
name: string;
|
|
62
|
+
verifiedAt: any | null;
|
|
63
|
+
metadata: Record<string, any>;
|
|
61
64
|
}
|
|
62
65
|
export interface StoreBanner {
|
|
63
|
-
title: string
|
|
64
|
-
url?: string | null
|
|
65
|
-
enabled: boolean
|
|
66
|
-
metadata: Record<string, any
|
|
66
|
+
title: string;
|
|
67
|
+
url?: string | null;
|
|
68
|
+
enabled: boolean;
|
|
69
|
+
metadata: Record<string, any>;
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
export interface StoreDecoration {
|
|
70
|
-
primary: number
|
|
71
|
-
onPrimary?: number
|
|
72
|
-
showStoreLogoInHeader?: boolean
|
|
73
|
-
logoFullHeight?: boolean
|
|
74
|
-
showStoreNameInHeader?: boolean
|
|
75
|
-
metadata?: Record<string, any
|
|
73
|
+
primary: number;
|
|
74
|
+
onPrimary?: number;
|
|
75
|
+
showStoreLogoInHeader?: boolean;
|
|
76
|
+
logoFullHeight?: boolean;
|
|
77
|
+
showStoreNameInHeader?: boolean;
|
|
78
|
+
metadata?: Record<string, any>;
|
|
76
79
|
}
|
|
77
80
|
|
|
78
81
|
export interface StoreAction {
|
|
79
|
-
label: string
|
|
80
|
-
url: string
|
|
81
|
-
type: StoreActionType
|
|
82
|
+
label: string;
|
|
83
|
+
url: string;
|
|
84
|
+
type: StoreActionType;
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
export enum StoreActionType {
|
|
85
|
-
link =
|
|
86
|
-
whatsapp =
|
|
87
|
-
telegram =
|
|
88
|
-
phone =
|
|
88
|
+
link = "link",
|
|
89
|
+
whatsapp = "whatsapp",
|
|
90
|
+
telegram = "telegram",
|
|
91
|
+
phone = "phone",
|
|
92
|
+
}
|
|
93
|
+
export interface MetaPixel {
|
|
94
|
+
id: string;
|
|
95
|
+
key?: string;
|
|
96
|
+
}
|
|
97
|
+
export interface MetaPixelIntegration {
|
|
98
|
+
id: string;
|
|
99
|
+
pixels: MetaPixel[];
|
|
100
|
+
active: boolean;
|
|
101
|
+
metadata: Record<string, any>;
|
|
89
102
|
}
|
|
90
103
|
|
|
91
104
|
export interface StoreIntegrations {
|
|
92
|
-
[key: string]: any
|
|
93
|
-
metadata?: Record<string, any
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
[key: string]: any;
|
|
106
|
+
metadata?: Record<string, any>;
|
|
107
|
+
|
|
108
|
+
// @Default('default') String id,
|
|
109
|
+
// @Default([]) List<MetaPixel> pixels,
|
|
110
|
+
// @Default(true) bool active,
|
|
111
|
+
// @Default({}) Map<String, dynamic> metadata,
|
|
112
|
+
metaPixel?: MetaPixelIntegration;
|
|
113
|
+
googleAnalytics?: any;
|
|
114
|
+
googleSheet?: any;
|
|
115
|
+
sms?: any;
|
|
116
|
+
telegram?: any;
|
|
117
|
+
yalidine?: any;
|
|
118
|
+
maystroDelivery?: any;
|
|
119
|
+
echotrak?: any;
|
|
120
|
+
procolis?: any;
|
|
121
|
+
noest?: any;
|
|
105
122
|
}
|
|
106
123
|
|
|
107
124
|
export enum StoreSubscriptionStatus {
|
|
108
|
-
active =
|
|
109
|
-
inactive =
|
|
125
|
+
active = "active",
|
|
126
|
+
inactive = "inactive",
|
|
110
127
|
}
|
|
111
128
|
|
|
112
129
|
export enum StoreSubscriptionType {
|
|
113
|
-
free =
|
|
114
|
-
quota =
|
|
115
|
-
percentage =
|
|
130
|
+
free = "free",
|
|
131
|
+
quota = "quota",
|
|
132
|
+
percentage = "percentage",
|
|
116
133
|
}
|
|
117
134
|
|
|
118
135
|
export interface StoreSubscription {
|
|
119
|
-
type: StoreSubscriptionType
|
|
120
|
-
status: StoreSubscriptionStatus
|
|
121
|
-
startedAt: DateTime
|
|
122
|
-
expiresAt: DateTime | null
|
|
123
|
-
metadata: Record<string, any
|
|
136
|
+
type: StoreSubscriptionType;
|
|
137
|
+
status: StoreSubscriptionStatus;
|
|
138
|
+
startedAt: DateTime;
|
|
139
|
+
expiresAt: DateTime | null;
|
|
140
|
+
metadata: Record<string, any>;
|
|
124
141
|
}
|
|
125
142
|
|
|
126
143
|
export interface StoreFreeSubscription extends StoreSubscription {
|
|
127
|
-
type: StoreSubscriptionType.free
|
|
144
|
+
type: StoreSubscriptionType.free;
|
|
128
145
|
}
|
|
129
146
|
|
|
130
147
|
export interface StoreQuotaSubscription extends StoreSubscription {
|
|
131
|
-
type: StoreSubscriptionType.quota
|
|
132
|
-
quota: number
|
|
148
|
+
type: StoreSubscriptionType.quota;
|
|
149
|
+
quota: number;
|
|
133
150
|
}
|
|
134
151
|
// another way is by taking percentage of the sales
|
|
135
152
|
export interface StorePercentageSubscription extends StoreSubscription {
|
|
136
|
-
type: StoreSubscriptionType.percentage
|
|
137
|
-
percentage: number
|
|
153
|
+
type: StoreSubscriptionType.percentage;
|
|
154
|
+
percentage: number;
|
|
138
155
|
}
|