SyncMadeEasy/force-app/main/default/lwc/smeProFeaturePlaceholder/smeProFeaturePlaceholder.js

246 lines
14 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import {LightningElement, track, wire} from 'lwc';
import isPackageInstalled from '@salesforce/apex/ShopifyController.isPackageInstalled';
import isPackageValid from '@salesforce/apex/ShopifyController.isPackageValid';
import {NavigationMixin} from 'lightning/navigation';
export default class SmeProFeaturePlaceholder extends NavigationMixin(LightningElement) {
@track showModal = false;
@track isInstalled = false;
@track isValid = true;
@track beforeInstallMessage = 'To access this feature, please install the SME Pro package from AppExchange by clicking the button below, then continue with the setup.';
@track beforeInstallTitle = 'Prerequisite Package Required';
@track beforeInstallButtonLabel = 'AppExchange';
@track onInstallMessage = 'You’re almost ready! Complete the setup to use this feature. Click below to learn more.';
@track onInstallTitle = 'Package Installed';
@track onInstallButtonLabel = 'How to Setup';
@track onExpireMessage = 'Your subscription period has expired. To renew your package and continue using the service, please contact us:';
@track onExpireTitle = 'Subscription Expired';
@track onExpireButtonLabel = 'Contact Support';
@track features = [
{
name: "Automate Lead Conversion",
updateName: "Lead Conversion on Customer's First Purchase",
sortOrder: 5,
description: "When a Shopify customer places their first order, this feature helps to convert the corresponding lead in Salesforce into an Account and Contact (or Person Account).",
link: "https://support.syncmadeasy.com/support/solutions/articles/1130000038415-how-to-automate-lead-conversion-from-shopify-to-salesforce-"
},
{
name: "Cancel Order Sync",
updateName: "Order Cancel Sync (Salesforce → Shopify)",
sortOrder: 12,
description: "Paid orders canceled in Salesforce are automatically canceled in Shopify.",
link: "https://support.syncmadeasy.com/support/solutions/articles/1130000039152-how-cancel-order-button-work-for-orders-"
},
{
name: "Do Not Override Opportunity Stage",
updateName: "Prevent Opportunity Stage Override from Shopify",
sortOrder: 17,
description: "This feature locks Salesforce opportunity stages from being overridden by Shopify.",
link: "https://support.syncmadeasy.com/support/solutions/articles/1130000042219-how-to-prevent-opportunity-stage-override-when-shopify-orders-are-updated"
},
{
name: "Initiate Batch Sync",
updateName: "Selective Date-Duration Data Sync (Shopify → Salesforce)",
sortOrder: 25,
description: "This feature helps sync Shopify's historical data for a specified date range.",
link: "https://support.syncmadeasy.com/support/solutions/articles/1130000038375-how-to-use-the-initiate-batch-sync-feature-"
}, {
name: "Lead Sync (Newsletter Subscribers)",
updateName: "Non-Purchasing Customer's Lead Creation",
sortOrder: 4,
description: "To track potential customers, this feature creates leads in Salesforce for those customer's who haven't purchased in Shopify.",
link: "https://support.syncmadeasy.com/en/support/solutions/articles/1130000041833-from-salesforce-to-shopify-%E2%80%94-the-easiest-way-to-sync-newsletter-leads-like-a-pro"
}, {
name: "Opportunity Closed On Draft Completed",
updateName: "Auto Close Opportunity on Shopify Draft Order Payment",
sortOrder: 16,
description: "This feature automatically updates the Salesforce opportunity stage to Closed Won when the corresponding Shopify draft order is marked as Paid.",
link: 'https://support.syncmadeasy.com/support/solutions/articles/1130000044451-how-to-auto-close-opportunities-when-shopify-draft-orders-are-paid'
}, {
name: "Order Sync As Draft",
updateName: "Preserve Shopify Orders as Drafts in Salesforce",
sortOrder: 15,
description: "This feature ensures Shopify orders are imported into Salesforce in Draft status.",
link: "https://support.syncmadeasy.com/support/solutions/articles/1130000044264-how-to-preserve-shopify-orders-as-drafts-in-salesforce-"
}, {
name: "Order Sync Based on Category",
updateName: "Order Sync – Based on Order Category (Salesforce → Shopify)",
sortOrder: 18,
description: "Salesforce orders are synced to Shopify according to their status category by this feature.",
link: 'https://support.syncmadeasy.com/support/solutions/articles/1130000044518-how-to-sync-orders-by-category-salesforce-%E2%86%92-shopify-'
}, {
name: "Prevent Duplicate Basis on Account",
updateName: "Account Duplicate Prevention (Based on Company Name)",
sortOrder: 2,
description: "Based on the Shopify Customer's Company Name, this feature updates existing Salesforce Accounts instead of creating new ones.",
link: "https://support.syncmadeasy.com/support/solutions/articles/1130000044251-how-account-duplicate-prevention-feature-works"
}, {
name: "Prevent Duplicate Basis on Email",
updateName: "Contact Duplicate Prevention (Based on Customer Email)",
sortOrder: 3,
description: "Based on the customer's email address, this feature updates existing Salesforce Contact records instead of creating new ones.",
link: "https://support.syncmadeasy.com/support/solutions/articles/1130000044252-how-contact-duplicate-prevention-feature-works"
}, {
name: "Product Images Sync",
updateName: "Product Images Sync (Shopify → Salesforce)",
sortOrder: 19,
description: "To keep product listings clear and attractive, this feature syncs product images from Shopify to Salesforce.",
link: "https://support.syncmadeasy.com/support/solutions/articles/1130000038371-how-to-sync-shopify-product-images-to-salesforce-"
}, {
name: "Salesforce Fulfillment Sync",
updateName: "Order Fulfillment Sync (Salesforce → Shopify)",
sortOrder: 7,
description: "This feature lets you fulfill paid orders from Salesforce, automatically syncing the fulfillment details back to Shopify.",
link: "https://support.syncmadeasy.com/support/solutions/articles/1130000042208-how-to-fulfill-a-shopify-paid-order-from-salesforce-"
}, {
name: "Salesforce Inventory Sync",
updateName: "Product Inventory Sync (Salesforce → Shopify)",
sortOrder: 14,
description: "Keep stock quantities accurate across Salesforce and Shopify by syncing inventory levels with this feature.",
link: "https://support.syncmadeasy.com/support/solutions/articles/1130000042220-how-to-sync-products-inventory-from-salesforce-to-shopify-"
}, {
name: "Salesforce Product Images Sync",
updateName: "Product Images Sync (Salesforce → Shopify)",
sortOrder: 20,
description: "Ensure both Salesforce and Shopify display the same product images by syncing them with this feature.",
link: "https://support.syncmadeasy.com/support/solutions/articles/1130000044258-how-to-sync-salesforce-product-images-to-shopify-"
}, {
name: "Salesforce Refunds Sync",
updateName: "Order Refund Sync (Salesforce → Shopify)",
sortOrder: 11,
description: "Refund information from Salesforce orders is automatically synced to the respective Shopify orders.",
link: "https://support.syncmadeasy.com/support/solutions/articles/1130000042211-how-to-refund-a-shopify-order-from-salesforce-"
}, {
name: "SF2Shopify Sync",
updateName: "Salesforce → Shopify Data Sync",
sortOrder: 1,
description: "This feature helps synchronize data from Salesforce to Shopify based on the configured field mappings and their corresponding object mappings.",
link: "https://support.syncmadeasy.com/support/solutions/articles/1130000038471-how-send-to-shopify-button-work-for-all-objects-"
}, {
name: "Shopify Abandoned Checkouts Sync",
updateName: "Checkout Synchronization (Shopify → Salesforce)",
sortOrder: 13,
description: "Shopify checkouts are automatically synced to Salesforce checkouts or opportunities.",
link: "https://support.syncmadeasy.com/support/solutions/articles/1130000038383-how-to-sync-abandoned-checkouts-from-shopify-to-salesforce-"
}, {
name: "Shopify Metafields Sync",
updateName: "Metafield Mapping & Sync (Shopify ↔ Salesforce)",
sortOrder: 21,
description: "Sync any metafield value by mapping it to the correct object and data type with this feature.",
link: 'https://support.syncmadeasy.com/support/solutions/articles/1130000044467-metafield-mapping-sync-shopify-%E2%86%94-salesforce-complete-setup-guide'
}, {
name: "Shopify Order Total Sync",
updateName: "Comprehensive Financial Sync for Shopify Orders (Shopify → Salesforce)",
sortOrder: 6,
description: "This feature ensures Shopify order data in Salesforce is accurate for Order Totals, Taxes, Shipping, Checkout, and Discount Charges, simplifying financial tracking.",
link: "https://support.syncmadeasy.com/support/solutions/articles/1130000038436-how-to-automate-shopify-order-total-sync-in-salesforce-"
}, {
name: "Shopify Refunds Sync",
updateName: "Refund Sync (Shopify → Salesforce)",
sortOrder: 10,
description: "To maintain clear order history and transaction details, this feature syncs Shopify order refunds to Salesforce.",
link: "https://support.syncmadeasy.com/support/solutions/articles/1130000038357-how-to-sync-shopify-refunds-to-salesforce-"
}, {
name: "Shopify ShipLines Sync",
updateName: "Shipping Sync (Shopify → Salesforce)",
sortOrder: 8,
description: "This feature ensures Salesforce orders reflect the shipping details from Shopify.",
link: "https://support.syncmadeasy.com/support/solutions/articles/1130000038418-how-to-sync-shopify-shipping-lines-to-salesforce-"
}, {
name: "Shopify TaxLines Sync",
updateName: "Tax Sync (Shopify → Salesforce)",
sortOrder: 9,
description: "To ensure accurate order records, this feature updates Salesforce orders with tax details from Shopify.",
link: "https://support.syncmadeasy.com/support/solutions/articles/1130000038429-how-to-automate-order-tax-line-sync-from-shopify-to-salesforce-"
}, {
name: "Customer Email Domain Sync",
updateName: "Customer Email Domain Sync",
sortOrder: 24,
description: "It helps sync the Company based on the customer’s email—mapping the Company as an Account in Salesforce, the Customer as a Contact in Salesforce, and their orders under both the Account and Contact.",
link: 'https://support.syncmadeasy.com/support/solutions/articles/1130000043861-how-the-customer-email-domain-feature-works'
}, {
name: "B2B",
updateName: "Wholesale Business Storefront (B2B Shopify)",
sortOrder: 23,
description: "This feature helps sync Shopify wholesale storefront details, such as Company, Customer, Location, location catalog, and many other features with customization support.",
link: null
}, {
name: "UTM Params Sync",
updateName: "UTM Parameter Sync (Shopify → Salesforce)",
sortOrder: 22,
description: "This feature ensures that UTM parameters from Shopify are reflected in Salesforce Orders and Opportunities.",
link: "https://support.syncmadeasy.com/support/solutions/articles/1130000042207-how-to-sync-utm-parameters-from-shopify-to-salesforce-"
}
];
get data() {
this.features = this.features.map(obj => {
obj.isActive = false;
return obj;
});
this.features.sort((a, b) => a.sortOrder - b.sortOrder);
return this.features;
}
handleToggleClick(event) {
event.preventDefault();
event.target.checked = false;
this.showModal = true;
}
closeModal() {
this.showModal = false;
}
redirectToAppExchange() {
window.open('https://appexchange.salesforce.com/appxListingDetail?listingId=a0N4V00000JFgkpUAD', '_blank');
this.closeModal();
}
redirectToSetup() {
window.open('https://support.syncmadeasy.com/support/solutions/articles/1130000038416-user-manual-pro', '_blank');
}
redirectToSupport(){
window.open('https://support.syncmadeasy.com/support/home', '_blank');
}
@wire(isPackageInstalled, {namespace: 'HIC_SMEPRO'})
wiredPackageCheck({data, error}) {
console.log('wiredPackageCheck triggered. Custom Label Value:', this.packageName);
if (data !== undefined) {
this.isInstalled = data;
console.log('isPackageInstalled returned:', data);
} else if (error) {
this.error = error;
console.error('isPackageInstalled error:', error);
}
}
closeInstallModal() {
this.navigateToAppPage();
}
navigateToAppPage() {
this[NavigationMixin.Navigate]({
type: 'standard__navItemPage',
attributes: {
apiName: 'HIC_ShopifySync__SME_Settings'
}
});
}
@wire(isPackageValid, {namespace: 'HIC_SMEPRO'})
wiredPackageValidCheck({data, error}) {
console.log('wiredPackageValidCheck triggered. Custom Label Value:', this.packageName);
if (data !== undefined) {
this.isValid = data;
console.log('isPackageValid returned:', data);
} else if (error) {
this.error = error;
console.error('isPackageValid error:', error);
}
}
}