Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix v4.6.2 #2374

Merged
merged 7 commits into from
Nov 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
<div class="c-bolt-code-snippet" data-mode="light">
<pre><code>{
"FullName": "OpportunityEvents_chn_OpportunityChangeEvent",
"Metadata": {
"enrichedFields": [
{"name": "OwnerId"},
{"name": "Name"},
{"name": "CloseDate"},
{"name": "Probability"}, 
{"name": "LastModifiedDate"},
{"name": "LastModifiedById"},
{"name": "IsClosed"},
{"name": "AccountId"},
{"name": "CreatedById"},
{"name": "CreatedDate"}
],
"eventChannel": "OpportunityEvents__chn",
"selectedEntity": "OpportunityChangeEvent"
}
} </code></pre>
</div>

<bolt-table>
<table>
<thead>
<tr>
<td style="width: 50%;">Element</td>
<td style="width: 89%;">Value</td>
</tr>
</thead>
<tbody>
<tr>
<td>Method</td>
<td><code>POST</code></td>
</tr>
<tr>
<td>Request URL</td>
<td>Instance URL received in the access token response with a
<code>/services/data/v51.0/tooling/sobjects/PlatformEventChannelMember</code>
part, for example
<code>https://sales-sample-URL.my.salesforce.com/services/data/v51.0/tooling/sobjects/PlatformEventChannelMember</code>
</td>
</tr>
<tr>
<td>Sample request body of JSON type with enrichment fields
added in an
<samp>OpportunityEvents__chn</samp>
channel member for an Opportunity entity
</td>
<td>
<div class="c-bolt-code-snippet some-other-class" data-mode="light">
<pre><code>{
"FullName": "OpportunityEvents_chn_OpportunityChangeEvent",
"Metadata": {
"enrichedFields": [
{"name": "OwnerId"},
{"name": "Name"},
{"name": "CloseDate"},
{"name": "Probability"}, 
{"name": "LastModifiedDate"},
{"name": "LastModifiedById"},
{"name": "IsClosed"},
{"name": "AccountId"},
{"name": "CreatedById"},
{"name": "CreatedDate"}
],
"eventChannel": "OpportunityEvents__chn",
"selectedEntity": "OpportunityChangeEvent"
}
} </code></pre>
</div>
</td>
</tr>
<tr>
<td>Sample request body of JSON type with enrichment fields
added in an
<samp>OpportunityEvents__chn</samp>
channel member for an Opportunity entity
</td>
<td>
<div class="c-bolt-code-snippet some-other-class" data-mode="light">
<pre><code>{
"FullName": "OpportunityEvents_chn_OpportunityChangeEvent",
"Metadata": {
"enrichedFields": [
{"name": "OwnerId"},
{"name": "Name"},
{"name": "CloseDate"},
{"name": "Probability"}, 
{"name": "LastModifiedDate"},
{"name": "LastModifiedById"},
{"name": "IsClosed"},
{"name": "AccountId"},
{"name": "CreatedById"},
{"name": "CreatedDate"}
],
"eventChannel": "OpportunityEvents__chn",
"selectedEntity": "OpportunityChangeEvent"
}
} </code></pre>
</div>
</td>
</tr>
<tr>
<td>Sample request body of JSON type with enrichment fields
added in a <samp>WorkOrderEvents__chn</samp>
channel member for a Work Order entity
</td>
<td>
<pre><code>{
"FullName": "WorkOrderEvents_chn_ WorkOrderChangeEvent",
"Metadata": {
"enrichedFields": [
{"name": "OwnerId"},
{"name": "Subject"},
{"name": "WorkOrderNumber"},
{"name": "Priority"}, 
{"name": "LastModifiedDate"},
{"name": "LastModifiedById"},
{"name": "IsClosed"},
{"name": "AccountId"},
{"name": "CreatedById"},
{"name": "CreatedDate"}
],
"eventChannel": "WorkOrderEvents__chn",
"selectedEntity": "WorkOrderChangeEvent"
  }
} </code></pre>
</td>
</tr>
</tbody>
</table>
</bolt-table>

