sfdx-browserforce-plugin 5.2.0-next.4 → 6.0.0-next.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/lib/browserforce.js +88 -22
- package/lib/browserforce.js.map +1 -1
- package/lib/plugins/activity-settings/index.js +93 -20
- package/lib/plugins/activity-settings/index.js.map +1 -1
- package/lib/plugins/company-information/index.js +104 -31
- package/lib/plugins/company-information/index.js.map +1 -1
- package/lib/plugins/customer-portal/available-custom-objects/index.js +166 -71
- package/lib/plugins/customer-portal/available-custom-objects/index.js.map +1 -1
- package/lib/plugins/customer-portal/enabled/index.js +73 -10
- package/lib/plugins/customer-portal/enabled/index.js.map +1 -1
- package/lib/plugins/customer-portal/portals/index.js +196 -101
- package/lib/plugins/customer-portal/portals/index.js.map +1 -1
- package/lib/plugins/density-settings/index.js +95 -21
- package/lib/plugins/density-settings/index.js.map +1 -1
- package/lib/plugins/email-deliverability/index.js +94 -21
- package/lib/plugins/email-deliverability/index.js.map +1 -1
- package/lib/plugins/high-velocity-sales-settings/index.js +67 -2
- package/lib/plugins/high-velocity-sales-settings/index.js.map +1 -1
- package/lib/plugins/high-velocity-sales-settings/page.js +0 -1
- package/lib/plugins/high-velocity-sales-settings/page.js.map +1 -1
- package/lib/plugins/history-tracking/index.js +162 -83
- package/lib/plugins/history-tracking/index.js.map +1 -1
- package/lib/plugins/home-page-layouts/index.js +129 -57
- package/lib/plugins/home-page-layouts/index.js.map +1 -1
- package/lib/plugins/lightning-experience-settings/index.js +85 -12
- package/lib/plugins/lightning-experience-settings/index.js.map +1 -1
- package/lib/plugins/linkedin-sales-navigator-settings/index.js +84 -6
- package/lib/plugins/linkedin-sales-navigator-settings/index.js.map +1 -1
- package/lib/plugins/linkedin-sales-navigator-settings/page.js +0 -2
- package/lib/plugins/linkedin-sales-navigator-settings/page.js.map +1 -1
- package/lib/plugins/omni-channel-settings/index.js +88 -13
- package/lib/plugins/omni-channel-settings/index.js.map +1 -1
- package/lib/plugins/opportunity-splits/index.js +103 -18
- package/lib/plugins/opportunity-splits/index.js.map +1 -1
- package/lib/plugins/permission-sets/service-presence-status/index.js +124 -51
- package/lib/plugins/permission-sets/service-presence-status/index.js.map +1 -1
- package/lib/plugins/picklists/field-dependencies/index.js +86 -4
- package/lib/plugins/picklists/field-dependencies/index.js.map +1 -1
- package/lib/plugins/picklists/field-dependencies/pages.js +0 -1
- package/lib/plugins/picklists/field-dependencies/pages.js.map +1 -1
- package/lib/plugins/picklists/index.js +128 -55
- package/lib/plugins/picklists/index.js.map +1 -1
- package/lib/plugins/picklists/pages.js +9 -10
- package/lib/plugins/picklists/pages.js.map +1 -1
- package/lib/plugins/record-types/index.js +73 -10
- package/lib/plugins/record-types/index.js.map +1 -1
- package/lib/plugins/record-types/pages.js +0 -1
- package/lib/plugins/record-types/pages.js.map +1 -1
- package/lib/plugins/relate-contact-to-multiple-accounts/index.js +102 -28
- package/lib/plugins/relate-contact-to-multiple-accounts/index.js.map +1 -1
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.js +107 -35
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.js.map +1 -1
- package/lib/plugins/salesforce-cpq-config/index.js +249 -165
- package/lib/plugins/salesforce-cpq-config/index.js.map +1 -1
- package/lib/plugins/salesforce-to-salesforce/index.js +93 -20
- package/lib/plugins/salesforce-to-salesforce/index.js.map +1 -1
- package/lib/plugins/security/authentication-configuration/index.js +121 -49
- package/lib/plugins/security/authentication-configuration/index.js.map +1 -1
- package/lib/plugins/security/certificate-and-key-management/index.js +142 -57
- package/lib/plugins/security/certificate-and-key-management/index.js.map +1 -1
- package/lib/plugins/service-channels/capacity/index.js +173 -102
- package/lib/plugins/service-channels/capacity/index.js.map +1 -1
- package/lib/plugins/slack/index.js +101 -27
- package/lib/plugins/slack/index.js.map +1 -1
- package/lib/plugins/user-access-policies/index.js +96 -24
- package/lib/plugins/user-access-policies/index.js.map +1 -1
- package/lib/plugins/user-access-policies/page.js +0 -6
- package/lib/plugins/user-access-policies/page.js.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,55 @@
|
|
|
1
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
+
if (value !== null && value !== void 0) {
|
|
3
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
+
var dispose, inner;
|
|
5
|
+
if (async) {
|
|
6
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
+
dispose = value[Symbol.asyncDispose];
|
|
8
|
+
}
|
|
9
|
+
if (dispose === void 0) {
|
|
10
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
+
dispose = value[Symbol.dispose];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
+
}
|
|
18
|
+
else if (async) {
|
|
19
|
+
env.stack.push({ async: true });
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
+
return function (env) {
|
|
25
|
+
function fail(e) {
|
|
26
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
+
env.hasError = true;
|
|
28
|
+
}
|
|
29
|
+
var r, s = 0;
|
|
30
|
+
function next() {
|
|
31
|
+
while (r = env.stack.pop()) {
|
|
32
|
+
try {
|
|
33
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
+
if (r.dispose) {
|
|
35
|
+
var result = r.dispose.call(r.value);
|
|
36
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
+
}
|
|
38
|
+
else s |= 1;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
fail(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
+
if (env.hasError) throw env.error;
|
|
46
|
+
}
|
|
47
|
+
return next();
|
|
48
|
+
};
|
|
49
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
+
var e = new Error(message);
|
|
51
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
+
});
|
|
1
53
|
import { BrowserforcePlugin } from '../../../plugin.js';
|
|
2
54
|
const BASE_PATH = 'ui/rpt/AnalyticsSharingSettingsPage/e';
|
|
3
55
|
const BASE_SELECTOR = 'div.pbBody';
|
|
@@ -5,49 +57,69 @@ const ENABLE_CHECKBOX_SELECTOR = 'input[id="0"]';
|
|
|
5
57
|
const SAVE_BUTTON_SELECTOR = 'input[id="saveButton"]';
|
|
6
58
|
export class FolderSharing extends BrowserforcePlugin {
|
|
7
59
|
async retrieve(definition) {
|
|
8
|
-
const
|
|
9
|
-
enableEnhancedFolderSharing: true,
|
|
10
|
-
};
|
|
11
|
-
const page = await this.browserforce.openPage(BASE_PATH);
|
|
60
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
12
61
|
try {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
62
|
+
const response = {
|
|
63
|
+
enableEnhancedFolderSharing: true,
|
|
64
|
+
};
|
|
65
|
+
const page = __addDisposableResource(env_1, await this.browserforce.openPage(BASE_PATH), true);
|
|
66
|
+
try {
|
|
67
|
+
const frameOrPage = await this.browserforce.waitForSelectorInFrameOrPage(page, BASE_SELECTOR);
|
|
68
|
+
const inputEnable = await frameOrPage
|
|
19
69
|
.locator(ENABLE_CHECKBOX_SELECTOR)
|
|
20
|
-
.
|
|
70
|
+
.count();
|
|
71
|
+
if (inputEnable > 0) {
|
|
72
|
+
response.enableEnhancedFolderSharing = await frameOrPage
|
|
73
|
+
.locator(ENABLE_CHECKBOX_SELECTOR)
|
|
74
|
+
.isChecked();
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
// already enabled
|
|
78
|
+
response.enableEnhancedFolderSharing = true;
|
|
79
|
+
}
|
|
21
80
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
81
|
+
catch (e) {
|
|
82
|
+
if (e instanceof Error && e.message.match('Insufficient Privileges')) {
|
|
83
|
+
return response;
|
|
84
|
+
}
|
|
85
|
+
throw e;
|
|
25
86
|
}
|
|
87
|
+
return response;
|
|
26
88
|
}
|
|
27
|
-
catch (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
89
|
+
catch (e_1) {
|
|
90
|
+
env_1.error = e_1;
|
|
91
|
+
env_1.hasError = true;
|
|
92
|
+
}
|
|
93
|
+
finally {
|
|
94
|
+
const result_1 = __disposeResources(env_1);
|
|
95
|
+
if (result_1)
|
|
96
|
+
await result_1;
|
|
34
97
|
}
|
|
35
|
-
await page.close();
|
|
36
|
-
return response;
|
|
37
98
|
}
|
|
38
99
|
async apply(config) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
100
|
+
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
101
|
+
try {
|
|
102
|
+
if (config.enableEnhancedFolderSharing === false) {
|
|
103
|
+
throw new Error('`enableEnhancedFolderSharing` cannot be disabled once enabled');
|
|
104
|
+
}
|
|
105
|
+
const page = __addDisposableResource(env_2, await this.browserforce.openPage(BASE_PATH), true);
|
|
106
|
+
await page
|
|
107
|
+
.locator(ENABLE_CHECKBOX_SELECTOR)
|
|
108
|
+
.setChecked(config.enableEnhancedFolderSharing);
|
|
109
|
+
await Promise.all([
|
|
110
|
+
page.waitForEvent('load'),
|
|
111
|
+
page.locator(SAVE_BUTTON_SELECTOR).click(),
|
|
112
|
+
]);
|
|
113
|
+
}
|
|
114
|
+
catch (e_2) {
|
|
115
|
+
env_2.error = e_2;
|
|
116
|
+
env_2.hasError = true;
|
|
117
|
+
}
|
|
118
|
+
finally {
|
|
119
|
+
const result_2 = __disposeResources(env_2);
|
|
120
|
+
if (result_2)
|
|
121
|
+
await result_2;
|
|
122
|
+
}
|
|
51
123
|
}
|
|
52
124
|
}
|
|
53
125
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/reports-and-dashboards/folder-sharing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,SAAS,GAAG,uCAAuC,CAAC;AAE1D,MAAM,aAAa,GAAG,YAAY,CAAC;AACnC,MAAM,wBAAwB,GAAG,eAAe,CAAC;AACjD,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAMtD,MAAM,OAAO,aAAc,SAAQ,kBAAkB;IAC5C,KAAK,CAAC,QAAQ,CAAC,UAAmB
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/reports-and-dashboards/folder-sharing/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,SAAS,GAAG,uCAAuC,CAAC;AAE1D,MAAM,aAAa,GAAG,YAAY,CAAC;AACnC,MAAM,wBAAwB,GAAG,eAAe,CAAC;AACjD,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAMtD,MAAM,OAAO,aAAc,SAAQ,kBAAkB;IAC5C,KAAK,CAAC,QAAQ,CAAC,UAAmB;;;YACvC,MAAM,QAAQ,GAAG;gBACf,2BAA2B,EAAE,IAAI;aAClC,CAAC;YACF,MAAY,IAAI,kCAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAA,CAAC;YAE/D,IAAI,CAAC;gBACH,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,4BAA4B,CACtE,IAAI,EACJ,aAAa,CACd,CAAC;gBACF,MAAM,WAAW,GAAG,MAAM,WAAW;qBAClC,OAAO,CAAC,wBAAwB,CAAC;qBACjC,KAAK,EAAE,CAAC;gBACX,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;oBACpB,QAAQ,CAAC,2BAA2B,GAAG,MAAM,WAAW;yBACrD,OAAO,CAAC,wBAAwB,CAAC;yBACjC,SAAS,EAAE,CAAC;gBACjB,CAAC;qBAAM,CAAC;oBACN,kBAAkB;oBAClB,QAAQ,CAAC,2BAA2B,GAAG,IAAI,CAAC;gBAC9C,CAAC;YACH,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,yBAAyB,CAAC,EAAE,CAAC;oBACrE,OAAO,QAAQ,CAAC;gBAClB,CAAC;gBACD,MAAM,CAAC,CAAC;YACV,CAAC;YACD,OAAO,QAAQ,CAAC;;;;;;;;;;;KACjB;IAEM,KAAK,CAAC,KAAK,CAAC,MAAc;;;YAC/B,IAAI,MAAM,CAAC,2BAA2B,KAAK,KAAK,EAAE,CAAC;gBACjD,MAAM,IAAI,KAAK,CACb,+DAA+D,CAChE,CAAC;YACJ,CAAC;YACD,MAAY,IAAI,kCAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAA,CAAC;YAC/D,MAAM,IAAI;iBACP,OAAO,CAAC,wBAAwB,CAAC;iBACjC,UAAU,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC;YAClD,MAAM,OAAO,CAAC,GAAG,CAAC;gBAChB,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;gBACzB,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,KAAK,EAAE;aAC3C,CAAC,CAAC;;;;;;;;;;;KACJ;CACF"}
|
|
@@ -1,3 +1,55 @@
|
|
|
1
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
+
if (value !== null && value !== void 0) {
|
|
3
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
+
var dispose, inner;
|
|
5
|
+
if (async) {
|
|
6
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
+
dispose = value[Symbol.asyncDispose];
|
|
8
|
+
}
|
|
9
|
+
if (dispose === void 0) {
|
|
10
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
+
dispose = value[Symbol.dispose];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
+
}
|
|
18
|
+
else if (async) {
|
|
19
|
+
env.stack.push({ async: true });
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
+
return function (env) {
|
|
25
|
+
function fail(e) {
|
|
26
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
+
env.hasError = true;
|
|
28
|
+
}
|
|
29
|
+
var r, s = 0;
|
|
30
|
+
function next() {
|
|
31
|
+
while (r = env.stack.pop()) {
|
|
32
|
+
try {
|
|
33
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
+
if (r.dispose) {
|
|
35
|
+
var result = r.dispose.call(r.value);
|
|
36
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
+
}
|
|
38
|
+
else s |= 1;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
fail(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
+
if (env.hasError) throw env.error;
|
|
46
|
+
}
|
|
47
|
+
return next();
|
|
48
|
+
};
|
|
49
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
+
var e = new Error(message);
|
|
51
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
+
});
|
|
1
53
|
import { BrowserforcePlugin } from '../../plugin.js';
|
|
2
54
|
import { formConfig } from './formConfig.js';
|
|
3
55
|
const BASE_PATH = '0A3?setupid=ImportedPackage&retURL=%2Fui%2Fsetup%2FSetup%3Fsetupid%3DStudio';
|
|
@@ -10,36 +62,146 @@ const ALLOW_SELECTOR = 'input[name="save"]';
|
|
|
10
62
|
export class SalesforceCpqConfig extends BrowserforcePlugin {
|
|
11
63
|
logger = this.browserforce.logger;
|
|
12
64
|
async retrieve(definition) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
page.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
65
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
66
|
+
try {
|
|
67
|
+
const page = __addDisposableResource(env_1, await this.browserforce.openPage(BASE_PATH), true);
|
|
68
|
+
await Promise.all([
|
|
69
|
+
page.waitForEvent('load'),
|
|
70
|
+
page.locator(CONFIGURE_SELECTOR).click(),
|
|
71
|
+
]);
|
|
72
|
+
const response = {};
|
|
73
|
+
if (definition) {
|
|
74
|
+
for (const [keyTab, valueTab] of Object.entries(formConfig)) {
|
|
75
|
+
if (definition[keyTab]) {
|
|
76
|
+
await page.locator(`td[id="${valueTab.id}"]`).click();
|
|
77
|
+
for (const [keyItem, valueItem] of Object.entries(valueTab.properties)) {
|
|
78
|
+
if (!(definition[keyTab][keyItem] === undefined)) {
|
|
79
|
+
const item = valueItem;
|
|
80
|
+
response[keyTab] = response[keyTab] || {};
|
|
81
|
+
try {
|
|
82
|
+
if (item.component === 'input' && item.type === 'boolean') {
|
|
83
|
+
response[keyTab][keyItem] = await page
|
|
84
|
+
.locator(`${item.component}[name="${item.name}"]`)
|
|
85
|
+
.isChecked();
|
|
86
|
+
}
|
|
87
|
+
else if (item.component === 'input' &&
|
|
88
|
+
item.type === 'string') {
|
|
89
|
+
response[keyTab][keyItem] = await page
|
|
90
|
+
.locator(`${item.component}[name="${item.name}"]`)
|
|
91
|
+
.inputValue();
|
|
92
|
+
}
|
|
93
|
+
else if (item.component === 'select') {
|
|
94
|
+
response[keyTab][keyItem] = await page
|
|
95
|
+
.locator(`${item.component}[name="${item.name}"] option:checked`)
|
|
96
|
+
.textContent();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
if (e instanceof Error &&
|
|
101
|
+
e.message.includes(`Error: failed to find element matching selector "${item.component}[name="${item.name}"]"`)) {
|
|
102
|
+
this.logger?.warn(`Label '${item.label}' '${keyTab}.${keyItem}' with component '${item.component}[name="${item.name}"]' is not found`);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
throw e;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return response;
|
|
114
|
+
}
|
|
115
|
+
catch (e_1) {
|
|
116
|
+
env_1.error = e_1;
|
|
117
|
+
env_1.hasError = true;
|
|
118
|
+
}
|
|
119
|
+
finally {
|
|
120
|
+
const result_1 = __disposeResources(env_1);
|
|
121
|
+
if (result_1)
|
|
122
|
+
await result_1;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
async apply(config) {
|
|
126
|
+
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
127
|
+
try {
|
|
128
|
+
const page = __addDisposableResource(env_2, await this.browserforce.openPage(BASE_PATH), true);
|
|
129
|
+
await Promise.all([
|
|
130
|
+
page.waitForEvent('load'),
|
|
131
|
+
page.locator(CONFIGURE_SELECTOR).click(),
|
|
132
|
+
]);
|
|
133
|
+
/*
|
|
134
|
+
This to click on the 'Generate Integration User Permissions button' for first time setup.
|
|
135
|
+
Once the button is clicked, it will not be available for the next time.
|
|
136
|
+
*/
|
|
137
|
+
this.logger?.log(`Checking for 'Generate Integration User Permissions' button`);
|
|
138
|
+
await page
|
|
139
|
+
.locator(`td[id="${formConfig.pricingAndCalculation.id}"]`)
|
|
140
|
+
.click();
|
|
141
|
+
const generateButtonCount = await page
|
|
142
|
+
.locator(GENERATE_INTEGRATION_USER_PERMISSIONS_SELECTOR)
|
|
143
|
+
.count();
|
|
144
|
+
if (generateButtonCount > 0) {
|
|
145
|
+
this.logger?.log(`Clicking on 'Generate Integration User Permissions' button`);
|
|
146
|
+
await page
|
|
147
|
+
.locator(GENERATE_INTEGRATION_USER_PERMISSIONS_SELECTOR)
|
|
148
|
+
.click();
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
this.logger?.log(`The button 'Generate Integration User Permissions' is not found. It might be already clicked before.`);
|
|
152
|
+
}
|
|
153
|
+
/*
|
|
154
|
+
This to loop through the formConfig and set the value based on the config provided.
|
|
155
|
+
*/
|
|
20
156
|
for (const [keyTab, valueTab] of Object.entries(formConfig)) {
|
|
21
|
-
if (
|
|
157
|
+
if (config[keyTab]) {
|
|
22
158
|
await page.locator(`td[id="${valueTab.id}"]`).click();
|
|
23
159
|
for (const [keyItem, valueItem] of Object.entries(valueTab.properties)) {
|
|
24
|
-
if (!(
|
|
160
|
+
if (!(config[keyTab][keyItem] === undefined)) {
|
|
25
161
|
const item = valueItem;
|
|
26
|
-
response[keyTab] = response[keyTab] || {};
|
|
27
162
|
try {
|
|
163
|
+
this.logger?.log(`Updating: '${keyTab}.${keyItem}' (${item.label}) with component '${item.component}[name="${item.name}"]' with value: '${config[keyTab][keyItem]}'`);
|
|
28
164
|
if (item.component === 'input' && item.type === 'boolean') {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
165
|
+
const checkbox = await page.locator(`input[name="${item.name}"]`);
|
|
166
|
+
if (!(await checkbox.isDisabled())) {
|
|
167
|
+
if (config[keyTab][keyItem]) {
|
|
168
|
+
await checkbox.check();
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
await checkbox.uncheck();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
32
174
|
}
|
|
33
|
-
else if (item.component === 'input' &&
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
.
|
|
37
|
-
.inputValue();
|
|
175
|
+
else if (item.component === 'input' && item.type === 'string') {
|
|
176
|
+
await page
|
|
177
|
+
.locator(`input[name="${item.name}"]`)
|
|
178
|
+
.fill(config[keyTab][keyItem]);
|
|
38
179
|
}
|
|
39
180
|
else if (item.component === 'select') {
|
|
40
|
-
|
|
41
|
-
.locator(
|
|
42
|
-
.
|
|
181
|
+
const selectFieldOptions = await page
|
|
182
|
+
.locator(`select[name="${item.name}"] option`)
|
|
183
|
+
.evaluateAll((options) => {
|
|
184
|
+
return options.map((option) => {
|
|
185
|
+
return {
|
|
186
|
+
text: option.text,
|
|
187
|
+
value: option.value,
|
|
188
|
+
};
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
const chooseFieldOption = selectFieldOptions.find((x) => x.text === config[keyTab][keyItem]);
|
|
192
|
+
if (!chooseFieldOption) {
|
|
193
|
+
const availableOption = selectFieldOptions.map((option) => option.text);
|
|
194
|
+
throw new Error(`Fail to set '${item.label}' with value '${config[keyTab][keyItem]}'. \nPlease make sure to select one of this available options: ${JSON.stringify(availableOption)}\n`);
|
|
195
|
+
}
|
|
196
|
+
await page
|
|
197
|
+
.locator(`select[name="${item.name}"]`)
|
|
198
|
+
.selectOption(chooseFieldOption.value);
|
|
199
|
+
}
|
|
200
|
+
if (item.immediatelySave) {
|
|
201
|
+
await Promise.all([
|
|
202
|
+
page.waitForEvent('load'),
|
|
203
|
+
page.locator(SAVE_SELECTOR).click(),
|
|
204
|
+
]);
|
|
43
205
|
}
|
|
44
206
|
}
|
|
45
207
|
catch (e) {
|
|
@@ -48,168 +210,90 @@ export class SalesforceCpqConfig extends BrowserforcePlugin {
|
|
|
48
210
|
this.logger?.warn(`Label '${item.label}' '${keyTab}.${keyItem}' with component '${item.component}[name="${item.name}"]' is not found`);
|
|
49
211
|
}
|
|
50
212
|
else {
|
|
213
|
+
this.logger?.warn(`Error: at Label '${item.label}' '${keyTab}.${keyItem}' with component '${item.component}[name="${item.name}"]' with message: ${e instanceof Error ? e.message : String(e)}`);
|
|
51
214
|
throw e;
|
|
52
215
|
}
|
|
53
216
|
}
|
|
54
217
|
}
|
|
55
218
|
}
|
|
56
219
|
}
|
|
220
|
+
await Promise.all([
|
|
221
|
+
page.waitForEvent('load'),
|
|
222
|
+
page.locator(SAVE_SELECTOR).click(),
|
|
223
|
+
]);
|
|
57
224
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
this.logger?.log(`The button 'Generate Integration User Permissions' is not found. It might be already clicked before.`);
|
|
87
|
-
}
|
|
88
|
-
/*
|
|
89
|
-
This to loop through the formConfig and set the value based on the config provided.
|
|
90
|
-
*/
|
|
91
|
-
for (const [keyTab, valueTab] of Object.entries(formConfig)) {
|
|
92
|
-
if (config[keyTab]) {
|
|
93
|
-
await page.locator(`td[id="${valueTab.id}"]`).click();
|
|
94
|
-
for (const [keyItem, valueItem] of Object.entries(valueTab.properties)) {
|
|
95
|
-
if (!(config[keyTab][keyItem] === undefined)) {
|
|
96
|
-
const item = valueItem;
|
|
97
|
-
try {
|
|
98
|
-
this.logger?.log(`Updating: '${keyTab}.${keyItem}' (${item.label}) with component '${item.component}[name="${item.name}"]' with value: '${config[keyTab][keyItem]}'`);
|
|
99
|
-
if (item.component === 'input' && item.type === 'boolean') {
|
|
100
|
-
const checkbox = await page.locator(`input[name="${item.name}"]`);
|
|
101
|
-
if (!(await checkbox.isDisabled())) {
|
|
102
|
-
if (config[keyTab][keyItem]) {
|
|
103
|
-
await checkbox.check();
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
await checkbox.uncheck();
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
else if (item.component === 'input' && item.type === 'string') {
|
|
111
|
-
await page
|
|
112
|
-
.locator(`input[name="${item.name}"]`)
|
|
113
|
-
.fill(config[keyTab][keyItem]);
|
|
114
|
-
}
|
|
115
|
-
else if (item.component === 'select') {
|
|
116
|
-
const selectFieldOptions = await page
|
|
117
|
-
.locator(`select[name="${item.name}"] option`)
|
|
118
|
-
.evaluateAll((options) => {
|
|
119
|
-
return options.map((option) => {
|
|
120
|
-
return {
|
|
121
|
-
text: option.text,
|
|
122
|
-
value: option.value,
|
|
123
|
-
};
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
const chooseFieldOption = selectFieldOptions.find((x) => x.text === config[keyTab][keyItem]);
|
|
127
|
-
if (!chooseFieldOption) {
|
|
128
|
-
const availableOption = selectFieldOptions.map((option) => option.text);
|
|
129
|
-
await page.close();
|
|
130
|
-
throw new Error(`Fail to set '${item.label}' with value '${config[keyTab][keyItem]}'. \nPlease make sure to select one of this available options: ${JSON.stringify(availableOption)}\n`);
|
|
131
|
-
}
|
|
132
|
-
await page
|
|
133
|
-
.locator(`select[name="${item.name}"]`)
|
|
134
|
-
.selectOption(chooseFieldOption.value);
|
|
135
|
-
}
|
|
136
|
-
if (item.immediatelySave) {
|
|
137
|
-
await Promise.all([
|
|
138
|
-
page.waitForEvent('load'),
|
|
139
|
-
page.locator(SAVE_SELECTOR).click(),
|
|
140
|
-
]);
|
|
141
|
-
}
|
|
225
|
+
/*
|
|
226
|
+
This to click on the 'Authorize New Calculation Service' link under Pricing and Calculation tab.
|
|
227
|
+
Once authorized, it will not appear the next time.
|
|
228
|
+
*/
|
|
229
|
+
try {
|
|
230
|
+
this.logger?.log(`'Authorize New Calculation Service' link`);
|
|
231
|
+
await page
|
|
232
|
+
.locator(`td[id="${formConfig.pricingAndCalculation.id}"]`)
|
|
233
|
+
.click();
|
|
234
|
+
const authorizeLinkCount = await page
|
|
235
|
+
.locator(AUTHORIZE_NEW_CALCULATION_SERVICE_SELECTOR)
|
|
236
|
+
.count();
|
|
237
|
+
if (authorizeLinkCount > 0) {
|
|
238
|
+
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
239
|
+
try {
|
|
240
|
+
// Click on 'Authorize New Calculation Service' link and wait for popup
|
|
241
|
+
const popupPromise = page
|
|
242
|
+
.context()
|
|
243
|
+
.waitForEvent('page', (newPage) => newPage.url().includes(AUTH_PATH));
|
|
244
|
+
await page.locator(AUTHORIZE_NEW_CALCULATION_SERVICE_SELECTOR).click();
|
|
245
|
+
const newPage = __addDisposableResource(env_3, await popupPromise, true);
|
|
246
|
+
if (newPage) {
|
|
247
|
+
// Click on 'Allow' button
|
|
248
|
+
await Promise.all([
|
|
249
|
+
page.waitForEvent('load'), // Wait for the main page to refresh
|
|
250
|
+
newPage.locator(ALLOW_SELECTOR).click(),
|
|
251
|
+
]);
|
|
252
|
+
this.logger?.log('The main page has refreshed after allowing.');
|
|
142
253
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
e.message.includes(`Error: failed to find element matching selector "${item.component}[name="${item.name}"]"`)) {
|
|
146
|
-
this.logger?.warn(`Label '${item.label}' '${keyTab}.${keyItem}' with component '${item.component}[name="${item.name}"]' is not found`);
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
this.logger?.warn(`Error: at Label '${item.label}' '${keyTab}.${keyItem}' with component '${item.component}[name="${item.name}"]' with message: ${e instanceof Error ? e.message : String(e)}`);
|
|
150
|
-
throw e;
|
|
151
|
-
}
|
|
254
|
+
else {
|
|
255
|
+
this.logger?.warn('Failed to retrieve the new page from the popup.');
|
|
152
256
|
}
|
|
257
|
+
this.logger?.log('The authorization process has been completed.');
|
|
258
|
+
}
|
|
259
|
+
catch (e_2) {
|
|
260
|
+
env_3.error = e_2;
|
|
261
|
+
env_3.hasError = true;
|
|
262
|
+
}
|
|
263
|
+
finally {
|
|
264
|
+
const result_2 = __disposeResources(env_3);
|
|
265
|
+
if (result_2)
|
|
266
|
+
await result_2;
|
|
153
267
|
}
|
|
154
268
|
}
|
|
269
|
+
else {
|
|
270
|
+
this.logger?.log(`The link 'Authorize New Calculation Service' was not found. It might be already clicked before.`);
|
|
271
|
+
}
|
|
155
272
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
*/
|
|
165
|
-
try {
|
|
166
|
-
this.logger?.log(`'Authorize New Calculation Service' link`);
|
|
167
|
-
await page
|
|
168
|
-
.locator(`td[id="${formConfig.pricingAndCalculation.id}"]`)
|
|
169
|
-
.click();
|
|
170
|
-
const authorizeLinkCount = await page
|
|
171
|
-
.locator(AUTHORIZE_NEW_CALCULATION_SERVICE_SELECTOR)
|
|
172
|
-
.count();
|
|
173
|
-
if (authorizeLinkCount > 0) {
|
|
174
|
-
// Click on 'Authorize New Calculation Service' link and wait for popup
|
|
175
|
-
const popupPromise = page
|
|
176
|
-
.context()
|
|
177
|
-
.waitForEvent('page', (newPage) => newPage.url().includes(AUTH_PATH));
|
|
178
|
-
await page.locator(AUTHORIZE_NEW_CALCULATION_SERVICE_SELECTOR).click();
|
|
179
|
-
const newPage = await popupPromise;
|
|
180
|
-
if (newPage) {
|
|
181
|
-
// Click on 'Allow' button
|
|
182
|
-
await Promise.all([
|
|
183
|
-
page.waitForEvent('load'), // Wait for the main page to refresh
|
|
184
|
-
newPage.locator(ALLOW_SELECTOR).click(),
|
|
185
|
-
]);
|
|
186
|
-
this.logger?.log('The main page has refreshed after allowing.');
|
|
187
|
-
await newPage.close();
|
|
273
|
+
catch (e) {
|
|
274
|
+
if (e instanceof Error &&
|
|
275
|
+
e.message.includes(`No element found for selector: ${AUTHORIZE_NEW_CALCULATION_SERVICE_SELECTOR}`)) {
|
|
276
|
+
this.logger?.log(`The link Authorize New Calculation Service' is not found. It might be already clicked before.`);
|
|
277
|
+
}
|
|
278
|
+
else if (e instanceof Error &&
|
|
279
|
+
e.message.includes(`Waiting for selector \`input[name="save"]\` failed: waitForFunction failed: frame got detached.`)) {
|
|
280
|
+
this.logger?.log(`ALLOW button is not found. It might be already clicked before.`);
|
|
188
281
|
}
|
|
189
282
|
else {
|
|
190
|
-
this.logger?.warn('
|
|
283
|
+
this.logger?.warn(`Error clicking Authorize New Calculation Service' button with message: ${e instanceof Error ? e.message : String(e)}`);
|
|
284
|
+
throw e;
|
|
191
285
|
}
|
|
192
|
-
this.logger?.log('The authorization process has been completed.');
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
this.logger?.log(`The link 'Authorize New Calculation Service' was not found. It might be already clicked before.`);
|
|
196
286
|
}
|
|
197
287
|
}
|
|
198
|
-
catch (
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
else {
|
|
208
|
-
this.logger?.warn(`Error clicking Authorize New Calculation Service' button with message: ${e instanceof Error ? e.message : String(e)}`);
|
|
209
|
-
throw e;
|
|
210
|
-
}
|
|
288
|
+
catch (e_3) {
|
|
289
|
+
env_2.error = e_3;
|
|
290
|
+
env_2.hasError = true;
|
|
291
|
+
}
|
|
292
|
+
finally {
|
|
293
|
+
const result_3 = __disposeResources(env_2);
|
|
294
|
+
if (result_3)
|
|
295
|
+
await result_3;
|
|
211
296
|
}
|
|
212
|
-
await page.close();
|
|
213
297
|
}
|
|
214
298
|
}
|
|
215
299
|
//# sourceMappingURL=index.js.map
|