@psmarketplace/config 10.23.1
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/LICENSE +21 -0
- package/README.md +26 -0
- package/dist/auth/index.js +58 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/policy.js +120 -0
- package/dist/auth/policy.js.map +1 -0
- package/dist/environment/base.js +560 -0
- package/dist/environment/base.js.map +1 -0
- package/dist/environment/decorators.js +98 -0
- package/dist/environment/decorators.js.map +1 -0
- package/dist/environment/index.js +37 -0
- package/dist/environment/index.js.map +1 -0
- package/dist/environment/types.js +3 -0
- package/dist/environment/types.js.map +1 -0
- package/dist/events/index.js +12 -0
- package/dist/events/index.js.map +1 -0
- package/dist/helpers/index.js +68 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/uid.js +87 -0
- package/dist/helpers/uid.js.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/metrics.js +6 -0
- package/dist/metrics.js.map +1 -0
- package/dist/path/index.js +47 -0
- package/dist/path/index.js.map +1 -0
- package/dist/plans/base.js +117 -0
- package/dist/plans/base.js.map +1 -0
- package/dist/plans/index.js +223 -0
- package/dist/plans/index.js.map +1 -0
- package/dist/plans/types.js +3 -0
- package/dist/plans/types.js.map +1 -0
- package/dist/types/auth/index.d.ts +22 -0
- package/dist/types/auth/index.d.ts.map +1 -0
- package/dist/types/auth/policy.d.ts +13 -0
- package/dist/types/auth/policy.d.ts.map +1 -0
- package/dist/types/environment/base.d.ts +4 -0
- package/dist/types/environment/base.d.ts.map +1 -0
- package/dist/types/environment/decorators.d.ts +7 -0
- package/dist/types/environment/decorators.d.ts.map +1 -0
- package/dist/types/environment/index.d.ts +16 -0
- package/dist/types/environment/index.d.ts.map +1 -0
- package/dist/types/environment/types.d.ts +162 -0
- package/dist/types/environment/types.d.ts.map +1 -0
- package/dist/types/events/index.d.ts +59 -0
- package/dist/types/events/index.d.ts.map +1 -0
- package/dist/types/helpers/index.d.ts +66 -0
- package/dist/types/helpers/index.d.ts.map +1 -0
- package/dist/types/helpers/uid.d.ts +6 -0
- package/dist/types/helpers/uid.d.ts.map +1 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/metrics.d.ts +3 -0
- package/dist/types/metrics.d.ts.map +1 -0
- package/dist/types/path/index.d.ts +8 -0
- package/dist/types/path/index.d.ts.map +1 -0
- package/dist/types/plans/base.d.ts +9 -0
- package/dist/types/plans/base.d.ts.map +1 -0
- package/dist/types/plans/index.d.ts +10 -0
- package/dist/types/plans/index.d.ts.map +1 -0
- package/dist/types/plans/types.d.ts +179 -0
- package/dist/types/plans/types.d.ts.map +1 -0
- package/dist/types/types.d.ts +3641 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/utils/flatten.d.ts +9 -0
- package/dist/types/utils/flatten.d.ts.map +1 -0
- package/dist/types/whatsapp/index.d.ts +4 -0
- package/dist/types/whatsapp/index.d.ts.map +1 -0
- package/dist/types/whatsapp/requests.d.ts +82 -0
- package/dist/types/whatsapp/requests.d.ts.map +1 -0
- package/dist/types/whatsapp/responses.d.ts +170 -0
- package/dist/types/whatsapp/responses.d.ts.map +1 -0
- package/dist/types.js +734 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/flatten.js +43 -0
- package/dist/utils/flatten.js.map +1 -0
- package/dist/whatsapp/index.js +7 -0
- package/dist/whatsapp/index.js.map +1 -0
- package/dist/whatsapp/requests.js +3 -0
- package/dist/whatsapp/requests.js.map +1 -0
- package/dist/whatsapp/responses.js +3 -0
- package/dist/whatsapp/responses.js.map +1 -0
- package/package.json +32 -0
- package/src/auth/index.ts +72 -0
- package/src/auth/policy.ts +277 -0
- package/src/environment/base.ts +602 -0
- package/src/environment/decorators.ts +97 -0
- package/src/environment/index.ts +35 -0
- package/src/environment/types.ts +174 -0
- package/src/events/index.ts +80 -0
- package/src/helpers/index.ts +121 -0
- package/src/helpers/uid.ts +108 -0
- package/src/index.ts +52 -0
- package/src/metrics.ts +3 -0
- package/src/path/index.ts +61 -0
- package/src/plans/base.ts +121 -0
- package/src/plans/index.ts +233 -0
- package/src/plans/types.ts +208 -0
- package/src/types.ts +4362 -0
- package/src/utils/flatten.ts +60 -0
- package/src/whatsapp/index.ts +4 -0
- package/src/whatsapp/requests.ts +113 -0
- package/src/whatsapp/responses.ts +197 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { ProductCreationParams, ProductReference } from './types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param envName
|
|
6
|
+
* @param params
|
|
7
|
+
*/
|
|
8
|
+
const createProducts = (params: ProductCreationParams): ProductReference => {
|
|
9
|
+
const plans: string[] =
|
|
10
|
+
Object.values(params.classic.tariffs ?? {}).map((t) => t.id) ?? [];
|
|
11
|
+
|
|
12
|
+
const products: ProductReference = {
|
|
13
|
+
classic: {
|
|
14
|
+
id: params.classic.id,
|
|
15
|
+
internal: 'classic',
|
|
16
|
+
product: {
|
|
17
|
+
id: params.classic.id,
|
|
18
|
+
name: 'Abonnement Articho',
|
|
19
|
+
description: '',
|
|
20
|
+
type: 'service',
|
|
21
|
+
price: 159,
|
|
22
|
+
main: true,
|
|
23
|
+
active: true,
|
|
24
|
+
isPrivate: false,
|
|
25
|
+
rating: 3,
|
|
26
|
+
order: 3,
|
|
27
|
+
includes: {
|
|
28
|
+
maxAdminUsers: 1,
|
|
29
|
+
maxAgentUsers: 0,
|
|
30
|
+
maxProUsers: 0,
|
|
31
|
+
maxSellerUsers: 0,
|
|
32
|
+
authorizationManagement: true,
|
|
33
|
+
dashboard: true,
|
|
34
|
+
accounting: true,
|
|
35
|
+
projectStorage: true,
|
|
36
|
+
customCatalog: true,
|
|
37
|
+
customConfig: true,
|
|
38
|
+
exportReports: true,
|
|
39
|
+
externalApiIntegration: true,
|
|
40
|
+
support: true,
|
|
41
|
+
},
|
|
42
|
+
plans,
|
|
43
|
+
tax_rates: params.classic.tax_rates,
|
|
44
|
+
},
|
|
45
|
+
tariffs: params.classic.tariffs,
|
|
46
|
+
},
|
|
47
|
+
standard: {
|
|
48
|
+
id: params.standard.id,
|
|
49
|
+
internal: 'standard',
|
|
50
|
+
product: {
|
|
51
|
+
id: params.standard.id,
|
|
52
|
+
name: 'Standard',
|
|
53
|
+
description: 'Pour les entreprises unipersonnelles',
|
|
54
|
+
type: 'service',
|
|
55
|
+
price: 69,
|
|
56
|
+
main: true,
|
|
57
|
+
active: true,
|
|
58
|
+
isPrivate: true,
|
|
59
|
+
rating: 1,
|
|
60
|
+
order: 1,
|
|
61
|
+
includes: {
|
|
62
|
+
maxAdminUsers: null,
|
|
63
|
+
maxAgentUsers: null,
|
|
64
|
+
maxProUsers: null,
|
|
65
|
+
maxSellerUsers: null,
|
|
66
|
+
authorizationManagement: true,
|
|
67
|
+
dashboard: true,
|
|
68
|
+
accounting: true,
|
|
69
|
+
projectStorage: true,
|
|
70
|
+
customCatalog: true,
|
|
71
|
+
customConfig: true,
|
|
72
|
+
exportReports: true,
|
|
73
|
+
externalApiIntegration: true,
|
|
74
|
+
support: true,
|
|
75
|
+
},
|
|
76
|
+
plans,
|
|
77
|
+
tax_rates: params.standard.tax_rates,
|
|
78
|
+
},
|
|
79
|
+
tariffs: params.standard.tariffs,
|
|
80
|
+
},
|
|
81
|
+
plus: {
|
|
82
|
+
id: params.plus.id,
|
|
83
|
+
internal: 'plus',
|
|
84
|
+
product: {
|
|
85
|
+
id: params.plus.id,
|
|
86
|
+
name: 'Plus',
|
|
87
|
+
description:
|
|
88
|
+
'Idéal pour les agences et les entreprises de plus grande taille',
|
|
89
|
+
type: 'service',
|
|
90
|
+
price: 159,
|
|
91
|
+
main: true,
|
|
92
|
+
active: true,
|
|
93
|
+
isPrivate: true,
|
|
94
|
+
rating: 2,
|
|
95
|
+
order: 2,
|
|
96
|
+
includes: {
|
|
97
|
+
maxAdminUsers: null,
|
|
98
|
+
maxAgentUsers: null,
|
|
99
|
+
maxProUsers: null,
|
|
100
|
+
maxSellerUsers: null,
|
|
101
|
+
authorizationManagement: true,
|
|
102
|
+
dashboard: true,
|
|
103
|
+
accounting: true,
|
|
104
|
+
projectStorage: true,
|
|
105
|
+
customCatalog: true,
|
|
106
|
+
customConfig: true,
|
|
107
|
+
exportReports: true,
|
|
108
|
+
externalApiIntegration: true,
|
|
109
|
+
support: true,
|
|
110
|
+
},
|
|
111
|
+
plans,
|
|
112
|
+
tax_rates: params.plus.tax_rates,
|
|
113
|
+
},
|
|
114
|
+
tariffs: params.plus.tariffs,
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
return products;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export default createProducts;
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Product,
|
|
3
|
+
DeploymentEnvironment,
|
|
4
|
+
ProductCreationParams,
|
|
5
|
+
ProductReference,
|
|
6
|
+
ProductEntry,
|
|
7
|
+
} from './types';
|
|
8
|
+
|
|
9
|
+
import createProducts from './base';
|
|
10
|
+
import { SubscriptionSettings } from '../types';
|
|
11
|
+
|
|
12
|
+
export { Product, ProductEntry, SubscriptionSettings };
|
|
13
|
+
|
|
14
|
+
const testing: ProductCreationParams = {
|
|
15
|
+
classic: {
|
|
16
|
+
id: 'prod_KzmO4rORyWl8cA',
|
|
17
|
+
tax_rates: ['txr_1HPXZVLFzcsAA7x6w0zpHu01'],
|
|
18
|
+
tariffs: {
|
|
19
|
+
base: {
|
|
20
|
+
id: 'price_1KJmpiLFzcsAA7x6rLA0GNZX',
|
|
21
|
+
price: 159,
|
|
22
|
+
usageType: 'licensed',
|
|
23
|
+
type: 'base',
|
|
24
|
+
},
|
|
25
|
+
additionalAdmin: {
|
|
26
|
+
id: 'price_1KJmpiLFzcsAA7x6VtCIuhqw',
|
|
27
|
+
price: 30,
|
|
28
|
+
usageType: 'metered',
|
|
29
|
+
type: 'extra_user',
|
|
30
|
+
},
|
|
31
|
+
additionalAgent: {
|
|
32
|
+
id: 'price_1KJmpiLFzcsAA7x6gFBgAXkr',
|
|
33
|
+
price: 20,
|
|
34
|
+
usageType: 'metered',
|
|
35
|
+
type: 'extra_user',
|
|
36
|
+
},
|
|
37
|
+
additionalPro: {
|
|
38
|
+
id: 'price_1KJmpiLFzcsAA7x6JxTnlLC8',
|
|
39
|
+
price: 10,
|
|
40
|
+
usageType: 'metered',
|
|
41
|
+
type: 'extra_user',
|
|
42
|
+
},
|
|
43
|
+
additionalSeller: {
|
|
44
|
+
id: 'price_1KJmpiLFzcsAA7x6XS9PBgQo',
|
|
45
|
+
price: 2,
|
|
46
|
+
usageType: 'metered',
|
|
47
|
+
type: 'extra_user',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
standard: {
|
|
52
|
+
id: 'prod_KzmEyS3UQ5lbnz',
|
|
53
|
+
tax_rates: ['txr_1HPXZVLFzcsAA7x6w0zpHu01'],
|
|
54
|
+
tariffs: {
|
|
55
|
+
base: {
|
|
56
|
+
id: 'price_1KJmg4LFzcsAA7x6SMfj1iDu',
|
|
57
|
+
price: 69,
|
|
58
|
+
usageType: 'licensed',
|
|
59
|
+
type: 'base',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
// prices: {
|
|
63
|
+
// monthly: 'price_1KJmg4LFzcsAA7x6SMfj1iDu',
|
|
64
|
+
// additionalUser: 'price_1KJmg4LFzcsAA7x6yzvGdoxe',
|
|
65
|
+
// },
|
|
66
|
+
// additionalUserPrice: 10,
|
|
67
|
+
},
|
|
68
|
+
plus: {
|
|
69
|
+
id: 'prod_KzmyY1ysEOeK93',
|
|
70
|
+
tax_rates: ['txr_1HPXZVLFzcsAA7x6w0zpHu01'],
|
|
71
|
+
tariffs: {
|
|
72
|
+
base: {
|
|
73
|
+
id: 'price_1KJnP0LFzcsAA7x6oDVeaPAv',
|
|
74
|
+
price: 159,
|
|
75
|
+
usageType: 'licensed',
|
|
76
|
+
type: 'base',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
// test_1: {
|
|
81
|
+
// id: 'prod_L2ZqDUzF0HFuFN',
|
|
82
|
+
// tax_rates: ['txr_1HPXZVLFzcsAA7x6w0zpHu01'],
|
|
83
|
+
// tariffs: {
|
|
84
|
+
// base: { id: 'price_1KMUgwLFzcsAA7x6c3wk0Buy', price: 50, usageType: 'licensed', type: 'base' },
|
|
85
|
+
// additionalAdmin: { id: 'price_1KMUgwLFzcsAA7x6X8qYBxls', price: 10, usageType: 'metered', type: 'extra_user' },
|
|
86
|
+
// additionalAgent: { id: 'price_1KMUgwLFzcsAA7x6fyOLh2gM', price: 8, usageType: 'metered', type: 'extra_user' },
|
|
87
|
+
// additionalPro: { id: 'price_1KMUgwLFzcsAA7x6eB6Oevw2', price: 6, usageType: 'metered', type: 'extra_user' },
|
|
88
|
+
// additionalSeller: { id: 'price_1KMUgwLFzcsAA7x6s9WBpxTS', price: 4, usageType: 'metered', type: 'extra_user' },
|
|
89
|
+
// },
|
|
90
|
+
// },
|
|
91
|
+
// test_2: {
|
|
92
|
+
// id: 'prod_L2xmEk7gqqRJtS',
|
|
93
|
+
// tax_rates: ['txr_1HPXZVLFzcsAA7x6w0zpHu01'],
|
|
94
|
+
// tariffs: {
|
|
95
|
+
// base: { id: 'price_1KMrqrLFzcsAA7x62Ag7xwjU', price: 100, usageType: 'licensed', type: 'base' },
|
|
96
|
+
// additionalAdmin: { id: 'price_1KMrqrLFzcsAA7x6cu3it43A', price: 20, usageType: 'metered', type: 'extra_user' },
|
|
97
|
+
// additionalAgent: { id: 'price_1KMrqrLFzcsAA7x6eNCDb3D6', price: 16, usageType: 'metered', type: 'extra_user' },
|
|
98
|
+
// additionalPro: { id: 'price_1KMrqrLFzcsAA7x6wRuDxyyN', price: 12, usageType: 'metered', type: 'extra_user' },
|
|
99
|
+
// additionalSeller: { id: 'price_1KMrqsLFzcsAA7x61NRR9gne', price: 8, usageType: 'metered', type: 'extra_user' },
|
|
100
|
+
// },
|
|
101
|
+
// },
|
|
102
|
+
// test_3: {
|
|
103
|
+
// id: 'prod_L2xnCHGi6QNgX8',
|
|
104
|
+
// tax_rates: ['txr_1HPXZVLFzcsAA7x6w0zpHu01'],
|
|
105
|
+
// tariffs: {
|
|
106
|
+
// base: { id: 'price_1KMrs0LFzcsAA7x6p2tkW6lu', price: 80, usageType: 'licensed', type: 'base' },
|
|
107
|
+
// },
|
|
108
|
+
// },
|
|
109
|
+
// test_4: {
|
|
110
|
+
// id: 'prod_L2yWF4ssugw8Ln',
|
|
111
|
+
// tax_rates: ['txr_1HPXZVLFzcsAA7x6w0zpHu01'],
|
|
112
|
+
// tariffs: {
|
|
113
|
+
// base: { id: 'price_1KMsZFLFzcsAA7x6qVbCQpuN', price: 65, usageType: 'licensed', type: 'base' },
|
|
114
|
+
// additionalAdmin: { id: 'price_1KMsZFLFzcsAA7x6EjaDfica', price: 15, usageType: 'metered', type: 'extra_user' },
|
|
115
|
+
// additionalAgent: { id: 'price_1KMsZFLFzcsAA7x6T1FI1WF4', price: 12, usageType: 'metered', type: 'extra_user' },
|
|
116
|
+
// additionalPro: { id: 'price_1KMsZFLFzcsAA7x6L6I0M1ND', price: 9, usageType: 'metered', type: 'extra_user' },
|
|
117
|
+
// additionalSeller: { id: 'price_1KMsZFLFzcsAA7x6G5GXzPeW', price: 6, usageType: 'metered', type: 'extra_user' },
|
|
118
|
+
// },
|
|
119
|
+
// },
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const production: ProductCreationParams = {
|
|
123
|
+
classic: {
|
|
124
|
+
id: 'prod_KzmYFhrWXrzWdR',
|
|
125
|
+
tax_rates: ['txr_1HIMA8LFzcsAA7x61nsqfrYU'],
|
|
126
|
+
tariffs: {
|
|
127
|
+
base: {
|
|
128
|
+
id: 'price_1KJmzNLFzcsAA7x6I6gNlCpY',
|
|
129
|
+
price: 159,
|
|
130
|
+
usageType: 'licensed',
|
|
131
|
+
type: 'base',
|
|
132
|
+
},
|
|
133
|
+
additionalAdmin: {
|
|
134
|
+
id: 'price_1KJmzNLFzcsAA7x6Tl6D8Wus',
|
|
135
|
+
price: 30,
|
|
136
|
+
usageType: 'metered',
|
|
137
|
+
type: 'extra_user',
|
|
138
|
+
},
|
|
139
|
+
additionalAgent: {
|
|
140
|
+
id: 'price_1KJmzNLFzcsAA7x6DeUQScKY',
|
|
141
|
+
price: 20,
|
|
142
|
+
usageType: 'metered',
|
|
143
|
+
type: 'extra_user',
|
|
144
|
+
},
|
|
145
|
+
additionalPro: {
|
|
146
|
+
id: 'price_1KJmzNLFzcsAA7x695wsj6rA',
|
|
147
|
+
price: 10,
|
|
148
|
+
usageType: 'metered',
|
|
149
|
+
type: 'extra_user',
|
|
150
|
+
},
|
|
151
|
+
additionalSeller: {
|
|
152
|
+
id: 'price_1KJmzNLFzcsAA7x6gF62MX41',
|
|
153
|
+
price: 2,
|
|
154
|
+
usageType: 'metered',
|
|
155
|
+
type: 'extra_user',
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
standard: {
|
|
160
|
+
id: 'prod_HsAwETfIUblsAT',
|
|
161
|
+
tax_rates: ['txr_1HIMA8LFzcsAA7x61nsqfrYU'],
|
|
162
|
+
tariffs: {
|
|
163
|
+
base: {
|
|
164
|
+
id: 'price_1HIQaILFzcsAA7x6NVk3cJu1',
|
|
165
|
+
price: 69,
|
|
166
|
+
usageType: 'licensed',
|
|
167
|
+
type: 'base',
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
plus: {
|
|
172
|
+
id: 'prod_HsB2YJPEZ9H98c',
|
|
173
|
+
tax_rates: ['txr_1HIMA8LFzcsAA7x61nsqfrYU'],
|
|
174
|
+
tariffs: {
|
|
175
|
+
base: {
|
|
176
|
+
id: 'price_1HIQg0LFzcsAA7x6X6lfFUdv',
|
|
177
|
+
price: 159,
|
|
178
|
+
usageType: 'licensed',
|
|
179
|
+
type: 'base',
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
// test_1: {
|
|
184
|
+
// id: 'prod_L2ZqDUzF0HFuFN',
|
|
185
|
+
// tax_rates: ['txr_1HPXZVLFzcsAA7x6w0zpHu01'],
|
|
186
|
+
// tariffs: {
|
|
187
|
+
// base: { id: 'price_1KMUgwLFzcsAA7x6c3wk0Buy', price: 50, usageType: 'licensed', type: 'base' },
|
|
188
|
+
// additionalAdmin: { id: 'price_1KMUgwLFzcsAA7x6X8qYBxls', price: 10, usageType: 'metered', type: 'extra_user' },
|
|
189
|
+
// additionalAgent: { id: 'price_1KMUgwLFzcsAA7x6fyOLh2gM', price: 8, usageType: 'metered', type: 'extra_user' },
|
|
190
|
+
// additionalPro: { id: 'price_1KMUgwLFzcsAA7x6eB6Oevw2', price: 6, usageType: 'metered', type: 'extra_user' },
|
|
191
|
+
// additionalSeller: { id: 'price_1KMUgwLFzcsAA7x6s9WBpxTS', price: 4, usageType: 'metered', type: 'extra_user' },
|
|
192
|
+
// },
|
|
193
|
+
// },
|
|
194
|
+
// test_2: {
|
|
195
|
+
// id: 'prod_L2xmEk7gqqRJtS',
|
|
196
|
+
// tax_rates: ['txr_1HPXZVLFzcsAA7x6w0zpHu01'],
|
|
197
|
+
// tariffs: {
|
|
198
|
+
// base: { id: 'price_1KMrqrLFzcsAA7x62Ag7xwjU', price: 100, usageType: 'licensed', type: 'base' },
|
|
199
|
+
// additionalAdmin: { id: 'price_1KMrqrLFzcsAA7x6cu3it43A', price: 20, usageType: 'metered', type: 'extra_user' },
|
|
200
|
+
// additionalAgent: { id: 'price_1KMrqrLFzcsAA7x6eNCDb3D6', price: 16, usageType: 'metered', type: 'extra_user' },
|
|
201
|
+
// additionalPro: { id: 'price_1KMrqrLFzcsAA7x6wRuDxyyN', price: 12, usageType: 'metered', type: 'extra_user' },
|
|
202
|
+
// additionalSeller: { id: 'price_1KMrqsLFzcsAA7x61NRR9gne', price: 8, usageType: 'metered', type: 'extra_user' },
|
|
203
|
+
// },
|
|
204
|
+
// },
|
|
205
|
+
// test_3: {
|
|
206
|
+
// id: 'prod_L2xnCHGi6QNgX8',
|
|
207
|
+
// tax_rates: ['txr_1HPXZVLFzcsAA7x6w0zpHu01'],
|
|
208
|
+
// tariffs: {
|
|
209
|
+
// base: { id: 'price_1KMrs0LFzcsAA7x6p2tkW6lu', price: 80, usageType: 'licensed', type: 'base' },
|
|
210
|
+
// },
|
|
211
|
+
// },
|
|
212
|
+
// test_4: {
|
|
213
|
+
// id: 'prod_L2yWF4ssugw8Ln',
|
|
214
|
+
// tax_rates: ['txr_1HPXZVLFzcsAA7x6w0zpHu01'],
|
|
215
|
+
// tariffs: {
|
|
216
|
+
// base: { id: 'price_1KMsZFLFzcsAA7x6qVbCQpuN', price: 65, usageType: 'licensed', type: 'base' },
|
|
217
|
+
// additionalAdmin: { id: 'price_1KMsZFLFzcsAA7x6EjaDfica', price: 15, usageType: 'metered', type: 'extra_user' },
|
|
218
|
+
// additionalAgent: { id: 'price_1KMsZFLFzcsAA7x6T1FI1WF4', price: 12, usageType: 'metered', type: 'extra_user' },
|
|
219
|
+
// additionalPro: { id: 'price_1KMsZFLFzcsAA7x6L6I0M1ND', price: 9, usageType: 'metered', type: 'extra_user' },
|
|
220
|
+
// additionalSeller: { id: 'price_1KMsZFLFzcsAA7x6G5GXzPeW', price: 6, usageType: 'metered', type: 'extra_user' },
|
|
221
|
+
// },
|
|
222
|
+
// },
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
*
|
|
227
|
+
* @param envName
|
|
228
|
+
*/
|
|
229
|
+
export default (envName: DeploymentEnvironment): ProductReference => {
|
|
230
|
+
if (envName === 'production') return createProducts(production);
|
|
231
|
+
|
|
232
|
+
return createProducts(testing);
|
|
233
|
+
};
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { SubscriptionSettings } from '../types';
|
|
2
|
+
|
|
3
|
+
export type DeploymentEnvironment = 'development' | 'staging' | 'production';
|
|
4
|
+
|
|
5
|
+
export interface CouponSettings {
|
|
6
|
+
/**
|
|
7
|
+
* How many admins extra can have a team
|
|
8
|
+
*/
|
|
9
|
+
adminUsersFree?: number | 'all';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* How many agents extra can have a team
|
|
13
|
+
*/
|
|
14
|
+
agentUsersFree?: number | 'all';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* How many pros extra can have a team
|
|
18
|
+
*/
|
|
19
|
+
proUsersFree?: number | 'all';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* How many sellers extra can have a team
|
|
23
|
+
*/
|
|
24
|
+
sellerUsersFree?: number | 'all';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface Coupon {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
object: string;
|
|
31
|
+
amount_off?: number;
|
|
32
|
+
percent_off?: number;
|
|
33
|
+
created: number;
|
|
34
|
+
currency?: string;
|
|
35
|
+
duration: string;
|
|
36
|
+
duration_in_months?: any;
|
|
37
|
+
livemode: boolean;
|
|
38
|
+
max_redemptions?: any;
|
|
39
|
+
redeem_by?: any;
|
|
40
|
+
times_redeemed?: number;
|
|
41
|
+
valid: boolean;
|
|
42
|
+
metadata?: CouponSettings;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface Product {
|
|
46
|
+
/**
|
|
47
|
+
* the internal product ID
|
|
48
|
+
*/
|
|
49
|
+
id: string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
order: number;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The product price
|
|
58
|
+
*/
|
|
59
|
+
price: number;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The name of product
|
|
63
|
+
*/
|
|
64
|
+
name: string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Type of product
|
|
68
|
+
*/
|
|
69
|
+
type: 'service';
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Is this product active?
|
|
73
|
+
*/
|
|
74
|
+
active: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Description to show to users
|
|
77
|
+
*/
|
|
78
|
+
description: string;
|
|
79
|
+
/**
|
|
80
|
+
* Marked as default
|
|
81
|
+
*/
|
|
82
|
+
isDefault?: boolean;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Marked as need on signup screen
|
|
86
|
+
*/
|
|
87
|
+
main?: boolean;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Indicate rating among products
|
|
91
|
+
*/
|
|
92
|
+
rating: 1 | 2 | 3;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Marked as private
|
|
96
|
+
*/
|
|
97
|
+
isPrivate?: boolean;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Stripe plans associated with this product to be charged automatically
|
|
101
|
+
*/
|
|
102
|
+
plans: string[];
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* What's inclued within the product
|
|
106
|
+
*/
|
|
107
|
+
includes: SubscriptionSettings;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Ids of taxes applied to this product
|
|
111
|
+
*/
|
|
112
|
+
tax_rates: string[];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export type ProductEntry = {
|
|
116
|
+
id: string;
|
|
117
|
+
internal: string;
|
|
118
|
+
product: Product;
|
|
119
|
+
tariffs: {
|
|
120
|
+
base: {
|
|
121
|
+
id: string;
|
|
122
|
+
price: number;
|
|
123
|
+
usageType: 'licensed' | 'metered';
|
|
124
|
+
type: 'base' | 'extra_user';
|
|
125
|
+
};
|
|
126
|
+
additionalAdmin?: {
|
|
127
|
+
id: string;
|
|
128
|
+
price: number;
|
|
129
|
+
usageType: 'licensed' | 'metered';
|
|
130
|
+
type: 'base' | 'extra_user';
|
|
131
|
+
};
|
|
132
|
+
additionalAgent?: {
|
|
133
|
+
id: string;
|
|
134
|
+
price: number;
|
|
135
|
+
usageType: 'licensed' | 'metered';
|
|
136
|
+
type: 'base' | 'extra_user';
|
|
137
|
+
};
|
|
138
|
+
additionalPro?: {
|
|
139
|
+
id: string;
|
|
140
|
+
price: number;
|
|
141
|
+
usageType: 'licensed' | 'metered';
|
|
142
|
+
type: 'base' | 'extra_user';
|
|
143
|
+
};
|
|
144
|
+
additionalSeller?: {
|
|
145
|
+
id: string;
|
|
146
|
+
price: number;
|
|
147
|
+
usageType: 'licensed' | 'metered';
|
|
148
|
+
type: 'base' | 'extra_user';
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export type ProductReference = {
|
|
154
|
+
classic: ProductEntry;
|
|
155
|
+
plus: ProductEntry;
|
|
156
|
+
standard: ProductEntry;
|
|
157
|
+
// test_1: ProductEntry;
|
|
158
|
+
// test_2: ProductEntry;
|
|
159
|
+
// test_3: ProductEntry;
|
|
160
|
+
// test_4: ProductEntry;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export type ProductCreationEntry = {
|
|
164
|
+
id: string;
|
|
165
|
+
tax_rates: string[];
|
|
166
|
+
tariffs: {
|
|
167
|
+
base: {
|
|
168
|
+
id: string;
|
|
169
|
+
price: number;
|
|
170
|
+
usageType: 'licensed' | 'metered';
|
|
171
|
+
type: 'base' | 'extra_user';
|
|
172
|
+
};
|
|
173
|
+
additionalAdmin?: {
|
|
174
|
+
id: string;
|
|
175
|
+
price: number;
|
|
176
|
+
usageType: 'licensed' | 'metered';
|
|
177
|
+
type: 'base' | 'extra_user';
|
|
178
|
+
};
|
|
179
|
+
additionalAgent?: {
|
|
180
|
+
id: string;
|
|
181
|
+
price: number;
|
|
182
|
+
usageType: 'licensed' | 'metered';
|
|
183
|
+
type: 'base' | 'extra_user';
|
|
184
|
+
};
|
|
185
|
+
additionalPro?: {
|
|
186
|
+
id: string;
|
|
187
|
+
price: number;
|
|
188
|
+
usageType: 'licensed' | 'metered';
|
|
189
|
+
type: 'base' | 'extra_user';
|
|
190
|
+
};
|
|
191
|
+
additionalSeller?: {
|
|
192
|
+
id: string;
|
|
193
|
+
price: number;
|
|
194
|
+
usageType: 'licensed' | 'metered';
|
|
195
|
+
type: 'base' | 'extra_user';
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export type ProductCreationParams = {
|
|
201
|
+
classic: ProductCreationEntry;
|
|
202
|
+
standard: ProductCreationEntry;
|
|
203
|
+
plus: ProductCreationEntry;
|
|
204
|
+
// test_1: ProductCreationEntry;
|
|
205
|
+
// test_2: ProductCreationEntry;
|
|
206
|
+
// test_3: ProductCreationEntry;
|
|
207
|
+
// test_4: ProductCreationEntry;
|
|
208
|
+
};
|