Skip to content

Commit

Permalink
Eager imports for PS-WF
Browse files Browse the repository at this point in the history
  • Loading branch information
mokimo committed Aug 17, 2024
1 parent ce45b56 commit 95ab0a3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions unitylibs/core/workflow/workflow-photoshop/workflow-photoshop.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ import {
decorateDefaultLinkAnalytics,
createIntersectionObserver,
} from '../../../scripts/utils.js';
import {
IMG_LANDSCAPE,
IMG_PORTRAIT,
IMG_REMOVE_BG,
resetClasses,
default as createUpload,
} from '../../steps/upload-btn.js';
import initAppConnector from '../../steps/app-connector.js';

function resetSliders(unityWidget) {
const adjustmentCircles = unityWidget.querySelectorAll('.adjustment-circle');
Expand Down Expand Up @@ -89,11 +97,6 @@ async function handleEvent(cfg, eventHandler) {
async function updateImgClasses(cfg, img) {
const { imgDisplay } = cfg;
if (imgDisplay === 'landscape' || imgDisplay === 'portrait') {
const {
IMG_LANDSCAPE,
IMG_PORTRAIT,
IMG_REMOVE_BG,
} = await import('../../steps/upload-btn.js');
if (cfg.imgDisplay === 'landscape') {
if (img.classList.contains(IMG_LANDSCAPE)) img.classList.remove(IMG_LANDSCAPE);
} else if (cfg.imgDisplay === 'portrait') {
Expand Down Expand Up @@ -452,7 +455,6 @@ async function resetWidgetState(cfg) {
unityWidget.querySelector('.widget-product-icon')?.classList.add('show');
unityWidget.querySelector('.widget-refresh-button').classList.remove('show');
targetEl.querySelector(':scope > .widget-refresh-button').classList.remove('show');
const { resetClasses } = await import('../../steps/upload-btn.js');
resetClasses(img, targetEl);
resetSliders(unityWidget);
await loadImg(img);
Expand Down Expand Up @@ -485,10 +487,8 @@ export default async function init(cfg) {
await addProductIcon(cfg);
await changeVisibleFeature(cfg);
const img = cfg.targetEl.querySelector('picture img');
const { default: createUpload } = await import('../../steps/upload-btn.js');
const uploadBtn = await createUpload(cfg, img, uploadCallback);
unityWidget.querySelector('.unity-action-area').append(uploadBtn);
const { default: initAppConnector } = await import('../../steps/app-connector.js');
await initAppConnector(cfg, 'photoshop');
await decorateDefaultLinkAnalytics(unityWidget);
unityEl.addEventListener(interactiveSwitchEvent, async () => {
Expand Down

0 comments on commit 95ab0a3

Please sign in to comment.