@pega/cosmos-react-work 8.31.0 → 8.32.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/lib/components/GenAICoach/GenAICoach.utils.d.ts +2 -0
- package/lib/components/GenAICoach/GenAICoach.utils.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.utils.js +26 -0
- package/lib/components/GenAICoach/GenAICoach.utils.js.map +1 -1
- package/lib/components/GenAICoach/index.d.ts +1 -1
- package/lib/components/GenAICoach/index.d.ts.map +1 -1
- package/lib/components/GenAICoach/index.js +1 -1
- package/lib/components/GenAICoach/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { CoachMessageProps, GenAIMessageProps, State, UserMessageProps, Variant } from './GenAICoach.types';
|
|
2
|
+
/** Copies text using the Clipboard API with a legacy fallback and reports whether it succeeded. */
|
|
3
|
+
export declare const copyToClipboard: (text: string) => Promise<boolean>;
|
|
2
4
|
export declare const isCoachMessage: (message: GenAIMessageProps) => message is CoachMessageProps;
|
|
3
5
|
export declare const isUserMessage: (message: GenAIMessageProps) => message is UserMessageProps;
|
|
4
6
|
export declare const isInUtilities: (item: Variant) => item is {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAICoach.utils.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,EACL,gBAAgB,EAChB,OAAO,EACR,MAAM,oBAAoB,CAAC;AAE5B,eAAO,MAAM,cAAc,GAAI,SAAS,iBAAiB,KAAG,OAAO,IAAI,iBAEtE,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,SAAS,iBAAiB,KAAG,OAAO,IAAI,gBAErE,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,MAAM,OAAO,KACZ,IAAI,IAAI;IACT,SAAS,EAAE,WAAW,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAGvC,CAAC"}
|
|
1
|
+
{"version":3,"file":"GenAICoach.utils.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,EACL,gBAAgB,EAChB,OAAO,EACR,MAAM,oBAAoB,CAAC;AAE5B,mGAAmG;AACnG,eAAO,MAAM,eAAe,GAAU,MAAM,MAAM,qBAwBjD,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,SAAS,iBAAiB,KAAG,OAAO,IAAI,iBAEtE,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,SAAS,iBAAiB,KAAG,OAAO,IAAI,gBAErE,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,MAAM,OAAO,KACZ,IAAI,IAAI;IACT,SAAS,EAAE,WAAW,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAGvC,CAAC"}
|
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
/** Copies text using the Clipboard API with a legacy fallback and reports whether it succeeded. */
|
|
2
|
+
export const copyToClipboard = async (text) => {
|
|
3
|
+
try {
|
|
4
|
+
if (navigator.clipboard?.writeText) {
|
|
5
|
+
await navigator.clipboard.writeText(text);
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
const textArea = document.createElement('textarea');
|
|
9
|
+
textArea.value = text;
|
|
10
|
+
textArea.setAttribute('readonly', '');
|
|
11
|
+
textArea.style.position = 'fixed';
|
|
12
|
+
textArea.style.opacity = '0';
|
|
13
|
+
document.body.appendChild(textArea);
|
|
14
|
+
// Use the legacy copy command as a fallback and always remove the temporary textarea.
|
|
15
|
+
try {
|
|
16
|
+
textArea.select();
|
|
17
|
+
return document.execCommand('copy');
|
|
18
|
+
}
|
|
19
|
+
finally {
|
|
20
|
+
document.body.removeChild(textArea);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
1
27
|
export const isCoachMessage = (message) => {
|
|
2
28
|
return message.from === 'coach';
|
|
3
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAICoach.utils.js","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.utils.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAA0B,EAAgC,EAAE;IACzF,OAAO,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC;AAClC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAA0B,EAA+B,EAAE;IACvF,OAAO,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC;AACjC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,IAAa,EAKb,EAAE;IACF,OAAO,IAAI,CAAC,SAAS,KAAK,WAAW,CAAC;AACxC,CAAC,CAAC","sourcesContent":["import type {\n CoachMessageProps,\n GenAIMessageProps,\n State,\n UserMessageProps,\n Variant\n} from './GenAICoach.types';\n\nexport const isCoachMessage = (message: GenAIMessageProps): message is CoachMessageProps => {\n return message.from === 'coach';\n};\n\nexport const isUserMessage = (message: GenAIMessageProps): message is UserMessageProps => {\n return message.from === 'user';\n};\n\nexport const isInUtilities = (\n item: Variant\n): item is {\n placement: 'utilities';\n state: State;\n onStateChange: (state: State) => void;\n} => {\n return item.placement === 'utilities';\n};\n"]}
|
|
1
|
+
{"version":3,"file":"GenAICoach.utils.js","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.utils.ts"],"names":[],"mappings":"AAQA,mGAAmG;AACnG,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK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","sourcesContent":["import type {\n CoachMessageProps,\n GenAIMessageProps,\n State,\n UserMessageProps,\n Variant\n} from './GenAICoach.types';\n\n/** Copies text using the Clipboard API with a legacy fallback and reports whether it succeeded. */\nexport const copyToClipboard = async (text: string) => {\n try {\n if (navigator.clipboard?.writeText) {\n await navigator.clipboard.writeText(text);\n return true;\n }\n\n const textArea = document.createElement('textarea');\n textArea.value = text;\n textArea.setAttribute('readonly', '');\n textArea.style.position = 'fixed';\n textArea.style.opacity = '0';\n document.body.appendChild(textArea);\n\n // Use the legacy copy command as a fallback and always remove the temporary textarea.\n try {\n textArea.select();\n return document.execCommand('copy');\n } finally {\n document.body.removeChild(textArea);\n }\n } catch {\n return false;\n }\n};\n\nexport const isCoachMessage = (message: GenAIMessageProps): message is CoachMessageProps => {\n return message.from === 'coach';\n};\n\nexport const isUserMessage = (message: GenAIMessageProps): message is UserMessageProps => {\n return message.from === 'user';\n};\n\nexport const isInUtilities = (\n item: Variant\n): item is {\n placement: 'utilities';\n state: State;\n onStateChange: (state: State) => void;\n} => {\n return item.placement === 'utilities';\n};\n"]}
|
|
@@ -2,5 +2,5 @@ export { default } from './GenAICoach';
|
|
|
2
2
|
export type { GenAICoachProps, GenAIMessageProps, UserMessageProps, CoachMessageProps, MessageProps, UtilitiesGenAICoachProps, SendMessageProps, State } from './GenAICoach.types';
|
|
3
3
|
export { default as GenAIMessage, StreamingContext } from './GenAIMessage';
|
|
4
4
|
export { default as InitialSuggestedMessage } from './InitialSuggestedMessage';
|
|
5
|
-
export { isUserMessage, isCoachMessage } from './GenAICoach.utils';
|
|
5
|
+
export { copyToClipboard, isUserMessage, isCoachMessage } from './GenAICoach.utils';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,wBAAwB,EACxB,gBAAgB,EAChB,KAAK,EACN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,wBAAwB,EACxB,gBAAgB,EAChB,KAAK,EACN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default } from './GenAICoach';
|
|
2
2
|
export { default as GenAIMessage, StreamingContext } from './GenAIMessage';
|
|
3
3
|
export { default as InitialSuggestedMessage } from './InitialSuggestedMessage';
|
|
4
|
-
export { isUserMessage, isCoachMessage } from './GenAICoach.utils';
|
|
4
|
+
export { copyToClipboard, isUserMessage, isCoachMessage } from './GenAICoach.utils';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/GenAICoach/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAWvC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export { default } from './GenAICoach';\nexport type {\n GenAICoachProps,\n GenAIMessageProps,\n UserMessageProps,\n CoachMessageProps,\n MessageProps,\n UtilitiesGenAICoachProps,\n SendMessageProps,\n State\n} from './GenAICoach.types';\nexport { default as GenAIMessage, StreamingContext } from './GenAIMessage';\nexport { default as InitialSuggestedMessage } from './InitialSuggestedMessage';\nexport { isUserMessage, isCoachMessage } from './GenAICoach.utils';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/GenAICoach/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAWvC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export { default } from './GenAICoach';\nexport type {\n GenAICoachProps,\n GenAIMessageProps,\n UserMessageProps,\n CoachMessageProps,\n MessageProps,\n UtilitiesGenAICoachProps,\n SendMessageProps,\n State\n} from './GenAICoach.types';\nexport { default as GenAIMessage, StreamingContext } from './GenAIMessage';\nexport { default as InitialSuggestedMessage } from './InitialSuggestedMessage';\nexport { copyToClipboard, isUserMessage, isCoachMessage } from './GenAICoach.utils';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-work",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.32.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"author": "Pegasystems",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"build": "tsc -b tsconfig.build.json"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pega/cosmos-react-core": "8.
|
|
18
|
-
"@pega/cosmos-react-rte": "8.
|
|
17
|
+
"@pega/cosmos-react-core": "8.32.0",
|
|
18
|
+
"@pega/cosmos-react-rte": "8.32.0",
|
|
19
19
|
"@types/react": "^17.0.62 || ^18.3.3",
|
|
20
20
|
"@types/react-dom": "^17.0.20 || ^18.3.0",
|
|
21
21
|
"@types/styled-components": "^5.1.26",
|