@salesforcedevs/docs-components 0.17.1 → 0.17.12-search-alpha

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 (117) hide show
  1. package/lwc.config.json +17 -3
  2. package/package.json +18 -7
  3. package/src/modules/README.md +41 -0
  4. package/src/modules/doc/amfModelParser/amfModelParser.ts +674 -0
  5. package/src/modules/doc/amfReference/amfReference.css +25 -0
  6. package/src/modules/doc/amfReference/amfReference.html +55 -0
  7. package/src/modules/doc/amfReference/amfReference.ts +1467 -0
  8. package/src/modules/doc/amfReference/constants.ts +76 -0
  9. package/src/modules/doc/amfReference/types.ts +125 -0
  10. package/src/modules/doc/amfTopic/amfTopic.css +21 -0
  11. package/src/modules/doc/amfTopic/amfTopic.html +3 -0
  12. package/src/modules/doc/amfTopic/amfTopic.ts +111 -0
  13. package/src/modules/doc/amfTopic/types.ts +56 -0
  14. package/src/modules/doc/amfTopic/utils.ts +136 -0
  15. package/src/modules/doc/breadcrumbItem/breadcrumbItem.css +51 -0
  16. package/src/modules/doc/breadcrumbItem/breadcrumbItem.html +5 -0
  17. package/src/modules/doc/breadcrumbItem/breadcrumbItem.ts +71 -0
  18. package/src/modules/doc/breadcrumbs/breadcrumbs.css +27 -0
  19. package/src/modules/doc/breadcrumbs/breadcrumbs.html +58 -0
  20. package/src/modules/doc/breadcrumbs/breadcrumbs.ts +183 -0
  21. package/src/modules/doc/componentPlayground/componentPlayground.css +22 -0
  22. package/src/modules/doc/componentPlayground/componentPlayground.html +20 -0
  23. package/src/modules/doc/componentPlayground/componentPlayground.ts +42 -0
  24. package/src/modules/doc/content/content.css +89 -70
  25. package/src/modules/doc/content/content.html +1 -0
  26. package/src/modules/doc/content/content.ts +188 -195
  27. package/src/modules/doc/contentCallout/contentCallout.css +18 -10
  28. package/src/modules/doc/contentCallout/contentCallout.html +13 -4
  29. package/src/modules/doc/contentCallout/contentCallout.ts +14 -2
  30. package/src/modules/doc/contentLayout/contentLayout.css +1 -0
  31. package/src/modules/doc/contentLayout/contentLayout.html +46 -0
  32. package/src/modules/doc/contentLayout/contentLayout.ts +524 -0
  33. package/src/modules/doc/doDont/doDont.css +47 -0
  34. package/src/modules/doc/doDont/doDont.html +27 -0
  35. package/src/modules/doc/doDont/doDont.ts +17 -0
  36. package/src/modules/doc/header/header.css +70 -37
  37. package/src/modules/doc/header/header.html +41 -138
  38. package/src/modules/doc/header/header.ts +56 -78
  39. package/src/modules/doc/heading/heading.css +33 -0
  40. package/src/modules/doc/heading/heading.html +14 -0
  41. package/src/modules/doc/heading/heading.ts +67 -0
  42. package/src/modules/doc/headingAnchor/headingAnchor.css +3 -3
  43. package/src/modules/doc/headingAnchor/headingAnchor.ts +2 -2
  44. package/src/modules/doc/headingContent/headingContent.css +53 -0
  45. package/src/modules/doc/headingContent/headingContent.html +13 -0
  46. package/src/modules/doc/headingContent/headingContent.ts +30 -0
  47. package/src/modules/doc/lwcContentLayout/lwcContentLayout.css +1 -0
  48. package/src/modules/doc/lwcContentLayout/lwcContentLayout.html +45 -0
  49. package/src/modules/doc/lwcContentLayout/lwcContentLayout.ts +256 -0
  50. package/src/modules/doc/overview/overview.css +40 -0
  51. package/src/modules/doc/overview/overview.html +34 -0
  52. package/src/modules/doc/overview/overview.ts +12 -0
  53. package/src/modules/doc/phase/phase.css +21 -6
  54. package/src/modules/doc/phase/phase.html +15 -3
  55. package/src/modules/doc/phase/phase.ts +48 -12
  56. package/src/modules/doc/specificationContent/specificationContent.css +36 -0
  57. package/src/modules/doc/specificationContent/specificationContent.html +167 -0
  58. package/src/modules/doc/specificationContent/specificationContent.ts +127 -0
  59. package/src/modules/doc/sprigSurvey/sprigSurvey.html +20 -0
  60. package/src/modules/doc/sprigSurvey/sprigSurvey.scoped.css +16 -0
  61. package/src/modules/doc/sprigSurvey/sprigSurvey.ts +16 -0
  62. package/src/modules/doc/toc/toc.ts +1 -1
  63. package/src/modules/doc/versionPicker/versionPicker.css +64 -0
  64. package/src/modules/doc/versionPicker/versionPicker.html +38 -0
  65. package/src/modules/doc/versionPicker/versionPicker.ts +65 -0
  66. package/src/modules/doc/xmlContent/types.ts +120 -0
  67. package/src/modules/doc/xmlContent/utils.ts +163 -0
  68. package/src/modules/doc/xmlContent/xmlContent.css +54 -0
  69. package/src/modules/doc/xmlContent/xmlContent.html +54 -0
  70. package/src/modules/doc/xmlContent/xmlContent.ts +763 -0
  71. package/src/modules/docHelpers/amfStyle/amfStyle.css +355 -0
  72. package/src/modules/docHelpers/contentLayoutStyle/contentLayoutStyle.css +131 -0
  73. package/src/modules/docHelpers/imgStyle/imgStyle.css +59 -0
  74. package/src/modules/{helpers → docHelpers}/status/status.css +1 -1
  75. package/src/modules/docUtils/searchSyncer/searchSyncer.ts +86 -0
  76. package/src/modules/docUtils/utils/__mocks__/coveo.analytics.ts +16 -0
  77. package/src/modules/docUtils/utils/coveo.analytics.d.ts +10 -0
  78. package/src/modules/docUtils/utils/utils.ts +32 -0
  79. package/LICENSE +0 -12
  80. package/src/modules/doc/content/__tests__/content.test.ts +0 -312
  81. package/src/modules/doc/content/__tests__/mockDocContent.ts +0 -348
  82. package/src/modules/doc/content/__tests__/mockPageReference.ts +0 -8
  83. package/src/modules/doc/content/__tests__/mockSidebar.ts +0 -81
  84. package/src/modules/doc/content/content.stories.ts +0 -148
  85. package/src/modules/doc/contentCallout/__tests__/contentCallout.test.ts +0 -80
  86. package/src/modules/doc/contentCallout/__tests__/mockProps.ts +0 -14
  87. package/src/modules/doc/contentCallout/contentCallout.stories.ts +0 -29
  88. package/src/modules/doc/contentMedia/__tests__/contentMedia.test.ts +0 -97
  89. package/src/modules/doc/contentMedia/contentMedia.stories.ts +0 -113
  90. package/src/modules/doc/header/__tests__/coveoConfig.ts +0 -12
  91. package/src/modules/doc/header/__tests__/header.test.ts +0 -445
  92. package/src/modules/doc/header/__tests__/mockNavDevelopers.ts +0 -427
  93. package/src/modules/doc/header/__tests__/mockNavs.ts +0 -115
  94. package/src/modules/doc/header/__tests__/mockProps.ts +0 -152
  95. package/src/modules/doc/header/header.stories.ts +0 -190
  96. package/src/modules/doc/headingAnchor/__tests__/headingAnchor.test.ts +0 -111
  97. package/src/modules/doc/headingAnchor/headingAnchor.stories.ts +0 -33
  98. package/src/modules/doc/nav/__tests__/mockAvailableLanguages.ts +0 -8
  99. package/src/modules/doc/nav/__tests__/mockAvailableVersions.ts +0 -122
  100. package/src/modules/doc/nav/__tests__/mockPageReference.ts +0 -8
  101. package/src/modules/doc/nav/__tests__/mockPdfUrl.ts +0 -1
  102. package/src/modules/doc/nav/__tests__/mockSelectedLanguage.ts +0 -8
  103. package/src/modules/doc/nav/__tests__/mockSelectedVersion.ts +0 -8
  104. package/src/modules/doc/nav/__tests__/mockToc.ts +0 -146
  105. package/src/modules/doc/nav/__tests__/nav.test.ts +0 -58
  106. package/src/modules/doc/phase/__tests__/mockProps.ts +0 -13
  107. package/src/modules/doc/phase/__tests__/phase.test.ts +0 -60
  108. package/src/modules/doc/phase/phase.stories.ts +0 -12
  109. package/src/modules/doc/toc/__tests__/mockPageReference.ts +0 -8
  110. package/src/modules/doc/toc/__tests__/mockToc.ts +0 -146
  111. package/src/modules/doc/toc/__tests__/toc.test.ts +0 -29
  112. package/src/modules/doc/toolbar/__tests__/mockAvailableLanguages.ts +0 -8
  113. package/src/modules/doc/toolbar/__tests__/mockAvailableVersions.ts +0 -122
  114. package/src/modules/doc/toolbar/__tests__/mockPdfUrl.ts +0 -1
  115. package/src/modules/doc/toolbar/__tests__/mockSelectedLanguage.ts +0 -8
  116. package/src/modules/doc/toolbar/__tests__/mockSelectedVersion.ts +0 -8
  117. package/src/modules/doc/toolbar/__tests__/toolbar.test.ts +0 -44
