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

Added content for Pub Sub API demo #419

Merged
merged 2 commits into from
Jun 30, 2022
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
26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ E-Bikes is a sample application that demonstrates how to build applications with

- [Installing E-Bikes using a scratch org](#installing-e-bikes-using-a-scratch-org)
- [Installing E-Bikes using a Developer Edition Org or a Trailhead Playground](#installing-e-bikes-using-a-developer-edition-org-or-a-trailhead-playground)
- [Optional installation instructions](#optional-installation-instructions)
- [Code Formatting](#code-formatting)
- [Code Linting](#code-linting)
- [Pre-commit Hook](#pre-commit-hook)
- [Lightning Web Component Tests](#lightning-web-component-tests)
- [UI Tests](#ui-tests)
- [Code Tours](#code-tours)
- [Optional demo installation](#optional-demo-installation)
- [Pub Sub API demo](#pub-sub-api-demo)
- [Optional tool installation](#optional-tool-installation)
- [Code formatting](#code-formatting)
- [Code linting](#code-linting)
- [Pre-commit hook](#pre-commit-hook)
- [Lightning Web Component tests](#lightning-web-component-tests)
- [UI tests with UTAM](#ui-tests)
- [Code Tours](#code-tours)

## Installing E-Bikes using a Scratch Org

Expand Down Expand Up @@ -190,7 +192,13 @@ Make sure to start from a brand-new environment to avoid conflicts with previous

1. In App Launcher, select the **E-Bikes** app.

## Optional Installation Instructions
## Optional Demo Installation

### Pub Sub API Demo

After installing the E-Bikes Salesforce app, you can install an optional [ebikes-manufacturing](https://github.com/trailheadapps/ebikes-manufacturing) demo app. This demo is built with the Lightning Web Runtime and demonstrates the use of the Pub Sub API with Change Data Capture events and Platform Events.

## Optional Tool Installation

This repository contains several tools and scripts that are relevant if you want to integrate modern web development tooling to your Salesforce development processes, or to your continuous integration/continuous deployment processes.

Expand Down Expand Up @@ -256,6 +264,6 @@ Follow these steps to run the UI tests manually:

**Note:** if the test runner fails to open Chrome programmatically, update the `chromedriver` dependency to the latest version in `package.json` then, run `npm install` and `npm run test:ui` again.

## Code Tours
### Code Tours

Code Tours are guided walkthroughs that will help you understand the app code better. To be able to run them, install the [CodeTour VSCode extension](https://marketplace.visualstudio.com/items?itemName=vsls-contrib.codetour).
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
<editHeading>true</editHeading>
<label>Information</label>
<layoutColumns>
<layoutItems>
<behavior>Required</behavior>
<field>Status__c</field>
</layoutItems>
<layoutItems>
<behavior>Readonly</behavior>
<field>Name</field>
Expand Down Expand Up @@ -46,6 +50,9 @@
<layoutColumns />
<style>CustomLinks</style>
</layoutSections>
<miniLayout>
<fields>Status__c</fields>
</miniLayout>
<relatedLists>
<fields>NAME</fields>
<relatedList>Order_Item__c.Order__c</relatedList>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ import { reduceErrors } from 'c/ldsUtils';

describe('c-lds-utils', () => {
describe('reduceErrors', () => {
it('reduces string error', () => {
const FULL_ERROR = 'mockError';

const reduced = reduceErrors(FULL_ERROR);

expect(reduced).toStrictEqual([FULL_ERROR]);
});

it('reduces single error with message in body', () => {
const FULL_ERROR = { body: { message: 'mockError' } };
const REDUCED_ERROR = [FULL_ERROR.body.message];
Expand Down
4 changes: 4 additions & 0 deletions force-app/main/default/lwc/ldsUtils/ldsUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export function reduceErrors(errors) {
.filter((error) => !!error)
// Extract an error message
.map((error) => {
// String error
if (typeof error === 'string') {
return error;
}
// UI API read errors
if (Array.isArray(error.body)) {
return error.body.map((e) => e.message);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"apiName": "Order__c",
"createable": true,
"custom": false,
"defaultRecordTypeId": "012000000000000AAA",
"deletable": true,
"dependentFields": {},
"feedEnabled": true,
"fields": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"controllerValues": {},
"defaultValue": null,
"eTag": "8c7c1b7d2a22b6e10fe50bed9f0e9204",
"url": "/services/data/v55.0/ui-api/object-info/Order__c/picklist-values/012000000000000AAA/Type",
"values": [
{
"attributes": null,
"label": "A",
"validFor": [],
"value": "A"
},
{
"attributes": null,
"label": "B",
"validFor": [],
"value": "B"
},
{
"attributes": null,
"label": "C",
"validFor": [],
"value": "C"
},
{
"attributes": null,
"label": "D",
"validFor": [],
"value": "D"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"apiName": "Contact",
"childRelationships": {},
"eTag": "846fdcd21a53214d447e578adbe263c6",
"fields": {
"Status__c": {
"displayValue": null,
"value": "A"
}
},
"id": "0031700000pHcf8AAC",
"lastModifiedById": "00517000002fESIAA2",
"lastModifiedDate": "2019-02-15T10:33:07.000Z",
"recordTypeInfo": null,
"systemModstamp": "2019-02-15T10:33:07.000Z"
}
Loading