@stackable-labs/sdk-extension-react 1.29.0 → 1.31.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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ApiRequest, FetchRequestInit, FetchResponse, ToastPayload, ContextData, AllowedIconName } from '@stackable-labs/sdk-extension-contracts';
2
+ import { ApiRequest, FetchRequestInit, FetchResponse, ToastPayload, InvokeAction, ContextData, AllowedIconName } from '@stackable-labs/sdk-extension-contracts';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
 
5
5
  /**
@@ -62,7 +62,7 @@ declare const useCapabilities: () => {
62
62
  };
63
63
  actions: {
64
64
  toast: (payload: ToastPayload) => Promise<void>;
65
- invoke: <T = unknown>(action: string, payload?: Record<string, unknown>) => Promise<T>;
65
+ invoke: <T = unknown>(action: InvokeAction, payload?: Record<string, unknown>) => Promise<T>;
66
66
  };
67
67
  context: {
68
68
  read: () => Promise<ContextData>;
@@ -105,19 +105,17 @@ declare const CardHeader: (props: {
105
105
  declare const Stack: (props: {
106
106
  gap?: string;
107
107
  direction?: "row" | "column";
108
- align?: string;
109
108
  className?: string;
110
109
  children?: React.ReactNode;
111
110
  }) => react_jsx_runtime.JSX.Element;
112
111
  declare const Inline: (props: {
113
112
  gap?: string;
114
- align?: string;
115
113
  className?: string;
116
114
  children?: React.ReactNode;
117
115
  }) => react_jsx_runtime.JSX.Element;
118
116
  declare const Text: (props: {
119
117
  className?: string;
120
- tone?: string;
118
+ tone?: "default" | "muted" | "destructive";
121
119
  children?: React.ReactNode;
122
120
  }) => react_jsx_runtime.JSX.Element;
123
121
  declare const Heading: (props: {
@@ -127,7 +125,8 @@ declare const Heading: (props: {
127
125
  }) => react_jsx_runtime.JSX.Element;
128
126
  declare const Badge: (props: {
129
127
  variant?: string;
130
- tone?: string;
128
+ hue?: "amber" | "blue" | "emerald" | "red" | "purple" | "pink" | "gray";
129
+ tone?: "default" | "muted" | "destructive";
131
130
  className?: string;
132
131
  children?: React.ReactNode;
133
132
  }) => react_jsx_runtime.JSX.Element;
@@ -320,6 +319,7 @@ declare global {
320
319
  }, HTMLElement>;
321
320
  'ui-badge': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement> & {
322
321
  variant?: string;
322
+ hue?: string;
323
323
  tone?: string;
324
324
  }, HTMLElement>;
325
325
  'ui-input': Omit<React.HTMLAttributes<HTMLElement>, 'onChange'> & {
@@ -378,11 +378,9 @@ declare global {
378
378
  'ui-stack': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement> & {
379
379
  gap?: string;
380
380
  direction?: string;
381
- align?: string;
382
381
  }, HTMLElement>;
383
382
  'ui-inline': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement> & {
384
383
  gap?: string;
385
- align?: string;
386
384
  }, HTMLElement>;
387
385
  'ui-separator': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
388
386
  'ui-tabs': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement> & {
package/dist/index.js CHANGED
@@ -52,23 +52,6 @@ var initRpcListener = (extensionId) => {
52
52
  });
53
53
  };
54
54
  var isEncryptedPayload = (value) => typeof value === "object" && value !== null && value.encrypted === true && Array.isArray(value.data);
55
- var callCapability = async (capability, payload) => {
56
- let actualPayload = payload;
57
- if (capability === "data.fetch" && encryptionKey) {
58
- const encrypted = await getWebCrypto().encryptMessage(JSON.stringify(payload), encryptionKey);
59
- if (!encrypted) throw new Error("Failed to encrypt data.fetch payload");
60
- actualPayload = { encrypted: true, data: encrypted };
61
- }
62
- const result = await sendCapabilityRequest(capability, actualPayload);
63
- if (capability === "data.fetch" && encryptionKey) {
64
- const fetchResult = result;
65
- if (isEncryptedPayload(fetchResult.data)) {
66
- const decrypted = await getWebCrypto().decryptMessage(fetchResult.data.data, encryptionKey);
67
- fetchResult.data = JSON.parse(decrypted);
68
- }
69
- }
70
- return result;
71
- };
72
55
  var sendCapabilityRequest = (capability, payload) => new Promise((resolve, reject) => {
73
56
  const id = generateRequestId();
74
57
  pendingRequests.set(id, {
@@ -90,6 +73,23 @@ var sendCapabilityRequest = (capability, payload) => new Promise((resolve, rejec
90
73
  }
91
74
  }, 3e4);
92
75
  });
76
+ var callCapability = async (capability, payload) => {
77
+ let actualPayload = payload;
78
+ if (capability === "data.fetch" && encryptionKey) {
79
+ const encrypted = await getWebCrypto().encryptMessage(JSON.stringify(payload), encryptionKey);
80
+ if (!encrypted) throw new Error("Failed to encrypt data.fetch payload");
81
+ actualPayload = { encrypted: true, data: encrypted };
82
+ }
83
+ const result = await sendCapabilityRequest(capability, actualPayload);
84
+ if (capability === "data.fetch" && encryptionKey) {
85
+ const fetchResult = result;
86
+ if (isEncryptedPayload(fetchResult.data)) {
87
+ const decrypted = await getWebCrypto().decryptMessage(fetchResult.data.data, encryptionKey);
88
+ fetchResult.data = JSON.parse(decrypted);
89
+ }
90
+ }
91
+ return result;
92
+ };
93
93
 
94
94
  // src/createExtension.tsx
95
95
  import { jsx } from "react/jsx-runtime";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackable-labs/sdk-extension-react",
3
- "version": "1.29.0",
3
+ "version": "1.31.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -15,7 +15,7 @@
15
15
  "@agnostack/verifyd": "alpha",
16
16
  "@remote-dom/core": "1.x",
17
17
  "@remote-dom/react": "1.x",
18
- "@stackable-labs/sdk-extension-contracts": "1.29.0"
18
+ "@stackable-labs/sdk-extension-contracts": "1.31.0"
19
19
  },
20
20
  "peerDependencies": {
21
21
  "react": ">=18.0.0 <19.0.0",