package/LICENSE DELETED
@@ -1,12 +0,0 @@
1
- Copyright (c) 2020, Salesforce.com, Inc.
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
-
6
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
-
8
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
-
10
- * Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
-
12
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,312 +0,0 @@
1
- import CodeBlock from "dx/codeBlock";
2
- import { createRenderComponent } from "utils/tests";
3
- import Content from "../content";
4
- import * as mockContent from "./mockDocContent";
5
- import mockPageReference from "./mockPageReference";
6
-
7
- const TAG = "doc-content";
8
- const render = createRenderComponent(TAG, Content);
9
-
10
- describe("doc-content", () => {
11
- it("renders the content", () => {
12
- const component = render({
13
- docsData: mockContent.content,
14
- pageReference: mockPageReference,
15
- _isStorybook: false
16
- });
17
- const contentEl = component.shadowRoot.querySelector(
18
- '[data-name="content"]'
19
- );
20
- expect(contentEl).not.toBeNull();
21
- });
22
-
23
- it("renders both with and wothout pagination buttons", () => {
24
- const c_buttons = render({
25
- docsData: mockContent.withButtons,
26
- pageReference: mockPageReference,
27
- showPaginationButtons: true,
28
- _isStorybook: false
29
- });
30
- const dx_buttons = c_buttons.shadowRoot.querySelectorAll("dx-button");
31
- expect(dx_buttons.length).toEqual(2);
32
-
33
- const c_no_buttons = render({
34
- docsData: mockContent.withButtons,
35
- pageReference: mockPageReference,
36
- _isStorybook: false
37
- });
38
- const empty_dx_buttons =
39
- c_no_buttons.shadowRoot.querySelectorAll("dx-button");
40
- expect(empty_dx_buttons.length).toEqual(0);
41
- });
42
-
43
- it("swaps out images", () => {
44
- const component = render({
45
- docsData: mockContent.withImages,
46
- pageReference: mockPageReference,
47
- _isStorybook: false
48
- });
49
- const contentEl = component.shadowRoot.querySelector(
50
- '[data-name="content"]'
51
- );
52
- expect(contentEl).not.toBeNull();
53
- const images = component.shadowRoot.querySelectorAll("img");
54
- expect(images.length).toEqual(3);
55
- const contentMediaEls =
56
- component.shadowRoot.querySelectorAll("doc-content-media");
57
- expect(contentMediaEls.length).toEqual(0);
58
- });
59
-
60
- it("swaps out iframes", () => {
61
- const component = render({
62
- docsData: mockContent.withVideos,
63
- pageReference: mockPageReference,
64
- _isStorybook: false
65
- });
66
- const contentEl = component.shadowRoot.querySelector(
67
- '[data-name="content"]'
68
- );
69
- expect(contentEl).not.toBeNull();
70
- const images = component.shadowRoot.querySelectorAll("iframe");
71
- expect(images.length).toEqual(0);
72
- const contentMediaEls =
73
- component.shadowRoot.querySelectorAll("doc-content-media");
74
- expect(contentMediaEls.length).toEqual(2);
75
- contentMediaEls.forEach((contentMedia) => {
76
- expect(contentMedia.contentType).toEqual("iframe");
77
- expect(contentMedia.mediaTitle).not.toBeUndefined();
78
- expect(contentMedia.contentSrc).toMatch(
79
- "https://play.vidyard.com/"
80
- );
81
- });
82
- });
83
-
84
- it("swaps out notes", () => {
85
- const component = render({
86
- docsData: mockContent.withNotes,
87
- pageReference: mockPageReference,
88
- _isStorybook: false
89
- });
90
- const contentEl = component.shadowRoot.querySelector(
91
- '[data-name="content"]'
92
- );
93
- expect(contentEl).not.toBeNull();
94
- const notes = component.shadowRoot.querySelectorAll(".message");
95
- expect(notes).toHaveLength(4);
96
- notes.forEach((note) => {
97
- const noteHeader = note.querySelector("doc-content-callout");
98
- expect(noteHeader).not.toBeNull();
99
- });
100
- });
101
-
102
- it("includes tables, lists, and code blocks in notes", () => {
103
- const component = render({
104
- docsData: mockContent.withNotes,
105
- pageReference: mockPageReference,
106
- _isStorybook: false
107
- });
108
- const contentEl = component.shadowRoot.querySelector(
109
- '[data-name="content"]'
110
- );
111
- expect(contentEl).not.toBeNull();
112
- const notes = component.shadowRoot.querySelectorAll(".message");
113
- expect(notes[0].querySelector("table")).not.toBeNull();
114
- expect(notes[1].querySelector("ul")).not.toBeNull();
115
- expect(notes[2].querySelector("ol")).not.toBeNull();
116
- expect(notes[3].querySelector("dx-code-block")).not.toBeNull();
117
- });
118
-
119
- it("highlights text that matches search criteria", () => {
120
- const component = render({
121
- docsData: mockContent.content,
122
- pageReference: mockPageReference,
123
- isStorybook: true
124
- });
125
-
126
- const contentEl = component.shadowRoot.querySelector(
127
- '[data-name="content"]'
128
- );
129
-
130
- expect(contentEl.querySelectorAll("mark")).toHaveLength(0);
131
-
132
- contentEl.dispatchEvent(
133
- new CustomEvent("highlightedtermchange", {
134
- detail: "apex",
135
- composed: true,
136
- bubbles: true
137
- })
138
- );
139
-
140
- expect(contentEl.querySelectorAll("mark")).toHaveLength(14);
141
- });
142
-
143
- it("doesn't highlight elements that contains dx/docs components", () => {
144
- const searchTerm = "customreport";
145
-
146
- const component = render({
147
- docsData: mockContent.sampleCodeBlockAndNote,
148
- pageReference: mockPageReference,
149
- isStorybook: true
150
- });
151
-
152
- const contentEl = component.shadowRoot.querySelector(
153
- '[data-name="content"]'
154
- );
155
-
156
- expect(contentEl.querySelectorAll("mark")).toHaveLength(0);
157
-
158
- contentEl.dispatchEvent(
159
- new CustomEvent("highlightedtermchange", {
160
- detail: searchTerm,
161
- composed: true,
162
- bubbles: true
163
- })
164
- );
165
-
166
- const marks: Array<HTMLElement> = contentEl.querySelectorAll("mark");
167
-
168
- expect(marks).toHaveLength(0);
169
-
170
- const code: CodeBlock = contentEl.querySelector("dx-code-block");
171
- expect(code).not.toBeNull();
172
- expect(code.codeBlock).toBeTruthy();
173
- expect(contentEl.querySelector("doc-content-callout")).not.toBeNull();
174
- });
175
-
176
- it("doesn't highlight terms separated by html tags", () => {
177
- const searchTerm = "loadData within";
178
-
179
- const component = render({
180
- docsData: mockContent.sampleCodeBlockAndNote,
181
- pageReference: mockPageReference,
182
- isStorybook: true
183
- });
184
-
185
- const contentEl = component.shadowRoot.querySelector(
186
- '[data-name="content"]'
187
- );
188
-
189
- contentEl.dispatchEvent(
190
- new CustomEvent("highlightedtermchange", {
191
- detail: searchTerm,
192
- composed: true,
193
- bubbles: true
194
- })
195
- );
196
-
197
- const marks: Array<HTMLElement> =
198
- component.shadowRoot.querySelectorAll("mark");
199
- expect(marks).toHaveLength(0);
200
- });
201
-
202
- it("escapes regex especial characters", () => {
203
- const searchTerm = "used.+";
204
-
205
- const component = render({
206
- docsData: mockContent.sampleCodeBlockAndNote,
207
- pageReference: mockPageReference,
208
- isStorybook: true
209
- });
210
-
211
- const contentEl = component.shadowRoot.querySelector(
212
- '[data-name="content"]'
213
- );
214
-
215
- contentEl.dispatchEvent(
216
- new CustomEvent("highlightedtermchange", {
217
- detail: searchTerm,
218
- composed: true,
219
- bubbles: true
220
- })
221
- );
222
-
223
- const marks: Array<HTMLElement> =
224
- component.shadowRoot.querySelectorAll("mark");
225
- expect(marks).toHaveLength(0);
226
- });
227
-
228
- it("cleans previous search result before searching for a new term", () => {
229
- const firstSearch = "verify";
230
- const secondSearch = "sObject";
231
-
232
- const component = render({
233
- docsData: mockContent.sampleCodeBlockAndNote,
234
- pageReference: mockPageReference,
235
- isStorybook: true
236
- });
237
-
238
- const contentEl = component.shadowRoot.querySelector(
239
- '[data-name="content"]'
240
- );
241
-
242
- contentEl.dispatchEvent(
243
- new CustomEvent("highlightedtermchange", {
244
- detail: firstSearch,
245
- composed: true,
246
- bubbles: true
247
- })
248
- );
249
-
250
- const firstMarks: Array<HTMLElement> =
251
- component.shadowRoot.querySelectorAll("mark");
252
- expect(firstMarks).toHaveLength(2);
253
- firstMarks.forEach(({ textContent }) =>
254
- expect(textContent).toBe(firstSearch)
255
- );
256
-
257
- contentEl.dispatchEvent(
258
- new CustomEvent("highlightedtermchange", {
259
- detail: secondSearch,
260
- composed: true,
261
- bubbles: true
262
- })
263
- );
264
-
265
- const secondMarks: Array<HTMLElement> =
266
- component.shadowRoot.querySelectorAll("mark");
267
- expect(secondMarks).toHaveLength(1);
268
- secondMarks.forEach(({ textContent }) =>
269
- expect(textContent).toBe(secondSearch)
270
- );
271
- });
272
-
273
- it("cleans all marks if the search term is empty string", () => {
274
- const firstSearch = "verify";
275
- const secondSearch = "";
276
-
277
- const component = render({
278
- docsData: mockContent.sampleCodeBlockAndNote,
279
- pageReference: mockPageReference,
280
- isStorybook: true
281
- });
282
-
283
- const contentEl = component.shadowRoot.querySelector(
284
- '[data-name="content"]'
285
- );
286
-
287
- contentEl.dispatchEvent(
288
- new CustomEvent("highlightedtermchange", {
289
- detail: firstSearch,
290
- composed: true,
291
- bubbles: true
292
- })
293
- );
294
-
295
- const firstMarks: Array<HTMLElement> =
296
- component.shadowRoot.querySelectorAll("mark");
297
- expect(firstMarks).toHaveLength(2);
298
- firstMarks.forEach(({ textContent }) =>
299
- expect(textContent).toBe(firstSearch)
300
- );
301
-
302
- contentEl.dispatchEvent(
303
- new CustomEvent("highlightedtermchange", {
304
- detail: secondSearch,
305
- composed: true,
306
- bubbles: true
307
- })
308
- );
309
-
310
- expect(component.shadowRoot.querySelectorAll("mark")).toHaveLength(0);
311
- });
312
- });
@@ -1,348 +0,0 @@
1
- export const content = `<div><a name='apex_dev_guide'><!-- --></a><h1 class='helpHead1'>Apex Developer Guide</h1><div class='shortdesc'>Salesforce has changed the way organizations do business by moving enterprise
2
- applications that were traditionally client-server-based into the Lightning Platform, an
3
- on-demand, multitenant Web environment. This environment enables you to run and customize
4
- applications, such as Salesforce Automation and Service &amp; Support, and build new custom
5
- applications based on particular business needs. </div><div id='sfdc:seealso' class='related-links'>
6
- <ul class='ullinks'>
7
- <li class='link ulchildlink'>
8
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/apex_intro_get_started.htm'>Getting Started with Apex</a></strong><br>
9
- Apex is a strongly typed, object-oriented programming language that allows developers to execute flow and transaction control statements on the Lightning Platform server, in conjunction with calls to the API.</li>
10
- <li class='link ulchildlink'>
11
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/apex_writing.htm'>Writing Apex</a></strong><br>
12
- Apex is like Java for Salesforce. It enables you to add and interact with data in the Lightning Platform persistence layer. It uses classes, data types, variables, and if-else statements. You can make it execute based on a condition, or have a block of code execute repeatedly.</li>
13
- <li class='link ulchildlink'>
14
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/apex_running.htm'>Running Apex</a></strong><br>
15
- You can access many features of the Salesforce user interface programmatically in Apex, and you can integrate with external SOAP and REST Web services. You can run Apex code using a variety of mechanisms. Apex code runs in atomic transactions. </li>
16
- <li class='link ulchildlink'>
17
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/apex_debug_test_deploy.htm'>Debugging, Testing, and Deploying Apex</a></strong><br>
18
- Develop your Apex code in a sandbox and debug it with the Developer Console and debug logs. Unit-test your code, then distribute it to customers using packages.</li>
19
- <li class='link ulchildlink'>
20
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/apex_reference.htm'>Apex Language Reference</a></strong><br>
21
- This Apex reference goes into detail about DML statements and the built-in Apex classes and interfaces.</li>
22
- <li class='link ulchildlink'>
23
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/apex_appendices.htm'>Appendices</a></strong><br>
24
- </li>
25
- <li class='link ulchildlink'>
26
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/glossary_apex.htm'>Glossary</a></strong><br>
27
- </li>
28
- </ul>
29
- </div><!--DRC 228.7--></div>`;
30
-
31
- export const withButtons = `<div><a name='apex_dev_guide'><!-- --></a><h1 class='helpHead1'>Apex Developer Guide</h1><div class='shortdesc'>Salesforce has changed the way organizations do business by moving enterprise
32
- applications that were traditionally client-server-based into the Lightning Platform, an
33
- on-demand, multitenant Web environment. This environment enables you to run and customize
34
- applications, such as Salesforce Automation and Service &amp; Support, and build new custom
35
- applications based on particular business needs. </div><div id='sfdc:seealso' class='related-links'>
36
- <ul class='ullinks'>
37
- <li class='link ulchildlink'>
38
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/apex_intro_get_started.htm'>Getting Started with Apex</a></strong><br>
39
- Apex is a strongly typed, object-oriented programming language that allows developers to execute flow and transaction control statements on the Lightning Platform server, in conjunction with calls to the API.</li>
40
- <li class='link ulchildlink'>
41
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/apex_writing.htm'>Writing Apex</a></strong><br>
42
- Apex is like Java for Salesforce. It enables you to add and interact with data in the Lightning Platform persistence layer. It uses classes, data types, variables, and if-else statements. You can make it execute based on a condition, or have a block of code execute repeatedly.</li>
43
- <li class='link ulchildlink'>
44
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/apex_running.htm'>Running Apex</a></strong><br>
45
- You can access many features of the Salesforce user interface programmatically in Apex, and you can integrate with external SOAP and REST Web services. You can run Apex code using a variety of mechanisms. Apex code runs in atomic transactions. </li>
46
- <li class='link ulchildlink'>
47
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/apex_debug_test_deploy.htm'>Debugging, Testing, and Deploying Apex</a></strong><br>
48
- Develop your Apex code in a sandbox and debug it with the Developer Console and debug logs. Unit-test your code, then distribute it to customers using packages.</li>
49
- <li class='link ulchildlink'>
50
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/apex_reference.htm'>Apex Language Reference</a></strong><br>
51
- This Apex reference goes into detail about DML statements and the built-in Apex classes and interfaces.</li>
52
- <li class='link ulchildlink'>
53
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/apex_appendices.htm'>Appendices</a></strong><br>
54
- </li>
55
- <li class='link ulchildlink'>
56
- <strong><a href='atlas.en-us.apexcode.meta/apexcode/glossary_apex.htm'>Glossary</a></strong><br>
57
- </li>
58
- <div style='display: flex; justify-content: space-between; width: 220px; margin-top: 15px;'>
59
- <a href='atlas.en-us.apexcode.meta/apexcode/glossary_apex.htm'>← Previous</a>
60
- <a href='atlas.en-us.apexcode.meta/apexcode/glossary_apex.htm'>Next →</a>
61
- </div>
62
- </ul>
63
- </div><!--DRC 228.7--></div>`;
64
-
65
- export const withImages = `<div>
66
- <div class='section'>
67
- <h2 class='helpHead2'>Sketch</h2>
68
-
69
- <p class='p'>
70
- The following diagram illustrates how Streaming API can be
71
- implemented to stream notifications to the Salesforce user
72
- interface. These notifications are triggered by record changes
73
- in Salesforce.
74
- </p>
75
-
76
- <div class='p'>
77
- <div class='fig fignone'>
78
- <span class='figcap'>
79
- UI Update in Salesforce Triggered by a Data Change
80
- </span>
81
-
82
- <img
83
- class='image'
84
- src='https://developer.salesforce.com/docs/resources/img/en-us/232.0?doc_id=dev_guides%2Fintegration_patterns%2Fimages%2Fui_updates_data_changes.png&amp;folder=integration_patterns_and_practices'
85
- alt='UI Update Based on Data Changes Pattern'
86
- />
87
- </div>
88
- </div>
89
- </div>
90
-
91
- <div class='section'>
92
- <h2 class='helpHead2'>Sketch</h2>
93
-
94
- <p class='p'>
95
- The following diagram illustrates how Streaming API can be
96
- implemented to stream notifications to the Salesforce user
97
- interface. These notifications are triggered by record changes
98
- in Salesforce.
99
- </p>
100
-
101
- <div class='p'>
102
- <div class='fig fignone'>
103
- <span class='figcap'>
104
- UI Update in Salesforce Triggered by a Data Change
105
- </span>
106
-
107
- <img
108
- class='image'
109
- src='https://developer.salesforce.com/docs/resources/img/en-us/232.0?doc_id=dev_guides%2Fintegration_patterns%2Fimages%2Fui_updates_data_changes.png&amp;folder=integration_patterns_and_practices'
110
- alt='UI Update Based on Data Changes Pattern'
111
- />
112
- </div>
113
- </div>
114
- </div>
115
-
116
- <div class='section'>
117
- <h2 class='helpHead2'>Sketch</h2>
118
-
119
- <p class='p'>
120
- The following diagram illustrates how Streaming API can be
121
- implemented to stream notifications to the Salesforce user
122
- interface. These notifications are triggered by record changes
123
- in Salesforce.
124
- </p>
125
-
126
- <div class='p'>
127
- <div class='fig fignone'>
128
- <span class='figcap'>
129
- UI Update in Salesforce Triggered by a Data Change
130
- </span>
131
-
132
- <img
133
- class='image'
134
- src='https://developer.salesforce.com/docs/resources/img/en-us/232.0?doc_id=dev_guides%2Fintegration_patterns%2Fimages%2Fui_updates_data_changes.png&amp;folder=integration_patterns_and_practices'
135
- alt='UI Update Based on Data Changes Pattern'
136
- />
137
- </div>
138
- </div>
139
- </div>
140
- </div>`;
141
-
142
- export const withTable = `<table>
143
- <thead>
144
- <tr>
145
- <th><strong>Parameter</strong></th>
146
- <th><strong>Required</strong></th>
147
- <th><strong>Description</strong></th>
148
- </tr>
149
- </thead>
150
- <tbody>
151
- <tr>
152
- <td><code>grant_type</code></td>
153
- <td>X</td>
154
- <td>The value must be password</td>
155
- </tr>
156
- <tr>
157
- <td><code>client_id</code></td>
158
- <td>X</td>
159
- <td>The consumer key</td>
160
- </tr>
161
- <tr>
162
- <td><code>client_secret</code></td>
163
- <td>X</td>
164
- <td>The consumer secret</td>
165
- </tr>
166
- <tr>
167
- <td><code>username</code></td>
168
- <td>X</td>
169
- <td>The email address of the SSO user account</td>
170
- </tr>
171
- <tr>
172
- <td><code>password</code></td>
173
- <td>X</td>
174
- <td>The password of the SSO user account</td>
175
- </tr>
176
- <tr>
177
- <td><code>list</code></td>
178
- <td>X</td>
179
- <td class="with-list">
180
- The items in this list should not have larger text than normal:
181
- <ul>
182
- <li class="li">Item one</li>
183
- <li class="li">Item two</li>
184
- </ul>
185
- </td>
186
- </tr>
187
- <tr>
188
- <td><a href="#">link</a></td>
189
- <td>X</td>
190
- <td class="with-link-and-p">
191
- The link text should not be larger than normal.
192
- <p>Paragraph text should not be larger either.</p>
193
- </td>
194
- </tr>
195
- <tr>
196
- <td><code>callout</code></td>
197
- <td></td>
198
- <td class="with-callout">
199
- This callout should still have larger text:
200
- <doc-content-callout title="Callout test" variant="note">
201
- <p>The text here should *not* be the same size as other table text.</p>
202
- </doc-content-callout>
203
- </td>
204
- </tr>
205
- </tbody>
206
- </table>`;
207
-
208
- export const withVideos = `<div>
209
- <iframe src='https://play.vidyard.com/yThw736PBYf18ts1f8SKXa?disable_popouts=1&v=4.2.30&type=inline' title='Video title'></iframe>
210
- <iframe src='https://play.vidyard.com/yThw736PBYf18ts1f8SKXa?disable_popouts=1&v=4.2.30&type=inline' label='This is from a label'></iframe>
211
- </div>`;
212
-
213
- const noteWithTable = `<div class='box message info'>
214
- <h4>Note with a table</h4>
215
- <div class='data colSort'>
216
- <table class='featureTable sort_table' summary=''>
217
- <thead class='thead sorted' align='left'>
218
- <tr>
219
- <th class='featureTableHeader vertical-align-top ' id='d8672e193'>Organization Type</th>
220
- <th class='featureTableHeader vertical-align-top ' id='d8672e196'>Secure URL</th>
221
- </tr>
222
- </thead>
223
- <tbody class='tbody'>
224
- <tr>
225
- <td class='entry' headers='d8672e193' data-title='Organization Type'>Developer Edition</td>
226
- <td class='entry' headers='d8672e196' data-title='Secure URL'><span class='ph filepath'><var
227
- class='keyword varname'>MyDomainName</var>-dev-ed.my.salesforce-sites.com</span>
228
- </td>
229
- </tr>
230
- <tr>
231
- <td class='entry' headers='d8672e193' data-title='Organization Type'>Sandbox</td>
232
- <td class='entry' headers='d8672e196' data-title='Secure URL'><span class='ph filepath'><var
233
- class='keyword varname'>MyDomainName</var>--<var
234
- class='keyword varname'>SandboxName</var>.sandbox.my.salesforce-sites.com</span>
235
- </td>
236
- </tr>
237
- <tr>
238
- <td class='entry' headers='d8672e193' data-title='Organization Type'>Production</td>
239
- <td class='entry' headers='d8672e196' data-title='Secure URL'><span class='ph filepath'><var
240
- class='keyword varname'>MyDomainName</var>.my.salesforce-sites.com</span></td>
241
- </tr>
242
- </tbody>
243
- </table>
244
- </div>
245
- </div>`;
246
-
247
- const noteWithOrderedList = `<div class='box message info'>
248
- <h4 class='mbs'>Note with ordered list</h4>
249
- <ol class='ol enumList'>
250
- <li class='li'>From Setup, enter <kbd class='ph userinput'>Apex Classes</kbd> in the <span
251
- class='keyword parmname'>Quick
252
- Find</span> box, then select <strong class='ph uicontrol'>Apex Classes</strong>.</li>
253
-
254
- <li class='li'>Click <strong class='ph uicontrol'>Edit</strong> next to SiteRegisterController.</li>
255
-
256
- <li class='li'>Find the <samp class='codeph apex_code'><span class='keyword'>private</span> <span
257
- class='keyword'>static</span> Id PORTAL_ACCOUNT_ID =
258
- <span class='string'>'&lt;Account_ID&gt;'</span>;</samp> line and insert the ID for the account that
259
- you want
260
- to
261
- associate with new users. The line should look similar to
262
- this:
263
- </li>
264
-
265
- <li class='li'>Click <strong class='ph uicontrol'>Save</strong>.</li>
266
- </ol>
267
- </div>`;
268
-
269
- const noteWithUnorderedList = `<div class='box message info'>
270
- <h4 class='mbs'>Note with unordered list</h4>
271
- <ul class='ul bulletList' id='static_resource_service_unavailable_page'>
272
- <li class='li'>Must be a public .zip file 1 MB or smaller.</li>
273
-
274
- <li class='li'>Must contain a page named <span class='ph filepath'>maintenance.html</span> at the root level
275
- of
276
- the .zip file. Other resources in the .zip file, such as images or CSS files, can follow
277
- any directory structure.</li>
278
- <li class='li'>Must contain only files that have file extensions.</li>
279
- </ul>
280
- </div>`;
281
-
282
- const noteWithCodeBlock = `<div class='box message info'>
283
- <div class='inner'>
284
- <div class='bd'>
285
- <div class='media'>
286
- <img class='img mtm'
287
- src='/docs/resources/img/en-us/232.0?doc_id=images%2Ficon_note.png&amp;folder=apexcode'
288
- alt='Note'>
289
- <div class='mediaBd'>
290
- <h4 class='mbs'>Note with code block</h4>
291
- <p><span class='ph' id='instanceof_change_part1'><a name='instanceof_change_part1'>
292
- <!-- --></a>In Apex saved with API version 32.0 and later,
293
- <samp class='codeph apex_code'><span class='statement'>instanceof</span></samp> returns
294
- <samp class='codeph apex_code'><span class='keyword'>false</span></samp> if the left
295
- operand is a null
296
- object. For
297
- example, the following sample returns <samp class='codeph apex_code'><span
298
- class='keyword'>false</span></samp>.
299
- </span></p>
300
- <div class='codeSection apex_code'>
301
- <pre class='codeblock brush:apex' id='instanceof_change_part2'><a name='instanceof_change_part2'><!-- --></a><span class='keyword'>Object</span> o = <span class='keyword'>null</span>;
302
- <span class='keyword'>Boolean</span> result = o <span class='statement'>instanceof</span> Account;
303
- System.assertEquals(<span class='keyword'>false</span>, result);</pre>
304
- </div>
305
- <span class='ph' id='instanceof_change_part3'><a name='instanceof_change_part3'>
306
- <!-- --></a>In API version 31.0 and earlier, <samp class='codeph apex_code'><span
307
- class='statement'>instanceof</span></samp> returns <samp
308
- class='codeph apex_code'><span class='keyword'>true</span></samp> in this case.</span>
309
- <p></p>
310
- </div>
311
- </div>
312
- </div>
313
- </div>
314
- </div>`;
315
-
316
- export const sampleCodeBlockAndNote = `
317
- <h1 class='helpHead1'>Using the instanceof Keyword</h1>
318
- <p class="p">If you need to verify at run time whether an object is actually an instance of a particular class, use the
319
- <samp class="codeph apex_code"><span class="statement">instanceof</span></samp> keyword.
320
- The <samp class="codeph apex_code"><span class="statement">instanceof</span></samp> keyword can only be used to
321
- verify if the target type in the expression on the right of the keyword is a viable
322
- alternative for the declared type of the expression on the left.
323
- </p>
324
- <div class="p">You could add the following check to the <samp class="codeph apex_code">Report</samp>class in the <a class="xref" href="atlas.en-us.apexcode.meta/apexcode/apex_classes_casting.htm" title="In general, all type information is available at run time. This means that Apex enables casting, that is, a data type of one class can be assigned to a data type of another class, but only if one class is a subclass of the other class. Use casting when you want to convert an object from one data type to another.">classes and casting example</a> before you cast the item back into a <samp class="codeph apex_code">CustomReport</samp> object.
325
- <div class="codeSection apex_code">
326
- <pre class="codeblock brush:apex">If (Reports.get(0) <span class="statement">instanceof</span> CustomReport) {\n <span class="onelineComment">// Can safely cast it back to a custom report object</span>\n CustomReport c = (CustomReport) Reports.get(0);\n} Else {\n <span class="onelineComment">// Do something with the non-custom-report.</span>\n}</pre>
327
- </div>
328
- </div>
329
- ${noteWithOrderedList}
330
- <div class="p">
331
- Follow these steps:
332
- <ol class="ol enumList">
333
- <li class="li">Add the data in a .csv file.</li>
334
- <li class="li">Create a static resource for this file.</li>
335
- <li class="li">
336
- Call <samp class="codeph apex_code">Test.loadData</samp> within your test
337
- method and passing it the sObject type token and the static resource name.
338
- </li>
339
- </ol>
340
- </div>
341
- `;
342
-
343
- export const withNotes = `<div>
344
- ${noteWithTable}
345
- ${noteWithUnorderedList}
346
- ${noteWithOrderedList}
347
- ${noteWithCodeBlock}
348
- </div>`;