@pega/custom-dx-components 0.25.10 → 0.25.12
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/package.json +1 -1
- package/src/constants.js +4 -3
- package/src/tasks/build-lib/index.js +7 -7
- package/src/tasks/delete/helper.js +6 -1
- package/src/tasks/delete-lib/index.js +2 -2
- package/src/tasks/export-archive/index.js +1 -1
- package/src/tasks/import-archive/index.js +2 -2
- package/src/tasks/init/template/package.json.mustache +1 -1
- package/src/tasks/list/helper.js +5 -1
- package/src/tasks/move/index.js +1 -1
- package/src/tasks/publish/helper.js +3 -1
- package/src/tasks/publish/index.js +34 -3
- package/src/tasks/publish-all/index.js +3 -1
- package/src/tasks/publish-lib/index.js +224 -5
- package/src/tasks/switch-lib/index.js +1 -1
- package/src/tasks/switch-version/index.js +1 -1
- package/src/util.js +72 -6
- package/tests/assets/library/components/{create/shared → createAll/Constellation/Pega_DXIL_MyDetails}/Avatar.tsx +1 -1
- package/tests/assets/{original/components/create/shared → library/components/createAll/Constellation/Pega_DXIL_MyDetails}/Operator.tsx +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx +1 -1
- package/tests/assets/{original/components/create/shared → library/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget}/Avatar.tsx +3 -4
- package/tests/assets/library/components/{create/shared → createAll/Constellation/Pega_DXIL_MyPageCaseWidget}/Operator.tsx +3 -3
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/index.tsx +1 -1
- package/tests/assets/library/components/createAll/Constellation/{shared → Pega_DXIL_MyTwoColumnDetails}/Avatar.tsx +6 -6
- package/tests/assets/{original/components/createAll/Constellation/shared → library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails}/Operator.tsx +3 -3
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +1 -1
- package/tests/functional/localCreatePublishAllDeleteAll.test.js +1 -1
- package/tests/functional/localLibCreateLibExportImportLib.test.js +7 -7
- package/tests/functional/localLibCreateLibExportLib.test.js +3 -3
- package/tests/assets/library/components/createAll/Constellation/shared/Operator.tsx +0 -215
- package/tests/assets/original/components/create/shared/PConnProps.d.ts +0 -46
- package/tests/assets/original/components/create/shared/create-nonce.ts +0 -6
- package/tests/assets/original/components/create/shared/suggestions-handler.ts +0 -9
- package/tests/assets/original/components/createAll/Constellation/shared/Avatar.tsx +0 -76
- package/tests/assets/original/components/createAll/Constellation/shared/PConnProps.d.ts +0 -46
- package/tests/assets/original/components/createAll/Constellation/shared/create-nonce.ts +0 -6
- package/tests/assets/original/components/createAll/Constellation/shared/suggestions-handler.ts +0 -9
- package/tests/assets/original/components/createAll/Launchpad/shared/Avatar.tsx +0 -76
- package/tests/assets/original/components/createAll/Launchpad/shared/Operator.tsx +0 -215
- package/tests/assets/original/components/createAll/Launchpad/shared/PConnProps.d.ts +0 -46
- package/tests/assets/original/components/createAll/Launchpad/shared/create-nonce.ts +0 -6
- package/tests/assets/original/components/createAll/Launchpad/shared/suggestions-handler.ts +0 -9
package/src/util.js
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
USE_PROMOTED_WEB_PACK,
|
|
30
30
|
BOOTSTRAP_CONFIG,
|
|
31
31
|
LIBRARY_BASED,
|
|
32
|
+
LIBRARY_BASED_CL,
|
|
32
33
|
SHARED_DIRECTORY,
|
|
33
34
|
SHOW_DEBUG,
|
|
34
35
|
COMPONENTS_PATH,
|
|
@@ -53,6 +54,7 @@ let addAboutData = true;
|
|
|
53
54
|
let defaultConfigs = {
|
|
54
55
|
serverType: "",
|
|
55
56
|
isLibraryBased: false,
|
|
57
|
+
isLibraryBasedCL: false,
|
|
56
58
|
devBuild: true,
|
|
57
59
|
library: "",
|
|
58
60
|
organization: "",
|
|
@@ -108,6 +110,7 @@ export const setUpDefaults = async () => {
|
|
|
108
110
|
let retrievedConfigData = {
|
|
109
111
|
serverType: "",
|
|
110
112
|
isLibraryBased: false,
|
|
113
|
+
isLibraryBasedCL: false,
|
|
111
114
|
devBuild: true,
|
|
112
115
|
library: "",
|
|
113
116
|
organization: "",
|
|
@@ -146,6 +149,10 @@ export const setUpDefaults = async () => {
|
|
|
146
149
|
retrievedConfigData.library = data.component.library;
|
|
147
150
|
retrievedConfigData.version = data.component.version;
|
|
148
151
|
|
|
152
|
+
if (data[LIBRARY_BASED_CL]) {
|
|
153
|
+
retrievedConfigData.isLibraryBasedCL = data[LIBRARY_BASED_CL];
|
|
154
|
+
}
|
|
155
|
+
|
|
149
156
|
|
|
150
157
|
const { organization } = JSON.parse(fs.readFileSync(path.resolve('package.json'), 'utf8'));
|
|
151
158
|
retrievedConfigData.organization = organization;
|
|
@@ -262,7 +269,7 @@ if (showDebug) addDebugLog("updateUseWebPackPromotion", "", "");
|
|
|
262
269
|
}
|
|
263
270
|
|
|
264
271
|
export const getAboutData = async (currentOrgLib, buildVersion, dateStamp) => {
|
|
265
|
-
if (showDebug) addDebugLog("getAboutData", `currentOrgLib: ${currentOrgLib}, buildVersion: ${buildVersion}, dateStamp: ${dateStamp}
|
|
272
|
+
if (showDebug) addDebugLog("getAboutData", `currentOrgLib: ${currentOrgLib}, buildVersion: ${buildVersion}, dateStamp: ${dateStamp}`,"");
|
|
266
273
|
const tokenAndStaticServer = await getC11NB2STokenAndStaticServer();
|
|
267
274
|
|
|
268
275
|
if (tokenAndStaticServer.C11NB2S === undefined) {
|
|
@@ -277,6 +284,40 @@ if (showDebug) addDebugLog("getAboutData", `currentOrgLib: ${currentOrgLib}, bui
|
|
|
277
284
|
return `${currentOrgLib} ${buildVersion}, ${dateStamp}, ${infinityVersion}`;
|
|
278
285
|
}
|
|
279
286
|
|
|
287
|
+
export const applyPegaData = async (configJson) => {
|
|
288
|
+
if (showDebug) addDebugLog("applyPegaData", "", "");
|
|
289
|
+
const tokenAndStaticServer = await getC11NB2STokenAndStaticServer();
|
|
290
|
+
const currentDirectory = process.cwd()
|
|
291
|
+
const currentPackagePath = join(currentDirectory, PACKAGE_JSON_FILENAME);
|
|
292
|
+
let currentPackageData;
|
|
293
|
+
|
|
294
|
+
try {
|
|
295
|
+
currentPackageData = fs.readFileSync(currentPackagePath);
|
|
296
|
+
}
|
|
297
|
+
catch (ex) {
|
|
298
|
+
console.log($chalk.red(`\nUnable to retrieve current package.json.`))
|
|
299
|
+
process.exit(1);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
const cData = JSON.parse(currentPackageData);
|
|
303
|
+
const cosmosVersion = cData.dependencies["@pega/cosmos-react-core"];
|
|
304
|
+
let infinityVersion = "";
|
|
305
|
+
|
|
306
|
+
if (tokenAndStaticServer.C11NB2S === undefined) {
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
const jwt = jwtDecode(tokenAndStaticServer.C11NB2S);
|
|
310
|
+
infinityVersion= jwt.infinity_version;
|
|
311
|
+
// don't remove "8." from infinity version so can do a comparison
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// apply info to config.json
|
|
315
|
+
configJson.infinityVersion = infinityVersion;
|
|
316
|
+
configJson.packageCosmosVersion = cosmosVersion;
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
}
|
|
320
|
+
|
|
280
321
|
export const checkJWTExpiration = async () => {
|
|
281
322
|
const tokenAndStaticServer = await getC11NB2STokenAndStaticServer();
|
|
282
323
|
|
|
@@ -301,6 +342,25 @@ export const checkJWTExpiration = async () => {
|
|
|
301
342
|
|
|
302
343
|
}
|
|
303
344
|
|
|
345
|
+
export const checkAccessTokenExpiration = async() => {
|
|
346
|
+
|
|
347
|
+
const tokenAndStaticServer = await getC11NB2STokenAndStaticServer();
|
|
348
|
+
|
|
349
|
+
if (tokenAndStaticServer.access_token === undefined) {
|
|
350
|
+
console.log(chalk.redBright("Need to authenticate, missing token.\n"));
|
|
351
|
+
process.exit(1);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
const jwt = jwtDecode(tokenAndStaticServer.access_token);
|
|
355
|
+
const { exp, customer_org } = jwt;
|
|
356
|
+
if (exp < (new Date().getTime() + 1) / 1000) {
|
|
357
|
+
console.log(chalk.redBright("Authentication token has expired, please reauthenticate."));
|
|
358
|
+
process.exit(1);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
}
|
|
363
|
+
|
|
304
364
|
export const getLibraryBased = () => {
|
|
305
365
|
if (showDebug) addDebugLog("getLibraryBased", "", "");
|
|
306
366
|
// const currentDirectory = process.cwd();
|
|
@@ -332,6 +392,11 @@ if (showDebug) addDebugLog("getLibraryBased", "", "");
|
|
|
332
392
|
return defaultConfigs.isLibraryBased;
|
|
333
393
|
}
|
|
334
394
|
|
|
395
|
+
export const getLibraryBasedCL = () => {
|
|
396
|
+
if (showDebug) addDebugLog("getLibraryBasedCL", "", "");
|
|
397
|
+
return defaultConfigs.isLibraryBasedCL;
|
|
398
|
+
}
|
|
399
|
+
|
|
335
400
|
export const setLibraryBased = async (isLibraryBased) => {
|
|
336
401
|
if (showDebug) addDebugLog("setLibraryBased", "", "");
|
|
337
402
|
const currentDirectory = process.cwd();
|
|
@@ -952,7 +1017,8 @@ if (showDebug) addDebugLog("updateConfigVersion", `componentKey: ${componentKey}
|
|
|
952
1017
|
data.version = buildVersion;
|
|
953
1018
|
|
|
954
1019
|
if (addAboutData) {
|
|
955
|
-
data.buildDate =
|
|
1020
|
+
data.buildDate = currentDate;
|
|
1021
|
+
await applyPegaData(data);
|
|
956
1022
|
}
|
|
957
1023
|
|
|
958
1024
|
|
|
@@ -1384,10 +1450,10 @@ if (showDebug) addDebugLog("getC11NB2STokenAndStaticServer", "", "");
|
|
|
1384
1450
|
}
|
|
1385
1451
|
|
|
1386
1452
|
if (OAuthData) {
|
|
1387
|
-
const { C11NB2S, appStaticContentServer } = JSON.parse(OAuthData)
|
|
1453
|
+
const { C11NB2S, appStaticContentServer, access_token } = JSON.parse(OAuthData)
|
|
1388
1454
|
|
|
1389
1455
|
if (C11NB2S) {
|
|
1390
|
-
return ({ C11NB2S, appStaticContentServer});
|
|
1456
|
+
return ({ C11NB2S, appStaticContentServer, access_token});
|
|
1391
1457
|
}
|
|
1392
1458
|
|
|
1393
1459
|
}
|
|
@@ -1509,7 +1575,7 @@ if (showDebug) addDebugLog("deletePublishExtras", `libraryName: ${libraryName},
|
|
|
1509
1575
|
// check if .DS_store file exists in Library, if so delete it because causes issue with services
|
|
1510
1576
|
|
|
1511
1577
|
const currentDirectory = process.cwd();
|
|
1512
|
-
const zipFile = libraryName.concat(".zip");
|
|
1578
|
+
const zipFile = libraryName.concat(".arch.zip");
|
|
1513
1579
|
|
|
1514
1580
|
// delete zip file
|
|
1515
1581
|
const zipPath = join(currentDirectory, zipFile);
|
|
@@ -1593,7 +1659,7 @@ if (showDebug) addDebugLog("zipVersionAndArchive", `orgLibName: ${orgLibName}, v
|
|
|
1593
1659
|
const srcDirectoryPath = join(currentDirectory, "src");
|
|
1594
1660
|
const tasksConfig = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
|
|
1595
1661
|
const packageJson = join(currentDirectory, PACKAGE_JSON_FILENAME);
|
|
1596
|
-
const archiveFileName = `${orgLibName}_${version}.zip`;
|
|
1662
|
+
const archiveFileName = `${orgLibName}_${version}.arch.zip`;
|
|
1597
1663
|
|
|
1598
1664
|
|
|
1599
1665
|
// 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 '
|
|
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 '
|
|
17
|
+
import type { PConnFieldProps } from '../shared/PConnProps';
|
|
18
18
|
|
|
19
19
|
import Avatar from './Avatar';
|
|
20
20
|
|
package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx
CHANGED
|
@@ -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 '
|
|
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 '
|
|
5
|
+
import type { PConnFieldProps } from '../shared/PConnProps';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
// interface for props
|
|
9
|
-
interface
|
|
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:
|
|
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 '
|
|
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
|
|
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:
|
|
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);
|
package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/index.tsx
CHANGED
|
@@ -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 '
|
|
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 '
|
|
5
|
+
import type { PConnFieldProps } from '../shared/PConnProps';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
// interface for props
|
|
9
|
-
interface
|
|
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:
|
|
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
|
-
|
|
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 '
|
|
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
|
|
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:
|
|
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 '
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
}
|