Skip to content

Instantly share code, notes, and snippets.

View svierk's full-sized avatar
🏠
Working from home

Sebastiano Schwarz svierk

🏠
Working from home
View GitHub Profile
@svierk
svierk / package.json
Created June 1, 2023 08:18
Specify the required node / npm version for a project using the "engines" setting
"engines": {
"node": "18.16.0",
"npm": "9.x.x"
},
@svierk
svierk / customMapView.js
Created April 7, 2023 12:32
JS code for Custom Map View LWC
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { getRecord } from 'lightning/uiRecordApi';
import { api, LightningElement, track, wire } from 'lwc';
const ICONS = {
Account: 'standard:account',
Asset: 'standard:asset_object'
};
export default class CustomMapView extends LightningElement {
@svierk
svierk / customMapView.html
Created April 7, 2023 12:21
HTML Template for Custom Map View LWC
<template>
<lightning-map list-view={listView} map-markers={mapMarkers} zoom-level={zoomLevel} style={styles}></lightning-map>
</template>
@svierk
svierk / customMapView.js-meta.xml
Last active November 18, 2023 14:08
XML file for Custom Map View LWC
<?xml version="1.0" encoding="UTF-8" ?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<isExposed>true</isExposed>
<masterLabel>Custom Map View</masterLabel>
<description>Configurable map component for displaying locations via Google Maps API.</description>
<targets>
<target>lightning__RecordPage</target>
</targets>
<targetConfigs>
@svierk
svierk / example.js
Last active January 10, 2023 07:08
Base64 encoded PDF string example for Base64 to PDF LWC
const base64 = 'JVBERi0xLjMKJcTl8uXrp/Og0MTGCjMgMCBvYmoKPDwgL0ZpbHRlciAvRmxh...';
export { base64 };
@svierk
svierk / base64ToPdf.js
Created January 10, 2023 06:49
JS code for Base64 to PDF LWC (only download)
import { api, LightningElement } from 'lwc';
import { base64 } from './example.js';
export default class Base64ToPdf extends LightningElement {
pdf = `data:application/pdf;base64,${base64}`;
fileName = 'example.pdf';
}
@svierk
svierk / base64ToPdf.html
Last active January 10, 2023 06:47
HTML Template for Base64 to PDF LWC (only download)
<template>
<a class="slds-button slds-button_brand" href={pdf} download={fileName}>Download PDF File</a>
</template>
@svierk
svierk / base64ToPdf.js
Created January 10, 2023 06:45
JS code for Base64 to PDF LWC
import { api, LightningElement } from 'lwc';
import { base64 } from './example.js';
export default class Base64ToPdf extends LightningElement {
pdf = `data:application/pdf;base64,${base64}`;
fileName = 'example.pdf';
get pdfSrc() {
return this.pdf;
}
@svierk
svierk / base64ToPdf.html
Created January 10, 2023 06:42
HTML Template for Base64 to PDF LWC
<template>
<lightning-card title="Base64 To PDF" icon-name="doctype:pdf">
<a class="slds-button slds-button_brand" href={pdf} download={fileName} slot="actions">Download PDF File</a>
<div class="slds-p-around_medium">
<iframe src={pdfSrc} height="100%" width="500px" title="iFrame"></iframe>
</div>
</lightning-card>
</template>
@svierk
svierk / openRecordPageFlowAction.js-meta.xml
Last active November 18, 2023 14:09
XML file for Open Record Page Flow Action LWC
<?xml version="1.0" encoding="UTF-8" ?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<isExposed>true</isExposed>
<masterLabel>Open Record Page Flow Action</masterLabel>
<description>Component to forward to a record page from flow.</description>
<targets>
<target>lightning__FlowScreen</target>
</targets>
<targetConfigs>