@pega/custom-dx-components 0.25.10 → 0.25.11

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.
Files changed (35) hide show
  1. package/package.json +1 -1
  2. package/src/constants.js +1 -3
  3. package/src/tasks/delete-lib/index.js +2 -2
  4. package/src/tasks/export-archive/index.js +1 -1
  5. package/src/tasks/import-archive/index.js +2 -2
  6. package/src/tasks/init/template/package.json.mustache +1 -1
  7. package/src/tasks/move/index.js +1 -1
  8. package/src/tasks/switch-lib/index.js +1 -1
  9. package/src/tasks/switch-version/index.js +1 -1
  10. package/src/util.js +38 -3
  11. package/tests/assets/library/components/{create/shared → createAll/Constellation/Pega_DXIL_MyDetails}/Avatar.tsx +1 -1
  12. package/tests/assets/{original/components/create/shared → library/components/createAll/Constellation/Pega_DXIL_MyDetails}/Operator.tsx +1 -1
  13. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx +1 -1
  14. package/tests/assets/{original/components/create/shared → library/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget}/Avatar.tsx +3 -4
  15. package/tests/assets/library/components/{create/shared → createAll/Constellation/Pega_DXIL_MyPageCaseWidget}/Operator.tsx +3 -3
  16. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/index.tsx +1 -1
  17. package/tests/assets/library/components/createAll/Constellation/{shared → Pega_DXIL_MyTwoColumnDetails}/Avatar.tsx +6 -6
  18. package/tests/assets/{original/components/createAll/Constellation/shared → library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails}/Operator.tsx +3 -3
  19. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +1 -1
  20. package/tests/functional/localCreatePublishAllDeleteAll.test.js +1 -1
  21. package/tests/functional/localLibCreateLibExportImportLib.test.js +7 -7
  22. package/tests/functional/localLibCreateLibExportLib.test.js +3 -3
  23. package/tests/assets/library/components/createAll/Constellation/shared/Operator.tsx +0 -215
  24. package/tests/assets/original/components/create/shared/PConnProps.d.ts +0 -46
  25. package/tests/assets/original/components/create/shared/create-nonce.ts +0 -6
  26. package/tests/assets/original/components/create/shared/suggestions-handler.ts +0 -9
  27. package/tests/assets/original/components/createAll/Constellation/shared/Avatar.tsx +0 -76
  28. package/tests/assets/original/components/createAll/Constellation/shared/PConnProps.d.ts +0 -46
  29. package/tests/assets/original/components/createAll/Constellation/shared/create-nonce.ts +0 -6
  30. package/tests/assets/original/components/createAll/Constellation/shared/suggestions-handler.ts +0 -9
  31. package/tests/assets/original/components/createAll/Launchpad/shared/Avatar.tsx +0 -76
  32. package/tests/assets/original/components/createAll/Launchpad/shared/Operator.tsx +0 -215
  33. package/tests/assets/original/components/createAll/Launchpad/shared/PConnProps.d.ts +0 -46
  34. package/tests/assets/original/components/createAll/Launchpad/shared/create-nonce.ts +0 -6
  35. package/tests/assets/original/components/createAll/Launchpad/shared/suggestions-handler.ts +0 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/custom-dx-components",
