@stackable-labs/sdk-extension-contracts 1.17.0 → 1.17.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/dist/index.d.ts +471 -12
- package/dist/index.js +133 -13
- package/package.json +1 -4
- package/dist/api.d.ts +0 -14
- package/dist/api.js +0 -2
- package/dist/api.js.map +0 -1
- package/dist/app.d.ts +0 -1
- package/dist/app.js +0 -2
- package/dist/app.js.map +0 -1
- package/dist/capabilities.d.ts +0 -59
- package/dist/capabilities.js +0 -6
- package/dist/capabilities.js.map +0 -1
- package/dist/common.d.ts +0 -8
- package/dist/common.js +0 -5
- package/dist/common.js.map +0 -1
- package/dist/components.d.ts +0 -18
- package/dist/components.js +0 -91
- package/dist/components.js.map +0 -1
- package/dist/ecommerce.d.ts +0 -235
- package/dist/ecommerce.js +0 -6
- package/dist/ecommerce.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/instance.d.ts +0 -13
- package/dist/instance.js +0 -6
- package/dist/instance.js.map +0 -1
- package/dist/manifest.d.ts +0 -42
- package/dist/manifest.js +0 -6
- package/dist/manifest.js.map +0 -1
- package/dist/marketplace.d.ts +0 -7
- package/dist/marketplace.js +0 -2
- package/dist/marketplace.js.map +0 -1
- package/dist/permissions.d.ts +0 -11
- package/dist/permissions.js +0 -23
- package/dist/permissions.js.map +0 -1
- package/dist/rpc.d.ts +0 -38
- package/dist/rpc.js +0 -6
- package/dist/rpc.js.map +0 -1
- package/dist/surface.d.ts +0 -20
- package/dist/surface.js +0 -6
- package/dist/surface.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,471 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { MarketplaceMetadata } from '@stackable-labs/lib-contracts';
|
|
2
|
+
export { AppRegistryEntry, EXTENSION_CATEGORIES, EXTENSION_VISIBILITIES, ExtensionCategory, ExtensionVisibility, MarketplaceMetadata } from '@stackable-labs/lib-contracts';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Shared primitive types used across contracts.
|
|
6
|
+
*/
|
|
7
|
+
/** Lightweight reference to a named entity (e.g. extension, instance). */
|
|
8
|
+
interface NamedEntity {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface ApiRequest {
|
|
14
|
+
action: string;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
interface ApiResponse<T = unknown> {
|
|
18
|
+
success: boolean;
|
|
19
|
+
data: T;
|
|
20
|
+
action: string;
|
|
21
|
+
}
|
|
22
|
+
interface ApiError {
|
|
23
|
+
error: string;
|
|
24
|
+
status?: number;
|
|
25
|
+
message?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* UI Component Contract
|
|
30
|
+
* Defines the fixed set of UI tags that extensions can render.
|
|
31
|
+
* The host maps these to real React components.
|
|
32
|
+
*/
|
|
33
|
+
declare const UI_TAGS: readonly ["ui-card", "ui-card-content", "ui-card-header", "ui-button", "ui-text", "ui-heading", "ui-badge", "ui-input", "ui-stack", "ui-inline", "ui-separator", "ui-tabs", "ui-tabs-list", "ui-tabs-trigger", "ui-tabs-content", "ui-scroll-area", "ui-avatar", "ui-avatar-image", "ui-avatar-fallback", "ui-icon", "ui-link", "ui-menu", "ui-menu-item"];
|
|
34
|
+
type UITag = (typeof UI_TAGS)[number];
|
|
35
|
+
/**
|
|
36
|
+
* Allowed attributes per UI tag.
|
|
37
|
+
* Host should reject any attributes not in this allowlist.
|
|
38
|
+
*/
|
|
39
|
+
declare const UI_TAG_ATTRIBUTES: Record<UITag, readonly string[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Supported icon names (subset of lucide-react).
|
|
42
|
+
* Extensions reference icons by name; host renders the actual icon component.
|
|
43
|
+
*/
|
|
44
|
+
declare const ALLOWED_ICONS: readonly ["arrow-left", "calendar", "check-circle-2", "chevron-left", "chevron-right", "clock", "credit-card", "external-link", "help-circle", "info", "loader-2", "mail", "map-pin", "message-circle", "message-square", "package", "phone", "search", "shopping-bag", "sparkles", "truck", "user", "x-circle", "alert-circle", "book-open"];
|
|
45
|
+
type AllowedIconName = (typeof ALLOWED_ICONS)[number];
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Capabilities Contract
|
|
49
|
+
* Defines the host-mediated APIs that extensions can call via RPC.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/** Optional init for data.fetch — mirrors RequestInit subset */
|
|
53
|
+
interface FetchRequestInit {
|
|
54
|
+
/** HTTP method (default: 'GET') */
|
|
55
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
56
|
+
/** Optional request headers */
|
|
57
|
+
headers?: Record<string, string>;
|
|
58
|
+
/** Optional request body (JSON-serializable) */
|
|
59
|
+
body?: unknown;
|
|
60
|
+
}
|
|
61
|
+
/** Internal wire payload sent over RPC (url merged back in from positional args) */
|
|
62
|
+
interface FetchRequest extends FetchRequestInit {
|
|
63
|
+
/** Full URL to fetch — must be on the extension's allowedDomains */
|
|
64
|
+
url: string;
|
|
65
|
+
}
|
|
66
|
+
/** Response returned to the extension */
|
|
67
|
+
interface FetchResponse {
|
|
68
|
+
status: number;
|
|
69
|
+
ok: boolean;
|
|
70
|
+
data: unknown;
|
|
71
|
+
}
|
|
72
|
+
/** Payload for actions.toast capability */
|
|
73
|
+
interface ToastPayload {
|
|
74
|
+
message: string;
|
|
75
|
+
type?: 'success' | 'error' | 'info' | 'warning';
|
|
76
|
+
duration?: number;
|
|
77
|
+
}
|
|
78
|
+
/** Payload for actions.invoke capability */
|
|
79
|
+
interface ActionInvokePayload {
|
|
80
|
+
action: string;
|
|
81
|
+
payload?: Record<string, unknown>;
|
|
82
|
+
}
|
|
83
|
+
/** Context returned by context.read capability */
|
|
84
|
+
interface ContextData {
|
|
85
|
+
customerId?: string;
|
|
86
|
+
customerEmail?: string;
|
|
87
|
+
[key: string]: unknown;
|
|
88
|
+
}
|
|
89
|
+
/** Union of all capability call types */
|
|
90
|
+
type CapabilityCall = {
|
|
91
|
+
type: 'data.query';
|
|
92
|
+
payload: ApiRequest;
|
|
93
|
+
} | {
|
|
94
|
+
type: 'data.fetch';
|
|
95
|
+
payload: FetchRequest;
|
|
96
|
+
} | {
|
|
97
|
+
type: 'actions.toast';
|
|
98
|
+
payload: ToastPayload;
|
|
99
|
+
} | {
|
|
100
|
+
type: 'actions.invoke';
|
|
101
|
+
payload: ActionInvokePayload;
|
|
102
|
+
} | {
|
|
103
|
+
type: 'context.read';
|
|
104
|
+
};
|
|
105
|
+
type CapabilityType = CapabilityCall['type'];
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Instance Contract
|
|
109
|
+
* Shared types for extension instances used by both host and admin.
|
|
110
|
+
*/
|
|
111
|
+
type Theme = 'light' | 'dark';
|
|
112
|
+
type InstanceSettings = {
|
|
113
|
+
theme?: Theme;
|
|
114
|
+
} & Record<string, unknown>;
|
|
115
|
+
interface InstanceOption {
|
|
116
|
+
id: string;
|
|
117
|
+
name: string;
|
|
118
|
+
settings?: InstanceSettings;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Permissions Contract
|
|
123
|
+
* Extensions declare required permissions in their manifest.
|
|
124
|
+
* Host enforces: capability calls must be a subset of granted permissions.
|
|
125
|
+
*/
|
|
126
|
+
declare const PERMISSIONS: readonly ["context:read", "data:query", "data:fetch", "actions:toast", "actions:invoke"];
|
|
127
|
+
type Permission = (typeof PERMISSIONS)[number];
|
|
128
|
+
/**
|
|
129
|
+
* Maps capability types to the permission required to use them.
|
|
130
|
+
*/
|
|
131
|
+
declare const CAPABILITY_PERMISSION_MAP: Record<string, Permission>;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Extension Manifest Schema
|
|
135
|
+
* Declared by extension developers in manifest.json.
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* An extension point target identifier (e.g. "slot.header").
|
|
140
|
+
* Apps define which targets they expose; this is not a fixed list.
|
|
141
|
+
*/
|
|
142
|
+
type Target = string;
|
|
143
|
+
interface ExtensionManifest {
|
|
144
|
+
/** Human-readable extension name */
|
|
145
|
+
name: string;
|
|
146
|
+
/** Semver version string */
|
|
147
|
+
version: string;
|
|
148
|
+
/** Extension point targets this extension renders into */
|
|
149
|
+
targets: string[];
|
|
150
|
+
/** Permissions required by this extension */
|
|
151
|
+
permissions: Permission[];
|
|
152
|
+
/**
|
|
153
|
+
* Hostnames this extension is permitted to reach via data.fetch.
|
|
154
|
+
* Example: ["api.myservice.com", "cdn.myservice.com"]
|
|
155
|
+
* Must be exact hostname strings — no wildcards, no paths.
|
|
156
|
+
* Use an empty array for extensions that do not use data.fetch.
|
|
157
|
+
*/
|
|
158
|
+
allowedDomains: string[];
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Registry entry for an installed extension (returned by /api/extensions).
|
|
162
|
+
*/
|
|
163
|
+
interface ExtensionRegistryEntry {
|
|
164
|
+
/** Unique extension ID */
|
|
165
|
+
id: string;
|
|
166
|
+
/** Extension manifest */
|
|
167
|
+
manifest: ExtensionManifest;
|
|
168
|
+
/** URL to the extension's JS bundle */
|
|
169
|
+
bundleUrl: string;
|
|
170
|
+
/** Whether the extension is enabled */
|
|
171
|
+
enabled: boolean;
|
|
172
|
+
/** URL to the extension icon */
|
|
173
|
+
iconUrl?: string;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** Full extension with marketplace fields — stays here because it extends ExtensionRegistryEntry */
|
|
177
|
+
interface MarketplaceExtension extends ExtensionRegistryEntry, MarketplaceMetadata {
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Surface Lifecycle Contract
|
|
182
|
+
* Messages exchanged between host and sandbox for surface management.
|
|
183
|
+
*/
|
|
184
|
+
interface SurfaceContext {
|
|
185
|
+
[key: string]: unknown;
|
|
186
|
+
}
|
|
187
|
+
type SurfaceLifecycleMessage = {
|
|
188
|
+
type: 'createSurface';
|
|
189
|
+
surfaceId: string;
|
|
190
|
+
target: string;
|
|
191
|
+
context: SurfaceContext;
|
|
192
|
+
} | {
|
|
193
|
+
type: 'updateSurfaceContext';
|
|
194
|
+
surfaceId: string;
|
|
195
|
+
context: SurfaceContext;
|
|
196
|
+
} | {
|
|
197
|
+
type: 'destroySurface';
|
|
198
|
+
surfaceId: string;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
/** Request from extension sandbox to host */
|
|
202
|
+
interface CapabilityRequest {
|
|
203
|
+
type: 'capability-request';
|
|
204
|
+
id: string;
|
|
205
|
+
extensionId: string;
|
|
206
|
+
capability: CapabilityType;
|
|
207
|
+
payload: unknown;
|
|
208
|
+
}
|
|
209
|
+
/** Response from host to extension sandbox */
|
|
210
|
+
interface CapabilityResponse {
|
|
211
|
+
type: 'capability-response';
|
|
212
|
+
id: string;
|
|
213
|
+
success: boolean;
|
|
214
|
+
data?: unknown;
|
|
215
|
+
error?: string;
|
|
216
|
+
}
|
|
217
|
+
/** All message types that can be sent between host and sandbox */
|
|
218
|
+
type HostToSandboxMessage = {
|
|
219
|
+
type: 'surface-lifecycle';
|
|
220
|
+
data: SurfaceLifecycleMessage;
|
|
221
|
+
} | CapabilityResponse | {
|
|
222
|
+
type: 'context-update';
|
|
223
|
+
surfaceId: string;
|
|
224
|
+
context: Record<string, unknown>;
|
|
225
|
+
};
|
|
226
|
+
type SandboxToHostMessage = CapabilityRequest | {
|
|
227
|
+
type: 'surface-ready';
|
|
228
|
+
extensionId: string;
|
|
229
|
+
surfaceId: string;
|
|
230
|
+
} | {
|
|
231
|
+
type: 'extension-ready';
|
|
232
|
+
extensionId: string;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Ecommerce Type Definitions
|
|
237
|
+
* Ported from zendesk-embedded-widget/app/src/types/ecommerce.ts
|
|
238
|
+
*/
|
|
239
|
+
interface Price {
|
|
240
|
+
currency: string;
|
|
241
|
+
amount: number;
|
|
242
|
+
precise: number;
|
|
243
|
+
rounded: string;
|
|
244
|
+
formatted: string;
|
|
245
|
+
}
|
|
246
|
+
interface Address {
|
|
247
|
+
id: string;
|
|
248
|
+
type: 'address';
|
|
249
|
+
first_name: string;
|
|
250
|
+
last_name: string;
|
|
251
|
+
phone: string;
|
|
252
|
+
line_1: string;
|
|
253
|
+
line_2: string;
|
|
254
|
+
city: string;
|
|
255
|
+
region: string;
|
|
256
|
+
postcode: string;
|
|
257
|
+
country: string;
|
|
258
|
+
meta?: {
|
|
259
|
+
entity_id: string;
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
type DataFieldType = 'data_boolean' | 'data_text' | 'data_pill' | 'data_badge' | 'data_price' | 'data_highlight' | 'data_datestamp';
|
|
263
|
+
interface DataField {
|
|
264
|
+
identifier: string;
|
|
265
|
+
type: DataFieldType;
|
|
266
|
+
value: unknown;
|
|
267
|
+
editable?: boolean;
|
|
268
|
+
label?: string;
|
|
269
|
+
}
|
|
270
|
+
interface Customer {
|
|
271
|
+
id: string;
|
|
272
|
+
url: string;
|
|
273
|
+
type: 'guest' | 'registered';
|
|
274
|
+
name: string;
|
|
275
|
+
status?: string;
|
|
276
|
+
first_name: string;
|
|
277
|
+
last_name: string;
|
|
278
|
+
email: string;
|
|
279
|
+
phone: string;
|
|
280
|
+
data: Array<{
|
|
281
|
+
data: DataField[];
|
|
282
|
+
provider: string;
|
|
283
|
+
}>;
|
|
284
|
+
meta: {
|
|
285
|
+
tags: {
|
|
286
|
+
data: string[];
|
|
287
|
+
};
|
|
288
|
+
entity_id: string;
|
|
289
|
+
total_orders: string;
|
|
290
|
+
};
|
|
291
|
+
relationships: {
|
|
292
|
+
notes: Array<{
|
|
293
|
+
id: string;
|
|
294
|
+
type: 'note';
|
|
295
|
+
messages: string[];
|
|
296
|
+
editable: boolean;
|
|
297
|
+
}>;
|
|
298
|
+
metadata: Array<{
|
|
299
|
+
identifier: string;
|
|
300
|
+
data: DataField[];
|
|
301
|
+
}>;
|
|
302
|
+
addresses: Address[];
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
interface OrderStatus {
|
|
306
|
+
vendor: string;
|
|
307
|
+
color: string;
|
|
308
|
+
abbreviation: string;
|
|
309
|
+
label: string;
|
|
310
|
+
}
|
|
311
|
+
interface OrderStatuses {
|
|
312
|
+
note: string;
|
|
313
|
+
alerts: unknown[];
|
|
314
|
+
isPaid: boolean;
|
|
315
|
+
isShipped: boolean;
|
|
316
|
+
isRefunded: boolean;
|
|
317
|
+
isCancelled: boolean;
|
|
318
|
+
isRefundable: boolean;
|
|
319
|
+
hasBalanceOwed: boolean;
|
|
320
|
+
isCancellable: boolean;
|
|
321
|
+
isModifiable: boolean;
|
|
322
|
+
order: OrderStatus;
|
|
323
|
+
payment: OrderStatus;
|
|
324
|
+
shipping: OrderStatus;
|
|
325
|
+
refund: OrderStatus;
|
|
326
|
+
}
|
|
327
|
+
interface OrderItem {
|
|
328
|
+
id: string;
|
|
329
|
+
type: 'order_item' | 'custom_item';
|
|
330
|
+
sku: string;
|
|
331
|
+
name: string;
|
|
332
|
+
quantity: number;
|
|
333
|
+
refunded: number;
|
|
334
|
+
modified?: number;
|
|
335
|
+
url?: string;
|
|
336
|
+
statuses?: {
|
|
337
|
+
isShipped: boolean;
|
|
338
|
+
isModifiable: boolean;
|
|
339
|
+
};
|
|
340
|
+
meta: {
|
|
341
|
+
entity_id?: string;
|
|
342
|
+
timestamps: {
|
|
343
|
+
created_at: string;
|
|
344
|
+
updated_at: string;
|
|
345
|
+
};
|
|
346
|
+
actions?: Array<{
|
|
347
|
+
id: string;
|
|
348
|
+
type: string;
|
|
349
|
+
label: {
|
|
350
|
+
key: string;
|
|
351
|
+
};
|
|
352
|
+
url?: string;
|
|
353
|
+
}>;
|
|
354
|
+
product?: unknown;
|
|
355
|
+
price_mode?: string;
|
|
356
|
+
display_price: {
|
|
357
|
+
with_tax: {
|
|
358
|
+
unit: Price;
|
|
359
|
+
value: Price;
|
|
360
|
+
};
|
|
361
|
+
without_tax: {
|
|
362
|
+
unit: Price;
|
|
363
|
+
value: Price;
|
|
364
|
+
};
|
|
365
|
+
tax: {
|
|
366
|
+
unit: Price;
|
|
367
|
+
value: Price;
|
|
368
|
+
};
|
|
369
|
+
};
|
|
370
|
+
discount_price?: {
|
|
371
|
+
with_tax: {
|
|
372
|
+
unit: Price;
|
|
373
|
+
value: Price;
|
|
374
|
+
};
|
|
375
|
+
without_tax: {
|
|
376
|
+
unit: Price;
|
|
377
|
+
value: Price;
|
|
378
|
+
};
|
|
379
|
+
tax: {
|
|
380
|
+
unit: Price;
|
|
381
|
+
value: Price;
|
|
382
|
+
};
|
|
383
|
+
};
|
|
384
|
+
vendor?: string;
|
|
385
|
+
};
|
|
386
|
+
relationships?: {
|
|
387
|
+
shipping?: {
|
|
388
|
+
parcels?: Array<{
|
|
389
|
+
id: string;
|
|
390
|
+
shipment_status: string;
|
|
391
|
+
trackings: Array<{
|
|
392
|
+
tracking_number: string;
|
|
393
|
+
carrier: string;
|
|
394
|
+
carrier_code: string;
|
|
395
|
+
service_code?: string;
|
|
396
|
+
url?: string;
|
|
397
|
+
}>;
|
|
398
|
+
name?: string;
|
|
399
|
+
timestamps?: {
|
|
400
|
+
created_at: string;
|
|
401
|
+
};
|
|
402
|
+
}>;
|
|
403
|
+
};
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
interface Shipment {
|
|
407
|
+
id: string;
|
|
408
|
+
shipping_address: Address;
|
|
409
|
+
}
|
|
410
|
+
interface OrderAction {
|
|
411
|
+
id: string;
|
|
412
|
+
type: 'order_action';
|
|
413
|
+
label: {
|
|
414
|
+
key: string;
|
|
415
|
+
};
|
|
416
|
+
url?: string;
|
|
417
|
+
confirm?: boolean;
|
|
418
|
+
}
|
|
419
|
+
interface Order {
|
|
420
|
+
id: string;
|
|
421
|
+
type: 'order';
|
|
422
|
+
url: string;
|
|
423
|
+
transaction_id: string;
|
|
424
|
+
statuses: OrderStatuses;
|
|
425
|
+
actions?: OrderAction[];
|
|
426
|
+
billing_address?: Address;
|
|
427
|
+
shipments: Shipment[];
|
|
428
|
+
relationships: {
|
|
429
|
+
items: {
|
|
430
|
+
data: OrderItem[];
|
|
431
|
+
};
|
|
432
|
+
transactions?: {
|
|
433
|
+
data: unknown[];
|
|
434
|
+
};
|
|
435
|
+
customer: {
|
|
436
|
+
data: {
|
|
437
|
+
type: 'customer';
|
|
438
|
+
id: string;
|
|
439
|
+
url: string;
|
|
440
|
+
name: string;
|
|
441
|
+
phone: string;
|
|
442
|
+
email: string;
|
|
443
|
+
};
|
|
444
|
+
};
|
|
445
|
+
};
|
|
446
|
+
meta: {
|
|
447
|
+
timestamps: {
|
|
448
|
+
created_at: string;
|
|
449
|
+
updated_at: string;
|
|
450
|
+
};
|
|
451
|
+
tax_mode: string;
|
|
452
|
+
entity_id: string;
|
|
453
|
+
tags: {
|
|
454
|
+
data: string[];
|
|
455
|
+
};
|
|
456
|
+
display_price: {
|
|
457
|
+
with_tax: Price;
|
|
458
|
+
without_tax: Price;
|
|
459
|
+
tax: Price;
|
|
460
|
+
};
|
|
461
|
+
display_balance_price?: {
|
|
462
|
+
with_tax: Price;
|
|
463
|
+
};
|
|
464
|
+
refundable_balance_price?: {
|
|
465
|
+
with_tax: Price;
|
|
466
|
+
};
|
|
467
|
+
};
|
|
468
|
+
display_status?: OrderStatus;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
export { ALLOWED_ICONS, type ActionInvokePayload, type Address, type AllowedIconName, type ApiError, type ApiRequest, type ApiResponse, CAPABILITY_PERMISSION_MAP, type CapabilityCall, type CapabilityRequest, type CapabilityResponse, type CapabilityType, type ContextData, type Customer, type DataField, type DataFieldType, type ExtensionManifest, type ExtensionRegistryEntry, type FetchRequest, type FetchRequestInit, type FetchResponse, type HostToSandboxMessage, type InstanceOption, type InstanceSettings, type MarketplaceExtension, type NamedEntity, type Order, type OrderAction, type OrderItem, type OrderStatus, type OrderStatuses, PERMISSIONS, type Permission, type Price, type SandboxToHostMessage, type Shipment, type SurfaceContext, type SurfaceLifecycleMessage, type Target, type Theme, type ToastPayload, type UITag, UI_TAGS, UI_TAG_ATTRIBUTES };
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,133 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
// src/components.ts
|
|
2
|
+
var UI_TAGS = [
|
|
3
|
+
"ui-card",
|
|
4
|
+
"ui-card-content",
|
|
5
|
+
"ui-card-header",
|
|
6
|
+
"ui-button",
|
|
7
|
+
"ui-text",
|
|
8
|
+
"ui-heading",
|
|
9
|
+
"ui-badge",
|
|
10
|
+
"ui-input",
|
|
11
|
+
"ui-stack",
|
|
12
|
+
"ui-inline",
|
|
13
|
+
"ui-separator",
|
|
14
|
+
"ui-tabs",
|
|
15
|
+
"ui-tabs-list",
|
|
16
|
+
"ui-tabs-trigger",
|
|
17
|
+
"ui-tabs-content",
|
|
18
|
+
"ui-scroll-area",
|
|
19
|
+
"ui-avatar",
|
|
20
|
+
"ui-avatar-image",
|
|
21
|
+
"ui-avatar-fallback",
|
|
22
|
+
"ui-icon",
|
|
23
|
+
"ui-link",
|
|
24
|
+
"ui-menu",
|
|
25
|
+
"ui-menu-item"
|
|
26
|
+
];
|
|
27
|
+
var UI_TAG_ATTRIBUTES = {
|
|
28
|
+
"ui-card": ["className", "onClick"],
|
|
29
|
+
"ui-card-content": ["className"],
|
|
30
|
+
"ui-card-header": ["className"],
|
|
31
|
+
"ui-button": ["variant", "size", "disabled", "onClick", "type", "className", "title"],
|
|
32
|
+
"ui-text": ["className", "tone"],
|
|
33
|
+
"ui-heading": ["level", "className"],
|
|
34
|
+
"ui-badge": ["variant", "tone", "className"],
|
|
35
|
+
"ui-input": ["type", "placeholder", "value", "onChange", "disabled", "className", "id"],
|
|
36
|
+
"ui-stack": ["gap", "direction", "align", "className"],
|
|
37
|
+
"ui-inline": ["gap", "align", "className"],
|
|
38
|
+
"ui-separator": ["className"],
|
|
39
|
+
"ui-tabs": ["defaultValue", "className"],
|
|
40
|
+
"ui-tabs-list": ["className"],
|
|
41
|
+
"ui-tabs-trigger": ["value", "className"],
|
|
42
|
+
"ui-tabs-content": ["value", "className"],
|
|
43
|
+
"ui-scroll-area": ["className"],
|
|
44
|
+
"ui-avatar": ["className"],
|
|
45
|
+
"ui-avatar-image": ["src", "alt", "className"],
|
|
46
|
+
"ui-avatar-fallback": ["className"],
|
|
47
|
+
"ui-icon": ["name", "size", "className"],
|
|
48
|
+
"ui-link": ["href", "target", "rel", "className"],
|
|
49
|
+
"ui-menu-item": ["icon", "label", "description", "onClick", "className"],
|
|
50
|
+
"ui-menu": ["title", "className"]
|
|
51
|
+
};
|
|
52
|
+
var ALLOWED_ICONS = [
|
|
53
|
+
"arrow-left",
|
|
54
|
+
"calendar",
|
|
55
|
+
"check-circle-2",
|
|
56
|
+
"chevron-left",
|
|
57
|
+
"chevron-right",
|
|
58
|
+
"clock",
|
|
59
|
+
"credit-card",
|
|
60
|
+
"external-link",
|
|
61
|
+
"help-circle",
|
|
62
|
+
"info",
|
|
63
|
+
"loader-2",
|
|
64
|
+
"mail",
|
|
65
|
+
"map-pin",
|
|
66
|
+
"message-circle",
|
|
67
|
+
"message-square",
|
|
68
|
+
"package",
|
|
69
|
+
"phone",
|
|
70
|
+
"search",
|
|
71
|
+
"shopping-bag",
|
|
72
|
+
"sparkles",
|
|
73
|
+
"truck",
|
|
74
|
+
"user",
|
|
75
|
+
"x-circle",
|
|
76
|
+
"alert-circle",
|
|
77
|
+
"book-open"
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
// src/permissions.ts
|
|
81
|
+
var PERMISSIONS = [
|
|
82
|
+
"context:read",
|
|
83
|
+
"data:query",
|
|
84
|
+
"data:fetch",
|
|
85
|
+
"actions:toast",
|
|
86
|
+
"actions:invoke"
|
|
87
|
+
];
|
|
88
|
+
var CAPABILITY_PERMISSION_MAP = {
|
|
89
|
+
"context.read": "context:read",
|
|
90
|
+
"data.query": "data:query",
|
|
91
|
+
"data.fetch": "data:fetch",
|
|
92
|
+
"actions.toast": "actions:toast",
|
|
93
|
+
"actions.invoke": "actions:invoke"
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// ../../../lib/contracts/src/permissions.ts
|
|
97
|
+
var SUPER_ROLE = {
|
|
98
|
+
ADMIN: "org:super_admin"
|
|
99
|
+
};
|
|
100
|
+
var ORG_ROLE = {
|
|
101
|
+
ADMIN: "org:admin",
|
|
102
|
+
OWNER: "org:owner",
|
|
103
|
+
MEMBER: "org:member"
|
|
104
|
+
};
|
|
105
|
+
var EDITOR_ROLES = [
|
|
106
|
+
SUPER_ROLE.ADMIN,
|
|
107
|
+
ORG_ROLE.ADMIN,
|
|
108
|
+
ORG_ROLE.OWNER
|
|
109
|
+
];
|
|
110
|
+
var VIEWER_ROLES = [
|
|
111
|
+
...Object.values(SUPER_ROLE),
|
|
112
|
+
...Object.values(EDITOR_ROLES)
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
// ../../../lib/contracts/src/marketplace.ts
|
|
116
|
+
var EXTENSION_CATEGORIES = [
|
|
117
|
+
"commerce",
|
|
118
|
+
"support",
|
|
119
|
+
"analytics",
|
|
120
|
+
"productivity",
|
|
121
|
+
"communication",
|
|
122
|
+
"other"
|
|
123
|
+
];
|
|
124
|
+
var EXTENSION_VISIBILITIES = ["public", "protected"];
|
|
125
|
+
export {
|
|
126
|
+
ALLOWED_ICONS,
|
|
127
|
+
CAPABILITY_PERMISSION_MAP,
|
|
128
|
+
EXTENSION_CATEGORIES,
|
|
129
|
+
EXTENSION_VISIBILITIES,
|
|
130
|
+
PERMISSIONS,
|
|
131
|
+
UI_TAGS,
|
|
132
|
+
UI_TAG_ATTRIBUTES
|
|
133
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackable-labs/sdk-extension-contracts",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
"default": "./dist/index.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
-
"dependencies": {
|
|
15
|
-
"@stackable-labs/lib-contracts": "workspace:*"
|
|
16
|
-
},
|
|
17
14
|
"description": "TypeScript contracts and interfaces for Stackable extensions.",
|
|
18
15
|
"license": "SEE LICENSE IN LICENSE",
|
|
19
16
|
"publishConfig": {
|
package/dist/api.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface ApiRequest {
|
|
2
|
-
action: string;
|
|
3
|
-
[key: string]: unknown;
|
|
4
|
-
}
|
|
5
|
-
export interface ApiResponse<T = unknown> {
|
|
6
|
-
success: boolean;
|
|
7
|
-
data: T;
|
|
8
|
-
action: string;
|
|
9
|
-
}
|
|
10
|
-
export interface ApiError {
|
|
11
|
-
error: string;
|
|
12
|
-
status?: number;
|
|
13
|
-
message?: string;
|
|
14
|
-
}
|
package/dist/api.js
DELETED
package/dist/api.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":""}
|
package/dist/app.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { AppRegistryEntry } from '@stackable-labs/lib-contracts';
|
package/dist/app.js
DELETED
package/dist/app.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":""}
|