sfdx-browserforce-plugin 5.2.0-next.5 → 6.0.0-next.10

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 (178) hide show
  1. package/README.md +66 -87
  2. package/lib/browserforce-command.d.ts +14 -3
  3. package/lib/browserforce-command.js +117 -17
  4. package/lib/browserforce-command.js.map +1 -1
  5. package/lib/browserforce.d.ts +14 -12
  6. package/lib/browserforce.js +98 -100
  7. package/lib/browserforce.js.map +1 -1
  8. package/lib/commands/browserforce/apply.js +17 -12
  9. package/lib/commands/browserforce/apply.js.map +1 -1
  10. package/lib/commands/browserforce/playwright.js +9 -3
  11. package/lib/commands/browserforce/playwright.js.map +1 -1
  12. package/lib/config-parser.js.map +1 -1
  13. package/lib/pages/login.d.ts +2 -2
  14. package/lib/pages/login.js +5 -15
  15. package/lib/pages/login.js.map +1 -1
  16. package/lib/plugin.d.ts +0 -2
  17. package/lib/plugin.js +0 -2
  18. package/lib/plugin.js.map +1 -1
  19. package/lib/plugins/activity-settings/index.e2e-spec.js +1 -1
  20. package/lib/plugins/activity-settings/index.e2e-spec.js.map +1 -1
  21. package/lib/plugins/activity-settings/index.js +92 -21
  22. package/lib/plugins/activity-settings/index.js.map +1 -1
  23. package/lib/plugins/company-information/index.e2e-spec.js +1 -1
  24. package/lib/plugins/company-information/index.e2e-spec.js.map +1 -1
  25. package/lib/plugins/company-information/index.js +100 -31
  26. package/lib/plugins/company-information/index.js.map +1 -1
  27. package/lib/plugins/customer-portal/available-custom-objects/index.js +161 -73
  28. package/lib/plugins/customer-portal/available-custom-objects/index.js.map +1 -1
  29. package/lib/plugins/customer-portal/available-custom-objects/index.test.js +1 -1
  30. package/lib/plugins/customer-portal/available-custom-objects/index.test.js.map +1 -1
  31. package/lib/plugins/customer-portal/enabled/index.js +76 -13
  32. package/lib/plugins/customer-portal/enabled/index.js.map +1 -1
  33. package/lib/plugins/customer-portal/enabled/index.test.js +1 -1
  34. package/lib/plugins/customer-portal/enabled/index.test.js.map +1 -1
  35. package/lib/plugins/customer-portal/index.e2e-spec.js +12 -19
  36. package/lib/plugins/customer-portal/index.e2e-spec.js.map +1 -1
  37. package/lib/plugins/customer-portal/index.js +3 -4
  38. package/lib/plugins/customer-portal/index.js.map +1 -1
  39. package/lib/plugins/customer-portal/index.test.js +1 -1
  40. package/lib/plugins/customer-portal/index.test.js.map +1 -1
  41. package/lib/plugins/customer-portal/portals/index.js +186 -110
  42. package/lib/plugins/customer-portal/portals/index.js.map +1 -1
  43. package/lib/plugins/customer-portal/portals/index.test.js +1 -1
  44. package/lib/plugins/customer-portal/portals/index.test.js.map +1 -1
  45. package/lib/plugins/density-settings/index.e2e-spec.js +1 -1
  46. package/lib/plugins/density-settings/index.e2e-spec.js.map +1 -1
  47. package/lib/plugins/density-settings/index.js +91 -22
  48. package/lib/plugins/density-settings/index.js.map +1 -1
  49. package/lib/plugins/email-deliverability/index.e2e-spec.js +1 -1
  50. package/lib/plugins/email-deliverability/index.e2e-spec.js.map +1 -1
  51. package/lib/plugins/email-deliverability/index.js +93 -22
  52. package/lib/plugins/email-deliverability/index.js.map +1 -1
  53. package/lib/plugins/high-velocity-sales-settings/index.d.ts +1 -1
  54. package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.js +1 -1
  55. package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.js.map +1 -1
  56. package/lib/plugins/high-velocity-sales-settings/index.js +71 -8
  57. package/lib/plugins/high-velocity-sales-settings/index.js.map +1 -1
  58. package/lib/plugins/high-velocity-sales-settings/page.d.ts +2 -1
  59. package/lib/plugins/high-velocity-sales-settings/page.js +2 -6
  60. package/lib/plugins/high-velocity-sales-settings/page.js.map +1 -1
  61. package/lib/plugins/history-tracking/index.e2e-spec.js +3 -4
  62. package/lib/plugins/history-tracking/index.e2e-spec.js.map +1 -1
  63. package/lib/plugins/history-tracking/index.js +156 -94
  64. package/lib/plugins/history-tracking/index.js.map +1 -1
  65. package/lib/plugins/home-page-layouts/index.e2e-spec.js +1 -1
  66. package/lib/plugins/home-page-layouts/index.e2e-spec.js.map +1 -1
  67. package/lib/plugins/home-page-layouts/index.js +121 -57
  68. package/lib/plugins/home-page-layouts/index.js.map +1 -1
  69. package/lib/plugins/home-page-layouts/index.test.js +1 -1
  70. package/lib/plugins/home-page-layouts/index.test.js.map +1 -1
  71. package/lib/plugins/index.d.ts +1 -1
  72. package/lib/plugins/index.js +1 -1
  73. package/lib/plugins/index.js.map +1 -1
  74. package/lib/plugins/lightning-experience-settings/index.e2e-spec.js +1 -1
  75. package/lib/plugins/lightning-experience-settings/index.e2e-spec.js.map +1 -1
  76. package/lib/plugins/lightning-experience-settings/index.js +90 -27
  77. package/lib/plugins/lightning-experience-settings/index.js.map +1 -1
  78. package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.js +1 -1
  79. package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.js.map +1 -1
  80. package/lib/plugins/linkedin-sales-navigator-settings/index.js +84 -6
  81. package/lib/plugins/linkedin-sales-navigator-settings/index.js.map +1 -1
  82. package/lib/plugins/linkedin-sales-navigator-settings/page.d.ts +2 -1
  83. package/lib/plugins/linkedin-sales-navigator-settings/page.js +2 -7
  84. package/lib/plugins/linkedin-sales-navigator-settings/page.js.map +1 -1
  85. package/lib/plugins/omni-channel-settings/index.e2e-spec.js +1 -1
  86. package/lib/plugins/omni-channel-settings/index.e2e-spec.js.map +1 -1
  87. package/lib/plugins/omni-channel-settings/index.js +87 -14
  88. package/lib/plugins/omni-channel-settings/index.js.map +1 -1
  89. package/lib/plugins/opportunity-splits/index.e2e-spec.js +1 -1
  90. package/lib/plugins/opportunity-splits/index.e2e-spec.js.map +1 -1
  91. package/lib/plugins/opportunity-splits/index.js +103 -18
  92. package/lib/plugins/opportunity-splits/index.js.map +1 -1
  93. package/lib/plugins/opportunity-splits/pages/layout-selection.js.map +1 -1
  94. package/lib/plugins/opportunity-splits/pages/overview.d.ts +2 -1
  95. package/lib/plugins/opportunity-splits/pages/overview.js +2 -3
  96. package/lib/plugins/opportunity-splits/pages/overview.js.map +1 -1
  97. package/lib/plugins/opportunity-splits/pages/setup.d.ts +2 -1
  98. package/lib/plugins/opportunity-splits/pages/setup.js +1 -1
  99. package/lib/plugins/opportunity-splits/pages/setup.js.map +1 -1
  100. package/lib/plugins/permission-sets/index.e2e-spec.js +1 -1
  101. package/lib/plugins/permission-sets/index.e2e-spec.js.map +1 -1
  102. package/lib/plugins/permission-sets/index.js.map +1 -1
  103. package/lib/plugins/permission-sets/service-presence-status/index.js +106 -53
  104. package/lib/plugins/permission-sets/service-presence-status/index.js.map +1 -1
  105. package/lib/plugins/picklists/field-dependencies/index.js +91 -14
  106. package/lib/plugins/picklists/field-dependencies/index.js.map +1 -1
  107. package/lib/plugins/picklists/field-dependencies/index.test.js +1 -1
  108. package/lib/plugins/picklists/field-dependencies/index.test.js.map +1 -1
  109. package/lib/plugins/picklists/field-dependencies/pages.d.ts +3 -2
  110. package/lib/plugins/picklists/field-dependencies/pages.js +5 -14
  111. package/lib/plugins/picklists/field-dependencies/pages.js.map +1 -1
  112. package/lib/plugins/picklists/index.d.ts +1 -1
  113. package/lib/plugins/picklists/index.e2e-spec.js +36 -14
  114. package/lib/plugins/picklists/index.e2e-spec.js.map +1 -1
  115. package/lib/plugins/picklists/index.js +136 -68
  116. package/lib/plugins/picklists/index.js.map +1 -1
  117. package/lib/plugins/picklists/pages.js +13 -28
  118. package/lib/plugins/picklists/pages.js.map +1 -1
  119. package/lib/plugins/picklists/standard-value-set.js +2 -2
  120. package/lib/plugins/picklists/standard-value-set.js.map +1 -1
  121. package/lib/plugins/record-types/index.e2e-spec.js +2 -3
  122. package/lib/plugins/record-types/index.e2e-spec.js.map +1 -1
  123. package/lib/plugins/record-types/index.js +81 -20
  124. package/lib/plugins/record-types/index.js.map +1 -1
  125. package/lib/plugins/record-types/pages.js +1 -5
  126. package/lib/plugins/record-types/pages.js.map +1 -1
  127. package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.js +2 -2
  128. package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.js.map +1 -1
  129. package/lib/plugins/relate-contact-to-multiple-accounts/index.js +99 -35
  130. package/lib/plugins/relate-contact-to-multiple-accounts/index.js.map +1 -1
  131. package/lib/plugins/reports-and-dashboards/folder-sharing/index.js +100 -37
  132. package/lib/plugins/reports-and-dashboards/folder-sharing/index.js.map +1 -1
  133. package/lib/plugins/reports-and-dashboards/index.js +1 -1
  134. package/lib/plugins/reports-and-dashboards/index.js.map +1 -1
  135. package/lib/plugins/salesforce-cpq-config/index.e2e-spec.js +1 -1
  136. package/lib/plugins/salesforce-cpq-config/index.e2e-spec.js.map +1 -1
  137. package/lib/plugins/salesforce-cpq-config/index.js +213 -167
  138. package/lib/plugins/salesforce-cpq-config/index.js.map +1 -1
  139. package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.js +1 -2
  140. package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.js.map +1 -1
  141. package/lib/plugins/salesforce-to-salesforce/index.js +93 -23
  142. package/lib/plugins/salesforce-to-salesforce/index.js.map +1 -1
  143. package/lib/plugins/security/authentication-configuration/index.e2e-spec.js +2 -3
  144. package/lib/plugins/security/authentication-configuration/index.e2e-spec.js.map +1 -1
  145. package/lib/plugins/security/authentication-configuration/index.js +122 -50
  146. package/lib/plugins/security/authentication-configuration/index.js.map +1 -1
  147. package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.js +4 -25
  148. package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.js.map +1 -1
  149. package/lib/plugins/security/certificate-and-key-management/index.js +141 -65
  150. package/lib/plugins/security/certificate-and-key-management/index.js.map +1 -1
  151. package/lib/plugins/security/certificate-and-key-management/index.test.js +1 -1
  152. package/lib/plugins/security/certificate-and-key-management/index.test.js.map +1 -1
  153. package/lib/plugins/security/index.js +1 -2
  154. package/lib/plugins/security/index.js.map +1 -1
  155. package/lib/plugins/service-channels/capacity/index.js +145 -112
  156. package/lib/plugins/service-channels/capacity/index.js.map +1 -1
  157. package/lib/plugins/service-channels/index.e2e-spec.js +5 -6
  158. package/lib/plugins/service-channels/index.e2e-spec.js.map +1 -1
  159. package/lib/plugins/service-channels/index.js +1 -2
  160. package/lib/plugins/service-channels/index.js.map +1 -1
  161. package/lib/plugins/slack/index.e2e-spec.js +1 -1
  162. package/lib/plugins/slack/index.e2e-spec.js.map +1 -1
  163. package/lib/plugins/slack/index.js +97 -28
  164. package/lib/plugins/slack/index.js.map +1 -1
  165. package/lib/plugins/user-access-policies/index.e2e-spec.js +3 -5
  166. package/lib/plugins/user-access-policies/index.e2e-spec.js.map +1 -1
  167. package/lib/plugins/user-access-policies/index.js +95 -26
  168. package/lib/plugins/user-access-policies/index.js.map +1 -1
  169. package/lib/plugins/user-access-policies/page.d.ts +2 -1
  170. package/lib/plugins/user-access-policies/page.js +1 -7
  171. package/lib/plugins/user-access-policies/page.js.map +1 -1
  172. package/lib/plugins/utils.js +2 -7
  173. package/lib/plugins/utils.js.map +1 -1
  174. package/oclif.manifest.json +67 -71
  175. package/package.json +10 -8
  176. package/lib/commands/browserforce/plan.d.ts +0 -10
  177. package/lib/commands/browserforce/plan.js +0 -56
  178. package/lib/commands/browserforce/plan.js.map +0 -1
