sf-browserforce 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +266 -0
  3. package/bin/run +9 -0
  4. package/bin/run.cmd +3 -0
  5. package/lib/browserforce-command.d.ts +27 -0
  6. package/lib/browserforce-command.js +162 -0
  7. package/lib/browserforce-command.js.map +1 -0
  8. package/lib/browserforce.d.ts +27 -0
  9. package/lib/browserforce.js +163 -0
  10. package/lib/browserforce.js.map +1 -0
  11. package/lib/commands/browserforce/apply.d.ts +10 -0
  12. package/lib/commands/browserforce/apply.js +83 -0
  13. package/lib/commands/browserforce/apply.js.map +1 -0
  14. package/lib/commands/browserforce/playwright.d.ts +9 -0
  15. package/lib/commands/browserforce/playwright.js +53 -0
  16. package/lib/commands/browserforce/playwright.js.map +1 -0
  17. package/lib/config-parser.d.ts +16 -0
  18. package/lib/config-parser.js +24 -0
  19. package/lib/config-parser.js.map +1 -0
  20. package/lib/index.d.ts +1 -0
  21. package/lib/index.js +2 -0
  22. package/lib/index.js.map +1 -0
  23. package/lib/jsforce-utils.d.ts +5 -0
  24. package/lib/jsforce-utils.js +14 -0
  25. package/lib/jsforce-utils.js.map +1 -0
  26. package/lib/pages/login.d.ts +7 -0
  27. package/lib/pages/login.js +17 -0
  28. package/lib/pages/login.js.map +1 -0
  29. package/lib/plugin.d.ts +15 -0
  30. package/lib/plugin.js +28 -0
  31. package/lib/plugin.js.map +1 -0
  32. package/lib/plugins/activity-settings/index.d.ts +9 -0
  33. package/lib/plugins/activity-settings/index.e2e-spec.d.ts +1 -0
  34. package/lib/plugins/activity-settings/index.e2e-spec.js +36 -0
  35. package/lib/plugins/activity-settings/index.e2e-spec.js.map +1 -0
  36. package/lib/plugins/activity-settings/index.js +102 -0
  37. package/lib/plugins/activity-settings/index.js.map +1 -0
  38. package/lib/plugins/auth-providers/index.d.ts +13 -0
  39. package/lib/plugins/auth-providers/index.e2e-spec.d.ts +1 -0
  40. package/lib/plugins/auth-providers/index.e2e-spec.js +78 -0
  41. package/lib/plugins/auth-providers/index.e2e-spec.js.map +1 -0
  42. package/lib/plugins/auth-providers/index.js +135 -0
  43. package/lib/plugins/auth-providers/index.js.map +1 -0
  44. package/lib/plugins/company-information/index.d.ts +8 -0
  45. package/lib/plugins/company-information/index.e2e-spec.d.ts +1 -0
  46. package/lib/plugins/company-information/index.e2e-spec.js +37 -0
  47. package/lib/plugins/company-information/index.e2e-spec.js.map +1 -0
  48. package/lib/plugins/company-information/index.js +114 -0
  49. package/lib/plugins/company-information/index.js.map +1 -0
  50. package/lib/plugins/customer-portal/available-custom-objects/index.d.ts +14 -0
  51. package/lib/plugins/customer-portal/available-custom-objects/index.js +203 -0
  52. package/lib/plugins/customer-portal/available-custom-objects/index.js.map +1 -0
  53. package/lib/plugins/customer-portal/available-custom-objects/index.test.d.ts +1 -0
  54. package/lib/plugins/customer-portal/available-custom-objects/index.test.js +39 -0
  55. package/lib/plugins/customer-portal/available-custom-objects/index.test.js.map +1 -0
  56. package/lib/plugins/customer-portal/enabled/index.d.ts +6 -0
  57. package/lib/plugins/customer-portal/enabled/index.js +89 -0
  58. package/lib/plugins/customer-portal/enabled/index.js.map +1 -0
  59. package/lib/plugins/customer-portal/enabled/index.test.d.ts +1 -0
  60. package/lib/plugins/customer-portal/enabled/index.test.js +34 -0
  61. package/lib/plugins/customer-portal/enabled/index.test.js.map +1 -0
  62. package/lib/plugins/customer-portal/index.d.ts +15 -0
  63. package/lib/plugins/customer-portal/index.e2e-spec.d.ts +1 -0
  64. package/lib/plugins/customer-portal/index.e2e-spec.js +188 -0
  65. package/lib/plugins/customer-portal/index.e2e-spec.js.map +1 -0
  66. package/lib/plugins/customer-portal/index.js +58 -0
  67. package/lib/plugins/customer-portal/index.js.map +1 -0
  68. package/lib/plugins/customer-portal/index.test.d.ts +1 -0
  69. package/lib/plugins/customer-portal/index.test.js +84 -0
  70. package/lib/plugins/customer-portal/index.test.js.map +1 -0
  71. package/lib/plugins/customer-portal/portals/index.d.ts +25 -0
  72. package/lib/plugins/customer-portal/portals/index.js +254 -0
  73. package/lib/plugins/customer-portal/portals/index.js.map +1 -0
  74. package/lib/plugins/customer-portal/portals/index.test.d.ts +1 -0
  75. package/lib/plugins/customer-portal/portals/index.test.js +140 -0
  76. package/lib/plugins/customer-portal/portals/index.test.js.map +1 -0
  77. package/lib/plugins/density-settings/index.d.ts +10 -0
  78. package/lib/plugins/density-settings/index.e2e-spec.d.ts +1 -0
  79. package/lib/plugins/density-settings/index.e2e-spec.js +39 -0
  80. package/lib/plugins/density-settings/index.e2e-spec.js.map +1 -0
  81. package/lib/plugins/density-settings/index.js +101 -0
  82. package/lib/plugins/density-settings/index.js.map +1 -0
  83. package/lib/plugins/deprecated.d.ts +4 -0
  84. package/lib/plugins/deprecated.js +28 -0
  85. package/lib/plugins/deprecated.js.map +1 -0
  86. package/lib/plugins/email-deliverability/index.d.ts +9 -0
  87. package/lib/plugins/email-deliverability/index.e2e-spec.d.ts +1 -0
  88. package/lib/plugins/email-deliverability/index.e2e-spec.js +55 -0
  89. package/lib/plugins/email-deliverability/index.e2e-spec.js.map +1 -0
  90. package/lib/plugins/email-deliverability/index.js +109 -0
  91. package/lib/plugins/email-deliverability/index.js.map +1 -0
  92. package/lib/plugins/high-velocity-sales-settings/index.d.ts +10 -0
  93. package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.d.ts +1 -0
  94. package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.js +29 -0
  95. package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.js.map +1 -0
  96. package/lib/plugins/high-velocity-sales-settings/index.js +105 -0
  97. package/lib/plugins/high-velocity-sales-settings/index.js.map +1 -0
  98. package/lib/plugins/high-velocity-sales-settings/page.d.ts +8 -0
  99. package/lib/plugins/high-velocity-sales-settings/page.js +27 -0
  100. package/lib/plugins/high-velocity-sales-settings/page.js.map +1 -0
  101. package/lib/plugins/history-tracking/index.d.ts +19 -0
  102. package/lib/plugins/history-tracking/index.e2e-spec.d.ts +1 -0
  103. package/lib/plugins/history-tracking/index.e2e-spec.js +128 -0
  104. package/lib/plugins/history-tracking/index.e2e-spec.js.map +1 -0
  105. package/lib/plugins/history-tracking/index.js +272 -0
  106. package/lib/plugins/history-tracking/index.js.map +1 -0
  107. package/lib/plugins/home-page-layouts/index.d.ts +14 -0
  108. package/lib/plugins/home-page-layouts/index.e2e-spec.d.ts +1 -0
  109. package/lib/plugins/home-page-layouts/index.e2e-spec.js +47 -0
  110. package/lib/plugins/home-page-layouts/index.e2e-spec.js.map +1 -0
  111. package/lib/plugins/home-page-layouts/index.js +145 -0
  112. package/lib/plugins/home-page-layouts/index.js.map +1 -0
  113. package/lib/plugins/home-page-layouts/index.test.d.ts +1 -0
  114. package/lib/plugins/home-page-layouts/index.test.js +104 -0
  115. package/lib/plugins/home-page-layouts/index.test.js.map +1 -0
  116. package/lib/plugins/index.d.ts +28 -0
  117. package/lib/plugins/index.js +29 -0
  118. package/lib/plugins/index.js.map +1 -0
  119. package/lib/plugins/lightning-experience-settings/index.d.ts +17 -0
  120. package/lib/plugins/lightning-experience-settings/index.e2e-spec.d.ts +1 -0
  121. package/lib/plugins/lightning-experience-settings/index.e2e-spec.js +48 -0
  122. package/lib/plugins/lightning-experience-settings/index.e2e-spec.js.map +1 -0
  123. package/lib/plugins/lightning-experience-settings/index.js +149 -0
  124. package/lib/plugins/lightning-experience-settings/index.js.map +1 -0
  125. package/lib/plugins/linkedin-sales-navigator-settings/index.d.ts +8 -0
  126. package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.d.ts +1 -0
  127. package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.js +29 -0
  128. package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.js.map +1 -0
  129. package/lib/plugins/linkedin-sales-navigator-settings/index.js +93 -0
  130. package/lib/plugins/linkedin-sales-navigator-settings/index.js.map +1 -0
  131. package/lib/plugins/linkedin-sales-navigator-settings/page.d.ts +9 -0
  132. package/lib/plugins/linkedin-sales-navigator-settings/page.js +35 -0
  133. package/lib/plugins/linkedin-sales-navigator-settings/page.js.map +1 -0
  134. package/lib/plugins/login-as-user/index.d.ts +9 -0
  135. package/lib/plugins/login-as-user/index.js +104 -0
  136. package/lib/plugins/login-as-user/index.js.map +1 -0
  137. package/lib/plugins/logout-login-as-user/index.d.ts +6 -0
  138. package/lib/plugins/logout-login-as-user/index.js +76 -0
  139. package/lib/plugins/logout-login-as-user/index.js.map +1 -0
  140. package/lib/plugins/omni-channel-settings/index.d.ts +9 -0
  141. package/lib/plugins/omni-channel-settings/index.e2e-spec.d.ts +1 -0
  142. package/lib/plugins/omni-channel-settings/index.e2e-spec.js +30 -0
  143. package/lib/plugins/omni-channel-settings/index.e2e-spec.js.map +1 -0
  144. package/lib/plugins/omni-channel-settings/index.js +97 -0
  145. package/lib/plugins/omni-channel-settings/index.js.map +1 -0
  146. package/lib/plugins/opportunity-splits/index.d.ts +9 -0
  147. package/lib/plugins/opportunity-splits/index.e2e-spec.d.ts +1 -0
  148. package/lib/plugins/opportunity-splits/index.e2e-spec.js +46 -0
  149. package/lib/plugins/opportunity-splits/index.e2e-spec.js.map +1 -0
  150. package/lib/plugins/opportunity-splits/index.js +117 -0
  151. package/lib/plugins/opportunity-splits/index.js.map +1 -0
  152. package/lib/plugins/opportunity-splits/pages/layout-selection.d.ts +8 -0
  153. package/lib/plugins/opportunity-splits/pages/layout-selection.js +15 -0
  154. package/lib/plugins/opportunity-splits/pages/layout-selection.js.map +1 -0
  155. package/lib/plugins/opportunity-splits/pages/overview.d.ts +11 -0
  156. package/lib/plugins/opportunity-splits/pages/overview.js +32 -0
  157. package/lib/plugins/opportunity-splits/pages/overview.js.map +1 -0
  158. package/lib/plugins/opportunity-splits/pages/setup.d.ts +9 -0
  159. package/lib/plugins/opportunity-splits/pages/setup.js +17 -0
  160. package/lib/plugins/opportunity-splits/pages/setup.js.map +1 -0
  161. package/lib/plugins/permission-sets/index.d.ts +10 -0
  162. package/lib/plugins/permission-sets/index.e2e-spec.d.ts +1 -0
  163. package/lib/plugins/permission-sets/index.e2e-spec.js +47 -0
  164. package/lib/plugins/permission-sets/index.e2e-spec.js.map +1 -0
  165. package/lib/plugins/permission-sets/index.js +22 -0
  166. package/lib/plugins/permission-sets/index.js.map +1 -0
  167. package/lib/plugins/permission-sets/service-presence-status/index.d.ts +10 -0
  168. package/lib/plugins/permission-sets/service-presence-status/index.js +124 -0
  169. package/lib/plugins/permission-sets/service-presence-status/index.js.map +1 -0
  170. package/lib/plugins/picklists/field-dependencies/index.d.ts +11 -0
  171. package/lib/plugins/picklists/field-dependencies/index.js +133 -0
  172. package/lib/plugins/picklists/field-dependencies/index.js.map +1 -0
  173. package/lib/plugins/picklists/field-dependencies/index.test.d.ts +1 -0
  174. package/lib/plugins/picklists/field-dependencies/index.test.js +64 -0
  175. package/lib/plugins/picklists/field-dependencies/index.test.js.map +1 -0
  176. package/lib/plugins/picklists/field-dependencies/pages.d.ts +15 -0
  177. package/lib/plugins/picklists/field-dependencies/pages.js +50 -0
  178. package/lib/plugins/picklists/field-dependencies/pages.js.map +1 -0
  179. package/lib/plugins/picklists/index.d.ts +23 -0
  180. package/lib/plugins/picklists/index.e2e-spec.d.ts +1 -0
  181. package/lib/plugins/picklists/index.e2e-spec.js +128 -0
  182. package/lib/plugins/picklists/index.e2e-spec.js.map +1 -0
  183. package/lib/plugins/picklists/index.js +229 -0
  184. package/lib/plugins/picklists/index.js.map +1 -0
  185. package/lib/plugins/picklists/pages.d.ts +45 -0
  186. package/lib/plugins/picklists/pages.js +185 -0
  187. package/lib/plugins/picklists/pages.js.map +1 -0
  188. package/lib/plugins/picklists/standard-value-set.d.ts +1 -0
  189. package/lib/plugins/picklists/standard-value-set.js +80 -0
  190. package/lib/plugins/picklists/standard-value-set.js.map +1 -0
  191. package/lib/plugins/record-types/index.d.ts +14 -0
  192. package/lib/plugins/record-types/index.e2e-spec.d.ts +1 -0
  193. package/lib/plugins/record-types/index.e2e-spec.js +76 -0
  194. package/lib/plugins/record-types/index.e2e-spec.js.map +1 -0
  195. package/lib/plugins/record-types/index.js +133 -0
  196. package/lib/plugins/record-types/index.js.map +1 -0
  197. package/lib/plugins/record-types/pages.d.ts +14 -0
  198. package/lib/plugins/record-types/pages.js +50 -0
  199. package/lib/plugins/record-types/pages.js.map +1 -0
  200. package/lib/plugins/relate-contact-to-multiple-accounts/index.d.ts +11 -0
  201. package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.d.ts +1 -0
  202. package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.js +30 -0
  203. package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.js.map +1 -0
  204. package/lib/plugins/relate-contact-to-multiple-accounts/index.js +120 -0
  205. package/lib/plugins/relate-contact-to-multiple-accounts/index.js.map +1 -0
  206. package/lib/plugins/reports-and-dashboards/folder-sharing/index.d.ts +8 -0
  207. package/lib/plugins/reports-and-dashboards/folder-sharing/index.e2e-spec.d.ts +1 -0
  208. package/lib/plugins/reports-and-dashboards/folder-sharing/index.e2e-spec.js +3 -0
  209. package/lib/plugins/reports-and-dashboards/folder-sharing/index.e2e-spec.js.map +1 -0
  210. package/lib/plugins/reports-and-dashboards/folder-sharing/index.js +116 -0
  211. package/lib/plugins/reports-and-dashboards/folder-sharing/index.js.map +1 -0
  212. package/lib/plugins/reports-and-dashboards/index.d.ts +11 -0
  213. package/lib/plugins/reports-and-dashboards/index.e2e-spec.d.ts +1 -0
  214. package/lib/plugins/reports-and-dashboards/index.e2e-spec.js +3 -0
  215. package/lib/plugins/reports-and-dashboards/index.e2e-spec.js.map +1 -0
  216. package/lib/plugins/reports-and-dashboards/index.js +29 -0
  217. package/lib/plugins/reports-and-dashboards/index.js.map +1 -0
  218. package/lib/plugins/salesforce-cpq-config/formConfig.d.ts +17 -0
  219. package/lib/plugins/salesforce-cpq-config/formConfig.js +649 -0
  220. package/lib/plugins/salesforce-cpq-config/formConfig.js.map +1 -0
  221. package/lib/plugins/salesforce-cpq-config/index.d.ts +7 -0
  222. package/lib/plugins/salesforce-cpq-config/index.e2e-spec.d.ts +1 -0
  223. package/lib/plugins/salesforce-cpq-config/index.e2e-spec.js +37 -0
  224. package/lib/plugins/salesforce-cpq-config/index.e2e-spec.js.map +1 -0
  225. package/lib/plugins/salesforce-cpq-config/index.js +261 -0
  226. package/lib/plugins/salesforce-cpq-config/index.js.map +1 -0
  227. package/lib/plugins/salesforce-to-salesforce/index.d.ts +9 -0
  228. package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.d.ts +1 -0
  229. package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.js +34 -0
  230. package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.js.map +1 -0
  231. package/lib/plugins/salesforce-to-salesforce/index.js +107 -0
  232. package/lib/plugins/salesforce-to-salesforce/index.js.map +1 -0
  233. package/lib/plugins/scheduled-batches/index.d.ts +10 -0
  234. package/lib/plugins/scheduled-batches/index.js +145 -0
  235. package/lib/plugins/scheduled-batches/index.js.map +1 -0
  236. package/lib/plugins/scheduled-batches/page.d.ts +19 -0
  237. package/lib/plugins/scheduled-batches/page.js +39 -0
  238. package/lib/plugins/scheduled-batches/page.js.map +1 -0
  239. package/lib/plugins/security/authentication-configuration/index.d.ts +15 -0
  240. package/lib/plugins/security/authentication-configuration/index.e2e-spec.d.ts +1 -0
  241. package/lib/plugins/security/authentication-configuration/index.e2e-spec.js +129 -0
  242. package/lib/plugins/security/authentication-configuration/index.e2e-spec.js.map +1 -0
  243. package/lib/plugins/security/authentication-configuration/index.js +200 -0
  244. package/lib/plugins/security/authentication-configuration/index.js.map +1 -0
  245. package/lib/plugins/security/certificate-and-key-management/index.d.ts +23 -0
  246. package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.d.ts +1 -0
  247. package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.js +59 -0
  248. package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.js.map +1 -0
  249. package/lib/plugins/security/certificate-and-key-management/index.js +233 -0
  250. package/lib/plugins/security/certificate-and-key-management/index.js.map +1 -0
  251. package/lib/plugins/security/certificate-and-key-management/index.test.d.ts +1 -0
  252. package/lib/plugins/security/certificate-and-key-management/index.test.js +61 -0
  253. package/lib/plugins/security/certificate-and-key-management/index.test.js.map +1 -0
  254. package/lib/plugins/security/index.d.ts +13 -0
  255. package/lib/plugins/security/index.js +41 -0
  256. package/lib/plugins/security/index.js.map +1 -0
  257. package/lib/plugins/service-channels/capacity/index.d.ts +18 -0
  258. package/lib/plugins/service-channels/capacity/index.js +194 -0
  259. package/lib/plugins/service-channels/capacity/index.js.map +1 -0
  260. package/lib/plugins/service-channels/index.d.ts +12 -0
  261. package/lib/plugins/service-channels/index.e2e-spec.d.ts +1 -0
  262. package/lib/plugins/service-channels/index.e2e-spec.js +67 -0
  263. package/lib/plugins/service-channels/index.e2e-spec.js.map +1 -0
  264. package/lib/plugins/service-channels/index.js +37 -0
  265. package/lib/plugins/service-channels/index.js.map +1 -0
  266. package/lib/plugins/slack/index.d.ts +9 -0
  267. package/lib/plugins/slack/index.e2e-spec.d.ts +1 -0
  268. package/lib/plugins/slack/index.e2e-spec.js +47 -0
  269. package/lib/plugins/slack/index.e2e-spec.js.map +1 -0
  270. package/lib/plugins/slack/index.js +111 -0
  271. package/lib/plugins/slack/index.js.map +1 -0
  272. package/lib/plugins/user-access-policies/index.d.ts +19 -0
  273. package/lib/plugins/user-access-policies/index.e2e-spec.d.ts +1 -0
  274. package/lib/plugins/user-access-policies/index.e2e-spec.js +61 -0
  275. package/lib/plugins/user-access-policies/index.e2e-spec.js.map +1 -0
  276. package/lib/plugins/user-access-policies/index.js +176 -0
  277. package/lib/plugins/user-access-policies/index.js.map +1 -0
  278. package/lib/plugins/user-access-policies/page.d.ts +30 -0
  279. package/lib/plugins/user-access-policies/page.js +114 -0
  280. package/lib/plugins/user-access-policies/page.js.map +1 -0
  281. package/lib/plugins/utils.d.ts +13 -0
  282. package/lib/plugins/utils.js +159 -0
  283. package/lib/plugins/utils.js.map +1 -0
  284. package/oclif.manifest.json +177 -0
  285. package/package.json +65 -0
