oneentry 1.0.159 → 1.0.161
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/README.md +2 -0
- package/changelog.md +56 -1
- package/dist/admins/adminsApi.d.ts +15 -1
- package/dist/admins/adminsApi.js +29 -0
- package/dist/admins/adminsInterfaces.d.ts +37 -1
- package/dist/base/lazySchema.d.ts +15 -0
- package/dist/base/lazySchema.js +20 -0
- package/dist/discounts/discountsApi.d.ts +14 -1
- package/dist/discounts/discountsApi.js +21 -0
- package/dist/discounts/discountsInterfaces.d.ts +27 -1
- package/dist/filters/filtersInterfaces.d.ts +2 -2
- package/dist/filters/filtersSchemas.d.ts +1 -1
- package/dist/filters/filtersSchemas.js +4 -1
- package/dist/forms-data/formsDataApi.d.ts +14 -1
- package/dist/forms-data/formsDataApi.js +21 -0
- package/dist/forms-data/formsDataInterfaces.d.ts +74 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/orders/ordersApi.d.ts +15 -1
- package/dist/orders/ordersApi.js +22 -0
- package/dist/orders/ordersInterfaces.d.ts +27 -1
- package/dist/pages/pagesApi.d.ts +14 -1
- package/dist/pages/pagesApi.js +21 -0
- package/dist/pages/pagesInterfaces.d.ts +38 -1
- package/dist/payments/paymentsInterfaces.d.ts +2 -2
- package/dist/products/productsInterfaces.d.ts +1 -1
- package/dist/search/searchApi.d.ts +35 -0
- package/dist/search/searchApi.js +86 -0
- package/dist/search/searchInterfaces.d.ts +94 -0
- package/dist/search/searchInterfaces.js +2 -0
- package/dist/search/searchSchemas.d.ts +73 -0
- package/dist/search/searchSchemas.js +44 -0
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +0 -2
- package/dist/templates-preview/templatesPreviewSchemas.d.ts +0 -2
- package/dist/templates-preview/templatesPreviewSchemas.js +0 -1
- package/dist/types.d.ts +35 -0
- package/dist/types.js +2 -0
- package/dist/users/usersApi.d.ts +15 -1
- package/dist/users/usersApi.js +22 -0
- package/dist/users/usersInterfaces.d.ts +39 -1
- package/dist/web-socket/lazySocket.d.ts +18 -0
- package/dist/web-socket/lazySocket.js +70 -0
- package/esm/admins/adminsApi.d.ts +66 -0
- package/esm/admins/adminsApi.js +90 -0
- package/esm/admins/adminsInterfaces.d.ts +137 -0
- package/esm/admins/adminsInterfaces.js +1 -0
- package/esm/admins/adminsSchemas.d.ts +48 -0
- package/esm/admins/adminsSchemas.js +31 -0
- package/esm/attribute-sets/attributeSetsApi.d.ts +67 -0
- package/esm/attribute-sets/attributeSetsApi.js +97 -0
- package/esm/attribute-sets/attributeSetsInterfaces.d.ts +285 -0
- package/esm/attribute-sets/attributeSetsInterfaces.js +1 -0
- package/esm/attribute-sets/attributeSetsSchemas.d.ts +84 -0
- package/esm/attribute-sets/attributeSetsSchemas.js +66 -0
- package/esm/auth-provider/authProviderApi.d.ts +262 -0
- package/esm/auth-provider/authProviderApi.js +362 -0
- package/esm/auth-provider/authProviderSchemas.d.ts +124 -0
- package/esm/auth-provider/authProviderSchemas.js +92 -0
- package/esm/auth-provider/authProvidersInterfaces.d.ts +430 -0
- package/esm/auth-provider/authProvidersInterfaces.js +1 -0
- package/esm/base/asyncModules.d.ts +123 -0
- package/esm/base/asyncModules.js +382 -0
- package/esm/base/lazySchema.d.ts +15 -0
- package/esm/base/lazySchema.js +17 -0
- package/esm/base/stateModule.d.ts +35 -0
- package/esm/base/stateModule.js +51 -0
- package/esm/base/syncModules.d.ts +245 -0
- package/esm/base/syncModules.js +555 -0
- package/esm/base/timeIntervals.d.ts +95 -0
- package/esm/base/timeIntervals.js +317 -0
- package/esm/base/utils.d.ts +354 -0
- package/esm/base/utils.js +1 -0
- package/esm/base/validation.d.ts +98 -0
- package/esm/base/validation.js +118 -0
- package/esm/blocks/blocksApi.d.ts +252 -0
- package/esm/blocks/blocksApi.js +394 -0
- package/esm/blocks/blocksInterfaces.d.ts +361 -0
- package/esm/blocks/blocksInterfaces.js +1 -0
- package/esm/blocks/blocksSchemas.d.ts +213 -0
- package/esm/blocks/blocksSchemas.js +40 -0
- package/esm/discounts/discountsApi.d.ts +94 -0
- package/esm/discounts/discountsApi.js +136 -0
- package/esm/discounts/discountsInterfaces.d.ts +293 -0
- package/esm/discounts/discountsInterfaces.js +1 -0
- package/esm/events/eventsApi.d.ts +108 -0
- package/esm/events/eventsApi.js +141 -0
- package/esm/events/eventsInterfaces.d.ts +176 -0
- package/esm/events/eventsInterfaces.js +1 -0
- package/esm/file-uploading/fileUploadingApi.d.ts +91 -0
- package/esm/file-uploading/fileUploadingApi.js +127 -0
- package/esm/file-uploading/fileUploadingInterfaces.d.ts +116 -0
- package/esm/file-uploading/fileUploadingInterfaces.js +1 -0
- package/esm/file-uploading/fileUploadingSchemas.d.ts +24 -0
- package/esm/file-uploading/fileUploadingSchemas.js +19 -0
- package/esm/filters/filtersApi.d.ts +32 -0
- package/esm/filters/filtersApi.js +36 -0
- package/esm/filters/filtersInterfaces.d.ts +56 -0
- package/esm/filters/filtersInterfaces.js +1 -0
- package/esm/filters/filtersSchemas.d.ts +32 -0
- package/esm/filters/filtersSchemas.js +29 -0
- package/esm/forms/formsApi.d.ts +44 -0
- package/esm/forms/formsApi.js +54 -0
- package/esm/forms/formsInterfaces.d.ts +237 -0
- package/esm/forms/formsInterfaces.js +1 -0
- package/esm/forms/formsSchemas.d.ts +56 -0
- package/esm/forms/formsSchemas.js +32 -0
- package/esm/forms-data/formsDataApi.d.ts +124 -0
- package/esm/forms-data/formsDataApi.js +210 -0
- package/esm/forms-data/formsDataInterfaces.d.ts +670 -0
- package/esm/forms-data/formsDataInterfaces.js +1 -0
- package/esm/forms-data/formsDataSchemas.d.ts +107 -0
- package/esm/forms-data/formsDataSchemas.js +83 -0
- package/esm/general-types/generalTypesApi.d.ts +29 -0
- package/esm/general-types/generalTypesApi.js +34 -0
- package/esm/general-types/generalTypesInterfaces.d.ts +29 -0
- package/esm/general-types/generalTypesInterfaces.js +1 -0
- package/esm/general-types/generalTypesSchemas.d.ts +68 -0
- package/esm/general-types/generalTypesSchemas.js +42 -0
- package/esm/index.d.ts +143 -0
- package/esm/index.js +124 -0
- package/esm/integration-collections/integrationCollectionsApi.d.ts +172 -0
- package/esm/integration-collections/integrationCollectionsApi.js +224 -0
- package/esm/integration-collections/integrationCollectionsInterfaces.d.ts +317 -0
- package/esm/integration-collections/integrationCollectionsInterfaces.js +1 -0
- package/esm/integration-collections/integrationCollectionsSchemas.d.ts +84 -0
- package/esm/integration-collections/integrationCollectionsSchemas.js +60 -0
- package/esm/locales/localesApi.d.ts +28 -0
- package/esm/locales/localesApi.js +33 -0
- package/esm/locales/localesInterfaces.d.ts +40 -0
- package/esm/locales/localesInterfaces.js +1 -0
- package/esm/locales/localesSchemas.d.ts +32 -0
- package/esm/locales/localesSchemas.js +23 -0
- package/esm/menus/menusApi.d.ts +30 -0
- package/esm/menus/menusApi.js +35 -0
- package/esm/menus/menusInterfaces.d.ts +87 -0
- package/esm/menus/menusInterfaces.js +2 -0
- package/esm/menus/menusSchemas.d.ts +16 -0
- package/esm/menus/menusSchemas.js +25 -0
- package/esm/orders/ordersApi.d.ts +213 -0
- package/esm/orders/ordersApi.js +288 -0
- package/esm/orders/ordersInterfaces.d.ts +763 -0
- package/esm/orders/ordersInterfaces.js +1 -0
- package/esm/orders/ordersSchemas.d.ts +312 -0
- package/esm/orders/ordersSchemas.js +171 -0
- package/esm/package.json +4 -0
- package/esm/pages/pagesApi.d.ts +173 -0
- package/esm/pages/pagesApi.js +414 -0
- package/esm/pages/pagesInterfaces.d.ts +344 -0
- package/esm/pages/pagesInterfaces.js +1 -0
- package/esm/pages/pagesSchemas.d.ts +121 -0
- package/esm/pages/pagesSchemas.js +60 -0
- package/esm/payments/paymentsApi.d.ts +88 -0
- package/esm/payments/paymentsApi.js +122 -0
- package/esm/payments/paymentsInterfaces.d.ts +189 -0
- package/esm/payments/paymentsInterfaces.js +1 -0
- package/esm/payments/paymentsSchemas.d.ts +94 -0
- package/esm/payments/paymentsSchemas.js +53 -0
- package/esm/product-statuses/productStatusesApi.d.ts +50 -0
- package/esm/product-statuses/productStatusesApi.js +68 -0
- package/esm/product-statuses/productStatusesInterfaces.d.ts +62 -0
- package/esm/product-statuses/productStatusesInterfaces.js +1 -0
- package/esm/product-statuses/productStatusesSchemas.d.ts +34 -0
- package/esm/product-statuses/productStatusesSchemas.js +27 -0
- package/esm/products/productsApi.d.ts +366 -0
- package/esm/products/productsApi.js +468 -0
- package/esm/products/productsInterfaces.d.ts +723 -0
- package/esm/products/productsInterfaces.js +1 -0
- package/esm/products/productsSchemas.d.ts +234 -0
- package/esm/products/productsSchemas.js +121 -0
- package/esm/search/searchApi.d.ts +35 -0
- package/esm/search/searchApi.js +47 -0
- package/esm/search/searchInterfaces.d.ts +94 -0
- package/esm/search/searchInterfaces.js +1 -0
- package/esm/search/searchSchemas.d.ts +73 -0
- package/esm/search/searchSchemas.js +41 -0
- package/esm/sitemap/sitemapApi.d.ts +37 -0
- package/esm/sitemap/sitemapApi.js +41 -0
- package/esm/sitemap/sitemapInterfaces.d.ts +51 -0
- package/esm/sitemap/sitemapInterfaces.js +1 -0
- package/esm/subscriptions/subscriptionsApi.d.ts +74 -0
- package/esm/subscriptions/subscriptionsApi.js +90 -0
- package/esm/subscriptions/subscriptionsInterfaces.d.ts +111 -0
- package/esm/subscriptions/subscriptionsInterfaces.js +1 -0
- package/esm/subscriptions/subscriptionsSchemas.d.ts +46 -0
- package/esm/subscriptions/subscriptionsSchemas.js +38 -0
- package/esm/system/systemApi.d.ts +46 -0
- package/esm/system/systemApi.js +53 -0
- package/esm/system/systemInterfaces.d.ts +29 -0
- package/esm/system/systemInterfaces.js +1 -0
- package/esm/templates/templatesApi.d.ts +53 -0
- package/esm/templates/templatesApi.js +78 -0
- package/esm/templates/templatesInterfaces.d.ts +68 -0
- package/esm/templates/templatesInterfaces.js +1 -0
- package/esm/templates/templatesSchemas.d.ts +48 -0
- package/esm/templates/templatesSchemas.js +28 -0
- package/esm/templates-preview/templatesPreviewApi.d.ts +40 -0
- package/esm/templates-preview/templatesPreviewApi.js +50 -0
- package/esm/templates-preview/templatesPreviewInterfaces.d.ts +129 -0
- package/esm/templates-preview/templatesPreviewInterfaces.js +1 -0
- package/esm/templates-preview/templatesPreviewSchemas.d.ts +79 -0
- package/esm/templates-preview/templatesPreviewSchemas.js +43 -0
- package/esm/types.d.ts +35 -0
- package/esm/types.js +1 -0
- package/esm/user-activity/userActivityApi.d.ts +31 -0
- package/esm/user-activity/userActivityApi.js +37 -0
- package/esm/user-activity/userActivityInterfaces.d.ts +42 -0
- package/esm/user-activity/userActivityInterfaces.js +1 -0
- package/esm/users/usersApi.d.ts +249 -0
- package/esm/users/usersApi.js +312 -0
- package/esm/users/usersInterfaces.d.ts +419 -0
- package/esm/users/usersInterfaces.js +1 -0
- package/esm/users/usersSchemas.d.ts +72 -0
- package/esm/users/usersSchemas.js +55 -0
- package/esm/web-socket/lazySocket.d.ts +18 -0
- package/esm/web-socket/lazySocket.js +67 -0
- package/esm/web-socket/wsApi.d.ts +27 -0
- package/esm/web-socket/wsApi.js +43 -0
- package/esm/web-socket/wsInterfaces.d.ts +16 -0
- package/esm/web-socket/wsInterfaces.js +1 -0
- package/package.json +47 -2
- package/types.d.ts +1 -0
- package/types.js +1 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation schemas for FormsData module
|
|
3
|
+
* @description Zod schemas for validating forms data-related API responses
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
/**
|
|
7
|
+
* Form data type schema (flexible structure)
|
|
8
|
+
*/
|
|
9
|
+
export declare const FormDataTypeSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
10
|
+
marker: z.ZodString;
|
|
11
|
+
type: z.ZodString;
|
|
12
|
+
value: z.ZodAny;
|
|
13
|
+
}, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
|
|
14
|
+
/**
|
|
15
|
+
* Form by marker data entity schema
|
|
16
|
+
*/
|
|
17
|
+
export declare const FormByMarkerDataEntitySchema: z.ZodObject<{
|
|
18
|
+
id: z.ZodNumber;
|
|
19
|
+
parentId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
20
|
+
formIdentifier: z.ZodString;
|
|
21
|
+
depth: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
ip: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
23
|
+
fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
24
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
25
|
+
userIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
26
|
+
formData: z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
27
|
+
marker: z.ZodString;
|
|
28
|
+
type: z.ZodString;
|
|
29
|
+
value: z.ZodAny;
|
|
30
|
+
}, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
|
|
31
|
+
attributeSetIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
32
|
+
time: z.ZodUnion<readonly [z.ZodDate, z.ZodString]>;
|
|
33
|
+
entityIdentifier: z.ZodOptional<z.ZodString>;
|
|
34
|
+
isUserAdmin: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
+
formModuleConfigId: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
moduleIdentifier: z.ZodOptional<z.ZodString>;
|
|
37
|
+
entityId: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
/**
|
|
40
|
+
* Forms by marker data response schema
|
|
41
|
+
*/
|
|
42
|
+
export declare const FormsByMarkerDataResponseSchema: z.ZodObject<{
|
|
43
|
+
items: z.ZodArray<z.ZodObject<{
|
|
44
|
+
id: z.ZodNumber;
|
|
45
|
+
parentId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
46
|
+
formIdentifier: z.ZodString;
|
|
47
|
+
depth: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
ip: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
49
|
+
fingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
|
+
status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
51
|
+
userIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
52
|
+
formData: z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
53
|
+
marker: z.ZodString;
|
|
54
|
+
type: z.ZodString;
|
|
55
|
+
value: z.ZodAny;
|
|
56
|
+
}, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
|
|
57
|
+
attributeSetIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
58
|
+
time: z.ZodUnion<readonly [z.ZodDate, z.ZodString]>;
|
|
59
|
+
entityIdentifier: z.ZodOptional<z.ZodString>;
|
|
60
|
+
isUserAdmin: z.ZodOptional<z.ZodBoolean>;
|
|
61
|
+
formModuleConfigId: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
moduleIdentifier: z.ZodOptional<z.ZodString>;
|
|
63
|
+
entityId: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
total: z.ZodNumber;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
/**
|
|
68
|
+
* Post form response schema
|
|
69
|
+
*/
|
|
70
|
+
export declare const PostFormResponseSchema: z.ZodObject<{
|
|
71
|
+
actionMessage: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>;
|
|
72
|
+
formData: z.ZodObject<{
|
|
73
|
+
id: z.ZodNumber;
|
|
74
|
+
formIdentifier: z.ZodString;
|
|
75
|
+
time: z.ZodString;
|
|
76
|
+
entityIdentifier: z.ZodString;
|
|
77
|
+
fingerprint: z.ZodNullable<z.ZodString>;
|
|
78
|
+
isUserAdmin: z.ZodBoolean;
|
|
79
|
+
formModuleId: z.ZodNumber;
|
|
80
|
+
userIdentifier: z.ZodNullable<z.ZodString>;
|
|
81
|
+
parentId: z.ZodNullable<z.ZodNumber>;
|
|
82
|
+
formData: z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
83
|
+
marker: z.ZodString;
|
|
84
|
+
type: z.ZodString;
|
|
85
|
+
value: z.ZodAny;
|
|
86
|
+
}, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
|
|
87
|
+
}, z.core.$strip>;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
/**
|
|
90
|
+
* Update forms data response schema
|
|
91
|
+
*/
|
|
92
|
+
export declare const UpdateFormsDataSchema: z.ZodObject<{
|
|
93
|
+
id: z.ZodNumber;
|
|
94
|
+
formIdentifier: z.ZodString;
|
|
95
|
+
time: z.ZodString;
|
|
96
|
+
formData: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
97
|
+
marker: z.ZodString;
|
|
98
|
+
type: z.ZodString;
|
|
99
|
+
value: z.ZodAny;
|
|
100
|
+
}, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
|
|
101
|
+
userIdentifier: z.ZodString;
|
|
102
|
+
entityIdentifier: z.ZodString;
|
|
103
|
+
parentId: z.ZodNullable<z.ZodNumber>;
|
|
104
|
+
fingerprint: z.ZodNullable<z.ZodString>;
|
|
105
|
+
isUserAdmin: z.ZodBoolean;
|
|
106
|
+
formModuleId: z.ZodNumber;
|
|
107
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation schemas for FormsData module
|
|
3
|
+
* @description Zod schemas for validating forms data-related API responses
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
/**
|
|
7
|
+
* Form data type schema (flexible structure)
|
|
8
|
+
*/
|
|
9
|
+
export const FormDataTypeSchema = z.union([
|
|
10
|
+
z.object({
|
|
11
|
+
marker: z.string(),
|
|
12
|
+
type: z.string(),
|
|
13
|
+
value: z.any(),
|
|
14
|
+
}),
|
|
15
|
+
z.record(z.string(), z.any()),
|
|
16
|
+
]);
|
|
17
|
+
/**
|
|
18
|
+
* Form by marker data entity schema
|
|
19
|
+
*/
|
|
20
|
+
export const FormByMarkerDataEntitySchema = z.object({
|
|
21
|
+
id: z.number(),
|
|
22
|
+
parentId: z.number().nullish(),
|
|
23
|
+
formIdentifier: z.string(),
|
|
24
|
+
depth: z.number().optional(),
|
|
25
|
+
ip: z.string().nullish(),
|
|
26
|
+
fingerprint: z.string().nullish(),
|
|
27
|
+
status: z.string().nullish(),
|
|
28
|
+
userIdentifier: z.string().nullish(),
|
|
29
|
+
formData: z.union([
|
|
30
|
+
z.array(FormDataTypeSchema),
|
|
31
|
+
z.record(z.string(), z.any()),
|
|
32
|
+
]),
|
|
33
|
+
attributeSetIdentifier: z.string().nullish(),
|
|
34
|
+
time: z.union([z.date(), z.string()]),
|
|
35
|
+
entityIdentifier: z.string().optional(),
|
|
36
|
+
isUserAdmin: z.boolean().optional(),
|
|
37
|
+
formModuleConfigId: z.number().optional(),
|
|
38
|
+
moduleIdentifier: z.string().optional(),
|
|
39
|
+
entityId: z.number().optional(),
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Forms by marker data response schema
|
|
43
|
+
*/
|
|
44
|
+
export const FormsByMarkerDataResponseSchema = z.object({
|
|
45
|
+
items: z.array(FormByMarkerDataEntitySchema),
|
|
46
|
+
total: z.number(),
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* Post form response schema
|
|
50
|
+
*/
|
|
51
|
+
export const PostFormResponseSchema = z.object({
|
|
52
|
+
actionMessage: z.union([z.string(), z.record(z.string(), z.any())]),
|
|
53
|
+
formData: z.object({
|
|
54
|
+
id: z.number(),
|
|
55
|
+
formIdentifier: z.string(),
|
|
56
|
+
time: z.string(),
|
|
57
|
+
entityIdentifier: z.string(),
|
|
58
|
+
fingerprint: z.string().nullable(),
|
|
59
|
+
isUserAdmin: z.boolean(),
|
|
60
|
+
formModuleId: z.number(),
|
|
61
|
+
userIdentifier: z.string().nullable(),
|
|
62
|
+
parentId: z.number().nullable(),
|
|
63
|
+
formData: z.union([
|
|
64
|
+
z.array(FormDataTypeSchema),
|
|
65
|
+
z.record(z.string(), z.any()),
|
|
66
|
+
]),
|
|
67
|
+
}),
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* Update forms data response schema
|
|
71
|
+
*/
|
|
72
|
+
export const UpdateFormsDataSchema = z.object({
|
|
73
|
+
id: z.number(),
|
|
74
|
+
formIdentifier: z.string(),
|
|
75
|
+
time: z.string(),
|
|
76
|
+
formData: z.array(FormDataTypeSchema),
|
|
77
|
+
userIdentifier: z.string(),
|
|
78
|
+
entityIdentifier: z.string(),
|
|
79
|
+
parentId: z.number().nullable(),
|
|
80
|
+
fingerprint: z.string().nullable(),
|
|
81
|
+
isUserAdmin: z.boolean(),
|
|
82
|
+
formModuleId: z.number(),
|
|
83
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import AsyncModules from '../base/asyncModules.js';
|
|
2
|
+
import type StateModule from '../base/stateModule.js';
|
|
3
|
+
import type { IError } from '../base/utils.js';
|
|
4
|
+
import type { IGeneralTypes, IGeneralTypesEntity } from './generalTypesInterfaces.js';
|
|
5
|
+
/**
|
|
6
|
+
* Controllers for working with types
|
|
7
|
+
* @handle /api/content/general-types
|
|
8
|
+
* @class GeneralTypesApi
|
|
9
|
+
* @augments AsyncModules
|
|
10
|
+
* @implements {IGeneralTypes}
|
|
11
|
+
* @description This class provides methods to interact with general types, including retrieving all types.
|
|
12
|
+
*/
|
|
13
|
+
export default class GeneralTypesApi extends AsyncModules implements IGeneralTypes {
|
|
14
|
+
protected state: StateModule;
|
|
15
|
+
protected _url: string;
|
|
16
|
+
/**
|
|
17
|
+
* Constructor for the GeneralTypesApi class.
|
|
18
|
+
*/
|
|
19
|
+
constructor(state: StateModule);
|
|
20
|
+
/**
|
|
21
|
+
* Get all types.
|
|
22
|
+
* @handleName getAllTypes
|
|
23
|
+
* @returns {Promise<IGeneralTypesEntity[] | IError>} Returns an array of general types or an error object if there was an issue.
|
|
24
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
25
|
+
* @description This method retrieves all general types available in the system.
|
|
26
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/general-types/getAllTypes getAllTypes} documentation.
|
|
27
|
+
*/
|
|
28
|
+
getAllTypes(): Promise<IGeneralTypesEntity[] | IError>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import AsyncModules from '../base/asyncModules.js';
|
|
2
|
+
import createSchemaLoader from '../base/lazySchema.js';
|
|
3
|
+
const schema = createSchemaLoader(() => import('./generalTypesSchemas.js'));
|
|
4
|
+
/**
|
|
5
|
+
* Controllers for working with types
|
|
6
|
+
* @handle /api/content/general-types
|
|
7
|
+
* @class GeneralTypesApi
|
|
8
|
+
* @augments AsyncModules
|
|
9
|
+
* @implements {IGeneralTypes}
|
|
10
|
+
* @description This class provides methods to interact with general types, including retrieving all types.
|
|
11
|
+
*/
|
|
12
|
+
export default class GeneralTypesApi extends AsyncModules {
|
|
13
|
+
/**
|
|
14
|
+
* Constructor for the GeneralTypesApi class.
|
|
15
|
+
*/
|
|
16
|
+
constructor(state) {
|
|
17
|
+
super(state);
|
|
18
|
+
this._url = state.url + '/api/content/general-types';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get all types.
|
|
22
|
+
* @handleName getAllTypes
|
|
23
|
+
* @returns {Promise<IGeneralTypesEntity[] | IError>} Returns an array of general types or an error object if there was an issue.
|
|
24
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
25
|
+
* @description This method retrieves all general types available in the system.
|
|
26
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/general-types/getAllTypes getAllTypes} documentation.
|
|
27
|
+
*/
|
|
28
|
+
async getAllTypes() {
|
|
29
|
+
const result = await this._fetchGet('');
|
|
30
|
+
// Validate response if validation is enabled
|
|
31
|
+
const validated = await this._validateResponse(result, schema('GeneralTypesResponseSchema'));
|
|
32
|
+
return validated;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { IError } from '../base/utils.js';
|
|
2
|
+
import type { BlockType } from '../blocks/blocksInterfaces.js';
|
|
3
|
+
/**
|
|
4
|
+
* Interface for retrieving all general types in the system.
|
|
5
|
+
* @interface IGeneralTypes
|
|
6
|
+
* @description This interface defines a method for retrieving all general types in the system.
|
|
7
|
+
*/
|
|
8
|
+
interface IGeneralTypes {
|
|
9
|
+
/**
|
|
10
|
+
* Get all types.
|
|
11
|
+
* @handleName getAllTypes
|
|
12
|
+
* @returns {IGeneralTypesEntity[]} Returns an array of general types or an error object if there was an issue.
|
|
13
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
14
|
+
* @description This method gets all types.
|
|
15
|
+
*/
|
|
16
|
+
getAllTypes(): Promise<IGeneralTypesEntity[] | IError>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Represents a general type entity.
|
|
20
|
+
* @interface IGeneralTypesEntity
|
|
21
|
+
* @property {number} id - Type id. Example: 1.
|
|
22
|
+
* @property {BlockType} type - Types enum. Example: "product", "category", "etc".
|
|
23
|
+
* @description Represents a general type entity with an identifier and a type.
|
|
24
|
+
*/
|
|
25
|
+
interface IGeneralTypesEntity {
|
|
26
|
+
id: number;
|
|
27
|
+
type: BlockType;
|
|
28
|
+
}
|
|
29
|
+
export type { IGeneralTypes, IGeneralTypesEntity };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation schemas for GeneralTypes module
|
|
3
|
+
* @description Zod schemas for validating general types-related API responses
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
/**
|
|
7
|
+
* General type entity schema
|
|
8
|
+
* Includes all fields returned by the API
|
|
9
|
+
*/
|
|
10
|
+
export declare const GeneralTypeEntitySchema: z.ZodObject<{
|
|
11
|
+
id: z.ZodNumber;
|
|
12
|
+
type: z.ZodEnum<{
|
|
13
|
+
none: "none";
|
|
14
|
+
product: "product";
|
|
15
|
+
order: "order";
|
|
16
|
+
form: "form";
|
|
17
|
+
error_page: "error_page";
|
|
18
|
+
catalog_page: "catalog_page";
|
|
19
|
+
product_preview: "product_preview";
|
|
20
|
+
similar_products_block: "similar_products_block";
|
|
21
|
+
product_block: "product_block";
|
|
22
|
+
frequently_ordered_block: "frequently_ordered_block";
|
|
23
|
+
trending_block: "trending_block";
|
|
24
|
+
recently_viewed_block: "recently_viewed_block";
|
|
25
|
+
repeat_purchase_block: "repeat_purchase_block";
|
|
26
|
+
slider_block: "slider_block";
|
|
27
|
+
personal_recommendations_block: "personal_recommendations_block";
|
|
28
|
+
cart_complement_block: "cart_complement_block";
|
|
29
|
+
cart_similar_block: "cart_similar_block";
|
|
30
|
+
wishlist_similar_block: "wishlist_similar_block";
|
|
31
|
+
common_page: "common_page";
|
|
32
|
+
common_block: "common_block";
|
|
33
|
+
service: "service";
|
|
34
|
+
external_page: "external_page";
|
|
35
|
+
discount: "discount";
|
|
36
|
+
}>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
/**
|
|
39
|
+
* General types response schema (array of general types)
|
|
40
|
+
*/
|
|
41
|
+
export declare const GeneralTypesResponseSchema: z.ZodArray<z.ZodObject<{
|
|
42
|
+
id: z.ZodNumber;
|
|
43
|
+
type: z.ZodEnum<{
|
|
44
|
+
none: "none";
|
|
45
|
+
product: "product";
|
|
46
|
+
order: "order";
|
|
47
|
+
form: "form";
|
|
48
|
+
error_page: "error_page";
|
|
49
|
+
catalog_page: "catalog_page";
|
|
50
|
+
product_preview: "product_preview";
|
|
51
|
+
similar_products_block: "similar_products_block";
|
|
52
|
+
product_block: "product_block";
|
|
53
|
+
frequently_ordered_block: "frequently_ordered_block";
|
|
54
|
+
trending_block: "trending_block";
|
|
55
|
+
recently_viewed_block: "recently_viewed_block";
|
|
56
|
+
repeat_purchase_block: "repeat_purchase_block";
|
|
57
|
+
slider_block: "slider_block";
|
|
58
|
+
personal_recommendations_block: "personal_recommendations_block";
|
|
59
|
+
cart_complement_block: "cart_complement_block";
|
|
60
|
+
cart_similar_block: "cart_similar_block";
|
|
61
|
+
wishlist_similar_block: "wishlist_similar_block";
|
|
62
|
+
common_page: "common_page";
|
|
63
|
+
common_block: "common_block";
|
|
64
|
+
service: "service";
|
|
65
|
+
external_page: "external_page";
|
|
66
|
+
discount: "discount";
|
|
67
|
+
}>;
|
|
68
|
+
}, z.core.$strip>>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation schemas for GeneralTypes module
|
|
3
|
+
* @description Zod schemas for validating general types-related API responses
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
/**
|
|
7
|
+
* General type entity schema
|
|
8
|
+
* Includes all fields returned by the API
|
|
9
|
+
*/
|
|
10
|
+
export const GeneralTypeEntitySchema = z.object({
|
|
11
|
+
id: z.number(),
|
|
12
|
+
// Must stay in sync with BlockType in src/blocks/blocksInterfaces.ts
|
|
13
|
+
type: z.enum([
|
|
14
|
+
'product',
|
|
15
|
+
'error_page',
|
|
16
|
+
'catalog_page',
|
|
17
|
+
'product_preview',
|
|
18
|
+
'similar_products_block',
|
|
19
|
+
'product_block',
|
|
20
|
+
'frequently_ordered_block',
|
|
21
|
+
'trending_block',
|
|
22
|
+
'recently_viewed_block',
|
|
23
|
+
'repeat_purchase_block',
|
|
24
|
+
'slider_block',
|
|
25
|
+
'personal_recommendations_block',
|
|
26
|
+
'cart_complement_block',
|
|
27
|
+
'cart_similar_block',
|
|
28
|
+
'wishlist_similar_block',
|
|
29
|
+
'form',
|
|
30
|
+
'common_page',
|
|
31
|
+
'common_block',
|
|
32
|
+
'order',
|
|
33
|
+
'service',
|
|
34
|
+
'external_page',
|
|
35
|
+
'discount',
|
|
36
|
+
'none',
|
|
37
|
+
]),
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* General types response schema (array of general types)
|
|
41
|
+
*/
|
|
42
|
+
export const GeneralTypesResponseSchema = z.array(GeneralTypeEntitySchema);
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OneEntry SDK
|
|
3
|
+
*/
|
|
4
|
+
import AdminsApi from './admins/adminsApi.js';
|
|
5
|
+
import AttributesSetsApi from './attribute-sets/attributeSetsApi.js';
|
|
6
|
+
import AuthProviderApi from './auth-provider/authProviderApi.js';
|
|
7
|
+
import type { IConfig } from './base/utils.js';
|
|
8
|
+
import BlocksApi from './blocks/blocksApi.js';
|
|
9
|
+
import DiscountsApi from './discounts/discountsApi.js';
|
|
10
|
+
import EventsApi from './events/eventsApi.js';
|
|
11
|
+
import FileUploadingApi from './file-uploading/fileUploadingApi.js';
|
|
12
|
+
import FiltersApi from './filters/filtersApi.js';
|
|
13
|
+
import FormsApi from './forms/formsApi.js';
|
|
14
|
+
import FormsDataApi from './forms-data/formsDataApi.js';
|
|
15
|
+
import GeneralTypesApi from './general-types/generalTypesApi.js';
|
|
16
|
+
import IntegrationCollectionsApi from './integration-collections/integrationCollectionsApi.js';
|
|
17
|
+
import LocalesApi from './locales/localesApi.js';
|
|
18
|
+
import MenusApi from './menus/menusApi.js';
|
|
19
|
+
import OrdersApi from './orders/ordersApi.js';
|
|
20
|
+
import PagesApi from './pages/pagesApi.js';
|
|
21
|
+
import PaymentsApi from './payments/paymentsApi.js';
|
|
22
|
+
import ProductStatusesApi from './product-statuses/productStatusesApi.js';
|
|
23
|
+
import ProductsApi from './products/productsApi.js';
|
|
24
|
+
import SearchApi from './search/searchApi.js';
|
|
25
|
+
import SitemapApi from './sitemap/sitemapApi.js';
|
|
26
|
+
import SubscriptionsApi from './subscriptions/subscriptionsApi.js';
|
|
27
|
+
import SystemApi from './system/systemApi.js';
|
|
28
|
+
import TemplatesApi from './templates/templatesApi.js';
|
|
29
|
+
import TemplatePreviewsApi from './templates-preview/templatesPreviewApi.js';
|
|
30
|
+
import UserActivityApi from './user-activity/userActivityApi.js';
|
|
31
|
+
import UsersApi from './users/usersApi.js';
|
|
32
|
+
import WsApi from './web-socket/wsApi.js';
|
|
33
|
+
export { expandAttributeTimeIntervals, expandTimeIntervals, isTimeIntervalAttribute, } from './base/timeIntervals.js';
|
|
34
|
+
export type * from './types.js';
|
|
35
|
+
/**
|
|
36
|
+
* IDefineApi interface
|
|
37
|
+
* @interface IDefineApi
|
|
38
|
+
* @property {AdminsApi} Admins - Admins API module.
|
|
39
|
+
* @property {AttributesSetsApi} AttributesSets - Attribute sets API module.
|
|
40
|
+
* @property {AuthProviderApi} AuthProvider - Auth provider API module.
|
|
41
|
+
* @property {BlocksApi} Blocks - Blocks API module.
|
|
42
|
+
* @property {EventsApi} Events - Events API module.
|
|
43
|
+
* @property {DiscountsApi} Discounts - Discounts API module.
|
|
44
|
+
* @property {FileUploadingApi} FileUploading - File uploading API module.
|
|
45
|
+
* @property {FiltersApi} Filters - Filters API module.
|
|
46
|
+
* @property {FormsApi} Forms - Forms API module.
|
|
47
|
+
* @property {FormsDataApi} FormData - Form data API module.
|
|
48
|
+
* @property {GeneralTypesApi} GeneralTypes - General types API module.
|
|
49
|
+
* @property {IntegrationCollectionsApi} IntegrationCollections - Integration collections API module.
|
|
50
|
+
* @property {LocalesApi} Locales - Locales API module.
|
|
51
|
+
* @property {MenusApi} Menus - Menus API module.
|
|
52
|
+
* @property {OrdersApi} Orders - Orders API module.
|
|
53
|
+
* @property {PagesApi} Pages - Pages API module.
|
|
54
|
+
* @property {PaymentsApi} Payments - Payments API module.
|
|
55
|
+
* @property {ProductsApi} Products - Products API module.
|
|
56
|
+
* @property {ProductStatusesApi} ProductStatuses - Product statuses API module.
|
|
57
|
+
* @property {SearchApi} Search - Search API module.
|
|
58
|
+
* @property {SitemapApi} Sitemap - Sitemap API module.
|
|
59
|
+
* @property {SubscriptionsApi} Subscriptions - Subscriptions API module.
|
|
60
|
+
* @property {SystemApi} System - System API module.
|
|
61
|
+
* @property {TemplatesApi} Templates - Templates API module.
|
|
62
|
+
* @property {TemplatePreviewsApi} TemplatePreviews - Template previews API module.
|
|
63
|
+
* @property {UserActivityApi} UserActivity - User activity API module.
|
|
64
|
+
* @property {UsersApi} Users - Users API module.
|
|
65
|
+
* @property {WsApi} WS - WebSocket API module.
|
|
66
|
+
*/
|
|
67
|
+
interface IDefineApi {
|
|
68
|
+
/** Admin panel users management */
|
|
69
|
+
Admins: AdminsApi;
|
|
70
|
+
/** Attribute set schemas: getAttributesByMarker, getAttributeSetByMarker, getSingleAttributeByMarkerSet */
|
|
71
|
+
AttributesSets: AttributesSetsApi;
|
|
72
|
+
/** User registration, login, logout, OAuth, token refresh */
|
|
73
|
+
AuthProvider: AuthProviderApi;
|
|
74
|
+
/** Page blocks: getBlocksByPageUrl, getBlockByMarker */
|
|
75
|
+
Blocks: BlocksApi;
|
|
76
|
+
/** Subscription events: subscribe to real-time entity changes */
|
|
77
|
+
Events: EventsApi;
|
|
78
|
+
/** Discounts and promo codes */
|
|
79
|
+
Discounts: DiscountsApi;
|
|
80
|
+
/** File upload helpers: createFileFromUrl */
|
|
81
|
+
FileUploading: FileUploadingApi;
|
|
82
|
+
/** Content filters: getFilterByMarker */
|
|
83
|
+
Filters: FiltersApi;
|
|
84
|
+
/** Form schemas: getFormByMarker — use for rendering dynamic forms */
|
|
85
|
+
Forms: FormsApi;
|
|
86
|
+
/** Submit form data: postFormsData */
|
|
87
|
+
FormData: FormsDataApi;
|
|
88
|
+
/** General types / custom types defined in admin panel */
|
|
89
|
+
GeneralTypes: GeneralTypesApi;
|
|
90
|
+
/** Integration collections */
|
|
91
|
+
IntegrationCollections: IntegrationCollectionsApi;
|
|
92
|
+
/** Project locales: getLocales */
|
|
93
|
+
Locales: LocalesApi;
|
|
94
|
+
/** Navigation menus: getMenusByMarker */
|
|
95
|
+
Menus: MenusApi;
|
|
96
|
+
/** Orders: createOrder, getAllOrdersByMarker, getAllOrdersStorage */
|
|
97
|
+
Orders: OrdersApi;
|
|
98
|
+
/** Pages: getPageByUrl, getPageById, getChildPages, getRootPages */
|
|
99
|
+
Pages: PagesApi;
|
|
100
|
+
/** Payments: createSession, getSessionByOrderId */
|
|
101
|
+
Payments: PaymentsApi;
|
|
102
|
+
/** Products: getProducts, getProductById, filterProducts, searchProducts */
|
|
103
|
+
Products: ProductsApi;
|
|
104
|
+
/** Product statuses: getProductStatuses */
|
|
105
|
+
ProductStatuses: ProductStatusesApi;
|
|
106
|
+
/** Public cross-entity search: globalSearch */
|
|
107
|
+
Search: SearchApi;
|
|
108
|
+
/** Sitemap generation */
|
|
109
|
+
Sitemap: SitemapApi;
|
|
110
|
+
/** Paid subscriptions: subscribe, cancelSubscription, recoverSubscriptions, getAllSubscriptions, getActiveSubscriptions */
|
|
111
|
+
Subscriptions: SubscriptionsApi;
|
|
112
|
+
/** System info */
|
|
113
|
+
System: SystemApi;
|
|
114
|
+
/** Page templates */
|
|
115
|
+
Templates: TemplatesApi;
|
|
116
|
+
/** Template previews */
|
|
117
|
+
TemplatePreviews: TemplatePreviewsApi;
|
|
118
|
+
/** User/guest activity tracking: trackUserActivity */
|
|
119
|
+
UserActivity: UserActivityApi;
|
|
120
|
+
/** Current authenticated user: getUser, updateUser */
|
|
121
|
+
Users: UsersApi;
|
|
122
|
+
/** WebSocket real-time updates */
|
|
123
|
+
WS: WsApi;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Define API.
|
|
127
|
+
* @function defineOneEntry
|
|
128
|
+
* @param {string} url - URl of your project.
|
|
129
|
+
* @param {IConfig} config - Custom configuration settings
|
|
130
|
+
* @param {string} [config.token] - Optional token parameter
|
|
131
|
+
* @param {string} [config.guestId] - Optional guest identifier sent as the `x-guest-id` header for guest cart/wishlist/activity flows (only while unauthenticated). In the browser, if omitted, a stable per-device id is generated and persisted in localStorage. On the server you MUST pass a per-visitor `guestId` (or call `setGuestId`): the SDK never auto-generates a server id, to avoid sharing one guest across visitors.
|
|
132
|
+
* @param {string} [config.deviceMetadata] - Optional device-metadata string sent as the `x-device-metadata` header instead of the environment-derived fingerprint. Refresh tokens are bound to this header, so a server issuing tokens for a browser (OAuth code exchange) must pass the browser's string (from `getDeviceMetadata()`), or the token will not be refreshable from that browser.
|
|
133
|
+
* @param {string} [config.langCode] - Optional langCode parameter
|
|
134
|
+
* @param {boolean} [config.traficLimit] - Some methods use multiple queries to make it easier to work with the API. Set this parameter to "false" to save traffic and decide for yourself what data you need.
|
|
135
|
+
* @param {string} [config.auth] - An object with authorization settings.
|
|
136
|
+
* @param {boolean} [config.auth.customAuth] - Set this flag to true if you want to configure the authorization process yourself. Set the flag to false, or do not pass it at all to have automatic authorization and token renewal.
|
|
137
|
+
* @param {string} [config.auth.refreshToken] - Transfer the refresh token here, for example from the local storage, to resume the user's session. Otherwise, the user will need to log in every time a new session is created.
|
|
138
|
+
* @param {string} [config.auth.providerMarker] - The marker of the authorization provider.
|
|
139
|
+
* @param {string} [config.auth.saveFunction] - If you want to store the token between sessions, for example in local storage, create a custom function that takes refreshToken as a parameter and executes the necessary instructions. This function will be called every time the tokens are updated.
|
|
140
|
+
* @returns {IDefineApi} List of methods set.
|
|
141
|
+
* @description Define API.
|
|
142
|
+
*/
|
|
143
|
+
export declare function defineOneEntry(url: string, config: IConfig): IDefineApi;
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OneEntry SDK
|
|
3
|
+
*/
|
|
4
|
+
import AdminsApi from './admins/adminsApi.js';
|
|
5
|
+
import AttributesSetsApi from './attribute-sets/attributeSetsApi.js';
|
|
6
|
+
import AuthProviderApi from './auth-provider/authProviderApi.js';
|
|
7
|
+
import StateModule from './base/stateModule.js';
|
|
8
|
+
import BlocksApi from './blocks/blocksApi.js';
|
|
9
|
+
import DiscountsApi from './discounts/discountsApi.js';
|
|
10
|
+
import EventsApi from './events/eventsApi.js';
|
|
11
|
+
import FileUploadingApi from './file-uploading/fileUploadingApi.js';
|
|
12
|
+
import FiltersApi from './filters/filtersApi.js';
|
|
13
|
+
import FormsApi from './forms/formsApi.js';
|
|
14
|
+
import FormsDataApi from './forms-data/formsDataApi.js';
|
|
15
|
+
import GeneralTypesApi from './general-types/generalTypesApi.js';
|
|
16
|
+
import IntegrationCollectionsApi from './integration-collections/integrationCollectionsApi.js';
|
|
17
|
+
import LocalesApi from './locales/localesApi.js';
|
|
18
|
+
import MenusApi from './menus/menusApi.js';
|
|
19
|
+
import OrdersApi from './orders/ordersApi.js';
|
|
20
|
+
import PagesApi from './pages/pagesApi.js';
|
|
21
|
+
import PaymentsApi from './payments/paymentsApi.js';
|
|
22
|
+
import ProductStatusesApi from './product-statuses/productStatusesApi.js';
|
|
23
|
+
import ProductsApi from './products/productsApi.js';
|
|
24
|
+
import SearchApi from './search/searchApi.js';
|
|
25
|
+
import SitemapApi from './sitemap/sitemapApi.js';
|
|
26
|
+
import SubscriptionsApi from './subscriptions/subscriptionsApi.js';
|
|
27
|
+
import SystemApi from './system/systemApi.js';
|
|
28
|
+
import TemplatesApi from './templates/templatesApi.js';
|
|
29
|
+
import TemplatePreviewsApi from './templates-preview/templatesPreviewApi.js';
|
|
30
|
+
import UserActivityApi from './user-activity/userActivityApi.js';
|
|
31
|
+
import UsersApi from './users/usersApi.js';
|
|
32
|
+
import WsApi from './web-socket/wsApi.js';
|
|
33
|
+
export { expandAttributeTimeIntervals, expandTimeIntervals, isTimeIntervalAttribute, } from './base/timeIntervals.js';
|
|
34
|
+
/**
|
|
35
|
+
* Define API.
|
|
36
|
+
* @function defineOneEntry
|
|
37
|
+
* @param {string} url - URl of your project.
|
|
38
|
+
* @param {IConfig} config - Custom configuration settings
|
|
39
|
+
* @param {string} [config.token] - Optional token parameter
|
|
40
|
+
* @param {string} [config.guestId] - Optional guest identifier sent as the `x-guest-id` header for guest cart/wishlist/activity flows (only while unauthenticated). In the browser, if omitted, a stable per-device id is generated and persisted in localStorage. On the server you MUST pass a per-visitor `guestId` (or call `setGuestId`): the SDK never auto-generates a server id, to avoid sharing one guest across visitors.
|
|
41
|
+
* @param {string} [config.deviceMetadata] - Optional device-metadata string sent as the `x-device-metadata` header instead of the environment-derived fingerprint. Refresh tokens are bound to this header, so a server issuing tokens for a browser (OAuth code exchange) must pass the browser's string (from `getDeviceMetadata()`), or the token will not be refreshable from that browser.
|
|
42
|
+
* @param {string} [config.langCode] - Optional langCode parameter
|
|
43
|
+
* @param {boolean} [config.traficLimit] - Some methods use multiple queries to make it easier to work with the API. Set this parameter to "false" to save traffic and decide for yourself what data you need.
|
|
44
|
+
* @param {string} [config.auth] - An object with authorization settings.
|
|
45
|
+
* @param {boolean} [config.auth.customAuth] - Set this flag to true if you want to configure the authorization process yourself. Set the flag to false, or do not pass it at all to have automatic authorization and token renewal.
|
|
46
|
+
* @param {string} [config.auth.refreshToken] - Transfer the refresh token here, for example from the local storage, to resume the user's session. Otherwise, the user will need to log in every time a new session is created.
|
|
47
|
+
* @param {string} [config.auth.providerMarker] - The marker of the authorization provider.
|
|
48
|
+
* @param {string} [config.auth.saveFunction] - If you want to store the token between sessions, for example in local storage, create a custom function that takes refreshToken as a parameter and executes the necessary instructions. This function will be called every time the tokens are updated.
|
|
49
|
+
* @returns {IDefineApi} List of methods set.
|
|
50
|
+
* @description Define API.
|
|
51
|
+
*/
|
|
52
|
+
export function defineOneEntry(url, config) {
|
|
53
|
+
if (typeof url !== 'string' || url.trim() === '') {
|
|
54
|
+
throw new Error('OneEntry SDK: project URL is required to initialize the SDK. ' +
|
|
55
|
+
'Pass a non-empty URL as the first argument of defineOneEntry, e.g. ' +
|
|
56
|
+
'defineOneEntry("https://your-project.oneentry.cloud", { token: "your-app-token" }).');
|
|
57
|
+
}
|
|
58
|
+
if (!config ||
|
|
59
|
+
typeof config.token !== 'string' ||
|
|
60
|
+
config.token.trim() === '') {
|
|
61
|
+
throw new Error('OneEntry SDK: app token is required to initialize the SDK. ' +
|
|
62
|
+
'Pass it via config, e.g. ' +
|
|
63
|
+
'defineOneEntry("https://your-project.oneentry.cloud", { token: "your-app-token" }).');
|
|
64
|
+
}
|
|
65
|
+
const stateModule = new StateModule(url.endsWith('/') ? url.slice(0, -1) : url, config);
|
|
66
|
+
const Admins = new AdminsApi(stateModule);
|
|
67
|
+
const AttributesSets = new AttributesSetsApi(stateModule);
|
|
68
|
+
const AuthProvider = new AuthProviderApi(stateModule);
|
|
69
|
+
const Blocks = new BlocksApi(stateModule);
|
|
70
|
+
const Discounts = new DiscountsApi(stateModule);
|
|
71
|
+
const Events = new EventsApi(stateModule);
|
|
72
|
+
const FileUploading = new FileUploadingApi(stateModule);
|
|
73
|
+
const Filters = new FiltersApi(stateModule);
|
|
74
|
+
const Forms = new FormsApi(stateModule);
|
|
75
|
+
const FormData = new FormsDataApi(stateModule);
|
|
76
|
+
const GeneralTypes = new GeneralTypesApi(stateModule);
|
|
77
|
+
const IntegrationCollections = new IntegrationCollectionsApi(stateModule);
|
|
78
|
+
const Locales = new LocalesApi(stateModule);
|
|
79
|
+
const Menus = new MenusApi(stateModule);
|
|
80
|
+
const Orders = new OrdersApi(stateModule);
|
|
81
|
+
const Pages = new PagesApi(stateModule);
|
|
82
|
+
const Payments = new PaymentsApi(stateModule);
|
|
83
|
+
const Products = new ProductsApi(stateModule);
|
|
84
|
+
const ProductStatuses = new ProductStatusesApi(stateModule);
|
|
85
|
+
const Search = new SearchApi(stateModule);
|
|
86
|
+
const Sitemap = new SitemapApi(stateModule);
|
|
87
|
+
const Subscriptions = new SubscriptionsApi(stateModule);
|
|
88
|
+
const System = new SystemApi(stateModule);
|
|
89
|
+
const Templates = new TemplatesApi(stateModule);
|
|
90
|
+
const TemplatePreviews = new TemplatePreviewsApi(stateModule);
|
|
91
|
+
const UserActivity = new UserActivityApi(stateModule);
|
|
92
|
+
const Users = new UsersApi(stateModule);
|
|
93
|
+
const WS = new WsApi(stateModule);
|
|
94
|
+
return {
|
|
95
|
+
Admins,
|
|
96
|
+
AttributesSets,
|
|
97
|
+
AuthProvider,
|
|
98
|
+
Blocks,
|
|
99
|
+
Discounts,
|
|
100
|
+
Events,
|
|
101
|
+
FileUploading,
|
|
102
|
+
Filters,
|
|
103
|
+
Forms,
|
|
104
|
+
FormData,
|
|
105
|
+
GeneralTypes,
|
|
106
|
+
IntegrationCollections,
|
|
107
|
+
Locales,
|
|
108
|
+
Menus,
|
|
109
|
+
Orders,
|
|
110
|
+
Pages,
|
|
111
|
+
Payments,
|
|
112
|
+
Products,
|
|
113
|
+
ProductStatuses,
|
|
114
|
+
Search,
|
|
115
|
+
Sitemap,
|
|
116
|
+
Subscriptions,
|
|
117
|
+
System,
|
|
118
|
+
Templates,
|
|
119
|
+
TemplatePreviews,
|
|
120
|
+
UserActivity,
|
|
121
|
+
Users,
|
|
122
|
+
WS,
|
|
123
|
+
};
|
|
124
|
+
}
|