<bolt-table>
<table>
<thead>
<tr>
<td style="width: 50%;">Element</td>
<td style="width: 89%;">Value</td>
</tr>
</thead>
<tbody>
<tr>
<td>Method</td>
<td><code>POST</code></td>
</tr>
<tr>
<td>Request URL</td>
<td>Instance URL received in the access token response with a
<code>/services/data/v51.0/tooling/sobjects/PlatformEventChannelMember</code>
part, for example
<code>https://sales-sample-URL.my.salesforce.com/services/data/v51.0/tooling/sobjects/PlatformEventChannelMember</code>
</td>
</tr>
<tr>
<td>Sample request body of JSON type with enrichment fields
added in an
<samp>OpportunityEvents__chn</samp>
channel member for an Opportunity entity
</td>
<td>
<div class="c-bolt-code-snippet some-other-class" data-mode="light">
<pre><code>{
"FullName": "OpportunityEvents_chn_OpportunityChangeEvent",
"Metadata": {
"enrichedFields": [
{"name": "OwnerId"},
{"name": "Name"},
{"name": "CloseDate"},
{"name": "Probability"}, 
{"name": "LastModifiedDate"},
{"name": "LastModifiedById"},
{"name": "IsClosed"},
{"name": "AccountId"},
{"name": "CreatedById"},
{"name": "CreatedDate"}
],
"eventChannel": "OpportunityEvents__chn",
"selectedEntity": "OpportunityChangeEvent"
}
} </code></pre>
</div>
</td>
</tr>
<tr>
<td>Sample request body of JSON type with enrichment fields
added in an
<samp>OpportunityEvents__chn</samp>
channel member for an Opportunity entity
</td>
<td>
<div class="c-bolt-code-snippet some-other-class" data-mode="light">
<pre><code>{
"FullName": "OpportunityEvents_chn_OpportunityChangeEvent",
"Metadata": {
"enrichedFields": [
{"name": "OwnerId"},
{"name": "Name"},
{"name": "CloseDate"},
{"name": "Probability"}, 
{"name": "LastModifiedDate"},
{"name": "LastModifiedById"},
{"name": "IsClosed"},
{"name": "AccountId"},
{"name": "CreatedById"},
{"name": "CreatedDate"}
],
"eventChannel": "OpportunityEvents__chn",
"selectedEntity": "OpportunityChangeEvent"
}
} </code></pre>
</div>
</td>
</tr>
<tr>
<td>Sample request body of JSON type with enrichment fields
added in a <samp>WorkOrderEvents__chn</samp>
channel member for a Work Order entity
</td>
<td>
<pre><code>{
"FullName": "WorkOrderEvents_chn_ WorkOrderChangeEvent",
"Metadata": {
"enrichedFields": [
{"name": "OwnerId"},
{"name": "Subject"},
{"name": "WorkOrderNumber"},
{"name": "Priority"}, 
{"name": "LastModifiedDate"},
{"name": "LastModifiedById"},
{"name": "IsClosed"},
{"name": "AccountId"},
{"name": "CreatedById"},
{"name": "CreatedDate"}
],
"eventChannel": "WorkOrderEvents__chn",
"selectedEntity": "WorkOrderChangeEvent"
  }
} </code></pre>
</td>
</tr>
</tbody>
</table>
<div slot="caption">This is a table caption</div>
</bolt-table>
7 changes: 6 additions & 1 deletion packages/components/bolt-code-snippet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ if (codeSnippets.length) {
import(/* webpackChunkName: 'bolt-code-snippet' */ './src/code-snippet').then(
({ BoltCodeSnippet }) => {
codeSnippets.forEach(el => {
const codeSnippetComponent = new BoltCodeSnippet(el);
// Workaround for Bolt Table...
// Table stringifies the DOM, losing any event binding setup by the Code Snippet component.
// So, we don't init any Code Snippets inside tables and let the Table component init them itself when it's ready.
if (!el.closest('bolt-table')) {
const codeSnippetComponent = new BoltCodeSnippet(el);
}
});
},
);
Expand Down
7 changes: 6 additions & 1 deletion packages/components/bolt-code-snippet/src/code-snippet.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ export class BoltCodeSnippet {
constructor(el) {
if (!el) return;
this.el = el;
this.init();

// Ensure component doesn't init twice
// @TODO: Enable component to be properly re-initialized?
if (!this.el.hasAttribute('data-bolt-ready')) {
this.init();
}
}

init() {
Expand Down
1 change: 1 addition & 0 deletions packages/components/bolt-table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"main": "index.js",
"style": "index.scss",
"dependencies": {
"@bolt/components-code-snippet": "^4.6.0",
"@bolt/core-v3.x": "^4.6.0",
"@bolt/lazy-queue": "^4.3.0",
"himalaya": "^1.1.0"
Expand Down
13 changes: 12 additions & 1 deletion packages/components/bolt-table/src/table.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { html, customElement, BoltElement, unsafeCSS } from '@bolt/element';
import { BoltCodeSnippet } from '@bolt/components-code-snippet/src/code-snippet';
import { unsafeHTML } from 'lit-html/directives/unsafe-html';
import { ifDefined } from 'lit-html/directives/if-defined';
import { parse, stringify } from 'himalaya';
Expand Down Expand Up @@ -52,7 +53,9 @@ class BoltTable extends BoltElement {
stripWhitespace(nodes) {
return nodes.map(node => {
if (node.type === 'element') {
node.children = this.stripWhitespace(node.children);
if (node.tagName !== 'code') {
node.children = this.stripWhitespace(node.children);
}
} else {
node.content =
node.content.trim().length === 0
Expand Down Expand Up @@ -134,6 +137,14 @@ class BoltTable extends BoltElement {
td.innerHTML = '';
}
});

// Init Code Snippets once Table has been updated, @see packages/components/bolt-code-snippet/index.js
const codeSnippets = this.querySelectorAll('.c-bolt-code-snippet');
if (codeSnippets.length) {
codeSnippets.forEach(el => {
const codeSnippetComponent = new BoltCodeSnippet(el);
});
}
}

render() {
Expand Down
Loading