3
- "version": "0.25.10",
3
+ "version": "0.25.11",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
package/src/constants.js CHANGED
@@ -71,9 +71,7 @@ export const AUTHENTICATE_DEFAULTS = {
71
71
  export const SHARED_FILE_NAMES = [
72
72
  "suggestions-handler.ts",
73
73
  "PConnProps.d.ts",
74
- "create-nonce.ts",
75
- "Operator.tsx",
76
- "Avatar.tsx"
74
+ "create-nonce.ts"
77
75
  ];
78
76
 
79
77
  export const AUTHENTICATE_SCHEMA = {
@@ -152,7 +152,7 @@ addDebugLog("deleteLibraryVersion", "END", "-");
152
152
  if (archiveLibraries.includes(libraryName)) {
153
153
  const archLibVersions = await getLibraryArchivesVersions(libraryName, "");
154
154
  const lastVersion = archLibVersions[archLibVersions.length -1];
155
- const switchToFileName = `${libraryName}_${lastVersion}.zip`;
155
+ const switchToFileName = `${libraryName}_${lastVersion}.arch.zip`;
156
156
  await restoreFromArchive(switchToFileName, libraryName, lastVersion);
157
157
 
158
158
  await forceDefaultsUpdate();
@@ -166,7 +166,7 @@ addDebugLog("deleteLibraryVersion", "END", "-");
166
166
  const newLib = archiveLibraries[0];
167
167
  const archLibVersions = await getLibraryArchivesVersions(newLib, "");
168
168
  const lastVersion = archLibVersions[archLibVersions.length -1];
169
- const switchToFileName = `${newLib}_${lastVersion}.zip`;
169
+ const switchToFileName = `${newLib}_${lastVersion}.arch.zip`;
170
170
  await restoreFromArchive(switchToFileName, newLib, lastVersion);
171
171
 
172
172
 
@@ -170,7 +170,7 @@ export const exportArch = async(exportPath, orgLibName, selectedVersion, fullArc
170
170
  addDebugLog("exportArch", `exportPath: ${exportPath}, orgLibName: ${orgLibName}, selectedVersion: ${selectedVersion}`, "");
171
171
  const currentDirectory = process.cwd();
172
172
  const archiveDirectory = join (currentDirectory, ARCHIVES_PATH, `${orgLibName}`, `${selectedVersion}`);
173
- const fileName = `${orgLibName}_${selectedVersion}.zip`;
173
+ const fileName = `${orgLibName}_${selectedVersion}.arch.zip`;
174
174
  const archFileName = join(archiveDirectory, fileName);
175
175
  const configDef = await getConfigDefaults();
176
176
 
@@ -186,7 +186,7 @@ export const moveComp = async(componentKey, orgLibName, version, copyShared, opt
186
186
  const currentDirectory = process.cwd();
187
187
  const tempDirectory = join(currentDirectory, TEMP_PATH);
188
188
  const archiveDirectory = join (currentDirectory, ARCHIVES_PATH, `${orgLibName}`, `${version}`);
189
- const fileName = `${orgLibName}_${version}.zip`;
189
+ const fileName = `${orgLibName}_${version}.arch.zip`;
190
190
  const archFileName = join(archiveDirectory, fileName);
191
191
 
192
192
 
@@ -372,7 +372,7 @@ addDebugLog("importArch", `filePath: ${filePath}, fileName: ${fileName}`, "");
372
372
  console.log(`You can switch to ${chalk.green(`${orgLibName}/${version}`)} via npm run switchLib.\n`);
373
373
  }
374
374
  else {
375
- const switchToFileName = `${orgLibName}_${version}.zip`;
375
+ const switchToFileName = `${orgLibName}_${version}.arch.zip`;
376
376
 
377
377
  const tasks = new Listr(
378
378
  [
@@ -106,7 +106,7 @@
106
106
  "@babel/preset-react": "^7.26.3",
107
107
  "@babel/preset-typescript": "^7.26.0",
108
108
  "@pega/configs": "^0.16.2",
109
- "@pega/custom-dx-components": "~0.25.10",
109
+ "@pega/custom-dx-components": "~0.25.11",
110
110
  "@pega/pcore-pconnect-typedefs": "^4.1.0-alpha.1",
111
111
  "@storybook/addon-actions": "^7.6.19",
112
112
  "@storybook/addon-essentials": "^7.6.19",
@@ -176,7 +176,7 @@ export const moveComp = async(componentKey, copyMove, orgLibName, version, copyS
176
176
  const currentDirectory = process.cwd();
177
177
  const tempDirectory = join(currentDirectory, TEMP_PATH);
178
178
  const archiveDirectory = join (currentDirectory, ARCHIVES_PATH, `${orgLibName}`, `${version}`);
179
- const fileName = `${orgLibName}_${version}.zip`;
179
+ const fileName = `${orgLibName}_${version}.arch.zip`;
180
180
  const archFileName = join(archiveDirectory, fileName);
181
181
  const currentCompPath = join(currentDirectory, "src", "components");
182
182
  const tempCompPath = join(tempDirectory, "src", "components");
@@ -103,7 +103,7 @@ addDebugLog("switchLibrary", "", "+");
103
103
  const existingOrgLib = orgLib.currentOrgLib;
104
104
  let oldVersion = orgLib.buildVersion;
105
105
 
106
- const switchToFileName = `${newOrgLib}_${newVersion}.zip`;
106
+ const switchToFileName = `${newOrgLib}_${newVersion}.arch.zip`;
107
107
 
108
108
  console.log("");
109
109
 
@@ -75,7 +75,7 @@ addDebugLog("switchVersion", "", "+");
75
75
  const existingOrgLib = orgLib.currentOrgLib;
76
76
  const oldVersion = orgLib.buildVersion;
77
77
 
78
- const switchToFileName = `${existingOrgLib}_${newVersion}.zip`;
78
+ const switchToFileName = `${existingOrgLib}_${newVersion}.arch.zip`;
79
79
 
80
80
  console.log("");
81
81
 
package/src/util.js CHANGED
@@ -262,7 +262,7 @@ if (showDebug) addDebugLog("updateUseWebPackPromotion", "", "");
262
262
  }
263
263
 
264
264
  export const getAboutData = async (currentOrgLib, buildVersion, dateStamp) => {
265
- if (showDebug) addDebugLog("getAboutData", `currentOrgLib: ${currentOrgLib}, buildVersion: ${buildVersion}, dateStamp: ${dateStamp}`)
265
+ if (showDebug) addDebugLog("getAboutData", `currentOrgLib: ${currentOrgLib}, buildVersion: ${buildVersion}, dateStamp: ${dateStamp}`,"");
266
266
  const tokenAndStaticServer = await getC11NB2STokenAndStaticServer();
267
267
 
268
268
  if (tokenAndStaticServer.C11NB2S === undefined) {
@@ -277,6 +277,40 @@ if (showDebug) addDebugLog("getAboutData", `currentOrgLib: ${currentOrgLib}, bui
277
277
  return `${currentOrgLib} ${buildVersion}, ${dateStamp}, ${infinityVersion}`;
278
278
  }
279
279
 
280
+ export const applyPegaData = async (configJson) => {
281
+ if (showDebug) addDebugLog("applyPegaData", "", "");
282
+ const tokenAndStaticServer = await getC11NB2STokenAndStaticServer();
283
+ const currentDirectory = process.cwd()
284
+ const currentPackagePath = join(currentDirectory, PACKAGE_JSON_FILENAME);
285
+ let currentPackageData;
286
+
287
+ try {
288
+ currentPackageData = fs.readFileSync(currentPackagePath);
289
+ }
290
+ catch (ex) {
291
+ console.log($chalk.red(`\nUnable to retrieve current package.json.`))
292
+ process.exit(1);
293
+ }
294
+
295
+ const cData = JSON.parse(currentPackageData);
296
+ const cosmosVersion = cData.dependencies["@pega/cosmos-react-core"];
297
+ let infinityVersion = "";
298
+
299
+ if (tokenAndStaticServer.C11NB2S === undefined) {
300
+ }
301
+ else {
302
+ const jwt = jwtDecode(tokenAndStaticServer.C11NB2S);
303
+ infinityVersion= jwt.infinity_version;
304
+ // don't remove "8." from infinity version so can do a comparison
305
+ }
306
+
307
+ // apply info to config.json
308
+ configJson.infinityVersion = infinityVersion;
309
+ configJson.packageCosmosVersion = cosmosVersion;
310
+
311
+
312
+ }
313
+
280
314
  export const checkJWTExpiration = async () => {
281
315
  const tokenAndStaticServer = await getC11NB2STokenAndStaticServer();
282
316
 
@@ -953,6 +987,7 @@ if (showDebug) addDebugLog("updateConfigVersion", `componentKey: ${componentKey}
953
987
 
954
988
  if (addAboutData) {
955
989
  data.buildDate = dateStamp;
990
+ await applyPegaData(data);
956
991
  }
957
992
 
958
993
 
@@ -1509,7 +1544,7 @@ if (showDebug) addDebugLog("deletePublishExtras", `libraryName: ${libraryName},
1509
1544
  // check if .DS_store file exists in Library, if so delete it because causes issue with services
1510
1545
 
1511
1546
  const currentDirectory = process.cwd();
1512
- const zipFile = libraryName.concat(".zip");
1547
+ const zipFile = libraryName.concat(".arch.zip");
1513
1548
 
1514
1549
  // delete zip file
1515
1550
  const zipPath = join(currentDirectory, zipFile);
@@ -1593,7 +1628,7 @@ if (showDebug) addDebugLog("zipVersionAndArchive", `orgLibName: ${orgLibName}, v
1593
1628
  const srcDirectoryPath = join(currentDirectory, "src");
1594
1629
  const tasksConfig = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
1595
1630
  const packageJson = join(currentDirectory, PACKAGE_JSON_FILENAME);
1596
- const archiveFileName = `${orgLibName}_${version}.zip`;
1631
+ const archiveFileName = `${orgLibName}_${version}.arch.zip`;
1597
1632
 
1598
1633
 
1599
1634
  // const configContent = Buffer.from(fs.readFileSync(configJson)).toString();
@@ -2,7 +2,7 @@
2
2
  import React from 'react';
3
3
  import { useEffect, useState } from 'react';
4
4
  import { Avatar as CosmosAvatar, withConfiguration } from '@pega/cosmos-react-core';
5
- import type { PConnFieldProps } from './PConnProps';
5
+ import type { PConnFieldProps } from '../shared/PConnProps';
6
6
 
7
7
 
8
8
  // interface for props
@@ -14,7 +14,7 @@ import {
14
14
  import { Glimpse } from '@pega/cosmos-react-work';
15
15
  import { EmailDisplay } from '@pega/cosmos-react-core';
16
16
 
17
- import type { PConnFieldProps } from './PConnProps';
17
+ import type { PConnFieldProps } from '../shared/PConnProps';
18
18
 
19
19
  import Avatar from './Avatar';
20
20
 
@@ -5,7 +5,7 @@ import { Text, FieldValueList, Button, DateTimeDisplay, useTheme } from '@pega/c
5
5
  import PegaDxilMyDetails from './index';
6
6
  import { pyReviewRaw, pyReviewResolved, regionChildrenResolved, operatorDetails, configProps } from './mock';
7
7
  import StatusWorkRenderer from './StatusWork';
8
- import Operator from '../shared/Operator';
8
+ import Operator from './Operator';
9
9
  import type C11nEnv from '@pega/pcore-pconnect-typedefs/interpreter/c11n-env';
10
10
 
11
11
  const meta: Meta<typeof PegaDxilMyDetails> = {
@@ -2,18 +2,18 @@
2
2
  import React from 'react';
3
3
  import { useEffect, useState } from 'react';
4
4
  import { Avatar as CosmosAvatar, withConfiguration } from '@pega/cosmos-react-core';
5
- import type { PConnFieldProps } from './PConnProps';
5
+ import type { PConnFieldProps } from '../shared/PConnProps';
6
6
 
7
7
 
8
8
  // interface for props
9
- interface PegaDxilMyDetailsAvatarProps extends PConnFieldProps {
9
+ interface PegaDxilMyPageCaseWidgetAvatarProps extends PConnFieldProps {
10
10
  // If any, enter additional props that only exist on TextInput here
11
11
  metaObj: any;
12
12
  showStatus: boolean;
13
13
 
14
14
  }
15
15
 
16
- function Avatar(props: PegaDxilMyDetailsAvatarProps) {
16
+ function Avatar(props: PegaDxilMyPageCaseWidgetAvatarProps) {
17
17
  const { metaObj, showStatus = false } = props;
18
18
  const [imageBlobUrl, setImageBlobUrl] = useState(null);
19
19
  let userName: string;
@@ -59,7 +59,6 @@ function Avatar(props: PegaDxilMyDetailsAvatarProps) {
59
59
  PCore.getMessagingServiceManager().getUserPresence().unsubscribe(userIdentifier, subId);
60
60
  };
61
61
  }, [userIdentifier, handleUserStateChange]);
62
-
63
62
  return <CosmosAvatar name={userName} imageSrc={imageBlobUrl as React.SetStateAction<any>} status={userState} />;
64
63
  }
65
64
 
@@ -14,13 +14,13 @@ import {
14
14
  import { Glimpse } from '@pega/cosmos-react-work';
15
15
  import { EmailDisplay } from '@pega/cosmos-react-core';
16
16
 
17
- import type { PConnFieldProps } from './PConnProps';
17
+ import type { PConnFieldProps } from '../shared/PConnProps';
18
18
 
19
19
  import Avatar from './Avatar';
20
20
 
21
21
 
22
22
  // interface for props
23
- interface PegaDxilMyDetailsOperatorProps extends PConnFieldProps {
23
+ interface PegaDxilMyPageCaseWidgetOperatorProps extends PConnFieldProps {
24
24
  // If any, enter additional props that only exist on TextInput here
25
25
  name: string;
26
26
  id: string;
@@ -31,7 +31,7 @@ interface PegaDxilMyDetailsOperatorProps extends PConnFieldProps {
31
31
 
32
32
  let pTarget = null;
33
33
 
34
- function Operator(props: PegaDxilMyDetailsOperatorProps) {
34
+ function Operator(props: PegaDxilMyPageCaseWidgetOperatorProps) {
35
35
  const { id, name, label, testId, helperText, externalUser, metaObj } = props;
36
36
  const [isOpen, setIsOpen] = useState(false);
37
37
  const [isLoading, setIsLoading] = useState(true);
@@ -6,7 +6,7 @@ import { DateTimeDisplay, Card, CardHeader, CardContent, Flex, withConfiguration
6
6
  import type { PConnFieldProps } from '../shared/PConnProps';
7
7
 
8
8
  // includes in bundle
9
- import Operator from '../shared/Operator';
9
+ import Operator from './Operator';
10
10
 
11
11
  import StyledPegaDxilMyPageCaseWidgetWrapper from './styles';
12
12
 
@@ -2,18 +2,18 @@
2
2
  import React from 'react';
3
3
  import { useEffect, useState } from 'react';
4
4
  import { Avatar as CosmosAvatar, withConfiguration } from '@pega/cosmos-react-core';
5
- import type { PConnFieldProps } from './PConnProps';
5
+ import type { PConnFieldProps } from '../shared/PConnProps';
6
6
 
7
7
 
8
8
  // interface for props
9
- interface PegaDxilMyDetailsAvatarProps extends PConnFieldProps {
9
+ interface PegaDxilMyTwoColumnDetailsAvatarProps extends PConnFieldProps {
10
10
  // If any, enter additional props that only exist on TextInput here
11
11
  metaObj: any;
12
12
  showStatus: boolean;
13
13
 
14
14
  }
15
15
 
16
- function Avatar(props: PegaDxilMyDetailsAvatarProps) {
16
+ function Avatar(props: PegaDxilMyTwoColumnDetailsAvatarProps) {
17
17
  const { metaObj, showStatus = false } = props;
18
18
  const [imageBlobUrl, setImageBlobUrl] = useState(null);
19
19
  let userName: string;
@@ -46,20 +46,20 @@ function Avatar(props: PegaDxilMyDetailsAvatarProps) {
46
46
  const currentState = PCore.getMessagingServiceManager().getUserPresence().getUserState(userIdentifier);
47
47
  const [userState, setUserState]: any = useState(currentState === 'online' ? 'active' : 'inactive');
48
48
 
49
- const handleUserStateChange = ({ state }: any) => {
49
+ const handleUserStateChange = ({ state } : any) => {
50
50
  setUserState(state === 'online' ? 'active' : 'inactive');
51
51
  };
52
52
 
53
53
  useEffect(() => {
54
54
  const subId = PCore.getMessagingServiceManager()
55
55
  .getUserPresence()
56
- .subscribe(userIdentifier, handleUserStateChange, '');
56
+ // @ts-ignore
57
+ .subscribe(userIdentifier, handleUserStateChange);
57
58
 
58
59
  return function cleanup() {
59
60
  PCore.getMessagingServiceManager().getUserPresence().unsubscribe(userIdentifier, subId);
60
61
  };
61
62
  }, [userIdentifier, handleUserStateChange]);
62
-
63
63
  return <CosmosAvatar name={userName} imageSrc={imageBlobUrl as React.SetStateAction<any>} status={userState} />;
64
64
  }
65
65
 
@@ -14,13 +14,13 @@ import {
14
14
  import { Glimpse } from '@pega/cosmos-react-work';
15
15
  import { EmailDisplay } from '@pega/cosmos-react-core';
16
16
 
17
- import type { PConnFieldProps } from './PConnProps';
17
+ import type { PConnFieldProps } from '../shared/PConnProps';
18
18
 
19
19
  import Avatar from './Avatar';
20
20
 
21
21
 
22
22
  // interface for props
23
- interface PegaDxilMyDetailsOperatorProps extends PConnFieldProps {
23
+ interface PegaDxilMyTwoColumnDetailsOperatorProps extends PConnFieldProps {
24
24
  // If any, enter additional props that only exist on TextInput here
25
25
  name: string;
26
26
  id: string;
@@ -31,7 +31,7 @@ interface PegaDxilMyDetailsOperatorProps extends PConnFieldProps {
31
31
 
32
32
  let pTarget = null;
33
33
 
34
- function Operator(props: PegaDxilMyDetailsOperatorProps) {
34
+ function Operator(props: PegaDxilMyTwoColumnDetailsOperatorProps) {
35
35
  const { id, name, label, testId, helperText, externalUser, metaObj } = props;
36
36
  const [isOpen, setIsOpen] = useState(false);
37
37
  const [isLoading, setIsLoading] = useState(true);
@@ -4,7 +4,7 @@ import { Text, FieldValueList, Button, DateTimeDisplay, useTheme } from '@pega/c
4
4
  import PegaDxilMyTwoColumnDetails from './index';
5
5
  import { pyReviewRaw, pyReviewResolved, regionChildrenResolved, operatorDetails, configProps } from './mock';
6
6
  import StatusWorkRenderer from './StatusWork';
7
- import Operator from '../shared/Operator';
7
+ import Operator from './Operator';
8
8
  import type C11nEnv from '@pega/pcore-pconnect-typedefs/interpreter/c11n-env';
9
9
 
10
10
  const meta: Meta<typeof PegaDxilMyTwoColumnDetails> = {
@@ -211,6 +211,6 @@ describe(`create publish deleteAll local: ${serverDir} - ${compType}`, () => {
211
211
  // const createFile = path.resolve(path.join(`src/components/${newFileName}`, 'index.tsx'));
212
212
  // const doesExist = fs.existsSync(createFile);
213
213
  // expect(doesExist).not.toBeTruthy();
214
- }, 10000);
214
+ }, 100000);
215
215
 
216
216
  });
@@ -176,12 +176,12 @@ describe(`createLib createAll exportStore importStore deleteLib: ${serverDir} -
176
176
  const script = `npm run exportLibVersion Full Pega_DXIL 0.0.1-dev ${defaultPath} Current --prefix ../../..`;
177
177
  const { stdout, stderr } = await exec(script);
178
178
 
179
- expect(stdout).toContain('Pega_DXIL_0.0.1-dev.zip has been exported');
180
- const zipFile = path.join(defaultPath, "Pega_DXIL_0.0.1-dev.zip");
179
+ expect(stdout).toContain('Pega_DXIL_0.0.1-dev.arch.zip has been exported');
180
+ const zipFile = path.join(defaultPath, "Pega_DXIL_0.0.1-dev.arch.zip");
181
181
  expect(fs.existsSync(zipFile)).toBeTruthy();
182
182
 
183
183
 
184
- }, 30000);
184
+ }, 90000);
185
185
 
186
186
  it(`npm run import lib (delete zip) - ${isLibraryBased}`, async() => {
187
187
 
@@ -192,13 +192,13 @@ describe(`createLib createAll exportStore importStore deleteLib: ${serverDir} -
192
192
  defaultPath = "/".concat(defaultPath);
193
193
  }
194
194
 
195
- const script = `npm run importLibVersion ${defaultPath} Pega_DXIL_0.0.1-dev.zip --prefix ../../..`;
195
+ const script = `npm run importLibVersion ${defaultPath} Pega_DXIL_0.0.1-dev.arch.zip --prefix ../../..`;
196
196
  const { stdout, stderr } = await exec(script);
197
197
 
198
- expect(stdout).toContain('Pega_DXIL_0.0.1-dev.zip has been imported!');
198
+ expect(stdout).toContain('Pega_DXIL_0.0.1-dev.arch.zip has been imported!');
199
199
  expect(stdout).toContain('You can switch to Pega_DXIL/0.0.1-dev via npm run switchLib.');
200
200
 
201
- const zipFile = path.join(defaultPath, "Pega_DXIL_0.0.1-dev.zip");
201
+ const zipFile = path.join(defaultPath, "Pega_DXIL_0.0.1-dev.arch.zip");
202
202
  expect(fs.existsSync(zipFile)).toBeTruthy();
203
203
 
204
204
  // delete zip file
@@ -217,7 +217,7 @@ describe(`createLib createAll exportStore importStore deleteLib: ${serverDir} -
217
217
  defaultPath = "/".concat(defaultPath);
218
218
  }
219
219
 
220
- const zipFile = path.join(defaultPath, "Pega_DXIL_0.0.1-dev.zip");
220
+ const zipFile = path.join(defaultPath, "Pega_DXIL_0.0.1-dev.arch.zip");
221
221
  expect(fs.existsSync(zipFile)).toBeTruthy();
222
222
 
223
223
  // delete zip file
@@ -176,8 +176,8 @@ describe(`createLib createAll exportStore deleteLib: ${serverDir} - ${compType}`
176
176
  const script = `npm run exportLibVersion Full Pega_DXIL 0.0.1-dev ${defaultPath} Current --prefix ../../..`;
177
177
  const { stdout, stderr } = await exec(script);
178
178
 
179
- expect(stdout).toContain('Pega_DXIL_0.0.1-dev.zip has been exported');
180
- const zipFile = path.join(defaultPath, "Pega_DXIL_0.0.1-dev.zip");
179
+ expect(stdout).toContain('Pega_DXIL_0.0.1-dev.arch.zip has been exported');
180
+ const zipFile = path.join(defaultPath, "Pega_DXIL_0.0.1-dev.arch.zip");
181
181
  expect(fs.existsSync(zipFile)).toBeTruthy();
182
182
 
183
183
  // delete zip file
@@ -195,7 +195,7 @@ describe(`createLib createAll exportStore deleteLib: ${serverDir} - ${compType}`
195
195
  defaultPath = "/".concat(defaultPath);
196
196
  }
197
197
 
198
- const zipFile = path.join(defaultPath, "Pega_DXIL_0.0.1-dev.zip");
198
+ const zipFile = path.join(defaultPath, "Pega_DXIL_0.0.1-dev.arch.zip");
199
199
  expect(fs.existsSync(zipFile)).toBeTruthy();
200
200
 
201
201
  // delete zip file
@@ -1,215 +0,0 @@
1
- // @ts-nocheck
2
- import { useState, useEffect, Fragment } from 'react';
3
- import {
4
- Link,
5
- Button,
6
- Popover,
7
- useOuterEvent,
8
- useElement,
9
- Progress,
10
- FormField,
11
- useTheme,
12
- withConfiguration
13
- } from '@pega/cosmos-react-core';
14
- import { Glimpse } from '@pega/cosmos-react-work';
15
- import { EmailDisplay } from '@pega/cosmos-react-core';
16
-
17
- import type { PConnFieldProps } from './PConnProps';
18
-
19
- import Avatar from './Avatar';
20
-
21
-
22
- // interface for props
23
- interface PegaDxilMyDetailsOperatorProps extends PConnFieldProps {
24
- // If any, enter additional props that only exist on TextInput here
25
- name: string;
26
- id: string;
27
- label: string;
28
- metaObj: any;
29
- externalUser: any;
30
- }
31
-
32
- let pTarget = null;
33
-
34
- function Operator(props: PegaDxilMyDetailsOperatorProps) {
35
- const { id, name, label, testId, helperText, externalUser, metaObj } = props;
36
- const [isOpen, setIsOpen] = useState(false);
37
- const [isLoading, setIsLoading] = useState(true);
38
- const [popoverEl, setPopoverEl] = useElement(null);
39
- const [popoverContent, setpopoverContent] = useState(null);
40
- const theme: any = useTheme();
41
-
42
- /* If the id has changed, we need to reset the popover */
43
- useEffect(() => {
44
- pTarget = null;
45
- }, [id]);
46
-
47
-
48
-
49
- const OperatorPreview = () => {
50
- const localizedVal = PCore.getLocaleUtils().getLocaleValue;
51
- const localeCategory = 'Operator';
52
- setpopoverContent(
53
- <Progress variant='ring' message={localizedVal('Loading operator...', localeCategory)} placement='local' />
54
- );
55
- if (externalUser && externalUser.classID !== 'Data-Party-Operator') {
56
- const fields = [
57
- {
58
- id: 'pyFirstName',
59
- name: localizedVal('Name', localeCategory),
60
- value: externalUser.name
61
- },
62
- {
63
- id: 'pyEmail1',
64
- name: localizedVal('Email', localeCategory),
65
- value:
66
- externalUser.email !== '' ? <Link href={`mailto:${externalUser.email}`}>{externalUser.email}</Link> : ''
67
- },
68
- {
69
- id: 'pyPhoneNumber',
70
- name: localizedVal('Phone', localeCategory),
71
- value: externalUser.phone !== '' ? <Link href={`tel:${externalUser.phone}`}>{externalUser.phone}</Link> : ''
72
- }
73
- ];
74
- setIsLoading(false);
75
- setpopoverContent(
76
- <Glimpse
77
- visual={
78
- <Avatar
79
- metaObj={{
80
- name: externalUser.name
81
- }}
82
- />
83
- }
84
- primary={externalUser.name}
85
- secondary={[externalUser.position]}
86
- fields={fields}
87
- target={pTarget}
88
- />
89
- );
90
- } else {
91
- return PCore.getUserApi()
92
- .getOperatorDetails(id, true)
93
- .then(res => {
94
- if (res.data?.pyOperatorInfo) {
95
- const fields = [];
96
- const data = res.data;
97
- if (data.pyOperatorInfo && data.pyOperatorInfo.pyUserName) {
98
- fields.push({
99
- id: 'Name',
100
- name: localizedVal('Name', localeCategory),
101
- value: data.pyOperatorInfo.pyUserName
102
- });
103
- }
104
- if (data.pyOperatorInfo && data.pyOperatorInfo.pyEmailAddress) {
105
- fields.push({
106
- id: 'Email',
107
- name: localizedVal('Email address', localeCategory),
108
- value: <EmailDisplay value={data.pyOperatorInfo.pyEmailAddress} />
109
- });
110
- }
111
- const opAvatar = (
112
- <Avatar
113
- metaObj={{
114
- image: '',
115
- name: data.pyOperatorInfo.pyUserName
116
- }}
117
- />
118
- );
119
-
120
- setIsLoading(false);
121
- setpopoverContent(
122
- <Glimpse
123
- heading={{
124
- primary: data.pyOperatorInfo.pyUserName,
125
- secondary: data.pyOperatorInfo.pyEmailAddress,
126
- visual: opAvatar
127
- }}
128
- fields={fields}
129
- target={pTarget}
130
- onDismiss={() => {pTarget = null;}}
131
- />
132
- );
133
- }
134
- });
135
- }
136
- };
137
-
138
-
139
- const clickAction = (e: any) => {
140
-
141
- setIsOpen(!isOpen);
142
- if (pTarget === null) {
143
- pTarget = e.currentTarget;
144
- OperatorPreview();
145
- }
146
- };
147
-
148
- const hidePopover = () => {
149
- if (isOpen) {
150
- setIsOpen(false);
151
- }
152
- };
153
-
154
- useOuterEvent('mousedown', [popoverEl], hidePopover); // Call the method on clicking outside these elements
155
-
156
- const hideOnEscape = (e: any) => {
157
- if (e.key === 'Escape') hidePopover(); // Call the method when Escape key is pressed
158
- };
159
-
160
- const comp = (
161
- <Fragment>
162
- {metaObj ? (
163
- <Button
164
- variant='text'
165
- aria-haspopup
166
- aria-expanded={isOpen}
167
- onClick={clickAction}
168
- onKeyDown={hideOnEscape}
169
- data-test-id={testId}
170
- style={label !== null ? { width: 'max-content', height: theme.components.input.height } : undefined}
171
- >
172
- <Avatar {...props} />
173
- </Button>
174
- ) : (
175
- <Button
176
- variant='link'
177
- aria-haspopup
178
- aria-expanded={isOpen}
179
- onClick={clickAction}
180
- onKeyDown={hideOnEscape}
181
- data-test-id={testId}
182
- style={label !== null ? { width: 'max-content', height: theme.components.input.height } : undefined}
183
- >
184
- {name}
185
- </Button>
186
- )}
187
-
188
- {isOpen && (
189
- <Popover
190
- ref={setPopoverEl}
191
- groupId='operator'
192
- target={pTarget}
193
- placement='bottom-start'
194
- style={isLoading ? { position: 'relative', width: '10rem', minHeight: '4rem' } : undefined}
195
- strategy='fixed'
196
- >
197
- {popoverContent}
198
- </Popover>
199
- )}
200
- </Fragment>
201
- );
202
-
203
- if (label !== null) {
204
- return (
205
- <FormField label={label} info={helperText}>
206
- {comp}
207
- </FormField>
208
- );
209
- }
210
-
211
- return comp;
212
- };
213
-
214
-
215
- export default withConfiguration(Operator);
@@ -1,46 +0,0 @@
1
- import {PConnect } from '@pega/pcore-pconnect-typedefs';
2
-
3
- // PConnProps.d.ts
4
- // This gives us a place to have each component (which is most DX Components) that is
5
- // expected to have a getPConnect extend its props (from BaseProps)
6
- // such that every component will be expected to have a getPConnect() function
7
- // that returns a PConnect object. (new/better way of doing .propTypes).
8
- // This PConnProps can be extended to include other props that we know are in every component
9
- export interface PConnProps {
10
- // getPConnect should exist for every C11n component. (add @ts-ignore in special cases where it isn't)
11
- getPConnect: () => typeof PConnect;
12
-
13
- // Allow any/all other key/value pairs in the BaseProps for now
14
- // TODO: refine which other props are always expected for various component
15
- // types and consider further interface "subclassing". For example, we may
16
- // want to create a "BasePropsForm" that gives guidance on required, readonly, etc.
17
- // and any other props that every Form component expects.
18
- // For example, see the PConnFieldProps below.
19
- // NOTE: if you uncomment the line below, the PConnProps type will allow
20
- // otherwise undefined types to appear. This can be helpful for debugging
21
- // or when adding new components whose types aren't yet known.
22
- // [key: string]: any;
23
- }
24
-
25
-
26
- // PConnFieldProps extends PConnProps to bring in the common properties that are
27
- // associated with most field components (ex: Dropdown, TextInput, etc.) in the
28
- // components/field directory
29
- export interface PConnFieldProps extends PConnProps {
30
- label: string,
31
- required: boolean,
32
- disabled: boolean,
33
- value: any,
34
- validatemessage: string,
35
- status?: string,
36
- onChange?: any,
37
- onBlur?: any,
38
- readOnly: boolean,
39
- testId: string,
40
- helperText: string,
41
- displayMode?: string,
42
- hideLabel: boolean,
43
- placeholder?: string,
44
- fieldMetadata?: any,
45
- additionalProps?: any
46
- }
@@ -1,6 +0,0 @@
1
- /* eslint-disable camelcase */
2
- // @ts-ignore
3
- if (window?.__webpack_nonce__) {
4
- // @ts-ignore
5
- __webpack_nonce__ = window.__webpack_nonce__;
6
- }
@@ -1,9 +0,0 @@
1
- export const suggestionsHandler = (accepted: boolean, pConn: any, setStatus: any) => {
2
- if (accepted) {
3
- pConn.acceptSuggestion();
4
- setStatus('success');
5
- } else {
6
- pConn.ignoreSuggestion();
7
- setStatus(undefined);
8
- }
9
- };
@@ -1,76 +0,0 @@
1
- /* eslint-disable react-hooks/rules-of-hooks */
2
- import React from 'react';
3
- import { useEffect, useState } from 'react';
4
- import { Avatar as CosmosAvatar, withConfiguration } from '@pega/cosmos-react-core';
5
- import type { PConnFieldProps } from './PConnProps';
6
-
7
-
8
- // interface for props
9
- interface PegaDxilMyDetailsAvatarProps extends PConnFieldProps {
10
- // If any, enter additional props that only exist on TextInput here
11
- metaObj: any;
12
- showStatus: boolean;
13
-
14
- }
15
-
16
- function Avatar(props: PegaDxilMyDetailsAvatarProps) {
17
- const { metaObj, showStatus = false } = props;
18
- const [imageBlobUrl, setImageBlobUrl] = useState(null);
19
- let userName: string;
20
- let userIdentifier: string;
21
-
22
- // TODO Below if conditions can be removed once we have apis to get worklist/mywork info
23
- // This is non CaseView case (Dashboard, MyWork etc)
24
- if (!metaObj) {
25
- userName = PCore.getEnvironmentInfo().getOperatorName() ?? "";
26
- userIdentifier = PCore.getEnvironmentInfo().getOperatorIdentifier() ?? "";
27
- } else {
28
- userName = metaObj.name;
29
- userIdentifier = metaObj.ID;
30
- }
31
- if (!userName && userIdentifier) {
32
- userName = userIdentifier;
33
- }
34
-
35
- useEffect(() => {
36
- const imageKey = !metaObj ? PCore.getEnvironmentInfo().getOperatorImageInsKey() : metaObj.image;
37
- if (imageKey) {
38
- PCore.getAssetLoader()
39
- .getSvcImage(imageKey)
40
- .then((blob) => window.URL.createObjectURL(blob))
41
- .then((imagePath) => setImageBlobUrl(imagePath as React.SetStateAction<any>));
42
- }
43
- }, [metaObj]);
44
-
45
- if (showStatus) {
46
- const currentState = PCore.getMessagingServiceManager().getUserPresence().getUserState(userIdentifier);
47
- const [userState, setUserState]: any = useState(currentState === 'online' ? 'active' : 'inactive');
48
-
49
- const handleUserStateChange = ({ state }: any) => {
50
- setUserState(state === 'online' ? 'active' : 'inactive');
51
- };
52
-
53
- useEffect(() => {
54
- const subId = PCore.getMessagingServiceManager()
55
- .getUserPresence()
56
- .subscribe(userIdentifier, handleUserStateChange, '');
57
-
58
- return function cleanup() {
59
- PCore.getMessagingServiceManager().getUserPresence().unsubscribe(userIdentifier, subId);
60
- };
61
- }, [userIdentifier, handleUserStateChange]);
62
-
63
- return <CosmosAvatar name={userName} imageSrc={imageBlobUrl as React.SetStateAction<any>} status={userState} />;
64
- }
65
-
66
- // Do not render when userName does not exists
67
- // TODO : In CNR case, pxRequestor is not available, please remove this condition once it populates
68
- if (!userName) {
69
- return null;
70
- }
71
-
72
- return <CosmosAvatar name={userName} imageSrc={imageBlobUrl as React.SetStateAction<any>} />;
73
- }
74
-
75
-
76
- export default withConfiguration(Avatar);
@@ -1,46 +0,0 @@
1
- import {PConnect } from '@pega/pcore-pconnect-typedefs';
2
-
3
- // PConnProps.d.ts
4
- // This gives us a place to have each component (which is most DX Components) that is
5
- // expected to have a getPConnect extend its props (from BaseProps)
6
- // such that every component will be expected to have a getPConnect() function
7
- // that returns a PConnect object. (new/better way of doing .propTypes).
8
- // This PConnProps can be extended to include other props that we know are in every component
9
- export interface PConnProps {
10
- // getPConnect should exist for every C11n component. (add @ts-ignore in special cases where it isn't)
11
- getPConnect: () => typeof PConnect;
12
-
13
- // Allow any/all other key/value pairs in the BaseProps for now
14
- // TODO: refine which other props are always expected for various component
15
- // types and consider further interface "subclassing". For example, we may
16
- // want to create a "BasePropsForm" that gives guidance on required, readonly, etc.
17
- // and any other props that every Form component expects.
18
- // For example, see the PConnFieldProps below.
19
- // NOTE: if you uncomment the line below, the PConnProps type will allow
20
- // otherwise undefined types to appear. This can be helpful for debugging
21
- // or when adding new components whose types aren't yet known.
22
- // [key: string]: any;
23
- }
24
-
25
-
26
- // PConnFieldProps extends PConnProps to bring in the common properties that are
27
- // associated with most field components (ex: Dropdown, TextInput, etc.) in the
28
- // components/field directory
29
- export interface PConnFieldProps extends PConnProps {
30
- label: string,
31
- required: boolean,
32
- disabled: boolean,
33
- value: any,
34
- validatemessage: string,
35
- status?: string,
36
- onChange?: any,
37
- onBlur?: any,
38
- readOnly: boolean,
39
- testId: string,
40
- helperText: string,
41
- displayMode?: string,
42
- hideLabel: boolean,
43
- placeholder?: string,
44
- fieldMetadata?: any,
45
- additionalProps?: any
46
- }
@@ -1,6 +0,0 @@
1
- /* eslint-disable camelcase */
2
- // @ts-ignore
3
- if (window?.__webpack_nonce__) {
4
- // @ts-ignore
5
- __webpack_nonce__ = window.__webpack_nonce__;
6
- }
@@ -1,9 +0,0 @@
1
- export const suggestionsHandler = (accepted: boolean, pConn: any, setStatus: any) => {
2
- if (accepted) {
3
- pConn.acceptSuggestion();
4
- setStatus('success');
5
- } else {
6
- pConn.ignoreSuggestion();
7
- setStatus(undefined);
8
- }
9
- };
@@ -1,76 +0,0 @@
1
- /* eslint-disable react-hooks/rules-of-hooks */
2
- import React from 'react';
3
- import { useEffect, useState } from 'react';
4
- import { Avatar as CosmosAvatar, withConfiguration } from '@pega/cosmos-react-core';
5
- import type { PConnFieldProps } from './PConnProps';
6
-
7
-
8
- // interface for props
9
- interface PegaDxilMyDetailsAvatarProps extends PConnFieldProps {
10
- // If any, enter additional props that only exist on TextInput here
11
- metaObj: any;
12
- showStatus: boolean;
13
-
14
- }
15
-
16
- function Avatar(props: PegaDxilMyDetailsAvatarProps) {
17
- const { metaObj, showStatus = false } = props;
18
- const [imageBlobUrl, setImageBlobUrl] = useState(null);
19
- let userName: string;
20
- let userIdentifier: string;
21
-
22
- // TODO Below if conditions can be removed once we have apis to get worklist/mywork info
23
- // This is non CaseView case (Dashboard, MyWork etc)
24
- if (!metaObj) {
25
- userName = PCore.getEnvironmentInfo().getOperatorName() ?? "";
26
- userIdentifier = PCore.getEnvironmentInfo().getOperatorIdentifier() ?? "";
27
- } else {
28
- userName = metaObj.name;
29
- userIdentifier = metaObj.ID;
30
- }
31
- if (!userName && userIdentifier) {
32
- userName = userIdentifier;
33
- }
34
-
35
- useEffect(() => {
36
- const imageKey = !metaObj ? PCore.getEnvironmentInfo().getOperatorImageInsKey() : metaObj.image;
37
- if (imageKey) {
38
- PCore.getAssetLoader()
39
- .getSvcImage(imageKey)
40
- .then((blob) => window.URL.createObjectURL(blob))
41
- .then((imagePath) => setImageBlobUrl(imagePath as React.SetStateAction<any>));
42
- }
43
- }, [metaObj]);
44
-
45
- if (showStatus) {
46
- const currentState = PCore.getMessagingServiceManager().getUserPresence().getUserState(userIdentifier);
47
- const [userState, setUserState]: any = useState(currentState === 'online' ? 'active' : 'inactive');
48
-
49
- const handleUserStateChange = ({ state }: any) => {
50
- setUserState(state === 'online' ? 'active' : 'inactive');
51
- };
52
-
53
- useEffect(() => {
54
- const subId = PCore.getMessagingServiceManager()
55
- .getUserPresence()
56
- .subscribe(userIdentifier, handleUserStateChange, '');
57
-
58
- return function cleanup() {
59
- PCore.getMessagingServiceManager().getUserPresence().unsubscribe(userIdentifier, subId);
60
- };
61
- }, [userIdentifier, handleUserStateChange]);
62
-
63
- return <CosmosAvatar name={userName} imageSrc={imageBlobUrl as React.SetStateAction<any>} status={userState} />;
64
- }
65
-
66
- // Do not render when userName does not exists
67
- // TODO : In CNR case, pxRequestor is not available, please remove this condition once it populates
68
- if (!userName) {
69
- return null;
70
- }
71
-
72
- return <CosmosAvatar name={userName} imageSrc={imageBlobUrl as React.SetStateAction<any>} />;
73
- }
74
-
75
-
76
- export default withConfiguration(Avatar);
@@ -1,215 +0,0 @@
1
- // @ts-nocheck
2
- import { useState, useEffect, Fragment } from 'react';
3
- import {
4
- Link,
5
- Button,
6
- Popover,
7
- useOuterEvent,
8
- useElement,
9
- Progress,
10
- FormField,
11
- useTheme,
12
- withConfiguration
13
- } from '@pega/cosmos-react-core';
14
- import { Glimpse } from '@pega/cosmos-react-work';
15
- import { EmailDisplay } from '@pega/cosmos-react-core';
16
-
17
- import type { PConnFieldProps } from './PConnProps';
18
-
19
- import Avatar from './Avatar';
20
-
21
-
22
- // interface for props
23
- interface PegaDxilMyDetailsOperatorProps extends PConnFieldProps {
24
- // If any, enter additional props that only exist on TextInput here
25
- name: string;
26
- id: string;
27
- label: string;
28
- metaObj: any;
29
- externalUser: any;
30
- }
31
-
32
- let pTarget = null;
33
-
34
- function Operator(props: PegaDxilMyDetailsOperatorProps) {
35
- const { id, name, label, testId, helperText, externalUser, metaObj } = props;
36
- const [isOpen, setIsOpen] = useState(false);
37
- const [isLoading, setIsLoading] = useState(true);
38
- const [popoverEl, setPopoverEl] = useElement(null);
39
- const [popoverContent, setpopoverContent] = useState(null);
40
- const theme: any = useTheme();
41
-
42
- /* If the id has changed, we need to reset the popover */
43
- useEffect(() => {
44
- pTarget = null;
45
- }, [id]);
46
-
47
-
48
-
49
- const OperatorPreview = () => {
50
- const localizedVal = PCore.getLocaleUtils().getLocaleValue;
51
- const localeCategory = 'Operator';
52
- setpopoverContent(
53
- <Progress variant='ring' message={localizedVal('Loading operator...', localeCategory)} placement='local' />
54
- );
55
- if (externalUser && externalUser.classID !== 'Data-Party-Operator') {
56
- const fields = [
57
- {
58
- id: 'pyFirstName',
59
- name: localizedVal('Name', localeCategory),
60
- value: externalUser.name
61
- },
62
- {
63
- id: 'pyEmail1',
64
- name: localizedVal('Email', localeCategory),
65
- value:
66
- externalUser.email !== '' ? <Link href={`mailto:${externalUser.email}`}>{externalUser.email}</Link> : ''
67
- },
68
- {
69
- id: 'pyPhoneNumber',
70
- name: localizedVal('Phone', localeCategory),
71
- value: externalUser.phone !== '' ? <Link href={`tel:${externalUser.phone}`}>{externalUser.phone}</Link> : ''
72
- }
73
- ];
74
- setIsLoading(false);
75
- setpopoverContent(
76
- <Glimpse
77
- visual={
78
- <Avatar
79
- metaObj={{
80
- name: externalUser.name
81
- }}
82
- />
83
- }
84
- primary={externalUser.name}
85
- secondary={[externalUser.position]}
86
- fields={fields}
87
- target={pTarget}
88
- />
89
- );
90
- } else {
91
- return PCore.getUserApi()
92
- .getOperatorDetails(id, true)
93
- .then(res => {
94
- if (res.data?.pyOperatorInfo) {
95
- const fields = [];
96
- const data = res.data;
97
- if (data.pyOperatorInfo && data.pyOperatorInfo.pyUserName) {
98
- fields.push({
99
- id: 'Name',
100
- name: localizedVal('Name', localeCategory),
101
- value: data.pyOperatorInfo.pyUserName
102
- });
103
- }
104
- if (data.pyOperatorInfo && data.pyOperatorInfo.pyEmailAddress) {
105
- fields.push({
106
- id: 'Email',
107
- name: localizedVal('Email address', localeCategory),
108
- value: <EmailDisplay value={data.pyOperatorInfo.pyEmailAddress} />
109
- });
110
- }
111
- const opAvatar = (
112
- <Avatar
113
- metaObj={{
114
- image: '',
115
- name: data.pyOperatorInfo.pyUserName
116
- }}
117
- />
118
- );
119
-
120
- setIsLoading(false);
121
- setpopoverContent(
122
- <Glimpse
123
- heading={{
124
- primary: data.pyOperatorInfo.pyUserName,
125
- secondary: data.pyOperatorInfo.pyEmailAddress,
126
- visual: opAvatar
127
- }}
128
- fields={fields}
129
- target={pTarget}
130
- onDismiss={() => {pTarget = null;}}
131
- />
132
- );
133
- }
134
- });
135
- }
136
- };
137
-
138
-
139
- const clickAction = (e: any) => {
140
-
141
- setIsOpen(!isOpen);
142
- if (pTarget === null) {
143
- pTarget = e.currentTarget;
144
- OperatorPreview();
145
- }
146
- };
147
-
148
- const hidePopover = () => {
149
- if (isOpen) {
150
- setIsOpen(false);
151
- }
152
- };
153
-
154
- useOuterEvent('mousedown', [popoverEl], hidePopover); // Call the method on clicking outside these elements
155
-
156
- const hideOnEscape = (e: any) => {
157
- if (e.key === 'Escape') hidePopover(); // Call the method when Escape key is pressed
158
- };
159
-
160
- const comp = (
161
- <Fragment>
162
- {metaObj ? (
163
- <Button
164
- variant='text'
165
- aria-haspopup
166
- aria-expanded={isOpen}
167
- onClick={clickAction}
168
- onKeyDown={hideOnEscape}
169
- data-test-id={testId}
170
- style={label !== null ? { width: 'max-content', height: theme.components.input.height } : undefined}
171
- >
172
- <Avatar {...props} />
173
- </Button>
174
- ) : (
175
- <Button
176
- variant='link'
177
- aria-haspopup
178
- aria-expanded={isOpen}
179
- onClick={clickAction}
180
- onKeyDown={hideOnEscape}
181
- data-test-id={testId}
182
- style={label !== null ? { width: 'max-content', height: theme.components.input.height } : undefined}
183
- >
184
- {name}
185
- </Button>
186
- )}
187
-
188
- {isOpen && (
189
- <Popover
190
- ref={setPopoverEl}
191
- groupId='operator'
192
- target={pTarget}
193
- placement='bottom-start'
194
- style={isLoading ? { position: 'relative', width: '10rem', minHeight: '4rem' } : undefined}
195
- strategy='fixed'
196
- >
197
- {popoverContent}
198
- </Popover>
199
- )}
200
- </Fragment>
201
- );
202
-
203
- if (label !== null) {
204
- return (
205
- <FormField label={label} info={helperText}>
206
- {comp}
207
- </FormField>
208
- );
209
- }
210
-
211
- return comp;
212
- };
213
-
214
-
215
- export default withConfiguration(Operator);
@@ -1,46 +0,0 @@
1
- import {PConnect } from '@pega/pcore-pconnect-typedefs';
2
-
3
- // PConnProps.d.ts
4
- // This gives us a place to have each component (which is most DX Components) that is
5
- // expected to have a getPConnect extend its props (from BaseProps)
6
- // such that every component will be expected to have a getPConnect() function
7
- // that returns a PConnect object. (new/better way of doing .propTypes).
8
- // This PConnProps can be extended to include other props that we know are in every component
9
- export interface PConnProps {
10
- // getPConnect should exist for every C11n component. (add @ts-ignore in special cases where it isn't)
11
- getPConnect: () => typeof PConnect;
12
-
13
- // Allow any/all other key/value pairs in the BaseProps for now
14
- // TODO: refine which other props are always expected for various component
15
- // types and consider further interface "subclassing". For example, we may
16
- // want to create a "BasePropsForm" that gives guidance on required, readonly, etc.
17
- // and any other props that every Form component expects.
18
- // For example, see the PConnFieldProps below.
19
- // NOTE: if you uncomment the line below, the PConnProps type will allow
20
- // otherwise undefined types to appear. This can be helpful for debugging
21
- // or when adding new components whose types aren't yet known.
22
- // [key: string]: any;
23
- }
24
-
25
-
26
- // PConnFieldProps extends PConnProps to bring in the common properties that are
27
- // associated with most field components (ex: Dropdown, TextInput, etc.) in the
28
- // components/field directory
29
- export interface PConnFieldProps extends PConnProps {
30
- label: string,
31
- required: boolean,
32
- disabled: boolean,
33
- value: any,
34
- validatemessage: string,
35
- status?: string,
36
- onChange?: any,
37
- onBlur?: any,
38
- readOnly: boolean,
39
- testId: string,
40
- helperText: string,
41
- displayMode?: string,
42
- hideLabel: boolean,
43
- placeholder?: string,
44
- fieldMetadata?: any,
45
- additionalProps?: any
46
- }
@@ -1,6 +0,0 @@
1
- /* eslint-disable camelcase */
2
- // @ts-ignore
3
- if (window?.__webpack_nonce__) {
4
- // @ts-ignore
5
- __webpack_nonce__ = window.__webpack_nonce__;
6
- }
@@ -1,9 +0,0 @@
1
- export const suggestionsHandler = (accepted: boolean, pConn: any, setStatus: any) => {
2
- if (accepted) {
3
- pConn.acceptSuggestion();
4
- setStatus('success');
5
- } else {
6
- pConn.ignoreSuggestion();
7
- setStatus(undefined);
8
- }
9
- };