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,58 @@
1
+ import { BrowserforcePlugin } from '../../plugin.js';
2
+ import { CustomerPortalAvailableCustomObjects, } from './available-custom-objects/index.js';
3
+ import { CustomerPortalEnable } from './enabled/index.js';
4
+ import { CustomerPortalSetup } from './portals/index.js';
5
+ export class CustomerPortal extends BrowserforcePlugin {
6
+ async retrieve(definition) {
7
+ const pluginEnable = new CustomerPortalEnable(this.browserforce);
8
+ const response = {
9
+ enabled: false,
10
+ portals: [],
11
+ availableCustomObjects: [],
12
+ };
13
+ response.enabled = await pluginEnable.retrieve();
14
+ if (response.enabled) {
15
+ if (definition.portals) {
16
+ const pluginSetup = new CustomerPortalSetup(this.browserforce);
17
+ response.portals = await pluginSetup.retrieve();
18
+ }
19
+ if (definition.availableCustomObjects) {
20
+ const pluginAvailableCustomObjects = new CustomerPortalAvailableCustomObjects(this.browserforce);
21
+ response.availableCustomObjects = await pluginAvailableCustomObjects.retrieve(definition.availableCustomObjects);
22
+ }
23
+ }
24
+ return response;
25
+ }
26
+ diff(state, definition) {
27
+ const enabled = new CustomerPortalEnable(this.browserforce).diff(state.enabled, definition.enabled);
28
+ const portals = new CustomerPortalSetup(this.browserforce).diff(state.portals, definition.portals);
29
+ const availableCustomObjects = new CustomerPortalAvailableCustomObjects(this.browserforce).diff(state.availableCustomObjects, definition.availableCustomObjects);
30
+ const response = {
31
+ ...(enabled !== undefined && {
32
+ enabled,
33
+ }),
34
+ ...(portals !== undefined && {
35
+ portals,
36
+ }),
37
+ ...(availableCustomObjects !== undefined && {
38
+ availableCustomObjects,
39
+ }),
40
+ };
41
+ return Object.keys(response).length ? response : undefined;
42
+ }
43
+ async apply(config) {
44
+ if (config.enabled !== undefined) {
45
+ const pluginEnable = new CustomerPortalEnable(this.browserforce);
46
+ await pluginEnable.apply(config.enabled);
47
+ }
48
+ if (config.portals?.length) {
49
+ const pluginSetup = new CustomerPortalSetup(this.browserforce);
50
+ await pluginSetup.apply(config.portals);
51
+ }
52
+ if (config.availableCustomObjects) {
53
+ const pluginAvailableCustomObjects = new CustomerPortalAvailableCustomObjects(this.browserforce);
54
+ await pluginAvailableCustomObjects.apply(config.availableCustomObjects);
55
+ }
56
+ }
57
+ }
58
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/customer-portal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EACL,oCAAoC,GAErC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAwC,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAuC,MAAM,oBAAoB,CAAC;AAQ9F,MAAM,OAAO,cAAe,SAAQ,kBAAkB;IAC7C,KAAK,CAAC,QAAQ,CAAC,UAAkB;QACtC,MAAM,YAAY,GAAG,IAAI,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACjE,MAAM,QAAQ,GAAW;YACvB,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,EAAE;YACX,sBAAsB,EAAE,EAAE;SAC3B,CAAC;QACF,QAAQ,CAAC,OAAO,GAAG,MAAM,YAAY,CAAC,QAAQ,EAAE,CAAC;QACjD,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;YACrB,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;gBACvB,MAAM,WAAW,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBAC/D,QAAQ,CAAC,OAAO,GAAG,MAAM,WAAW,CAAC,QAAQ,EAAE,CAAC;YAClD,CAAC;YACD,IAAI,UAAU,CAAC,sBAAsB,EAAE,CAAC;gBACtC,MAAM,4BAA4B,GAAG,IAAI,oCAAoC,CAAC,IA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AM,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;QACD,IAAI,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;YAC3B,MAAM,WAAW,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC/D,MAAM,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC1C,CAAC;QACD,IAAI,MAAM,CAAC,sBAAsB,EAAE,CAAC;YAClC,MAAM,4BAA4B,GAAG,IAAI,oCAAoC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACjG,MAAM,4BAA4B,CAAC,KAAK,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,84 @@
1
+ import assert from 'assert';
2
+ import { CustomerPortal } from './index.js';
3
+ const tests = [
4
+ {
5
+ description: 'should ignore a non-existent target flag',
6
+ source: {
7
+ enabled: true,
8
+ },
9
+ target: {},
10
+ expected: undefined,
11
+ },
12
+ {
13
+ description: 'should ignore a matching target flag',
14
+ source: {
15
+ enabled: true,
16
+ },
17
+ target: {
18
+ enabled: true,
19
+ },
20
+ expected: undefined,
21
+ },
22
+ {
23
+ description: 'should detect a changed flag',
24
+ source: {
25
+ enabled: false,
26
+ },
27
+ target: {
28
+ enabled: true,
29
+ },
30
+ expected: {
31
+ enabled: true,
32
+ },
33
+ },
34
+ {
35
+ description: 'should only return necessary fields',
36
+ source: {
37
+ enabled: true,
38
+ portals: [
39
+ {
40
+ name: 'Customer Portal',
41
+ description: 'Customer Portal',
42
+ adminUser: 'User User',
43
+ portalProfileMemberships: [
44
+ {
45
+ name: 'Customer Portal Manager Standard',
46
+ active: true,
47
+ _id: 'a1',
48
+ },
49
+ ],
50
+ _id: 'p1',
51
+ },
52
+ ],
53
+ },
54
+ target: {
55
+ portals: [
56
+ {
57
+ name: 'Customer Portal',
58
+ description: 'new description',
59
+ },
60
+ ],
61
+ },
62
+ expected: {
63
+ portals: [
64
+ {
65
+ name: 'Customer Portal',
66
+ description: 'new description',
67
+ _id: 'p1',
68
+ },
69
+ ],
70
+ },
71
+ },
72
+ ];
73
+ describe('CustomerPortal', () => {
74
+ describe('diff()', () => {
75
+ const p = new CustomerPortal(global.browserforce);
76
+ for (const t of tests) {
77
+ it(t.description, () => {
78
+ const actual = p.diff(t.source, t.target);
79
+ assert.deepStrictEqual(actual, t.expected);
80
+ });
81
+ }
82
+ });
83
+ });
84
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../src/plugins/customer-portal/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,KAAK,GAAG;IACZ;QACE,WAAW,EAAE,0CAA0C;QACvD,MAAM,EAAE;YACN,OAAO,EAAE,IAAI;SACd;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE,SAAS;KACpB;IACD;QACE,WAAW,EAAE,sCAAsC;QACnD,MAAM,EAAE;YACN,OAAO,EAAE,IAAI;SACd;QACD,MAAM,EAAE;YACN,OAAO,EAAE,IAAI;SACd;QACD,QAAQ,EAAE,SAAS;KACpB;IACD;QACE,WAAW,EAAE,8BAA8B;QAC3C,MAAM,EAAE;YACN,OAAO,EAAE,KAAK;SACf;QACD,MAAM,EAAE;YACN,OAAO,EAAE,IAAI;SACd;QACD,QAAQ,EAAE;YACR,OAAO,EAAE,IAAI;SACd;KACF;IACD;QACE,WAAW,EAAE,qCAAqC;QAClD,MAAM,EAAE;YACN,OAAO,EAAE,IAAI;YACb,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,iBAAiB;oBACvB,WAAW,EAAE,iBAAiB;oBAC9B,SAAS,EAAE,WAAW;oBACtB,wBAAwB,EAAE;wBACxB;4BACE,IAAI,EAAE,kCAAkC;4BACxC,MAAM,EAAE,IAAI;4BACZ,GAAG,EAAE,IAAI;yBACV;qBACF;oBACD,GAAG,EAAE,IAAI;iBACV;aACF;SACF;QACD,MAAM,EAAE;YACN,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,iBAAiB;oBACvB,WAAW,EAAE,iBAAiB;iBAC/B;aACF;SACF;QACD,QAAQ,EAAE;YACR,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,iBAAiB;oBACvB,WAAW,EAAE,iBAAiB;oBAC9B,GAAG,EAAE,IAAI;iBACV;aACF;SACF;KACF;CACF,CAAC;AAEF,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;QACtB,MAAM,CAAC,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAClD,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,EAAE;gBACrB,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;gBAC1C,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;YAC7C,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { BrowserforcePlugin } from '../../../plugin.js';
2
+ export type Config = PortalConfig[];
3
+ type PortalConfig = {
4
+ adminUser?: string;
5
+ description?: string;
6
+ isSelfRegistrationActivated?: boolean;
7
+ name: string;
8
+ oldName?: string;
9
+ selfRegUserDefaultLicense?: string;
10
+ selfRegUserDefaultProfile?: string;
11
+ selfRegUserDefaultRole?: string;
12
+ portalProfileMemberships?: PortalProfileMembership[];
13
+ _id?: string;
14
+ };
15
+ type PortalProfileMembership = {
16
+ name: string;
17
+ active: boolean;
18
+ _id?: string;
19
+ };
20
+ export declare class CustomerPortalSetup extends BrowserforcePlugin {
21
+ retrieve(): Promise<Config>;
22
+ diff(source?: Config, target?: Config): Config | undefined;
23
+ apply(config: Config): Promise<void>;
24
+ }
25
+ export {};
@@ -0,0 +1,254 @@
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 * as queryString from 'querystring';
54
+ import { waitForPageErrors } from '../../../browserforce.js';
55
+ import { BrowserforcePlugin } from '../../../plugin.js';
56
+ import { semanticallyCleanObject } from '../../utils.js';
57
+ const LIST_VIEW_PATH = '/_ui/core/portal/CustomerSuccessPortalSetup/d';
58
+ const PORTAL_PROFILE_MEMBERSHIP_PATH = '/_ui/core/portal/PortalProfileMembershipPage/e';
59
+ const SAVE_BUTTON_SELECTOR = 'input[name="save"]';
60
+ export class CustomerPortalSetup extends BrowserforcePlugin {
61
+ async retrieve() {
62
+ const env_1 = { stack: [], error: void 0, hasError: false };
63
+ try {
64
+ const page = __addDisposableResource(env_1, await this.browserforce.openPage(LIST_VIEW_PATH), true);
65
+ const portalLinksLocator = page.locator('xpath=//div[contains(@class,"pbBody")]//th[contains(@class,"dataCell")]//a[starts-with(@href, "/060")]');
66
+ await portalLinksLocator.first().waitFor();
67
+ const linkLocators = await portalLinksLocator.all();
68
+ const response = await Promise.all(linkLocators.map(async (link) => ({
69
+ _id: (await link.getAttribute('href')).split('/')[1],
70
+ name: await link.textContent(),
71
+ portalProfileMemberships: [],
72
+ })));
73
+ for (const portal of response) {
74
+ const env_2 = { stack: [], error: void 0, hasError: false };
75
+ try {
76
+ const portalPage = __addDisposableResource(env_2, await this.browserforce.openPage(`/${portal._id}/e`), true);
77
+ portal.description = await portalPage.locator('input#Description').inputValue();
78
+ portal.adminUser = await portalPage.locator('input#Admin').inputValue();
79
+ portal.isSelfRegistrationActivated = await portalPage.locator('input#IsSelfRegistrationActivated').isChecked();
80
+ portal.selfRegUserDefaultLicense = await portalPage
81
+ .locator('select#SelfRegUserDefaultLicense option:checked')
82
+ .textContent();
83
+ portal.selfRegUserDefaultRole = await portalPage
84
+ .locator('select#SelfRegUserDefaultRole option:checked')
85
+ .textContent();
86
+ portal.selfRegUserDefaultProfile = await portalPage
87
+ .locator('select#SelfRegUserDefaultProfile option:checked')
88
+ .textContent();
89
+ // portalProfileMemberships
90
+ const portalProfilePage = __addDisposableResource(env_2, await this.browserforce.openPage(`${PORTAL_PROFILE_MEMBERSHIP_PATH}?portalId=${portal._id}&setupid=CustomerSuccessPortalSettings`), true);
91
+ const profilesLocator = portalProfilePage.locator('th.dataCell');
92
+ await profilesLocator.first().waitFor();
93
+ const profiles = await profilesLocator.allTextContents();
94
+ const inputLocators = await portalProfilePage.locator('td.dataCell input').all();
95
+ const checkboxes = await Promise.all(inputLocators.map(async (input) => ({
96
+ active: await input.isChecked(),
97
+ _id: await input.getAttribute('id'),
98
+ })));
99
+ const portalProfileMemberships = [];
100
+ for (let i = 0; i < profiles.length; i++) {
101
+ portalProfileMemberships.push({
102
+ name: profiles[i],
103
+ active: checkboxes[i].active,
104
+ _id: checkboxes[i]._id,
105
+ });
106
+ }
107
+ portal.portalProfileMemberships = portalProfileMemberships;
108
+ }
109
+ catch (e_1) {
110
+ env_2.error = e_1;
111
+ env_2.hasError = true;
112
+ }
113
+ finally {
114
+ const result_1 = __disposeResources(env_2);
115
+ if (result_1)
116
+ await result_1;
117
+ }
118
+ }
119
+ return response;
120
+ }
121
+ catch (e_2) {
122
+ env_1.error = e_2;
123
+ env_1.hasError = true;
124
+ }
125
+ finally {
126
+ const result_2 = __disposeResources(env_1);
127
+ if (result_2)
128
+ await result_2;
129
+ }
130
+ }
131
+ diff(source, target) {
132
+ const response = [];
133
+ if (source && target) {
134
+ for (const plannedPortal of target) {
135
+ const portal = JSON.parse(JSON.stringify(plannedPortal));
136
+ let sourcePortal = source.find((p) => p.name === portal.name);
137
+ if (portal.oldName && !sourcePortal) {
138
+ // fallback to old name of portal
139
+ sourcePortal = source.find((p) => p.name === portal.oldName);
140
+ }
141
+ if (!sourcePortal) {
142
+ throw new Error(`Portal with name '${portal.name} (oldName: ${portal.oldName})' not found. Setting up new Portals is not yet supported.`);
143
+ }
144
+ delete portal.oldName;
145
+ if (sourcePortal) {
146
+ // copy id of existing portal to new portal to be retained and used
147
+ portal._id = sourcePortal._id;
148
+ }
149
+ if (sourcePortal.portalProfileMemberships && portal.portalProfileMemberships) {
150
+ const membershipResponse = [];
151
+ for (const member of portal.portalProfileMemberships) {
152
+ // copy id of existing member to new member to be retained and used
153
+ const sourceMember = sourcePortal.portalProfileMemberships.find((m) => m.name === member.name);
154
+ if (sourceMember) {
155
+ member._id = sourceMember._id;
156
+ }
157
+ else {
158
+ throw new Error(`Could not find portal profile membership for '${member.name}'`);
159
+ }
160
+ const membershipDiff = semanticallyCleanObject(super.diff(sourceMember, member), '_id');
161
+ if (membershipDiff) {
162
+ membershipResponse.push(membershipDiff);
163
+ }
164
+ }
165
+ delete sourcePortal.portalProfileMemberships;
166
+ delete portal.portalProfileMemberships;
167
+ if (membershipResponse.length) {
168
+ portal.portalProfileMemberships = membershipResponse;
169
+ }
170
+ }
171
+ const diff = semanticallyCleanObject(super.diff(sourcePortal, portal), '_id');
172
+ if (diff !== undefined) {
173
+ response.push(diff);
174
+ }
175
+ }
176
+ }
177
+ return response.length ? response : undefined;
178
+ }
179
+ async apply(config) {
180
+ for (const portal of config) {
181
+ if (portal._id) {
182
+ const env_3 = { stack: [], error: void 0, hasError: false };
183
+ try {
184
+ // everything that can be changed using the url
185
+ const urlAttributes = {};
186
+ if (portal.name) {
187
+ urlAttributes['Name'] = portal.name;
188
+ }
189
+ if (portal.description) {
190
+ urlAttributes['Description'] = portal.description;
191
+ }
192
+ if (portal.adminUser) {
193
+ urlAttributes['Admin'] = portal.adminUser;
194
+ }
195
+ if (portal.isSelfRegistrationActivated !== undefined) {
196
+ urlAttributes['IsSelfRegistrationActivated'] = portal.isSelfRegistrationActivated ? 1 : 0;
197
+ }
198
+ const page = __addDisposableResource(env_3, await this.browserforce.openPage(`/${portal._id}/e?${queryString.stringify(urlAttributes)}`), true);
199
+ await page.locator('input#Description').waitFor();
200
+ if (portal.selfRegUserDefaultLicense) {
201
+ await page
202
+ .locator('select#SelfRegUserDefaultLicense')
203
+ .selectOption({ label: portal.selfRegUserDefaultLicense });
204
+ }
205
+ if (portal.selfRegUserDefaultRole) {
206
+ await page.locator('select#SelfRegUserDefaultRole').selectOption({ label: portal.selfRegUserDefaultRole });
207
+ }
208
+ if (portal.selfRegUserDefaultProfile) {
209
+ await page
210
+ .locator('select#SelfRegUserDefaultProfile')
211
+ .selectOption({ label: portal.selfRegUserDefaultProfile });
212
+ }
213
+ await page.locator(SAVE_BUTTON_SELECTOR).first().click();
214
+ await Promise.race([page.waitForURL((url) => !url.pathname.includes(portal._id)), waitForPageErrors(page)]);
215
+ // portalProfileMemberships
216
+ if (portal.portalProfileMemberships) {
217
+ const env_4 = { stack: [], error: void 0, hasError: false };
218
+ try {
219
+ const membershipUrlAttributes = {};
220
+ for (const member of portal.portalProfileMemberships) {
221
+ membershipUrlAttributes[member._id] = member.active ? 1 : 0;
222
+ }
223
+ const portalProfilePage = __addDisposableResource(env_4, await this.browserforce.openPage(`${PORTAL_PROFILE_MEMBERSHIP_PATH}?portalId=${portal._id}&setupid=CustomerSuccessPortalSettings&${queryString.stringify(membershipUrlAttributes)}&retURL=${encodeURIComponent('/setup/forcecomHomepage.apexp')}`), true);
224
+ await portalProfilePage.locator(SAVE_BUTTON_SELECTOR).first().click();
225
+ await Promise.race([
226
+ portalProfilePage.waitForURL((url) => url.pathname === '/setup/forcecomHomepage.apexp'),
227
+ waitForPageErrors(portalProfilePage),
228
+ ]);
229
+ }
230
+ catch (e_3) {
231
+ env_4.error = e_3;
232
+ env_4.hasError = true;
233
+ }
234
+ finally {
235
+ const result_3 = __disposeResources(env_4);
236
+ if (result_3)
237
+ await result_3;
238
+ }
239
+ }
240
+ }
241
+ catch (e_4) {
242
+ env_3.error = e_4;
243
+ env_3.hasError = true;
244
+ }
245
+ finally {
246
+ const result_4 = __disposeResources(env_3);
247
+ if (result_4)
248
+ await result_4;
249
+ }
250
+ }
251
+ }
252
+ }
253
+ }
254
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/customer-portal/portals/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,WAAW,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,MAAM,cAAc,GAAG,+CAA+C,CAAC;AACvE,MAAM,8BAA8B,GAAG,gDAAgD,CAAC;AAExF,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAuBlD,MAAM,OAAO,mBAAoB,SAAQ,kBAAkB;IAClD,KAAK,CAAC,QAAQ;;;YACnB,MAAY,IAAI,kCAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAA,CAAC;YACpE,MAAM,kBAAkB,GAAG,IAAI,CAAC,OAAO,CACrC,wGAAwG,CACzG,CAAC;YACF,MAAM,kBAAkB,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,CAAC;YAC3C,MAAM,YAAY,GAAG,MAAM,kBAAkB,CAAC,GAAG,EAAE,CAAC;YACpD,MAAM,QAAQ,GAAW,MAAM,OAAO,CAAC,GAAG,CACxC,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;gBAChC,GAAG,EAAE,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBACrD,IAAI,EAAE,MAAM,IAAI,CAAC,WAAW,EAAE;gBAC9B,wBA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uBAAuB,GAA8B,EAAE,CAAC;4BAC9D,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,wBAAwB,EAAE,CAAC;gCACrD,uBAAuB,CAAC,MAAM,CAAC,GAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;4BAC/D,CAAC;4BACD,MAAY,iBAAiB,kCAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAC9D,GAAG,8BAA8B,aAC/B,MAAM,CAAC,GACT,0CAA0C,WAAW,CAAC,SAAS,CAC7D,uBAAuB,CACxB,WAAW,kBAAkB,CAAC,+BAA+B,CAAC,EAAE,CAClE,OAAA,CAAC;4BACF,MAAM,iBAAiB,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC;4BACtE,MAAM,OAAO,CAAC,IAAI,CAAC;gCACjB,iBAAiB,CAAC,UAAU,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,+BAA+B,CAAC;gCACvF,iBAAiB,CAAC,iBAAiB,CAAC;6BACrC,CAAC,CAAC;;;;;;;;;;;qBACJ;;;;;;;;;;;aACF;QACH,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,140 @@
1
+ import assert from 'assert';
2
+ import { CustomerPortalSetup } from './index.js';
3
+ const tests = [
4
+ {
5
+ description: 'should only return necessary portal fields',
6
+ source: [
7
+ {
8
+ _id: 'p1',
9
+ name: 'Customer Portal',
10
+ description: 'Customer Portal',
11
+ adminUser: 'User User',
12
+ isSelfRegistrationActivated: true,
13
+ selfRegUserDefaultLicense: 'Customer Portal Manager Custom',
14
+ selfRegUserDefaultRole: 'User',
15
+ selfRegUserDefaultProfile: 'Customer Portal Manager Custom',
16
+ },
17
+ ],
18
+ target: [
19
+ {
20
+ name: 'Customer Portal',
21
+ description: 'new description',
22
+ },
23
+ ],
24
+ expected: [
25
+ {
26
+ _id: 'p1',
27
+ name: 'Customer Portal',
28
+ description: 'new description',
29
+ },
30
+ ],
31
+ },
32
+ {
33
+ description: 'should only return portal and portalProfileMemberships fields',
34
+ source: [
35
+ {
36
+ name: 'Customer Portal',
37
+ description: 'Customer Portal',
38
+ adminUser: 'User User',
39
+ portalProfileMemberships: [
40
+ {
41
+ name: 'Customer Portal Manager Standard',
42
+ active: true,
43
+ _id: 'a1',
44
+ },
45
+ ],
46
+ _id: 'p1',
47
+ },
48
+ ],
49
+ target: [
50
+ {
51
+ name: 'Customer Portal',
52
+ portalProfileMemberships: [
53
+ {
54
+ name: 'Customer Portal Manager Standard',
55
+ active: false,
56
+ },
57
+ ],
58
+ },
59
+ ],
60
+ expected: [
61
+ {
62
+ _id: 'p1',
63
+ name: 'Customer Portal',
64
+ portalProfileMemberships: [
65
+ {
66
+ _id: 'a1',
67
+ name: 'Customer Portal Manager Standard',
68
+ active: false,
69
+ },
70
+ ],
71
+ },
72
+ ],
73
+ },
74
+ {
75
+ description: 'should detect a renamed portal',
76
+ source: [
77
+ {
78
+ name: 'Customer Portal',
79
+ description: 'Customer Portal',
80
+ adminUser: 'User User',
81
+ portalProfileMemberships: [],
82
+ _id: 'p1',
83
+ },
84
+ ],
85
+ target: [
86
+ {
87
+ name: 'Foo Portal',
88
+ oldName: 'Customer Portal',
89
+ },
90
+ ],
91
+ expected: [
92
+ {
93
+ _id: 'p1',
94
+ name: 'Foo Portal',
95
+ },
96
+ ],
97
+ },
98
+ {
99
+ description: 'should return no change',
100
+ source: [
101
+ {
102
+ name: 'Customer Portal',
103
+ description: 'Customer Portal',
104
+ adminUser: 'User User',
105
+ portalProfileMemberships: [
106
+ {
107
+ name: 'Customer Portal Manager Standard',
108
+ active: true,
109
+ _id: 'a1',
110
+ },
111
+ ],
112
+ _id: 'p1',
113
+ },
114
+ ],
115
+ target: [
116
+ {
117
+ name: 'Customer Portal',
118
+ portalProfileMemberships: [
119
+ {
120
+ name: 'Customer Portal Manager Standard',
121
+ active: true,
122
+ },
123
+ ],
124
+ },
125
+ ],
126
+ expected: undefined,
127
+ },
128
+ ];
129
+ describe('CustomerPortalSetup', () => {
130
+ describe('diff()', () => {
131
+ const p = new CustomerPortalSetup(global.browserforce);
132
+ for (const t of tests) {
133
+ it(t.description, () => {
134
+ const actual = p.diff(t.source, t.target);
135
+ assert.deepStrictEqual(actual, t.expected);
136
+ });
137
+ }
138
+ });
139
+ });
140
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../../src/plugins/customer-portal/portals/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,KAAK,GAAG;IACZ;QACE,WAAW,EAAE,4CAA4C;QACzD,MAAM,EAAE;YACN;gBACE,GAAG,EAAE,IAAI;gBACT,IAAI,EAAE,iBAAiB;gBACvB,WAAW,EAAE,iBAAiB;gBAC9B,SAAS,EAAE,WAAW;gBACtB,2BAA2B,EAAE,IAAI;gBACjC,yBAAyB,EAAE,gCAAgC;gBAC3D,sBAAsB,EAAE,MAAM;gBAC9B,yBAAyB,EAAE,gCAAgC;aAC5D;SACF;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,iBAAiB;gBACvB,WAAW,EAAE,iBAAiB;aAC/B;SACF;QACD,QAAQ,EAAE;YACR;gBACE,GAAG,EAAE,IAAI;gBACT,IAAI,EAAE,iBAAiB;gBACvB,WAAW,EAAE,iBAAiB;aAC/B;SACF;KACF;IACD;QACE,WAAW,EAAE,+DAA+D;QAC5E,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,iBAAiB;gBACvB,WAAW,EAAE,iBAAiB;gBAC9B,SAAS,EAAE,WAAW;gBACtB,wBAAwB,EAAE;oBACxB;wBACE,IAAI,EAAE,kCAAkC;wBACxC,MAAM,EAAE,IAAI;wBACZ,G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Q,EAAE,SAAS;KACpB;CACF,CAAC;AAEF,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;QACtB,MAAM,CAAC,GAAG,IAAI,mBAAmB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QACvD,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,EAAE;gBACrB,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;gBAC1C,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;YAC7C,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { BrowserforcePlugin } from '../../plugin.js';
2
+ type Density = 'Comfy' | 'Compact';
3
+ type Config = {
4
+ density: Density;
5
+ };
6
+ export declare class DensitySettings extends BrowserforcePlugin {
7
+ retrieve(): Promise<Config>;
8
+ apply(config: Config): Promise<void>;
9
+ }
10
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,39 @@
1
+ import assert from 'assert';
2
+ import { DensitySettings } from './index.js';
3
+ describe(DensitySettings.name, function () {
4
+ let plugin;
5
+ before(() => {
6
+ plugin = new DensitySettings(global.browserforce);
7
+ });
8
+ const configComfy = {
9
+ density: 'Comfy',
10
+ };
11
+ const configCompact = { density: 'Compact' };
12
+ it('should set to Compact', async () => {
13
+ await plugin.run(configCompact);
14
+ });
15
+ it('should be set to Compact', async () => {
16
+ const res = await plugin.retrieve();
17
+ assert.deepStrictEqual(res, configCompact);
18
+ });
19
+ it('should set to Comfy', async () => {
20
+ await plugin.apply(configComfy);
21
+ });
22
+ it('should be set to Comfy', async () => {
23
+ const res = await plugin.retrieve();
24
+ assert.deepStrictEqual(res, configComfy);
25
+ });
26
+ it('should throw for invalid density', async () => {
27
+ let err;
28
+ try {
29
+ await plugin.run({ density: 'Foo' });
30
+ }
31
+ catch (e) {
32
+ err = e;
33
+ }
34
+ assert.throws(() => {
35
+ throw err;
36
+ }, /Could not find density/);
37
+ });
38
+ });
39
+ //# sourceMappingURL=index.e2e-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.e2e-spec.js","sourceRoot":"","sources":["../../../src/plugins/density-settings/index.e2e-spec.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAI7C,QAAQ,CAAC,eAAe,CAAC,IAAI,EAAE;IAC7B,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,WAAW,GAAW;QAC1B,OAAO,EAAE,OAAO;KACjB,CAAC;IACF,MAAM,aAAa,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IAE7C,EAAE,CAAC,uBAAuB,EAAE,KAAK,IAAI,EAAE;QACrC,MAAM,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,0BAA0B,EAAE,KAAK,IAAI,EAAE;QACxC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpC,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE;QACnC,MAAM,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,wBAAwB,EAAE,K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