@ptkl/sdk 1.3.4 → 1.5.0
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/dist/index.0.10.js +94 -22
- package/dist/index.0.9.js +75 -24
- package/dist/package.json +5 -4
- package/dist/v0.10/api/component.d.ts +30 -12
- package/dist/v0.10/api/functions.d.ts +17 -5
- package/dist/v0.10/api/index.d.ts +2 -0
- package/dist/v0.10/api/integrations/ecommerce.d.ts +42 -0
- package/dist/v0.10/api/integrations.d.ts +2 -0
- package/dist/v0.10/api/platform.d.ts +1 -1
- package/dist/v0.10/api/system.d.ts +38 -1
- package/dist/v0.10/index.cjs.js +94 -22
- package/dist/v0.10/index.esm.js +94 -23
- package/dist/v0.10/types/component.d.ts +4 -3
- package/dist/v0.10/types/functions.d.ts +81 -0
- package/dist/v0.10/types/integrations/ecommerce.d.ts +199 -0
- package/dist/v0.9/api/component.d.ts +6 -6
- package/dist/v0.9/api/functions.d.ts +17 -5
- package/dist/v0.9/api/index.d.ts +1 -0
- package/dist/v0.9/api/integrations/ecommerce.d.ts +42 -0
- package/dist/v0.9/api/integrations.d.ts +2 -0
- package/dist/v0.9/api/system.d.ts +1 -1
- package/dist/v0.9/index.cjs.js +75 -24
- package/dist/v0.9/index.esm.js +75 -25
- package/dist/v0.9/types/component.d.ts +4 -3
- package/dist/v0.9/types/functions.d.ts +41 -0
- package/dist/v0.9/types/integrations/ecommerce.d.ts +199 -0
- package/package.json +5 -4
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
export type IDNamePair = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
};
|
|
5
|
+
export type ShippingMethodsConfig = {
|
|
6
|
+
methods: IDNamePair[];
|
|
7
|
+
};
|
|
8
|
+
export type PaymentMethodsConfig = {
|
|
9
|
+
methods: IDNamePair[];
|
|
10
|
+
};
|
|
11
|
+
export type PaymentProvidersConfig = {
|
|
12
|
+
options?: IDNamePair;
|
|
13
|
+
};
|
|
14
|
+
export type CartSettings = {
|
|
15
|
+
shipping_methods: ShippingMethodsConfig;
|
|
16
|
+
payment_methods: PaymentMethodsConfig;
|
|
17
|
+
payment_providers: PaymentProvidersConfig;
|
|
18
|
+
};
|
|
19
|
+
export type PriceSettings = {
|
|
20
|
+
default_currency: IDNamePair;
|
|
21
|
+
};
|
|
22
|
+
export type I18nSettings = {
|
|
23
|
+
default_locale: IDNamePair;
|
|
24
|
+
locales: IDNamePair[];
|
|
25
|
+
};
|
|
26
|
+
export type LogoConfig = {
|
|
27
|
+
position: number;
|
|
28
|
+
src: string;
|
|
29
|
+
alt: string;
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
};
|
|
33
|
+
export type ItemsConfig = {
|
|
34
|
+
position: number;
|
|
35
|
+
menu: IDNamePair;
|
|
36
|
+
};
|
|
37
|
+
export type ActionsConfig = {
|
|
38
|
+
position: number;
|
|
39
|
+
icons: Record<string, any>;
|
|
40
|
+
};
|
|
41
|
+
export type HeaderSettings = {
|
|
42
|
+
logo: LogoConfig;
|
|
43
|
+
items: ItemsConfig;
|
|
44
|
+
actions: ActionsConfig;
|
|
45
|
+
};
|
|
46
|
+
export type HomepageSection = {
|
|
47
|
+
id: string;
|
|
48
|
+
type: string;
|
|
49
|
+
show: boolean;
|
|
50
|
+
settings: Record<string, any>;
|
|
51
|
+
};
|
|
52
|
+
export type HomepageSettings = {
|
|
53
|
+
sections: HomepageSection[];
|
|
54
|
+
};
|
|
55
|
+
export type CategoryInfoConfig = {
|
|
56
|
+
text_position: IDNamePair;
|
|
57
|
+
show_title: boolean;
|
|
58
|
+
show_description: boolean;
|
|
59
|
+
show_image: boolean;
|
|
60
|
+
};
|
|
61
|
+
export type CategoryHeaderConfig = {
|
|
62
|
+
use_breadcrumbs: boolean;
|
|
63
|
+
category_info: CategoryInfoConfig;
|
|
64
|
+
};
|
|
65
|
+
export type CategoryFiltersConfig = {
|
|
66
|
+
show: boolean;
|
|
67
|
+
type: IDNamePair;
|
|
68
|
+
use_accordion: boolean;
|
|
69
|
+
};
|
|
70
|
+
export type CategorySettings = {
|
|
71
|
+
header: CategoryHeaderConfig;
|
|
72
|
+
filters: CategoryFiltersConfig;
|
|
73
|
+
};
|
|
74
|
+
export type DisplayConfig = {
|
|
75
|
+
show: boolean;
|
|
76
|
+
text_position: IDNamePair;
|
|
77
|
+
position: number;
|
|
78
|
+
};
|
|
79
|
+
export type SimpleDisplayConfig = {
|
|
80
|
+
show: boolean;
|
|
81
|
+
};
|
|
82
|
+
export type InventoryConfig = {
|
|
83
|
+
show: boolean;
|
|
84
|
+
text_position: IDNamePair;
|
|
85
|
+
position: number;
|
|
86
|
+
allow_backorder: boolean;
|
|
87
|
+
};
|
|
88
|
+
export type ActionButtonConfig = {
|
|
89
|
+
icon: IDNamePair;
|
|
90
|
+
button_variant: IDNamePair;
|
|
91
|
+
show: boolean;
|
|
92
|
+
};
|
|
93
|
+
export type ProductActionsConfig = {
|
|
94
|
+
position: number;
|
|
95
|
+
align: IDNamePair;
|
|
96
|
+
add_to_cart: ActionButtonConfig;
|
|
97
|
+
add_to_wishlist: ActionButtonConfig;
|
|
98
|
+
};
|
|
99
|
+
export type QuantitySelectorConfig = {
|
|
100
|
+
show: boolean;
|
|
101
|
+
text_position: IDNamePair;
|
|
102
|
+
};
|
|
103
|
+
export type ProductInfoConfig = {
|
|
104
|
+
title: DisplayConfig;
|
|
105
|
+
sku: DisplayConfig;
|
|
106
|
+
stock_status: SimpleDisplayConfig;
|
|
107
|
+
inventory: InventoryConfig;
|
|
108
|
+
description: DisplayConfig;
|
|
109
|
+
variants: DisplayConfig;
|
|
110
|
+
price: DisplayConfig;
|
|
111
|
+
actions: ProductActionsConfig;
|
|
112
|
+
discount_badge?: SimpleDisplayConfig;
|
|
113
|
+
quantity_selector?: QuantitySelectorConfig;
|
|
114
|
+
specifications?: SimpleDisplayConfig;
|
|
115
|
+
};
|
|
116
|
+
export type ProductSettings = {
|
|
117
|
+
product_info: ProductInfoConfig;
|
|
118
|
+
};
|
|
119
|
+
export type FooterLogoConfig = {
|
|
120
|
+
src: string;
|
|
121
|
+
alt: string;
|
|
122
|
+
width: number;
|
|
123
|
+
height: number;
|
|
124
|
+
};
|
|
125
|
+
export type FooterColumnOne = {
|
|
126
|
+
logo: FooterLogoConfig;
|
|
127
|
+
socials: any[];
|
|
128
|
+
};
|
|
129
|
+
export type FooterSettings = {
|
|
130
|
+
column_one: FooterColumnOne;
|
|
131
|
+
};
|
|
132
|
+
export type EcommerceSettings = {
|
|
133
|
+
maintenance: boolean;
|
|
134
|
+
cart: CartSettings;
|
|
135
|
+
price: PriceSettings;
|
|
136
|
+
i18n: I18nSettings;
|
|
137
|
+
header: HeaderSettings;
|
|
138
|
+
homepage: HomepageSettings;
|
|
139
|
+
category: CategorySettings;
|
|
140
|
+
product: ProductSettings;
|
|
141
|
+
footer: FooterSettings;
|
|
142
|
+
theme?: any;
|
|
143
|
+
};
|
|
144
|
+
export type EcommEnvSettings = {
|
|
145
|
+
dev: EcommerceSettings | null;
|
|
146
|
+
live: EcommerceSettings | null;
|
|
147
|
+
};
|
|
148
|
+
export type CompanyInfo = {
|
|
149
|
+
vat_number: string;
|
|
150
|
+
legal_name: string;
|
|
151
|
+
company_name: string;
|
|
152
|
+
address: string;
|
|
153
|
+
city: string;
|
|
154
|
+
zip_code: string;
|
|
155
|
+
phone: string;
|
|
156
|
+
email: string;
|
|
157
|
+
legal_representative: string;
|
|
158
|
+
additional_info?: Record<string, any>;
|
|
159
|
+
};
|
|
160
|
+
export type Documentation = {
|
|
161
|
+
terms_of_service: string | null;
|
|
162
|
+
privacy_policy: string | null;
|
|
163
|
+
};
|
|
164
|
+
export type EcommerceIntegrationUser = {
|
|
165
|
+
project_uuid: string;
|
|
166
|
+
base_domain: string;
|
|
167
|
+
custom_domains: string[];
|
|
168
|
+
company: CompanyInfo;
|
|
169
|
+
merchant_description: string;
|
|
170
|
+
mcc: string[];
|
|
171
|
+
documentation: Documentation;
|
|
172
|
+
product_types: string[];
|
|
173
|
+
settings: EcommEnvSettings;
|
|
174
|
+
data: Record<string, any>;
|
|
175
|
+
created_at: string;
|
|
176
|
+
updated_at: string;
|
|
177
|
+
deleted_at?: string | null;
|
|
178
|
+
};
|
|
179
|
+
export type UpdateEcommerceSettingsRequest = {
|
|
180
|
+
base_domain?: string;
|
|
181
|
+
custom_domains?: string[];
|
|
182
|
+
company?: Partial<CompanyInfo>;
|
|
183
|
+
merchant_description?: string;
|
|
184
|
+
mcc?: string[];
|
|
185
|
+
product_types?: string[];
|
|
186
|
+
documentation?: Partial<Documentation>;
|
|
187
|
+
settings?: Partial<EcommEnvSettings>;
|
|
188
|
+
};
|
|
189
|
+
export type CheckDomainResponse = {
|
|
190
|
+
domain: string;
|
|
191
|
+
available: boolean;
|
|
192
|
+
};
|
|
193
|
+
export type AddDomainResponse = {
|
|
194
|
+
integration: EcommerceIntegrationUser;
|
|
195
|
+
verification_token: string;
|
|
196
|
+
};
|
|
197
|
+
export type DomainsResponse = {
|
|
198
|
+
domains: string[];
|
|
199
|
+
};
|
|
@@ -45,7 +45,7 @@ export default class Component extends PlatformBaseClient {
|
|
|
45
45
|
* name: "John Doe",
|
|
46
46
|
* })
|
|
47
47
|
**/
|
|
48
|
-
findOne(filter: FindAdvancedParams, opts
|
|
48
|
+
findOne(filter: FindAdvancedParams, opts?: FindOptions): Promise<Model | null>;
|
|
49
49
|
/**
|
|
50
50
|
* Get model by uuid
|
|
51
51
|
*
|
|
@@ -60,7 +60,7 @@ export default class Component extends PlatformBaseClient {
|
|
|
60
60
|
* @param data
|
|
61
61
|
* @returns
|
|
62
62
|
*/
|
|
63
|
-
update(uuid: string, data: Record<string, any>, options
|
|
63
|
+
update(uuid: string, data: Record<string, any>, options?: UpdateOptions): Promise<AxiosResponse<any, any>>;
|
|
64
64
|
/**
|
|
65
65
|
* Update many models
|
|
66
66
|
*
|
|
@@ -68,7 +68,7 @@ export default class Component extends PlatformBaseClient {
|
|
|
68
68
|
* @param options
|
|
69
69
|
* @returns
|
|
70
70
|
*/
|
|
71
|
-
updateMany(data: Record<string, any>[], options
|
|
71
|
+
updateMany(data: Record<string, any>[], options?: UpdateManyOptions): Promise<AxiosResponse<any, any>>;
|
|
72
72
|
/**
|
|
73
73
|
* Create many models
|
|
74
74
|
*
|
|
@@ -76,7 +76,7 @@ export default class Component extends PlatformBaseClient {
|
|
|
76
76
|
* @param options
|
|
77
77
|
* @returns
|
|
78
78
|
*/
|
|
79
|
-
createMany(data: Record<string, any>[], options
|
|
79
|
+
createMany(data: Record<string, any>[], options?: CreateManyOptions): Promise<AxiosResponse<any, any>>;
|
|
80
80
|
/**
|
|
81
81
|
* Modify models by filters
|
|
82
82
|
*
|
|
@@ -84,7 +84,7 @@ export default class Component extends PlatformBaseClient {
|
|
|
84
84
|
* @param options
|
|
85
85
|
* @returns
|
|
86
86
|
*/
|
|
87
|
-
modify(filters: Record<string, any>, data: Record<string, any>, options
|
|
87
|
+
modify(filters: Record<string, any>, data: Record<string, any>, options?: ModifyOptions): Promise<AxiosResponse<any, any>>;
|
|
88
88
|
/**
|
|
89
89
|
* Concurrent update model by uuid
|
|
90
90
|
*
|
|
@@ -93,7 +93,7 @@ export default class Component extends PlatformBaseClient {
|
|
|
93
93
|
* @param data
|
|
94
94
|
* @returns
|
|
95
95
|
*/
|
|
96
|
-
concurrentUpdate(uuid: string, version: number, data: Record<string, any>, options
|
|
96
|
+
concurrentUpdate(uuid: string, version: number, data: Record<string, any>, options?: UpdateOptions): Promise<AxiosResponse<any, any>>;
|
|
97
97
|
create(model: Record<string, any>): Promise<AxiosResponse<any, any>>;
|
|
98
98
|
delete(uuid: string): Promise<AxiosResponse<any, any>>;
|
|
99
99
|
/**
|
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
import PlatformBaseClient from "./platformBaseClient";
|
|
2
|
+
import type { PlatformFunctions, FunctionInput, FunctionOutput } from "../types/functions";
|
|
2
3
|
export default class Functions extends PlatformBaseClient {
|
|
3
4
|
list(): Promise<any>;
|
|
4
5
|
get(ref: string): Promise<any>;
|
|
5
6
|
update(uuid: string, update: any): Promise<any>;
|
|
6
7
|
/**
|
|
7
|
-
* Run platform function
|
|
8
|
+
* Run a platform function.
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* When the function name is registered in `PlatformFunctions`, input and
|
|
11
|
+
* output types are inferred automatically from the IDL signature.
|
|
12
|
+
* Register signatures by running `ptkl generate-types` in your project.
|
|
12
13
|
*
|
|
13
14
|
* @example
|
|
14
|
-
*
|
|
15
|
+
* // Typed — "send_email" is registered in PlatformFunctions
|
|
16
|
+
* const result = await fn.run("send_email", { input: { body: "hi", to: "a@b.com" } })
|
|
17
|
+
* // result: { status: boolean }
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // Untyped fallback for unregistered names
|
|
21
|
+
* const result = await fn.run("unknown_func", { input: { foo: "bar" } })
|
|
15
22
|
*/
|
|
23
|
+
run<K extends keyof PlatformFunctions>(id: K, d: {
|
|
24
|
+
input?: FunctionInput<K>;
|
|
25
|
+
query?: Record<string, string>;
|
|
26
|
+
headers?: Record<string, string>;
|
|
27
|
+
}): Promise<FunctionOutput<K>>;
|
|
16
28
|
run(id: string, d: {
|
|
17
29
|
input?: Record<string, any>;
|
|
18
30
|
query?: Record<string, string>;
|
package/dist/v0.9/api/index.d.ts
CHANGED
|
@@ -21,5 +21,6 @@ export { default as DMS } from './integrations/dms';
|
|
|
21
21
|
export { default as SerbiaUtil } from './integrations/serbiaUtil';
|
|
22
22
|
export { default as VPFR } from './integrations/vpfr';
|
|
23
23
|
export { default as Mail } from './integrations/mail';
|
|
24
|
+
export { default as Ecommerce } from './integrations/ecommerce';
|
|
24
25
|
import Platfrom from './platform';
|
|
25
26
|
export default Platfrom;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import IntegrationsBaseClient from "../integrationsBaseClient";
|
|
2
|
+
import { EcommerceIntegrationUser, UpdateEcommerceSettingsRequest, CheckDomainResponse, AddDomainResponse, DomainsResponse } from "../../types/integrations/ecommerce";
|
|
3
|
+
export default class Ecommerce extends IntegrationsBaseClient {
|
|
4
|
+
/**
|
|
5
|
+
* Get the ecommerce integration user for the current project.
|
|
6
|
+
*/
|
|
7
|
+
get(): Promise<EcommerceIntegrationUser>;
|
|
8
|
+
/**
|
|
9
|
+
* Update ecommerce integration settings (onboarding or partial update).
|
|
10
|
+
*/
|
|
11
|
+
update(req: UpdateEcommerceSettingsRequest): Promise<EcommerceIntegrationUser>;
|
|
12
|
+
/**
|
|
13
|
+
* Check whether a base domain subdomain is available.
|
|
14
|
+
*/
|
|
15
|
+
checkBaseDomain(domain: string): Promise<CheckDomainResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* Add a custom domain (returns a verification token for DNS validation).
|
|
18
|
+
*/
|
|
19
|
+
addCustomDomain(domain: string): Promise<AddDomainResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Validate a custom domain with its verification token.
|
|
22
|
+
*/
|
|
23
|
+
validateCustomDomain(domain: string, token: string): Promise<{
|
|
24
|
+
integration: EcommerceIntegrationUser;
|
|
25
|
+
message: string;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Remove a custom domain.
|
|
29
|
+
*/
|
|
30
|
+
removeCustomDomain(domain: string): Promise<{
|
|
31
|
+
integration: EcommerceIntegrationUser;
|
|
32
|
+
message: string;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* List pending (unvalidated) custom domains.
|
|
36
|
+
*/
|
|
37
|
+
getPendingDomains(): Promise<DomainsResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* List validated custom domains.
|
|
40
|
+
*/
|
|
41
|
+
getValidatedDomains(): Promise<DomainsResponse>;
|
|
42
|
+
}
|
|
@@ -5,6 +5,7 @@ import VPFR from "./integrations/vpfr";
|
|
|
5
5
|
import IntegrationsBaseClient from "./integrationsBaseClient";
|
|
6
6
|
import Payments from "./integrations/payments";
|
|
7
7
|
import Minimax from "./integrations/minimax";
|
|
8
|
+
import Ecommerce from "./integrations/ecommerce";
|
|
8
9
|
export default class Integrations extends IntegrationsBaseClient {
|
|
9
10
|
private integrations;
|
|
10
11
|
constructor(options?: {
|
|
@@ -19,6 +20,7 @@ export default class Integrations extends IntegrationsBaseClient {
|
|
|
19
20
|
getMail(): Mail;
|
|
20
21
|
getPayments(): Payments;
|
|
21
22
|
getMinimax(): Minimax;
|
|
23
|
+
getEcommerce(): Ecommerce;
|
|
22
24
|
isInstalled(id: string): Promise<boolean>;
|
|
23
25
|
getInterfaceOf(id: string): any;
|
|
24
26
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import PlatformBaseClient from "./platformBaseClient";
|
|
2
2
|
export default class System extends PlatformBaseClient {
|
|
3
|
-
resourceResolver(
|
|
3
|
+
resourceResolver(prn: string, format?: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
4
4
|
}
|
package/dist/v0.9/index.cjs.js
CHANGED
|
@@ -19016,11 +19016,15 @@ class PlatformBaseClient extends BaseClient {
|
|
|
19016
19016
|
token = token !== null && token !== void 0 ? token : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_API_TOKEN;
|
|
19017
19017
|
project_uuid = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_UUID;
|
|
19018
19018
|
if (isBrowser) {
|
|
19019
|
-
if (sessionStorage.getItem('protokol_context')
|
|
19020
|
-
headers['X-Project-Env'] = (_b = sessionStorage.getItem('forge_app_env')) !== null && _b !== void 0 ? _b :
|
|
19019
|
+
if (sessionStorage.getItem('protokol_context') === 'forge') {
|
|
19020
|
+
headers['X-Project-Env'] = (_b = sessionStorage.getItem('forge_app_env')) !== null && _b !== void 0 ? _b : 'dev';
|
|
19021
|
+
// pick up forge actor token — overrides any other token source
|
|
19022
|
+
const forgeToken = sessionStorage.getItem('forge_actor_token');
|
|
19023
|
+
if (forgeToken)
|
|
19024
|
+
token = forgeToken;
|
|
19021
19025
|
}
|
|
19022
19026
|
else {
|
|
19023
|
-
headers['X-Project-Env'] = (_c = localStorage.getItem('current_env')) !== null && _c !== void 0 ? _c :
|
|
19027
|
+
headers['X-Project-Env'] = (_c = localStorage.getItem('current_env')) !== null && _c !== void 0 ? _c : 'dev';
|
|
19024
19028
|
}
|
|
19025
19029
|
}
|
|
19026
19030
|
}
|
|
@@ -19045,8 +19049,7 @@ class PlatformBaseClient extends BaseClient {
|
|
|
19045
19049
|
headers: {
|
|
19046
19050
|
...headers,
|
|
19047
19051
|
'Content-Type': 'application/json',
|
|
19048
|
-
}
|
|
19049
|
-
withCredentials: true,
|
|
19052
|
+
}
|
|
19050
19053
|
});
|
|
19051
19054
|
super(client);
|
|
19052
19055
|
this.env = null;
|
|
@@ -19204,7 +19207,7 @@ class Component extends PlatformBaseClient {
|
|
|
19204
19207
|
async updateMany(data, options) {
|
|
19205
19208
|
return await this.client.patch(`${this.getComponentPath()}/models/bulk`, {
|
|
19206
19209
|
data,
|
|
19207
|
-
options
|
|
19210
|
+
options,
|
|
19208
19211
|
});
|
|
19209
19212
|
}
|
|
19210
19213
|
/**
|
|
@@ -19438,16 +19441,6 @@ class Functions extends PlatformBaseClient {
|
|
|
19438
19441
|
async update(uuid, update) {
|
|
19439
19442
|
return await this.client.patch(`/v1/system/function/${uuid}`, update);
|
|
19440
19443
|
}
|
|
19441
|
-
/**
|
|
19442
|
-
* Run platform function
|
|
19443
|
-
*
|
|
19444
|
-
* @param id - Function ID
|
|
19445
|
-
* @param d - Object containing input data, query parameters, and headers
|
|
19446
|
-
* @returns - Function result
|
|
19447
|
-
*
|
|
19448
|
-
* @example
|
|
19449
|
-
* const result = await platform.function().run("myFunction", {input: { foo: "bar" }})
|
|
19450
|
-
*/
|
|
19451
19444
|
async run(id, d) {
|
|
19452
19445
|
const { data } = await this.client.post(`/v1/system/function/run/${id}`, d.input, {
|
|
19453
19446
|
params: d.query,
|
|
@@ -19891,10 +19884,9 @@ class Sandbox extends PlatformBaseClient {
|
|
|
19891
19884
|
}
|
|
19892
19885
|
|
|
19893
19886
|
class System extends PlatformBaseClient {
|
|
19894
|
-
async resourceResolver(
|
|
19887
|
+
async resourceResolver(prn, format) {
|
|
19895
19888
|
return await this.client.post("/v3/system/resource-resolver", {
|
|
19896
|
-
|
|
19897
|
-
ref,
|
|
19889
|
+
prn,
|
|
19898
19890
|
format,
|
|
19899
19891
|
});
|
|
19900
19892
|
}
|
|
@@ -20221,11 +20213,15 @@ class IntegrationsBaseClient extends BaseClient {
|
|
|
20221
20213
|
env = env !== null && env !== void 0 ? env : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_ENV;
|
|
20222
20214
|
token = token !== null && token !== void 0 ? token : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_API_TOKEN;
|
|
20223
20215
|
if (isBrowser) {
|
|
20224
|
-
if (sessionStorage.getItem('protokol_context')
|
|
20225
|
-
headers['X-Project-Env'] = (_b = sessionStorage.getItem('forge_app_env')) !== null && _b !== void 0 ? _b :
|
|
20216
|
+
if (sessionStorage.getItem('protokol_context') === 'forge') {
|
|
20217
|
+
headers['X-Project-Env'] = (_b = sessionStorage.getItem('forge_app_env')) !== null && _b !== void 0 ? _b : 'dev';
|
|
20218
|
+
// pick up forge actor token — overrides any other token source
|
|
20219
|
+
const forgeToken = sessionStorage.getItem('forge_actor_token');
|
|
20220
|
+
if (forgeToken)
|
|
20221
|
+
token = forgeToken;
|
|
20226
20222
|
}
|
|
20227
20223
|
else {
|
|
20228
|
-
headers['X-Project-Env'] = (_c = localStorage.getItem('current_env')) !== null && _c !== void 0 ? _c :
|
|
20224
|
+
headers['X-Project-Env'] = (_c = localStorage.getItem('current_env')) !== null && _c !== void 0 ? _c : 'dev';
|
|
20229
20225
|
}
|
|
20230
20226
|
}
|
|
20231
20227
|
}
|
|
@@ -20249,8 +20245,7 @@ class IntegrationsBaseClient extends BaseClient {
|
|
|
20249
20245
|
timeout: 30000,
|
|
20250
20246
|
headers: {
|
|
20251
20247
|
...headers,
|
|
20252
|
-
}
|
|
20253
|
-
withCredentials: true,
|
|
20248
|
+
}
|
|
20254
20249
|
});
|
|
20255
20250
|
super(client);
|
|
20256
20251
|
this.env = null;
|
|
@@ -21859,6 +21854,57 @@ class Minimax extends IntegrationsBaseClient {
|
|
|
21859
21854
|
}
|
|
21860
21855
|
}
|
|
21861
21856
|
|
|
21857
|
+
class Ecommerce extends IntegrationsBaseClient {
|
|
21858
|
+
/**
|
|
21859
|
+
* Get the ecommerce integration user for the current project.
|
|
21860
|
+
*/
|
|
21861
|
+
async get() {
|
|
21862
|
+
return await this.client.get(`/v1/ecomm/user`);
|
|
21863
|
+
}
|
|
21864
|
+
/**
|
|
21865
|
+
* Update ecommerce integration settings (onboarding or partial update).
|
|
21866
|
+
*/
|
|
21867
|
+
async update(req) {
|
|
21868
|
+
return await this.client.patch(`/v1/ecomm/user`, req);
|
|
21869
|
+
}
|
|
21870
|
+
/**
|
|
21871
|
+
* Check whether a base domain subdomain is available.
|
|
21872
|
+
*/
|
|
21873
|
+
async checkBaseDomain(domain) {
|
|
21874
|
+
return await this.client.post(`/v1/ecomm/base-domain/check`, { domain });
|
|
21875
|
+
}
|
|
21876
|
+
/**
|
|
21877
|
+
* Add a custom domain (returns a verification token for DNS validation).
|
|
21878
|
+
*/
|
|
21879
|
+
async addCustomDomain(domain) {
|
|
21880
|
+
return await this.client.post(`/v1/ecomm/domains`, { domain });
|
|
21881
|
+
}
|
|
21882
|
+
/**
|
|
21883
|
+
* Validate a custom domain with its verification token.
|
|
21884
|
+
*/
|
|
21885
|
+
async validateCustomDomain(domain, token) {
|
|
21886
|
+
return await this.client.post(`/v1/ecomm/domains/validate`, { domain, token });
|
|
21887
|
+
}
|
|
21888
|
+
/**
|
|
21889
|
+
* Remove a custom domain.
|
|
21890
|
+
*/
|
|
21891
|
+
async removeCustomDomain(domain) {
|
|
21892
|
+
return await this.client.delete(`/v1/ecomm/domains`, { data: { domain } });
|
|
21893
|
+
}
|
|
21894
|
+
/**
|
|
21895
|
+
* List pending (unvalidated) custom domains.
|
|
21896
|
+
*/
|
|
21897
|
+
async getPendingDomains() {
|
|
21898
|
+
return await this.client.get(`/v1/ecomm/domains/pending`);
|
|
21899
|
+
}
|
|
21900
|
+
/**
|
|
21901
|
+
* List validated custom domains.
|
|
21902
|
+
*/
|
|
21903
|
+
async getValidatedDomains() {
|
|
21904
|
+
return await this.client.get(`/v1/ecomm/domains/validated`);
|
|
21905
|
+
}
|
|
21906
|
+
}
|
|
21907
|
+
|
|
21862
21908
|
// import integrations
|
|
21863
21909
|
class Integrations extends IntegrationsBaseClient {
|
|
21864
21910
|
constructor(options) {
|
|
@@ -21871,6 +21917,7 @@ class Integrations extends IntegrationsBaseClient {
|
|
|
21871
21917
|
'serbia-utilities': new SerbiaUtil().setClient(this.client),
|
|
21872
21918
|
'protokol-payments': new Payments().setClient(this.client),
|
|
21873
21919
|
'protokol-minimax': new Minimax().setClient(this.client),
|
|
21920
|
+
'protokol-ecommerce': new Ecommerce().setClient(this.client),
|
|
21874
21921
|
};
|
|
21875
21922
|
}
|
|
21876
21923
|
getSerbiaUtilities() {
|
|
@@ -21894,6 +21941,9 @@ class Integrations extends IntegrationsBaseClient {
|
|
|
21894
21941
|
getMinimax() {
|
|
21895
21942
|
return this.getInterfaceOf('protokol-minimax');
|
|
21896
21943
|
}
|
|
21944
|
+
getEcommerce() {
|
|
21945
|
+
return this.getInterfaceOf('protokol-ecommerce');
|
|
21946
|
+
}
|
|
21897
21947
|
async isInstalled(id) {
|
|
21898
21948
|
const { data } = await this.client.get("/v1/integrations");
|
|
21899
21949
|
return data.find((i) => i.id == id) !== undefined;
|
|
@@ -21918,6 +21968,7 @@ exports.Component = Component;
|
|
|
21918
21968
|
exports.ComponentUtils = ComponentUtils;
|
|
21919
21969
|
exports.Config = Config;
|
|
21920
21970
|
exports.DMS = DMS;
|
|
21971
|
+
exports.Ecommerce = Ecommerce;
|
|
21921
21972
|
exports.Forge = Forge;
|
|
21922
21973
|
exports.Functions = Functions;
|
|
21923
21974
|
exports.Integration = Integrations;
|