@wix/editor 1.320.0 → 1.322.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/index.js +133 -122
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +133 -122
- package/dist/esm/index.js.map +1 -1
- package/dist/statics/index.js +133 -122
- package/dist/statics/index.js.map +1 -1
- package/dist/types/index.d.ts +22 -35
- package/package.json +4 -4
package/dist/statics/index.js
CHANGED
|
@@ -304,49 +304,32 @@
|
|
|
304
304
|
"EmptyAppDefinitionId" /* EmptyAppDefinitionId */
|
|
305
305
|
);
|
|
306
306
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
307
|
+
if (!instance || hasEnoughTimeUntilExpiry(
|
|
308
|
+
instance.expires,
|
|
309
|
+
ACCESS_TOKEN_EXPIRY_GRACE_PERIOD
|
|
310
|
+
)) {
|
|
311
|
+
instance = await privateAPI.auth.getAccessToken(
|
|
312
|
+
bindings.appDefinitionId,
|
|
313
|
+
await privateAPI.info.getMetaSiteId()
|
|
311
314
|
);
|
|
312
|
-
} catch (e) {
|
|
313
|
-
supportNewAuth = false;
|
|
314
315
|
}
|
|
315
|
-
if (
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
ACCESS_TOKEN_EXPIRY_GRACE_PERIOD
|
|
319
|
-
)) {
|
|
320
|
-
instance = await privateAPI.auth.getAccessToken(
|
|
321
|
-
bindings.appDefinitionId,
|
|
322
|
-
await privateAPI.info.getMetaSiteId()
|
|
323
|
-
);
|
|
324
|
-
}
|
|
325
|
-
if (!instance?.token) {
|
|
326
|
-
throw createEditorPlatformSDKAuthError(
|
|
316
|
+
if (!instance?.token) {
|
|
317
|
+
console.error(
|
|
318
|
+
createEditorPlatformSDKAuthError(
|
|
327
319
|
"EmptyAppAuthInstance" /* EmptyAppAuthInstance */
|
|
328
|
-
).withAppDefinitionId(bindings.appDefinitionId)
|
|
329
|
-
}
|
|
330
|
-
return {
|
|
331
|
-
headers: {
|
|
332
|
-
Authorization: instance.token
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
} else {
|
|
336
|
-
const authInstance = await privateAPI.info.getAppInstance(
|
|
337
|
-
bindings.appDefinitionId
|
|
320
|
+
).withAppDefinitionId(bindings.appDefinitionId)
|
|
338
321
|
);
|
|
339
|
-
if (authInstance === void 0) {
|
|
340
|
-
throw createEditorPlatformSDKAuthError(
|
|
341
|
-
"EmptyAppAuthInstance" /* EmptyAppAuthInstance */
|
|
342
|
-
).withAppDefinitionId(bindings.appDefinitionId);
|
|
343
|
-
}
|
|
344
322
|
return {
|
|
345
323
|
headers: {
|
|
346
|
-
Authorization:
|
|
324
|
+
Authorization: ""
|
|
347
325
|
}
|
|
348
326
|
};
|
|
349
327
|
}
|
|
328
|
+
return {
|
|
329
|
+
headers: {
|
|
330
|
+
Authorization: instance.token
|
|
331
|
+
}
|
|
332
|
+
};
|
|
350
333
|
}
|
|
351
334
|
};
|
|
352
335
|
};
|
|
@@ -503,13 +486,98 @@
|
|
|
503
486
|
});
|
|
504
487
|
var index$1 = widgetShape.build();
|
|
505
488
|
|
|
489
|
+
const UNDERLINE_DEFINITION = "underline";
|
|
490
|
+
function extractFontVar(fontString) {
|
|
491
|
+
const trimmedFont = fontString.trim();
|
|
492
|
+
const match = trimmedFont.match(/var\((--[\w-]+),\s*(.+)\)/);
|
|
493
|
+
if (match) {
|
|
494
|
+
return {
|
|
495
|
+
variableName: match[1],
|
|
496
|
+
fallbackValue: match[2]?.trim() ?? ""
|
|
497
|
+
};
|
|
498
|
+
} else {
|
|
499
|
+
return {
|
|
500
|
+
variableName: void 0,
|
|
501
|
+
fallbackValue: trimmedFont
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
function parseFontString(fontPickerValue) {
|
|
506
|
+
const font = {
|
|
507
|
+
family: void 0,
|
|
508
|
+
size: void 0
|
|
509
|
+
};
|
|
510
|
+
if (fontPickerValue?.font) {
|
|
511
|
+
const { variableName, fallbackValue } = extractFontVar(
|
|
512
|
+
fontPickerValue.font
|
|
513
|
+
);
|
|
514
|
+
font.cssVariableName = variableName;
|
|
515
|
+
const parts = fallbackValue.match(/(?:(["']).*?\1|\S)+/g) || [];
|
|
516
|
+
for (let i = 0; i < parts.length; i++) {
|
|
517
|
+
const part = parts[i];
|
|
518
|
+
switch (part) {
|
|
519
|
+
case "bold":
|
|
520
|
+
font.bold = true;
|
|
521
|
+
break;
|
|
522
|
+
case "italic":
|
|
523
|
+
font.italic = true;
|
|
524
|
+
break;
|
|
525
|
+
default:
|
|
526
|
+
if (part?.endsWith("px")) {
|
|
527
|
+
font.size = parseInt(part, 10);
|
|
528
|
+
} else if (i === parts.length - 1) {
|
|
529
|
+
font.family = part;
|
|
530
|
+
} else {
|
|
531
|
+
font.family = (font.family || "") + " " + part;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
if (fontPickerValue?.textDecoration) {
|
|
537
|
+
font.underline = fontPickerValue.textDecoration === UNDERLINE_DEFINITION;
|
|
538
|
+
}
|
|
539
|
+
font.family = font.family?.trim().replace(/['"]+/g, "");
|
|
540
|
+
return font;
|
|
541
|
+
}
|
|
542
|
+
function fontValueToCSS(fontValue) {
|
|
543
|
+
return `${fontValue.cssVariableName ? `var(${fontValue.cssVariableName}, ` : ""}${fontValue.italic ? "italic " : ""}${fontValue.bold ? "bold " : ""}${fontValue.size || 16}px ${// wrap each font family with quotes
|
|
544
|
+
fontValue.family?.split(",").map((fontFamily) => `"${fontFamily.replace(/['"]+/g, "")}"`).join(",") || "serif"}${fontValue.cssVariableName ? ")" : ""}`;
|
|
545
|
+
}
|
|
546
|
+
function parseColorString(colorPickerValue) {
|
|
547
|
+
if (!colorPickerValue) {
|
|
548
|
+
return null;
|
|
549
|
+
}
|
|
550
|
+
const colorString = colorPickerValue;
|
|
551
|
+
const match = colorString.match(/var\((--[\w-]+),\s*(.+)\)/);
|
|
552
|
+
if (match) {
|
|
553
|
+
return {
|
|
554
|
+
cssVariableName: match[1],
|
|
555
|
+
color: match[2]
|
|
556
|
+
};
|
|
557
|
+
} else {
|
|
558
|
+
return {
|
|
559
|
+
color: colorString
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
function colorValueToCSS(colorValue) {
|
|
564
|
+
if (!colorValue) {
|
|
565
|
+
return "";
|
|
566
|
+
}
|
|
567
|
+
return colorValue.cssVariableName ? `var(${colorValue.cssVariableName}, ${colorValue.color})` : colorValue.color;
|
|
568
|
+
}
|
|
506
569
|
const fonts = {
|
|
507
570
|
transformFontInternalValue: (value) => {
|
|
508
571
|
if (value) {
|
|
509
|
-
const { theme, ...rest } =
|
|
572
|
+
const { theme, cssVariableName, bold, italic, underline, ...rest } = value;
|
|
510
573
|
return {
|
|
511
574
|
...rest,
|
|
512
|
-
|
|
575
|
+
style: {
|
|
576
|
+
bold,
|
|
577
|
+
italic,
|
|
578
|
+
underline
|
|
579
|
+
},
|
|
580
|
+
editorKey: cssVariableName || theme || ""
|
|
513
581
|
};
|
|
514
582
|
} else {
|
|
515
583
|
return {
|
|
@@ -519,112 +587,55 @@
|
|
|
519
587
|
style: {}
|
|
520
588
|
};
|
|
521
589
|
}
|
|
522
|
-
},
|
|
523
|
-
transformFontPublicValue: (value) => {
|
|
524
|
-
if (!value) {
|
|
525
|
-
return null;
|
|
526
|
-
}
|
|
527
|
-
return {
|
|
528
|
-
...fonts.normalize(value),
|
|
529
|
-
theme: value.editorKey
|
|
530
|
-
};
|
|
531
|
-
},
|
|
532
|
-
normalize: ({
|
|
533
|
-
theme,
|
|
534
|
-
editorKey,
|
|
535
|
-
preset,
|
|
536
|
-
...rest
|
|
537
|
-
}) => {
|
|
538
|
-
return {
|
|
539
|
-
...rest,
|
|
540
|
-
theme: theme ?? editorKey
|
|
541
|
-
};
|
|
542
590
|
}
|
|
543
591
|
};
|
|
544
592
|
const inputsShape = new PlatformSDKShape("inputs", {
|
|
545
593
|
selectColor({ applicationContext }) {
|
|
546
|
-
return async (value,
|
|
594
|
+
return async (value, options) => {
|
|
547
595
|
const privateAPI = applicationContext.getPrivateAPI();
|
|
548
|
-
let
|
|
549
|
-
|
|
550
|
-
theme: value?.theme
|
|
551
|
-
} : null;
|
|
596
|
+
let colorValue = parseColorString(value);
|
|
597
|
+
let colorResult = colorValueToCSS(colorValue);
|
|
552
598
|
await privateAPI.inputs.openColorPicker(
|
|
553
599
|
{
|
|
554
|
-
color:
|
|
600
|
+
color: colorValue?.cssVariableName || colorValue?.theme || colorValue?.color
|
|
555
601
|
},
|
|
556
602
|
({
|
|
557
603
|
color,
|
|
558
|
-
theme
|
|
604
|
+
theme,
|
|
605
|
+
cssVariableTheme
|
|
559
606
|
}) => {
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
607
|
+
colorValue = {
|
|
608
|
+
color,
|
|
609
|
+
theme,
|
|
610
|
+
cssVariableName: cssVariableTheme
|
|
611
|
+
};
|
|
612
|
+
colorResult = colorValueToCSS(colorValue);
|
|
613
|
+
options?.onChange?.(colorResult);
|
|
563
614
|
}
|
|
564
615
|
);
|
|
565
|
-
return
|
|
616
|
+
return colorResult;
|
|
566
617
|
};
|
|
567
618
|
},
|
|
568
619
|
selectFont({ applicationContext }) {
|
|
569
|
-
return async (value, options
|
|
620
|
+
return async (value, options) => {
|
|
570
621
|
const privateAPI = applicationContext.getPrivateAPI();
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
_value = fonts.transformFontPublicValue(
|
|
575
|
-
fonts.transformFontInternalValue(value)
|
|
576
|
-
);
|
|
577
|
-
}
|
|
578
|
-
switch (changes[0]) {
|
|
579
|
-
case "theme":
|
|
580
|
-
Object.assign(_value, {
|
|
581
|
-
theme: changes[1]
|
|
582
|
-
});
|
|
583
|
-
break;
|
|
584
|
-
case "size":
|
|
585
|
-
Object.assign(_value, {
|
|
586
|
-
size: changes[1]
|
|
587
|
-
});
|
|
588
|
-
break;
|
|
589
|
-
case "bold":
|
|
590
|
-
Object.assign(_value, {
|
|
591
|
-
style: {
|
|
592
|
-
..._value.style,
|
|
593
|
-
bold: changes[1]
|
|
594
|
-
}
|
|
595
|
-
});
|
|
596
|
-
break;
|
|
597
|
-
case "italic":
|
|
598
|
-
Object.assign(_value, {
|
|
599
|
-
style: {
|
|
600
|
-
..._value.style,
|
|
601
|
-
italic: changes[1]
|
|
602
|
-
}
|
|
603
|
-
});
|
|
604
|
-
break;
|
|
605
|
-
case "underline":
|
|
606
|
-
Object.assign(_value, {
|
|
607
|
-
style: {
|
|
608
|
-
..._value.style,
|
|
609
|
-
underline: changes[1]
|
|
610
|
-
}
|
|
611
|
-
});
|
|
612
|
-
break;
|
|
613
|
-
case "family":
|
|
614
|
-
Object.assign(_value, {
|
|
615
|
-
family: changes[1]
|
|
616
|
-
});
|
|
617
|
-
break;
|
|
618
|
-
}
|
|
619
|
-
};
|
|
620
|
-
await privateAPI.inputs.openFontPicker(
|
|
622
|
+
const fontValue = parseFontString(value);
|
|
623
|
+
let _value = value;
|
|
624
|
+
await privateAPI.inputs.openFontPickerV2(
|
|
621
625
|
{
|
|
622
626
|
...options,
|
|
623
|
-
|
|
627
|
+
panelSectionsDefinition: {
|
|
628
|
+
...options?.panelSectionsDefinition,
|
|
629
|
+
htmlTag: "hidden"
|
|
630
|
+
},
|
|
631
|
+
componentStyle: fonts.transformFontInternalValue(fontValue)
|
|
624
632
|
},
|
|
625
|
-
(
|
|
626
|
-
|
|
627
|
-
|
|
633
|
+
(font, accessibility) => {
|
|
634
|
+
_value = {
|
|
635
|
+
font: fontValueToCSS(font),
|
|
636
|
+
textDecoration: font.underline ? UNDERLINE_DEFINITION : void 0
|
|
637
|
+
};
|
|
638
|
+
options?.onChange?.(_value);
|
|
628
639
|
}
|
|
629
640
|
);
|
|
630
641
|
return _value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../editor-platform-application-context/dist/esm/index.js","../../src/auth.ts","../../src/env.ts","../../src/PlatformSDKShape.ts","../../src/application/index.ts","../../src/components/index.ts","../../src/events/index.ts","../../src/info/index.ts","../../src/widget/errors.ts","../../src/widget/index.ts","../../src/inputs/index.ts","../../src/editorPlatformFrameHost.ts","../../src/editorPlatformWorkerHost.ts","../../src/index.ts"],"sourcesContent":["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 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 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 };\n//# sourceMappingURL=index.js.map\n","import { ApplicationContext } from '@wix/editor-application-context';\nimport {\n BaseError,\n createErrorBuilder,\n} from '@wix/public-editor-platform-errors';\nimport { AccessToken } from '@wix/public-editor-platform-interfaces';\n\nexport enum EditorPlatformSDKAuthErrorCode {\n EmptyAppAuthInstance = 'EmptyAppAuthInstance',\n EmptyAppDefinitionId = 'EmptyAppDefinitionId',\n}\n\nclass EditorPlatformSDKAuthError extends BaseError<EditorPlatformSDKAuthErrorCode> {\n state: Partial<{\n appDefinitionId: string;\n }> = {};\n\n constructor(message: string, code: EditorPlatformSDKAuthErrorCode) {\n super(message, code, 'Auth Strategy Error');\n }\n\n withAppDefinitionId(appDefinitionId: string) {\n this.state = { ...this.state, appDefinitionId };\n return this;\n }\n}\n\nexport const createEditorPlatformSDKAuthError = createErrorBuilder<\n EditorPlatformSDKAuthErrorCode,\n EditorPlatformSDKAuthError\n>(EditorPlatformSDKAuthError);\n\nfunction hasEnoughTimeUntilExpiry(\n expires: Date | undefined,\n expiryBuffer: number,\n) {\n const now = Date.now();\n const expiryTime = expires ? new Date(expires).getTime() : null;\n return expiryTime && expiryTime - now > expiryBuffer;\n}\n\nconst ACCESS_TOKEN_EXPIRY_GRACE_PERIOD = 30 * 60 * 1000; // half an hour\n\nexport const auth = () => {\n let instance: AccessToken;\n\n return {\n getAuthHeaders: async () => {\n const context = await ApplicationContext.getInstance();\n const bindings = context.getBindings();\n const privateAPI = context.getPrivateAPI();\n\n if (!bindings.appDefinitionId) {\n throw createEditorPlatformSDKAuthError(\n EditorPlatformSDKAuthErrorCode.EmptyAppDefinitionId,\n );\n }\n\n /**\n * temporary try/catch\n */\n let supportNewAuth: boolean;\n\n try {\n supportNewAuth = await privateAPI.experiments.enabled(\n 'platform2.0_sdk_auth',\n );\n } catch (e) {\n supportNewAuth = false;\n }\n\n if (supportNewAuth) {\n if (\n !instance ||\n hasEnoughTimeUntilExpiry(\n instance.expires,\n ACCESS_TOKEN_EXPIRY_GRACE_PERIOD,\n )\n ) {\n instance = await privateAPI.auth.getAccessToken(\n bindings.appDefinitionId,\n await privateAPI.info.getMetaSiteId(),\n );\n }\n\n if (!instance?.token) {\n throw createEditorPlatformSDKAuthError(\n EditorPlatformSDKAuthErrorCode.EmptyAppAuthInstance,\n ).withAppDefinitionId(bindings.appDefinitionId);\n }\n\n return {\n headers: {\n Authorization: instance.token,\n },\n };\n } else {\n const authInstance = await privateAPI.info.getAppInstance(\n bindings.appDefinitionId,\n );\n\n if (authInstance === undefined) {\n throw createEditorPlatformSDKAuthError(\n EditorPlatformSDKAuthErrorCode.EmptyAppAuthInstance,\n ).withAppDefinitionId(bindings.appDefinitionId);\n }\n\n return {\n headers: {\n Authorization: authInstance,\n },\n };\n }\n },\n };\n};\n","import {\n IFrameConsumerChannel,\n WorkerConsumerChannel,\n} from '@wix/editor-platform-transport';\nimport { PlatformFrameAPI } from '@wix/editor-application/platform-frame-api';\nimport { PlatformWorkerAPI } from '@wix/editor-application/platform-worker-api';\n\ndeclare global {\n // eslint-disable-next-line no-var\n var _EP_TRANSPORT_INIT_KEY: boolean;\n}\n\nconst INIT_KEY = '_EP_TRANSPORT_INIT_KEY';\n\n/**\n * small workaround to run init only for a one time\n */\nif (!globalThis[INIT_KEY]) {\n const isWorker = typeof importScripts === 'function';\n\n /**\n * TODO: probably we can try to split this code somehow\n * and load the only API according to the current env.\n */\n if (isWorker) {\n const channel = new WorkerConsumerChannel();\n channel.expose(new PlatformWorkerAPI());\n } else {\n const channel = new IFrameConsumerChannel();\n channel.expose(new PlatformFrameAPI());\n }\n\n globalThis[INIT_KEY] = true;\n}\n","import './env';\n\nimport { createHostModule, HostModule } from '@wix/sdk-runtime/host-modules';\nimport { Host } from '@wix/sdk-types';\nimport {\n ApplicationContext,\n EnvironmentContext,\n IAddonContext,\n IEditorApplicationContext,\n} from '@wix/editor-application-context';\n\ninterface IHostContexts {\n environmentContext: EnvironmentContext;\n applicationContext: ApplicationContext<\n IEditorApplicationContext | IAddonContext\n >;\n}\n\ntype UnwrapShape<T> = {\n [K in keyof T]: T[K] extends (contexts: IHostContexts) => infer R ? R : never;\n};\n\nexport class PlatformSDKShape<\n TShape extends Record<\n string,\n (contexts: IHostContexts) => (...args: any[]) => any\n >,\n> {\n constructor(\n public namespace: string,\n private shape: TShape,\n ) {\n // Object.assign(this.shape, {\n // [Symbol(`platform-sdk-shape-namespace`)]: this.namespace,\n // });\n }\n\n build() {\n return createHostModule<Host, TShape>(\n Object.fromEntries(\n Object.entries(this.shape).map(([key, value]) => [\n key,\n (host: IHostContexts) => {\n /**\n * this is case when shapes are used as a host modules,\n * meaning without calling the createClient, and use one from the context\n */\n if (host?.environmentContext && host?.applicationContext) {\n return async (...args: any) => {\n const [environmentContext, applicationContext] =\n await Promise.all([\n host.environmentContext,\n host.applicationContext,\n ]);\n\n return value({\n environmentContext,\n applicationContext,\n })(...args);\n };\n }\n\n /**\n * the fallback to platform's contexts\n * if for some reason they are not available at the host.\n * for instance:\n * - `createClient` is not created or created with a wrong configuration\n */\n return async (...args: any) => {\n const [environmentContext, applicationContext] =\n await Promise.all([\n EnvironmentContext.getInstance(),\n ApplicationContext.getInstance(),\n ]);\n\n return value({\n environmentContext,\n applicationContext,\n })(...args);\n };\n },\n ]),\n ) as unknown as { [K in keyof TShape]: () => TShape[K] },\n ) as UnwrapShape<TShape> & HostModule<UnwrapShape<TShape>, Host>;\n }\n}\n","import { PlatformSDKShape } from '../PlatformSDKShape';\n\nconst applicationShape = new PlatformSDKShape('application', {\n getPrivateAPI({ applicationContext }) {\n return async <TApplicationPrivateAPI = any>() => {\n return applicationContext.getPrivateApplicationAPI() as TApplicationPrivateAPI;\n };\n },\n\n getPublicAPI({ applicationContext }) {\n return async <TApplicationPrivateAPI>(appDefinitionId: string) => {\n const privateAPI = applicationContext.getPrivateAPI();\n\n return privateAPI.applicationManager.getPublicApplicationAPI(\n appDefinitionId,\n ) as TApplicationPrivateAPI;\n };\n },\n\n getAppInstance({ applicationContext }) {\n return async () => {\n const privateAPI = applicationContext.getPrivateAPI();\n const bindings = applicationContext.getBindings();\n\n return privateAPI.info.getAppInstance(bindings.appDefinitionId);\n };\n },\n});\n\nexport default applicationShape.build();\n","import { IComponent } from '@wix/editor-application-context';\nimport { PlatformSDKShape } from '../PlatformSDKShape';\n\nconst componentsShape = new PlatformSDKShape('components', {\n getSelectedComponents({ applicationContext }) {\n return async (): Promise<IComponent[]> => {\n const privateAPI = applicationContext.getPrivateAPI();\n const refs = await privateAPI.components.getSelectedComponents();\n\n return Promise.all(\n refs.map((ref: any) => privateAPI.components.getComponent(ref)),\n );\n };\n },\n});\n\nexport default componentsShape.build();\n","import {\n AppEventPayload,\n AllowedEvents,\n} from '@wix/editor-application-context';\nimport { PlatformSDKShape } from '../PlatformSDKShape';\n\nconst eventsShape = new PlatformSDKShape('events', {\n addEventListener({ applicationContext }) {\n return async (\n name: any,\n // TODO: fix types\n cb: (payload: AppEventPayload<AllowedEvents>) => void,\n ) => {\n return applicationContext.getEvents().addEventListener(name, cb);\n };\n },\n});\n\nexport default eventsShape.build();\n","import { PlatformSDKShape } from '../PlatformSDKShape';\n\nconst infoShape = new PlatformSDKShape('info', {\n getViewMode({ applicationContext }) {\n return async () => {\n const privateAPI = applicationContext.getPrivateAPI();\n return privateAPI.info.getViewMode();\n };\n },\n\n getLanguageCode({ applicationContext }) {\n return async () => {\n const privateAPI = applicationContext.getPrivateAPI();\n return privateAPI.info.getLanguageCode();\n };\n },\n});\n\nexport default infoShape.build();\n","import {\n BaseError,\n createErrorBuilder,\n} from '@wix/public-editor-platform-errors';\n\nexport enum WidgetShapeErrorCode {\n UndefinedCompRef = 'UndefinedCompRef',\n}\n\nclass WidgetShapeError extends BaseError<WidgetShapeErrorCode> {\n constructor(message: string, code: WidgetShapeErrorCode) {\n super(message, code, 'Widget Error');\n }\n}\n\nexport const createWidgetShapeError = createErrorBuilder<\n WidgetShapeErrorCode,\n WidgetShapeError\n>(WidgetShapeError);\n","import components from '../components';\nimport { createWidgetShapeError, WidgetShapeErrorCode } from './errors';\nimport { PlatformSDKShape } from '../PlatformSDKShape';\n\nconst getSelectedComponentRef = async () => {\n const selected = await components.getSelectedComponents();\n const compRef = selected[0]?.compRef;\n\n if (!compRef) {\n throw createWidgetShapeError(WidgetShapeErrorCode.UndefinedCompRef);\n }\n\n return compRef;\n};\n\nconst widgetShape = new PlatformSDKShape('widget', {\n getProp({ applicationContext }) {\n return async (propName: string): Promise<string> => {\n const privateAPI = applicationContext.getPrivateAPI();\n const compRef = await getSelectedComponentRef();\n\n return privateAPI.customElement.getAttribute(compRef, propName);\n };\n },\n setProp({ applicationContext }) {\n return async (propName: string, value: string): Promise<void> => {\n const privateAPI = applicationContext.getPrivateAPI();\n const compRef = await getSelectedComponentRef();\n\n await privateAPI.customElement.setAttribute(compRef, propName, value);\n };\n },\n});\n\nexport default widgetShape.build();\n","import { PlatformSDKShape } from '../PlatformSDKShape';\n\ninterface IColorValue {\n color: string;\n theme?: string;\n}\n\ninterface IFontValue {\n family?: string;\n style?: {\n bold?: boolean;\n italic?: boolean;\n underline?: boolean;\n };\n size?: number;\n theme?: string;\n}\n\ntype IFontValueInternal = IFontValue & {\n editorKey?: string;\n preset?: string;\n};\n\nconst fonts = {\n transformFontInternalValue: (value?: IFontValue): IFontValueInternal => {\n if (value) {\n const { theme, ...rest } = fonts.normalize(value);\n\n return {\n ...rest,\n editorKey: theme,\n };\n } else {\n return {\n editorKey: 'font_7',\n family: 'helvetica-w01-roman',\n size: 16,\n style: {},\n };\n }\n },\n\n transformFontPublicValue: (\n value?: IFontValue & IFontValueInternal,\n ): IFontValue | null => {\n if (!value) {\n return null;\n }\n\n return {\n ...fonts.normalize(value),\n theme: value.editorKey,\n };\n },\n\n normalize: ({\n theme,\n editorKey,\n preset,\n ...rest\n }: IFontValueInternal): IFontValue => {\n return {\n ...rest,\n theme: theme ?? editorKey,\n };\n },\n};\n\nconst inputsShape = new PlatformSDKShape('inputs', {\n selectColor({ applicationContext }) {\n return async (\n value?: Partial<IColorValue>,\n onColorChange?: (value: IColorValue) => void,\n ): Promise<IColorValue | null> => {\n const privateAPI = applicationContext.getPrivateAPI() as any;\n\n let _value: IColorValue | null = value\n ? ({\n color: value.color,\n theme: value?.theme,\n } as IColorValue)\n : null;\n\n await privateAPI.inputs.openColorPicker(\n {\n color: value?.theme ? value.theme : value?.color,\n },\n ({\n color,\n theme,\n }: {\n color: string;\n theme: string;\n isHover: boolean;\n }) => {\n const _color = { color, theme };\n\n _value = _color;\n onColorChange?.(_color);\n },\n );\n\n return _value;\n };\n },\n\n selectFont({ applicationContext }) {\n return async (\n value?: IFontValue,\n options?: {\n title?: string;\n panelSectionsDefinition?: Partial<{\n theme: 'hidden' | 'enabled';\n font: 'hidden' | 'enabled';\n size: 'hidden' | 'enabled';\n style: 'hidden' | 'enabled';\n htmlTag: 'hidden' | 'enabled';\n }>;\n fontMaxSize?: number;\n fontMinSize?: number;\n },\n onFontChange?: (value: IFontValue) => void,\n ): Promise<IFontValue | null> => {\n const privateAPI = applicationContext.getPrivateAPI() as any;\n\n let _value = fonts.transformFontPublicValue(value) as IFontValue;\n\n const applyChanges = (...changes: (string | number)[]) => {\n if (!_value) {\n _value = fonts.transformFontPublicValue(\n fonts.transformFontInternalValue(value),\n ) as IFontValue;\n }\n\n switch (changes[0]) {\n case 'theme':\n Object.assign(_value, {\n theme: changes[1],\n });\n\n break;\n\n case 'size':\n Object.assign(_value, {\n size: changes[1],\n });\n\n break;\n\n case 'bold':\n Object.assign(_value, {\n style: {\n ..._value.style,\n bold: changes[1],\n },\n });\n\n break;\n\n case 'italic':\n Object.assign(_value, {\n style: {\n ..._value.style,\n italic: changes[1],\n },\n });\n\n break;\n\n case 'underline':\n Object.assign(_value, {\n style: {\n ..._value.style,\n underline: changes[1],\n },\n });\n\n break;\n\n case 'family':\n Object.assign(_value, {\n family: changes[1],\n });\n\n break;\n }\n };\n\n await privateAPI.inputs.openFontPicker(\n {\n ...options,\n componentStyle: fonts.transformFontInternalValue(value),\n },\n (...changes: (string | number)[]) => {\n applyChanges(...changes);\n onFontChange?.(_value!);\n },\n );\n\n return _value;\n };\n },\n});\n\nexport default inputsShape.build();\n","import type { WixSDKTypes } from '@wix/public-editor-platform-interfaces';\nimport {\n ApplicationContext,\n EnvironmentContext,\n} from '@wix/editor-application-context';\n\nexport const editorPlatformFrameHost = (): WixSDKTypes.Host & {\n environmentContext: Promise<EnvironmentContext>;\n applicationContext: Promise<ApplicationContext<any>>;\n essentials: {\n language?: string;\n locale?: string;\n };\n} => {\n const queryParams = new URLSearchParams(window.location.search);\n\n return {\n environment: {},\n channel: {\n observeState: async () => {\n return { disconnect() {} };\n },\n },\n environmentContext: EnvironmentContext.getInstance(),\n applicationContext: ApplicationContext.getInstance(),\n essentials: queryParams.has('essentials')\n ? JSON.parse(queryParams.get('essentials')!)\n : {},\n };\n};\n","import type { WixSDKTypes } from '@wix/public-editor-platform-interfaces';\nimport {\n ApplicationContext,\n EnvironmentContext,\n} from '@wix/editor-application-context';\n\nexport const editorPlatformWorkerHost = (): WixSDKTypes.Host & {\n environmentContext: Promise<EnvironmentContext>;\n applicationContext: Promise<ApplicationContext<any>>;\n} => {\n return {\n environment: {},\n channel: {\n observeState: async () => {\n return { disconnect() {} };\n },\n },\n environmentContext: EnvironmentContext.getInstance(),\n applicationContext: ApplicationContext.getInstance(),\n };\n};\n","import { auth } from './auth';\n\nexport { default as application } from './application';\nexport { default as components } from './components';\nexport { default as events } from './events';\nexport { default as info } from './info';\nexport { default as widget } from './widget';\nexport { default as inputs } from './inputs';\n\nimport { editorPlatformFrameHost } from './editorPlatformFrameHost';\nimport { editorPlatformWorkerHost } from './editorPlatformWorkerHost';\n\nexport const editor = {\n host: () => {\n const isWorker = typeof importScripts === 'function';\n\n if (isWorker) {\n return editorPlatformWorkerHost();\n }\n\n return editorPlatformFrameHost();\n },\n auth,\n};\n"],"names":["BaseError","createErrorBuilder","PlatformAppEvent","WorkerConsumerChannel","PlatformWorkerAPI","IFrameConsumerChannel","PlatformFrameAPI","createHostModule","WidgetShapeErrorCode"],"mappings":";;;;;;EAGA,IAAI,yCAAA,qBAA8D,0CAA+C,KAAA;EAC/G,EAAA,0CAAA,CAA2C,sBAAsB,CAAI,GAAA,sBAAA,CAAA;EACrE,EAAA,0CAAA,CAA2C,iBAAiB,CAAI,GAAA,iBAAA,CAAA;EAChE,EAAO,OAAA,0CAAA,CAAA;EACT,CAAG,EAAA,yCAAA,IAA6C,EAAE,CAAA,CAAA;EAClD,MAAM,8CAA8CA,oCAAU,CAAA;EAAA,EAC5D,QAAQ,EAAC,CAAA;EAAA,EACT,WAAA,CAAY,SAAS,IAAM,EAAA;EACzB,IAAM,KAAA,CAAA,OAAA,EAAS,MAAM,2CAA2C,CAAA,CAAA;EAAA,GAClE;EAAA,EACA,QAAQ,GAAK,EAAA;EACX,IAAA,IAAA,CAAK,KAAQ,GAAA,EAAE,GAAG,IAAA,CAAK,OAAO,GAAI,EAAA,CAAA;EAClC,IAAO,OAAA,IAAA,CAAA;EAAA,GACT;EAAA,EACA,oBAAoB,eAAiB,EAAA;EACnC,IAAA,IAAA,CAAK,KAAQ,GAAA,EAAE,GAAG,IAAA,CAAK,OAAO,eAAgB,EAAA,CAAA;EAC9C,IAAO,OAAA,IAAA,CAAA;EAAA,GACT;EACF,CAAA;EACA,MAAM,2CAAA,GAA8CC,8CAAmB,qCAAqC,CAAA,CAAA;EAE5G,eAAe,qBAAA,CAAsB,cAAc,UAAY,EAAA;EAC7D,EAAI,IAAA,CAAC,cAAc,IAAM,EAAA;EACvB,IAAO,OAAA,YAAA,CAAA;EAAA,GACT;EACA,EAAA,QAAQ,aAAa,IAAM;EAAA,IACzB,KAAK,2BAAA;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AAA,OAAO,uBAAwB,EAAA,CAAA;EAAA,GACjC;EAAA,EACA,IAAA;EACF;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../editor-platform-application-context/dist/esm/index.js","../../src/auth.ts","../../src/env.ts","../../src/PlatformSDKShape.ts","../../src/application/index.ts","../../src/components/index.ts","../../src/events/index.ts","../../src/info/index.ts","../../src/widget/errors.ts","../../src/widget/index.ts","../../src/inputs/index.ts","../../src/editorPlatformFrameHost.ts","../../src/editorPlatformWorkerHost.ts","../../src/index.ts"],"sourcesContent":["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 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\nexport { APPLICATION_CONTEXT_KEY, ApplicationBoundEvents, ApplicationContext, ENVIRONMENT_CONTEXT_KEY, EnvironmentContext, PlatformEnvironment };\n//# sourceMappingURL=index.js.map\n","import { ApplicationContext } from '@wix/editor-application-context';\nimport {\n BaseError,\n createErrorBuilder,\n} from '@wix/public-editor-platform-errors';\nimport { AccessToken } from '@wix/public-editor-platform-interfaces';\n\nexport enum EditorPlatformSDKAuthErrorCode {\n EmptyAppAuthInstance = 'EmptyAppAuthInstance',\n EmptyAppDefinitionId = 'EmptyAppDefinitionId',\n}\n\nclass EditorPlatformSDKAuthError extends BaseError<EditorPlatformSDKAuthErrorCode> {\n state: Partial<{\n appDefinitionId: string;\n }> = {};\n\n constructor(message: string, code: EditorPlatformSDKAuthErrorCode) {\n super(message, code, 'Auth Strategy Error');\n }\n\n withAppDefinitionId(appDefinitionId: string) {\n this.state = { ...this.state, appDefinitionId };\n return this;\n }\n}\n\nexport const createEditorPlatformSDKAuthError = createErrorBuilder<\n EditorPlatformSDKAuthErrorCode,\n EditorPlatformSDKAuthError\n>(EditorPlatformSDKAuthError);\n\nfunction hasEnoughTimeUntilExpiry(\n expires: Date | undefined,\n expiryBuffer: number,\n) {\n const now = Date.now();\n const expiryTime = expires ? new Date(expires).getTime() : null;\n return expiryTime && expiryTime - now > expiryBuffer;\n}\n\nconst ACCESS_TOKEN_EXPIRY_GRACE_PERIOD = 30 * 60 * 1000; // half an hour\n\nexport const auth = () => {\n let instance: AccessToken;\n\n return {\n getAuthHeaders: async () => {\n const context = await ApplicationContext.getInstance();\n const bindings = context.getBindings();\n const privateAPI = context.getPrivateAPI();\n\n if (!bindings.appDefinitionId) {\n throw createEditorPlatformSDKAuthError(\n EditorPlatformSDKAuthErrorCode.EmptyAppDefinitionId,\n );\n }\n\n if (\n !instance ||\n hasEnoughTimeUntilExpiry(\n instance.expires,\n ACCESS_TOKEN_EXPIRY_GRACE_PERIOD,\n )\n ) {\n instance = await privateAPI.auth.getAccessToken(\n bindings.appDefinitionId,\n await privateAPI.info.getMetaSiteId(),\n );\n }\n\n if (!instance?.token) {\n console.error(\n createEditorPlatformSDKAuthError(\n EditorPlatformSDKAuthErrorCode.EmptyAppAuthInstance,\n ).withAppDefinitionId(bindings.appDefinitionId),\n );\n\n return {\n headers: {\n Authorization: '',\n },\n };\n }\n\n return {\n headers: {\n Authorization: instance.token,\n },\n };\n },\n };\n};\n","import {\n IFrameConsumerChannel,\n WorkerConsumerChannel,\n} from '@wix/editor-platform-transport';\nimport { PlatformFrameAPI } from '@wix/editor-application/platform-frame-api';\nimport { PlatformWorkerAPI } from '@wix/editor-application/platform-worker-api';\n\ndeclare global {\n // eslint-disable-next-line no-var\n var _EP_TRANSPORT_INIT_KEY: boolean;\n}\n\nconst INIT_KEY = '_EP_TRANSPORT_INIT_KEY';\n\n/**\n * small workaround to run init only for a one time\n */\nif (!globalThis[INIT_KEY]) {\n const isWorker = typeof importScripts === 'function';\n\n /**\n * TODO: probably we can try to split this code somehow\n * and load the only API according to the current env.\n */\n if (isWorker) {\n const channel = new WorkerConsumerChannel();\n channel.expose(new PlatformWorkerAPI());\n } else {\n const channel = new IFrameConsumerChannel();\n channel.expose(new PlatformFrameAPI());\n }\n\n globalThis[INIT_KEY] = true;\n}\n","import './env';\n\nimport { createHostModule, HostModule } from '@wix/sdk-runtime/host-modules';\nimport { Host } from '@wix/sdk-types';\nimport {\n ApplicationContext,\n EnvironmentContext,\n IAddonContext,\n IEditorApplicationContext,\n} from '@wix/editor-application-context';\n\ninterface IHostContexts {\n environmentContext: EnvironmentContext;\n applicationContext: ApplicationContext<\n IEditorApplicationContext | IAddonContext\n >;\n}\n\ntype UnwrapShape<T> = {\n [K in keyof T]: T[K] extends (contexts: IHostContexts) => infer R ? R : never;\n};\n\nexport class PlatformSDKShape<\n TShape extends Record<\n string,\n (contexts: IHostContexts) => (...args: any[]) => any\n >,\n> {\n constructor(\n public namespace: string,\n private shape: TShape,\n ) {\n // Object.assign(this.shape, {\n // [Symbol(`platform-sdk-shape-namespace`)]: this.namespace,\n // });\n }\n\n build() {\n return createHostModule<Host, TShape>(\n Object.fromEntries(\n Object.entries(this.shape).map(([key, value]) => [\n key,\n (host: IHostContexts) => {\n /**\n * this is case when shapes are used as a host modules,\n * meaning without calling the createClient, and use one from the context\n */\n if (host?.environmentContext && host?.applicationContext) {\n return async (...args: any) => {\n const [environmentContext, applicationContext] =\n await Promise.all([\n host.environmentContext,\n host.applicationContext,\n ]);\n\n return value({\n environmentContext,\n applicationContext,\n })(...args);\n };\n }\n\n /**\n * the fallback to platform's contexts\n * if for some reason they are not available at the host.\n * for instance:\n * - `createClient` is not created or created with a wrong configuration\n */\n return async (...args: any) => {\n const [environmentContext, applicationContext] =\n await Promise.all([\n EnvironmentContext.getInstance(),\n ApplicationContext.getInstance(),\n ]);\n\n return value({\n environmentContext,\n applicationContext,\n })(...args);\n };\n },\n ]),\n ) as unknown as { [K in keyof TShape]: () => TShape[K] },\n ) as UnwrapShape<TShape> & HostModule<UnwrapShape<TShape>, Host>;\n }\n}\n","import { PlatformSDKShape } from '../PlatformSDKShape';\n\nconst applicationShape = new PlatformSDKShape('application', {\n getPrivateAPI({ applicationContext }) {\n return async <TApplicationPrivateAPI = any>() => {\n return applicationContext.getPrivateApplicationAPI() as TApplicationPrivateAPI;\n };\n },\n\n getPublicAPI({ applicationContext }) {\n return async <TApplicationPrivateAPI>(appDefinitionId: string) => {\n const privateAPI = applicationContext.getPrivateAPI();\n\n return privateAPI.applicationManager.getPublicApplicationAPI(\n appDefinitionId,\n ) as TApplicationPrivateAPI;\n };\n },\n\n getAppInstance({ applicationContext }) {\n return async () => {\n const privateAPI = applicationContext.getPrivateAPI();\n const bindings = applicationContext.getBindings();\n\n return privateAPI.info.getAppInstance(bindings.appDefinitionId);\n };\n },\n});\n\nexport default applicationShape.build();\n","import { IComponent } from '@wix/editor-application-context';\nimport { PlatformSDKShape } from '../PlatformSDKShape';\n\nconst componentsShape = new PlatformSDKShape('components', {\n getSelectedComponents({ applicationContext }) {\n return async (): Promise<IComponent[]> => {\n const privateAPI = applicationContext.getPrivateAPI();\n const refs = await privateAPI.components.getSelectedComponents();\n\n return Promise.all(\n refs.map((ref: any) => privateAPI.components.getComponent(ref)),\n );\n };\n },\n});\n\nexport default componentsShape.build();\n","import {\n AppEventPayload,\n AllowedEvents,\n} from '@wix/editor-application-context';\nimport { PlatformSDKShape } from '../PlatformSDKShape';\n\nconst eventsShape = new PlatformSDKShape('events', {\n addEventListener({ applicationContext }) {\n return async (\n name: any,\n // TODO: fix types\n cb: (payload: AppEventPayload<AllowedEvents>) => void,\n ) => {\n return applicationContext.getEvents().addEventListener(name, cb);\n };\n },\n});\n\nexport default eventsShape.build();\n","import { PlatformSDKShape } from '../PlatformSDKShape';\n\nconst infoShape = new PlatformSDKShape('info', {\n getViewMode({ applicationContext }) {\n return async () => {\n const privateAPI = applicationContext.getPrivateAPI();\n return privateAPI.info.getViewMode();\n };\n },\n\n getLanguageCode({ applicationContext }) {\n return async () => {\n const privateAPI = applicationContext.getPrivateAPI();\n return privateAPI.info.getLanguageCode();\n };\n },\n});\n\nexport default infoShape.build();\n","import {\n BaseError,\n createErrorBuilder,\n} from '@wix/public-editor-platform-errors';\n\nexport enum WidgetShapeErrorCode {\n UndefinedCompRef = 'UndefinedCompRef',\n}\n\nclass WidgetShapeError extends BaseError<WidgetShapeErrorCode> {\n constructor(message: string, code: WidgetShapeErrorCode) {\n super(message, code, 'Widget Error');\n }\n}\n\nexport const createWidgetShapeError = createErrorBuilder<\n WidgetShapeErrorCode,\n WidgetShapeError\n>(WidgetShapeError);\n","import components from '../components';\nimport { createWidgetShapeError, WidgetShapeErrorCode } from './errors';\nimport { PlatformSDKShape } from '../PlatformSDKShape';\n\nconst getSelectedComponentRef = async () => {\n const selected = await components.getSelectedComponents();\n const compRef = selected[0]?.compRef;\n\n if (!compRef) {\n throw createWidgetShapeError(WidgetShapeErrorCode.UndefinedCompRef);\n }\n\n return compRef;\n};\n\nconst widgetShape = new PlatformSDKShape('widget', {\n getProp({ applicationContext }) {\n return async (propName: string): Promise<string> => {\n const privateAPI = applicationContext.getPrivateAPI();\n const compRef = await getSelectedComponentRef();\n\n return privateAPI.customElement.getAttribute(compRef, propName);\n };\n },\n setProp({ applicationContext }) {\n return async (propName: string, value: string): Promise<void> => {\n const privateAPI = applicationContext.getPrivateAPI();\n const compRef = await getSelectedComponentRef();\n\n await privateAPI.customElement.setAttribute(compRef, propName, value);\n };\n },\n});\n\nexport default widgetShape.build();\n","import { PlatformSDKShape } from '../PlatformSDKShape';\nimport { FontPickerOptions } from '@wix/editor-platform-sdk-types';\n\ninterface IColorValue {\n color: string;\n theme?: string;\n cssVariableName?: string;\n}\n\ninterface IFontValue {\n theme?: string;\n family?: string;\n size?: number;\n bold?: boolean;\n italic?: boolean;\n underline?: boolean;\n cssVariableName?: string;\n}\n\ninterface FontPickerValue {\n font: string;\n textDecoration?: string;\n}\n\ntype ColorPickerValue = string | null | undefined;\n\nconst UNDERLINE_DEFINITION = 'underline';\n\nfunction extractFontVar(fontString: string) {\n const trimmedFont = fontString.trim();\n const match = trimmedFont.match(/var\\((--[\\w-]+),\\s*(.+)\\)/);\n\n if (match) {\n return {\n variableName: match[1],\n fallbackValue: match[2]?.trim() ?? '',\n };\n } else {\n return {\n variableName: undefined,\n fallbackValue: trimmedFont,\n };\n }\n}\n\nfunction parseFontString(fontPickerValue?: FontPickerValue) {\n const font: IFontValue = {\n family: undefined,\n size: undefined,\n };\n\n if (fontPickerValue?.font) {\n const { variableName, fallbackValue } = extractFontVar(\n fontPickerValue.font,\n );\n font.cssVariableName = variableName;\n const parts = fallbackValue.match(/(?:([\"']).*?\\1|\\S)+/g) || [];\n\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n\n switch (part) {\n case 'bold':\n font.bold = true;\n break;\n case 'italic':\n font.italic = true;\n break;\n default:\n if (part?.endsWith('px')) {\n font.size = parseInt(part, 10);\n } else if (i === parts.length - 1) {\n font.family = part;\n } else {\n font.family = (font.family || '') + ' ' + part;\n }\n }\n }\n }\n if (fontPickerValue?.textDecoration) {\n font.underline = fontPickerValue.textDecoration === UNDERLINE_DEFINITION;\n }\n // since we wrap it with \"\" in the font string, we need to remove it\n font.family = font.family?.trim().replace(/['\"]+/g, '');\n\n return font;\n}\n\nfunction fontValueToCSS(fontValue: IFontValue): string {\n return `${\n fontValue.cssVariableName ? `var(${fontValue.cssVariableName}, ` : ''\n }${fontValue.italic ? 'italic ' : ''}${fontValue.bold ? 'bold ' : ''}${fontValue.size || 16}px ${\n // wrap each font family with quotes\n fontValue.family\n ?.split(',')\n .map((fontFamily) => `\"${fontFamily.replace(/['\"]+/g, '')}\"`)\n .join(',') || 'serif'\n }${fontValue.cssVariableName ? ')' : ''}`;\n}\n\nfunction parseColorString(\n colorPickerValue?: ColorPickerValue,\n): IColorValue | null {\n if (!colorPickerValue) {\n return null;\n }\n const colorString = colorPickerValue!;\n const match = colorString.match(/var\\((--[\\w-]+),\\s*(.+)\\)/);\n\n if (match) {\n return {\n cssVariableName: match[1],\n color: match[2]!,\n };\n } else {\n return {\n color: colorString,\n };\n }\n}\n\nfunction colorValueToCSS(colorValue?: IColorValue | null): string {\n if (!colorValue) {\n return '';\n }\n return colorValue.cssVariableName\n ? `var(${colorValue.cssVariableName}, ${colorValue.color})`\n : colorValue.color;\n}\n\ntype IFontValueInternal = {\n preset?: string;\n editorKey?: string;\n family?: string;\n size?: number;\n style: {\n bold?: boolean;\n italic?: boolean;\n underline?: boolean;\n };\n htmlTag?: string;\n};\n\nconst fonts = {\n transformFontInternalValue: (value?: IFontValue): IFontValueInternal => {\n if (value) {\n const { theme, cssVariableName, bold, italic, underline, ...rest } =\n value;\n\n return {\n ...rest,\n style: {\n bold,\n italic,\n underline,\n },\n editorKey: cssVariableName || theme || '',\n };\n } else {\n return {\n editorKey: 'font_7',\n family: 'helvetica-w01-roman',\n size: 16,\n style: {},\n };\n }\n },\n};\n\nconst inputsShape = new PlatformSDKShape('inputs', {\n selectColor({ applicationContext }) {\n return async (\n value?: ColorPickerValue,\n options?: {\n onChange?: (value: ColorPickerValue) => void;\n },\n ): Promise<ColorPickerValue> => {\n const privateAPI = applicationContext.getPrivateAPI() as any;\n\n let colorValue: IColorValue | null = parseColorString(value);\n let colorResult = colorValueToCSS(colorValue);\n\n await privateAPI.inputs.openColorPicker(\n {\n color:\n colorValue?.cssVariableName ||\n colorValue?.theme ||\n colorValue?.color,\n },\n ({\n color,\n theme,\n cssVariableTheme,\n }: {\n color: string;\n theme: string;\n cssVariableTheme: string;\n isHover: boolean;\n }) => {\n colorValue = {\n color,\n theme,\n cssVariableName: cssVariableTheme,\n };\n colorResult = colorValueToCSS(colorValue);\n options?.onChange?.(colorResult);\n },\n );\n\n return colorResult;\n };\n },\n\n selectFont({ applicationContext }) {\n return async (\n value?: FontPickerValue,\n options?: {\n title?: string;\n panelSectionsDefinition?: Omit<\n FontPickerOptions['panelSectionsDefinition'],\n 'htmlTag'\n >;\n fontMaxSize?: number;\n fontMinSize?: number;\n onChange?: (value: FontPickerValue) => void;\n },\n ): Promise<FontPickerValue | undefined> => {\n const privateAPI = applicationContext.getPrivateAPI() as any;\n const fontValue = parseFontString(value);\n let _value = value;\n\n await privateAPI.inputs.openFontPickerV2(\n {\n ...options,\n panelSectionsDefinition: {\n ...options?.panelSectionsDefinition,\n htmlTag: 'hidden',\n },\n componentStyle: fonts.transformFontInternalValue(fontValue),\n },\n (font: IFontValue, accessibility: any) => {\n _value = {\n font: fontValueToCSS(font),\n textDecoration: font.underline ? UNDERLINE_DEFINITION : undefined,\n };\n options?.onChange?.(_value);\n },\n );\n\n return _value;\n };\n },\n});\n\nexport default inputsShape.build();\n","import type { WixSDKTypes } from '@wix/public-editor-platform-interfaces';\nimport {\n ApplicationContext,\n EnvironmentContext,\n} from '@wix/editor-application-context';\n\nexport const editorPlatformFrameHost = (): WixSDKTypes.Host & {\n environmentContext: Promise<EnvironmentContext>;\n applicationContext: Promise<ApplicationContext<any>>;\n essentials: {\n language?: string;\n locale?: string;\n };\n} => {\n const queryParams = new URLSearchParams(window.location.search);\n\n return {\n environment: {},\n channel: {\n observeState: async () => {\n return { disconnect() {} };\n },\n },\n environmentContext: EnvironmentContext.getInstance(),\n applicationContext: ApplicationContext.getInstance(),\n essentials: queryParams.has('essentials')\n ? JSON.parse(queryParams.get('essentials')!)\n : {},\n };\n};\n","import type { WixSDKTypes } from '@wix/public-editor-platform-interfaces';\nimport {\n ApplicationContext,\n EnvironmentContext,\n} from '@wix/editor-application-context';\n\nexport const editorPlatformWorkerHost = (): WixSDKTypes.Host & {\n environmentContext: Promise<EnvironmentContext>;\n applicationContext: Promise<ApplicationContext<any>>;\n} => {\n return {\n environment: {},\n channel: {\n observeState: async () => {\n return { disconnect() {} };\n },\n },\n environmentContext: EnvironmentContext.getInstance(),\n applicationContext: ApplicationContext.getInstance(),\n };\n};\n","import { auth } from './auth';\n\nexport { default as application } from './application';\nexport { default as components } from './components';\nexport { default as events } from './events';\nexport { default as info } from './info';\nexport { default as widget } from './widget';\nexport { default as inputs } from './inputs';\n\nimport { editorPlatformFrameHost } from './editorPlatformFrameHost';\nimport { editorPlatformWorkerHost } from './editorPlatformWorkerHost';\n\nexport const editor = {\n host: () => {\n const isWorker = typeof importScripts === 'function';\n\n if (isWorker) {\n return editorPlatformWorkerHost();\n }\n\n return editorPlatformFrameHost();\n },\n auth,\n};\n"],"names":["BaseError","createErrorBuilder","PlatformAppEvent","WorkerConsumerChannel","PlatformWorkerAPI","IFrameConsumerChannel","PlatformFrameAPI","createHostModule","WidgetShapeErrorCode"],"mappings":";;;;;;EAGA,IAAI,yCAAA,qBAA8D,0CAA+C,KAAA;EAC/G,EAAA,0CAAA,CAA2C,sBAAsB,CAAI,GAAA,sBAAA,CAAA;EACrE,EAAA,0CAAA,CAA2C,iBAAiB,CAAI,GAAA,iBAAA,CAAA;EAChE,EAAO,OAAA,0CAAA,CAAA;EACT,CAAG,EAAA,yCAAA,IAA6C,EAAE,CAAA,CAAA;EAClD,MAAM,8CAA8CA,oCAAU,CAAA;EAAA,EAC5D,QAAQ,EAAC,CAAA;EAAA,EACT,WAAA,CAAY,SAAS,IAAM,EAAA;EACzB,IAAM,KAAA,CAAA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AAA,EAAoB,mBAAmB,WAAY,EAAA;EAAA,IACnD,kBAAA,EAAoB,mBAAmB,WAAY,EAAA;EAAA,IACnD,UAAY,EAAA,WAAA,CAAY,GAAI,CAAA,YAAY,CACpC,GAAA,IAAA,CAAK,KAAM,CAAA,WAAA,CAAY,GAAI,CAAA,YAAY,CAAE,CAAA,GACzC,EAAC;EAAA,GACP,CAAA;EACF,CAAA;;ECvBO,MAAM,2BAA2B,MAGnC;EACH,EAAO,OAAA;EAAA,IACL,aAAa,EAAC;EAAA,IACd,OAAS,EAAA;EAAA,MACP,cAAc,YAAY;EACxB,QAAA,OAAO,EAAE,UAAa,GAAA;EAAA,SAAG,EAAA,CAAA;EAAA,OAC3B;EAAA,KACF;EAAA,IACA,kBAAA,EAAoB,mBAAmB,WAAY,EAAA;EAAA,IACnD,kBAAA,EAAoB,mBAAmB,WAAY,EAAA;EAAA,GACrD,CAAA;EACF,CAAA;;ACRO,QAAM,MAAS,GAAA;EAAA,EACpB,MAAM,MAAM;EACV,IAAM,MAAA,QAAA,GAAW,OAAO,aAAkB,KAAA,UAAA,CAAA;EAE1C,IAAA,IAAI,QAAU,EAAA;EACZ,MAAA,OAAO,wBAAyB,EAAA,CAAA;EAAA,KAClC;EAEA,IAAA,OAAO,uBAAwB,EAAA,CAAA;EAAA,GACjC;EAAA,EACA,IAAA;EACF;;;;;;;;;;;;;;"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { WithPromiseFunctions } from '@wix/editor-platform-transport';
|
|
|
3
3
|
import { PlatformAppEventEmitter, IPlatformAppEvent } from '@wix/public-editor-platform-events';
|
|
4
4
|
import { ComponentRef } from '@wix/public-editor-platform-interfaces';
|
|
5
5
|
import * as _wix_sdk_types from '@wix/sdk-types';
|
|
6
|
+
import { FontPickerOptions } from '@wix/editor-platform-sdk-types';
|
|
6
7
|
|
|
7
8
|
type PrivateAPIFixMe = any;
|
|
8
9
|
interface Component<TComponentType extends string> {
|
|
@@ -116,7 +117,8 @@ declare class ApplicationContext<TContext extends IApplicationContext> {
|
|
|
116
117
|
getEvents(): ApplicationBoundEvents;
|
|
117
118
|
getPrivateAPI(): _wix_editor_platform_transport.WithPromiseFunctions<any>;
|
|
118
119
|
getPrivateApplicationAPI(): any;
|
|
119
|
-
}
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=index.d.ts.map
|
|
120
122
|
|
|
121
123
|
declare const _default$5: {
|
|
122
124
|
getPrivateAPI: () => Promise<any>;
|
|
@@ -156,48 +158,33 @@ declare const _default$1: {
|
|
|
156
158
|
setProp: (propName: string, value: string) => Promise<void>;
|
|
157
159
|
}, _wix_sdk_types.Host>;
|
|
158
160
|
|
|
159
|
-
interface
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
interface IFontValue {
|
|
164
|
-
family?: string;
|
|
165
|
-
style?: {
|
|
166
|
-
bold?: boolean;
|
|
167
|
-
italic?: boolean;
|
|
168
|
-
underline?: boolean;
|
|
169
|
-
};
|
|
170
|
-
size?: number;
|
|
171
|
-
theme?: string;
|
|
161
|
+
interface FontPickerValue {
|
|
162
|
+
font: string;
|
|
163
|
+
textDecoration?: string;
|
|
172
164
|
}
|
|
165
|
+
type ColorPickerValue = string | null | undefined;
|
|
173
166
|
declare const _default: {
|
|
174
|
-
selectColor: (value?:
|
|
175
|
-
|
|
167
|
+
selectColor: (value?: ColorPickerValue, options?: {
|
|
168
|
+
onChange?: (value: ColorPickerValue) => void;
|
|
169
|
+
}) => Promise<ColorPickerValue>;
|
|
170
|
+
selectFont: (value?: FontPickerValue, options?: {
|
|
176
171
|
title?: string;
|
|
177
|
-
panelSectionsDefinition?:
|
|
178
|
-
theme: "hidden" | "enabled";
|
|
179
|
-
font: "hidden" | "enabled";
|
|
180
|
-
size: "hidden" | "enabled";
|
|
181
|
-
style: "hidden" | "enabled";
|
|
182
|
-
htmlTag: "hidden" | "enabled";
|
|
183
|
-
}>;
|
|
172
|
+
panelSectionsDefinition?: Omit<FontPickerOptions["panelSectionsDefinition"], "htmlTag">;
|
|
184
173
|
fontMaxSize?: number;
|
|
185
174
|
fontMinSize?: number;
|
|
186
|
-
|
|
175
|
+
onChange?: (value: FontPickerValue) => void;
|
|
176
|
+
}) => Promise<FontPickerValue | undefined>;
|
|
187
177
|
} & _wix_sdk_types.HostModule<{
|
|
188
|
-
selectColor: (value?:
|
|
189
|
-
|
|
178
|
+
selectColor: (value?: ColorPickerValue, options?: {
|
|
179
|
+
onChange?: (value: ColorPickerValue) => void;
|
|
180
|
+
}) => Promise<ColorPickerValue>;
|
|
181
|
+
selectFont: (value?: FontPickerValue, options?: {
|
|
190
182
|
title?: string;
|
|
191
|
-
panelSectionsDefinition?:
|
|
192
|
-
theme: "hidden" | "enabled";
|
|
193
|
-
font: "hidden" | "enabled";
|
|
194
|
-
size: "hidden" | "enabled";
|
|
195
|
-
style: "hidden" | "enabled";
|
|
196
|
-
htmlTag: "hidden" | "enabled";
|
|
197
|
-
}>;
|
|
183
|
+
panelSectionsDefinition?: Omit<FontPickerOptions["panelSectionsDefinition"], "htmlTag">;
|
|
198
184
|
fontMaxSize?: number;
|
|
199
185
|
fontMinSize?: number;
|
|
200
|
-
|
|
186
|
+
onChange?: (value: FontPickerValue) => void;
|
|
187
|
+
}) => Promise<FontPickerValue | undefined>;
|
|
201
188
|
}, _wix_sdk_types.Host>;
|
|
202
189
|
|
|
203
190
|
declare const editor: {
|
|
@@ -208,7 +195,7 @@ declare const editor: {
|
|
|
208
195
|
auth: () => {
|
|
209
196
|
getAuthHeaders: () => Promise<{
|
|
210
197
|
headers: {
|
|
211
|
-
Authorization:
|
|
198
|
+
Authorization: string;
|
|
212
199
|
};
|
|
213
200
|
}>;
|
|
214
201
|
};
|