diff --git a/.gitignore b/.gitignore index 25c1f5c..9ab20fa 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ open-iconic .next/ .nuxt/ dist/ -analytics.js \ No newline at end of file +analytics.js +.DS_Store \ No newline at end of file diff --git a/biome.json b/biome.json index b2ae923..2b81f92 100644 --- a/biome.json +++ b/biome.json @@ -7,7 +7,8 @@ "./examples/blazor/wasm/wwwroot/css/*", "./examples/wasm-benchmark/*", "./examples/asp-net/*", - "./examples/svelte-kit" + "./examples/svelte-kit", + "./examples/salesforce/*" ], "ignoreUnknown": true }, diff --git a/examples/salesforce/README.md b/examples/salesforce/README.md index a426fcc..74a16c2 100644 --- a/examples/salesforce/README.md +++ b/examples/salesforce/README.md @@ -1,14 +1,20 @@ -# PSPDFKit for Salesforce Integration +> ⚠️ **Repository Moved** +> This repository has been moved to https://github.com/PSPDFKit/nutrient-web-examples/tree/main/examples/salesforce. +> Please update your bookmarks and issues accordingly. +> +> This repo is now archived and will no longer receive updates. + +# Nutrient Salesforce SDK Integration ## Integrate into a New Salesforce Project as a Lightning Web Component -PSPDFKit for Salesforce enables you to open PDF, JPG, PNG, and TIFF files inside Salesforce. This unlocks the full functionality of PSPDFKit in Salesforce, including PDF generation, redaction, and signatures. +Nutrient Salesforce SDK enables you to open PDF, JPG, PNG, and TIFF files inside Salesforce. This unlocks the full functionality of Nutrient Web SDK in Salesforce, including PDF generation, redaction, and signatures. -This README explains how to integrate PSPDFKit into a new Salesforce project. The integration works as a [Lightning web component (LWC)][lwc] that you can add to any Salesforce organization. +This README explains how to integrate Nutrient Web SDK into a new Salesforce project. The integration works as a [Lightning web component (LWC)][lwc] that you can add to any Salesforce organization. -For more information on integrating PSPDFKit into an existing Salesforce project, see the [PSPDFKit for Salesforce documentation][salesforce docs]. +For more information on integrating Nutrient Web SDK into an existing Salesforce project, see the [Nutrient Salesforce SDK documentation][salesforce docs]. -PSPDFKit for Salesforce shares the same APIs as Nutrient Web SDK Standalone. For more information on customizing your Salesforce application, see the [Nutrient Web SDK Standalone documentation][web docs]. +Nutrient Salesforce SDK shares the same APIs as Nutrient Web SDK Standalone. For more information on customizing your Salesforce application, see the [Nutrient Web SDK Standalone documentation][web docs]. ## Requirements @@ -21,17 +27,17 @@ Before continuing, perform all of the following actions: ## Deploying the Package -To deploy the PSPDFKit package to your Salesforce organization, follow these steps. +To deploy the Nutrient Web SDK package to your Salesforce organization, follow these steps. -1. Download the [PSPDFKit for Salesforce project][zip] from GitHub, and then unpack the ZIP file. +1. Download the [Nutrient Salesforce SDK project][zip] from GitHub, and then unpack the ZIP file. - Alternatively, run the following terminal command to clone the [PSPDFKit for Salesforce repository][repo] from GitHub: + Alternatively, run the following terminal command to clone the [Nutrient Salesforce SDK repository][repo] from GitHub: ```bash git clone https://github.com/PSPDFKit/salesforce.git ``` -2. In the terminal, go to the PSPDFKit for Salesforce project folder and run the following command to install the PSPDFKit npm module. +2. In the terminal, go to the Nutrient Salesforce SDK project folder and run the following command to install the Nutrient Web SDK npm module. Use the following code for npm: @@ -45,15 +51,15 @@ To deploy the PSPDFKit package to your Salesforce organization, follow these ste yarn install ``` -3. The PSPDFKit for Salesforce integration example now makes use of the PSPDFKit version available from our CDN at https://cdn.cloud.pspdfkit.com/pspdfkit-web, which means it's no longer limited by Salesforce's upload assets size 5MB limit. +3. The Nutrient Salesforce SDK integration example now makes use of the Nutrient Web SDK version available from our CDN at https://cdn.cloud.pspdfkit.com/pspdfkit-web, which means it's no longer limited by Salesforce's upload assets size 5MB limit. -In order to set the PSPDFKit version you want to use, open `./force-app/main/default/pages/PSPDFKit_InitPSPDFKit.page` and edit the line 7 to reflect the PSPDFKit version. For example, in order to use version 2024.4.0, you should change the URL pointing to the CDN to: +In order to set the Nutrient Web SDK version you want to use, open `./force-app/main/default/pages/Nutrient_InitNutrient.page` and edit the line 7 to reflect the Nutrient Web SDK version. For example, in order to use version 1.0.0, you should change the URL pointing to the CDN to: ```html - + ``` - You can find the latest version of Nutrient Web SDK in the [PSPDFKit changelog](https://www.nutrient.io/changelog/web/). + You can find the latest version of Nutrient Web SDK in the [Nutrient Web SDK changelog](https://www.nutrient.io/changelog/web/). 4. Run the following command in the terminal to start the Salesforce authentication process: @@ -63,31 +69,31 @@ In order to set the PSPDFKit version you want to use, open `./force-app/main/def 5. In the browser window that opens, log in to your Salesforce organization and authorize the Salesforce CLI. -6. In the terminal, run the following command from the PSPDFKit for Salesforce project’s root folder: +6. In the terminal, run the following command from the Nutrient Salesforce SDK project’s root folder: ```bash sfdx force:source:deploy -x manifest/package.xml ``` -## Enabling Users to Use PSPDFKit +## Enabling Users to Use Nutrient Web SDK -To enable users of your Salesforce organization to use PSPDFKit, follow these steps. +To enable users of your Salesforce organization to use Nutrient Web SDK, follow these steps. 1. In Salesforce, go to **Users** > **Permission Sets**. -2. Find **PSPDFKit Admin Access** in the list and click it. +2. Find **Nutrient Admin Access** in the list and click it. 3. Click **Manage Assignments**. 4. Click **Add Assignment**. -5. Select the users you want to authorize to use PSPDFKit. +5. Select the users you want to authorize to use Nutrient. 6. Click **Next**, and then click **Assign**. ## Changing the Security Settings -PSPDFKit for Salesforce requires Lightning Locker to protect Lightning web components, but Salesforce uses Lightning Web Security by default. To change the default security settings, follow these steps. +Nutrient Salesforce SDK requires Lightning Locker to protect Lightning web components, but Salesforce uses Lightning Web Security by default. To change the default security settings, follow these steps. 1. In Salesforce, go to **Security** > **Session Settings**. @@ -95,15 +101,15 @@ PSPDFKit for Salesforce requires Lightning Locker to protect Lightning web compo 3. Scroll down and click **Save**. -## Using the PSPDFKit for Salesforce Integration +## Using the Nutrient Salesforce SDK Integration -To use PSPDFKit in your Salesforce organization, follow these steps. +To use Nutrient Web SDK in your Salesforce organization, follow these steps. -1. Ensure you’re logged in as a user authorized to use PSPDFKit. +1. Ensure you’re logged in as a user authorized to use Nutrient Web SDK. 2. In the top-right corner, open the App Launcher. -3. Search for and select **PSPDFKit**. +3. Search for and select **Nutrient**. 4. Click **browse** to upload local PDF files, or open a file from Salesforce. diff --git a/examples/salesforce/force-app/main/default/classes/PSPDFKitController.cls b/examples/salesforce/force-app/main/default/classes/NutrientController.cls similarity index 97% rename from examples/salesforce/force-app/main/default/classes/PSPDFKitController.cls rename to examples/salesforce/force-app/main/default/classes/NutrientController.cls index 98621fc..5c23802 100644 --- a/examples/salesforce/force-app/main/default/classes/PSPDFKitController.cls +++ b/examples/salesforce/force-app/main/default/classes/NutrientController.cls @@ -1,4 +1,4 @@ -global with sharing class PSPDFKitController { +global with sharing class NutrientController { public static contentVersion contVersion{get;set;} public static String conbase{get;set;} @@ -47,4 +47,4 @@ global with sharing class PSPDFKitController { } } -} \ No newline at end of file +} diff --git a/examples/salesforce/force-app/main/default/classes/PSPDFKitController.cls-meta.xml b/examples/salesforce/force-app/main/default/classes/NutrientController.cls-meta.xml similarity index 100% rename from examples/salesforce/force-app/main/default/classes/PSPDFKitController.cls-meta.xml rename to examples/salesforce/force-app/main/default/classes/NutrientController.cls-meta.xml diff --git a/examples/salesforce/force-app/main/default/classes/PSPDFKitControllerTest.cls b/examples/salesforce/force-app/main/default/classes/NutrientControllerTest.cls similarity index 87% rename from examples/salesforce/force-app/main/default/classes/PSPDFKitControllerTest.cls rename to examples/salesforce/force-app/main/default/classes/NutrientControllerTest.cls index a0441d8..c768cab 100644 --- a/examples/salesforce/force-app/main/default/classes/PSPDFKitControllerTest.cls +++ b/examples/salesforce/force-app/main/default/classes/NutrientControllerTest.cls @@ -1,5 +1,5 @@ @IsTest -public class PSPDFKitControllerTest { +public class NutrientControllerTest { @testSetup static void setup() { Account testAccts = new Account(Name = 'TestAcct'); @@ -27,7 +27,7 @@ public class PSPDFKitControllerTest { static void testGetAttacmentDetails() { Account act = [SELECT id FROM Account]; Test.startTest(); - List conDocList = PSPDFKitController.getAttachmentDetails(act.Id); + List conDocList = NutrientController.getAttachmentDetails(act.Id); Test.stopTest(); System.assertEquals(1,conDocList.size()); } @@ -37,7 +37,7 @@ public class PSPDFKitControllerTest { Account act = [SELECT id FROM Account]; ContentDocumentLink docLink = [SELECT contentDocumentId From ContentDocumentLink where LinkedEntityId=:act.Id]; Test.startTest(); - Map base64Data = PSPDFKitController.getbase64Data(docLink.contentDocumentId); + Map base64Data = NutrientController.getbase64Data(docLink.contentDocumentId); Test.stopTest(); System.assertEquals(3,base64Data.size()); } @@ -48,13 +48,13 @@ public class PSPDFKitControllerTest { ContentDocumentLink docLink = [SELECT contentDocumentId From ContentDocumentLink where LinkedEntityId=:act.Id]; Test.StartTest(); ApexPages.StandardController sc = new ApexPages.StandardController(docLink); - PSPDFKitController testAccPlan = new PSPDFKitController(); + NutrientController testAccPlan = new NutrientController(); - PageReference pageRef = Page.PSPDFKit_InitPSPDFKit; + PageReference pageRef = Page.Nutrient_InitNutrient; pageRef.getParameters().put('id', String.valueOf(docLink.contentDocumentId)); Test.setCurrentPage(pageRef); testAccPlan.getFileDetail(); Test.StopTest(); } -} \ No newline at end of file +} diff --git a/examples/salesforce/force-app/main/default/classes/PSPDFKitControllerTest.cls-meta.xml b/examples/salesforce/force-app/main/default/classes/NutrientControllerTest.cls-meta.xml similarity index 100% rename from examples/salesforce/force-app/main/default/classes/PSPDFKitControllerTest.cls-meta.xml rename to examples/salesforce/force-app/main/default/classes/NutrientControllerTest.cls-meta.xml diff --git a/examples/salesforce/force-app/main/default/labels/CustomLabels.labels-meta.xml b/examples/salesforce/force-app/main/default/labels/CustomLabels.labels-meta.xml index 95e8f6d..62bb285 100644 --- a/examples/salesforce/force-app/main/default/labels/CustomLabels.labels-meta.xml +++ b/examples/salesforce/force-app/main/default/labels/CustomLabels.labels-meta.xml @@ -5,6 +5,6 @@ en_US true Button label - Edit File with PSPDFKit + Edit File with Nutrient diff --git a/examples/salesforce/force-app/main/default/lwc/jsconfig.json b/examples/salesforce/force-app/main/default/lwc/jsconfig.json index f6c5c8d..c613acd 100644 --- a/examples/salesforce/force-app/main/default/lwc/jsconfig.json +++ b/examples/salesforce/force-app/main/default/lwc/jsconfig.json @@ -1,12 +1,19 @@ { - "compilerOptions": { - "experimentalDecorators": true - }, - "include": ["**/*", "../../../../.sfdx/typings/lwc/**/*.d.ts"], - "paths": { - "c/*": ["*"] - }, - "typeAcquisition": { - "include": ["jest"] - } + "compilerOptions": { + "experimentalDecorators": true + }, + "include": [ + "**/*", + "../../../../.sfdx/typings/lwc/**/*.d.ts" + ], + "paths": { + "c/*": [ + "*" + ] + }, + "typeAcquisition": { + "include": [ + "jest" + ] + } } diff --git a/examples/salesforce/force-app/main/default/lwc/pspdfkitEditButtonSolution/pspdfkitEditButtonSolution.html b/examples/salesforce/force-app/main/default/lwc/nutrientEditButtonSolution/nutrientEditButtonSolution.html similarity index 100% rename from examples/salesforce/force-app/main/default/lwc/pspdfkitEditButtonSolution/pspdfkitEditButtonSolution.html rename to examples/salesforce/force-app/main/default/lwc/nutrientEditButtonSolution/nutrientEditButtonSolution.html diff --git a/examples/salesforce/force-app/main/default/lwc/pspdfkitEditButtonSolution/pspdfkitEditButtonSolution.js b/examples/salesforce/force-app/main/default/lwc/nutrientEditButtonSolution/nutrientEditButtonSolution.js similarity index 60% rename from examples/salesforce/force-app/main/default/lwc/pspdfkitEditButtonSolution/pspdfkitEditButtonSolution.js rename to examples/salesforce/force-app/main/default/lwc/nutrientEditButtonSolution/nutrientEditButtonSolution.js index 9073836..819181c 100644 --- a/examples/salesforce/force-app/main/default/lwc/pspdfkitEditButtonSolution/pspdfkitEditButtonSolution.js +++ b/examples/salesforce/force-app/main/default/lwc/nutrientEditButtonSolution/nutrientEditButtonSolution.js @@ -1,6 +1,6 @@ -import Button_label from "@salesforce/label/c.Button_label"; import { LightningElement, api, track } from "lwc"; -export default class PSPDFKitEditButtonSolution extends LightningElement { +import Button_label from "@salesforce/label/c.Button_label"; +export default class NutrientEditButtonSolution extends LightningElement { @api recordId; @api btnColor; @api newTab = false; @@ -9,19 +9,19 @@ export default class PSPDFKitEditButtonSolution extends LightningElement { renderedCallback() { this.template.querySelector("button").style = - `background-color:${this.btnColor}`; + "background-color:" + this.btnColor; } openFileInNewTab() { - if (this.newTab === true) { + if (this.newTab == true) { this.newWindow = window.open( - `/apex/PSPDFKit_InitPSPDFKit?id=${this.recordId}`, - "_blank", + "/apex/Nutrient_InitNutrient?id=" + this.recordId, + "_blank" ); } else { this.newWindow = window.open( - `/apex/PSPDFKit_InitPSPDFKit?id=${this.recordId}`, - "_self", + "/apex/Nutrient_InitNutrient?id=" + this.recordId, + "_self" ); } } diff --git a/examples/salesforce/force-app/main/default/lwc/pspdfkitEditButtonSolution/pspdfkitEditButtonSolution.js-meta.xml b/examples/salesforce/force-app/main/default/lwc/nutrientEditButtonSolution/nutrientEditButtonSolution.js-meta.xml similarity index 100% rename from examples/salesforce/force-app/main/default/lwc/pspdfkitEditButtonSolution/pspdfkitEditButtonSolution.js-meta.xml rename to examples/salesforce/force-app/main/default/lwc/nutrientEditButtonSolution/nutrientEditButtonSolution.js-meta.xml diff --git a/examples/salesforce/force-app/main/default/lwc/pspdfkitFileSelector/pspdfkitFileSelector.css b/examples/salesforce/force-app/main/default/lwc/nutrientFileSelector/nutrientFileSelector.css similarity index 100% rename from examples/salesforce/force-app/main/default/lwc/pspdfkitFileSelector/pspdfkitFileSelector.css rename to examples/salesforce/force-app/main/default/lwc/nutrientFileSelector/nutrientFileSelector.css diff --git a/examples/salesforce/force-app/main/default/lwc/pspdfkitFileSelector/pspdfkitFileSelector.html b/examples/salesforce/force-app/main/default/lwc/nutrientFileSelector/nutrientFileSelector.html similarity index 91% rename from examples/salesforce/force-app/main/default/lwc/pspdfkitFileSelector/pspdfkitFileSelector.html rename to examples/salesforce/force-app/main/default/lwc/nutrientFileSelector/nutrientFileSelector.html index 209d6d6..fc5e788 100644 --- a/examples/salesforce/force-app/main/default/lwc/pspdfkitFileSelector/pspdfkitFileSelector.html +++ b/examples/salesforce/force-app/main/default/lwc/nutrientFileSelector/nutrientFileSelector.html @@ -41,7 +41,9 @@

