@blocksdiy/blocks-client-sdk 1.11.3 → 1.12.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/Agent.d.ts +19 -5
- package/dist/Agent.d.ts.map +1 -1
- package/dist/Agent.js +13 -3
- package/dist/ReactClientSdk.d.ts +5 -5
- package/dist/ReactClientSdk.jsx +5 -5
- package/package.json +3 -3
package/dist/Agent.d.ts
CHANGED
|
@@ -5,8 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export interface AgentConfig {
|
|
7
7
|
id: string;
|
|
8
|
+
/** @deprecated Internal identifier — not for display. */
|
|
8
9
|
name?: string;
|
|
10
|
+
/** Persona display name (e.g. "Leo"). */
|
|
9
11
|
title?: string;
|
|
12
|
+
/** Role title (e.g. "Support Specialist"). */
|
|
13
|
+
jobTitle?: string;
|
|
14
|
+
/** @deprecated No longer emitted in generated configs. */
|
|
10
15
|
harness?: string;
|
|
11
16
|
photoUrl?: string;
|
|
12
17
|
avatarUrl?: string;
|
|
@@ -14,25 +19,34 @@ export interface AgentConfig {
|
|
|
14
19
|
/**
|
|
15
20
|
* Agent class for referencing an app agent.
|
|
16
21
|
*
|
|
17
|
-
*
|
|
22
|
+
* UI-facing identity is exposed as readonly props — destructure directly:
|
|
23
|
+
* `const { title, jobTitle, avatarUrl, photoUrl } = useAgent(MyAgent);`
|
|
18
24
|
*/
|
|
19
25
|
export declare class Agent<AC extends AgentConfig = AgentConfig> {
|
|
20
|
-
|
|
26
|
+
readonly id: string;
|
|
27
|
+
/** Persona display name (e.g. "Leo"). */
|
|
28
|
+
readonly title?: string;
|
|
29
|
+
/** Role title (e.g. "Support Specialist"). */
|
|
30
|
+
readonly jobTitle?: string;
|
|
31
|
+
readonly photoUrl?: string;
|
|
32
|
+
readonly avatarUrl?: string;
|
|
21
33
|
private name?;
|
|
22
|
-
private title?;
|
|
23
34
|
private harness?;
|
|
24
|
-
private photoUrl?;
|
|
25
|
-
private avatarUrl?;
|
|
26
35
|
private appId;
|
|
27
36
|
private token?;
|
|
28
37
|
constructor(config: AC, { appId, token }: {
|
|
29
38
|
appId: string;
|
|
30
39
|
token?: string;
|
|
31
40
|
});
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Destructure the readonly props off the agent instead.
|
|
43
|
+
* Kept for previously generated app code.
|
|
44
|
+
*/
|
|
32
45
|
getAgentProps(): {
|
|
33
46
|
id: string;
|
|
34
47
|
name: string | undefined;
|
|
35
48
|
title: string | undefined;
|
|
49
|
+
jobTitle: string | undefined;
|
|
36
50
|
harness: string | undefined;
|
|
37
51
|
photoUrl: string | undefined;
|
|
38
52
|
avatarUrl: string | undefined;
|
package/dist/Agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../src/Agent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED
|
|
1
|
+
{"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../src/Agent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,qBAAa,KAAK,CAAC,EAAE,SAAS,WAAW,GAAG,WAAW;IACrD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,8CAA8C;IAC9C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAE5B,OAAO,CAAC,IAAI,CAAC,CAAS;IACtB,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,KAAK,CAAC,CAAS;gBAEX,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAY3E;;;OAGG;IACH,aAAa;;;;;;;;;;;CAad"}
|
package/dist/Agent.js
CHANGED
|
@@ -1,32 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agent class for referencing an app agent.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* UI-facing identity is exposed as readonly props — destructure directly:
|
|
5
|
+
* `const { title, jobTitle, avatarUrl, photoUrl } = useAgent(MyAgent);`
|
|
5
6
|
*/
|
|
6
7
|
export class Agent {
|
|
7
8
|
id;
|
|
8
|
-
name
|
|
9
|
+
/** Persona display name (e.g. "Leo"). */
|
|
9
10
|
title;
|
|
10
|
-
|
|
11
|
+
/** Role title (e.g. "Support Specialist"). */
|
|
12
|
+
jobTitle;
|
|
11
13
|
photoUrl;
|
|
12
14
|
avatarUrl;
|
|
15
|
+
name;
|
|
16
|
+
harness;
|
|
13
17
|
appId;
|
|
14
18
|
token;
|
|
15
19
|
constructor(config, { appId, token }) {
|
|
16
20
|
this.id = config.id;
|
|
17
21
|
this.name = config.name;
|
|
18
22
|
this.title = config.title;
|
|
23
|
+
this.jobTitle = config.jobTitle;
|
|
19
24
|
this.harness = config.harness;
|
|
20
25
|
this.photoUrl = config.photoUrl;
|
|
21
26
|
this.avatarUrl = config.avatarUrl;
|
|
22
27
|
this.appId = appId;
|
|
23
28
|
this.token = token;
|
|
24
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Destructure the readonly props off the agent instead.
|
|
32
|
+
* Kept for previously generated app code.
|
|
33
|
+
*/
|
|
25
34
|
getAgentProps() {
|
|
26
35
|
return {
|
|
27
36
|
id: this.id,
|
|
28
37
|
name: this.name,
|
|
29
38
|
title: this.title,
|
|
39
|
+
jobTitle: this.jobTitle,
|
|
30
40
|
harness: this.harness,
|
|
31
41
|
photoUrl: this.photoUrl,
|
|
32
42
|
avatarUrl: this.avatarUrl,
|
package/dist/ReactClientSdk.d.ts
CHANGED
|
@@ -528,8 +528,9 @@ export declare const useAgentChat: <ACC extends AgentChatConfig = AgentChatConfi
|
|
|
528
528
|
* Hook to get an Agent instance from a generated agent configuration.
|
|
529
529
|
*
|
|
530
530
|
* Import generated agent configs from `@/product-types`, then pass one to
|
|
531
|
-
* `useAgent()`
|
|
532
|
-
*
|
|
531
|
+
* `useAgent()` and read the agent's UI-facing identity directly off the
|
|
532
|
+
* returned object: `title` (persona display name, e.g. "Leo"), `jobTitle`
|
|
533
|
+
* (role title), and `avatarUrl` / `photoUrl` (persona images).
|
|
533
534
|
*
|
|
534
535
|
* @template AC - Agent configuration type
|
|
535
536
|
* @param {AC} agentConfig - Generated agent configuration from product-types
|
|
@@ -540,10 +541,9 @@ export declare const useAgentChat: <ACC extends AgentChatConfig = AgentChatConfi
|
|
|
540
541
|
* import { CustomerSupportAgent } from '@/product-types';
|
|
541
542
|
*
|
|
542
543
|
* function AgentHeader() {
|
|
543
|
-
* const
|
|
544
|
-
* const { name, title, avatarUrl, photoUrl } = agent.getAgentProps();
|
|
544
|
+
* const { title, jobTitle, avatarUrl, photoUrl } = useAgent(CustomerSupportAgent);
|
|
545
545
|
*
|
|
546
|
-
* return <img src={avatarUrl ?? photoUrl} alt={
|
|
546
|
+
* return <img src={avatarUrl ?? photoUrl} alt={title ?? jobTitle} />;
|
|
547
547
|
* }
|
|
548
548
|
* ```
|
|
549
549
|
*/
|
package/dist/ReactClientSdk.jsx
CHANGED
|
@@ -874,8 +874,9 @@ export const useAgentChat = (agentChatConfig) => {
|
|
|
874
874
|
* Hook to get an Agent instance from a generated agent configuration.
|
|
875
875
|
*
|
|
876
876
|
* Import generated agent configs from `@/product-types`, then pass one to
|
|
877
|
-
* `useAgent()`
|
|
878
|
-
*
|
|
877
|
+
* `useAgent()` and read the agent's UI-facing identity directly off the
|
|
878
|
+
* returned object: `title` (persona display name, e.g. "Leo"), `jobTitle`
|
|
879
|
+
* (role title), and `avatarUrl` / `photoUrl` (persona images).
|
|
879
880
|
*
|
|
880
881
|
* @template AC - Agent configuration type
|
|
881
882
|
* @param {AC} agentConfig - Generated agent configuration from product-types
|
|
@@ -886,10 +887,9 @@ export const useAgentChat = (agentChatConfig) => {
|
|
|
886
887
|
* import { CustomerSupportAgent } from '@/product-types';
|
|
887
888
|
*
|
|
888
889
|
* function AgentHeader() {
|
|
889
|
-
* const
|
|
890
|
-
* const { name, title, avatarUrl, photoUrl } = agent.getAgentProps();
|
|
890
|
+
* const { title, jobTitle, avatarUrl, photoUrl } = useAgent(CustomerSupportAgent);
|
|
891
891
|
*
|
|
892
|
-
* return <img src={avatarUrl ?? photoUrl} alt={
|
|
892
|
+
* return <img src={avatarUrl ?? photoUrl} alt={title ?? jobTitle} />;
|
|
893
893
|
* }
|
|
894
894
|
* ```
|
|
895
895
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocksdiy/blocks-client-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Blocks client sdk",
|
|
6
6
|
"keywords": [],
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@tanstack/react-query": "^5.101.0",
|
|
50
|
-
"@blocksdiy/
|
|
51
|
-
"@blocksdiy/
|
|
50
|
+
"@blocksdiy/react-common": "1.36.0",
|
|
51
|
+
"@blocksdiy/blocks-client-api": "1.5.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"tsc-alias": "^1.8.10",
|