@wix/editor-application 1.338.0 → 1.339.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/environment-api/index.js +154 -65
- package/dist/cjs/environment-api/index.js.map +1 -1
- package/dist/cjs/index.js +109 -20
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/platform-frame/index.js +112 -45
- package/dist/cjs/platform-frame/index.js.map +1 -1
- package/dist/cjs/platform-frame-api/index.js +112 -45
- package/dist/cjs/platform-frame-api/index.js.map +1 -1
- package/dist/cjs/platform-worker/index.js +143 -65
- package/dist/cjs/platform-worker/index.js.map +1 -1
- package/dist/cjs/platform-worker-api/index.js +132 -54
- package/dist/cjs/platform-worker-api/index.js.map +1 -1
- package/dist/esm/environment-api/index.js +155 -66
- package/dist/esm/environment-api/index.js.map +1 -1
- package/dist/esm/index.js +110 -21
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/platform-frame/index.js +113 -46
- package/dist/esm/platform-frame/index.js.map +1 -1
- package/dist/esm/platform-frame-api/index.js +113 -46
- package/dist/esm/platform-frame-api/index.js.map +1 -1
- package/dist/esm/platform-worker/index.js +144 -66
- package/dist/esm/platform-worker/index.js.map +1 -1
- package/dist/esm/platform-worker-api/index.js +132 -54
- package/dist/esm/platform-worker-api/index.js.map +1 -1
- package/dist/statics/environment-api/index.js +157 -69
- package/dist/statics/environment-api/index.js.map +1 -1
- package/dist/statics/index.js +112 -24
- package/dist/statics/index.js.map +1 -1
- package/dist/statics/platform-frame/index.js +115 -49
- package/dist/statics/platform-frame/index.js.map +1 -1
- package/dist/statics/platform-frame-api/index.js +115 -49
- package/dist/statics/platform-frame-api/index.js.map +1 -1
- package/dist/statics/platform-worker/index.js +146 -69
- package/dist/statics/platform-worker/index.js.map +1 -1
- package/dist/statics/platform-worker-api/index.js +134 -57
- package/dist/statics/platform-worker-api/index.js.map +1 -1
- package/dist/types/index.d.ts +5 -4
- package/package.json +4 -3
package/dist/statics/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@wix/public-editor-platform-events'), require('@wix/public-editor-platform-interfaces'), require('@wix/public-editor-platform-errors')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@wix/public-editor-platform-events', '@wix/public-editor-platform-interfaces', '@wix/public-editor-platform-errors'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.EditorPlatformApplicationRuntime = {}, global.publicEditorPlatformEvents, global.publicEditorPlatformInterfaces, global.publicEditorPlatformErrors));
|
|
5
|
-
})(this, (function (exports, publicEditorPlatformEvents, publicEditorPlatformInterfaces, publicEditorPlatformErrors) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@wix/public-editor-platform-events'), require('@wix/public-editor-platform-interfaces'), require('@wix/public-editor-platform-errors'), require('@wix/sdk')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@wix/public-editor-platform-events', '@wix/public-editor-platform-interfaces', '@wix/public-editor-platform-errors', '@wix/sdk'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.EditorPlatformApplicationRuntime = {}, global.publicEditorPlatformEvents, global.publicEditorPlatformInterfaces, global.publicEditorPlatformErrors, global.sdk));
|
|
5
|
+
})(this, (function (exports, publicEditorPlatformEvents, publicEditorPlatformInterfaces, publicEditorPlatformErrors, sdk) { 'use strict';
|
|
6
6
|
|
|
7
7
|
class ApplicationLifecycle {
|
|
8
8
|
constructor(events) {
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
EditorPlatformApplicationErrorCode2["UndefinedApiMethod"] = "UndefinedApiMethod";
|
|
54
54
|
EditorPlatformApplicationErrorCode2["ApplicationIsNotMutable"] = "ApplicationIsNotMutable";
|
|
55
55
|
EditorPlatformApplicationErrorCode2["FailedToGetPrivateAPI"] = "FailedToGetPrivateAPI";
|
|
56
|
+
EditorPlatformApplicationErrorCode2["ClientAuthError"] = "ClientAuthError";
|
|
56
57
|
return EditorPlatformApplicationErrorCode2;
|
|
57
58
|
})(EditorPlatformApplicationErrorCode || {});
|
|
58
59
|
class EditorPlatformApplicationError extends publicEditorPlatformErrors.BaseError {
|
|
@@ -157,6 +158,7 @@
|
|
|
157
158
|
|
|
158
159
|
var EditorPlatformApplicationContextErrorCode = /* @__PURE__ */ ((EditorPlatformApplicationContextErrorCode2) => {
|
|
159
160
|
EditorPlatformApplicationContextErrorCode2["IncorrectEnvironment"] = "IncorrectEnvironment";
|
|
161
|
+
EditorPlatformApplicationContextErrorCode2["ClientAuthError"] = "ClientAuthError";
|
|
160
162
|
return EditorPlatformApplicationContextErrorCode2;
|
|
161
163
|
})(EditorPlatformApplicationContextErrorCode || {});
|
|
162
164
|
class EditorPlatformApplicationContextError extends publicEditorPlatformErrors.BaseError {
|
|
@@ -319,6 +321,7 @@
|
|
|
319
321
|
var PlatformEnvironment = /* @__PURE__ */ ((PlatformEnvironment2) => {
|
|
320
322
|
PlatformEnvironment2["Worker"] = "Worker";
|
|
321
323
|
PlatformEnvironment2["Frame"] = "Frame";
|
|
324
|
+
PlatformEnvironment2["ComponentPanel"] = "ComponentPanel";
|
|
322
325
|
return PlatformEnvironment2;
|
|
323
326
|
})(PlatformEnvironment || {});
|
|
324
327
|
class EnvironmentContext {
|
|
@@ -423,6 +426,59 @@
|
|
|
423
426
|
return this.environment.getApplicationAPIs()[appDefinitionId];
|
|
424
427
|
}
|
|
425
428
|
}
|
|
429
|
+
const createSDKHost = (props) => {
|
|
430
|
+
const environmentContext = new EnvironmentContext({
|
|
431
|
+
environment: props.environment,
|
|
432
|
+
privateApi: props.privateAPI,
|
|
433
|
+
events: props.events ?? new publicEditorPlatformEvents.PlatformAppEventEmitter(),
|
|
434
|
+
applicationAPIs: props.applicationPrivateAPI ? {
|
|
435
|
+
[props.appDefinitionId]: props.applicationPrivateAPI
|
|
436
|
+
} : {}
|
|
437
|
+
});
|
|
438
|
+
const applicationContext = new ApplicationContext(
|
|
439
|
+
{
|
|
440
|
+
appDefinitionId: props.appDefinitionId,
|
|
441
|
+
appDefinitionName: ""
|
|
442
|
+
},
|
|
443
|
+
environmentContext
|
|
444
|
+
);
|
|
445
|
+
return {
|
|
446
|
+
environment: {},
|
|
447
|
+
channel: {
|
|
448
|
+
observeState: async () => {
|
|
449
|
+
return {
|
|
450
|
+
disconnect() {
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
},
|
|
455
|
+
environmentContext,
|
|
456
|
+
applicationContext
|
|
457
|
+
};
|
|
458
|
+
};
|
|
459
|
+
const auth = (appDefinitionId, privateAPI) => {
|
|
460
|
+
return {
|
|
461
|
+
getAuthHeaders: async () => {
|
|
462
|
+
if (!appDefinitionId) {
|
|
463
|
+
throw createEditorPlatformApplicationContextError(
|
|
464
|
+
EditorPlatformApplicationContextErrorCode.ClientAuthError
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
const authInstance = await privateAPI.info.getAppInstance(appDefinitionId);
|
|
468
|
+
if (authInstance === void 0) {
|
|
469
|
+
throw createEditorPlatformApplicationContextError(
|
|
470
|
+
EditorPlatformApplicationContextErrorCode.ClientAuthError,
|
|
471
|
+
"empty auth instance"
|
|
472
|
+
).withAppDefinitionId(appDefinitionId);
|
|
473
|
+
}
|
|
474
|
+
return {
|
|
475
|
+
headers: {
|
|
476
|
+
Authorization: authInstance
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
};
|
|
426
482
|
|
|
427
483
|
var ApplicationType = /* @__PURE__ */ ((ApplicationType2) => {
|
|
428
484
|
ApplicationType2["EditorAddon"] = "EDITOR_ADDON";
|
|
@@ -584,6 +640,17 @@
|
|
|
584
640
|
appDefinitionId,
|
|
585
641
|
appDefinitionName: ""
|
|
586
642
|
});
|
|
643
|
+
const client = sdk.createClient({
|
|
644
|
+
auth: auth(appDefinitionId, privateAPI),
|
|
645
|
+
host: createSDKHost({
|
|
646
|
+
appDefinitionId,
|
|
647
|
+
privateAPI: this.#privateAPI,
|
|
648
|
+
environment: PlatformEnvironment.Frame,
|
|
649
|
+
events: this.#events,
|
|
650
|
+
applicationPrivateAPI: this.#applicationPrivateAPI
|
|
651
|
+
})
|
|
652
|
+
});
|
|
653
|
+
client.enableContext("global");
|
|
587
654
|
}
|
|
588
655
|
notify(event) {
|
|
589
656
|
this.#eventsBridge.notify(event);
|
|
@@ -594,8 +661,9 @@
|
|
|
594
661
|
}
|
|
595
662
|
|
|
596
663
|
const APPLICATION_REGISTRY_KEY = "__APPLICATION_REGISTRY_KEY";
|
|
597
|
-
async function executeApplication(events, spec, bundle) {
|
|
664
|
+
async function executeApplication(events, client, spec, bundle) {
|
|
598
665
|
const executable = new Function(
|
|
666
|
+
"$wixContext",
|
|
599
667
|
APPLICATION_CONTEXT_KEY,
|
|
600
668
|
APPLICATION_REGISTRY_KEY,
|
|
601
669
|
bundle
|
|
@@ -619,7 +687,7 @@
|
|
|
619
687
|
try {
|
|
620
688
|
const context = { ...spec };
|
|
621
689
|
executable.call(
|
|
622
|
-
|
|
690
|
+
{ client },
|
|
623
691
|
new ApplicationContext(context, await EnvironmentContext.getInstance()),
|
|
624
692
|
applicationRegistryCallback
|
|
625
693
|
);
|
|
@@ -661,15 +729,18 @@
|
|
|
661
729
|
}
|
|
662
730
|
|
|
663
731
|
class PlatformApplicationContainer {
|
|
732
|
+
#apps = {};
|
|
733
|
+
#privateAPI;
|
|
734
|
+
#events;
|
|
664
735
|
constructor(privateApi, events) {
|
|
665
|
-
this
|
|
666
|
-
this
|
|
667
|
-
this
|
|
736
|
+
this.#privateAPI = privateApi;
|
|
737
|
+
this.#events = events;
|
|
738
|
+
this.#events.subscribe((event) => {
|
|
668
739
|
switch (event.type) {
|
|
669
740
|
case publicEditorPlatformEvents.PlatformAppEvent.HostEvent: {
|
|
670
741
|
if (event.payload.type === publicEditorPlatformInterfaces.EventType.removeAppCompleted) {
|
|
671
|
-
this
|
|
672
|
-
this
|
|
742
|
+
void this.#events.withEvent(
|
|
743
|
+
this.#events.factories.createApplicationRemovedEvent(
|
|
673
744
|
event.payload.appDefinitionId
|
|
674
745
|
),
|
|
675
746
|
() => {
|
|
@@ -682,7 +753,6 @@
|
|
|
682
753
|
}
|
|
683
754
|
});
|
|
684
755
|
}
|
|
685
|
-
apps = {};
|
|
686
756
|
async runApplication(app) {
|
|
687
757
|
const bundle = await this.loadApplication(app);
|
|
688
758
|
const instance = await this.executeApplication(app, bundle);
|
|
@@ -690,32 +760,32 @@
|
|
|
690
760
|
return instance;
|
|
691
761
|
}
|
|
692
762
|
setApplication(appDefId, instance) {
|
|
693
|
-
this
|
|
694
|
-
this
|
|
695
|
-
this
|
|
763
|
+
this.#apps[appDefId] = instance;
|
|
764
|
+
void this.#events.withEvent(
|
|
765
|
+
this.#events.factories.createApplicationApiInitEvent(
|
|
696
766
|
appDefId,
|
|
697
767
|
// TODO: both types are set here...
|
|
698
768
|
// @ts-expect-error TODO: fix me
|
|
699
769
|
instance?.api?.private ? "private" : "public"
|
|
700
770
|
),
|
|
701
771
|
() => {
|
|
702
|
-
this.
|
|
772
|
+
this.#privateAPI.applicationManager.setApplication(instance);
|
|
703
773
|
}
|
|
704
774
|
);
|
|
705
775
|
}
|
|
706
776
|
getApplication(appDefId) {
|
|
707
|
-
return this
|
|
777
|
+
return this.#apps[appDefId];
|
|
708
778
|
}
|
|
709
779
|
getAppDefinitionIds() {
|
|
710
|
-
return Object.keys(this
|
|
780
|
+
return Object.keys(this.#apps);
|
|
711
781
|
}
|
|
712
782
|
removeApplication(appDefinitionId) {
|
|
713
|
-
delete this
|
|
783
|
+
delete this.#apps[appDefinitionId];
|
|
714
784
|
}
|
|
715
785
|
async loadApplication(app) {
|
|
716
786
|
const url = app.url;
|
|
717
|
-
return this
|
|
718
|
-
this
|
|
787
|
+
return this.#events.withEvent(
|
|
788
|
+
this.#events.factories.createApplicationLoadEvent(app, url),
|
|
719
789
|
async () => {
|
|
720
790
|
try {
|
|
721
791
|
return await this.loadApplicationBundle(url);
|
|
@@ -740,14 +810,32 @@
|
|
|
740
810
|
return res.text();
|
|
741
811
|
}
|
|
742
812
|
async executeApplication(app, bundle) {
|
|
743
|
-
return this
|
|
744
|
-
this
|
|
813
|
+
return this.#events.withEvent(
|
|
814
|
+
this.#events.factories.createApplicationExecuteEvent(app, app.url),
|
|
745
815
|
async () => {
|
|
746
|
-
const
|
|
816
|
+
const client = this.#createWixClient(app.appDefinitionId);
|
|
817
|
+
const { instance } = await executeApplication(
|
|
818
|
+
this.#events,
|
|
819
|
+
client,
|
|
820
|
+
app,
|
|
821
|
+
bundle
|
|
822
|
+
);
|
|
747
823
|
return instance;
|
|
748
824
|
}
|
|
749
825
|
);
|
|
750
826
|
}
|
|
827
|
+
#createWixClient(appDefinitionId) {
|
|
828
|
+
return sdk.createClient({
|
|
829
|
+
auth: auth(appDefinitionId, this.#privateAPI),
|
|
830
|
+
host: createSDKHost({
|
|
831
|
+
appDefinitionId,
|
|
832
|
+
privateAPI: this.#privateAPI,
|
|
833
|
+
environment: PlatformEnvironment.Worker,
|
|
834
|
+
events: this.#events,
|
|
835
|
+
applicationPrivateAPI: {}
|
|
836
|
+
})
|
|
837
|
+
});
|
|
838
|
+
}
|
|
751
839
|
}
|
|
752
840
|
|
|
753
841
|
class PlatformWorkerAPI extends AbstractEnvironmentAPI {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/ApplicationLifecycle/ApplicationLifecycle.ts","../../src/errors.ts","../../src/EditorPlatformApplication/EditorPlatformApplication.ts","../../../editor-platform-application-context/dist/esm/index.js","../../src/types.ts","../../src/EditorPlatformApplication/WixEditorPlatformApplication.ts","../../src/EditorPlatformApplication/WixEditorPlatformAddon.ts","../../src/Events/WorkerEventsBridge.ts","../../src/PlatformEnvironmentAPI/AbstractEnvironmentAPI.ts","../../src/PlatformEnvironmentAPI/PlatformFrameAPI/PlatformFrameAPI.ts","../../src/PlatformApplicationContainer/executeApplication.ts","../../src/PlatformApplicationContainer/PlatformApplicationContainer.ts","../../src/PlatformEnvironmentAPI/PlatformWorkerAPI/PlatformWorkerAPI.ts"],"sourcesContent":["import {\n PlatformAppEvent,\n IPlatformEditorReadyEvent,\n} from '@wix/public-editor-platform-events';\nimport { ApplicationBoundEvents } from '@wix/editor-application-context';\n\nexport class ApplicationLifecycle {\n private callbacks: Partial<\n Record<\n PlatformAppEvent,\n {\n id: string;\n fn: (payload: any) => void;\n }[]\n >\n > = {};\n\n constructor(private events: ApplicationBoundEvents) {\n this.subscribe();\n }\n\n private subscribe() {\n this.events.subscribe((event) => {\n const { type, payload } = event;\n if (this.callbacks[type]) {\n this.callbacks[type]!.forEach(({ fn }) => fn(payload));\n }\n });\n }\n\n private addCallback(event: PlatformAppEvent, fn: (payload: any) => void) {\n if (!this.callbacks[event]) {\n this.callbacks[event] = [];\n }\n\n const id = `${performance.now()}`;\n\n this.callbacks[event]!.push({\n id,\n fn,\n });\n\n return () => {\n this.callbacks[event] = this.callbacks[event]!.filter(\n (cb) => cb.id !== id,\n );\n };\n }\n\n /**\n * NOTE: currently, we return function to unsubscribe from the event,\n * probably it is better to return `this` to allow chaining\n * and provide another way to unsubscribe from events.\n */\n public onEditorReady(\n fn: (payload: IPlatformEditorReadyEvent['payload']) => void,\n ) {\n return this.addCallback(PlatformAppEvent.EditorReady, fn);\n }\n}\n","import {\n BaseError,\n createErrorBuilder,\n} from '@wix/public-editor-platform-errors';\n\nexport enum EditorPlatformApplicationErrorCode {\n ApplicationRuntimeError = 'ApplicationRuntimeError',\n ApplicationCreationError = 'ApplicationCreationError',\n ApplicationLoadError = 'ApplicationLoadError',\n ApplicationFetchError = 'ApplicationFetchError',\n ApplicationExecuteError = 'ApplicationExecuteError',\n ApplicationWasRemoved = 'ApplicationWasRemoved',\n UndefinedApiMethod = 'UndefinedApiMethod',\n ApplicationIsNotMutable = 'ApplicationIsNotMutable',\n FailedToGetPrivateAPI = 'FailedToGetPrivateAPI',\n}\n\nclass EditorPlatformApplicationError extends BaseError<EditorPlatformApplicationErrorCode> {\n state: Partial<{\n url: string;\n appDefinitionId: string;\n apiMethod: string;\n apiType: string;\n }> = {};\n\n constructor(message: string, code: EditorPlatformApplicationErrorCode) {\n super(message, code, 'Editor Platform Application Error');\n }\n\n withUrl(url: string) {\n this.state = { ...this.state, url };\n return this;\n }\n\n withAppDefinitionId(appDefinitionId: string) {\n this.state = { ...this.state, appDefinitionId };\n return this;\n }\n\n withApiMethod(apiMethod: string) {\n this.state = { ...this.state, apiMethod };\n return this;\n }\n\n withApiType(apiType: string) {\n this.state = { ...this.state, apiType };\n return this;\n }\n}\n\nexport const createEditorPlatformApplicationError = createErrorBuilder<\n EditorPlatformApplicationErrorCode,\n EditorPlatformApplicationError\n>(EditorPlatformApplicationError);\n","import { PlatformAppEvent } from '@wix/public-editor-platform-events';\nimport {\n ApplicationContext,\n IApplicationContext,\n} from '@wix/editor-application-context';\nimport { EventType } from '@wix/public-editor-platform-interfaces';\nimport { ApplicationLifecycle } from '../ApplicationLifecycle';\nimport {\n createEditorPlatformApplicationError,\n EditorPlatformApplicationErrorCode,\n} from '../errors';\nimport { ApplicationType } from '../types';\n\n/**\n * TODO: duplicated type to get rid of extra dependency\n */\ntype IApplicationRegistry = (instance: EditorPlatformApplication) => void;\n\ndeclare global {\n // eslint-disable-next-line no-var\n var __APPLICATION_REGISTRY_KEY: IApplicationRegistry;\n}\n\nexport interface IApplicationAPI<TPublicAPI, TPrivateAPI> {\n public?: TPublicAPI;\n private?: TPrivateAPI;\n}\n\nclass ChainAPIConfiguration<TPublicAPI, TPrivateAPI> {\n constructor(private api: IApplicationAPI<TPublicAPI, TPrivateAPI>) {}\n\n exposePublicAPI(api: TPublicAPI) {\n this.api.public = api;\n return this;\n }\n\n exposePrivateAPI(api: TPrivateAPI) {\n this.api.private = api;\n return this;\n }\n}\n\n/**\n * TODO: should accept generic type\n */\nexport abstract class EditorPlatformApplication<\n TContext extends IApplicationContext = IApplicationContext,\n TPublicAPI = unknown,\n TPrivateAPI = unknown,\n> {\n public appDefinitionId: string;\n public state: 'READY' | 'REMOVED' = 'READY';\n\n public lifecycle: ApplicationLifecycle;\n\n #applicationAPI: IApplicationAPI<TPublicAPI, TPrivateAPI> = {};\n #chainAPIConfiguration = new ChainAPIConfiguration<TPublicAPI, TPrivateAPI>(\n this.#applicationAPI,\n );\n\n #manifest: any;\n #context: ApplicationContext<TContext>;\n\n protected constructor(\n public readonly type: ApplicationType,\n context: ApplicationContext<TContext>,\n ) {\n this.#context = context;\n const bindings = this.#context.getBindings();\n\n this.appDefinitionId = bindings.appDefinitionId;\n\n const events = this.#context.getEvents();\n this.lifecycle = new ApplicationLifecycle(events);\n\n /**\n * TODO: application should not listen such event, we should manage its state outside\n */\n events.addEventListener(EventType.removeAppCompleted, (e) => {\n if (e.appDefinitionId === this.appDefinitionId) {\n this.state = 'REMOVED';\n }\n });\n\n const registerApplicationInContainer =\n __APPLICATION_REGISTRY_KEY as IApplicationRegistry;\n\n registerApplicationInContainer(this);\n\n events.notify({\n type: PlatformAppEvent.ApplicationInit,\n payload: {},\n });\n }\n\n protected get context() {\n return this.#context;\n }\n public get events() {\n return this.#context.getEvents();\n }\n\n public setManifest(manifest: any) {\n this.#manifest = manifest;\n }\n\n public getManifest() {\n return this.#manifest;\n }\n\n public exposePublicAPI(api: TPublicAPI) {\n return this.#chainAPIConfiguration.exposePublicAPI(api);\n }\n\n public exposePrivateAPI(api: TPrivateAPI) {\n return this.#chainAPIConfiguration.exposePrivateAPI(api);\n }\n\n public getPublicAPI() {\n return this.#applicationAPI.public;\n }\n\n public getPrivateAPI() {\n return this.#applicationAPI.private;\n }\n\n public ready() {}\n\n buildApplicationError(message: string) {\n return createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationRuntimeError,\n message,\n ).withAppDefinitionId(this.appDefinitionId);\n }\n}\n","import { createErrorBuilder, BaseError } from '@wix/public-editor-platform-errors';\nimport { PlatformAppEvent } from '@wix/public-editor-platform-events';\n\nvar EditorPlatformApplicationContextErrorCode = /* @__PURE__ */ ((EditorPlatformApplicationContextErrorCode2) => {\n EditorPlatformApplicationContextErrorCode2[\"IncorrectEnvironment\"] = \"IncorrectEnvironment\";\n return EditorPlatformApplicationContextErrorCode2;\n})(EditorPlatformApplicationContextErrorCode || {});\nclass EditorPlatformApplicationContextError extends BaseError {\n state = {};\n constructor(message, code) {\n super(message, code, \"Editor Platform Application Context Error\");\n }\n withUrl(url) {\n this.state = { ...this.state, url };\n return this;\n }\n withAppDefinitionId(appDefinitionId) {\n this.state = { ...this.state, appDefinitionId };\n return this;\n }\n}\nconst createEditorPlatformApplicationContextError = createErrorBuilder(EditorPlatformApplicationContextError);\n\nasync function transformEventPayload(eventPayload, privateAPI) {\n if (!eventPayload?.type) {\n return eventPayload;\n }\n switch (eventPayload.type) {\n case \"componentSelectionChanged\":\n const componentRefs = eventPayload.componentRefs || [];\n const components = await Promise.all(\n componentRefs.map((ref) => {\n return privateAPI.components.getComponent(ref);\n })\n );\n return {\n type: eventPayload.type,\n components\n };\n default:\n return eventPayload;\n }\n}\n\nclass ApplicationBoundEvents {\n constructor(appDefinitionId, events, privateAPI) {\n this.appDefinitionId = appDefinitionId;\n this.privateAPI = privateAPI;\n this.events = events;\n this.subscribe = events.subscribe.bind(events);\n this.commit = events.commit.bind(events);\n this.startTransaction = events.startTransaction.bind(events);\n this.silent = events.silent.bind(events);\n }\n events;\n subscribe;\n commit;\n startTransaction;\n silent;\n notify(event) {\n this.events.notify({\n type: event.type,\n payload: event.payload,\n meta: {\n appDefinitionId: this.appDefinitionId\n }\n });\n }\n notifyCustomEvent(type, payload) {\n this.notify({\n type: PlatformAppEvent.CustomEvent,\n payload: {\n ...payload,\n type\n }\n });\n }\n /**\n * TODO: we should use same interface for all events\n * (subscribe vs addEventListener)\n */\n addEventListener(eventType, fn) {\n return this.events.subscribe(async (event) => {\n const isAppMatch = event.meta?.appDefinitionId === this.appDefinitionId || event.meta?.appDefinitionId === null;\n const transformPayload = () => transformEventPayload(event.payload, this.privateAPI);\n if (eventType === \"*\") {\n fn(await transformPayload());\n } else if (event.type === PlatformAppEvent.CustomEvent) {\n if (eventType === event.payload?.type && !isAppMatch) {\n fn(await transformPayload());\n }\n } else if (event.type === PlatformAppEvent.HostEvent) {\n if (eventType === event.payload?.type && isAppMatch) {\n fn(await transformPayload());\n }\n }\n });\n }\n}\n\nconst WAIT_INJECTED_TIMEOUT = 200;\nconst WAIT_INJECTED_RETRY_COUNT = 50;\nclass ContextInjectionStatus {\n _resolveContextInjected = () => {\n };\n _isInjected = false;\n key;\n constructor(uuid) {\n this.key = `__${uuid}_CONTEXT_INJECTION_STATUS_KEY`;\n if (!globalThis[this.key]) {\n globalThis[this.key] = new Promise((resolve) => {\n this._resolveContextInjected = () => {\n this._isInjected = true;\n resolve();\n };\n });\n }\n }\n isInjected() {\n return !!this._isInjected;\n }\n resolveInjected() {\n this._resolveContextInjected?.();\n }\n waitInjected() {\n return new Promise((resolve, reject) => {\n let injected = false;\n let timeoutId;\n let retryCount = 0;\n const timeout = () => {\n if (injected) {\n return;\n }\n timeoutId = setTimeout(() => {\n retryCount++;\n if (retryCount < WAIT_INJECTED_RETRY_COUNT) {\n if (retryCount % 10 === 0) {\n console.log(\n createEditorPlatformApplicationContextError(\n EditorPlatformApplicationContextErrorCode.IncorrectEnvironment,\n \"contexts are not resolved, still re-trying\"\n ).withMessage(`try number ${retryCount}`).message\n );\n }\n timeout();\n return;\n }\n if (!injected) {\n const error = createEditorPlatformApplicationContextError(\n EditorPlatformApplicationContextErrorCode.IncorrectEnvironment,\n \"contexts are not resolved, threw by timeout\"\n );\n reject(error);\n }\n }, WAIT_INJECTED_TIMEOUT);\n };\n timeout();\n const _waitContextInjectedPromise = globalThis[this.key];\n _waitContextInjectedPromise.then(() => {\n injected = true;\n clearTimeout(timeoutId);\n resolve();\n });\n });\n }\n}\n\nconst ENVIRONMENT_CONTEXT_KEY = \"__ENVIRONMENT_CONTEXT_KEY\";\nvar PlatformEnvironment = /* @__PURE__ */ ((PlatformEnvironment2) => {\n PlatformEnvironment2[\"Worker\"] = \"Worker\";\n PlatformEnvironment2[\"Frame\"] = \"Frame\";\n return PlatformEnvironment2;\n})(PlatformEnvironment || {});\nclass EnvironmentContext {\n constructor(environmentContext) {\n this.environmentContext = environmentContext;\n }\n static status = new ContextInjectionStatus(\"environment\");\n static async inject(context) {\n if (globalThis[ENVIRONMENT_CONTEXT_KEY]) {\n throw createEditorPlatformApplicationContextError(\n EditorPlatformApplicationContextErrorCode.IncorrectEnvironment,\n \"Environment context already exists and should not be overridden\"\n );\n }\n globalThis[ENVIRONMENT_CONTEXT_KEY] = new EnvironmentContext(context);\n this.status.resolveInjected();\n }\n static async getInstance() {\n await this.status.waitInjected();\n return globalThis[ENVIRONMENT_CONTEXT_KEY];\n }\n getPrivateAPI() {\n return this.environmentContext.privateApi;\n }\n getEvents() {\n return this.environmentContext.events;\n }\n getApplicationAPIs() {\n return this.environmentContext.applicationAPIs ?? {};\n }\n getEnvironment() {\n return this.environmentContext.environment;\n }\n}\n\nconst APPLICATION_CONTEXT_KEY = \"__APPLICATION_CONTEXT_KEY\";\nclass ApplicationContext {\n constructor(applicationContext, environment) {\n this.applicationContext = applicationContext;\n this.environment = environment;\n this.events = new ApplicationBoundEvents(\n this.applicationContext.appDefinitionId,\n this.environment.getEvents(),\n this.environment.getPrivateAPI()\n );\n }\n static status = new ContextInjectionStatus(\"application\");\n /**\n * TODO: use generics for context type\n * - application\n * - editor\n */\n static async inject(context) {\n const environment = await EnvironmentContext.getInstance();\n if (environment.getEnvironment() !== PlatformEnvironment.Frame) {\n throw createEditorPlatformApplicationContextError(\n EditorPlatformApplicationContextErrorCode.IncorrectEnvironment,\n \"Application context can be injected only in frame environment\"\n );\n }\n if (globalThis[APPLICATION_CONTEXT_KEY]) {\n throw createEditorPlatformApplicationContextError(\n EditorPlatformApplicationContextErrorCode.IncorrectEnvironment,\n \"Application context already exists and should not be overridden\"\n );\n }\n globalThis[APPLICATION_CONTEXT_KEY] = new ApplicationContext(\n context,\n await EnvironmentContext.getInstance()\n );\n this.status.resolveInjected();\n }\n static async getInstance() {\n const environment = await EnvironmentContext.getInstance();\n if (environment.getEnvironment() === PlatformEnvironment.Frame) {\n await this.status.waitInjected();\n return globalThis[APPLICATION_CONTEXT_KEY];\n } else {\n return __APPLICATION_CONTEXT_KEY;\n }\n }\n events;\n getAppDefinitionId() {\n return this.applicationContext.appDefinitionId;\n }\n getBindings() {\n return this.applicationContext;\n }\n getEvents() {\n return this.events;\n }\n getPrivateAPI() {\n return this.environment.getPrivateAPI();\n }\n getPrivateApplicationAPI() {\n const appDefinitionId = this.getAppDefinitionId();\n if (!appDefinitionId) {\n throw createEditorPlatformApplicationContextError(\n EditorPlatformApplicationContextErrorCode.IncorrectEnvironment,\n \"appDefinitionId is not available\"\n );\n }\n return this.environment.getApplicationAPIs()[appDefinitionId];\n }\n}\n\nexport { APPLICATION_CONTEXT_KEY, ApplicationBoundEvents, ApplicationContext, ENVIRONMENT_CONTEXT_KEY, EnvironmentContext, PlatformEnvironment };\n//# sourceMappingURL=index.js.map\n","export type IPrivateAPIFixMe = any; // TODO: replace with the real type WrappedPrivateAPI\n// TODO: fix any\nexport type IApplicationSpec = any;\n\nexport enum ApplicationType {\n EditorAddon = 'EDITOR_ADDON',\n Platform = 'PLATFORM',\n}\n","import {\n ApplicationContext,\n IEditorApplicationContext,\n} from '@wix/editor-application-context';\n\nimport { EditorPlatformApplication } from './EditorPlatformApplication';\nimport { ApplicationType } from '../types';\n\nexport class WixEditorPlatformApplication<\n TPublicAPI = unknown,\n TPrivateAPI = unknown,\n> extends EditorPlatformApplication<\n IEditorApplicationContext,\n TPublicAPI,\n TPrivateAPI\n> {\n static async create<TPublicAPI = unknown, TPrivateAPI = unknown>() {\n return new WixEditorPlatformApplication<TPublicAPI, TPrivateAPI>(\n await ApplicationContext.getInstance(),\n );\n }\n\n constructor(context: ApplicationContext<IEditorApplicationContext>) {\n super(ApplicationType.Platform, context);\n }\n}\n","import {\n ApplicationContext,\n IAddonContext,\n} from '@wix/editor-application-context';\nimport {\n EditorPlatformApplicationErrorCode,\n createEditorPlatformApplicationError,\n} from '../errors';\nimport { EditorPlatformApplication } from './EditorPlatformApplication';\nimport { ApplicationType } from '../types';\n\nexport class WixEditorPlatformAddon<\n TPublicAPI = unknown,\n TPrivateAPI = unknown,\n> extends EditorPlatformApplication<IAddonContext, TPublicAPI, TPrivateAPI> {\n static async create<TPublicAPI = unknown, TPrivateAPI = unknown>(): Promise<\n WixEditorPlatformAddon<TPublicAPI, TPrivateAPI>\n > {\n const context = await ApplicationContext.getInstance<IAddonContext>();\n const instance = new WixEditorPlatformAddon<TPublicAPI, TPrivateAPI>(\n context,\n );\n\n try {\n await instance.init();\n return instance;\n } catch (e: unknown) {\n const error = createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationRuntimeError,\n )\n .withParentError(e as Error)\n .withMessage('Failed to initialize addon');\n\n console.error(error);\n\n return instance;\n }\n }\n\n constructor(context: ApplicationContext<IAddonContext>) {\n super(ApplicationType.EditorAddon, context);\n }\n\n private async init() {\n try {\n await this.registerToolsPanel();\n } catch (e: unknown) {\n throw createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationRuntimeError,\n )\n .withMessage('Failed to register addon tools panel')\n .withParentError(e as Error);\n }\n }\n\n private async registerToolsPanel() {\n const bindings = this.context.getBindings();\n\n const { url, width, height, initialPosition } =\n bindings.data?.toolPanelConfig;\n\n if (url) {\n await this.context.getPrivateAPI().addons.registerToolsPanel(\n { appDefinitionId: bindings.appDefinitionId, applicationId: '111' },\n {\n title: bindings.appDefinitionName,\n },\n {\n url,\n // TODO: this can become \"200px\", \"50%\" etc in future. For now we simply assume numeric values like \"250\".\n width: Number(width),\n height: Number(height),\n initialPosition: {\n x: Number(initialPosition.x),\n y: Number(initialPosition.y),\n },\n },\n );\n }\n }\n}\n","import {\n IPlatformPrivateEvent,\n PlatformLifecycleEvent,\n PlatformPrivateEvent,\n // --\n IPlatformAppEvent,\n PlatformAppEvent,\n PlatformAppEventEmitter,\n} from '@wix/public-editor-platform-events';\n\n/**\n * The events bridge between platform events (private) and app events\n */\nexport class WorkerEventsBridge {\n constructor(private platformAppEvents: PlatformAppEventEmitter) {}\n\n /**\n * Notify by event from Worker Manager (platform infrastructure)\n */\n public notify(event: IPlatformPrivateEvent) {\n switch (event.type) {\n case PlatformLifecycleEvent.EditorReady:\n this.platformAppEvents.notify({\n ...event,\n // @ts-expect-error TODO: fix me\n type: PlatformAppEvent.EditorReady,\n });\n break;\n case PlatformPrivateEvent.HostEvent:\n this.platformAppEvents.notify({\n ...event,\n type: PlatformAppEvent.HostEvent,\n });\n break;\n }\n }\n\n /**\n * Subscribe to Worker (Application) event\n */\n public subscribe(cb: (event: IPlatformAppEvent) => void) {\n this.platformAppEvents.subscribe((event) => {\n cb(event);\n });\n }\n}\n","export enum PlatformConsumerEnvironmentAPIType {\n Frame = 'PLATFORM_FRAME_API',\n Worker = 'PLATFORM_WORKER_API',\n}\n\n/**\n * rename these entities -> API to Env\n */\nexport abstract class AbstractEnvironmentAPI<\n TEnv extends PlatformConsumerEnvironmentAPIType,\n> {\n /**\n * NOTE: we can't `type` declare getter within current abstract class\n * because then after transferring API between threads this getter becomes promise,\n * which is not expected\n *\n * get type() {\n * return this.env;\n * }\n */\n public abstract type: TEnv;\n\n protected constructor(protected env: TEnv) {\n this.create();\n }\n\n abstract create(): void;\n abstract initEnvironment(props: unknown): void;\n}\n","import { IPrivateAPIFixMe } from '../../types';\n\nimport {\n IPlatformPrivateEvent,\n PlatformAppEventEmitter,\n IPlatformAppEvent,\n} from '@wix/public-editor-platform-events';\nimport {\n EnvironmentContext,\n ApplicationContext,\n PlatformEnvironment,\n} from '@wix/editor-application-context';\n\nimport { WorkerEventsBridge } from '../../Events';\nimport {\n AbstractEnvironmentAPI,\n PlatformConsumerEnvironmentAPIType,\n} from '../AbstractEnvironmentAPI';\n\nconst DESIGN_SYSTEM_STYLES_MAP = {\n classic:\n 'https://www.unpkg.com/@wix/design-system/dist/statics/tokens-default.global.css',\n studio:\n 'https://www.unpkg.com/@wix/design-system/dist/statics/tokens-studio.global.css',\n};\n\nexport class PlatformFrameAPI extends AbstractEnvironmentAPI<PlatformConsumerEnvironmentAPIType.Frame> {\n public type: PlatformConsumerEnvironmentAPIType.Frame =\n PlatformConsumerEnvironmentAPIType.Frame;\n\n #events = new PlatformAppEventEmitter();\n #eventsBridge = new WorkerEventsBridge(this.#events);\n #privateAPI: IPrivateAPIFixMe;\n #applicationPrivateAPI: any;\n\n constructor() {\n super(PlatformConsumerEnvironmentAPIType.Frame);\n }\n\n create() {\n if (typeof globalThis?.document?.head?.prepend === 'function') {\n const params = new URL(globalThis.location.href).searchParams;\n\n // TODO: check all possible editorType values\n const host =\n params.get('editorType') === 'CLASSIC' ? 'classic' : 'studio';\n\n const url = DESIGN_SYSTEM_STYLES_MAP[host];\n\n const isAlreadyLoaded =\n url &&\n !!document.querySelectorAll(`link[type=\"text/css\"][href=\"${url}\"]`)\n ?.length;\n\n if (url && !isAlreadyLoaded) {\n const link: HTMLLinkElement = document.createElement('link');\n\n link.setAttribute('rel', 'stylesheet');\n link.setAttribute('type', 'text/css');\n link.setAttribute('href', url);\n\n globalThis.document.head.prepend(link);\n }\n }\n }\n\n async initEnvironment(props: {\n appDefinitionId: string;\n privateAPI: IPrivateAPIFixMe;\n applicationPrivateAPI: any;\n }) {\n const { applicationPrivateAPI, privateAPI, appDefinitionId } = props;\n\n this.#applicationPrivateAPI = applicationPrivateAPI;\n this.#privateAPI = privateAPI;\n\n await EnvironmentContext.inject({\n environment: PlatformEnvironment.Frame,\n privateApi: privateAPI,\n events: this.#events,\n applicationAPIs: {\n [appDefinitionId]: this.#applicationPrivateAPI,\n },\n });\n\n await ApplicationContext.inject({\n appDefinitionId,\n appDefinitionName: '',\n });\n }\n\n notify(event: IPlatformPrivateEvent) {\n this.#eventsBridge.notify(event);\n }\n\n subscribe(cb: (event: IPlatformAppEvent) => void) {\n this.#eventsBridge.subscribe(cb);\n }\n}\n","import {\n APPLICATION_CONTEXT_KEY,\n EnvironmentContext,\n ApplicationContext,\n} from '@wix/editor-application-context';\nimport {\n PlatformAppEvent,\n PlatformAppEventEmitter,\n} from '@wix/public-editor-platform-events';\n\nimport type { EditorPlatformApplication } from '../EditorPlatformApplication';\nimport {\n createEditorPlatformApplicationError,\n EditorPlatformApplicationErrorCode,\n} from '../errors';\nimport { IApplicationSpec } from '../types';\n\nexport const APPLICATION_REGISTRY_KEY = '__APPLICATION_REGISTRY_KEY';\n\nexport type IApplicationRegistry = (\n _instance: EditorPlatformApplication,\n) => void;\n\nexport async function executeApplication(\n events: PlatformAppEventEmitter,\n spec: IApplicationSpec,\n bundle: string,\n): Promise<{\n instance: EditorPlatformApplication;\n}> {\n // eslint-disable-next-line no-new-func\n const executable = new Function(\n APPLICATION_CONTEXT_KEY,\n APPLICATION_REGISTRY_KEY,\n bundle,\n );\n\n let instance: EditorPlatformApplication | undefined;\n\n const applicationRegistryCallback: IApplicationRegistry = (_instance) => {\n if (instance) {\n throw createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationExecuteError,\n 'Application registry called more than once',\n ).withAppDefinitionId(spec.appDefinitionId);\n }\n\n if (_instance.type !== spec.type) {\n throw createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationExecuteError,\n 'Application has different type',\n )\n .withMessage('expected type', spec.type)\n .withMessage('received type', _instance.type);\n }\n\n instance = _instance;\n };\n\n try {\n const context = { ...spec };\n\n executable.call(\n undefined,\n new ApplicationContext(context, await EnvironmentContext.getInstance()),\n applicationRegistryCallback,\n );\n } catch (e: unknown) {\n throw createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationExecuteError,\n (e as Error).message,\n )\n .withAppDefinitionId(spec.appDefinitionId)\n .withParentError(e as Error);\n }\n\n return new Promise((resolve, reject) => {\n const unsubscribe = events.subscribe((event) => {\n const timeoutId = setTimeout(() => {\n clearTimeout(timeoutId);\n unsubscribe();\n\n if (!instance) {\n reject(\n createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationExecuteError,\n 'Application registry was not called, threw by timeout',\n ).withAppDefinitionId(spec.appDefinitionId),\n );\n }\n }, 5000);\n\n if (\n event.type === PlatformAppEvent.ApplicationInit &&\n event.meta.appDefinitionId === spec.appDefinitionId\n ) {\n clearTimeout(timeoutId);\n unsubscribe();\n\n if (!instance) {\n reject(\n createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationExecuteError,\n 'Application registry was not called',\n ).withAppDefinitionId(spec.appDefinitionId),\n );\n }\n\n resolve({ instance: instance! });\n }\n });\n });\n}\n","import {\n PlatformAppEvent,\n PlatformAppEventEmitter,\n} from '@wix/public-editor-platform-events';\nimport { EventType } from '@wix/public-editor-platform-interfaces';\nimport {\n createEditorPlatformApplicationError,\n EditorPlatformApplicationErrorCode,\n} from '../errors';\nimport { EditorPlatformApplication } from '../EditorPlatformApplication';\nimport type { IApplicationSpec, IPrivateAPIFixMe } from '../types';\nimport { executeApplication } from './executeApplication';\n\nexport class PlatformApplicationContainer {\n private apps: Record<string, EditorPlatformApplication> = {};\n\n constructor(\n private privateApi: IPrivateAPIFixMe,\n private events: PlatformAppEventEmitter,\n ) {\n this.events.subscribe((event) => {\n switch (event.type) {\n case PlatformAppEvent.HostEvent: {\n if (event.payload.type === EventType.removeAppCompleted) {\n this.events.withEvent(\n this.events.factories.createApplicationRemovedEvent(\n event.payload.appDefinitionId!,\n ),\n () => {\n return this.removeApplication(event.payload.appDefinitionId!);\n },\n );\n }\n break;\n }\n }\n });\n }\n\n public async runApplication(app: IApplicationSpec) {\n const bundle = await this.loadApplication(app);\n const instance = await this.executeApplication(app, bundle);\n\n this.setApplication(app.appDefinitionId, instance);\n\n return instance;\n }\n\n private setApplication(\n appDefId: string,\n instance: EditorPlatformApplication,\n ) {\n this.apps[appDefId] = instance;\n\n this.events.withEvent(\n this.events.factories.createApplicationApiInitEvent(\n appDefId,\n // TODO: both types are set here...\n // @ts-expect-error TODO: fix me\n instance?.api?.private ? 'private' : 'public',\n ),\n () => {\n // NOTE: sometimes I saw this method was called while application was not executed\n this.privateApi.applicationManager.setApplication(instance);\n },\n );\n }\n\n public getApplication(appDefId: string) {\n return this.apps[appDefId];\n }\n\n public getAppDefinitionIds() {\n return Object.keys(this.apps);\n }\n\n private removeApplication(appDefinitionId: string) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this.apps[appDefinitionId];\n }\n\n private async loadApplication(app: IApplicationSpec) {\n const url = app.url;\n\n return this.events.withEvent(\n this.events.factories.createApplicationLoadEvent(app, url),\n async () => {\n try {\n return await this.loadApplicationBundle(url);\n } catch (e) {\n throw createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationLoadError,\n )\n .withUrl(url)\n .withAppDefinitionId(app.appDefinitionId)\n .withParentError(e as any);\n }\n },\n );\n }\n\n private async loadApplicationBundle(url: string) {\n /**\n * NOTE: we don't use wix http client here\n * because this code is public, while http client is private\n */\n const res = await fetch('url', {\n method: 'GET',\n });\n\n const isSuccessfulResponse = res.status >= 200 && res.status <= 299;\n\n if (!isSuccessfulResponse) {\n throw createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationFetchError,\n ).withUrl(url);\n }\n\n return res.text();\n }\n\n private async executeApplication(app: IApplicationSpec, bundle: string) {\n return this.events.withEvent(\n this.events.factories.createApplicationExecuteEvent(app, app.url),\n async () => {\n const { instance } = await executeApplication(this.events, app, bundle);\n return instance;\n },\n );\n }\n}\n","import {\n EnvironmentContext,\n PlatformEnvironment,\n} from '@wix/editor-application-context';\n\nimport { IApplicationSpec, IPrivateAPIFixMe } from '../../types';\nimport {\n IPlatformPrivateEvent,\n PlatformAppEventEmitter,\n IPlatformAppEvent,\n} from '@wix/public-editor-platform-events';\n\nimport { WorkerEventsBridge } from '../../Events';\n\nimport { PlatformApplicationContainer } from '../../PlatformApplicationContainer';\nimport {\n AbstractEnvironmentAPI,\n PlatformConsumerEnvironmentAPIType,\n} from '../AbstractEnvironmentAPI';\n\nexport class PlatformWorkerAPI extends AbstractEnvironmentAPI<PlatformConsumerEnvironmentAPIType.Worker> {\n public type: PlatformConsumerEnvironmentAPIType.Worker =\n PlatformConsumerEnvironmentAPIType.Worker;\n\n #events = new PlatformAppEventEmitter();\n\n #eventsBridge = new WorkerEventsBridge(this.#events);\n #container: PlatformApplicationContainer | null = null;\n #privateAPI: IPrivateAPIFixMe;\n\n #pendingWaiters: ((value: this) => void)[] = [];\n\n constructor() {\n super(PlatformConsumerEnvironmentAPIType.Worker);\n }\n\n create() {}\n\n async initEnvironment(props: {\n // TODO: should be Promise response in types\n buildPrivateAPI: (config: any) => IPrivateAPIFixMe;\n }) {\n const { buildPrivateAPI } = props;\n this.#privateAPI = await buildPrivateAPI({\n // TODO: should be per application (within the container before app execution)\n type: 'EDITOR_ADDON',\n });\n\n await EnvironmentContext.inject({\n environment: PlatformEnvironment.Worker,\n events: this.#events,\n privateApi: this.#privateAPI,\n applicationAPIs: {},\n });\n\n this.#container = new PlatformApplicationContainer(\n this.#privateAPI,\n this.#events,\n );\n\n this.#pendingWaiters.forEach((res) => res(this));\n }\n\n async notify(event: IPlatformPrivateEvent) {\n await this.waitReady();\n\n this.#eventsBridge.notify(event);\n }\n\n subscribe(cb: (event: IPlatformAppEvent) => void) {\n this.#eventsBridge.subscribe(cb);\n }\n\n async runApplication(app: IApplicationSpec) {\n await this.waitReady();\n\n await this.#container!.runApplication(app);\n }\n\n public waitReady(): Promise<this> {\n return new Promise((res) => {\n if (this.#privateAPI) {\n return res(this);\n }\n\n this.#pendingWaiters.push(res);\n });\n }\n}\n"],"names":["PlatformAppEvent","EditorPlatformApplicationErrorCode","BaseError","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C;EAAA,EAEA,MAAM,eAAe,GAAuB,EAAA;EAC1C,IAAA,MAAM,KAAK,SAAU,EAAA,CAAA;EAErB,IAAM,MAAA,IAAA,CAAK,UAAY,CAAA,cAAA,CAAe,GAAG,CAAA,CAAA;EAAA,GAC3C;EAAA,EAEO,SAA2B,GAAA;EAChC,IAAO,OAAA,IAAI,OAAQ,CAAA,CAAC,GAAQ,KAAA;EAC1B,MAAA,IAAI,KAAK,WAAa,EAAA;EACpB,QAAA,OAAO,IAAI,IAAI,CAAA,CAAA;EAAA,OACjB;EAEA,MAAK,IAAA,CAAA,eAAA,CAAgB,KAAK,GAAG,CAAA,CAAA;EAAA,KAC9B,CAAA,CAAA;EAAA,GACH;EACF;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/ApplicationLifecycle/ApplicationLifecycle.ts","../../src/errors.ts","../../src/EditorPlatformApplication/EditorPlatformApplication.ts","../../../editor-platform-application-context/dist/esm/index.js","../../src/types.ts","../../src/EditorPlatformApplication/WixEditorPlatformApplication.ts","../../src/EditorPlatformApplication/WixEditorPlatformAddon.ts","../../src/Events/WorkerEventsBridge.ts","../../src/PlatformEnvironmentAPI/AbstractEnvironmentAPI.ts","../../src/PlatformEnvironmentAPI/PlatformFrameAPI/PlatformFrameAPI.ts","../../src/PlatformApplicationContainer/executeApplication.ts","../../src/PlatformApplicationContainer/PlatformApplicationContainer.ts","../../src/PlatformEnvironmentAPI/PlatformWorkerAPI/PlatformWorkerAPI.ts"],"sourcesContent":["import {\n PlatformAppEvent,\n IPlatformEditorReadyEvent,\n} from '@wix/public-editor-platform-events';\nimport { ApplicationBoundEvents } from '@wix/editor-application-context';\n\nexport class ApplicationLifecycle {\n private callbacks: Partial<\n Record<\n PlatformAppEvent,\n {\n id: string;\n fn: (payload: any) => void;\n }[]\n >\n > = {};\n\n constructor(private events: ApplicationBoundEvents) {\n this.subscribe();\n }\n\n private subscribe() {\n this.events.subscribe((event) => {\n const { type, payload } = event;\n if (this.callbacks[type]) {\n this.callbacks[type]!.forEach(({ fn }) => fn(payload));\n }\n });\n }\n\n private addCallback(event: PlatformAppEvent, fn: (payload: any) => void) {\n if (!this.callbacks[event]) {\n this.callbacks[event] = [];\n }\n\n const id = `${performance.now()}`;\n\n this.callbacks[event]!.push({\n id,\n fn,\n });\n\n return () => {\n this.callbacks[event] = this.callbacks[event]!.filter(\n (cb) => cb.id !== id,\n );\n };\n }\n\n /**\n * NOTE: currently, we return function to unsubscribe from the event,\n * probably it is better to return `this` to allow chaining\n * and provide another way to unsubscribe from events.\n */\n public onEditorReady(\n fn: (payload: IPlatformEditorReadyEvent['payload']) => void,\n ) {\n return this.addCallback(PlatformAppEvent.EditorReady, fn);\n }\n}\n","import {\n BaseError,\n createErrorBuilder,\n} from '@wix/public-editor-platform-errors';\n\nexport enum EditorPlatformApplicationErrorCode {\n ApplicationRuntimeError = 'ApplicationRuntimeError',\n ApplicationCreationError = 'ApplicationCreationError',\n ApplicationLoadError = 'ApplicationLoadError',\n ApplicationFetchError = 'ApplicationFetchError',\n ApplicationExecuteError = 'ApplicationExecuteError',\n ApplicationWasRemoved = 'ApplicationWasRemoved',\n UndefinedApiMethod = 'UndefinedApiMethod',\n ApplicationIsNotMutable = 'ApplicationIsNotMutable',\n FailedToGetPrivateAPI = 'FailedToGetPrivateAPI',\n ClientAuthError = 'ClientAuthError',\n}\n\nclass EditorPlatformApplicationError extends BaseError<EditorPlatformApplicationErrorCode> {\n state: Partial<{\n url: string;\n appDefinitionId: string;\n apiMethod: string;\n apiType: string;\n }> = {};\n\n constructor(message: string, code: EditorPlatformApplicationErrorCode) {\n super(message, code, 'Editor Platform Application Error');\n }\n\n withUrl(url: string) {\n this.state = { ...this.state, url };\n return this;\n }\n\n withAppDefinitionId(appDefinitionId: string) {\n this.state = { ...this.state, appDefinitionId };\n return this;\n }\n\n withApiMethod(apiMethod: string) {\n this.state = { ...this.state, apiMethod };\n return this;\n }\n\n withApiType(apiType: string) {\n this.state = { ...this.state, apiType };\n return this;\n }\n}\n\nexport const createEditorPlatformApplicationError = createErrorBuilder<\n EditorPlatformApplicationErrorCode,\n EditorPlatformApplicationError\n>(EditorPlatformApplicationError);\n","import { PlatformAppEvent } from '@wix/public-editor-platform-events';\nimport {\n ApplicationContext,\n IApplicationContext,\n} from '@wix/editor-application-context';\nimport { EventType } from '@wix/public-editor-platform-interfaces';\nimport { ApplicationLifecycle } from '../ApplicationLifecycle';\nimport {\n createEditorPlatformApplicationError,\n EditorPlatformApplicationErrorCode,\n} from '../errors';\nimport { ApplicationType } from '../types';\n\n/**\n * TODO: duplicated type to get rid of extra dependency\n */\ntype IApplicationRegistry = (instance: EditorPlatformApplication) => void;\n\ndeclare global {\n // eslint-disable-next-line no-var\n var __APPLICATION_REGISTRY_KEY: IApplicationRegistry;\n}\n\nexport interface IApplicationAPI<TPublicAPI, TPrivateAPI> {\n public?: TPublicAPI;\n private?: TPrivateAPI;\n}\n\nclass ChainAPIConfiguration<TPublicAPI, TPrivateAPI> {\n constructor(private api: IApplicationAPI<TPublicAPI, TPrivateAPI>) {}\n\n exposePublicAPI(api: TPublicAPI) {\n this.api.public = api;\n return this;\n }\n\n exposePrivateAPI(api: TPrivateAPI) {\n this.api.private = api;\n return this;\n }\n}\n\n/**\n * TODO: should accept generic type\n */\nexport abstract class EditorPlatformApplication<\n TContext extends IApplicationContext = IApplicationContext,\n TPublicAPI = unknown,\n TPrivateAPI = unknown,\n> {\n public appDefinitionId: string;\n public state: 'READY' | 'REMOVED' = 'READY';\n\n public lifecycle: ApplicationLifecycle;\n\n #applicationAPI: IApplicationAPI<TPublicAPI, TPrivateAPI> = {};\n #chainAPIConfiguration = new ChainAPIConfiguration<TPublicAPI, TPrivateAPI>(\n this.#applicationAPI,\n );\n\n #manifest: any;\n #context: ApplicationContext<TContext>;\n\n protected constructor(\n public readonly type: ApplicationType,\n context: ApplicationContext<TContext>,\n ) {\n this.#context = context;\n const bindings = this.#context.getBindings();\n\n this.appDefinitionId = bindings.appDefinitionId;\n\n const events = this.#context.getEvents();\n this.lifecycle = new ApplicationLifecycle(events);\n\n /**\n * TODO: application should not listen such event, we should manage its state outside\n */\n events.addEventListener(EventType.removeAppCompleted, (e) => {\n if (e.appDefinitionId === this.appDefinitionId) {\n this.state = 'REMOVED';\n }\n });\n\n const registerApplicationInContainer =\n __APPLICATION_REGISTRY_KEY as IApplicationRegistry;\n\n registerApplicationInContainer(this);\n\n events.notify({\n type: PlatformAppEvent.ApplicationInit,\n payload: {},\n });\n }\n\n protected get context() {\n return this.#context;\n }\n public get events() {\n return this.#context.getEvents();\n }\n\n public setManifest(manifest: any) {\n this.#manifest = manifest;\n }\n\n public getManifest() {\n return this.#manifest;\n }\n\n public exposePublicAPI(api: TPublicAPI) {\n return this.#chainAPIConfiguration.exposePublicAPI(api);\n }\n\n public exposePrivateAPI(api: TPrivateAPI) {\n return this.#chainAPIConfiguration.exposePrivateAPI(api);\n }\n\n public getPublicAPI() {\n return this.#applicationAPI.public;\n }\n\n public getPrivateAPI() {\n return this.#applicationAPI.private;\n }\n\n public ready() {}\n\n buildApplicationError(message: string) {\n return createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationRuntimeError,\n message,\n ).withAppDefinitionId(this.appDefinitionId);\n }\n}\n","import { createErrorBuilder, BaseError } from '@wix/public-editor-platform-errors';\nimport { PlatformAppEvent, PlatformAppEventEmitter } from '@wix/public-editor-platform-events';\n\nvar EditorPlatformApplicationContextErrorCode = /* @__PURE__ */ ((EditorPlatformApplicationContextErrorCode2) => {\n EditorPlatformApplicationContextErrorCode2[\"IncorrectEnvironment\"] = \"IncorrectEnvironment\";\n EditorPlatformApplicationContextErrorCode2[\"ClientAuthError\"] = \"ClientAuthError\";\n return EditorPlatformApplicationContextErrorCode2;\n})(EditorPlatformApplicationContextErrorCode || {});\nclass EditorPlatformApplicationContextError extends BaseError {\n state = {};\n constructor(message, code) {\n super(message, code, \"Editor Platform Application Context Error\");\n }\n withUrl(url) {\n this.state = { ...this.state, url };\n return this;\n }\n withAppDefinitionId(appDefinitionId) {\n this.state = { ...this.state, appDefinitionId };\n return this;\n }\n}\nconst createEditorPlatformApplicationContextError = createErrorBuilder(EditorPlatformApplicationContextError);\n\nasync function transformEventPayload(eventPayload, privateAPI) {\n if (!eventPayload?.type) {\n return eventPayload;\n }\n switch (eventPayload.type) {\n case \"componentSelectionChanged\":\n const componentRefs = eventPayload.componentRefs || [];\n const components = await Promise.all(\n componentRefs.map((ref) => {\n return privateAPI.components.getComponent(ref);\n })\n );\n return {\n type: eventPayload.type,\n components\n };\n default:\n return eventPayload;\n }\n}\n\nclass ApplicationBoundEvents {\n constructor(appDefinitionId, events, privateAPI) {\n this.appDefinitionId = appDefinitionId;\n this.privateAPI = privateAPI;\n this.events = events;\n this.subscribe = events.subscribe.bind(events);\n this.commit = events.commit.bind(events);\n this.startTransaction = events.startTransaction.bind(events);\n this.silent = events.silent.bind(events);\n }\n events;\n subscribe;\n commit;\n startTransaction;\n silent;\n notify(event) {\n this.events.notify({\n type: event.type,\n payload: event.payload,\n meta: {\n appDefinitionId: this.appDefinitionId\n }\n });\n }\n notifyCustomEvent(type, payload) {\n this.notify({\n type: PlatformAppEvent.CustomEvent,\n payload: {\n ...payload,\n type\n }\n });\n }\n /**\n * TODO: we should use same interface for all events\n * (subscribe vs addEventListener)\n */\n addEventListener(eventType, fn) {\n return this.events.subscribe(async (event) => {\n const isAppMatch = event.meta?.appDefinitionId === this.appDefinitionId || event.meta?.appDefinitionId === null;\n const transformPayload = () => transformEventPayload(event.payload, this.privateAPI);\n if (eventType === \"*\") {\n fn(await transformPayload());\n } else if (event.type === PlatformAppEvent.CustomEvent) {\n if (eventType === event.payload?.type && !isAppMatch) {\n fn(await transformPayload());\n }\n } else if (event.type === PlatformAppEvent.HostEvent) {\n if (eventType === event.payload?.type && isAppMatch) {\n fn(await transformPayload());\n }\n }\n });\n }\n}\n\nconst WAIT_INJECTED_TIMEOUT = 200;\nconst WAIT_INJECTED_RETRY_COUNT = 50;\nclass ContextInjectionStatus {\n _resolveContextInjected = () => {\n };\n _isInjected = false;\n key;\n constructor(uuid) {\n this.key = `__${uuid}_CONTEXT_INJECTION_STATUS_KEY`;\n if (!globalThis[this.key]) {\n globalThis[this.key] = new Promise((resolve) => {\n this._resolveContextInjected = () => {\n this._isInjected = true;\n resolve();\n };\n });\n }\n }\n isInjected() {\n return !!this._isInjected;\n }\n resolveInjected() {\n this._resolveContextInjected?.();\n }\n waitInjected() {\n return new Promise((resolve, reject) => {\n let injected = false;\n let timeoutId;\n let retryCount = 0;\n const timeout = () => {\n if (injected) {\n return;\n }\n timeoutId = setTimeout(() => {\n retryCount++;\n if (retryCount < WAIT_INJECTED_RETRY_COUNT) {\n if (retryCount % 10 === 0) {\n console.log(\n createEditorPlatformApplicationContextError(\n EditorPlatformApplicationContextErrorCode.IncorrectEnvironment,\n \"contexts are not resolved, still re-trying\"\n ).withMessage(`try number ${retryCount}`).message\n );\n }\n timeout();\n return;\n }\n if (!injected) {\n const error = createEditorPlatformApplicationContextError(\n EditorPlatformApplicationContextErrorCode.IncorrectEnvironment,\n \"contexts are not resolved, threw by timeout\"\n );\n reject(error);\n }\n }, WAIT_INJECTED_TIMEOUT);\n };\n timeout();\n const _waitContextInjectedPromise = globalThis[this.key];\n _waitContextInjectedPromise.then(() => {\n injected = true;\n clearTimeout(timeoutId);\n resolve();\n });\n });\n }\n}\n\nconst ENVIRONMENT_CONTEXT_KEY = \"__ENVIRONMENT_CONTEXT_KEY\";\nvar PlatformEnvironment = /* @__PURE__ */ ((PlatformEnvironment2) => {\n PlatformEnvironment2[\"Worker\"] = \"Worker\";\n PlatformEnvironment2[\"Frame\"] = \"Frame\";\n PlatformEnvironment2[\"ComponentPanel\"] = \"ComponentPanel\";\n return PlatformEnvironment2;\n})(PlatformEnvironment || {});\nclass EnvironmentContext {\n constructor(environmentContext) {\n this.environmentContext = environmentContext;\n }\n static status = new ContextInjectionStatus(\"environment\");\n static async inject(context) {\n if (globalThis[ENVIRONMENT_CONTEXT_KEY]) {\n throw createEditorPlatformApplicationContextError(\n EditorPlatformApplicationContextErrorCode.IncorrectEnvironment,\n \"Environment context already exists and should not be overridden\"\n );\n }\n globalThis[ENVIRONMENT_CONTEXT_KEY] = new EnvironmentContext(context);\n this.status.resolveInjected();\n }\n static async getInstance() {\n await this.status.waitInjected();\n return globalThis[ENVIRONMENT_CONTEXT_KEY];\n }\n getPrivateAPI() {\n return this.environmentContext.privateApi;\n }\n getEvents() {\n return this.environmentContext.events;\n }\n getApplicationAPIs() {\n return this.environmentContext.applicationAPIs ?? {};\n }\n getEnvironment() {\n return this.environmentContext.environment;\n }\n}\n\nconst APPLICATION_CONTEXT_KEY = \"__APPLICATION_CONTEXT_KEY\";\nclass ApplicationContext {\n constructor(applicationContext, environment) {\n this.applicationContext = applicationContext;\n this.environment = environment;\n this.events = new ApplicationBoundEvents(\n this.applicationContext.appDefinitionId,\n this.environment.getEvents(),\n this.environment.getPrivateAPI()\n );\n }\n static status = new ContextInjectionStatus(\"application\");\n /**\n * TODO: use generics for context type\n * - application\n * - editor\n */\n static async inject(context) {\n const environment = await EnvironmentContext.getInstance();\n if (environment.getEnvironment() !== PlatformEnvironment.Frame) {\n throw createEditorPlatformApplicationContextError(\n EditorPlatformApplicationContextErrorCode.IncorrectEnvironment,\n \"Application context can be injected only in frame environment\"\n );\n }\n if (globalThis[APPLICATION_CONTEXT_KEY]) {\n throw createEditorPlatformApplicationContextError(\n EditorPlatformApplicationContextErrorCode.IncorrectEnvironment,\n \"Application context already exists and should not be overridden\"\n );\n }\n globalThis[APPLICATION_CONTEXT_KEY] = new ApplicationContext(\n context,\n await EnvironmentContext.getInstance()\n );\n this.status.resolveInjected();\n }\n static async getInstance() {\n const environment = await EnvironmentContext.getInstance();\n if (environment.getEnvironment() === PlatformEnvironment.Frame) {\n await this.status.waitInjected();\n return globalThis[APPLICATION_CONTEXT_KEY];\n } else {\n return __APPLICATION_CONTEXT_KEY;\n }\n }\n events;\n getAppDefinitionId() {\n return this.applicationContext.appDefinitionId;\n }\n getBindings() {\n return this.applicationContext;\n }\n getEvents() {\n return this.events;\n }\n getPrivateAPI() {\n return this.environment.getPrivateAPI();\n }\n getPrivateApplicationAPI() {\n const appDefinitionId = this.getAppDefinitionId();\n if (!appDefinitionId) {\n throw createEditorPlatformApplicationContextError(\n EditorPlatformApplicationContextErrorCode.IncorrectEnvironment,\n \"appDefinitionId is not available\"\n );\n }\n return this.environment.getApplicationAPIs()[appDefinitionId];\n }\n}\n\nconst createSDKHost = (props) => {\n const environmentContext = new EnvironmentContext({\n environment: props.environment,\n privateApi: props.privateAPI,\n events: props.events ?? new PlatformAppEventEmitter(),\n applicationAPIs: props.applicationPrivateAPI ? {\n [props.appDefinitionId]: props.applicationPrivateAPI\n } : {}\n });\n const applicationContext = new ApplicationContext(\n {\n appDefinitionId: props.appDefinitionId,\n appDefinitionName: \"\"\n },\n environmentContext\n );\n return {\n environment: {},\n channel: {\n observeState: async () => {\n return {\n disconnect() {\n }\n };\n }\n },\n environmentContext,\n applicationContext\n };\n};\n\nconst auth = (appDefinitionId, privateAPI) => {\n return {\n getAuthHeaders: async () => {\n if (!appDefinitionId) {\n throw createEditorPlatformApplicationContextError(\n EditorPlatformApplicationContextErrorCode.ClientAuthError\n );\n }\n const authInstance = await privateAPI.info.getAppInstance(appDefinitionId);\n if (authInstance === void 0) {\n throw createEditorPlatformApplicationContextError(\n EditorPlatformApplicationContextErrorCode.ClientAuthError,\n \"empty auth instance\"\n ).withAppDefinitionId(appDefinitionId);\n }\n return {\n headers: {\n Authorization: authInstance\n }\n };\n }\n };\n};\n\nexport { APPLICATION_CONTEXT_KEY, ApplicationBoundEvents, ApplicationContext, ENVIRONMENT_CONTEXT_KEY, EnvironmentContext, PlatformEnvironment, auth, createSDKHost };\n//# sourceMappingURL=index.js.map\n","export type IPrivateAPIFixMe = any; // TODO: replace with the real type WrappedPrivateAPI\n// TODO: fix any\nexport type IApplicationSpec = any;\n\nexport enum ApplicationType {\n EditorAddon = 'EDITOR_ADDON',\n Platform = 'PLATFORM',\n}\n","import {\n ApplicationContext,\n IEditorApplicationContext,\n} from '@wix/editor-application-context';\n\nimport { EditorPlatformApplication } from './EditorPlatformApplication';\nimport { ApplicationType } from '../types';\n\nexport class WixEditorPlatformApplication<\n TPublicAPI = unknown,\n TPrivateAPI = unknown,\n> extends EditorPlatformApplication<\n IEditorApplicationContext,\n TPublicAPI,\n TPrivateAPI\n> {\n static async create<TPublicAPI = unknown, TPrivateAPI = unknown>() {\n return new WixEditorPlatformApplication<TPublicAPI, TPrivateAPI>(\n await ApplicationContext.getInstance(),\n );\n }\n\n constructor(context: ApplicationContext<IEditorApplicationContext>) {\n super(ApplicationType.Platform, context);\n }\n}\n","import {\n ApplicationContext,\n IAddonContext,\n} from '@wix/editor-application-context';\nimport {\n EditorPlatformApplicationErrorCode,\n createEditorPlatformApplicationError,\n} from '../errors';\nimport { EditorPlatformApplication } from './EditorPlatformApplication';\nimport { ApplicationType } from '../types';\n\nexport class WixEditorPlatformAddon<\n TPublicAPI = unknown,\n TPrivateAPI = unknown,\n> extends EditorPlatformApplication<IAddonContext, TPublicAPI, TPrivateAPI> {\n static async create<TPublicAPI = unknown, TPrivateAPI = unknown>(): Promise<\n WixEditorPlatformAddon<TPublicAPI, TPrivateAPI>\n > {\n const context = await ApplicationContext.getInstance<IAddonContext>();\n const instance = new WixEditorPlatformAddon<TPublicAPI, TPrivateAPI>(\n context,\n );\n\n try {\n await instance.init();\n return instance;\n } catch (e: unknown) {\n const error = createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationRuntimeError,\n )\n .withParentError(e as Error)\n .withMessage('Failed to initialize addon');\n\n console.error(error);\n\n return instance;\n }\n }\n\n constructor(context: ApplicationContext<IAddonContext>) {\n super(ApplicationType.EditorAddon, context);\n }\n\n private async init() {\n try {\n await this.registerToolsPanel();\n } catch (e: unknown) {\n throw createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationRuntimeError,\n )\n .withMessage('Failed to register addon tools panel')\n .withParentError(e as Error);\n }\n }\n\n private async registerToolsPanel() {\n const bindings = this.context.getBindings();\n\n const { url, width, height, initialPosition } =\n bindings.data?.toolPanelConfig;\n\n if (url) {\n await this.context.getPrivateAPI().addons.registerToolsPanel(\n { appDefinitionId: bindings.appDefinitionId, applicationId: '111' },\n {\n title: bindings.appDefinitionName,\n },\n {\n url,\n // TODO: this can become \"200px\", \"50%\" etc in future. For now we simply assume numeric values like \"250\".\n width: Number(width),\n height: Number(height),\n initialPosition: {\n x: Number(initialPosition.x),\n y: Number(initialPosition.y),\n },\n },\n );\n }\n }\n}\n","import {\n IPlatformPrivateEvent,\n PlatformLifecycleEvent,\n PlatformPrivateEvent,\n // --\n IPlatformAppEvent,\n PlatformAppEvent,\n PlatformAppEventEmitter,\n} from '@wix/public-editor-platform-events';\n\n/**\n * The events bridge between platform events (private) and app events\n */\nexport class WorkerEventsBridge {\n constructor(private platformAppEvents: PlatformAppEventEmitter) {}\n\n /**\n * Notify by event from Worker Manager (platform infrastructure)\n */\n public notify(event: IPlatformPrivateEvent) {\n switch (event.type) {\n case PlatformLifecycleEvent.EditorReady:\n this.platformAppEvents.notify({\n ...event,\n // @ts-expect-error TODO: fix me\n type: PlatformAppEvent.EditorReady,\n });\n break;\n case PlatformPrivateEvent.HostEvent:\n this.platformAppEvents.notify({\n ...event,\n type: PlatformAppEvent.HostEvent,\n });\n break;\n }\n }\n\n /**\n * Subscribe to Worker (Application) event\n */\n public subscribe(cb: (event: IPlatformAppEvent) => void) {\n this.platformAppEvents.subscribe((event) => {\n cb(event);\n });\n }\n}\n","export enum PlatformConsumerEnvironmentAPIType {\n Frame = 'PLATFORM_FRAME_API',\n Worker = 'PLATFORM_WORKER_API',\n}\n\n/**\n * rename these entities -> API to Env\n */\nexport abstract class AbstractEnvironmentAPI<\n TEnv extends PlatformConsumerEnvironmentAPIType,\n> {\n /**\n * NOTE: we can't `type` declare getter within current abstract class\n * because then after transferring API between threads this getter becomes promise,\n * which is not expected\n *\n * get type() {\n * return this.env;\n * }\n */\n public abstract type: TEnv;\n\n protected constructor(protected env: TEnv) {\n this.create();\n }\n\n abstract create(): void;\n abstract initEnvironment(props: unknown): void;\n}\n","import { IPrivateAPIFixMe } from '../../types';\n\nimport {\n IPlatformAppEvent,\n IPlatformPrivateEvent,\n PlatformAppEventEmitter,\n} from '@wix/public-editor-platform-events';\nimport { createClient } from '@wix/sdk';\n\nimport { WorkerEventsBridge } from '../../Events';\nimport {\n AbstractEnvironmentAPI,\n PlatformConsumerEnvironmentAPIType,\n} from '../AbstractEnvironmentAPI';\nimport {\n ApplicationContext,\n createSDKHost,\n auth,\n EnvironmentContext,\n PlatformEnvironment,\n} from '@wix/editor-application-context';\n\nconst DESIGN_SYSTEM_STYLES_MAP = {\n classic:\n 'https://www.unpkg.com/@wix/design-system/dist/statics/tokens-default.global.css',\n studio:\n 'https://www.unpkg.com/@wix/design-system/dist/statics/tokens-studio.global.css',\n};\n\nexport class PlatformFrameAPI extends AbstractEnvironmentAPI<PlatformConsumerEnvironmentAPIType.Frame> {\n public type: PlatformConsumerEnvironmentAPIType.Frame =\n PlatformConsumerEnvironmentAPIType.Frame;\n\n #events = new PlatformAppEventEmitter();\n #eventsBridge = new WorkerEventsBridge(this.#events);\n #privateAPI: IPrivateAPIFixMe;\n #applicationPrivateAPI: any;\n\n constructor() {\n super(PlatformConsumerEnvironmentAPIType.Frame);\n }\n\n create() {\n if (typeof globalThis?.document?.head?.prepend === 'function') {\n const params = new URL(globalThis.location.href).searchParams;\n\n // TODO: check all possible editorType values\n const host =\n params.get('editorType') === 'CLASSIC' ? 'classic' : 'studio';\n\n const url = DESIGN_SYSTEM_STYLES_MAP[host];\n\n const isAlreadyLoaded =\n url &&\n !!document.querySelectorAll(`link[type=\"text/css\"][href=\"${url}\"]`)\n ?.length;\n\n if (url && !isAlreadyLoaded) {\n const link: HTMLLinkElement = document.createElement('link');\n\n link.setAttribute('rel', 'stylesheet');\n link.setAttribute('type', 'text/css');\n link.setAttribute('href', url);\n\n globalThis.document.head.prepend(link);\n }\n }\n }\n\n async initEnvironment(props: {\n appDefinitionId: string;\n privateAPI: IPrivateAPIFixMe;\n applicationPrivateAPI: any;\n }) {\n const { applicationPrivateAPI, privateAPI, appDefinitionId } = props;\n\n this.#applicationPrivateAPI = applicationPrivateAPI;\n this.#privateAPI = privateAPI;\n\n await EnvironmentContext.inject({\n environment: PlatformEnvironment.Frame,\n privateApi: privateAPI,\n events: this.#events,\n applicationAPIs: {\n [appDefinitionId]: this.#applicationPrivateAPI,\n },\n });\n\n await ApplicationContext.inject({\n appDefinitionId,\n appDefinitionName: '',\n });\n\n /**\n * https://github.com/wix-private/public-sdk?tab=readme-ov-file#providing-a-contextual-wixclient\n * init wix client and its contexts,\n * so sdk shapes will be able to use these client instance our of the box\n */\n const client = createClient({\n auth: auth(appDefinitionId, privateAPI),\n host: createSDKHost({\n appDefinitionId,\n privateAPI: this.#privateAPI,\n environment: PlatformEnvironment.Frame,\n events: this.#events,\n applicationPrivateAPI: this.#applicationPrivateAPI,\n }),\n });\n\n client.enableContext('global');\n }\n\n notify(event: IPlatformPrivateEvent) {\n this.#eventsBridge.notify(event);\n }\n\n subscribe(cb: (event: IPlatformAppEvent) => void) {\n this.#eventsBridge.subscribe(cb);\n }\n}\n","import {\n PlatformAppEvent,\n PlatformAppEventEmitter,\n} from '@wix/public-editor-platform-events';\nimport {\n APPLICATION_CONTEXT_KEY,\n EnvironmentContext,\n ApplicationContext,\n} from '@wix/editor-application-context';\n\nimport type { EditorPlatformApplication } from '../EditorPlatformApplication';\nimport {\n createEditorPlatformApplicationError,\n EditorPlatformApplicationErrorCode,\n} from '../errors';\nimport { IApplicationSpec } from '../types';\nimport { WixClient } from '@wix/sdk';\n\nexport const APPLICATION_REGISTRY_KEY = '__APPLICATION_REGISTRY_KEY';\n\nexport type IApplicationRegistry = (\n _instance: EditorPlatformApplication,\n) => void;\n\nexport async function executeApplication(\n events: PlatformAppEventEmitter,\n client: WixClient,\n spec: IApplicationSpec,\n bundle: string,\n): Promise<{\n instance: EditorPlatformApplication;\n}> {\n // eslint-disable-next-line no-new-func\n const executable = new Function(\n '$wixContext',\n APPLICATION_CONTEXT_KEY,\n APPLICATION_REGISTRY_KEY,\n bundle,\n );\n\n let instance: EditorPlatformApplication | undefined;\n\n const applicationRegistryCallback: IApplicationRegistry = (_instance) => {\n if (instance) {\n throw createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationExecuteError,\n 'Application registry called more than once',\n ).withAppDefinitionId(spec.appDefinitionId);\n }\n\n if (_instance.type !== spec.type) {\n throw createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationExecuteError,\n 'Application has different type',\n )\n .withMessage('expected type', spec.type)\n .withMessage('received type', _instance.type);\n }\n\n instance = _instance;\n };\n\n try {\n const context = { ...spec };\n\n executable.call(\n { client },\n new ApplicationContext(context, await EnvironmentContext.getInstance()),\n applicationRegistryCallback,\n );\n } catch (e: unknown) {\n throw createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationExecuteError,\n (e as Error).message,\n )\n .withAppDefinitionId(spec.appDefinitionId)\n .withParentError(e as Error);\n }\n\n return new Promise((resolve, reject) => {\n const unsubscribe = events.subscribe((event) => {\n const timeoutId = setTimeout(() => {\n clearTimeout(timeoutId);\n unsubscribe();\n\n if (!instance) {\n reject(\n createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationExecuteError,\n 'Application registry was not called, threw by timeout',\n ).withAppDefinitionId(spec.appDefinitionId),\n );\n }\n }, 5000);\n\n if (\n event.type === PlatformAppEvent.ApplicationInit &&\n event.meta.appDefinitionId === spec.appDefinitionId\n ) {\n clearTimeout(timeoutId);\n unsubscribe();\n\n if (!instance) {\n reject(\n createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationExecuteError,\n 'Application registry was not called',\n ).withAppDefinitionId(spec.appDefinitionId),\n );\n }\n\n resolve({ instance: instance! });\n }\n });\n });\n}\n","import {\n PlatformAppEvent,\n PlatformAppEventEmitter,\n} from '@wix/public-editor-platform-events';\nimport { EventType } from '@wix/public-editor-platform-interfaces';\nimport {\n createEditorPlatformApplicationError,\n EditorPlatformApplicationErrorCode,\n} from '../errors';\nimport { EditorPlatformApplication } from '../EditorPlatformApplication';\nimport type { IApplicationSpec, IPrivateAPIFixMe } from '../types';\nimport { executeApplication } from './executeApplication';\nimport { createClient } from '@wix/sdk';\nimport {\n ApplicationContext,\n EnvironmentContext,\n PlatformEnvironment,\n auth,\n createSDKHost,\n} from '@wix/editor-application-context';\n\nexport class PlatformApplicationContainer {\n #apps: Record<string, EditorPlatformApplication> = {};\n\n readonly #privateAPI: IPrivateAPIFixMe;\n readonly #events: PlatformAppEventEmitter;\n\n constructor(privateApi: IPrivateAPIFixMe, events: PlatformAppEventEmitter) {\n this.#privateAPI = privateApi;\n this.#events = events;\n\n this.#events.subscribe((event) => {\n switch (event.type) {\n case PlatformAppEvent.HostEvent: {\n if (event.payload.type === EventType.removeAppCompleted) {\n void this.#events.withEvent(\n this.#events.factories.createApplicationRemovedEvent(\n event.payload.appDefinitionId!,\n ),\n () => {\n return this.removeApplication(event.payload.appDefinitionId!);\n },\n );\n }\n break;\n }\n }\n });\n }\n\n public async runApplication(app: IApplicationSpec) {\n const bundle = await this.loadApplication(app);\n const instance = await this.executeApplication(app, bundle);\n\n this.setApplication(app.appDefinitionId, instance);\n\n return instance;\n }\n\n private setApplication(\n appDefId: string,\n instance: EditorPlatformApplication,\n ) {\n this.#apps[appDefId] = instance;\n\n void this.#events.withEvent(\n this.#events.factories.createApplicationApiInitEvent(\n appDefId,\n // TODO: both types are set here...\n // @ts-expect-error TODO: fix me\n instance?.api?.private ? 'private' : 'public',\n ),\n () => {\n // NOTE: sometimes I saw this method was called while application was not executed\n this.#privateAPI.applicationManager.setApplication(instance);\n },\n );\n }\n\n public getApplication(appDefId: string) {\n return this.#apps[appDefId];\n }\n\n public getAppDefinitionIds() {\n return Object.keys(this.#apps);\n }\n\n private removeApplication(appDefinitionId: string) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this.#apps[appDefinitionId];\n }\n\n private async loadApplication(app: IApplicationSpec) {\n const url = app.url;\n\n return this.#events.withEvent(\n this.#events.factories.createApplicationLoadEvent(app, url),\n\n async () => {\n try {\n return await this.loadApplicationBundle(url);\n } catch (e) {\n throw createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationLoadError,\n )\n .withUrl(url)\n .withAppDefinitionId(app.appDefinitionId)\n .withParentError(e as any);\n }\n },\n );\n }\n\n private async loadApplicationBundle(url: string) {\n /**\n * NOTE: we don't use wix http client here\n * because this code is public, while http client is private\n */\n const res = await fetch('url', {\n method: 'GET',\n });\n\n const isSuccessfulResponse = res.status >= 200 && res.status <= 299;\n\n if (!isSuccessfulResponse) {\n throw createEditorPlatformApplicationError(\n EditorPlatformApplicationErrorCode.ApplicationFetchError,\n ).withUrl(url);\n }\n\n return res.text();\n }\n\n private async executeApplication(app: IApplicationSpec, bundle: string) {\n return this.#events.withEvent(\n this.#events.factories.createApplicationExecuteEvent(app, app.url),\n async () => {\n const client = this.#createWixClient(app.appDefinitionId);\n\n const { instance } = await executeApplication(\n this.#events,\n client,\n app,\n bundle,\n );\n return instance;\n },\n );\n }\n\n #createWixClient(appDefinitionId: string) {\n return createClient({\n auth: auth(appDefinitionId, this.#privateAPI),\n host: createSDKHost({\n appDefinitionId,\n privateAPI: this.#privateAPI,\n environment: PlatformEnvironment.Worker,\n events: this.#events,\n applicationPrivateAPI: {},\n }),\n });\n }\n}\n","import { IApplicationSpec, IPrivateAPIFixMe } from '../../types';\nimport {\n IPlatformPrivateEvent,\n PlatformAppEventEmitter,\n IPlatformAppEvent,\n} from '@wix/public-editor-platform-events';\n\nimport { WorkerEventsBridge } from '../../Events';\n\nimport { PlatformApplicationContainer } from '../../PlatformApplicationContainer';\nimport {\n AbstractEnvironmentAPI,\n PlatformConsumerEnvironmentAPIType,\n} from '../AbstractEnvironmentAPI';\nimport {\n EnvironmentContext,\n PlatformEnvironment,\n} from '@wix/editor-application-context';\n\nexport class PlatformWorkerAPI extends AbstractEnvironmentAPI<PlatformConsumerEnvironmentAPIType.Worker> {\n public type: PlatformConsumerEnvironmentAPIType.Worker =\n PlatformConsumerEnvironmentAPIType.Worker;\n\n #events = new PlatformAppEventEmitter();\n\n #eventsBridge = new WorkerEventsBridge(this.#events);\n #container: PlatformApplicationContainer | null = null;\n #privateAPI: IPrivateAPIFixMe;\n\n #pendingWaiters: ((value: this) => void)[] = [];\n\n constructor() {\n super(PlatformConsumerEnvironmentAPIType.Worker);\n }\n\n create() {}\n\n async initEnvironment(props: {\n // TODO: should be Promise response in types\n buildPrivateAPI: (config: any) => IPrivateAPIFixMe;\n }) {\n const { buildPrivateAPI } = props;\n this.#privateAPI = await buildPrivateAPI({\n // TODO: should be per application (within the container before app execution)\n type: 'EDITOR_ADDON',\n });\n\n await EnvironmentContext.inject({\n environment: PlatformEnvironment.Worker,\n events: this.#events,\n privateApi: this.#privateAPI,\n applicationAPIs: {},\n });\n\n this.#container = new PlatformApplicationContainer(\n this.#privateAPI,\n this.#events,\n );\n\n this.#pendingWaiters.forEach((res) => res(this));\n }\n\n async notify(event: IPlatformPrivateEvent) {\n await this.waitReady();\n\n this.#eventsBridge.notify(event);\n }\n\n subscribe(cb: (event: IPlatformAppEvent) => void) {\n this.#eventsBridge.subscribe(cb);\n }\n\n async runApplication(app: IApplicationSpec) {\n await this.waitReady();\n\n await this.#container!.runApplication(app);\n }\n\n public waitReady(): Promise<this> {\n return new Promise((res) => {\n if (this.#privateAPI) {\n return res(this);\n }\n\n this.#pendingWaiters.push(res);\n });\n }\n}\n"],"names":["PlatformAppEvent","EditorPlatformApplicationErrorCode","BaseError","createErrorBuilder","EventType","PlatformAppEventEmitter","ApplicationType","PlatformLifecycleEvent","PlatformPrivateEvent","PlatformConsumerEnvironmentAPIType","createClient"],"mapp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