@@ -1,10 +1,62 @@
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 { existsSync } from 'fs';
2
54
  import * as path from 'path';
3
55
  import * as queryString from 'querystring';
4
56
  import { waitForPageErrors } from '../../../browserforce.js';
5
57
  import { BrowserforcePlugin } from '../../../plugin.js';
6
- const CERT_PREFIX_PATH = '0P1';
7
- const KEYSTORE_IMPORT_PATH = '_ui/security/certificate/KeyStoreImportUi/e';
58
+ const CERT_PREFIX_PATH = '/0P1';
59
+ const KEYSTORE_IMPORT_PATH = `/_ui/security/certificate/KeyStoreImportUi/e?retURL=${encodeURIComponent('/setup/forcecomHomepage.apexp')}`;
8
60
  const FILE_UPLOAD_SELECTOR = 'input[type="file"]';
9
61
  const KEYSTORE_PASSWORD_SELECTOR = 'input#Password';
10
62
  const SAVE_BUTTON_SELECTOR = 'input[name="save"]';
@@ -15,14 +67,10 @@ export class CertificateAndKeyManagement extends BrowserforcePlugin {
15
67
  importFromKeystore: [],
16
68
  };
17
69
  let existingCertificates = [];
18
- if (definition?.certificates?.length ||
19
- definition?.importFromKeystore?.length) {
20
- existingCertificates =
21
- // Note: Unfortunately scanAll=false has no impact and returns deleted records.
70
+ if (definition?.certificates?.length || definition?.importFromKeystore?.length) {
71
+ existingCertificates = // Note: Unfortunately scanAll=false has no impact and returns deleted records.
22
72
  // Workaround: Order by CreatedDate DESC to get the latest record first.
23
- (await this.org
24
- .getConnection()
25
- .tooling.query(`SELECT Id, DeveloperName, MasterLabel, OptionsIsPrivateKeyExportable, KeySize FROM Certificate ORDER BY CreatedDate DESC`, { scanAll: false }))?.records;
73
+ (await this.browserforce.connection.tooling.query(`SELECT Id, DeveloperName, MasterLabel, OptionsIsPrivateKeyExportable, KeySize FROM Certificate ORDER BY CreatedDate DESC`, { scanAll: false }))?.records;
26
74
  }
27
75
  if (definition?.certificates?.length) {
28
76
  for (const cert of definition.certificates) {
@@ -83,73 +131,101 @@ export class CertificateAndKeyManagement extends BrowserforcePlugin {
83
131
  // update
84
132
  }
85
133
  else {
86
- // create new
87
- const urlAttributes = {
88
- DeveloperName: certificate.name,
89
- MasterLabel: certificate.label,
90
- };
91
- if (certificate.keySize) {
92
- urlAttributes['keySize'] = certificate.keySize;
134
+ const env_1 = { stack: [], error: void 0, hasError: false };
135
+ try {
136
+ // create new
137
+ const urlAttributes = {
138
+ DeveloperName: certificate.name,
139
+ MasterLabel: certificate.label,
140
+ };
141
+ if (certificate.keySize) {
142
+ urlAttributes['keySize'] = certificate.keySize;
143
+ }
144
+ if (certificate.exportable !== undefined) {
145
+ urlAttributes['exp'] = certificate.exportable ? 1 : 0;
146
+ }
147
+ const page = __addDisposableResource(env_1, await this.browserforce.openPage(`${CERT_PREFIX_PATH}/e?${queryString.stringify(urlAttributes)}`), true);
148
+ await page.locator(SAVE_BUTTON_SELECTOR).first().click();
149
+ // -> id (15 character Salesforce ID starting with 0P1)
150
+ await page.waitForURL((url) => /\/0P1\w{12}/.test(url.pathname));
93
151
  }
94
- if (certificate.exportable !== undefined) {
95
- urlAttributes['exp'] = certificate.exportable ? 1 : 0;
152
+ catch (e_1) {
153
+ env_1.error = e_1;
154
+ env_1.hasError = true;
155
+ }
156
+ finally {
157
+ const result_1 = __disposeResources(env_1);
158
+ if (result_1)
159
+ await result_1;
96
160
  }
97
- const page = await this.browserforce.openPage(`${CERT_PREFIX_PATH}/e?${queryString.stringify(urlAttributes)}`);
98
- await page.locator(SAVE_BUTTON_SELECTOR).first().click();
99
- // -> id (15 character Salesforce ID starting with 0P1)
100
- await page.waitForURL((url) => /\/0P1\w{12}/.test(url.pathname));
101
- await page.close();
102
161
  }
103
162
  }
104
163
  }
105
164
  if (plan.importFromKeystore) {
106
165
  for (const certificate of plan.importFromKeystore) {
107
- // TODO: make relative to this.command.flags.definitionfile
108
- if (!certificate.filePath) {
109
- throw new Error(`To import a certificate, the filePath is mandatory.`);
110
- }
111
- const filePath = path.resolve(certificate.filePath);
112
- if (!existsSync(filePath)) {
113
- throw new Error(`file does not exist: ${filePath}`);
114
- }
115
- const page = await this.browserforce.openPage(`${KEYSTORE_IMPORT_PATH}`);
116
- await page.locator(FILE_UPLOAD_SELECTOR).setInputFiles(filePath);
117
- if (certificate.password) {
118
- await page
119
- .locator(KEYSTORE_PASSWORD_SELECTOR)
120
- .fill(certificate.password);
121
- }
122
- await page.locator(SAVE_BUTTON_SELECTOR).first().click();
123
- await Promise.race([
124
- page.waitForURL((url) => url.pathname !== `/${KEYSTORE_IMPORT_PATH}`),
125
- (async () => {
166
+ const env_2 = { stack: [], error: void 0, hasError: false };
167
+ try {
168
+ if (!certificate.filePath) {
169
+ throw new Error(`To import a certificate, the filePath is mandatory.`);
170
+ }
171
+ const filePath = path.resolve(certificate.filePath);
172
+ if (!existsSync(filePath)) {
173
+ throw new Error(`file does not exist: ${filePath}`);
174
+ }
175
+ const page = __addDisposableResource(env_2, await this.browserforce.openPage(KEYSTORE_IMPORT_PATH), true);
176
+ await page.locator(FILE_UPLOAD_SELECTOR).setInputFiles(filePath);
177
+ if (certificate.password) {
178
+ await page.locator(KEYSTORE_PASSWORD_SELECTOR).fill(certificate.password);
179
+ }
180
+ await page.locator(SAVE_BUTTON_SELECTOR).first().click();
181
+ await Promise.race([
182
+ page.waitForURL((url) => url.pathname === '/setup/forcecomHomepage.apexp'),
183
+ (async () => {
184
+ try {
185
+ await waitForPageErrors(page);
186
+ }
187
+ catch (e) {
188
+ if (e instanceof Error && e.message === 'Data Not Available') {
189
+ throw new Error('Failed to import certificate from Keystore. Please enable Identity Provider first. https://salesforce.stackexchange.com/questions/61618/import-keystore-in-certificate-and-key-management');
190
+ }
191
+ throw e;
192
+ }
193
+ })(),
194
+ ]);
195
+ if (certificate.name) {
196
+ const env_3 = { stack: [], error: void 0, hasError: false };
126
197
  try {
127
- await waitForPageErrors(page);
198
+ // rename cert as it has the wrong name
199
+ // JKS aliases are case-insensitive (and so lowercase)
200
+ const certsResponse = await this.browserforce.connection.tooling.query(`SELECT Id FROM Certificate WHERE DeveloperName = '${certificate.name.toLowerCase()}'`);
201
+ const importedCert = certsResponse.records[0];
202
+ const certPage = __addDisposableResource(env_3, await this.browserforce.openPage(`/${importedCert.Id}/e?MasterLabel=${certificate.name}&DeveloperName=${certificate.name}&retURL=${encodeURIComponent('/setup/forcecomHomepage.apexp')}`), true);
203
+ await certPage.locator(SAVE_BUTTON_SELECTOR).first().click();
204
+ await Promise.race([
205
+ await page.waitForURL((url) => url.pathname === '/setup/forcecomHomepage.apexp'),
206
+ waitForPageErrors(certPage),
207
+ ]);
128
208
  }
129
- catch (e) {
130
- if (e instanceof Error && e.message === 'Data Not Available') {
131
- throw new Error('Failed to import certificate from Keystore. Please enable Identity Provider first. https://salesforce.stackexchange.com/questions/61618/import-keystore-in-certificate-and-key-management');
132
- }
133
- throw e;
209
+ catch (e_2) {
210
+ env_3.error = e_2;
211
+ env_3.hasError = true;
134
212
  }
135
- })(),
136
- ]);
137
- if (certificate.name) {
138
- // rename cert as it has the wrong name
139
- // JKS aliases are case-insensitive (and so lowercase)
140
- const certsResponse = await this.org
141
- .getConnection()
142
- .tooling.query(`SELECT Id FROM Certificate WHERE DeveloperName = '${certificate.name.toLowerCase()}'`);
143
- const importedCert = certsResponse.records[0];
144
- const certPage = await this.browserforce.openPage(`${importedCert.Id}/e?MasterLabel=${certificate.name}&DeveloperName=${certificate.name}`);
145
- await certPage.locator(SAVE_BUTTON_SELECTOR).first().click();
146
- await Promise.race([
147
- await page.waitForURL((url) => url.pathname !== `/${importedCert.Id}/e`),
148
- waitForPageErrors(certPage),
149
- ]);
150
- await certPage.close();
213
+ finally {
214
+ const result_2 = __disposeResources(env_3);
215
+ if (result_2)
216
+ await result_2;
217
+ }
218
+ }
219
+ }
220
+ catch (e_3) {
221
+ env_2.error = e_3;
222
+ env_2.hasError = true;
223
+ }
224
+ finally {
225
+ const result_3 = __disposeResources(env_2);
226
+ if (result_3)
227
+ await result_3;
151
228
  }
152
- await page.close();
153
229
  }
154
230
  }
155
231
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/security/certificate-and-key-management/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,WAAW,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAC/B,MAAM,oBAAoB,GAAG,6CAA6C,CAAC;AAE3E,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAClD,MAAM,0BAA0B,GAAG,gBAAgB,CAAC;AACpD,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;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iBAAiB,CAAC,QAAQ,CAAC;qBAC5B,CAAC,CAAC;oBACH,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC;gBACzB,CAAC;gBACD,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;YACrB,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/security/certificate-and-key-management/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,WAAW,MAAM,aAAa,CAAC;AAC3C,OAAO,EAA0B,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,MAAM,oBAAoB,GAAsB,uDAAuD,kBAAkB,CAAC,+BAA+B,CAAC,EAAE,CAAC;AAE7J,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAClD,MAAM,0BAA0B,GAAG,gBAAgB,CAAC;AACpD,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AA4BlD,MAAM,OAAO,2BAA4B,SAAQ,kBAAkB;IAC1D,KAAK,CAAC,QAAQ,CAAC,UAAkB;QACtC,MAAM,QAAQ,GAAW;YACvB,YAAY,EAAE,EAAE;YAChB,kBAAkB,EAAE,EAAE;SACvB,CAAC;QACF,IAAI,oBAAoB,GAAwB,EAAE,CAAC;QACnD,IAAI,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,UAAU,EAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC;YAC/E,oBAAoB,GAAG,+EAA+E;gBACpG,wEAAwE;gBACxE,CACE,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,KAA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BACL,CAAC,CAAC;oBACH,IAAI,WAAW,CAAC,IAAI,EAAE,CAAC;;;4BACrB,uCAAuC;4BACvC,uDAAuD;4BACvD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CACpE,qDAAqD,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CACvF,CAAC;4BACF,MAAM,YAAY,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;4BAC9C,MAAY,QAAQ,kCAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CACrD,IAAI,YAAY,CAAC,EAAE,kBAAkB,WAAW,CAAC,IAAI,kBAAkB,WAAW,CAAC,IAAI,WAAW,kBAAkB,CAAC,+BAA+B,CAAC,EAAE,CACxJ,OAAA,CAAC;4BACF,MAAM,QAAQ,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC;4BAC7D,MAAM,OAAO,CAAC,IAAI,CAAC;gCACjB,MAAM,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,+BAA+B,CAAC;gCAChF,iBAAiB,CAAC,QAAQ,CAAC;6BAC5B,CAAC,CAAC;;;;;;;;;;;qBACJ;;;;;;;;;;;aACF;QACH,CAAC;IACH,CAAC;CACF"}
@@ -49,7 +49,7 @@ const tests = [
49
49
  ];
50
50
  describe('CertificateAndKeyManagement', () => {
51
51
  describe('diff()', () => {
52
- const p = new CertificateAndKeyManagement(global.bf);
52
+ const p = new CertificateAndKeyManagement(global.browserforce);
53
53
  for (const t of tests) {
54
54
  it(t.description, () => {
55
55
  const actual = p.diff(t.source, t.target);
@@ -1 +1 @@
1
- {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../../src/plugins/security/certificate-and-key-management/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,C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,"file":"index.test.js","sourceRoot":"","sources":["../../../../src/plugins/security/certificate-and-key-management/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,2BAA2B,EAAU,MAAM,YAAY,CAAC;AASjE,MAAM,KAAK,GAAQ;IACjB;QACE,WAAW,EAAE,mDAAmD;QAChE,MAAM,EAAE;YACN,kBAAkB,EAAE;gBAClB;oBACE,IAAI,EAAE,OAAO;iBACd;aACF;SACF;QACD,MAAM,EAAE;YACN,kBAAkB,EAAE;gBAClB;oBACE,IAAI,EAAE,OAAO;oBACb,QAAQ,EAAE,SAAS;iBACpB;aACF;SACF;QACD,QAAQ,EAAE,SAAS;KACpB;IACD;QACE,WAAW,EAAE,+BAA+B;QAC5C,MAAM,EAAE;YACN,kBAAkB,EAAE;gBAClB;oBACE,IAAI,EAAE,KAAK;iBACZ;aACF;SACF;QACD,MAAM,EAAE;YACN,kBAAkB,EAAE;gBAClB;oBACE,IAAI,EAAE,OAAO;oBACb,QAAQ,EAAE,SAAS;iBACpB;aACF;SACF;QACD,QAAQ,EAAE;YACR,kBAAkB,EAAE;gBAClB;oBACE,IAAI,EAAE,OAAO;oBACb,QAAQ,EAAE,SAAS;iBACpB;aACF;SACF;KACF;CACF,CAAC;AAEF,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;QACtB,MAAM,CAAC,GAAG,IAAI,2BAA2B,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC/D,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,EAAE;gBACrB,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;gBAC1C,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;YAC7C,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -10,8 +10,7 @@ export class Security extends BrowserforcePlugin {
10
10
  response.certificateAndKeyManagement = await pluginCKM.retrieve(definition.certificateAndKeyManagement);
11
11
  }
12
12
  if (definition.authenticationConfiguration) {
13
- response.authenticationConfiguration =
14
- await new AuthenticationConfiguration(this.browserforce).retrieve(definition.authenticationConfiguration);
13
+ response.authenticationConfiguration = await new AuthenticationConfiguration(this.browserforce).retrieve(definition.authenticationConfiguration);
15
14
  }
16
15
  }
17
16
  return response;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/security/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EACL,2BAA2B,GAE5B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,2BAA2B,GAE5B,MAAM,2CAA2C,CAAC;AAOnD,MAAM,OAAO,QAAS,SAAQ,kBAAkB;IACvC,KAAK,CAAC,QAAQ,CAAC,UAAmB;QACvC,MAAM,QAAQ,GAAW,EAAE,CAAC;QAC5B,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,UAAU,CAAC,2BAA2B,EAAE,CAAC;gBAC3C,MAAM,SAAS,GAAG,IAAI,2BAA2B,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBACrE,QAAQ,CAAC,2BAA2B,GAAG,MAAM,SAAS,CAAC,QAAQ,CAC7D,UAAU,CAAC,2BAA2B,CACvC,CAAC;YACJ,CAAC;YACD,IAAI,UAAU,CAAC,2BAA2B,EAAE,CAAC;gBAC3C,QAAQ,CAAC,2BAA2B;oBAClC,MAAM,IAAI,2BAA2B,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,QAAQ,CAC/D,UAAU,CAAC,2BAA2B,CACvC,CAAC;YACN,CAAC;QACH,CAAC;QAC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AC;YAC9C,QAAQ,CAAC,2BAA2B,GAAG,2BAA2B,CAAC;QACrE,CAAC;QACD,IAAI,2BAA2B,KAAK,SAAS,EAAE,CAAC;YAC9C,QAAQ,CAAC,2BAA2B,GAAG,2BAA2B,CAAC;QACrE,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7D,CAAC;IAEM,KAAK,CAAC,KAAK,CAAC,IAAY;QAC7B,IAAI,IAAI,CAAC,2BAA2B,EAAE,CAAC;YACrC,MAAM,SAAS,GAAG,IAAI,2BAA2B,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACrE,MAAM,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QAC1D,CAAC;QACD,IAAI,IAAI,CAAC,2BAA2B,EAAE,CAAC;YACrC,MAAM,gBAAgB,GAAG,IAAI,2BAA2B,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC5E,MAAM,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;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 { waitForPageErrors } from '../../../browserforce.js';
2
54
  import { BrowserforcePlugin } from '../../../plugin.js';
3
55
  const ADD_BUTTON_SELECTOR = 'a[id$=":duelingListBox:backingList_add"]';
@@ -11,50 +63,44 @@ const VALUES_COMPLETED_SELECTOR = 'select[id$=":statusFieldValues:duelingListBox
11
63
  const VALUES_IN_PROGRESS_SELECTOR = 'select[id$=":statusFieldValues:duelingListBox:backingList_s"]';
12
64
  export class Capacity extends BrowserforcePlugin {
13
65
  async retrieve(definition) {
14
- // Query for the service channel
15
- const serviceChannelDeveloperName = definition.serviceChannelDeveloperName;
16
- const serviceChannel = await this.org
17
- .getConnection()
18
- .singleRecordQuery(`SELECT Id FROM ServiceChannel WHERE DeveloperName='${serviceChannelDeveloperName}'`);
19
- // Open the service channel setup page
20
- const page = await this.browserforce.openPage(`${serviceChannel.Id}/e`);
21
- // Retrieve the service channel config
22
- const capacityModelCount = await page
23
- .locator(CAPACITY_MODEL_SELECTOR)
24
- .count();
25
- if (capacityModelCount === 0) {
26
- await page.close();
27
- return {};
66
+ const env_1 = { stack: [], error: void 0, hasError: false };
67
+ try {
68
+ // Query for the service channel
69
+ const serviceChannelDeveloperName = definition.serviceChannelDeveloperName;
70
+ const serviceChannel = await this.browserforce.connection.singleRecordQuery(`SELECT Id FROM ServiceChannel WHERE DeveloperName='${serviceChannelDeveloperName}'`);
71
+ // Open the service channel setup page
72
+ const page = __addDisposableResource(env_1, await this.browserforce.openPage(`/${serviceChannel.Id}/e`), true);
73
+ // Retrieve the service channel config
74
+ const capacityModelCount = await page.locator(CAPACITY_MODEL_SELECTOR).count();
75
+ if (capacityModelCount === 0) {
76
+ return {};
77
+ }
78
+ const capacityModel = await page.locator(`${CAPACITY_MODEL_SELECTOR}`).inputValue();
79
+ if (capacityModel === 'StatusBased') {
80
+ const statusField = await page.locator(`${STATUS_FIELD_SELECTOR}`).inputValue();
81
+ const inProgressOptionsLocator = page.locator(VALUES_IN_PROGRESS_SELECTOR).locator('option:not(:disabled)');
82
+ const valuesForInProgress = await Promise.all((await inProgressOptionsLocator.all()).map((option) => option.getAttribute('title')));
83
+ const checkAgentCapacityOnReopenedWorkItems = await page.locator(STATUS_CHANGE_CAPACITY_SELECTOR).isChecked();
84
+ const checkAgentCapacityOnReassignedWorkItems = await page.locator(OWNER_CHANGE_CAPACITY_SELECTOR).isChecked();
85
+ return {
86
+ capacityModel,
87
+ statusField,
88
+ valuesForInProgress,
89
+ checkAgentCapacityOnReopenedWorkItems,
90
+ checkAgentCapacityOnReassignedWorkItems,
91
+ };
92
+ }
93
+ return { capacityModel };
94
+ }
95
+ catch (e_1) {
96
+ env_1.error = e_1;
97
+ env_1.hasError = true;
28
98
  }
29
- const capacityModel = await page
30
- .locator(`${CAPACITY_MODEL_SELECTOR}`)
31
- .inputValue();
32
- if (capacityModel === 'StatusBased') {
33
- const statusField = await page
34
- .locator(`${STATUS_FIELD_SELECTOR}`)
35
- .inputValue();
36
- const valuesForInProgress = await page
37
- .locator(`${VALUES_IN_PROGRESS_SELECTOR} > option:not(:disabled)`)
38
- .evaluateAll((options) => {
39
- return options.map((option) => option.title);
40
- });
41
- const checkAgentCapacityOnReopenedWorkItems = await page
42
- .locator(STATUS_CHANGE_CAPACITY_SELECTOR)
43
- .isChecked();
44
- const checkAgentCapacityOnReassignedWorkItems = await page
45
- .locator(OWNER_CHANGE_CAPACITY_SELECTOR)
46
- .isChecked();
47
- await page.close();
48
- return {
49
- capacityModel,
50
- statusField,
51
- valuesForInProgress,
52
- checkAgentCapacityOnReopenedWorkItems,
53
- checkAgentCapacityOnReassignedWorkItems,
54
- };
99
+ finally {
100
+ const result_1 = __disposeResources(env_1);
101
+ if (result_1)
102
+ await result_1;
55
103
  }
56
- await page.close();
57
- return { capacityModel };
58
104
  }
59
105
  diff(state, definition) {
60
106
  const response = {};
@@ -72,90 +118,77 @@ export class Capacity extends BrowserforcePlugin {
72
118
  if (definition.statusField !== state.statusField) {
73
119
  response.statusField = definition.statusField;
74
120
  }
75
- if (JSON.stringify(definition.valuesForInProgress) !==
76
- JSON.stringify(state.valuesForInProgress)) {
121
+ if (JSON.stringify(definition.valuesForInProgress) !== JSON.stringify(state.valuesForInProgress)) {
77
122
  response.valuesForInProgress = definition.valuesForInProgress;
78
123
  }
79
- if (definition.checkAgentCapacityOnReassignedWorkItems !==
80
- state.checkAgentCapacityOnReassignedWorkItems) {
81
- response.checkAgentCapacityOnReassignedWorkItems =
82
- definition.checkAgentCapacityOnReassignedWorkItems;
124
+ if (definition.checkAgentCapacityOnReassignedWorkItems !== state.checkAgentCapacityOnReassignedWorkItems) {
125
+ response.checkAgentCapacityOnReassignedWorkItems = definition.checkAgentCapacityOnReassignedWorkItems;
83
126
  }
84
- if (definition.checkAgentCapacityOnReopenedWorkItems !==
85
- state.checkAgentCapacityOnReopenedWorkItems) {
86
- response.checkAgentCapacityOnReopenedWorkItems =
87
- definition.checkAgentCapacityOnReopenedWorkItems;
127
+ if (definition.checkAgentCapacityOnReopenedWorkItems !== state.checkAgentCapacityOnReopenedWorkItems) {
128
+ response.checkAgentCapacityOnReopenedWorkItems = definition.checkAgentCapacityOnReopenedWorkItems;
88
129
  }
89
130
  }
90
131
  return Object.keys(response).length ? response : undefined;
91
132
  }
92
133
  async apply(config) {
93
- const conn = this.org.getConnection();
94
- // Query for the service channel
95
- const serviceChannelDeveloperName = config.serviceChannelDeveloperName;
96
- const serviceChannel = await conn.singleRecordQuery(`SELECT Id FROM ServiceChannel WHERE DeveloperName='${serviceChannelDeveloperName}'`);
97
- // Open the service channel setup page
98
- const page = await this.browserforce.openPage(`${serviceChannel.Id}/e`);
99
- // Update the service channel config
100
- const configCapacity = config.capacity;
101
- if (configCapacity?.capacityModel) {
102
- await page
103
- .locator(CAPACITY_MODEL_SELECTOR)
104
- .selectOption(configCapacity.capacityModel);
105
- }
106
- if (configCapacity?.statusField) {
107
- await page
108
- .locator(STATUS_FIELD_SELECTOR)
109
- .selectOption(configCapacity.statusField);
110
- }
111
- // TODO: find another condition
112
- await page.waitForLoadState('networkidle');
113
- if (configCapacity?.valuesForInProgress) {
114
- const completedOptions = await page
115
- .locator(`${VALUES_COMPLETED_SELECTOR} > option:not(:disabled)`)
116
- .evaluateAll((options) => {
117
- return options.map((option) => option.title);
118
- });
119
- const inProgressOptions = await page
120
- .locator(`${VALUES_IN_PROGRESS_SELECTOR} > option:not(:disabled)`)
121
- .evaluateAll((options) => {
122
- return options.map((option) => option.title);
123
- });
124
- for (const optionTitle of completedOptions) {
125
- if (configCapacity.valuesForInProgress.includes(optionTitle)) {
126
- await page
127
- .getByRole('option', { name: optionTitle, exact: true })
128
- .click();
129
- await page.locator(ADD_BUTTON_SELECTOR).click();
130
- }
134
+ const env_2 = { stack: [], error: void 0, hasError: false };
135
+ try {
136
+ // Query for the service channel
137
+ const serviceChannelDeveloperName = config.serviceChannelDeveloperName;
138
+ const serviceChannel = await this.browserforce.connection.singleRecordQuery(`SELECT Id FROM ServiceChannel WHERE DeveloperName='${serviceChannelDeveloperName}'`);
139
+ // Open the service channel setup page
140
+ const page = __addDisposableResource(env_2, await this.browserforce.openPage(`/${serviceChannel.Id}/e`), true);
141
+ // Update the service channel config
142
+ const configCapacity = config.capacity;
143
+ if (configCapacity?.capacityModel) {
144
+ await page.locator(CAPACITY_MODEL_SELECTOR).selectOption(configCapacity.capacityModel);
131
145
  }
132
- for (const optionTitle of inProgressOptions) {
133
- if (!configCapacity.valuesForInProgress.includes(optionTitle)) {
134
- await page
135
- .getByRole('option', { name: optionTitle, exact: true })
136
- .click();
137
- await page.locator(REMOVE_BUTTON_SELECTOR).click();
146
+ if (configCapacity?.statusField) {
147
+ await page.locator(STATUS_FIELD_SELECTOR).selectOption(configCapacity.statusField);
148
+ }
149
+ // TODO: find another condition
150
+ await page.waitForLoadState('networkidle');
151
+ if (configCapacity?.valuesForInProgress) {
152
+ const completedOptionsLocator = page.locator(VALUES_COMPLETED_SELECTOR).locator('option:not(:disabled)');
153
+ const completedOptions = await Promise.all((await completedOptionsLocator.all()).map((option) => option.getAttribute('title')));
154
+ const inProgressOptionsLocator = page.locator(VALUES_IN_PROGRESS_SELECTOR).locator('option:not(:disabled)');
155
+ const inProgressOptions = await Promise.all((await inProgressOptionsLocator.all()).map((option) => option.getAttribute('title')));
156
+ for (const optionTitle of completedOptions) {
157
+ if (configCapacity.valuesForInProgress.includes(optionTitle)) {
158
+ await page.getByRole('option', { name: optionTitle, exact: true }).click();
159
+ await page.locator(ADD_BUTTON_SELECTOR).click();
160
+ }
161
+ }
162
+ for (const optionTitle of inProgressOptions) {
163
+ if (!configCapacity.valuesForInProgress.includes(optionTitle)) {
164
+ await page.getByRole('option', { name: optionTitle, exact: true }).click();
165
+ await page.locator(REMOVE_BUTTON_SELECTOR).click();
166
+ }
138
167
  }
139
168
  }
169
+ if (configCapacity?.checkAgentCapacityOnReassignedWorkItems !== undefined) {
170
+ await page
171
+ .locator(STATUS_CHANGE_CAPACITY_SELECTOR)
172
+ .setChecked(configCapacity.checkAgentCapacityOnReassignedWorkItems);
173
+ }
174
+ if (configCapacity?.checkAgentCapacityOnReopenedWorkItems !== undefined) {
175
+ await page
176
+ .locator(OWNER_CHANGE_CAPACITY_SELECTOR)
177
+ .setChecked(configCapacity.checkAgentCapacityOnReopenedWorkItems);
178
+ }
179
+ // Save the settings and wait for page refresh
180
+ await page.locator(SAVE_BUTTON_SELECTOR).first().click();
181
+ await Promise.race([page.waitForURL((url) => !url.pathname.endsWith('/e')), waitForPageErrors(page)]);
140
182
  }
141
- if (configCapacity?.checkAgentCapacityOnReassignedWorkItems !== undefined) {
142
- await page
143
- .locator(STATUS_CHANGE_CAPACITY_SELECTOR)
144
- .setChecked(configCapacity.checkAgentCapacityOnReassignedWorkItems);
183
+ catch (e_2) {
184
+ env_2.error = e_2;
185
+ env_2.hasError = true;
145
186
  }
146
- if (configCapacity?.checkAgentCapacityOnReopenedWorkItems !== undefined) {
147
- await page
148
- .locator(OWNER_CHANGE_CAPACITY_SELECTOR)
149
- .setChecked(configCapacity.checkAgentCapacityOnReopenedWorkItems);
187
+ finally {
188
+ const result_2 = __disposeResources(env_2);
189
+ if (result_2)
190
+ await result_2;
150
191
  }
151
- // Save the settings and wait for page refresh
152
- await page.locator(SAVE_BUTTON_SELECTOR).first().click();
153
- await Promise.race([
154
- page.waitForURL((url) => !url.pathname.endsWith('/e')),
155
- waitForPageErrors(page),
156
- ]);
157
- // Close the page
158
- await page.close();
159
192
  }
160
193
  }
161
194
  //# sourceMappingURL=index.js.map