Drop your document here, or browse

-

Supports PDF, JPG, PNG, TIF

+

+ Supports PDF, JPG, PNG, TIF, DOCX, PPTX and XLSX +

@@ -60,7 +62,7 @@
@@ -82,9 +84,9 @@

Salesforce Files

- + > diff --git a/examples/salesforce/force-app/main/default/lwc/pspdfkitFileSelector/pspdfkitFileSelector.js b/examples/salesforce/force-app/main/default/lwc/nutrientFileSelector/nutrientFileSelector.js similarity index 64% rename from examples/salesforce/force-app/main/default/lwc/pspdfkitFileSelector/pspdfkitFileSelector.js rename to examples/salesforce/force-app/main/default/lwc/nutrientFileSelector/nutrientFileSelector.js index c38893f..5eca2b0 100644 --- a/examples/salesforce/force-app/main/default/lwc/pspdfkitFileSelector/pspdfkitFileSelector.js +++ b/examples/salesforce/force-app/main/default/lwc/nutrientFileSelector/nutrientFileSelector.js @@ -1,8 +1,8 @@ -import getbase64Data from "@salesforce/apex/PSPDFKitController.getbase64Data"; -import { ShowToastEvent } from "lightning/platformShowToastEvent"; import { LightningElement, track, wire } from "lwc"; +import getbase64Data from "@salesforce/apex/NutrientController.getbase64Data"; +import { ShowToastEvent } from "lightning/platformShowToastEvent"; -export default class PSPDFKitFileSelector extends LightningElement { +export default class NutrientFileSelector extends LightningElement { fileContents; @track fileName; @track openModal = false; @@ -16,33 +16,33 @@ export default class PSPDFKitFileSelector extends LightningElement { this.fileName = this.file.name; } if ( - this.file.type !== "application/pdf" && - this.file.type !== "image/png" && - this.file.type !== "image/jpg" && - this.file.type !== "image/jpeg" && - this.file.type !== "image/tiff" && - this.file.type !== "image/tif" && - this.file.type !== "application/msword" && // doc - this.file.type !== + this.file.type != "application/pdf" && + this.file.type != "image/png" && + this.file.type != "image/jpg" && + this.file.type != "image/jpeg" && + this.file.type != "image/tiff" && + this.file.type != "image/tif" && + this.file.type != "application/msword" && // doc + this.file.type != "application/vnd.openxmlformats-officedocument.wordprocessingml.document" && // docx - this.file.type !== + this.file.type != "application/vnd.openxmlformats-officedocument.wordprocessingml.template" && // doct - this.file.type !== "application/vnd.ms-word.document.macroEnabled.12" && //.docm - this.file.type !== "application/vnd.ms-excel" && // xls", "xlt", "xla - this.file.type !== + this.file.type != "application/vnd.ms-word.document.macroEnabled.12" && //.docm + this.file.type != "application/vnd.ms-excel" && // xls", "xlt", "xla + this.file.type != "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" && // xlsx - this.file.type !== + this.file.type != "application/vnd.openxmlformats-officedocument.spreadsheetml.template" && // xltx - this.file.type !== "application/vnd.ms-powerpoint" && // ppt", "pps", "pot", "ppa - this.file.type !== + this.file.type != "application/vnd.ms-powerpoint" && // ppt", "pps", "pot", "ppa + this.file.type != "application/vnd.ms-powerpoint.presentation.macroEnabled.12" && // .pptm - this.file.type !== + this.file.type != "application/vnd.openxmlformats-officedocument.presentationml.presentation" && // pptx - this.file.type !== + this.file.type != "application/vnd.openxmlformats-officedocument.presentationml.template" && // potx - this.file.type !== + this.file.type != "application/vnd.openxmlformats-officedocument.presentationml.slideshow" && // ppsx - this.file.type !== "application/vnd.ms-excel.sheet.macroEnabled.12" // .xlsm + this.file.type != "application/vnd.ms-excel.sheet.macroEnabled.12" // .xlsm ) { const evt = new ShowToastEvent({ title: "Error", @@ -51,11 +51,11 @@ export default class PSPDFKitFileSelector extends LightningElement { }); this.dispatchEvent(evt); } else { - const visualForce = this.template.querySelector("iframe"); + let visualForce = this.template.querySelector("iframe"); if (visualForce) { visualForce.contentWindow.postMessage( { versionData: this.file, fName: this.fileName, state: "local" }, - "*", + "*" ); this.fileContents = null; } @@ -72,19 +72,19 @@ export default class PSPDFKitFileSelector extends LightningElement { this.handleFile(event); } handleClick() { - const input = document.createElement("input"); + var input = document.createElement("input"); input.setAttribute("type", "file"); input.setAttribute("multiple", false); input.setAttribute( "accept", - ".png, .jpg, .jpeg, .tiff, .tif, .pdf, .docx, .pptx, .xlsx, .doc, .xls, .ppt, .docm, .xlsm, .pptm, .potx, .ppsx, .xltx, .xlt, .xla, .ppa, .pot, .pps", + ".png, .jpg, .jpeg, .tiff, .tif, .pdf, .docx, .pptx, .xlsx, .doc, .xls, .ppt, .docm, .xlsm, .pptm, .potx, .ppsx, .xltx, .xlt, .xla, .ppa, .pot, .pps" ); input.style.display = "none"; input.click(); input.addEventListener("change", (file) => { this.handleFile(file); }); - const dropzone = this.template.querySelector("div[data-id=file]"); + var dropzone = this.template.querySelector("div[data-id=file]"); dropzone.appendChild(input); } @@ -97,19 +97,19 @@ export default class PSPDFKitFileSelector extends LightningElement { } openVfPage(event) { - const visualForce = this.template.querySelector("iframe"); + let visualForce = this.template.querySelector("iframe"); if (visualForce && event.detail) { getbase64Data({ strId: event.detail }) .then((result) => { - const base64str = result.VersionData; - const binary = atob(base64str.replace(/\s/g, "")); - const len = binary.length; - const buffer = new ArrayBuffer(len); - const view = new Uint8Array(buffer); - for (let i = 0; i < len; i++) { + var base64str = result.VersionData; + var binary = atob(base64str.replace(/\s/g, "")); + var len = binary.length; + var buffer = new ArrayBuffer(len); + var view = new Uint8Array(buffer); + for (var i = 0; i < len; i++) { view[i] = binary.charCodeAt(i); } - const blob = new Blob([view]); + var blob = new Blob([view]); visualForce.contentWindow.postMessage( { versionData: blob, @@ -117,7 +117,7 @@ export default class PSPDFKitFileSelector extends LightningElement { PathOnClient: result.PathOnClient, state: "salesforce", }, - "*", + "*" ); }) .catch((error) => { diff --git a/examples/salesforce/force-app/main/default/lwc/pspdfkitFileSelector/pspdfkitFileSelector.js-meta.xml b/examples/salesforce/force-app/main/default/lwc/nutrientFileSelector/nutrientFileSelector.js-meta.xml similarity index 100% rename from examples/salesforce/force-app/main/default/lwc/pspdfkitFileSelector/pspdfkitFileSelector.js-meta.xml rename to examples/salesforce/force-app/main/default/lwc/nutrientFileSelector/nutrientFileSelector.js-meta.xml diff --git a/examples/salesforce/force-app/main/default/lwc/nutrientOpenSalesforceFiles/nutrientOpenSalesforceFiles.html b/examples/salesforce/force-app/main/default/lwc/nutrientOpenSalesforceFiles/nutrientOpenSalesforceFiles.html new file mode 100644 index 0000000..b7a4f52 --- /dev/null +++ b/examples/salesforce/force-app/main/default/lwc/nutrientOpenSalesforceFiles/nutrientOpenSalesforceFiles.html @@ -0,0 +1,54 @@ + diff --git a/examples/salesforce/force-app/main/default/lwc/pspdfkitOpenSalesforceFiles/pspdfkitOpenSalesforceFiles.js b/examples/salesforce/force-app/main/default/lwc/nutrientOpenSalesforceFiles/nutrientOpenSalesforceFiles.js similarity index 78% rename from examples/salesforce/force-app/main/default/lwc/pspdfkitOpenSalesforceFiles/pspdfkitOpenSalesforceFiles.js rename to examples/salesforce/force-app/main/default/lwc/nutrientOpenSalesforceFiles/nutrientOpenSalesforceFiles.js index 87cd264..4039842 100644 --- a/examples/salesforce/force-app/main/default/lwc/pspdfkitOpenSalesforceFiles/pspdfkitOpenSalesforceFiles.js +++ b/examples/salesforce/force-app/main/default/lwc/nutrientOpenSalesforceFiles/nutrientOpenSalesforceFiles.js @@ -1,8 +1,8 @@ -import getAttachmentDetails from "@salesforce/apex/PSPDFKitController.getAttachmentDetails"; +import { LightningElement, wire, track } from "lwc"; import { CurrentPageReference } from "lightning/navigation"; -import { LightningElement, track, wire } from "lwc"; +import getAttachmentDetails from "@salesforce/apex/NutrientController.getAttachmentDetails"; -export default class pspdfkitOpenSalesforceFiles extends LightningElement { +export default class nutrientOpenSalesforceFiles extends LightningElement { @track isModalOpen; @track recordId; @track fileDetails = []; @@ -19,7 +19,7 @@ export default class pspdfkitOpenSalesforceFiles extends LightningElement { getAttachmentDetails({ record_Id: this.recordId }).then((data) => { this.fileDetails = data; if ( - this.fileDetails === undefined || + this.fileDetails == undefined || this.fileDetails == null || this.fileDetails.length === 0 ) { @@ -36,8 +36,8 @@ export default class pspdfkitOpenSalesforceFiles extends LightningElement { viewButton(event) { if ( this.recordId == null || - this.recordId === undefined || - this.recordId === "" + this.recordId == undefined || + this.recordId == "" ) { const itemIndex = event.currentTarget.dataset.index; this.rowSelected = this.fileDetails[itemIndex].Id; @@ -46,8 +46,8 @@ export default class pspdfkitOpenSalesforceFiles extends LightningElement { const itemIndex = event.currentTarget.dataset.index; this.rowSelected = this.fileDetails[itemIndex].Id; window.open( - `/apex/PSPDFKit_InitPSPDFKit?id=${this.rowSelected}`, - "_blank", + "/apex/Nutrient_InitNutrient?id=" + this.rowSelected, + "_blank" ); } } diff --git a/examples/salesforce/force-app/main/default/lwc/pspdfkitOpenSalesforceFiles/pspdfkitOpenSalesforceFiles.js-meta.xml b/examples/salesforce/force-app/main/default/lwc/nutrientOpenSalesforceFiles/nutrientOpenSalesforceFiles.js-meta.xml similarity index 100% rename from examples/salesforce/force-app/main/default/lwc/pspdfkitOpenSalesforceFiles/pspdfkitOpenSalesforceFiles.js-meta.xml rename to examples/salesforce/force-app/main/default/lwc/nutrientOpenSalesforceFiles/nutrientOpenSalesforceFiles.js-meta.xml diff --git a/examples/salesforce/force-app/main/default/lwc/pspdfkitOpenSalesforceFiles/pspdfkitOpenSalesforceFiles.html b/examples/salesforce/force-app/main/default/lwc/pspdfkitOpenSalesforceFiles/pspdfkitOpenSalesforceFiles.html deleted file mode 100644 index 6ab6d3f..0000000 --- a/examples/salesforce/force-app/main/default/lwc/pspdfkitOpenSalesforceFiles/pspdfkitOpenSalesforceFiles.html +++ /dev/null @@ -1,40 +0,0 @@ - \ No newline at end of file diff --git a/examples/salesforce/force-app/main/default/pages/PSPDFKit_InitPSPDFKit.page b/examples/salesforce/force-app/main/default/pages/Nutrient_InitNutrient.page similarity index 88% rename from examples/salesforce/force-app/main/default/pages/PSPDFKit_InitPSPDFKit.page rename to examples/salesforce/force-app/main/default/pages/Nutrient_InitNutrient.page index adcf390..0ed4cac 100644 --- a/examples/salesforce/force-app/main/default/pages/PSPDFKit_InitPSPDFKit.page +++ b/examples/salesforce/force-app/main/default/pages/Nutrient_InitNutrient.page @@ -1,10 +1,10 @@ - + -
+
- + diff --git a/examples/salesforce/force-app/main/default/pages/PSPDFKit_InitPSPDFKit.page-meta.xml b/examples/salesforce/force-app/main/default/pages/Nutrient_InitNutrient.page-meta.xml similarity index 86% rename from examples/salesforce/force-app/main/default/pages/PSPDFKit_InitPSPDFKit.page-meta.xml rename to examples/salesforce/force-app/main/default/pages/Nutrient_InitNutrient.page-meta.xml index 3974ed2..af84884 100644 --- a/examples/salesforce/force-app/main/default/pages/PSPDFKit_InitPSPDFKit.page-meta.xml +++ b/examples/salesforce/force-app/main/default/pages/Nutrient_InitNutrient.page-meta.xml @@ -3,5 +3,5 @@ 55.0 false false - + diff --git a/examples/salesforce/force-app/main/default/permissionsets/PSPDFKit_Admin_Access.permissionset-meta.xml b/examples/salesforce/force-app/main/default/permissionsets/Nutrient_Admin_Access.permissionset-meta.xml similarity index 67% rename from examples/salesforce/force-app/main/default/permissionsets/PSPDFKit_Admin_Access.permissionset-meta.xml rename to examples/salesforce/force-app/main/default/permissionsets/Nutrient_Admin_Access.permissionset-meta.xml index 818a447..5a35d9d 100644 --- a/examples/salesforce/force-app/main/default/permissionsets/PSPDFKit_Admin_Access.permissionset-meta.xml +++ b/examples/salesforce/force-app/main/default/permissionsets/Nutrient_Admin_Access.permissionset-meta.xml @@ -1,21 +1,21 @@ - PSPDFKitController + NutrientController true - PSPDFKitControllerTest + NutrientControllerTest true false - + - PSPDFKit_InitPSPDFKit + Nutrient_InitNutrient true - PSPDFKit + Nutrient Visible diff --git a/examples/salesforce/force-app/main/default/quickActions/Account.Edit_files_with_PSPDFKit.quickAction-meta.xml b/examples/salesforce/force-app/main/default/quickActions/Account.Edit_files_with_Nutrient.quickAction-meta.xml similarity index 71% rename from examples/salesforce/force-app/main/default/quickActions/Account.Edit_files_with_PSPDFKit.quickAction-meta.xml rename to examples/salesforce/force-app/main/default/quickActions/Account.Edit_files_with_Nutrient.quickAction-meta.xml index 94bf03d..f8e3fe3 100644 --- a/examples/salesforce/force-app/main/default/quickActions/Account.Edit_files_with_PSPDFKit.quickAction-meta.xml +++ b/examples/salesforce/force-app/main/default/quickActions/Account.Edit_files_with_Nutrient.quickAction-meta.xml @@ -1,8 +1,8 @@ ScreenAction - - pspdfkitOpenSalesforceFiles + + nutrientOpenSalesforceFiles false LightningWebComponent diff --git a/examples/salesforce/force-app/main/default/tabs/PSPDFKit.tab-meta.xml b/examples/salesforce/force-app/main/default/tabs/Nutrient.tab-meta.xml similarity index 64% rename from examples/salesforce/force-app/main/default/tabs/PSPDFKit.tab-meta.xml rename to examples/salesforce/force-app/main/default/tabs/Nutrient.tab-meta.xml index a4031ab..32fa5ff 100644 --- a/examples/salesforce/force-app/main/default/tabs/PSPDFKit.tab-meta.xml +++ b/examples/salesforce/force-app/main/default/tabs/Nutrient.tab-meta.xml @@ -1,6 +1,6 @@ - - pspdfkitFileSelector + + nutrientFileSelector Custom19: Wrench diff --git a/examples/salesforce/package-lock.json b/examples/salesforce/package-lock.json index 5451db0..d7dc5b9 100644 --- a/examples/salesforce/package-lock.json +++ b/examples/salesforce/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "hasInstallScript": true, "dependencies": { - "pspdfkit": "2024.8.1" + "@nutrient-sdk/viewer": "1.0.0" }, "devDependencies": { "@lwc/eslint-plugin-lwc": "^1.1.2", @@ -1999,6 +1999,15 @@ "node": ">= 8" } }, + "node_modules/@nutrient-sdk/viewer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@nutrient-sdk/viewer/-/viewer-1.0.0.tgz", + "integrity": "sha512-o2zp0xWwqIA7bEav5ymamNe/61EnSjY/7mkwy6nwgB2cudFFn8L8mI6Axd94UovqQrkCr9LT8gQOGboR0GBdvQ==", + "license": "SEE LICENSE IN https://www.nutrient.io/legal/Nutrient_SDK_User_Evaluation_Subscription_Agreement", + "dependencies": { + "@types/react": "^17.0.39" + } + }, "node_modules/@prettier/plugin-xml": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@prettier/plugin-xml/-/plugin-xml-2.2.0.tgz", @@ -8600,15 +8609,6 @@ "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==", "dev": true }, - "node_modules/pspdfkit": { - "version": "2024.8.1", - "resolved": "https://registry.npmjs.org/pspdfkit/-/pspdfkit-2024.8.1.tgz", - "integrity": "sha512-NLRZdRa9L9sO+Xbd3LD+xyZ9+o3cFNdZHvH2iOAkNl5xcQUdxGMJLhJsU6xtkeXgdYPoYQbPb1EvuCtNdJIHaA==", - "license": "SEE LICENSE IN https://www.nutrient.io/legal/Nutrient_SDK_User_Evaluation_Subscription_Agreement", - "dependencies": { - "@types/react": "^17.0.39" - } - }, "node_modules/punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", diff --git a/examples/salesforce/package.json b/examples/salesforce/package.json index 3c2bb9d..df6a75f 100644 --- a/examples/salesforce/package.json +++ b/examples/salesforce/package.json @@ -10,8 +10,11 @@ "test:unit:watch": "sfdx-lwc-jest --watch", "test:unit:debug": "sfdx-lwc-jest --debug", "test:unit:coverage": "sfdx-lwc-jest --coverage", - "postinstall": "node ./scripts/pspdfkit/update-pspdfkit-version.js", - "prepare": "test -f ./.git && husky install || echo 'Not a git repository, skipping husky install.'" + "postinstall": "node ./scripts/nutrient/update-nutrient-version.js", + "prepare": "test -f ./.git && husky install || echo 'Not a git repository, skipping husky install.'", + "prettier": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"", + "prettier:verify": "prettier --list-different \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"", + "precommit": "lint-staged" }, "devDependencies": { "@lwc/eslint-plugin-lwc": "^1.1.2", @@ -35,7 +38,15 @@ "json5@>= 2.0.0": "^2.2.2", "cross-spawn": "^7.0.5" }, + "lint-staged": { + "**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}": [ + "prettier --write" + ], + "**/{aura,lwc}/**": [ + "eslint" + ] + }, "dependencies": { - "pspdfkit": "2024.8.1" + "@nutrient-sdk/viewer": "1.0.0" } } diff --git a/examples/salesforce/scripts/nutrient/update-nutrient-version.js b/examples/salesforce/scripts/nutrient/update-nutrient-version.js new file mode 100644 index 0000000..22f549c --- /dev/null +++ b/examples/salesforce/scripts/nutrient/update-nutrient-version.js @@ -0,0 +1,23 @@ +const fs = require("fs"); +const { execSync } = require("child_process"); +const path = require("path"); + +const initNutrientPage = fs.readFileSync( + path.resolve("./force-app/main/default/pages/Nutrient_InitNutrient.page"), + "utf8" +); + +const version = execSync("npm view @nutrient-sdk/viewer version") + .toString("utf-8") + .trim(); + +const updatedNutrientPage = initNutrientPage.replace( + // Matches the URL token indicating the current Nutrient Web SDK version (eg. 1.0.0) + /pspdfkit-web@([0-9]+.[0-9]+.[0-9]+)?/g, + `pspdfkit-web@${version}` +); + +fs.writeFileSync( + path.resolve("./force-app/main/default/pages/Nutrient_InitNutrient.page"), + updatedNutrientPage +); diff --git a/examples/salesforce/scripts/pspdfkit/update-pspdfkit-version.js b/examples/salesforce/scripts/pspdfkit/update-pspdfkit-version.js deleted file mode 100644 index fb00a57..0000000 --- a/examples/salesforce/scripts/pspdfkit/update-pspdfkit-version.js +++ /dev/null @@ -1,21 +0,0 @@ -const fs = require("node:fs"); -const { execSync } = require("node:child_process"); -const path = require("node:path"); - -const initPSPDFKitPage = fs.readFileSync( - path.resolve("./force-app/main/default/pages/PSPDFKit_InitPSPDFKit.page"), - "utf8", -); - -const version = execSync("npm view pspdfkit version").toString("utf-8").trim(); - -const updatedPSPDFKitPage = initPSPDFKitPage.replace( - // Matches the URL token indicating the current Nutrient Web SDK version (eg. 2024.4.0) - /pspdfkit-web@([0-9]+.[0-9]+.[0-9]+)?/g, - `pspdfkit-web@${version}`, -); - -fs.writeFileSync( - path.resolve("./force-app/main/default/pages/PSPDFKit_InitPSPDFKit.page"), - updatedPSPDFKitPage, -);