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,37 @@
1
+ import assert from 'assert';
2
+ import { readFileSync } from 'node:fs';
3
+ import { SalesforceCpqConfig } from './index.js';
4
+ const defaultConfig = JSON.parse(readFileSync(new URL('./default.json', import.meta.url), 'utf8'));
5
+ const describeOrSkip = process.env['CPQ'] === 'true' ? describe : describe.skip;
6
+ describeOrSkip(SalesforceCpqConfig.name, function () {
7
+ let plugin;
8
+ before(() => {
9
+ plugin = new SalesforceCpqConfig(global.browserforce);
10
+ });
11
+ const configDefault = defaultConfig.settings.salesforceCpqConfig;
12
+ const configCustom = {
13
+ documents: {
14
+ documentFolder: 'Quotes',
15
+ hideDocumentName: true,
16
+ },
17
+ quote: {
18
+ disableInitialQuoteSync: true,
19
+ },
20
+ };
21
+ it('should apply default config', async () => {
22
+ await plugin.run(configDefault);
23
+ });
24
+ it('should already be configured', async () => {
25
+ const res = await plugin.run(configDefault);
26
+ assert.deepStrictEqual(res, { message: 'no action necessary' });
27
+ });
28
+ it('should apply custom config', async () => {
29
+ const res = await plugin.run(configCustom);
30
+ assert.notDeepStrictEqual(res, { message: 'no action necessary' });
31
+ });
32
+ it('should already be configured', async () => {
33
+ const res = await plugin.run(configCustom);
34
+ assert.deepStrictEqual(res, { message: 'no action necessary' });
35
+ });
36
+ });
37
+ //# sourceMappingURL=index.e2e-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.e2e-spec.js","sourceRoot":"","sources":["../../../src/plugins/salesforce-cpq-config/index.e2e-spec.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,YA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,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8BAA8B,EAAE,KAAK,IAAI,EAAE;QAC5C,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC3C,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,261 @@
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 { formConfig } from './formConfig.js';
55
+ const BASE_PATH = '/0A3?setupid=ImportedPackage&retURL=%2Fui%2Fsetup%2FSetup%3Fsetupid%3DStudio';
56
+ const AUTH_PATH = '/setup/secur/RemoteAccessAuthorizationPage.apexp';
57
+ const CONFIGURE_SELECTOR = '.actionLink[title*="Configure"][title*="Salesforce CPQ"]';
58
+ const GENERATE_INTEGRATION_USER_PERMISSIONS_SELECTOR = 'input[name="page:form:pb:j_id185:j_id197:setupIntegrationUserPermissions"]';
59
+ const SAVE_SELECTOR = 'input[name="page:form:j_id2:j_id3:j_id11"]';
60
+ const AUTHORIZE_NEW_CALCULATION_SERVICE_SELECTOR = 'span#page\\:form\\:pb\\:calculatorOptions\\:j_id201\\:j_id203 a';
61
+ const ALLOW_SELECTOR = 'input[name="save"][id!="oadeny"]';
62
+ export class SalesforceCpqConfig extends BrowserforcePlugin {
63
+ logger = this.browserforce.logger;
64
+ async retrieve(definition) {
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([page.waitForEvent('load'), page.locator(CONFIGURE_SELECTOR).click()]);
69
+ const response = {};
70
+ if (definition) {
71
+ for (const [keyTab, valueTab] of Object.entries(formConfig)) {
72
+ if (definition[keyTab]) {
73
+ await page.locator(`td[id="${valueTab.id}"]`).click();
74
+ for (const [keyItem, valueItem] of Object.entries(valueTab.properties)) {
75
+ if (!(definition[keyTab][keyItem] === undefined)) {
76
+ const item = valueItem;
77
+ response[keyTab] = response[keyTab] || {};
78
+ try {
79
+ if (item.component === 'input' && item.type === 'boolean') {
80
+ response[keyTab][keyItem] = await page.locator(`${item.component}[name="${item.name}"]`).isChecked();
81
+ }
82
+ else if (item.component === 'input' && item.type === 'string') {
83
+ response[keyTab][keyItem] = await page.locator(`${item.component}[name="${item.name}"]`).inputValue();
84
+ }
85
+ else if (item.component === 'select') {
86
+ response[keyTab][keyItem] = await page
87
+ .locator(`${item.component}[name="${item.name}"] option:checked`)
88
+ .textContent();
89
+ }
90
+ }
91
+ catch (e) {
92
+ if (e instanceof Error &&
93
+ e.message.includes(`Error: failed to find element matching selector "${item.component}[name="${item.name}"]"`)) {
94
+ this.logger?.warn(`Label '${item.label}' '${keyTab}.${keyItem}' with component '${item.component}[name="${item.name}"]' is not found`);
95
+ }
96
+ else {
97
+ throw e;
98
+ }
99
+ }
100
+ }
101
+ }
102
+ }
103
+ }
104
+ }
105
+ return response;
106
+ }
107
+ catch (e_1) {
108
+ env_1.error = e_1;
109
+ env_1.hasError = true;
110
+ }
111
+ finally {
112
+ const result_1 = __disposeResources(env_1);
113
+ if (result_1)
114
+ await result_1;
115
+ }
116
+ }
117
+ async apply(config) {
118
+ const env_2 = { stack: [], error: void 0, hasError: false };
119
+ try {
120
+ const page = __addDisposableResource(env_2, await this.browserforce.openPage(BASE_PATH), true);
121
+ await Promise.all([page.waitForEvent('load'), page.locator(CONFIGURE_SELECTOR).click()]);
122
+ /*
123
+ This to click on the 'Generate Integration User Permissions button' for first time setup.
124
+ Once the button is clicked, it will not be available for the next time.
125
+ */
126
+ this.logger?.log(`Checking for 'Generate Integration User Permissions' button`);
127
+ await page.locator(`td[id="${formConfig.pricingAndCalculation.id}"]`).click();
128
+ const generateButtonCount = await page.locator(GENERATE_INTEGRATION_USER_PERMISSIONS_SELECTOR).count();
129
+ if (generateButtonCount > 0) {
130
+ this.logger?.log(`Clicking on 'Generate Integration User Permissions' button`);
131
+ await page.locator(GENERATE_INTEGRATION_USER_PERMISSIONS_SELECTOR).click();
132
+ }
133
+ else {
134
+ this.logger?.log(`The button 'Generate Integration User Permissions' is not found. It might be already clicked before.`);
135
+ }
136
+ /*
137
+ This to loop through the formConfig and set the value based on the config provided.
138
+ */
139
+ for (const [keyTab, valueTab] of Object.entries(formConfig)) {
140
+ if (config[keyTab]) {
141
+ await page.locator(`td[id="${valueTab.id}"]`).click();
142
+ for (const [keyItem, valueItem] of Object.entries(valueTab.properties)) {
143
+ if (!(config[keyTab][keyItem] === undefined)) {
144
+ const item = valueItem;
145
+ try {
146
+ this.logger?.log(`Updating: '${keyTab}.${keyItem}' (${item.label}) with component '${item.component}[name="${item.name}"]' with value: '${config[keyTab][keyItem]}'`);
147
+ if (item.component === 'input' && item.type === 'boolean') {
148
+ const checkbox = await page.locator(`input[name="${item.name}"]`);
149
+ if (!(await checkbox.isDisabled())) {
150
+ if (config[keyTab][keyItem]) {
151
+ await checkbox.check();
152
+ }
153
+ else {
154
+ await checkbox.uncheck();
155
+ }
156
+ }
157
+ }
158
+ else if (item.component === 'input' && item.type === 'string') {
159
+ await page.locator(`input[name="${item.name}"]`).fill(config[keyTab][keyItem]);
160
+ }
161
+ else if (item.component === 'select') {
162
+ const optionLocators = await page.locator(`select[name="${item.name}"] option`).all();
163
+ const selectFieldOptions = await Promise.all(optionLocators.map(async (option) => ({
164
+ text: await option.textContent(),
165
+ value: await option.getAttribute('value'),
166
+ })));
167
+ const chooseFieldOption = selectFieldOptions.find((x) => x.text === config[keyTab][keyItem]);
168
+ if (!chooseFieldOption) {
169
+ const availableOption = selectFieldOptions.map((option) => option.text);
170
+ 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`);
171
+ }
172
+ await page.locator(`select[name="${item.name}"]`).selectOption(chooseFieldOption.value);
173
+ }
174
+ if (item.immediatelySave) {
175
+ await Promise.all([page.waitForEvent('load'), page.locator(SAVE_SELECTOR).click()]);
176
+ }
177
+ }
178
+ catch (e) {
179
+ if (e instanceof Error &&
180
+ e.message.includes(`Error: failed to find element matching selector "${item.component}[name="${item.name}"]"`)) {
181
+ this.logger?.warn(`Label '${item.label}' '${keyTab}.${keyItem}' with component '${item.component}[name="${item.name}"]' is not found`);
182
+ }
183
+ else {
184
+ 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)}`);
185
+ throw e;
186
+ }
187
+ }
188
+ }
189
+ }
190
+ }
191
+ await Promise.all([page.waitForEvent('load'), page.locator(SAVE_SELECTOR).click()]);
192
+ }
193
+ /*
194
+ This to click on the 'Authorize New Calculation Service' link under Pricing and Calculation tab.
195
+ Once authorized, it will not appear the next time.
196
+ */
197
+ try {
198
+ this.logger?.log(`'Authorize New Calculation Service' link`);
199
+ await page.locator(`td[id="${formConfig.pricingAndCalculation.id}"]`).click();
200
+ const authorizeLinkCount = await page.locator(AUTHORIZE_NEW_CALCULATION_SERVICE_SELECTOR).count();
201
+ if (authorizeLinkCount > 0) {
202
+ const env_3 = { stack: [], error: void 0, hasError: false };
203
+ try {
204
+ // Click on 'Authorize New Calculation Service' link and wait for popup
205
+ const popupPromise = page.context().waitForEvent('page', (newPage) => newPage.url().includes(AUTH_PATH));
206
+ await page.locator(AUTHORIZE_NEW_CALCULATION_SERVICE_SELECTOR).click();
207
+ const newPage = __addDisposableResource(env_3, await popupPromise, true);
208
+ if (newPage) {
209
+ // Click on 'Allow' button
210
+ await Promise.all([
211
+ page.waitForEvent('load'), // Wait for the main page to refresh
212
+ newPage.locator(ALLOW_SELECTOR).click(),
213
+ ]);
214
+ this.logger?.log('The main page has refreshed after allowing.');
215
+ }
216
+ else {
217
+ this.logger?.warn('Failed to retrieve the new page from the popup.');
218
+ }
219
+ this.logger?.log('The authorization process has been completed.');
220
+ }
221
+ catch (e_2) {
222
+ env_3.error = e_2;
223
+ env_3.hasError = true;
224
+ }
225
+ finally {
226
+ const result_2 = __disposeResources(env_3);
227
+ if (result_2)
228
+ await result_2;
229
+ }
230
+ }
231
+ else {
232
+ this.logger?.log(`The link 'Authorize New Calculation Service' was not found. It might be already clicked before.`);
233
+ }
234
+ }
235
+ catch (e) {
236
+ if (e instanceof Error &&
237
+ e.message.includes(`No element found for selector: ${AUTHORIZE_NEW_CALCULATION_SERVICE_SELECTOR}`)) {
238
+ this.logger?.log(`The link Authorize New Calculation Service' is not found. It might be already clicked before.`);
239
+ }
240
+ else if (e instanceof Error &&
241
+ e.message.includes(`Waiting for selector \`input[name="save"]\` failed: waitForFunction failed: frame got detached.`)) {
242
+ this.logger?.log(`ALLOW button is not found. It might be already clicked before.`);
243
+ }
244
+ else {
245
+ this.logger?.warn(`Error clicking Authorize New Calculation Service' button with message: ${e instanceof Error ? e.message : String(e)}`);
246
+ throw e;
247
+ }
248
+ }
249
+ }
250
+ catch (e_3) {
251
+ env_2.error = e_3;
252
+ env_2.hasError = true;
253
+ }
254
+ finally {
255
+ const result_3 = __disposeResources(env_2);
256
+ if (result_3)
257
+ await result_3;
258
+ }
259
+ }
260
+ }
261
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/salesforce-cpq-config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,SAAS,GAAG,8EAA8E,CAAC;AACjG,MAAM,SAAS,GAAG,kDAAkD,CAAC;AAErE,MAAM,kBAAkB,GAAG,0DAA0D,CAAC;AACtF,MAAM,8CAA8C,GAClD,4EAA4E,CAAC;AAC/E,MAAM,aAAa,GAAG,4CAA4C,CAAC;AACnE,MAAM,0CAA0C,GAA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AAC;oBACN,IAAI,CAAC,MAAM,EAAE,IAAI,CACf,0EACE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAC3C,EAAE,CACH,CAAC;oBACF,MAAM,CAAC,CAAC;gBACV,CAAC;YACH,CAAC;;;;;;;;;;;KACF;CACF"}
@@ -0,0 +1,9 @@
1
+ import { BrowserforcePlugin } from '../../plugin.js';
2
+ type Config = {
3
+ enabled: boolean;
4
+ };
5
+ export declare class SalesforceToSalesforce extends BrowserforcePlugin {
6
+ retrieve(): Promise<Config>;
7
+ apply(config: Config): Promise<void>;
8
+ }
9
+ export {};
@@ -0,0 +1,34 @@
1
+ import assert from 'assert';
2
+ import { SalesforceToSalesforce } from './index.js';
3
+ describe(SalesforceToSalesforce.name, function () {
4
+ let plugin;
5
+ before(() => {
6
+ plugin = new SalesforceToSalesforce(global.browserforce);
7
+ });
8
+ const configEnabled = {
9
+ enabled: true,
10
+ };
11
+ const configDisabled = {
12
+ enabled: false,
13
+ };
14
+ it('should enable', async () => {
15
+ await plugin.run(configEnabled);
16
+ });
17
+ it('should be enabled', async () => {
18
+ const state = await plugin.retrieve();
19
+ assert.deepStrictEqual(state, configEnabled);
20
+ });
21
+ it('should fail to disable', async () => {
22
+ let err;
23
+ try {
24
+ await plugin.apply(configDisabled);
25
+ }
26
+ catch (e) {
27
+ err = e;
28
+ }
29
+ assert.throws(() => {
30
+ throw err;
31
+ }, /cannot be disabled/);
32
+ });
33
+ });
34
+ //# sourceMappingURL=index.e2e-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.e2e-spec.js","sourceRoot":"","sources":["../../../src/plugins/salesforce-to-salesforce/index.e2e-spec.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,QAAQ,CAAC,sBAAsB,CAAC,IAAI,EAAE;IACpC,IAAI,MAA8B,CAAC;IACnC,MAAM,CAAC,GAAG,EAAE;QACV,MAAM,GAAG,IAAI,sBAAsB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,MAAM,aAAa,GAAG;QACpB,OAAO,EAAE,IAAI;KACd,CAAC;IACF,MAAM,cAAc,GAAG;QACrB,OAAO,EAAE,KAAK;KACf,CAAC;IAEF,EAAE,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;QAC7B,MAAM,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,mBAAmB,EAAE,KAAK,IAAI,EAAE;QACjC,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;QACtC,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,wBAAwB,EAAE,KAAK,IAAI,EAAE;QACtC,IAAI,GAAG,CAAC;QACR,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACrC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,GAAG,GAAG,CAAC,CAAC;QACV,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;YACjB,MAAM,GAAG,CAAC;QACZ,CAAC,EAAE,oBAAoB,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,107 @@
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 = '/_ui/s2s/ui/PartnerNetworkEnable/e';
55
+ export class SalesforceToSalesforce extends BrowserforcePlugin {
56
+ async retrieve() {
57
+ const env_1 = { stack: [], error: void 0, hasError: false };
58
+ try {
59
+ const page = __addDisposableResource(env_1, await this.browserforce.openPage(BASE_PATH), true);
60
+ const response = {
61
+ enabled: true,
62
+ };
63
+ const checkedImageCount = await page.getByRole('img', { name: 'Checked' }).count();
64
+ if (checkedImageCount === 0) {
65
+ response.enabled = false;
66
+ }
67
+ return response;
68
+ }
69
+ catch (e_1) {
70
+ env_1.error = e_1;
71
+ env_1.hasError = true;
72
+ }
73
+ finally {
74
+ const result_1 = __disposeResources(env_1);
75
+ if (result_1)
76
+ await result_1;
77
+ }
78
+ }
79
+ async apply(config) {
80
+ if (config.enabled === false) {
81
+ throw new Error('`enabled` cannot be disabled once enabled');
82
+ }
83
+ // sometimes the setting is not being applied although no error is being displayed
84
+ await this.browserforce.retry(async () => {
85
+ const env_2 = { stack: [], error: void 0, hasError: false };
86
+ try {
87
+ const page = __addDisposableResource(env_2, await this.browserforce.openPage(BASE_PATH), true);
88
+ await page.locator('#penabled').check();
89
+ await page.getByRole('button', { name: 'save' }).first().click();
90
+ const result = await this.retrieve();
91
+ if (result.enabled !== config.enabled) {
92
+ throw new Error('setting was not applied as expected');
93
+ }
94
+ }
95
+ catch (e_2) {
96
+ env_2.error = e_2;
97
+ env_2.hasError = true;
98
+ }
99
+ finally {
100
+ const result_2 = __disposeResources(env_2);
101
+ if (result_2)
102
+ await result_2;
103
+ }
104
+ });
105
+ }
106
+ }
107
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/salesforce-to-salesforce/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,SAAS,GAAG,oCAAoC,CAAC;AAMvD,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;IACrD,KAAK,CAAC,QAAQ;;;YACnB,MAAY,IAAI,kCAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAA,CAAC;YAC/D,MAAM,QAAQ,GAAG;gBACf,OAAO,EAAE,IAAI;aACd,CAAC;YAEF,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;YACnF,IAAI,iBAAiB,KAAK,CAAC,EAAE,CAAC;gBAC5B,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC;YAC3B,CAAC;YAED,OAAO,QAAQ,CAAC;;;;;;;;;;;KACjB;IAEM,KAAK,CAAC,KAAK,CAAC,MAAc;QAC/B,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC/D,CAAC;QAED,kFAAkF;QAClF,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;;;gBACvC,MAAY,IAAI,kCAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAA,CAAC;gBAE/D,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,CAAC;gBACxC,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC;gBAEjE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACrC,IAAI,MAAM,CAAC,OAAO,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC;oBACtC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;gBACzD,CAAC;;;;;;;;;;;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ import { BrowserforcePlugin } from '../../plugin.js';
2
+ export type Config = {
3
+ jobScheduleNames?: string[];
4
+ allJobScheduleNames?: boolean;
5
+ namespace?: string;
6
+ };
7
+ export declare class ScheduledBatches extends BrowserforcePlugin {
8
+ retrieve(definition?: Config): Promise<Config | undefined>;
9
+ apply(config: Config): Promise<void>;
10
+ }
@@ -0,0 +1,145 @@
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 { ScheduledBatchesPage } from './page.js';
55
+ const SCHEDULED_CHECKBOX_SELECTOR = 'input[type="checkbox"][data-record-id="{ID}"]';
56
+ const BASE_PATH = `/lightning/n/{NAMESPACE}BatchJobSchedulerConfiguration`;
57
+ const SCHEDULE_OBJECT_API = '{NAMESPACE}BatchJobSchedule__c';
58
+ export class ScheduledBatches extends BrowserforcePlugin {
59
+ async retrieve(definition) {
60
+ const env_1 = { stack: [], error: void 0, hasError: false };
61
+ try {
62
+ if (!definition?.namespace) {
63
+ return undefined;
64
+ }
65
+ if (!definition.allJobScheduleNames && (!definition.jobScheduleNames || definition.jobScheduleNames.length === 0)) {
66
+ throw new Error('jobScheduleNames or allJobScheduleNames is required');
67
+ }
68
+ const page = __addDisposableResource(env_1, await this.browserforce.openPage(BASE_PATH.replace('{NAMESPACE}', definition.namespace)), true);
69
+ const frameOrPage = await this.browserforce.waitForSelectorInFrameOrPage(page, ScheduledBatchesPage.getTableSelector());
70
+ const scheduledBatchesPage = new ScheduledBatchesPage(frameOrPage);
71
+ let jobScheduleNames = [];
72
+ if (definition.allJobScheduleNames) {
73
+ jobScheduleNames = await scheduledBatchesPage.resolveAllJobScheduleNames(this.browserforce, SCHEDULE_OBJECT_API.replace('{NAMESPACE}', definition.namespace));
74
+ }
75
+ else {
76
+ jobScheduleNames = await scheduledBatchesPage.resolveJobScheduleNames(this.browserforce, definition.jobScheduleNames, SCHEDULE_OBJECT_API.replace('{NAMESPACE}', definition.namespace));
77
+ }
78
+ const scheduled = [];
79
+ for (const jobSchedule of jobScheduleNames) {
80
+ try {
81
+ const checkbox = frameOrPage.locator(SCHEDULED_CHECKBOX_SELECTOR.replace('{ID}', jobSchedule.id));
82
+ const isChecked = await checkbox.isChecked();
83
+ if (isChecked) {
84
+ scheduled.push(jobSchedule.name);
85
+ }
86
+ }
87
+ catch (e) {
88
+ if (e instanceof Error && e.message.includes('Timeout')) {
89
+ throw new Error(`Job schedule not found: ${jobSchedule.name}`);
90
+ }
91
+ throw e;
92
+ }
93
+ }
94
+ return { jobScheduleNames: scheduled };
95
+ }
96
+ catch (e_1) {
97
+ env_1.error = e_1;
98
+ env_1.hasError = true;
99
+ }
100
+ finally {
101
+ const result_1 = __disposeResources(env_1);
102
+ if (result_1)
103
+ await result_1;
104
+ }
105
+ }
106
+ async apply(config) {
107
+ const env_2 = { stack: [], error: void 0, hasError: false };
108
+ try {
109
+ if (!config.namespace) {
110
+ throw new Error('namespace is required');
111
+ }
112
+ if (!config.allJobScheduleNames && (!config.jobScheduleNames || config.jobScheduleNames.length === 0)) {
113
+ throw new Error('jobScheduleNames is required when allJobScheduleNames is false');
114
+ }
115
+ const page = __addDisposableResource(env_2, await this.browserforce.openPage(BASE_PATH.replace('{NAMESPACE}', config.namespace)), true);
116
+ const frameOrPage = await this.browserforce.waitForSelectorInFrameOrPage(page, ScheduledBatchesPage.getTableSelector());
117
+ const scheduledBatchesPage = new ScheduledBatchesPage(frameOrPage);
118
+ let jobScheduleNames = [];
119
+ if (config.allJobScheduleNames) {
120
+ jobScheduleNames = await scheduledBatchesPage.resolveAllJobScheduleNames(this.browserforce, SCHEDULE_OBJECT_API.replace('{NAMESPACE}', config.namespace));
121
+ }
122
+ else {
123
+ jobScheduleNames = await scheduledBatchesPage.resolveJobScheduleNames(this.browserforce, config.jobScheduleNames, SCHEDULE_OBJECT_API.replace('{NAMESPACE}', config.namespace));
124
+ }
125
+ for (const jobSchedule of jobScheduleNames) {
126
+ const checkbox = frameOrPage.locator(SCHEDULED_CHECKBOX_SELECTOR.replace('{ID}', jobSchedule.id));
127
+ const isChecked = await checkbox.isChecked();
128
+ if (!isChecked) {
129
+ await checkbox.click();
130
+ }
131
+ }
132
+ await scheduledBatchesPage.clickApplyChanges();
133
+ }
134
+ catch (e_2) {
135
+ env_2.error = e_2;
136
+ env_2.hasError = true;
137
+ }
138
+ finally {
139
+ const result_2 = __disposeResources(env_2);
140
+ if (result_2)
141
+ await result_2;
142
+ }
143
+ }
144
+ }
145
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/scheduled-batches/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,2BAA2B,GAAG,+CAA+C,CAAC;AACpF,MAAM,SAAS,GAAsB,wDAAwD,CAAC;AAC9F,MAAM,mBAAmB,GAAG,gCAAgC,CAAC;AAQ7D,MAAM,OAAO,gBAAiB,SAAQ,kBAAkB;IAC/C,KAAK,CAAC,QAAQ,CAAC,UAAmB;;;YACvC,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,CAAC;gBAC3B,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,IAAI,CAAC,UAAU,CAAC,mBAAmB,IAAI,CAAC,CAAC,UAAU,CAAC,gBAAgB,IAAI,UAAU,CAAC,gBAAgB,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;gBAClH,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;YACzE,CAAC;YAED,MAAY,IAAI,kCAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CACjD,SAAS,CAAC,OAAO,CAAC,aAAa,EAAE,UAAU,CAAC,SAAS,CAAsB,CAC5E,OAAA,CAAC;YACF,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,4BAA4B,CACtE,IAAI,EACJ,oBAAoB,CAAC,gBAAgB,EAAE,CACxC,CAAC;YAEF,MAAM,oBAAoB,GAAG,IAAI,oBAAoB,CAAC,WAAW,CAAC,CAAC;YACnE,IAAI,gBAAgB,GAAmC,EAAE,CAAC;YAC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