@@ -0,0 +1,67 @@
1
+ import assert from 'assert';
2
+ import * as child from 'child_process';
3
+ import { fileURLToPath } from 'node:url';
4
+ import * as path from 'path';
5
+ import { ServiceChannels } from './index.js';
6
+ import { OmniChannelSettings } from '../omni-channel-settings/index.js';
7
+ const __dirname = fileURLToPath(new URL('.', import.meta.url));
8
+ describe(ServiceChannels.name, function () {
9
+ this.timeout('10m');
10
+ let plugin;
11
+ before(() => {
12
+ plugin = new ServiceChannels(global.browserforce);
13
+ });
14
+ const configureServiceChannels = [
15
+ {
16
+ serviceChannelDeveloperName: 'CaseTest',
17
+ capacity: {
18
+ capacityModel: 'StatusBased',
19
+ statusField: 'Case.Type',
20
+ valuesForInProgress: ['Electrical', 'Mechanical'],
21
+ checkAgentCapacityOnReopenedWorkItems: true,
22
+ checkAgentCapacityOnReassignedWorkItems: true,
23
+ },
24
+ },
25
+ {
26
+ serviceChannelDeveloperName: 'LeadTest',
27
+ capacity: {
28
+ capacityModel: 'StatusBased',
29
+ statusField: 'Lead.Industry',
30
+ valuesForInProgress: ['Agriculture', 'Chemicals'],
31
+ checkAgentCapacityOnReopenedWorkItems: true,
32
+ checkAgentCapacityOnReassignedWorkItems: true,
33
+ },
34
+ },
35
+ ];
36
+ it('should disable status based capacity model', async () => {
37
+ const omnniChannelPlugin = new OmniChannelSettings(global.browserforce);
38
+ await omnniChannelPlugin.run({ enableStatusBasedCapacityModel: false });
39
+ });
40
+ it('should create service channel as a prerequisite', () => {
41
+ const sourceDeployCmd = child.spawnSync('sf', [
42
+ 'project',
43
+ 'deploy',
44
+ 'start',
45
+ '-d',
46
+ path.join(__dirname, 'sfdx-source'),
47
+ '--json',
48
+ ]);
49
+ assert.deepStrictEqual(sourceDeployCmd.status, 0, sourceDeployCmd.output.toString());
50
+ });
51
+ it('should enable status based capacity model as a prerequisite', async () => {
52
+ const omnniChannelPlugin = new OmniChannelSettings(global.browserforce);
53
+ await omnniChannelPlugin.run({ enableStatusBasedCapacityModel: true });
54
+ });
55
+ it('should configure status based capacity model for service channels', async () => {
56
+ await plugin.run(configureServiceChannels);
57
+ const res = await plugin.retrieve(configureServiceChannels);
58
+ assert.deepStrictEqual(res, configureServiceChannels);
59
+ });
60
+ it('should delete Service Channels', async () => {
61
+ const result = await global.browserforce.connection.query("SELECT Id FROM ServiceChannel WHERE DeveloperName IN ('CaseTest', 'LeadTest')");
62
+ if (result.records?.length) {
63
+ await global.browserforce.connection.delete('ServiceChannel', result.records.map((r) => r.Id));
64
+ }
65
+ });
66
+ });
67
+ //# sourceMappingURL=index.e2e-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.e2e-spec.js","sourceRoot":"","sources":["../../../src/plugins/service-channels/index.e2e-spec.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,QAAQ,CAAC,eAAe,CAAC,IAAI,EAAE;IAC7B,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,IAAI,MAAuB,CAAC;IAC5B,MAAM,CAAC,GAAG,EAAE;QACV,MAAM,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,MAAM,wBAAwB,GAAG;QAC/B;YACE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8B,EAAE,IAAI,EAAE,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mEAAmE,EAAE,KAAK,IAAI,EAAE;QACjF,MAAM,MAAM,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;QAC3C,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC;QAC5D,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,wBAAwB,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE,KAAK,IAAI,EAAE;QAC9C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,CACvD,+EAA+E,CAChF,CAAC;QACF,IAAI,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;YAC3B,MAAM,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,CACzC,gBAAgB,EAChB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAChC,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { BrowserforcePlugin } from '../../plugin.js';
2
+ import { Capacity } from './capacity/index.js';
3
+ export class ServiceChannels extends BrowserforcePlugin {
4
+ async retrieve(definition) {
5
+ const pluginCapacity = new Capacity(this.browserforce);
6
+ const serviceChannels = [];
7
+ for (const serviceChannel of definition) {
8
+ serviceChannels.push({
9
+ serviceChannelDeveloperName: serviceChannel.serviceChannelDeveloperName,
10
+ capacity: await pluginCapacity.retrieve(serviceChannel),
11
+ });
12
+ }
13
+ return serviceChannels;
14
+ }
15
+ diff(state, definition) {
16
+ const pluginCapacity = new Capacity(this.browserforce);
17
+ const serviceChannels = [];
18
+ for (const serviceChannelDefinition of definition) {
19
+ const serviceChannelState = state.find((serviceChannelState) => serviceChannelState.serviceChannelDeveloperName === serviceChannelDefinition.serviceChannelDeveloperName);
20
+ const capacity = pluginCapacity.diff(serviceChannelState.capacity, serviceChannelDefinition.capacity);
21
+ if (capacity !== undefined) {
22
+ serviceChannels.push({
23
+ serviceChannelDeveloperName: serviceChannelDefinition.serviceChannelDeveloperName,
24
+ capacity,
25
+ });
26
+ }
27
+ }
28
+ return serviceChannels.length ? serviceChannels : undefined;
29
+ }
30
+ async apply(plan) {
31
+ const pluginCapacity = new Capacity(this.browserforce);
32
+ for (const serviceChannel of plan) {
33
+ await pluginCapacity.apply(serviceChannel);
34
+ }
35
+ }
36
+ }
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/service-channels/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAkB,MAAM,qBAAqB,CAAC;AAO/D,MAAM,OAAO,eAAgB,SAAQ,kBAAkB;IAC9C,KAAK,CAAC,QAAQ,CAAC,UAA6B;QACjD,MAAM,cAAc,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAEvD,MAAM,eAAe,GAAqB,EAAE,CAAC;QAE7C,KAAK,MAAM,cAAc,IAAI,UAAU,EAAE,CAAC;YACxC,eAAe,CAAC,IAAI,CAAC;gBACnB,2BAA2B,EAAE,cAAc,CAAC,2BAA2B;gBACvE,QAAQ,EAAE,MAAM,cAAc,CAAC,QAAQ,CAAC,cAAc,CAAC;aACxD,CAAC,CAAC;QACL,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;IAEM,IAAI,CAAC,KAAuB,EAAE,UAA4B;QAC/D,MAAM,cAAc,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAEvD,MAAM,eAAe,GAAqB,EAAE,CAAC;QAE7C,KAAK,MAAM,wBAAwB,IAAI,UAAU,EAAE,CAAC;YAClD,MAAM,mBAAmB,GAAG,KAAK,CAAC,IAAI,CACpC,CAAC,mBAAmB,EAAE,EAAE,CACtB,mBAAmB,CAAC,2BAA2B,KAAK,wBAAwB,CAAC,2BAA2B,CAC3G,CAAC;YAEF,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAAC;YAEtG,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,eAAe,CAAC,IAAI,CAAC;oBACnB,2BAA2B,EAAE,wBAAwB,CAAC,2BAA2B;oBACjF,QAAQ;iBACT,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9D,CAAC;IAEM,KAAK,CAAC,KAAK,CAAC,IAAsB;QACvC,MAAM,cAAc,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAEvD,KAAK,MAAM,cAAc,IAAI,IAAI,EAAE,CAAC;YAClC,MAAM,cAAc,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ import { BrowserforcePlugin } from '../../plugin.js';
2
+ export type Config = {
3
+ agreeToTermsAndConditions: boolean;
4
+ enableSalesCloudForSlack: boolean;
5
+ };
6
+ export declare class Slack extends BrowserforcePlugin {
7
+ retrieve(definition?: Config): Promise<Config>;
8
+ apply(config: Config): Promise<void>;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,47 @@
1
+ import assert from 'assert';
2
+ import { Slack } from './index.js';
3
+ describe(Slack.name, function () {
4
+ let plugin;
5
+ before(() => {
6
+ plugin = new Slack(global.browserforce);
7
+ });
8
+ const configEnable = {
9
+ agreeToTermsAndConditions: true,
10
+ enableSalesCloudForSlack: true,
11
+ };
12
+ const configDisabledSalesCloud = {
13
+ agreeToTermsAndConditions: true,
14
+ enableSalesCloudForSlack: false,
15
+ };
16
+ const configDisabled = {
17
+ agreeToTermsAndConditions: false,
18
+ enableSalesCloudForSlack: false,
19
+ };
20
+ it('should accept terms and conditions and enable Sales Cloud for Slack', async () => {
21
+ await plugin.run(configEnable);
22
+ });
23
+ it('should already be accepted and enabled', async () => {
24
+ const res = await plugin.run(configEnable);
25
+ assert.deepStrictEqual(res, { message: 'no action necessary' });
26
+ });
27
+ it('should disable Sales Cloud for Slack', async () => {
28
+ await plugin.run(configDisabledSalesCloud);
29
+ });
30
+ it('should already be disabled', async () => {
31
+ const res = await plugin.run(configDisabledSalesCloud);
32
+ assert.deepStrictEqual(res, { message: 'no action necessary' });
33
+ });
34
+ it('should fail to unaccept terms and conditions', async () => {
35
+ let err;
36
+ try {
37
+ await plugin.apply(configDisabled);
38
+ }
39
+ catch (e) {
40
+ err = e;
41
+ }
42
+ assert.throws(() => {
43
+ throw err;
44
+ }, /cannot be unaccepted/);
45
+ });
46
+ });
47
+ //# sourceMappingURL=index.e2e-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.e2e-spec.js","sourceRoot":"","sources":["../../../src/plugins/slack/index.e2e-spec.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAe,KAAK,EAAE,MAAM,YAAY,CAAC;AAEhD,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE;IACnB,IAAI,MAAa,CAAC;IAClB,MAAM,CAAC,GAAG,EAAE;QACV,MAAM,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,MAAM,YAAY,GAAW;QAC3B,yBAAyB,EAAE,IAAI;QAC/B,wBAAwB,EAAE,IAAI;KAC/B,CAAC;IACF,MAAM,wBAAwB,GAAW;QACvC,yBAAyB,E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,CAAC,CAAC"}
@@ -0,0 +1,111 @@
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
+ });
53
+ import { BrowserforcePlugin } from '../../plugin.js';
54
+ const BASE_PATH = '/lightning/setup/SlackSetupAssistant/home';
55
+ const TOS_CHECKBOX = 'setup_service-slack-agree-to-terms input[type="checkbox"]';
56
+ // unfortunately the divs intercept pointer events so we need to click on the label instead
57
+ const TOS_CHECKBOX_TOGGLE = `setup_service-slack-agree-to-terms lightning-primitive-input-toggle`;
58
+ const SALES_CLOUD_FOR_SLACK_CHECKBOX = 'input[type="checkbox"][name="SlkSetupStepSalesCloudForSlack"]';
59
+ // unfortunately the divs intercept pointer events so we need to click on the label instead
60
+ const SALES_CLOUD_FOR_SLACK_CHECKBOX_TOGGLE = `lightning-primitive-input-toggle:has(${SALES_CLOUD_FOR_SLACK_CHECKBOX})`;
61
+ export class Slack extends BrowserforcePlugin {
62
+ async retrieve(definition) {
63
+ const env_1 = { stack: [], error: void 0, hasError: false };
64
+ try {
65
+ const page = __addDisposableResource(env_1, await this.browserforce.openPage(BASE_PATH), true);
66
+ const response = {
67
+ agreeToTermsAndConditions: await page.locator(TOS_CHECKBOX).isChecked(),
68
+ enableSalesCloudForSlack: await page.locator(SALES_CLOUD_FOR_SLACK_CHECKBOX).isChecked(),
69
+ };
70
+ return response;
71
+ }
72
+ catch (e_1) {
73
+ env_1.error = e_1;
74
+ env_1.hasError = true;
75
+ }
76
+ finally {
77
+ const result_1 = __disposeResources(env_1);
78
+ if (result_1)
79
+ await result_1;
80
+ }
81
+ }
82
+ async apply(config) {
83
+ const env_2 = { stack: [], error: void 0, hasError: false };
84
+ try {
85
+ if (config.agreeToTermsAndConditions === false) {
86
+ throw new Error('terms and conditions cannot be unaccepted once accepted');
87
+ }
88
+ const state = await this.retrieve();
89
+ const page = __addDisposableResource(env_2, await this.browserforce.openPage(BASE_PATH), true);
90
+ if (state.agreeToTermsAndConditions !== config.agreeToTermsAndConditions) {
91
+ await Promise.all([page.waitForResponse(/handleSlackBetaTOSPref=1/), page.locator(TOS_CHECKBOX_TOGGLE).click()]);
92
+ }
93
+ if (state.enableSalesCloudForSlack !== config.enableSalesCloudForSlack) {
94
+ await Promise.all([
95
+ page.waitForResponse(/handleSlackSalesAppPrefToggle=1/),
96
+ page.locator(SALES_CLOUD_FOR_SLACK_CHECKBOX_TOGGLE).click(),
97
+ ]);
98
+ }
99
+ }
100
+ catch (e_2) {
101
+ env_2.error = e_2;
102
+ env_2.hasError = true;
103
+ }
104
+ finally {
105
+ const result_2 = __disposeResources(env_2);
106
+ if (result_2)
107
+ await result_2;
108
+ }
109
+ }
110
+ }
111
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/slack/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,SAAS,GAAG,2CAA2C,CAAC;AAE9D,MAAM,YAAY,GAAG,2DAA2D,CAAC;AACjF,2FAA2F;AAC3F,MAAM,mBAAmB,GAAG,qEAAqE,CAAC;AAClG,MAAM,8BAA8B,GAAG,+DAA+D,CAAC;AACvG,2FAA2F;AAC3F,MAAM,qCAAqC,GAAG,wCAAwC,8BAA8B,GAAG,CAAC;AAOxH,MAAM,OAAO,KAAM,SAAQ,kBAAkB;IACpC,KAAK,CAAC,QAAQ,CAAC,UAAmB;;;YACvC,MAAY,IAAI,kCAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAA,CAAC;YAC/D,MAAM,QAAQ,GAAG;gBACf,yBAAyB,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,SAAS,EAAE;gBACvE,wBAAwB,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,8BAA8B,CAAC,CAAC,SAAS,EAAE;aACzF,CAAC;YACF,OAAO,QAAQ,CAAC;;;;;;;;;;;KACjB;IAEM,KAAK,CAAC,KAAK,CAAC,MAAc;;;YAC/B,IAAI,MAAM,CAAC,yBAAyB,KAAK,KAAK,EAAE,CAAC;gBAC/C,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;YAC7E,CAAC;YACD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpC,MAAY,IAAI,kCAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAA,CAAC;YAC/D,IAAI,KAAK,CAAC,yBAAyB,KAAK,MAAM,CAAC,yBAAyB,EAAE,CAAC;gBACzE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,0BAA0B,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YACnH,CAAC;YACD,IAAI,KAAK,CAAC,wBAAwB,KAAK,MAAM,CAAC,wBAAwB,EAAE,CAAC;gBACvE,MAAM,OAAO,CAAC,GAAG,CAAC;oBAChB,IAAI,CAAC,eAAe,CAAC,iCAAiC,CAAC;oBACvD,IAAI,CAAC,OAAO,CAAC,qCAAqC,CAAC,CAAC,KAAK,EAAE;iBAC5D,CAAC,CAAC;YACL,CAAC;;;;;;;;;;;KACF;CACF"}
@@ -0,0 +1,19 @@
1
+ import { BrowserforcePlugin } from '../../plugin.js';
2
+ export type PolicyTriggerType = 'Create' | 'Update' | 'CreateAndUpdate';
3
+ type AccessPolicy = {
4
+ apiName: string;
5
+ active: boolean;
6
+ on?: PolicyTriggerType;
7
+ };
8
+ export type Config = {
9
+ accessPolicies?: AccessPolicy[];
10
+ };
11
+ export declare class UserAccessPolicies extends BrowserforcePlugin {
12
+ private queryPolicies;
13
+ retrieve(definition?: Config): Promise<Config>;
14
+ apply(config: Config): Promise<void>;
15
+ private isValidTriggerType;
16
+ private needsPolicyChange;
17
+ private applyPolicyChange;
18
+ }
19
+ export {};
@@ -0,0 +1,61 @@
1
+ import assert from 'assert';
2
+ import * as child from 'child_process';
3
+ import { readFileSync } from 'node:fs';
4
+ import { fileURLToPath } from 'node:url';
5
+ import * as path from 'path';
6
+ import { UserAccessPolicies } from './index.js';
7
+ const __dirname = fileURLToPath(new URL('.', import.meta.url));
8
+ const readJsonFile = function (u) {
9
+ return JSON.parse(readFileSync(new URL(u, import.meta.url), 'utf8'));
10
+ };
11
+ describe(UserAccessPolicies.name, function () {
12
+ this.timeout('10m');
13
+ let plugin;
14
+ before(() => {
15
+ plugin = new UserAccessPolicies(global.browserforce);
16
+ });
17
+ const configActivate = readJsonFile('./activate.json').settings.userAccessPolicies;
18
+ const configDeactivate = readJsonFile('./deactivate.json').settings.userAccessPolicies;
19
+ const multiConfig = readJsonFile('./multiple-policies.json').settings.userAccessPolicies;
20
+ const changeTriggerConfig = readJsonFile('./change-trigger-type.json').settings.userAccessPolicies;
21
+ it('should deploy a CustomObject for testing', () => {
22
+ const sourceDeployCmd = child.spawnSync('sf', [
23
+ 'project',
24
+ 'deploy',
25
+ 'start',
26
+ '-d',
27
+ path.join(__dirname, 'sfdx-source'),
28
+ '--json',
29
+ ]);
30
+ assert.deepStrictEqual(sourceDeployCmd.status, 0, sourceDeployCmd.output.toString());
31
+ });
32
+ it('should activate policy', async () => {
33
+ await plugin.run(configActivate);
34
+ });
35
+ it('should already be activated on default trigger type', async () => {
36
+ const res = await plugin.run(configActivate);
37
+ assert.deepStrictEqual(res, { message: 'no action necessary' });
38
+ });
39
+ it('should deactivate policy', async () => {
40
+ await plugin.run(configDeactivate);
41
+ });
42
+ it('should already be deactivated', async () => {
43
+ const res = await plugin.run(configDeactivate);
44
+ assert.deepStrictEqual(res, { message: 'no action necessary' });
45
+ });
46
+ it('should handle multiple policies', async () => {
47
+ await plugin.run(multiConfig);
48
+ });
49
+ it('should already have activated multiple policies on provided trigger types', async () => {
50
+ const res = await plugin.run(multiConfig);
51
+ assert.deepStrictEqual(res, { message: 'no action necessary' });
52
+ });
53
+ it('should change trigger type of an already active policy', async () => {
54
+ await plugin.run(changeTriggerConfig);
55
+ });
56
+ it('should already be activated with the new trigger type', async () => {
57
+ const res = await plugin.run(changeTriggerConfig);
58
+ assert.deepStrictEqual(res, { message: 'no action necessary' });
59
+ });
60
+ });
61
+ //# sourceMappingURL=index.e2e-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.e2e-spec.js","sourceRoot":"","sources":["../../../src/plugins/user-access-policies/index.e2e-spec.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,MAAM,YAAY,GAAG,UAAU,CAAS;IACtC,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AACvE,CAAC,CAAC;AAEF,QAAQ,CAAC,kBAAkB,CAAC,IAAI,EAAE;IAChC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,IAAI,MAA0B,CAAC;IAC/B,MAAM,CAAC,GAAG,EAAE;QACV,MAAM,GAAG,IAAI,kBAAkB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,YAAY,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC;IACnF,MAAM,g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C,CAAC;QAC/C,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iCAAiC,EAAE,KAAK,IAAI,EAAE;QAC/C,MAAM,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2EAA2E,EAAE,KAAK,IAAI,EAAE;QACzF,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAC1C,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE,KAAK,IAAI,EAAE;QACtE,MAAM,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uDAAuD,EAAE,KAAK,IAAI,EAAE;QACrE,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QAClD,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,176 @@
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
+ });
53
+ import { BrowserforcePlugin } from '../../plugin.js';
54
+ import { UserAccessPoliciesPage } from './page.js';
55
+ const DEFAULT_TRIGGER_TYPE = 'CreateAndUpdate';
56
+ export class UserAccessPolicies extends BrowserforcePlugin {
57
+ async queryPolicies(policyApiNames) {
58
+ const quotedNames = policyApiNames.map((name) => `'${name}'`);
59
+ const query = `SELECT Id, DeveloperName, Status, TriggerType FROM UserAccessPolicy WHERE DeveloperName IN (${quotedNames.join(',')})`;
60
+ const queryResult = await this.browserforce.connection.tooling.query(query);
61
+ const policyStateMap = new Map();
62
+ const policyIdMap = new Map();
63
+ const policyTriggerTypeMap = new Map();
64
+ for (const record of queryResult.records) {
65
+ policyStateMap.set(record.DeveloperName, record.Status === 'Active');
66
+ policyIdMap.set(record.DeveloperName, record.Id);
67
+ policyTriggerTypeMap.set(record.DeveloperName, record.TriggerType);
68
+ }
69
+ return { policyStateMap, policyIdMap, policyTriggerTypeMap };
70
+ }
71
+ async retrieve(definition) {
72
+ const response = {
73
+ accessPolicies: [],
74
+ };
75
+ if (!definition?.accessPolicies || definition.accessPolicies.length === 0) {
76
+ return response;
77
+ }
78
+ const policyApiNames = definition.accessPolicies.map((policy) => policy.apiName);
79
+ const { policyStateMap, policyTriggerTypeMap } = await this.queryPolicies(policyApiNames);
80
+ for (const policy of definition.accessPolicies) {
81
+ const isActive = policyStateMap.get(policy.apiName) ?? false;
82
+ const triggerType = policyTriggerTypeMap.get(policy.apiName);
83
+ const retrievedPolicy = {
84
+ apiName: policy.apiName,
85
+ active: isActive,
86
+ };
87
+ if (policy.on !== undefined && isActive && triggerType) {
88
+ if (this.isValidTriggerType(triggerType)) {
89
+ retrievedPolicy.on = triggerType;
90
+ }
91
+ }
92
+ response.accessPolicies.push(retrievedPolicy);
93
+ }
94
+ return response;
95
+ }
96
+ async apply(config) {
97
+ if (!config.accessPolicies || config.accessPolicies.length === 0) {
98
+ return;
99
+ }
100
+ const policyApiNames = config.accessPolicies.map((policy) => policy.apiName);
101
+ const { policyStateMap, policyIdMap, policyTriggerTypeMap } = await this.queryPolicies(policyApiNames);
102
+ for (const policy of config.accessPolicies) {
103
+ const currentState = policyStateMap.get(policy.apiName) ?? false;
104
+ const policyId = policyIdMap.get(policy.apiName);
105
+ const currentTriggerType = policyTriggerTypeMap.get(policy.apiName);
106
+ if (!policyId) {
107
+ throw new Error(`User Access Policy "${policy.apiName}" not found`);
108
+ }
109
+ await this.applyPolicyChange(policy, policyId, currentState, currentTriggerType);
110
+ }
111
+ }
112
+ isValidTriggerType(value) {
113
+ return value === 'Create' || value === 'Update' || value === 'CreateAndUpdate';
114
+ }
115
+ needsPolicyChange(policy, currentState, currentTriggerType) {
116
+ if (currentState !== policy.active) {
117
+ return true;
118
+ }
119
+ if (!policy.active) {
120
+ return false;
121
+ }
122
+ if (policy.on && currentTriggerType) {
123
+ return currentTriggerType !== policy.on;
124
+ }
125
+ return false;
126
+ }
127
+ async applyPolicyChange(policy, policyId, currentState, currentTriggerType) {
128
+ const env_1 = { stack: [], error: void 0, hasError: false };
129
+ try {
130
+ const needsChange = this.needsPolicyChange(policy, currentState, currentTriggerType);
131
+ if (!needsChange) {
132
+ return;
133
+ }
134
+ const page = __addDisposableResource(env_1, await this.browserforce.openPage(UserAccessPoliciesPage.getPolicyUrl(policyId)), true);
135
+ const policiesPage = new UserAccessPoliciesPage(page);
136
+ if (policy.active) {
137
+ const needsTriggerTypeChange = currentState && policy.on && currentTriggerType !== policy.on;
138
+ if (needsTriggerTypeChange) {
139
+ const env_2 = { stack: [], error: void 0, hasError: false };
140
+ try {
141
+ await policiesPage.deactivatePolicy();
142
+ const newPage = __addDisposableResource(env_2, await this.browserforce.openPage(UserAccessPoliciesPage.getPolicyUrl(policyId)), true);
143
+ const newPoliciesPage = new UserAccessPoliciesPage(newPage);
144
+ await newPoliciesPage.activatePolicy(policy.on);
145
+ }
146
+ catch (e_1) {
147
+ env_2.error = e_1;
148
+ env_2.hasError = true;
149
+ }
150
+ finally {
151
+ const result_1 = __disposeResources(env_2);
152
+ if (result_1)
153
+ await result_1;
154
+ }
155
+ }
156
+ else {
157
+ const triggerOn = policy.on || (this.isValidTriggerType(currentTriggerType) ? currentTriggerType : DEFAULT_TRIGGER_TYPE);
158
+ await policiesPage.activatePolicy(triggerOn);
159
+ }
160
+ }
161
+ else {
162
+ await policiesPage.deactivatePolicy();
163
+ }
164
+ }
165
+ catch (e_2) {
166
+ env_1.error = e_2;
167
+ env_1.hasError = true;
168
+ }
169
+ finally {
170
+ const result_2 = __disposeResources(env_1);
171
+ if (result_2)
172
+ await result_2;
173
+ }
174
+ }
175
+ }
176
+ //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AoB,CAAC,CAAC;oBAEzG,MAAM,YAAY,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;gBAC/C,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,YAAY,CAAC,gBAAgB,EAAE,CAAC;YACxC,CAAC;;;;;;;;;;;KACF;CACF"}
@@ -0,0 +1,30 @@
1
+ import type { Page } from 'playwright';
2
+ import type { SalesforceUrlPath } from '../../browserforce.js';
3
+ export declare class UserAccessPoliciesPage {
4
+ private page;
5
+ constructor(page: Page);
6
+ static getPolicyUrl(policyId: string): SalesforceUrlPath;
7
+ /**
8
+ * Activate a policy from its detail page
9
+ * @param triggerOn - When to trigger the policy: 'Create', 'Update', or 'CreateAndUpdate' (default)
10
+ */
11
+ activatePolicy(triggerOn?: 'Create' | 'Update' | 'CreateAndUpdate'): Promise<void>;
12
+ /**
13
+ * Deactivate a policy from its detail page
14
+ */
15
+ deactivatePolicy(): Promise<void>;
16
+ /**
17
+ * Handle the activation modal (select trigger option and click Activate)
18
+ */
19
+ private handleActivationModal;
20
+ /**
21
+ * Handle confirmation modal that may appear after deactivation
22
+ */
23
+ private handleConfirmationModal;
24
+ /**
25
+ * Wait for a button to become enabled
26
+ * @param button - The button locator to wait for
27
+ * @param timeout - Maximum time to wait in milliseconds (default: 10000)
28
+ */
29
+ private waitForButtonEnabled;
30
+ }