@chili-publish/studio-sdk 1.44.1 → 1.46.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.
Files changed (113) hide show
  1. package/_bundles/main.js +2 -2
  2. package/_bundles/main.js.map +1 -1
  3. package/lib/src/controllers/BrandKitController.cjs.js +13 -64
  4. package/lib/src/controllers/BrandKitController.cjs.js.map +1 -1
  5. package/lib/src/controllers/BrandKitController.d.ts +22 -30
  6. package/lib/src/controllers/BrandKitController.es.js +13 -64
  7. package/lib/src/controllers/BrandKitController.es.js.map +1 -1
  8. package/lib/src/controllers/ComponentController.cjs.js +4 -0
  9. package/lib/src/controllers/ComponentController.cjs.js.map +1 -1
  10. package/lib/src/controllers/ComponentController.d.ts +7 -1
  11. package/lib/src/controllers/ComponentController.es.js +4 -0
  12. package/lib/src/controllers/ComponentController.es.js.map +1 -1
  13. package/lib/src/controllers/ConnectorController.cjs.js.map +1 -1
  14. package/lib/src/controllers/ConnectorController.d.ts +5 -5
  15. package/lib/src/controllers/ConnectorController.es.js.map +1 -1
  16. package/lib/src/controllers/SubscriberController.cjs.js +3 -0
  17. package/lib/src/controllers/SubscriberController.cjs.js.map +1 -1
  18. package/lib/src/controllers/SubscriberController.d.ts +7 -0
  19. package/lib/src/controllers/SubscriberController.es.js +3 -0
  20. package/lib/src/controllers/SubscriberController.es.js.map +1 -1
  21. package/lib/src/exceptions/AsyncExceptions.cjs.js.map +1 -1
  22. package/lib/src/exceptions/AsyncExceptions.d.ts +1 -0
  23. package/lib/src/exceptions/AsyncExceptions.es.js.map +1 -1
  24. package/lib/src/exceptions/Helpers.cjs.js.map +1 -1
  25. package/lib/src/exceptions/Helpers.es.js.map +1 -1
  26. package/lib/src/index.cjs.js +3 -2
  27. package/lib/src/index.cjs.js.map +1 -1
  28. package/lib/src/index.d.ts +2 -1
  29. package/lib/src/index.es.js +2 -1
  30. package/lib/src/interactions/Connector.cjs.js +2 -1
  31. package/lib/src/interactions/Connector.cjs.js.map +1 -1
  32. package/lib/src/interactions/Connector.d.ts +1 -0
  33. package/lib/src/interactions/Connector.es.js +2 -1
  34. package/lib/src/interactions/Connector.es.js.map +1 -1
  35. package/lib/src/next/NextInitiator.cjs.js +0 -2
  36. package/lib/src/next/NextInitiator.cjs.js.map +1 -1
  37. package/lib/src/next/NextInitiator.d.ts +0 -2
  38. package/lib/src/next/NextInitiator.es.js +0 -2
  39. package/lib/src/next/NextInitiator.es.js.map +1 -1
  40. package/lib/src/next/index.d.ts +0 -1
  41. package/lib/src/sdk/editor-engine.json.cjs.js +1 -1
  42. package/lib/src/sdk/editor-engine.json.es.js +1 -1
  43. package/lib/src/sdk/package.json.cjs.js +1 -1
  44. package/lib/src/sdk/package.json.es.js +1 -1
  45. package/lib/src/sdk.cjs.js +118 -79
  46. package/lib/src/sdk.cjs.js.map +1 -1
  47. package/lib/src/sdk.d.ts +52 -34
  48. package/lib/src/sdk.es.js +118 -79
  49. package/lib/src/sdk.es.js.map +1 -1
  50. package/lib/src/types/BrandKitTypes.d.ts +70 -108
  51. package/lib/src/types/ColorStyleTypes.cjs.js +10 -0
  52. package/lib/src/types/ColorStyleTypes.cjs.js.map +1 -1
  53. package/lib/src/types/ColorStyleTypes.es.js +10 -0
  54. package/lib/src/types/ColorStyleTypes.es.js.map +1 -1
  55. package/lib/src/types/CommonTypes.cjs.js +1 -0
  56. package/lib/src/types/CommonTypes.cjs.js.map +1 -1
  57. package/lib/src/types/CommonTypes.d.ts +12 -1
  58. package/lib/src/types/CommonTypes.es.js +1 -0
  59. package/lib/src/types/CommonTypes.es.js.map +1 -1
  60. package/lib/src/types/ComponentGridTypes.cjs.js.map +1 -1
  61. package/lib/src/types/ComponentGridTypes.es.js.map +1 -1
  62. package/lib/src/types/ConnectorTypes.cjs.js +6 -2
  63. package/lib/src/types/ConnectorTypes.cjs.js.map +1 -1
  64. package/lib/src/types/ConnectorTypes.d.ts +10 -1
  65. package/lib/src/types/ConnectorTypes.es.js +6 -2
  66. package/lib/src/types/ConnectorTypes.es.js.map +1 -1
  67. package/lib/src/types/FrameTypes.cjs.js.map +1 -1
  68. package/lib/src/types/FrameTypes.d.ts +2 -4
  69. package/lib/src/types/FrameTypes.es.js.map +1 -1
  70. package/lib/src/types/MethodInvocationTypes.d.ts +27 -0
  71. package/lib/src/types/RichTextRuleTypes.cjs.js.map +1 -1
  72. package/lib/src/types/RichTextRuleTypes.es.js.map +1 -1
  73. package/lib/src/types/ShapeTypes.cjs.js +1 -0
  74. package/lib/src/types/ShapeTypes.cjs.js.map +1 -1
  75. package/lib/src/types/ShapeTypes.d.ts +12 -2
  76. package/lib/src/types/ShapeTypes.es.js +1 -0
  77. package/lib/src/types/ShapeTypes.es.js.map +1 -1
  78. package/lib/src/utils/ConfigHelper.cjs.js +4 -0
  79. package/lib/src/utils/ConfigHelper.cjs.js.map +1 -1
  80. package/lib/src/utils/ConfigHelper.es.js +4 -0
  81. package/lib/src/utils/ConfigHelper.es.js.map +1 -1
  82. package/lib/src/utils/EngineEventTrigger.cjs.js +4 -1
  83. package/lib/src/utils/EngineEventTrigger.cjs.js.map +1 -1
  84. package/lib/src/utils/EngineEventTrigger.d.ts +2 -1
  85. package/lib/src/utils/EngineEventTrigger.es.js +5 -2
  86. package/lib/src/utils/EngineEventTrigger.es.js.map +1 -1
  87. package/lib/src/utils/MethodInstrumentation.cjs.js +176 -0
  88. package/lib/src/utils/MethodInstrumentation.cjs.js.map +1 -0
  89. package/lib/src/utils/MethodInstrumentation.d.ts +10 -0
  90. package/lib/src/utils/MethodInstrumentation.es.js +176 -0
  91. package/lib/src/utils/MethodInstrumentation.es.js.map +1 -0
  92. package/lib/src/utils/SdkEvent.cjs.js +29 -0
  93. package/lib/src/utils/SdkEvent.cjs.js.map +1 -0
  94. package/lib/src/utils/SdkEvent.d.ts +13 -0
  95. package/lib/src/utils/SdkEvent.es.js +29 -0
  96. package/lib/src/utils/SdkEvent.es.js.map +1 -0
  97. package/lib/src/utils/SdkEvents.cjs.js +11 -0
  98. package/lib/src/utils/SdkEvents.cjs.js.map +1 -0
  99. package/lib/src/utils/SdkEvents.d.ts +19 -0
  100. package/lib/src/utils/SdkEvents.es.js +11 -0
  101. package/lib/src/utils/SdkEvents.es.js.map +1 -0
  102. package/package.json +1 -1
  103. package/lib/src/next/controllers/BrandKitController.cjs.js +0 -34
  104. package/lib/src/next/controllers/BrandKitController.cjs.js.map +0 -1
  105. package/lib/src/next/controllers/BrandKitController.d.ts +0 -24
  106. package/lib/src/next/controllers/BrandKitController.es.js +0 -34
  107. package/lib/src/next/controllers/BrandKitController.es.js.map +0 -1
  108. package/lib/src/next/types/BrandKitTypes.d.ts +0 -52
  109. package/lib/src/utils/BrandKitAdapter.cjs.js +0 -42
  110. package/lib/src/utils/BrandKitAdapter.cjs.js.map +0 -1
  111. package/lib/src/utils/BrandKitAdapter.d.ts +0 -9
  112. package/lib/src/utils/BrandKitAdapter.es.js +0 -42
  113. package/lib/src/utils/BrandKitAdapter.es.js.map +0 -1
@@ -93,11 +93,11 @@ export declare class ConnectorController {
93
93
  */
94
94
  updateMappings: (id: Id, mappings: ConnectorMappingType[]) => Promise<EditorResponse<null>>;
95
95
  /**
96
- * Sets the mappings for a given connector, replacing the existing mappings with the new ones.
97
- * @param id the id of your registered connector
98
- * @param mappings An array of mapping objects to set
99
- * @returns
100
- */
96
+ * Sets the mappings for a given connector, replacing the existing mappings with the new ones.
97
+ * @param id the id of your registered connector
98
+ * @param mappings An array of mapping objects to set
99
+ * @returns
100
+ */
101
101
  applyMappings: (id: Id, mappings: ConnectorMappingType[]) => Promise<EditorResponse<null>>;
102
102
  /**
103
103
  * Sets HTTP headers on every local connector instance of the given type that uses the given remote (Environment API) connector id.
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectorController.es.js","sources":["../../../src/controllers/ConnectorController.ts"],"sourcesContent":["import { EditorAPI, EditorResponse, Id } from '../types/CommonTypes';\r\nimport {\r\n ConnectorInstance,\r\n ConnectorMappingDirection,\r\n ConnectorMappingType,\r\n ConnectorOptions,\r\n ConnectorRegistration,\r\n ConnectorState,\r\n ConnectorStateType,\r\n ConnectorToEngineMapping,\r\n ConnectorType,\r\n EngineToConnectorMapping,\r\n} from '../types/ConnectorTypes';\r\nimport { getEditorResponseData } from '../utils/EditorResponseData';\r\n\r\nimport * as Next from '../next/types/ConnectorTypes';\r\nimport { WellKnownConfigurationKeys } from '../types/ConfigurationTypes';\r\nimport { ConnectorCompatibilityTools } from '../utils/ConnectorCompatibilityTools';\r\n\r\n/**\r\n * The ConnectorController manages lifetime of all available connectors, regardless of the type, in the\r\n * document. Use it to add/remove connectors to a template, or set specific configuration.\r\n *\r\n * The way CHILI Studio handles different sources of resources is called 'Connectors'. A Connectors is an\r\n * implementation of a set of capabilities we need to interact with a certain external resource management system.\r\n * In essence a connector is the combination of a Javascript snippet and some metadata. The Javascript snippet\r\n * is loaded in the studio engine using a sandboxed Javascript execution engine (QuickJs). This allows us to\r\n * execute the media connector both on web using webassembly and on the server side during e.g. animation output\r\n * generation.\r\n * This controller is an interface to the running connector instance inside the studio engine. The engine will\r\n * automatically register the 'grafx-media' and 'grafx-font' connectors. Custom connectors need to be registered\r\n * manually.\r\n */\r\nexport class ConnectorController {\r\n /**\r\n * @ignore\r\n */\r\n #editorAPI: EditorAPI;\r\n #localConfig: Map<string, string>;\r\n #connectorCompatibilityTools: ConnectorCompatibilityTools;\r\n\r\n /**\r\n * @ignore\r\n */\r\n constructor(editorAPI: EditorAPI, localConfig: Map<string, string>) {\r\n this.#editorAPI = editorAPI;\r\n this.#localConfig = localConfig;\r\n this.#connectorCompatibilityTools = new ConnectorCompatibilityTools();\r\n }\r\n\r\n /**\r\n * Gets a connector by its id\r\n * @param id the id of the connector\r\n * @returns connector\r\n */\r\n getById = async (id: Id) => {\r\n // add backwards compatibility code\r\n const res = await this.#editorAPI;\r\n return res\r\n .getConnectorById(id)\r\n .then((result) => getEditorResponseData<Next.ConnectorInstance>(result))\r\n .then((resp) => {\r\n const update: EditorResponse<ConnectorInstance> = { ...resp, parsedData: null };\r\n if (resp.parsedData) {\r\n update.parsedData = this.#connectorCompatibilityTools.makeSingleConnectorBackwardsCompatible(\r\n resp.parsedData,\r\n this.#localConfig.get(WellKnownConfigurationKeys.GraFxStudioEnvironmentApiUrl),\r\n );\r\n }\r\n return update;\r\n });\r\n };\r\n\r\n /**\r\n * Gets all available connectors of a 'ConnectorType'\r\n * @param type type of connector you want to get\r\n * @returns list of all available connectors of a 'ConnectorType'\r\n */\r\n getAllByType = async (type: ConnectorType) => {\r\n // add backwards compatibility code\r\n const res = await this.#editorAPI;\r\n return res\r\n .getConnectors(type)\r\n .then((result) => getEditorResponseData<Next.ConnectorInstance[]>(result))\r\n .then((resp) => {\r\n const update: EditorResponse<ConnectorInstance[]> = { ...resp, parsedData: null };\r\n if (resp.parsedData) {\r\n update.parsedData = this.#connectorCompatibilityTools.makeMultipleConnectorsBackwardsCompatible(\r\n resp.parsedData,\r\n this.#localConfig.get(WellKnownConfigurationKeys.GraFxStudioEnvironmentApiUrl),\r\n );\r\n }\r\n return update;\r\n });\r\n };\r\n\r\n /**\r\n * Registers a new connector in the SDK. After successful registration, depending\r\n * on the connector type, the connector can be configured and used in the template\r\n * Remember to add custom authentication information after registering the connector\r\n * @param registration registration object containing all details about the connector\r\n * @returns the Id of the newly created connector, this Id should be used going forward.\r\n */\r\n register = async (registration: ConnectorRegistration) => {\r\n const res = await this.#editorAPI;\r\n\r\n const connectorRegistration =\r\n this.#connectorCompatibilityTools.makeConnectorSourceForwardsCompatible(registration);\r\n\r\n return res\r\n .registerConnector(JSON.stringify(connectorRegistration))\r\n .then((result) => getEditorResponseData<Id>(result));\r\n };\r\n\r\n /**\r\n * Unregisters a connector from the document.\r\n * @param id the id of the connector to unregister\r\n * @returns\r\n */\r\n unregister = async (id: Id) => {\r\n const res = await this.#editorAPI;\r\n return res.unregisterConnector(id).then((result) => getEditorResponseData<null>(result));\r\n };\r\n\r\n /**\r\n * Configures a registered connector. A configurator helper is passed as an argument\r\n * of the callback for you to setup your connector.\r\n * @param id the id of your registered connector\r\n * @param configurationCallback callback to setup the connector\r\n * @returns\r\n */\r\n configure = async (id: Id, configurationCallback: (configurator: ConnectorConfigurator) => Promise<void>) => {\r\n const res = await this.#editorAPI;\r\n // wait for connector to be ready\r\n await this.waitToBeReady(id);\r\n // execute callback\r\n await configurationCallback(new ConnectorConfigurator(id, res));\r\n // invalidate connector in engine\r\n return res.updateConnectorConfiguration(id).then((result) => getEditorResponseData<null>(result));\r\n };\r\n\r\n /**\r\n * Gets the current state a connector is in, to wait until a connector is ready to be used, use the 'waitToBeReady'\r\n * method in this controller.\r\n * @param id the id of your registered connector you want to make sure it is loaded\r\n * @returns connector state\r\n */\r\n getState = async (id: Id) => {\r\n const res = await this.#editorAPI;\r\n return res.getConnectorState(id).then((result) => getEditorResponseData<ConnectorState>(result));\r\n };\r\n\r\n /**\r\n * Gets the mapped data from connector.\r\n * @param id the id of your registered connector\r\n * @param direction the mapping direction\r\n * @returns mappings\r\n */\r\n async getMappings(\r\n id: string,\r\n direction: ConnectorMappingDirection.engineToConnector,\r\n ): Promise<EditorResponse<EngineToConnectorMapping[]>>;\r\n async getMappings(\r\n id: string,\r\n direction: ConnectorMappingDirection.connectorToEngine,\r\n ): Promise<EditorResponse<ConnectorToEngineMapping[]>>;\r\n async getMappings(id: string, direction?: undefined): Promise<EditorResponse<ConnectorMappingType[]>>;\r\n async getMappings(id: string, direction?: ConnectorMappingDirection) {\r\n const res = await this.#editorAPI;\r\n return res\r\n .getConnectorMappings(id)\r\n .then((result) => getEditorResponseData<ConnectorMappingType[]>(result))\r\n .then((result) =>\r\n !direction\r\n ? result\r\n : {\r\n ...result,\r\n parsedData: result.parsedData?.filter((cm) => cm.direction === direction),\r\n },\r\n );\r\n }\r\n\r\n /**\r\n * Gets the options from the connector.\r\n * @param id the id of your registered connector\r\n * @returns options\r\n */\r\n getOptions = async (id: string) => {\r\n const res = await this.#editorAPI;\r\n return res.getConnectorOptions(id).then((result) => getEditorResponseData<ConnectorOptions>(result));\r\n };\r\n\r\n /**\r\n * Connectors are loaded asynchronously in the editor engine, this causes some challenges while configuring them. To make sure\r\n * an action on the connector will be available, it's advised to await this method. After the Promise resolves we are sure\r\n * the connector is up and running. This is used internally by the configure method to ensure correct execution. It's especially\r\n * useful during startup of the SDK / right after the loadDocument call.\r\n * @param id the id of your registered connector you want to make sure it is loaded\r\n * @returns\r\n */\r\n waitToBeReady = async (id: Id, timeoutMilliseconds = 2000): Promise<EditorResponse<null>> => {\r\n // minimum timeout is 500ms\r\n let timeout = Math.max(timeoutMilliseconds, 500);\r\n\r\n // maximum timeout is 5000ms\r\n timeout = Math.min(timeout, 5000);\r\n\r\n const waitTime = 100;\r\n let retries = 0;\r\n\r\n try {\r\n // using while loop will prevent stack overflow issues when using recursion\r\n // wait for maximum 2 seconds to fail\r\n while (retries * waitTime < timeout) {\r\n const result = await this.getState(id);\r\n\r\n if (\r\n result.success &&\r\n result.parsedData &&\r\n (result.parsedData.type === ConnectorStateType.running ||\r\n result.parsedData.type === ConnectorStateType.ready)\r\n ) {\r\n return getEditorResponseData<null>(\r\n { data: null, success: true, error: undefined, status: 0, parsedData: undefined },\r\n false,\r\n );\r\n }\r\n\r\n await new Promise((resolve) => setTimeout(resolve, waitTime));\r\n retries++;\r\n }\r\n } catch (err) {\r\n return getEditorResponseData<null>(\r\n {\r\n data: null,\r\n success: false,\r\n error: `Error while getting connector state ${err}`,\r\n status: 50000,\r\n parsedData: undefined,\r\n },\r\n false,\r\n );\r\n }\r\n\r\n return getEditorResponseData<null>(\r\n {\r\n data: null,\r\n success: false,\r\n error: `Timed out waiting for connector`,\r\n status: 50000,\r\n parsedData: undefined,\r\n },\r\n false,\r\n );\r\n };\r\n\r\n /**\r\n * Updates the mappings for a given connector.\r\n * @param id the id of your registered connector\r\n * @param mappings An array of mapping objects\r\n * @returns\r\n */\r\n updateMappings = async (id: Id, mappings: ConnectorMappingType[]) => {\r\n return await this.configure(id, async (config) => {\r\n // Retrieve all existing mappings\r\n const { parsedData: existingMappings } = await this.getMappings(id);\r\n\r\n // Filter out old mappings that are being replaced with new ones\r\n const filteredMappings =\r\n existingMappings?.filter(\r\n (mapping) =>\r\n !mappings.some(\r\n (newMapping) =>\r\n newMapping.name === mapping.name && newMapping.direction === mapping.direction,\r\n ),\r\n ) ?? [];\r\n\r\n // Filter out new mappings that have empty `name` or `value`\r\n const validMappings = mappings.filter((i) => i.name !== '' && i.value !== '');\r\n\r\n // Merge valid new mappings with the filtered existing mappings\r\n const combinedMappings = [...filteredMappings, ...validMappings];\r\n\r\n // Update the configuration with the resulted mappings\r\n await config.setMappings(combinedMappings);\r\n });\r\n };\r\n\r\n /**\r\n * Sets the mappings for a given connector, replacing the existing mappings with the new ones.\r\n * @param id the id of your registered connector\r\n * @param mappings An array of mapping objects to set\r\n * @returns\r\n */\r\n applyMappings = async (id: Id, mappings: ConnectorMappingType[]) => {\r\n return await this.configure(id, async (config) => {\r\n const validMappings = mappings.filter((i) => i.name !== '' && i.value !== '');\r\n await config.setMappings(validMappings);\r\n });\r\n };\r\n\r\n /**\r\n * Sets HTTP headers on every local connector instance of the given type that uses the given remote (Environment API) connector id.\r\n * It's applicable as for already registered connectors as well as for future one with same remote connector id.\r\n *\r\n * @param remoteConnectorId unique id of the remote connector from the Environment API (grafx source)\r\n * @param headers HTTP headers to set on the connector\r\n * @returns EditorResponse with null on success; error if the engine call fails\r\n */\r\n setHttpHeaders = async (\r\n remoteConnectorId: string,\r\n headers: Record<string, string>,\r\n ): Promise<EditorResponse<null>> => {\r\n const res = await this.#editorAPI;\r\n return res\r\n .remoteConnectorAuthenticationSetHttpHeaders(remoteConnectorId, JSON.stringify(headers))\r\n .then((result) => getEditorResponseData<null>(result));\r\n };\r\n}\r\n\r\n/**\r\n * Helper to setup your connector\r\n */\r\nclass ConnectorConfigurator {\r\n /**\r\n * @ignore\r\n */\r\n #connectorId: Id;\r\n #res: EditorAPI;\r\n\r\n /**\r\n * @ignore\r\n */\r\n constructor(id: Id, res: EditorAPI) {\r\n this.#connectorId = id;\r\n this.#res = res;\r\n }\r\n\r\n /**\r\n * Allows to customize the context data a connector can work with. The options data\r\n * will be available using the context parameter in the connector implementation code.\r\n * @param options object containing key value data to pass to connector context\r\n * @returns\r\n */\r\n setOptions = async (options: ConnectorOptions) => {\r\n return this.#res\r\n .setConnectorOptions(this.#connectorId, JSON.stringify(options))\r\n .then((result) => getEditorResponseData<null>(result));\r\n };\r\n\r\n /**\r\n * Allows to map variables or strings to connector context data.\r\n * By defining the mappings, we can trigger re-download of assets (dynamic asset provider)\r\n * or populate filters for the query endpoint. The mapped data will be available using\r\n * the context parameter in the connector implementation code.\r\n *\r\n * For the variables the mapping should follow the format \"var.[variable id]\". e.g. var.6B29FC40-CA47-1067-B31D-00DD010662DA\r\n *\r\n * @param mappings collection of mappings to set to this connector\r\n * @returns\r\n */\r\n setMappings = async (mappings: ConnectorMappingType[]) => {\r\n const result = await this.#res.setConnectorMappings(\r\n this.#connectorId,\r\n mappings.map(function (m) {\r\n return JSON.stringify(m);\r\n }),\r\n );\r\n return getEditorResponseData<null>(result);\r\n };\r\n\r\n /**\r\n * This method sets the HTTP headers for the 'staticKey' authentication type.\r\n * These additional headers will be added to all connector http calls.\r\n * Can only be used after a connector has been registered. (if you are using a grafx connector no registration is needed)\r\n * @param headerName name of the header\r\n * @param headerValue value of the header\r\n * @returns\r\n */\r\n setHttpHeader = async (headerName: string, headerValue: string) => {\r\n return this.#res\r\n .connectorAuthenticationSetHttpHeader(this.#connectorId, headerName, headerValue)\r\n .then((result) => getEditorResponseData<null>(result));\r\n };\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;;;;AAiCO,MAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA,EAW7B,YAAY,WAAsB,aAAkC;AAPpE;AAAA;AAAA;AAAA;AACA;AACA;AAgBA,SAAA,UAAU,OAAO,OAAW;AAExB,YAAM,MAAM,MAAM,mBAAK;AACvB,aAAO,IACF,iBAAiB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MAAM,CAAC,EACtE;AAAA,MAAK,CAAC,WAAA;;AACH,gBAAC,YACK,SACA;AAAA,UACE,GAAG;AAAA,UACH,aAAY,YAAO,eAAP,mBAAmB,OAAO,CAAC,OAAO,GAAG,cAAc;AAAA,QAAS;AAAA;AAAA,IAC5E;AAAA,EAEhB;AA0IJ;AAzRI;AACA;AACA;AA4RJ,MAAM,sBAAsB;AAAA;AAAA;AAAA;AAAA,EAUxB,YAAY,IAAQ,KAAgB;AANpC;AAAA;AAAA;AAAA;AACA;AAgBA,SAAA,aAAa,OAAO,YAA8B;AAC9C,aAAO,mBAAK,MACP,oBAAoB,mBAAK,eAAc,KAAK,UAAU,OAAO,CAAC,EAC9D,KAAK,CAAC,WAAW,sBAA4B,MAAM,CAAC;AAAA,IAC7D;AAaA,SAAA,cAAc,OAAO,aAAqC;AACtD,YAAM,SAAS,MAAM,mBAAK,MAAK;AAAA,QAC3B,mBAAK;AAAA,QACL,SAAS,IAAI,SAAU,GAAG;AACtB,iBAAO,KAAK,UAAU,CAAC;AAAA,QAC3B,CAAC;AAAA,MAAA;AAEL,aAAO,sBAA4B,MAAM;AAAA,IAC7C;AAUA,SAAA,gBAAgB,OAAO,YAAoB,gBAAwB;AAC/D,aAAO,mBAAK,MACP,qCAAqC,mBAAK,eAAc,YAAY,WAAW,EAC/E,KAAK,CAAC,WAAW,sBAA4B,MAAM,CAAC;AAAA,IAC7D;AAjDI,uBAAK,cAAe;AACpB,uBAAK,MAAO;AAAA,EAChB;AAgDJ;AAzDI;AACA;"}
1
+ {"version":3,"file":"ConnectorController.es.js","sources":["../../../src/controllers/ConnectorController.ts"],"sourcesContent":["import { EditorAPI, EditorResponse, Id } from '../types/CommonTypes';\r\nimport {\r\n ConnectorInstance,\r\n ConnectorMappingDirection,\r\n ConnectorMappingType,\r\n ConnectorOptions,\r\n ConnectorRegistration,\r\n ConnectorState,\r\n ConnectorStateType,\r\n ConnectorToEngineMapping,\r\n ConnectorType,\r\n EngineToConnectorMapping,\r\n} from '../types/ConnectorTypes';\r\nimport { getEditorResponseData } from '../utils/EditorResponseData';\r\n\r\nimport * as Next from '../next/types/ConnectorTypes';\r\nimport { WellKnownConfigurationKeys } from '../types/ConfigurationTypes';\r\nimport { ConnectorCompatibilityTools } from '../utils/ConnectorCompatibilityTools';\r\n\r\n/**\r\n * The ConnectorController manages lifetime of all available connectors, regardless of the type, in the\r\n * document. Use it to add/remove connectors to a template, or set specific configuration.\r\n *\r\n * The way CHILI Studio handles different sources of resources is called 'Connectors'. A Connectors is an\r\n * implementation of a set of capabilities we need to interact with a certain external resource management system.\r\n * In essence a connector is the combination of a Javascript snippet and some metadata. The Javascript snippet\r\n * is loaded in the studio engine using a sandboxed Javascript execution engine (QuickJs). This allows us to\r\n * execute the media connector both on web using webassembly and on the server side during e.g. animation output\r\n * generation.\r\n * This controller is an interface to the running connector instance inside the studio engine. The engine will\r\n * automatically register the 'grafx-media' and 'grafx-font' connectors. Custom connectors need to be registered\r\n * manually.\r\n */\r\nexport class ConnectorController {\r\n /**\r\n * @ignore\r\n */\r\n #editorAPI: EditorAPI;\r\n #localConfig: Map<string, string>;\r\n #connectorCompatibilityTools: ConnectorCompatibilityTools;\r\n\r\n /**\r\n * @ignore\r\n */\r\n constructor(editorAPI: EditorAPI, localConfig: Map<string, string>) {\r\n this.#editorAPI = editorAPI;\r\n this.#localConfig = localConfig;\r\n this.#connectorCompatibilityTools = new ConnectorCompatibilityTools();\r\n }\r\n\r\n /**\r\n * Gets a connector by its id\r\n * @param id the id of the connector\r\n * @returns connector\r\n */\r\n getById = async (id: Id) => {\r\n // add backwards compatibility code\r\n const res = await this.#editorAPI;\r\n return res\r\n .getConnectorById(id)\r\n .then((result) => getEditorResponseData<Next.ConnectorInstance>(result))\r\n .then((resp) => {\r\n const update: EditorResponse<ConnectorInstance> = { ...resp, parsedData: null };\r\n if (resp.parsedData) {\r\n update.parsedData = this.#connectorCompatibilityTools.makeSingleConnectorBackwardsCompatible(\r\n resp.parsedData,\r\n this.#localConfig.get(WellKnownConfigurationKeys.GraFxStudioEnvironmentApiUrl),\r\n );\r\n }\r\n return update;\r\n });\r\n };\r\n\r\n /**\r\n * Gets all available connectors of a 'ConnectorType'\r\n * @param type type of connector you want to get\r\n * @returns list of all available connectors of a 'ConnectorType'\r\n */\r\n getAllByType = async (type: ConnectorType) => {\r\n // add backwards compatibility code\r\n const res = await this.#editorAPI;\r\n return res\r\n .getConnectors(type)\r\n .then((result) => getEditorResponseData<Next.ConnectorInstance[]>(result))\r\n .then((resp) => {\r\n const update: EditorResponse<ConnectorInstance[]> = { ...resp, parsedData: null };\r\n if (resp.parsedData) {\r\n update.parsedData = this.#connectorCompatibilityTools.makeMultipleConnectorsBackwardsCompatible(\r\n resp.parsedData,\r\n this.#localConfig.get(WellKnownConfigurationKeys.GraFxStudioEnvironmentApiUrl),\r\n );\r\n }\r\n return update;\r\n });\r\n };\r\n\r\n /**\r\n * Registers a new connector in the SDK. After successful registration, depending\r\n * on the connector type, the connector can be configured and used in the template\r\n * Remember to add custom authentication information after registering the connector\r\n * @param registration registration object containing all details about the connector\r\n * @returns the Id of the newly created connector, this Id should be used going forward.\r\n */\r\n register = async (registration: ConnectorRegistration) => {\r\n const res = await this.#editorAPI;\r\n\r\n const connectorRegistration =\r\n this.#connectorCompatibilityTools.makeConnectorSourceForwardsCompatible(registration);\r\n\r\n return res\r\n .registerConnector(JSON.stringify(connectorRegistration))\r\n .then((result) => getEditorResponseData<Id>(result));\r\n };\r\n\r\n /**\r\n * Unregisters a connector from the document.\r\n * @param id the id of the connector to unregister\r\n * @returns\r\n */\r\n unregister = async (id: Id) => {\r\n const res = await this.#editorAPI;\r\n return res.unregisterConnector(id).then((result) => getEditorResponseData<null>(result));\r\n };\r\n\r\n /**\r\n * Configures a registered connector. A configurator helper is passed as an argument\r\n * of the callback for you to setup your connector.\r\n * @param id the id of your registered connector\r\n * @param configurationCallback callback to setup the connector\r\n * @returns\r\n */\r\n configure = async (id: Id, configurationCallback: (configurator: ConnectorConfigurator) => Promise<void>) => {\r\n const res = await this.#editorAPI;\r\n // wait for connector to be ready\r\n await this.waitToBeReady(id);\r\n // execute callback\r\n await configurationCallback(new ConnectorConfigurator(id, res));\r\n // invalidate connector in engine\r\n return res.updateConnectorConfiguration(id).then((result) => getEditorResponseData<null>(result));\r\n };\r\n\r\n /**\r\n * Gets the current state a connector is in, to wait until a connector is ready to be used, use the 'waitToBeReady'\r\n * method in this controller.\r\n * @param id the id of your registered connector you want to make sure it is loaded\r\n * @returns connector state\r\n */\r\n getState = async (id: Id) => {\r\n const res = await this.#editorAPI;\r\n return res.getConnectorState(id).then((result) => getEditorResponseData<ConnectorState>(result));\r\n };\r\n\r\n /**\r\n * Gets the mapped data from connector.\r\n * @param id the id of your registered connector\r\n * @param direction the mapping direction\r\n * @returns mappings\r\n */\r\n async getMappings(\r\n id: string,\r\n direction: ConnectorMappingDirection.engineToConnector,\r\n ): Promise<EditorResponse<EngineToConnectorMapping[]>>;\r\n async getMappings(\r\n id: string,\r\n direction: ConnectorMappingDirection.connectorToEngine,\r\n ): Promise<EditorResponse<ConnectorToEngineMapping[]>>;\r\n async getMappings(id: string, direction?: undefined): Promise<EditorResponse<ConnectorMappingType[]>>;\r\n async getMappings(id: string, direction?: ConnectorMappingDirection) {\r\n const res = await this.#editorAPI;\r\n return res\r\n .getConnectorMappings(id)\r\n .then((result) => getEditorResponseData<ConnectorMappingType[]>(result))\r\n .then((result) =>\r\n !direction\r\n ? result\r\n : {\r\n ...result,\r\n parsedData: result.parsedData?.filter((cm) => cm.direction === direction),\r\n },\r\n );\r\n }\r\n\r\n /**\r\n * Gets the options from the connector.\r\n * @param id the id of your registered connector\r\n * @returns options\r\n */\r\n getOptions = async (id: string) => {\r\n const res = await this.#editorAPI;\r\n return res.getConnectorOptions(id).then((result) => getEditorResponseData<ConnectorOptions>(result));\r\n };\r\n\r\n /**\r\n * Connectors are loaded asynchronously in the editor engine, this causes some challenges while configuring them. To make sure\r\n * an action on the connector will be available, it's advised to await this method. After the Promise resolves we are sure\r\n * the connector is up and running. This is used internally by the configure method to ensure correct execution. It's especially\r\n * useful during startup of the SDK / right after the loadDocument call.\r\n * @param id the id of your registered connector you want to make sure it is loaded\r\n * @returns\r\n */\r\n waitToBeReady = async (id: Id, timeoutMilliseconds = 2000): Promise<EditorResponse<null>> => {\r\n // minimum timeout is 500ms\r\n let timeout = Math.max(timeoutMilliseconds, 500);\r\n\r\n // maximum timeout is 5000ms\r\n timeout = Math.min(timeout, 5000);\r\n\r\n const waitTime = 100;\r\n let retries = 0;\r\n\r\n try {\r\n // using while loop will prevent stack overflow issues when using recursion\r\n // wait for maximum 2 seconds to fail\r\n while (retries * waitTime < timeout) {\r\n const result = await this.getState(id);\r\n\r\n if (\r\n result.success &&\r\n result.parsedData &&\r\n (result.parsedData.type === ConnectorStateType.running ||\r\n result.parsedData.type === ConnectorStateType.ready)\r\n ) {\r\n return getEditorResponseData<null>(\r\n { data: null, success: true, error: undefined, status: 0, parsedData: undefined },\r\n false,\r\n );\r\n }\r\n\r\n await new Promise((resolve) => setTimeout(resolve, waitTime));\r\n retries++;\r\n }\r\n } catch (err) {\r\n return getEditorResponseData<null>(\r\n {\r\n data: null,\r\n success: false,\r\n error: `Error while getting connector state ${err}`,\r\n status: 50000,\r\n parsedData: undefined,\r\n },\r\n false,\r\n );\r\n }\r\n\r\n return getEditorResponseData<null>(\r\n {\r\n data: null,\r\n success: false,\r\n error: `Timed out waiting for connector`,\r\n status: 50000,\r\n parsedData: undefined,\r\n },\r\n false,\r\n );\r\n };\r\n\r\n /**\r\n * Updates the mappings for a given connector.\r\n * @param id the id of your registered connector\r\n * @param mappings An array of mapping objects\r\n * @returns\r\n */\r\n updateMappings = async (id: Id, mappings: ConnectorMappingType[]) => {\r\n return await this.configure(id, async (config) => {\r\n // Retrieve all existing mappings\r\n const { parsedData: existingMappings } = await this.getMappings(id);\r\n\r\n // Filter out old mappings that are being replaced with new ones\r\n const filteredMappings =\r\n existingMappings?.filter(\r\n (mapping) =>\r\n !mappings.some(\r\n (newMapping) =>\r\n newMapping.name === mapping.name && newMapping.direction === mapping.direction,\r\n ),\r\n ) ?? [];\r\n\r\n // Filter out new mappings that have empty `name` or `value`\r\n const validMappings = mappings.filter((i) => i.name !== '' && i.value !== '');\r\n\r\n // Merge valid new mappings with the filtered existing mappings\r\n const combinedMappings = [...filteredMappings, ...validMappings];\r\n\r\n // Update the configuration with the resulted mappings\r\n await config.setMappings(combinedMappings);\r\n });\r\n };\r\n\r\n /**\r\n * Sets the mappings for a given connector, replacing the existing mappings with the new ones.\r\n * @param id the id of your registered connector\r\n * @param mappings An array of mapping objects to set\r\n * @returns\r\n */\r\n applyMappings = async (id: Id, mappings: ConnectorMappingType[]) => {\r\n return await this.configure(id, async (config) => {\r\n const validMappings = mappings.filter((i) => i.name !== '' && i.value !== '');\r\n await config.setMappings(validMappings);\r\n });\r\n };\r\n\r\n /**\r\n * Sets HTTP headers on every local connector instance of the given type that uses the given remote (Environment API) connector id.\r\n * It's applicable as for already registered connectors as well as for future one with same remote connector id.\r\n *\r\n * @param remoteConnectorId unique id of the remote connector from the Environment API (grafx source)\r\n * @param headers HTTP headers to set on the connector\r\n * @returns EditorResponse with null on success; error if the engine call fails\r\n */\r\n setHttpHeaders = async (\r\n remoteConnectorId: string,\r\n headers: Record<string, string>,\r\n ): Promise<EditorResponse<null>> => {\r\n const res = await this.#editorAPI;\r\n return res\r\n .remoteConnectorAuthenticationSetHttpHeaders(remoteConnectorId, JSON.stringify(headers))\r\n .then((result) => getEditorResponseData<null>(result));\r\n };\r\n}\r\n\r\n/**\r\n * Helper to setup your connector\r\n */\r\nclass ConnectorConfigurator {\r\n /**\r\n * @ignore\r\n */\r\n #connectorId: Id;\r\n #res: EditorAPI;\r\n\r\n /**\r\n * @ignore\r\n */\r\n constructor(id: Id, res: EditorAPI) {\r\n this.#connectorId = id;\r\n this.#res = res;\r\n }\r\n\r\n /**\r\n * Allows to customize the context data a connector can work with. The options data\r\n * will be available using the context parameter in the connector implementation code.\r\n * @param options object containing key value data to pass to connector context\r\n * @returns\r\n */\r\n setOptions = async (options: ConnectorOptions) => {\r\n return this.#res\r\n .setConnectorOptions(this.#connectorId, JSON.stringify(options))\r\n .then((result) => getEditorResponseData<null>(result));\r\n };\r\n\r\n /**\r\n * Allows to map variables or strings to connector context data.\r\n * By defining the mappings, we can trigger re-download of assets (dynamic asset provider)\r\n * or populate filters for the query endpoint. The mapped data will be available using\r\n * the context parameter in the connector implementation code.\r\n *\r\n * For the variables the mapping should follow the format \"var.[variable id]\". e.g. var.6B29FC40-CA47-1067-B31D-00DD010662DA\r\n *\r\n * @param mappings collection of mappings to set to this connector\r\n * @returns\r\n */\r\n setMappings = async (mappings: ConnectorMappingType[]) => {\r\n const result = await this.#res.setConnectorMappings(\r\n this.#connectorId,\r\n mappings.map(function (m) {\r\n return JSON.stringify(m);\r\n }),\r\n );\r\n return getEditorResponseData<null>(result);\r\n };\r\n\r\n /**\r\n * This method sets the HTTP headers for the 'staticKey' authentication type.\r\n * These additional headers will be added to all connector http calls.\r\n * Can only be used after a connector has been registered. (if you are using a grafx connector no registration is needed)\r\n * @param headerName name of the header\r\n * @param headerValue value of the header\r\n * @returns\r\n */\r\n setHttpHeader = async (headerName: string, headerValue: string) => {\r\n return this.#res\r\n .connectorAuthenticationSetHttpHeader(this.#connectorId, headerName, headerValue)\r\n .then((result) => getEditorResponseData<null>(result));\r\n };\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;;;;AAiCO,MAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA,EAW7B,YAAY,WAAsB,aAAkC;AAPpE;AAAA;AAAA;AAAA;AACA;AACA;AAgBA,SAAA,UAAU,OAAO,OAAW;AAExB,YAAM,MAAM,MAAM,mBAAK;AACvB,aAAO,IACF,iBAAiB,EAAE,EACnB,KAAK,CAAC,WAAW,sBAA8C,MAAM,CAAC,EACtE,KAAK,CAAC,SAAS;AACZ,cAAM,SAA4C,EAAE,GAAG,MAAM,YAAY,KA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AO,CAAC,OAAO,GAAG,cAAc;AAAA,QAAS;AAAA;AAAA,IAC5E;AAAA,EAElB;AA0IJ;AAzRI;AACA;AACA;AA4RJ,MAAM,sBAAsB;AAAA;AAAA;AAAA;AAAA,EAUxB,YAAY,IAAQ,KAAgB;AANpC;AAAA;AAAA;AAAA;AACA;AAgBA,SAAA,aAAa,OAAO,YAA8B;AAC9C,aAAO,mBAAK,MACP,oBAAoB,mBAAK,eAAc,KAAK,UAAU,OAAO,CAAC,EAC9D,KAAK,CAAC,WAAW,sBAA4B,MAAM,CAAC;AAAA,IAC7D;AAaA,SAAA,cAAc,OAAO,aAAqC;AACtD,YAAM,SAAS,MAAM,mBAAK,MAAK;AAAA,QAC3B,mBAAK;AAAA,QACL,SAAS,IAAI,SAAU,GAAG;AACtB,iBAAO,KAAK,UAAU,CAAC;AAAA,QAC3B,CAAC;AAAA,MAAA;AAEL,aAAO,sBAA4B,MAAM;AAAA,IAC7C;AAUA,SAAA,gBAAgB,OAAO,YAAoB,gBAAwB;AAC/D,aAAO,mBAAK,MACP,qCAAqC,mBAAK,eAAc,YAAY,WAAW,EAC/E,KAAK,CAAC,WAAW,sBAA4B,MAAM,CAAC;AAAA,IAC7D;AAjDI,uBAAK,cAAe;AACpB,uBAAK,MAAO;AAAA,EAChB;AAgDJ;AAzDI;AACA;"}
@@ -180,6 +180,9 @@ class SubscriberController {
180
180
  this.onBrandKitMediaChanged = (brandKitMedia) => {
181
181
  this.config.events.onBrandKitMediaChanged.trigger(JSON.parse(brandKitMedia));
182
182
  };
183
+ this.onCanvasFramesManipulated = (frameIds) => {
184
+ this.config.events.onCanvasFramesManipulated.trigger(JSON.parse(frameIds));
185
+ };
183
186
  this.config = config;
184
187
  this.localConfig = localConfig;
185
188
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriberController.cjs.js","sources":["../../../src/controllers/SubscriberController.ts"],"sourcesContent":["import { Id, RuntimeConfigType } from '../types/CommonTypes';\nimport { WellKnownConfigurationKeys } from '../types/ConfigurationTypes';\nimport { ListVariable, ListVariableItem, Variable, VariableType } from '../types/VariableTypes';\nimport { ViewMode } from '../types/ViewModeTypes';\nimport { ConnectorCompatibilityTools } from '../utils/ConnectorCompatibilityTools';\nimport { ToolType } from '../utils/Enums';\nimport { MeasurementUnit } from '../types/LayoutTypes';\nimport { ActionAsyncError, DataRowAsyncError } from '../exceptions';\n\n/**\n * The SubscriberController is responsible for all listeners which can influence the application-state from outside.\n * Callbacks inside this controller can be set by `window.SDK.subscriber.{method-name}`\n */\nexport class SubscriberController {\n /**\n * @ignore\n */\n private config: RuntimeConfigType;\n\n /**\n * @ignore\n */\n private localConfig: Map<string, string>;\n\n /**\n * @ignore\n */\n constructor(config: RuntimeConfigType, localConfig: Map<string, string>) {\n this.config = config;\n this.localConfig = localConfig;\n }\n\n /**\n * Listener on actions, if this changes, this listener will get triggered with the updates\n * @param actions Stringified array of DocumentAction type\n */\n onActionsChanged = (actions: string) => {\n this.config.events.onActionsChanged.trigger(JSON.parse(actions));\n };\n\n /**\n * Listener on when a certain animation gets changed\n * @param animation Stringified array of FrameAnimationType\n */\n onAnimationChanged = (animation: string) => {\n this.config.events.onFrameAnimationsChanged.trigger(JSON.parse(animation));\n };\n\n /**\n * Listener on the playback state of the animation, it contains the current time of the playback (in milliseconds) and a flag that describes if the animation is currently playing\n * @param animationPlaybackState Stringified array of AnimationPlaybackType\n */\n onAnimationPlaybackChanged = (animationPlaybackState: string) => {\n this.config.events.onScrubberPositionChanged.trigger(JSON.parse(animationPlaybackState));\n };\n\n /**\n * Listener on the state of the currently selected layout, if its properties are changed, this listener will get triggered with the new properties\n * @param layoutProperties Stringified object of LayoutPropertiesType\n */\n onSelectedLayoutPropertiesChanged = (layoutProperties: string) => {\n this.config.events.onSelectedLayoutPropertiesChanged.trigger(JSON.parse(layoutProperties));\n };\n\n /**\n * Listener on the unit of the currently active layout. If you switch between layouts with different units, this listener will get triggered with the new unit\n * If you switch the unit of a layout this listener will get triggered with the new unit\n *\n * @param unit Stringified object of MeasurementUnit\n */\n onSelectedLayoutUnitChanged = (unit: string) => {\n this.config.events.onSelectedLayoutUnitChanged.trigger(unit as MeasurementUnit);\n };\n\n /**\n * Listener on the state of all frames, if this changes, this listener will get triggered with the updates\n * @param framesLayout Stringified array of FrameLayoutType objects\n */\n onFramesLayoutChanged = (framesLayout: string) => {\n const frames = JSON.parse(framesLayout);\n this.config.events.onFramesLayoutChanged.trigger(frames);\n };\n\n /**\n * Listener on the state of the currently selected frames, if this changes, this listener will get triggered with the updates\n * @param framesLayout Stringified array of FrameLayoutType objects\n */\n onSelectedFramesLayoutChanged = (framesLayout: string) => {\n const frames = JSON.parse(framesLayout);\n this.config.events.onSelectedFramesLayoutChanged.trigger(frames);\n\n const singleFrameCallBack = this.config.onSelectedFrameLayoutChanged;\n singleFrameCallBack && singleFrameCallBack(frames.length > 1 ? undefined : frames[0]);\n };\n\n /**\n * Listener on the state of the currently selected frame, it contains some basic information on the type of frame it is\n * @param framesContent Stringified array of Frame objects\n */\n onSelectedFramesContentChanged = (framesContent: string) => {\n const frames = JSON.parse(framesContent);\n this.config.events.onSelectedFramesContentChanged.trigger(frames);\n\n const singleFrameCallBack = this.config.onSelectedFrameContentChanged;\n singleFrameCallBack && singleFrameCallBack(frames.length > 1 ? null : frames[0]);\n };\n\n /**\n * Listener on the general state of the document, gets triggered every time a change is done on the document.\n */\n onStateChanged = () => {\n this.config.events.onStateChanged.trigger();\n };\n\n /**\n * Listener on authentication expiration.\n * The callback should resolve to the refreshed authentication. If the\n * listener is not defined, the http requests from the connector will return\n * 401 with no refetch of assets.\n *\n * When this emits it means either:\n * - the grafxToken needs to be renewed\n * - any other authentication needs to be renewed (user impersonation, static..)\n *\n * @param authRefreshRequest Stringified object of AuthRefreshRequest\n */\n onAuthExpired = async (authRefreshRequest: string) => {\n const authCredentials = await this.config.handlers.onAuthExpired.trigger(JSON.parse(authRefreshRequest));\n return authCredentials != null ? JSON.stringify(authCredentials) : null;\n };\n\n /**\n * Listener on viewport request.\n * The callback should resolve to the visible viewport. If the\n * listener is not defined, the viewport will take full size.\n *\n * When this emits it means that the engine requested the viewport for a\n * zoom to page call.\n */\n onViewportRequested = () => {\n const viewport = this.config.handlers.onViewportRequested.trigger();\n return viewport != null ? JSON.stringify(viewport) : null;\n };\n\n /**\n * Listener on when the document is fully loaded.\n */\n onDocumentLoaded = () => {\n this.config.events.onDocumentLoaded.trigger();\n };\n\n /**\n * @deprecated use `onSelectedPageIdChanged` instead\n * To be implemented, gets triggered when clicking on the pageTitle on the canvas.\n */\n onPageSelectionChanged = (id: Id) => {\n this.config.events.onPageSelectionChanged.trigger(id);\n };\n\n /**\n * Listener on when variables change\n * @param variablesJson Stringified array of Variable\n */\n onVariableListChanged = (variablesJson: string) => {\n const parsed = JSON.parse(variablesJson) as Variable[];\n\n const updated = parsed.map((variable) =>\n variable.type === VariableType.list\n ? {\n ...variable,\n items: ((variable as ListVariable).items as unknown as ListVariableItem[]).map(\n (item) => item.value,\n ),\n selected: ((variable as ListVariable).selected as unknown as ListVariableItem | undefined)?.value,\n }\n : variable,\n );\n\n this.config.events.onVariableListChanged.trigger(updated);\n };\n\n /**\n * Listener on when the tool has changed by the canvas\n * @param tool the string representation of a certain tool\n */\n onSelectedToolChanged = (tool: string) => {\n this.config.events.onSelectedToolChanged.trigger(tool as ToolType);\n };\n\n /**\n * Listener on state changes\n * @param undoState Stringified object of UndoState\n */\n onUndoStateChanged = (undoState: string) => {\n this.config.events.onUndoStackStateChanged.trigger(JSON.parse(undoState));\n };\n\n /**\n * Listener on custom undo data changes\n *\n * @param customData Stringified object of custom undo data\n */\n onCustomUndoDataChanged = (customData: string) => {\n this.config.events.onCustomUndoDataChanged.trigger(JSON.parse(customData));\n };\n\n /**\n * Listener on the state of the currently selected layout's frames, if this changes, this listener will get triggered with the updates\n * @param layoutFrames Stringified object of Frames\n */\n onSelectedLayoutFramesChanged = (layoutFrames: string) => {\n this.config.events.onSelectedLayoutFramesChanged.trigger(JSON.parse(layoutFrames));\n };\n\n /**\n * Listener on the state of the currently selected text's styles, if this changes, this listener will get triggered with the updates\n * @param styles Stringified object of styles\n */\n onSelectedTextStyleChanged = (styles: string) => {\n this.config.events.onSelectedTextStyleChanged.trigger(JSON.parse(styles));\n };\n\n /**\n * Listener on the state of the currently selected color's styles, if this changes, this listener will get triggered with the updates\n * @param colors Stringified object of colors\n */\n onColorsChanged = (colors: string) => {\n this.config.events.onColorsChanged.trigger(JSON.parse(colors));\n };\n\n /**\n * Listener on paragraph styles, if this changes, this listener will get triggered with the updates\n * @param paragraphStyles Stringified object of paragraph styles\n */\n onParagraphStylesChanged = (paragraphStyles: string) => {\n this.config.events.onParagraphStylesChanged.trigger(JSON.parse(paragraphStyles));\n };\n\n /**\n * Listener on character styles, if this changes, this listener will get triggered with the updates\n * @param characterStyles Stringified object of character styles\n */\n onCharacterStylesChanged = (characterStyles: string) => {\n this.config.events.onCharacterStylesChanged.trigger(JSON.parse(characterStyles));\n };\n\n /**\n * Listener on fonts, if this changes, this listener will get triggered with the updates\n * @param fonts Stringified object of font families\n */\n onFontFamiliesChanged = (fonts: string) => {\n this.config.events.onFontFamiliesChanged.trigger(JSON.parse(fonts));\n };\n\n /**\n * Listener on selected layout id, this listener will get triggered when a different layout is selected.\n * @param id the currently selected layout id\n */\n onSelectedLayoutIdChanged = (id: Id) => {\n this.config.events.onSelectedLayoutIdChanged.trigger(id);\n };\n\n /**\n * Listener on layouts, this listener will get triggered when a (sub)layout is\n * - created\n * - removed\n * - renamed\n * - duplicated\n * @param layouts Stringified object of layouts\n */\n onLayoutsChanged = (layouts: string) => {\n this.config.events.onLayoutsChanged.trigger(JSON.parse(layouts));\n };\n\n /**\n * Listener on scale factor of the canvas, this listener will get triggered when a zoom is applied to the canvas\n * @param zoom Stringified scale factor\n */\n onZoomChanged = (zoom: string) => {\n this.config.events.onZoomChanged.trigger(JSON.parse(zoom));\n };\n\n /**\n * Listener on connector events, this listener will get triggered when a connector emits one of those events\n * - reloadRequired\n * - authChanged\n * - unloaded\n * - stateChanged\n *\n * stateChanged - this event will be triggered by connector states: loading, loaded, running, ready, error\n * @param connectorEvent Stringified object of ConnectorEvent\n */\n onConnectorEvent = (connectorEvent: string) => {\n this.config.events.onConnectorEvent.trigger(JSON.parse(connectorEvent));\n };\n\n /**\n * Listener on connectors, if this changes, this listener will get triggered with the updates\n * @param connectors Stringified array of ConnectorInstance type\n */\n onConnectorsChanged = (connectors: string) => {\n const connectorCompatibilityTools = new ConnectorCompatibilityTools();\n const compatibleConnectors = connectorCompatibilityTools.makeMultipleConnectorsBackwardsCompatible(\n JSON.parse(connectors),\n this.localConfig.get(WellKnownConfigurationKeys.GraFxStudioEnvironmentApiUrl),\n );\n this.config.events.onConnectorsChanged.trigger(compatibleConnectors);\n };\n\n /**\n * @experimental\n * Listener on when the selectedPageID is changed.\n * @param pageId Stringified pageId\n */\n onSelectedPageIdChanged = (pageId: string) => {\n this.config.events.onSelectedPageIdChanged.trigger(pageId);\n };\n\n /**\n * @experimental\n * Listener on pages list, this listener will get triggered when the pages are updated.\n * @param pages Stringified object of the pages\n */\n onPagesChanged = (pages: string) => {\n this.config.events.onPagesChanged.trigger(JSON.parse(pages));\n };\n\n /**\n * @experimental\n * Listener on pages snapshots, this will fire when a page snapshot is invalidated and should be updated.\n * @param pageId id of the page\n */\n onPageSnapshotInvalidated = (pageId: Id) => {\n this.config.events.onPageSnapshotInvalidated.trigger(pageId);\n };\n /**\n * Listener on page size, this listener will get triggered when the page size is changed, while the document is a `project`.\n * This will not emit anything if your document is a `template`.\n * @param pageSize Stringified object of the PageSize\n */\n onPageSizeChanged = (pageSize: string) => {\n this.config.events.onPageSizeChanged.trigger(JSON.parse(pageSize));\n };\n\n /**\n * Listener on corner radii of rectangle and polygon shapes, this listener will get triggered when any corner radius is changed\n * @param cornerRadius Stringified object of the CornerRadius\n */\n onShapeCornerRadiusChanged = (cornerRadius: string) => {\n this.config.events.onShapeCornerRadiusChanged.trigger(JSON.parse(cornerRadius));\n };\n\n /**\n * Listener of editor entering / exiting the crop mode\n * @param id frame id when entering / null when exiting\n */\n onCropActiveFrameIdChanged = (id?: Id) => {\n this.config.events.onCropActiveFrameIdChanged.trigger(id);\n };\n\n /**\n * Listener on async errors.\n * Async errors are thrown at times not directly tied to SDK calls.\n * e.g. Getting an action error triggered after a late event.\n *\n * If this is an `ActionAsyncError`:\n * - `id` refers to the action id\n * - `event` refers to the event that triggered the action\n * - `eventChain` refers the chain of events that lead to the action, first\n * item being the closest parent.\n * @param asyncError error triggered asynchronously\n */\n onAsyncError = (asyncError: string) => {\n const parsedError = JSON.parse(asyncError);\n\n if (parsedError?.type === 'dataRow') {\n const dataRowException = new DataRowAsyncError(\n parsedError.count,\n parsedError.message,\n parsedError.exceptions,\n );\n\n this.config.events.onAsyncError.trigger(dataRowException);\n } else if (parsedError?.type === 'action') {\n const actionException = new ActionAsyncError(\n parsedError.message,\n parsedError.id,\n parsedError.event,\n parsedError.eventChain,\n );\n\n this.config.events.onAsyncError.trigger(actionException);\n } else {\n this.config.events.onAsyncError.trigger(parsedError);\n }\n };\n\n /**\n * Listener on when the view mode has changed\n * @param viewMode the string representation of a view mode\n */\n onViewModeChanged = (viewMode: string) => {\n this.config.events.onViewModeChanged.trigger(viewMode as ViewMode);\n };\n\n /**\n * Listener on when barcode frames change their validation state\n *\n * @param validationResults the json string representation of the validation results\n */\n onBarcodeValidationChanged = (validationResults: string) => {\n this.config.events.onBarcodeValidationChanged.trigger(JSON.parse(validationResults));\n };\n\n /**\n * Listener on when the data source has changed\n *\n * @param connectorId the id of the data connector\n */\n onDataSourceIdChanged = (connectorId?: Id) => {\n this.config.events.onDataSourceIdChanged.trigger(connectorId);\n };\n\n /**\n * Listener on when injected data has changed\n *\n * @param variableId the id of the injected data source variable\n */\n onInjectedDataChanged = (variableId: Id) => {\n this.config.events.onInjectedDataChanged.trigger(variableId);\n };\n\n /**\n * Listener on document issues, if this changes, this listener will get triggered with the updates\n * @param documentIssues Stringified object of document issues\n */\n onDocumentIssueListChanged = (documentIssues: string) => {\n this.config.events.onDocumentIssueListChanged.trigger(JSON.parse(documentIssues));\n };\n\n /**\n * Listener on engine editing mode, if this changes, this listener will get triggered with the updates\n * @param engineEditMode Stringified object of engine edit mode\n */\n onEngineEditModeChanged = (engineEditMode: string) => {\n this.config.events.onEngineEditModeChanged.trigger(JSON.parse(engineEditMode));\n };\n\n /**\n * Listener on brand kit media, if this changes, this listener will get triggered with the updates\n * @param brandKitMedia Stringified array of BrandKitMedia objects\n */\n onBrandKitMediaChanged = (brandKitMedia: string) => {\n this.config.events.onBrandKitMediaChanged.trigger(JSON.parse(brandKitMedia));\n };\n}\n"],"names":["VariableType","ConnectorCompatibilityTools","WellKnownConfigurationKeys","DataRowAsyncError","ActionAsyncError"],"mappings":";;;;;;AAaO,MAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA,EAc9B,YAAY,QAA2B,aAAkC;AASzE,SAAA,mBAAmB,CAAC,YAAoB;AACpC,WAAK,OAAO,OAAO,iBAAiB,QAAQ,KAAK,MAAM,OAAO,CAAC;AAAA,IACnE;AAMA,SAAA,qBAAqB,CAAC,cAAsB;AACxC,WAAK,OAAO,OAAO,yBAAyB,QAAQ,KAAK,MAAM,SAAS,CAAC;AAAA,IAC7E;AAMA,SAAA,6BAA6B,CAAC,2BAAmC;AAC7D,WAAK,OAAO,OAAO,0BAA0B,QAAQ,KAAK,MAAM,sBAAsB,CAAC;AAAA,IAC3F;AAMA,SAAA,oCAAoC,CAAC,qBAA6B;AAC9D,WAAK,OAAO,OAAO,kCAAkC,QAAQ,KAAK,MAAM,gBAAgB,CAAC;AAAA,IAC7F;AAQA,SAAA,8BAA8B,CAAC,SAAiB;AAC5C,WAAK,OAAO,OAAO,4BAA4B,QAAQ,IAAuB;AAAA,IAClF;AAMA,SAAA,wBAAwB,CAAC,iBAAyB;AAC9C,YAAM,SAAS,KAAK,MAAM,YAAY;AACtC,WAAK,OAAO,OAAO,sBAAsB,QAAQ,MAAM;AAAA,I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AAC;AAAA,IAC/E;AA1aI,SAAK,SAAS;AACd,SAAK,cAAc;AAAA,EACvB;AAyaJ;;"}
1
+ {"version":3,"file":"SubscriberController.cjs.js","sources":["../../../src/controllers/SubscriberController.ts"],"sourcesContent":["import { Id, RuntimeConfigType } from '../types/CommonTypes';\nimport { WellKnownConfigurationKeys } from '../types/ConfigurationTypes';\nimport { ListVariable, ListVariableItem, Variable, VariableType } from '../types/VariableTypes';\nimport { ViewMode } from '../types/ViewModeTypes';\nimport { ConnectorCompatibilityTools } from '../utils/ConnectorCompatibilityTools';\nimport { ToolType } from '../utils/Enums';\nimport { MeasurementUnit } from '../types/LayoutTypes';\nimport { ActionAsyncError, DataRowAsyncError } from '../exceptions';\n\n/**\n * The SubscriberController is responsible for all listeners which can influence the application-state from outside.\n * Callbacks inside this controller can be set by `window.SDK.subscriber.{method-name}`\n */\nexport class SubscriberController {\n /**\n * @ignore\n */\n private config: RuntimeConfigType;\n\n /**\n * @ignore\n */\n private localConfig: Map<string, string>;\n\n /**\n * @ignore\n */\n constructor(config: RuntimeConfigType, localConfig: Map<string, string>) {\n this.config = config;\n this.localConfig = localConfig;\n }\n\n /**\n * Listener on actions, if this changes, this listener will get triggered with the updates\n * @param actions Stringified array of DocumentAction type\n */\n onActionsChanged = (actions: string) => {\n this.config.events.onActionsChanged.trigger(JSON.parse(actions));\n };\n\n /**\n * Listener on when a certain animation gets changed\n * @param animation Stringified array of FrameAnimationType\n */\n onAnimationChanged = (animation: string) => {\n this.config.events.onFrameAnimationsChanged.trigger(JSON.parse(animation));\n };\n\n /**\n * Listener on the playback state of the animation, it contains the current time of the playback (in milliseconds) and a flag that describes if the animation is currently playing\n * @param animationPlaybackState Stringified array of AnimationPlaybackType\n */\n onAnimationPlaybackChanged = (animationPlaybackState: string) => {\n this.config.events.onScrubberPositionChanged.trigger(JSON.parse(animationPlaybackState));\n };\n\n /**\n * Listener on the state of the currently selected layout, if its properties are changed, this listener will get triggered with the new properties\n * @param layoutProperties Stringified object of LayoutPropertiesType\n */\n onSelectedLayoutPropertiesChanged = (layoutProperties: string) => {\n this.config.events.onSelectedLayoutPropertiesChanged.trigger(JSON.parse(layoutProperties));\n };\n\n /**\n * Listener on the unit of the currently active layout. If you switch between layouts with different units, this listener will get triggered with the new unit\n * If you switch the unit of a layout this listener will get triggered with the new unit\n *\n * @param unit Stringified object of MeasurementUnit\n */\n onSelectedLayoutUnitChanged = (unit: string) => {\n this.config.events.onSelectedLayoutUnitChanged.trigger(unit as MeasurementUnit);\n };\n\n /**\n * Listener on the state of all frames, if this changes, this listener will get triggered with the updates\n * @param framesLayout Stringified array of FrameLayoutType objects\n */\n onFramesLayoutChanged = (framesLayout: string) => {\n const frames = JSON.parse(framesLayout);\n this.config.events.onFramesLayoutChanged.trigger(frames);\n };\n\n /**\n * Listener on the state of the currently selected frames, if this changes, this listener will get triggered with the updates\n * @param framesLayout Stringified array of FrameLayoutType objects\n */\n onSelectedFramesLayoutChanged = (framesLayout: string) => {\n const frames = JSON.parse(framesLayout);\n this.config.events.onSelectedFramesLayoutChanged.trigger(frames);\n\n const singleFrameCallBack = this.config.onSelectedFrameLayoutChanged;\n singleFrameCallBack && singleFrameCallBack(frames.length > 1 ? undefined : frames[0]);\n };\n\n /**\n * Listener on the state of the currently selected frame, it contains some basic information on the type of frame it is\n * @param framesContent Stringified array of Frame objects\n */\n onSelectedFramesContentChanged = (framesContent: string) => {\n const frames = JSON.parse(framesContent);\n this.config.events.onSelectedFramesContentChanged.trigger(frames);\n\n const singleFrameCallBack = this.config.onSelectedFrameContentChanged;\n singleFrameCallBack && singleFrameCallBack(frames.length > 1 ? null : frames[0]);\n };\n\n /**\n * Listener on the general state of the document, gets triggered every time a change is done on the document.\n */\n onStateChanged = () => {\n this.config.events.onStateChanged.trigger();\n };\n\n /**\n * Listener on authentication expiration.\n * The callback should resolve to the refreshed authentication. If the\n * listener is not defined, the http requests from the connector will return\n * 401 with no refetch of assets.\n *\n * When this emits it means either:\n * - the grafxToken needs to be renewed\n * - any other authentication needs to be renewed (user impersonation, static..)\n *\n * @param authRefreshRequest Stringified object of AuthRefreshRequest\n */\n onAuthExpired = async (authRefreshRequest: string) => {\n const authCredentials = await this.config.handlers.onAuthExpired.trigger(JSON.parse(authRefreshRequest));\n return authCredentials != null ? JSON.stringify(authCredentials) : null;\n };\n\n /**\n * Listener on viewport request.\n * The callback should resolve to the visible viewport. If the\n * listener is not defined, the viewport will take full size.\n *\n * When this emits it means that the engine requested the viewport for a\n * zoom to page call.\n */\n onViewportRequested = () => {\n const viewport = this.config.handlers.onViewportRequested.trigger();\n return viewport != null ? JSON.stringify(viewport) : null;\n };\n\n /**\n * Listener on when the document is fully loaded.\n */\n onDocumentLoaded = () => {\n this.config.events.onDocumentLoaded.trigger();\n };\n\n /**\n * @deprecated use `onSelectedPageIdChanged` instead\n * To be implemented, gets triggered when clicking on the pageTitle on the canvas.\n */\n onPageSelectionChanged = (id: Id) => {\n this.config.events.onPageSelectionChanged.trigger(id);\n };\n\n /**\n * Listener on when variables change\n * @param variablesJson Stringified array of Variable\n */\n onVariableListChanged = (variablesJson: string) => {\n const parsed = JSON.parse(variablesJson) as Variable[];\n\n const updated = parsed.map((variable) =>\n variable.type === VariableType.list\n ? {\n ...variable,\n items: ((variable as ListVariable).items as unknown as ListVariableItem[]).map(\n (item) => item.value,\n ),\n selected: ((variable as ListVariable).selected as unknown as ListVariableItem | undefined)?.value,\n }\n : variable,\n );\n\n this.config.events.onVariableListChanged.trigger(updated);\n };\n\n /**\n * Listener on when the tool has changed by the canvas\n * @param tool the string representation of a certain tool\n */\n onSelectedToolChanged = (tool: string) => {\n this.config.events.onSelectedToolChanged.trigger(tool as ToolType);\n };\n\n /**\n * Listener on state changes\n * @param undoState Stringified object of UndoState\n */\n onUndoStateChanged = (undoState: string) => {\n this.config.events.onUndoStackStateChanged.trigger(JSON.parse(undoState));\n };\n\n /**\n * Listener on custom undo data changes\n *\n * @param customData Stringified object of custom undo data\n */\n onCustomUndoDataChanged = (customData: string) => {\n this.config.events.onCustomUndoDataChanged.trigger(JSON.parse(customData));\n };\n\n /**\n * Listener on the state of the currently selected layout's frames, if this changes, this listener will get triggered with the updates\n * @param layoutFrames Stringified object of Frames\n */\n onSelectedLayoutFramesChanged = (layoutFrames: string) => {\n this.config.events.onSelectedLayoutFramesChanged.trigger(JSON.parse(layoutFrames));\n };\n\n /**\n * Listener on the state of the currently selected text's styles, if this changes, this listener will get triggered with the updates\n * @param styles Stringified object of styles\n */\n onSelectedTextStyleChanged = (styles: string) => {\n this.config.events.onSelectedTextStyleChanged.trigger(JSON.parse(styles));\n };\n\n /**\n * Listener on the state of the currently selected color's styles, if this changes, this listener will get triggered with the updates\n * @param colors Stringified object of colors\n */\n onColorsChanged = (colors: string) => {\n this.config.events.onColorsChanged.trigger(JSON.parse(colors));\n };\n\n /**\n * Listener on paragraph styles, if this changes, this listener will get triggered with the updates\n * @param paragraphStyles Stringified object of paragraph styles\n */\n onParagraphStylesChanged = (paragraphStyles: string) => {\n this.config.events.onParagraphStylesChanged.trigger(JSON.parse(paragraphStyles));\n };\n\n /**\n * Listener on character styles, if this changes, this listener will get triggered with the updates\n * @param characterStyles Stringified object of character styles\n */\n onCharacterStylesChanged = (characterStyles: string) => {\n this.config.events.onCharacterStylesChanged.trigger(JSON.parse(characterStyles));\n };\n\n /**\n * Listener on fonts, if this changes, this listener will get triggered with the updates\n * @param fonts Stringified object of font families\n */\n onFontFamiliesChanged = (fonts: string) => {\n this.config.events.onFontFamiliesChanged.trigger(JSON.parse(fonts));\n };\n\n /**\n * Listener on selected layout id, this listener will get triggered when a different layout is selected.\n * @param id the currently selected layout id\n */\n onSelectedLayoutIdChanged = (id: Id) => {\n this.config.events.onSelectedLayoutIdChanged.trigger(id);\n };\n\n /**\n * Listener on layouts, this listener will get triggered when a (sub)layout is\n * - created\n * - removed\n * - renamed\n * - duplicated\n * @param layouts Stringified object of layouts\n */\n onLayoutsChanged = (layouts: string) => {\n this.config.events.onLayoutsChanged.trigger(JSON.parse(layouts));\n };\n\n /**\n * Listener on scale factor of the canvas, this listener will get triggered when a zoom is applied to the canvas\n * @param zoom Stringified scale factor\n */\n onZoomChanged = (zoom: string) => {\n this.config.events.onZoomChanged.trigger(JSON.parse(zoom));\n };\n\n /**\n * Listener on connector events, this listener will get triggered when a connector emits one of those events\n * - reloadRequired\n * - authChanged\n * - unloaded\n * - stateChanged\n *\n * stateChanged - this event will be triggered by connector states: loading, loaded, running, ready, error\n * @param connectorEvent Stringified object of ConnectorEvent\n */\n onConnectorEvent = (connectorEvent: string) => {\n this.config.events.onConnectorEvent.trigger(JSON.parse(connectorEvent));\n };\n\n /**\n * Listener on connectors, if this changes, this listener will get triggered with the updates\n * @param connectors Stringified array of ConnectorInstance type\n */\n onConnectorsChanged = (connectors: string) => {\n const connectorCompatibilityTools = new ConnectorCompatibilityTools();\n const compatibleConnectors = connectorCompatibilityTools.makeMultipleConnectorsBackwardsCompatible(\n JSON.parse(connectors),\n this.localConfig.get(WellKnownConfigurationKeys.GraFxStudioEnvironmentApiUrl),\n );\n this.config.events.onConnectorsChanged.trigger(compatibleConnectors);\n };\n\n /**\n * @experimental\n * Listener on when the selectedPageID is changed.\n * @param pageId Stringified pageId\n */\n onSelectedPageIdChanged = (pageId: string) => {\n this.config.events.onSelectedPageIdChanged.trigger(pageId);\n };\n\n /**\n * @experimental\n * Listener on pages list, this listener will get triggered when the pages are updated.\n * @param pages Stringified object of the pages\n */\n onPagesChanged = (pages: string) => {\n this.config.events.onPagesChanged.trigger(JSON.parse(pages));\n };\n\n /**\n * @experimental\n * Listener on pages snapshots, this will fire when a page snapshot is invalidated and should be updated.\n * @param pageId id of the page\n */\n onPageSnapshotInvalidated = (pageId: Id) => {\n this.config.events.onPageSnapshotInvalidated.trigger(pageId);\n };\n /**\n * Listener on page size, this listener will get triggered when the page size is changed, while the document is a `project`.\n * This will not emit anything if your document is a `template`.\n * @param pageSize Stringified object of the PageSize\n */\n onPageSizeChanged = (pageSize: string) => {\n this.config.events.onPageSizeChanged.trigger(JSON.parse(pageSize));\n };\n\n /**\n * Listener on corner radii of rectangle and polygon shapes, this listener will get triggered when any corner radius is changed\n * @param cornerRadius Stringified object of the CornerRadius\n */\n onShapeCornerRadiusChanged = (cornerRadius: string) => {\n this.config.events.onShapeCornerRadiusChanged.trigger(JSON.parse(cornerRadius));\n };\n\n /**\n * Listener of editor entering / exiting the crop mode\n * @param id frame id when entering / null when exiting\n */\n onCropActiveFrameIdChanged = (id?: Id) => {\n this.config.events.onCropActiveFrameIdChanged.trigger(id);\n };\n\n /**\n * Listener on async errors.\n * Async errors are thrown at times not directly tied to SDK calls.\n * e.g. Getting an action error triggered after a late event.\n *\n * If this is an `ActionAsyncError`:\n * - `id` refers to the action id\n * - `event` refers to the event that triggered the action\n * - `eventChain` refers the chain of events that lead to the action, first\n * item being the closest parent.\n * @param asyncError error triggered asynchronously\n */\n onAsyncError = (asyncError: string) => {\n const parsedError = JSON.parse(asyncError);\n\n if (parsedError?.type === 'dataRow') {\n const dataRowException = new DataRowAsyncError(\n parsedError.count,\n parsedError.message,\n parsedError.exceptions,\n );\n\n this.config.events.onAsyncError.trigger(dataRowException);\n } else if (parsedError?.type === 'action') {\n const actionException = new ActionAsyncError(\n parsedError.message,\n parsedError.id,\n parsedError.event,\n parsedError.eventChain,\n );\n\n this.config.events.onAsyncError.trigger(actionException);\n } else {\n this.config.events.onAsyncError.trigger(parsedError);\n }\n };\n\n /**\n * Listener on when the view mode has changed\n * @param viewMode the string representation of a view mode\n */\n onViewModeChanged = (viewMode: string) => {\n this.config.events.onViewModeChanged.trigger(viewMode as ViewMode);\n };\n\n /**\n * Listener on when barcode frames change their validation state\n *\n * @param validationResults the json string representation of the validation results\n */\n onBarcodeValidationChanged = (validationResults: string) => {\n this.config.events.onBarcodeValidationChanged.trigger(JSON.parse(validationResults));\n };\n\n /**\n * Listener on when the data source has changed\n *\n * @param connectorId the id of the data connector\n */\n onDataSourceIdChanged = (connectorId?: Id) => {\n this.config.events.onDataSourceIdChanged.trigger(connectorId);\n };\n\n /**\n * Listener on when injected data has changed\n *\n * @param variableId the id of the injected data source variable\n */\n onInjectedDataChanged = (variableId: Id) => {\n this.config.events.onInjectedDataChanged.trigger(variableId);\n };\n\n /**\n * Listener on document issues, if this changes, this listener will get triggered with the updates\n * @param documentIssues Stringified object of document issues\n */\n onDocumentIssueListChanged = (documentIssues: string) => {\n this.config.events.onDocumentIssueListChanged.trigger(JSON.parse(documentIssues));\n };\n\n /**\n * Listener on engine editing mode, if this changes, this listener will get triggered with the updates\n * @param engineEditMode Stringified object of engine edit mode\n */\n onEngineEditModeChanged = (engineEditMode: string) => {\n this.config.events.onEngineEditModeChanged.trigger(JSON.parse(engineEditMode));\n };\n\n /**\n * Listener on brand kit media, if this changes, this listener will get triggered with the updates\n * @param brandKitMedia Stringified array of BrandKitMedia objects\n */\n onBrandKitMediaChanged = (brandKitMedia: string) => {\n this.config.events.onBrandKitMediaChanged.trigger(JSON.parse(brandKitMedia));\n };\n\n /**\n * Listener that fires when frames are manipulated (e.g. moved, resized, rotated, cropped, text changed) by the user.\n * Note: this event only fires when the manipulation was caused by direct user interaction on the canvas;\n * programmatic changes do not trigger this event.\n * @param frameIds Stringified array of frame Id strings\n */\n onCanvasFramesManipulated = (frameIds: string) => {\n this.config.events.onCanvasFramesManipulated.trigger(JSON.parse(frameIds));\n };\n}\n"],"names":["VariableType","ConnectorCompatibilityTools","WellKnownConfigurationKeys","DataRowAsyncError","ActionAsyncError"],"mappings":";;;;;;AAaO,MAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA,EAc9B,YAAY,QAA2B,aAAkC;AASzE,SAAA,mBAAmB,CAAC,YAAoB;AACpC,WAAK,OAAO,OAAO,iBAAiB,QAAQ,KAAK,MAAM,OAAO,CAAC;AAAA,IACnE;AAMA,SAAA,qBAAqB,CAAC,cAAsB;AACxC,WAAK,OAAO,OAAO,yBAAyB,QAAQ,KAAK,MAAM,SAAS,CAAC;AAAA,IAC7E;AAMA,SAAA,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AsB,QAAQ,WAAW;AAAA,IAChE;AAOA,SAAA,wBAAwB,CAAC,eAAmB;AACxC,WAAK,OAAO,OAAO,sBAAsB,QAAQ,UAAU;AAAA,IAC/D;AAMA,SAAA,6BAA6B,CAAC,mBAA2B;AACrD,WAAK,OAAO,OAAO,2BAA2B,QAAQ,KAAK,MAAM,cAAc,CAAC;AAAA,IACpF;AAMA,SAAA,0BAA0B,CAAC,mBAA2B;AAClD,WAAK,OAAO,OAAO,wBAAwB,QAAQ,KAAK,MAAM,cAAc,CAAC;AAAA,IACjF;AAMA,SAAA,yBAAyB,CAAC,kBAA0B;AAChD,WAAK,OAAO,OAAO,uBAAuB,QAAQ,KAAK,MAAM,aAAa,CAAC;AAAA,IAC/E;AAQA,SAAA,4BAA4B,CAAC,aAAqB;AAC9C,WAAK,OAAO,OAAO,0BAA0B,QAAQ,KAAK,MAAM,QAAQ,CAAC;AAAA,IAC7E;AApbI,SAAK,SAAS;AACd,SAAK,cAAc;AAAA,EACvB;AAmbJ;;"}
@@ -264,4 +264,11 @@ export declare class SubscriberController {
264
264
  * @param brandKitMedia Stringified array of BrandKitMedia objects
265
265
  */
266
266
  onBrandKitMediaChanged: (brandKitMedia: string) => void;
267
+ /**
268
+ * Listener that fires when frames are manipulated (e.g. moved, resized, rotated, cropped, text changed) by the user.
269
+ * Note: this event only fires when the manipulation was caused by direct user interaction on the canvas;
270
+ * programmatic changes do not trigger this event.
271
+ * @param frameIds Stringified array of frame Id strings
272
+ */
273
+ onCanvasFramesManipulated: (frameIds: string) => void;
267
274
  }
@@ -178,6 +178,9 @@ class SubscriberController {
178
178
  this.onBrandKitMediaChanged = (brandKitMedia) => {
179
179
  this.config.events.onBrandKitMediaChanged.trigger(JSON.parse(brandKitMedia));
180
180
  };
181
+ this.onCanvasFramesManipulated = (frameIds) => {
182
+ this.config.events.onCanvasFramesManipulated.trigger(JSON.parse(frameIds));
183
+ };
181
184
  this.config = config;
182
185
  this.localConfig = localConfig;
183
186
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriberController.es.js","sources":["../../../src/controllers/SubscriberController.ts"],"sourcesContent":["import { Id, RuntimeConfigType } from '../types/CommonTypes';\nimport { WellKnownConfigurationKeys } from '../types/ConfigurationTypes';\nimport { ListVariable, ListVariableItem, Variable, VariableType } from '../types/VariableTypes';\nimport { ViewMode } from '../types/ViewModeTypes';\nimport { ConnectorCompatibilityTools } from '../utils/ConnectorCompatibilityTools';\nimport { ToolType } from '../utils/Enums';\nimport { MeasurementUnit } from '../types/LayoutTypes';\nimport { ActionAsyncError, DataRowAsyncError } from '../exceptions';\n\n/**\n * The SubscriberController is responsible for all listeners which can influence the application-state from outside.\n * Callbacks inside this controller can be set by `window.SDK.subscriber.{method-name}`\n */\nexport class SubscriberController {\n /**\n * @ignore\n */\n private config: RuntimeConfigType;\n\n /**\n * @ignore\n */\n private localConfig: Map<string, string>;\n\n /**\n * @ignore\n */\n constructor(config: RuntimeConfigType, localConfig: Map<string, string>) {\n this.config = config;\n this.localConfig = localConfig;\n }\n\n /**\n * Listener on actions, if this changes, this listener will get triggered with the updates\n * @param actions Stringified array of DocumentAction type\n */\n onActionsChanged = (actions: string) => {\n this.config.events.onActionsChanged.trigger(JSON.parse(actions));\n };\n\n /**\n * Listener on when a certain animation gets changed\n * @param animation Stringified array of FrameAnimationType\n */\n onAnimationChanged = (animation: string) => {\n this.config.events.onFrameAnimationsChanged.trigger(JSON.parse(animation));\n };\n\n /**\n * Listener on the playback state of the animation, it contains the current time of the playback (in milliseconds) and a flag that describes if the animation is currently playing\n * @param animationPlaybackState Stringified array of AnimationPlaybackType\n */\n onAnimationPlaybackChanged = (animationPlaybackState: string) => {\n this.config.events.onScrubberPositionChanged.trigger(JSON.parse(animationPlaybackState));\n };\n\n /**\n * Listener on the state of the currently selected layout, if its properties are changed, this listener will get triggered with the new properties\n * @param layoutProperties Stringified object of LayoutPropertiesType\n */\n onSelectedLayoutPropertiesChanged = (layoutProperties: string) => {\n this.config.events.onSelectedLayoutPropertiesChanged.trigger(JSON.parse(layoutProperties));\n };\n\n /**\n * Listener on the unit of the currently active layout. If you switch between layouts with different units, this listener will get triggered with the new unit\n * If you switch the unit of a layout this listener will get triggered with the new unit\n *\n * @param unit Stringified object of MeasurementUnit\n */\n onSelectedLayoutUnitChanged = (unit: string) => {\n this.config.events.onSelectedLayoutUnitChanged.trigger(unit as MeasurementUnit);\n };\n\n /**\n * Listener on the state of all frames, if this changes, this listener will get triggered with the updates\n * @param framesLayout Stringified array of FrameLayoutType objects\n */\n onFramesLayoutChanged = (framesLayout: string) => {\n const frames = JSON.parse(framesLayout);\n this.config.events.onFramesLayoutChanged.trigger(frames);\n };\n\n /**\n * Listener on the state of the currently selected frames, if this changes, this listener will get triggered with the updates\n * @param framesLayout Stringified array of FrameLayoutType objects\n */\n onSelectedFramesLayoutChanged = (framesLayout: string) => {\n const frames = JSON.parse(framesLayout);\n this.config.events.onSelectedFramesLayoutChanged.trigger(frames);\n\n const singleFrameCallBack = this.config.onSelectedFrameLayoutChanged;\n singleFrameCallBack && singleFrameCallBack(frames.length > 1 ? undefined : frames[0]);\n };\n\n /**\n * Listener on the state of the currently selected frame, it contains some basic information on the type of frame it is\n * @param framesContent Stringified array of Frame objects\n */\n onSelectedFramesContentChanged = (framesContent: string) => {\n const frames = JSON.parse(framesContent);\n this.config.events.onSelectedFramesContentChanged.trigger(frames);\n\n const singleFrameCallBack = this.config.onSelectedFrameContentChanged;\n singleFrameCallBack && singleFrameCallBack(frames.length > 1 ? null : frames[0]);\n };\n\n /**\n * Listener on the general state of the document, gets triggered every time a change is done on the document.\n */\n onStateChanged = () => {\n this.config.events.onStateChanged.trigger();\n };\n\n /**\n * Listener on authentication expiration.\n * The callback should resolve to the refreshed authentication. If the\n * listener is not defined, the http requests from the connector will return\n * 401 with no refetch of assets.\n *\n * When this emits it means either:\n * - the grafxToken needs to be renewed\n * - any other authentication needs to be renewed (user impersonation, static..)\n *\n * @param authRefreshRequest Stringified object of AuthRefreshRequest\n */\n onAuthExpired = async (authRefreshRequest: string) => {\n const authCredentials = await this.config.handlers.onAuthExpired.trigger(JSON.parse(authRefreshRequest));\n return authCredentials != null ? JSON.stringify(authCredentials) : null;\n };\n\n /**\n * Listener on viewport request.\n * The callback should resolve to the visible viewport. If the\n * listener is not defined, the viewport will take full size.\n *\n * When this emits it means that the engine requested the viewport for a\n * zoom to page call.\n */\n onViewportRequested = () => {\n const viewport = this.config.handlers.onViewportRequested.trigger();\n return viewport != null ? JSON.stringify(viewport) : null;\n };\n\n /**\n * Listener on when the document is fully loaded.\n */\n onDocumentLoaded = () => {\n this.config.events.onDocumentLoaded.trigger();\n };\n\n /**\n * @deprecated use `onSelectedPageIdChanged` instead\n * To be implemented, gets triggered when clicking on the pageTitle on the canvas.\n */\n onPageSelectionChanged = (id: Id) => {\n this.config.events.onPageSelectionChanged.trigger(id);\n };\n\n /**\n * Listener on when variables change\n * @param variablesJson Stringified array of Variable\n */\n onVariableListChanged = (variablesJson: string) => {\n const parsed = JSON.parse(variablesJson) as Variable[];\n\n const updated = parsed.map((variable) =>\n variable.type === VariableType.list\n ? {\n ...variable,\n items: ((variable as ListVariable).items as unknown as ListVariableItem[]).map(\n (item) => item.value,\n ),\n selected: ((variable as ListVariable).selected as unknown as ListVariableItem | undefined)?.value,\n }\n : variable,\n );\n\n this.config.events.onVariableListChanged.trigger(updated);\n };\n\n /**\n * Listener on when the tool has changed by the canvas\n * @param tool the string representation of a certain tool\n */\n onSelectedToolChanged = (tool: string) => {\n this.config.events.onSelectedToolChanged.trigger(tool as ToolType);\n };\n\n /**\n * Listener on state changes\n * @param undoState Stringified object of UndoState\n */\n onUndoStateChanged = (undoState: string) => {\n this.config.events.onUndoStackStateChanged.trigger(JSON.parse(undoState));\n };\n\n /**\n * Listener on custom undo data changes\n *\n * @param customData Stringified object of custom undo data\n */\n onCustomUndoDataChanged = (customData: string) => {\n this.config.events.onCustomUndoDataChanged.trigger(JSON.parse(customData));\n };\n\n /**\n * Listener on the state of the currently selected layout's frames, if this changes, this listener will get triggered with the updates\n * @param layoutFrames Stringified object of Frames\n */\n onSelectedLayoutFramesChanged = (layoutFrames: string) => {\n this.config.events.onSelectedLayoutFramesChanged.trigger(JSON.parse(layoutFrames));\n };\n\n /**\n * Listener on the state of the currently selected text's styles, if this changes, this listener will get triggered with the updates\n * @param styles Stringified object of styles\n */\n onSelectedTextStyleChanged = (styles: string) => {\n this.config.events.onSelectedTextStyleChanged.trigger(JSON.parse(styles));\n };\n\n /**\n * Listener on the state of the currently selected color's styles, if this changes, this listener will get triggered with the updates\n * @param colors Stringified object of colors\n */\n onColorsChanged = (colors: string) => {\n this.config.events.onColorsChanged.trigger(JSON.parse(colors));\n };\n\n /**\n * Listener on paragraph styles, if this changes, this listener will get triggered with the updates\n * @param paragraphStyles Stringified object of paragraph styles\n */\n onParagraphStylesChanged = (paragraphStyles: string) => {\n this.config.events.onParagraphStylesChanged.trigger(JSON.parse(paragraphStyles));\n };\n\n /**\n * Listener on character styles, if this changes, this listener will get triggered with the updates\n * @param characterStyles Stringified object of character styles\n */\n onCharacterStylesChanged = (characterStyles: string) => {\n this.config.events.onCharacterStylesChanged.trigger(JSON.parse(characterStyles));\n };\n\n /**\n * Listener on fonts, if this changes, this listener will get triggered with the updates\n * @param fonts Stringified object of font families\n */\n onFontFamiliesChanged = (fonts: string) => {\n this.config.events.onFontFamiliesChanged.trigger(JSON.parse(fonts));\n };\n\n /**\n * Listener on selected layout id, this listener will get triggered when a different layout is selected.\n * @param id the currently selected layout id\n */\n onSelectedLayoutIdChanged = (id: Id) => {\n this.config.events.onSelectedLayoutIdChanged.trigger(id);\n };\n\n /**\n * Listener on layouts, this listener will get triggered when a (sub)layout is\n * - created\n * - removed\n * - renamed\n * - duplicated\n * @param layouts Stringified object of layouts\n */\n onLayoutsChanged = (layouts: string) => {\n this.config.events.onLayoutsChanged.trigger(JSON.parse(layouts));\n };\n\n /**\n * Listener on scale factor of the canvas, this listener will get triggered when a zoom is applied to the canvas\n * @param zoom Stringified scale factor\n */\n onZoomChanged = (zoom: string) => {\n this.config.events.onZoomChanged.trigger(JSON.parse(zoom));\n };\n\n /**\n * Listener on connector events, this listener will get triggered when a connector emits one of those events\n * - reloadRequired\n * - authChanged\n * - unloaded\n * - stateChanged\n *\n * stateChanged - this event will be triggered by connector states: loading, loaded, running, ready, error\n * @param connectorEvent Stringified object of ConnectorEvent\n */\n onConnectorEvent = (connectorEvent: string) => {\n this.config.events.onConnectorEvent.trigger(JSON.parse(connectorEvent));\n };\n\n /**\n * Listener on connectors, if this changes, this listener will get triggered with the updates\n * @param connectors Stringified array of ConnectorInstance type\n */\n onConnectorsChanged = (connectors: string) => {\n const connectorCompatibilityTools = new ConnectorCompatibilityTools();\n const compatibleConnectors = connectorCompatibilityTools.makeMultipleConnectorsBackwardsCompatible(\n JSON.parse(connectors),\n this.localConfig.get(WellKnownConfigurationKeys.GraFxStudioEnvironmentApiUrl),\n );\n this.config.events.onConnectorsChanged.trigger(compatibleConnectors);\n };\n\n /**\n * @experimental\n * Listener on when the selectedPageID is changed.\n * @param pageId Stringified pageId\n */\n onSelectedPageIdChanged = (pageId: string) => {\n this.config.events.onSelectedPageIdChanged.trigger(pageId);\n };\n\n /**\n * @experimental\n * Listener on pages list, this listener will get triggered when the pages are updated.\n * @param pages Stringified object of the pages\n */\n onPagesChanged = (pages: string) => {\n this.config.events.onPagesChanged.trigger(JSON.parse(pages));\n };\n\n /**\n * @experimental\n * Listener on pages snapshots, this will fire when a page snapshot is invalidated and should be updated.\n * @param pageId id of the page\n */\n onPageSnapshotInvalidated = (pageId: Id) => {\n this.config.events.onPageSnapshotInvalidated.trigger(pageId);\n };\n /**\n * Listener on page size, this listener will get triggered when the page size is changed, while the document is a `project`.\n * This will not emit anything if your document is a `template`.\n * @param pageSize Stringified object of the PageSize\n */\n onPageSizeChanged = (pageSize: string) => {\n this.config.events.onPageSizeChanged.trigger(JSON.parse(pageSize));\n };\n\n /**\n * Listener on corner radii of rectangle and polygon shapes, this listener will get triggered when any corner radius is changed\n * @param cornerRadius Stringified object of the CornerRadius\n */\n onShapeCornerRadiusChanged = (cornerRadius: string) => {\n this.config.events.onShapeCornerRadiusChanged.trigger(JSON.parse(cornerRadius));\n };\n\n /**\n * Listener of editor entering / exiting the crop mode\n * @param id frame id when entering / null when exiting\n */\n onCropActiveFrameIdChanged = (id?: Id) => {\n this.config.events.onCropActiveFrameIdChanged.trigger(id);\n };\n\n /**\n * Listener on async errors.\n * Async errors are thrown at times not directly tied to SDK calls.\n * e.g. Getting an action error triggered after a late event.\n *\n * If this is an `ActionAsyncError`:\n * - `id` refers to the action id\n * - `event` refers to the event that triggered the action\n * - `eventChain` refers the chain of events that lead to the action, first\n * item being the closest parent.\n * @param asyncError error triggered asynchronously\n */\n onAsyncError = (asyncError: string) => {\n const parsedError = JSON.parse(asyncError);\n\n if (parsedError?.type === 'dataRow') {\n const dataRowException = new DataRowAsyncError(\n parsedError.count,\n parsedError.message,\n parsedError.exceptions,\n );\n\n this.config.events.onAsyncError.trigger(dataRowException);\n } else if (parsedError?.type === 'action') {\n const actionException = new ActionAsyncError(\n parsedError.message,\n parsedError.id,\n parsedError.event,\n parsedError.eventChain,\n );\n\n this.config.events.onAsyncError.trigger(actionException);\n } else {\n this.config.events.onAsyncError.trigger(parsedError);\n }\n };\n\n /**\n * Listener on when the view mode has changed\n * @param viewMode the string representation of a view mode\n */\n onViewModeChanged = (viewMode: string) => {\n this.config.events.onViewModeChanged.trigger(viewMode as ViewMode);\n };\n\n /**\n * Listener on when barcode frames change their validation state\n *\n * @param validationResults the json string representation of the validation results\n */\n onBarcodeValidationChanged = (validationResults: string) => {\n this.config.events.onBarcodeValidationChanged.trigger(JSON.parse(validationResults));\n };\n\n /**\n * Listener on when the data source has changed\n *\n * @param connectorId the id of the data connector\n */\n onDataSourceIdChanged = (connectorId?: Id) => {\n this.config.events.onDataSourceIdChanged.trigger(connectorId);\n };\n\n /**\n * Listener on when injected data has changed\n *\n * @param variableId the id of the injected data source variable\n */\n onInjectedDataChanged = (variableId: Id) => {\n this.config.events.onInjectedDataChanged.trigger(variableId);\n };\n\n /**\n * Listener on document issues, if this changes, this listener will get triggered with the updates\n * @param documentIssues Stringified object of document issues\n */\n onDocumentIssueListChanged = (documentIssues: string) => {\n this.config.events.onDocumentIssueListChanged.trigger(JSON.parse(documentIssues));\n };\n\n /**\n * Listener on engine editing mode, if this changes, this listener will get triggered with the updates\n * @param engineEditMode Stringified object of engine edit mode\n */\n onEngineEditModeChanged = (engineEditMode: string) => {\n this.config.events.onEngineEditModeChanged.trigger(JSON.parse(engineEditMode));\n };\n\n /**\n * Listener on brand kit media, if this changes, this listener will get triggered with the updates\n * @param brandKitMedia Stringified array of BrandKitMedia objects\n */\n onBrandKitMediaChanged = (brandKitMedia: string) => {\n this.config.events.onBrandKitMediaChanged.trigger(JSON.parse(brandKitMedia));\n };\n}\n"],"names":[],"mappings":";;;;AAaO,MAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA,EAc9B,YAAY,QAA2B,aAAkC;AASzE,SAAA,mBAAmB,CAAC,YAAoB;AACpC,WAAK,OAAO,OAAO,iBAAiB,QAAQ,KAAK,MAAM,OAAO,CAAC;AAAA,IACnE;AAMA,SAAA,qBAAqB,CAAC,cAAsB;AACxC,WAAK,OAAO,OAAO,yBAAyB,QAAQ,KAAK,MAAM,SAAS,CAAC;AAAA,IAC7E;AAMA,SAAA,6BAA6B,CAAC,2BAAmC;AAC7D,WAAK,OAAO,OAAO,0BAA0B,QAAQ,KAAK,MAAM,sBAAsB,CAAC;AAAA,IAC3F;AAMA,SAAA,oCAAoC,CAAC,qBAA6B;AAC9D,WAAK,OAAO,OAAO,kCAAkC,QAAQ,KAAK,MAAM,gBAAgB,CAAC;AAAA,IAC7F;AAQA,SAAA,8BAA8B,CAAC,SAAiB;AAC5C,WAAK,OAAO,OAAO,4BAA4B,QAAQ,IAAuB;AAAA,IAClF;AAMA,SAAA,wBAAwB,CAAC,iBAAyB;AAC9C,YAAM,SAAS,K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uB,QAAQ,KAAK,MAAM,aAAa,CAAC;AAAA,IAC/E;AA1aI,SAAK,SAAS;AACd,SAAK,cAAc;AAAA,EACvB;AAyaJ;"}
1
+ {"version":3,"file":"SubscriberController.es.js","sources":["../../../src/controllers/SubscriberController.ts"],"sourcesContent":["import { Id, RuntimeConfigType } from '../types/CommonTypes';\nimport { WellKnownConfigurationKeys } from '../types/ConfigurationTypes';\nimport { ListVariable, ListVariableItem, Variable, VariableType } from '../types/VariableTypes';\nimport { ViewMode } from '../types/ViewModeTypes';\nimport { ConnectorCompatibilityTools } from '../utils/ConnectorCompatibilityTools';\nimport { ToolType } from '../utils/Enums';\nimport { MeasurementUnit } from '../types/LayoutTypes';\nimport { ActionAsyncError, DataRowAsyncError } from '../exceptions';\n\n/**\n * The SubscriberController is responsible for all listeners which can influence the application-state from outside.\n * Callbacks inside this controller can be set by `window.SDK.subscriber.{method-name}`\n */\nexport class SubscriberController {\n /**\n * @ignore\n */\n private config: RuntimeConfigType;\n\n /**\n * @ignore\n */\n private localConfig: Map<string, string>;\n\n /**\n * @ignore\n */\n constructor(config: RuntimeConfigType, localConfig: Map<string, string>) {\n this.config = config;\n this.localConfig = localConfig;\n }\n\n /**\n * Listener on actions, if this changes, this listener will get triggered with the updates\n * @param actions Stringified array of DocumentAction type\n */\n onActionsChanged = (actions: string) => {\n this.config.events.onActionsChanged.trigger(JSON.parse(actions));\n };\n\n /**\n * Listener on when a certain animation gets changed\n * @param animation Stringified array of FrameAnimationType\n */\n onAnimationChanged = (animation: string) => {\n this.config.events.onFrameAnimationsChanged.trigger(JSON.parse(animation));\n };\n\n /**\n * Listener on the playback state of the animation, it contains the current time of the playback (in milliseconds) and a flag that describes if the animation is currently playing\n * @param animationPlaybackState Stringified array of AnimationPlaybackType\n */\n onAnimationPlaybackChanged = (animationPlaybackState: string) => {\n this.config.events.onScrubberPositionChanged.trigger(JSON.parse(animationPlaybackState));\n };\n\n /**\n * Listener on the state of the currently selected layout, if its properties are changed, this listener will get triggered with the new properties\n * @param layoutProperties Stringified object of LayoutPropertiesType\n */\n onSelectedLayoutPropertiesChanged = (layoutProperties: string) => {\n this.config.events.onSelectedLayoutPropertiesChanged.trigger(JSON.parse(layoutProperties));\n };\n\n /**\n * Listener on the unit of the currently active layout. If you switch between layouts with different units, this listener will get triggered with the new unit\n * If you switch the unit of a layout this listener will get triggered with the new unit\n *\n * @param unit Stringified object of MeasurementUnit\n */\n onSelectedLayoutUnitChanged = (unit: string) => {\n this.config.events.onSelectedLayoutUnitChanged.trigger(unit as MeasurementUnit);\n };\n\n /**\n * Listener on the state of all frames, if this changes, this listener will get triggered with the updates\n * @param framesLayout Stringified array of FrameLayoutType objects\n */\n onFramesLayoutChanged = (framesLayout: string) => {\n const frames = JSON.parse(framesLayout);\n this.config.events.onFramesLayoutChanged.trigger(frames);\n };\n\n /**\n * Listener on the state of the currently selected frames, if this changes, this listener will get triggered with the updates\n * @param framesLayout Stringified array of FrameLayoutType objects\n */\n onSelectedFramesLayoutChanged = (framesLayout: string) => {\n const frames = JSON.parse(framesLayout);\n this.config.events.onSelectedFramesLayoutChanged.trigger(frames);\n\n const singleFrameCallBack = this.config.onSelectedFrameLayoutChanged;\n singleFrameCallBack && singleFrameCallBack(frames.length > 1 ? undefined : frames[0]);\n };\n\n /**\n * Listener on the state of the currently selected frame, it contains some basic information on the type of frame it is\n * @param framesContent Stringified array of Frame objects\n */\n onSelectedFramesContentChanged = (framesContent: string) => {\n const frames = JSON.parse(framesContent);\n this.config.events.onSelectedFramesContentChanged.trigger(frames);\n\n const singleFrameCallBack = this.config.onSelectedFrameContentChanged;\n singleFrameCallBack && singleFrameCallBack(frames.length > 1 ? null : frames[0]);\n };\n\n /**\n * Listener on the general state of the document, gets triggered every time a change is done on the document.\n */\n onStateChanged = () => {\n this.config.events.onStateChanged.trigger();\n };\n\n /**\n * Listener on authentication expiration.\n * The callback should resolve to the refreshed authentication. If the\n * listener is not defined, the http requests from the connector will return\n * 401 with no refetch of assets.\n *\n * When this emits it means either:\n * - the grafxToken needs to be renewed\n * - any other authentication needs to be renewed (user impersonation, static..)\n *\n * @param authRefreshRequest Stringified object of AuthRefreshRequest\n */\n onAuthExpired = async (authRefreshRequest: string) => {\n const authCredentials = await this.config.handlers.onAuthExpired.trigger(JSON.parse(authRefreshRequest));\n return authCredentials != null ? JSON.stringify(authCredentials) : null;\n };\n\n /**\n * Listener on viewport request.\n * The callback should resolve to the visible viewport. If the\n * listener is not defined, the viewport will take full size.\n *\n * When this emits it means that the engine requested the viewport for a\n * zoom to page call.\n */\n onViewportRequested = () => {\n const viewport = this.config.handlers.onViewportRequested.trigger();\n return viewport != null ? JSON.stringify(viewport) : null;\n };\n\n /**\n * Listener on when the document is fully loaded.\n */\n onDocumentLoaded = () => {\n this.config.events.onDocumentLoaded.trigger();\n };\n\n /**\n * @deprecated use `onSelectedPageIdChanged` instead\n * To be implemented, gets triggered when clicking on the pageTitle on the canvas.\n */\n onPageSelectionChanged = (id: Id) => {\n this.config.events.onPageSelectionChanged.trigger(id);\n };\n\n /**\n * Listener on when variables change\n * @param variablesJson Stringified array of Variable\n */\n onVariableListChanged = (variablesJson: string) => {\n const parsed = JSON.parse(variablesJson) as Variable[];\n\n const updated = parsed.map((variable) =>\n variable.type === VariableType.list\n ? {\n ...variable,\n items: ((variable as ListVariable).items as unknown as ListVariableItem[]).map(\n (item) => item.value,\n ),\n selected: ((variable as ListVariable).selected as unknown as ListVariableItem | undefined)?.value,\n }\n : variable,\n );\n\n this.config.events.onVariableListChanged.trigger(updated);\n };\n\n /**\n * Listener on when the tool has changed by the canvas\n * @param tool the string representation of a certain tool\n */\n onSelectedToolChanged = (tool: string) => {\n this.config.events.onSelectedToolChanged.trigger(tool as ToolType);\n };\n\n /**\n * Listener on state changes\n * @param undoState Stringified object of UndoState\n */\n onUndoStateChanged = (undoState: string) => {\n this.config.events.onUndoStackStateChanged.trigger(JSON.parse(undoState));\n };\n\n /**\n * Listener on custom undo data changes\n *\n * @param customData Stringified object of custom undo data\n */\n onCustomUndoDataChanged = (customData: string) => {\n this.config.events.onCustomUndoDataChanged.trigger(JSON.parse(customData));\n };\n\n /**\n * Listener on the state of the currently selected layout's frames, if this changes, this listener will get triggered with the updates\n * @param layoutFrames Stringified object of Frames\n */\n onSelectedLayoutFramesChanged = (layoutFrames: string) => {\n this.config.events.onSelectedLayoutFramesChanged.trigger(JSON.parse(layoutFrames));\n };\n\n /**\n * Listener on the state of the currently selected text's styles, if this changes, this listener will get triggered with the updates\n * @param styles Stringified object of styles\n */\n onSelectedTextStyleChanged = (styles: string) => {\n this.config.events.onSelectedTextStyleChanged.trigger(JSON.parse(styles));\n };\n\n /**\n * Listener on the state of the currently selected color's styles, if this changes, this listener will get triggered with the updates\n * @param colors Stringified object of colors\n */\n onColorsChanged = (colors: string) => {\n this.config.events.onColorsChanged.trigger(JSON.parse(colors));\n };\n\n /**\n * Listener on paragraph styles, if this changes, this listener will get triggered with the updates\n * @param paragraphStyles Stringified object of paragraph styles\n */\n onParagraphStylesChanged = (paragraphStyles: string) => {\n this.config.events.onParagraphStylesChanged.trigger(JSON.parse(paragraphStyles));\n };\n\n /**\n * Listener on character styles, if this changes, this listener will get triggered with the updates\n * @param characterStyles Stringified object of character styles\n */\n onCharacterStylesChanged = (characterStyles: string) => {\n this.config.events.onCharacterStylesChanged.trigger(JSON.parse(characterStyles));\n };\n\n /**\n * Listener on fonts, if this changes, this listener will get triggered with the updates\n * @param fonts Stringified object of font families\n */\n onFontFamiliesChanged = (fonts: string) => {\n this.config.events.onFontFamiliesChanged.trigger(JSON.parse(fonts));\n };\n\n /**\n * Listener on selected layout id, this listener will get triggered when a different layout is selected.\n * @param id the currently selected layout id\n */\n onSelectedLayoutIdChanged = (id: Id) => {\n this.config.events.onSelectedLayoutIdChanged.trigger(id);\n };\n\n /**\n * Listener on layouts, this listener will get triggered when a (sub)layout is\n * - created\n * - removed\n * - renamed\n * - duplicated\n * @param layouts Stringified object of layouts\n */\n onLayoutsChanged = (layouts: string) => {\n this.config.events.onLayoutsChanged.trigger(JSON.parse(layouts));\n };\n\n /**\n * Listener on scale factor of the canvas, this listener will get triggered when a zoom is applied to the canvas\n * @param zoom Stringified scale factor\n */\n onZoomChanged = (zoom: string) => {\n this.config.events.onZoomChanged.trigger(JSON.parse(zoom));\n };\n\n /**\n * Listener on connector events, this listener will get triggered when a connector emits one of those events\n * - reloadRequired\n * - authChanged\n * - unloaded\n * - stateChanged\n *\n * stateChanged - this event will be triggered by connector states: loading, loaded, running, ready, error\n * @param connectorEvent Stringified object of ConnectorEvent\n */\n onConnectorEvent = (connectorEvent: string) => {\n this.config.events.onConnectorEvent.trigger(JSON.parse(connectorEvent));\n };\n\n /**\n * Listener on connectors, if this changes, this listener will get triggered with the updates\n * @param connectors Stringified array of ConnectorInstance type\n */\n onConnectorsChanged = (connectors: string) => {\n const connectorCompatibilityTools = new ConnectorCompatibilityTools();\n const compatibleConnectors = connectorCompatibilityTools.makeMultipleConnectorsBackwardsCompatible(\n JSON.parse(connectors),\n this.localConfig.get(WellKnownConfigurationKeys.GraFxStudioEnvironmentApiUrl),\n );\n this.config.events.onConnectorsChanged.trigger(compatibleConnectors);\n };\n\n /**\n * @experimental\n * Listener on when the selectedPageID is changed.\n * @param pageId Stringified pageId\n */\n onSelectedPageIdChanged = (pageId: string) => {\n this.config.events.onSelectedPageIdChanged.trigger(pageId);\n };\n\n /**\n * @experimental\n * Listener on pages list, this listener will get triggered when the pages are updated.\n * @param pages Stringified object of the pages\n */\n onPagesChanged = (pages: string) => {\n this.config.events.onPagesChanged.trigger(JSON.parse(pages));\n };\n\n /**\n * @experimental\n * Listener on pages snapshots, this will fire when a page snapshot is invalidated and should be updated.\n * @param pageId id of the page\n */\n onPageSnapshotInvalidated = (pageId: Id) => {\n this.config.events.onPageSnapshotInvalidated.trigger(pageId);\n };\n /**\n * Listener on page size, this listener will get triggered when the page size is changed, while the document is a `project`.\n * This will not emit anything if your document is a `template`.\n * @param pageSize Stringified object of the PageSize\n */\n onPageSizeChanged = (pageSize: string) => {\n this.config.events.onPageSizeChanged.trigger(JSON.parse(pageSize));\n };\n\n /**\n * Listener on corner radii of rectangle and polygon shapes, this listener will get triggered when any corner radius is changed\n * @param cornerRadius Stringified object of the CornerRadius\n */\n onShapeCornerRadiusChanged = (cornerRadius: string) => {\n this.config.events.onShapeCornerRadiusChanged.trigger(JSON.parse(cornerRadius));\n };\n\n /**\n * Listener of editor entering / exiting the crop mode\n * @param id frame id when entering / null when exiting\n */\n onCropActiveFrameIdChanged = (id?: Id) => {\n this.config.events.onCropActiveFrameIdChanged.trigger(id);\n };\n\n /**\n * Listener on async errors.\n * Async errors are thrown at times not directly tied to SDK calls.\n * e.g. Getting an action error triggered after a late event.\n *\n * If this is an `ActionAsyncError`:\n * - `id` refers to the action id\n * - `event` refers to the event that triggered the action\n * - `eventChain` refers the chain of events that lead to the action, first\n * item being the closest parent.\n * @param asyncError error triggered asynchronously\n */\n onAsyncError = (asyncError: string) => {\n const parsedError = JSON.parse(asyncError);\n\n if (parsedError?.type === 'dataRow') {\n const dataRowException = new DataRowAsyncError(\n parsedError.count,\n parsedError.message,\n parsedError.exceptions,\n );\n\n this.config.events.onAsyncError.trigger(dataRowException);\n } else if (parsedError?.type === 'action') {\n const actionException = new ActionAsyncError(\n parsedError.message,\n parsedError.id,\n parsedError.event,\n parsedError.eventChain,\n );\n\n this.config.events.onAsyncError.trigger(actionException);\n } else {\n this.config.events.onAsyncError.trigger(parsedError);\n }\n };\n\n /**\n * Listener on when the view mode has changed\n * @param viewMode the string representation of a view mode\n */\n onViewModeChanged = (viewMode: string) => {\n this.config.events.onViewModeChanged.trigger(viewMode as ViewMode);\n };\n\n /**\n * Listener on when barcode frames change their validation state\n *\n * @param validationResults the json string representation of the validation results\n */\n onBarcodeValidationChanged = (validationResults: string) => {\n this.config.events.onBarcodeValidationChanged.trigger(JSON.parse(validationResults));\n };\n\n /**\n * Listener on when the data source has changed\n *\n * @param connectorId the id of the data connector\n */\n onDataSourceIdChanged = (connectorId?: Id) => {\n this.config.events.onDataSourceIdChanged.trigger(connectorId);\n };\n\n /**\n * Listener on when injected data has changed\n *\n * @param variableId the id of the injected data source variable\n */\n onInjectedDataChanged = (variableId: Id) => {\n this.config.events.onInjectedDataChanged.trigger(variableId);\n };\n\n /**\n * Listener on document issues, if this changes, this listener will get triggered with the updates\n * @param documentIssues Stringified object of document issues\n */\n onDocumentIssueListChanged = (documentIssues: string) => {\n this.config.events.onDocumentIssueListChanged.trigger(JSON.parse(documentIssues));\n };\n\n /**\n * Listener on engine editing mode, if this changes, this listener will get triggered with the updates\n * @param engineEditMode Stringified object of engine edit mode\n */\n onEngineEditModeChanged = (engineEditMode: string) => {\n this.config.events.onEngineEditModeChanged.trigger(JSON.parse(engineEditMode));\n };\n\n /**\n * Listener on brand kit media, if this changes, this listener will get triggered with the updates\n * @param brandKitMedia Stringified array of BrandKitMedia objects\n */\n onBrandKitMediaChanged = (brandKitMedia: string) => {\n this.config.events.onBrandKitMediaChanged.trigger(JSON.parse(brandKitMedia));\n };\n\n /**\n * Listener that fires when frames are manipulated (e.g. moved, resized, rotated, cropped, text changed) by the user.\n * Note: this event only fires when the manipulation was caused by direct user interaction on the canvas;\n * programmatic changes do not trigger this event.\n * @param frameIds Stringified array of frame Id strings\n */\n onCanvasFramesManipulated = (frameIds: string) => {\n this.config.events.onCanvasFramesManipulated.trigger(JSON.parse(frameIds));\n };\n}\n"],"names":[],"mappings":";;;;AAaO,MAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA,EAc9B,YAAY,QAA2B,aAAkC;AASzE,SAAA,mBAAmB,CAAC,YAAoB;AACpC,WAAK,OAAO,OAAO,iBAAiB,QAAQ,KAAK,MAAM,OAAO,CAAC;AAAA,IACnE;AAMA,SAAA,qBAAqB,CAAC,cAAsB;AACxC,WAAK,OAAO,OAAO,yBAAyB,QAAQ,KAAK,MAAM,SAAS,CAAC;AAAA,IAC7E;AAMA,SAAA,6BAA6B,CAAC,2BAAmC;AAC7D,WAAK,OA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AO,OAAO,sBAAsB,QAAQ,UAAU;AAAA,IAC/D;AAMA,SAAA,6BAA6B,CAAC,mBAA2B;AACrD,WAAK,OAAO,OAAO,2BAA2B,QAAQ,KAAK,MAAM,cAAc,CAAC;AAAA,IACpF;AAMA,SAAA,0BAA0B,CAAC,mBAA2B;AAClD,WAAK,OAAO,OAAO,wBAAwB,QAAQ,KAAK,MAAM,cAAc,CAAC;AAAA,IACjF;AAMA,SAAA,yBAAyB,CAAC,kBAA0B;AAChD,WAAK,OAAO,OAAO,uBAAuB,QAAQ,KAAK,MAAM,aAAa,CAAC;AAAA,IAC/E;AAQA,SAAA,4BAA4B,CAAC,aAAqB;AAC9C,WAAK,OAAO,OAAO,0BAA0B,QAAQ,KAAK,MAAM,QAAQ,CAAC;AAAA,IAC7E;AApbI,SAAK,SAAS;AACd,SAAK,cAAc;AAAA,EACvB;AAmbJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AsyncExceptions.cjs.js","sources":["../../../src/exceptions/AsyncExceptions.ts"],"sourcesContent":["import { ActionEditorEvent } from '../types/ActionTypes';\nimport { Id } from '../types/CommonTypes';\n\nexport interface ActionEventErrorData {\n event: ActionEditorEvent;\n actionIds: Id[];\n}\n\ninterface AsyncErrorBase {\n type: AsyncErrorType;\n message: string;\n}\n\nenum AsyncErrorType {\n action = 'action',\n dataRow = 'dataRow',\n}\n\ninterface ExceptionContext {\n variableId?: Id;\n}\n\ninterface EditorExceptionDto {\n type: string;\n code: number;\n message: string;\n context?: ExceptionContext;\n}\n\nexport class ActionAsyncError implements AsyncErrorBase {\n type: AsyncErrorType;\n id?: string;\n event?: ActionEditorEvent;\n eventChain?: ActionEventErrorData[];\n message: string;\n\n constructor(message: string, id?: string, event?: ActionEditorEvent, eventChain?: ActionEventErrorData[]) {\n this.type = AsyncErrorType.action;\n this.message = message;\n this.id = id;\n this.event = event;\n this.eventChain = eventChain;\n }\n}\n\nexport class DataRowAsyncError implements AsyncErrorBase {\n type: AsyncErrorType;\n count: number;\n exceptions: EditorExceptionDto[];\n message: string;\n\n constructor(count: number, message: string, exceptions: EditorExceptionDto[]) {\n this.type = AsyncErrorType.dataRow;\n this.count = count;\n this.message = message;\n this.exceptions = exceptions;\n }\n}\n\nexport type AsyncError = ActionAsyncError | DataRowAsyncError;\n"],"names":[],"mappings":";;AA6BO,MAAM,iBAA2C;AAAA,EAOpD,YAAY,SAAiB,IAAa,OAA2B,YAAqC;AACtG,SAAK,OAAO;AACZ,SAAK,UAAU;AACf,SAAK,KAAK;AACV,SAAK,QAAQ;AACb,SAAK,aAAa;AAAA,EACtB;AACJ;AAEO,MAAM,kBAA4C;AAAA,EAMrD,YAAY,OAAe,SAAiB,YAAkC;AAC1E,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,UAAU;AACf,SAAK,aAAa;AAAA,EACtB;AACJ;;;"}
1
+ {"version":3,"file":"AsyncExceptions.cjs.js","sources":["../../../src/exceptions/AsyncExceptions.ts"],"sourcesContent":["import { ActionEditorEvent } from '../types/ActionTypes';\nimport { Id } from '../types/CommonTypes';\n\nexport interface ActionEventErrorData {\n event: ActionEditorEvent;\n actionIds: Id[];\n}\n\ninterface AsyncErrorBase {\n type: AsyncErrorType;\n message: string;\n}\n\nenum AsyncErrorType {\n action = 'action',\n dataRow = 'dataRow',\n}\n\ninterface ExceptionContext {\n variableId?: Id;\n columnName?: string;\n}\n\ninterface EditorExceptionDto {\n type: string;\n code: number;\n message: string;\n context?: ExceptionContext;\n}\n\nexport class ActionAsyncError implements AsyncErrorBase {\n type: AsyncErrorType;\n id?: string;\n event?: ActionEditorEvent;\n eventChain?: ActionEventErrorData[];\n message: string;\n\n constructor(message: string, id?: string, event?: ActionEditorEvent, eventChain?: ActionEventErrorData[]) {\n this.type = AsyncErrorType.action;\n this.message = message;\n this.id = id;\n this.event = event;\n this.eventChain = eventChain;\n }\n}\n\nexport class DataRowAsyncError implements AsyncErrorBase {\n type: AsyncErrorType;\n count: number;\n exceptions: EditorExceptionDto[];\n message: string;\n\n constructor(count: number, message: string, exceptions: EditorExceptionDto[]) {\n this.type = AsyncErrorType.dataRow;\n this.count = count;\n this.message = message;\n this.exceptions = exceptions;\n }\n}\n\nexport type AsyncError = ActionAsyncError | DataRowAsyncError;\n"],"names":[],"mappings":";;AA8BO,MAAM,iBAA2C;AAAA,EAOpD,YAAY,SAAiB,IAAa,OAA2B,YAAqC;AACtG,SAAK,OAAO;AACZ,SAAK,UAAU;AACf,SAAK,KAAK;AACV,SAAK,QAAQ;AACb,SAAK,aAAa;AAAA,EACtB;AACJ;AAEO,MAAM,kBAA4C;AAAA,EAMrD,YAAY,OAAe,SAAiB,YAAkC;AAC1E,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,UAAU;AACf,SAAK,aAAa;AAAA,EACtB;AACJ;;;"}
@@ -14,6 +14,7 @@ declare enum AsyncErrorType {
14
14
  }
15
15
  interface ExceptionContext {
16
16
  variableId?: Id;
17
+ columnName?: string;
17
18
  }
18
19
  interface EditorExceptionDto {
19
20
  type: string;
@@ -1 +1 @@
1
- {"version":3,"file":"AsyncExceptions.es.js","sources":["../../../src/exceptions/AsyncExceptions.ts"],"sourcesContent":["import { ActionEditorEvent } from '../types/ActionTypes';\nimport { Id } from '../types/CommonTypes';\n\nexport interface ActionEventErrorData {\n event: ActionEditorEvent;\n actionIds: Id[];\n}\n\ninterface AsyncErrorBase {\n type: AsyncErrorType;\n message: string;\n}\n\nenum AsyncErrorType {\n action = 'action',\n dataRow = 'dataRow',\n}\n\ninterface ExceptionContext {\n variableId?: Id;\n}\n\ninterface EditorExceptionDto {\n type: string;\n code: number;\n message: string;\n context?: ExceptionContext;\n}\n\nexport class ActionAsyncError implements AsyncErrorBase {\n type: AsyncErrorType;\n id?: string;\n event?: ActionEditorEvent;\n eventChain?: ActionEventErrorData[];\n message: string;\n\n constructor(message: string, id?: string, event?: ActionEditorEvent, eventChain?: ActionEventErrorData[]) {\n this.type = AsyncErrorType.action;\n this.message = message;\n this.id = id;\n this.event = event;\n this.eventChain = eventChain;\n }\n}\n\nexport class DataRowAsyncError implements AsyncErrorBase {\n type: AsyncErrorType;\n count: number;\n exceptions: EditorExceptionDto[];\n message: string;\n\n constructor(count: number, message: string, exceptions: EditorExceptionDto[]) {\n this.type = AsyncErrorType.dataRow;\n this.count = count;\n this.message = message;\n this.exceptions = exceptions;\n }\n}\n\nexport type AsyncError = ActionAsyncError | DataRowAsyncError;\n"],"names":[],"mappings":"AA6BO,MAAM,iBAA2C;AAAA,EAOpD,YAAY,SAAiB,IAAa,OAA2B,YAAqC;AACtG,SAAK,OAAO;AACZ,SAAK,UAAU;AACf,SAAK,KAAK;AACV,SAAK,QAAQ;AACb,SAAK,aAAa;AAAA,EACtB;AACJ;AAEO,MAAM,kBAA4C;AAAA,EAMrD,YAAY,OAAe,SAAiB,YAAkC;AAC1E,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,UAAU;AACf,SAAK,aAAa;AAAA,EACtB;AACJ;"}
1
+ {"version":3,"file":"AsyncExceptions.es.js","sources":["../../../src/exceptions/AsyncExceptions.ts"],"sourcesContent":["import { ActionEditorEvent } from '../types/ActionTypes';\nimport { Id } from '../types/CommonTypes';\n\nexport interface ActionEventErrorData {\n event: ActionEditorEvent;\n actionIds: Id[];\n}\n\ninterface AsyncErrorBase {\n type: AsyncErrorType;\n message: string;\n}\n\nenum AsyncErrorType {\n action = 'action',\n dataRow = 'dataRow',\n}\n\ninterface ExceptionContext {\n variableId?: Id;\n columnName?: string;\n}\n\ninterface EditorExceptionDto {\n type: string;\n code: number;\n message: string;\n context?: ExceptionContext;\n}\n\nexport class ActionAsyncError implements AsyncErrorBase {\n type: AsyncErrorType;\n id?: string;\n event?: ActionEditorEvent;\n eventChain?: ActionEventErrorData[];\n message: string;\n\n constructor(message: string, id?: string, event?: ActionEditorEvent, eventChain?: ActionEventErrorData[]) {\n this.type = AsyncErrorType.action;\n this.message = message;\n this.id = id;\n this.event = event;\n this.eventChain = eventChain;\n }\n}\n\nexport class DataRowAsyncError implements AsyncErrorBase {\n type: AsyncErrorType;\n count: number;\n exceptions: EditorExceptionDto[];\n message: string;\n\n constructor(count: number, message: string, exceptions: EditorExceptionDto[]) {\n this.type = AsyncErrorType.dataRow;\n this.count = count;\n this.message = message;\n this.exceptions = exceptions;\n }\n}\n\nexport type AsyncError = ActionAsyncError | DataRowAsyncError;\n"],"names":[],"mappings":"AA8BO,MAAM,iBAA2C;AAAA,EAOpD,YAAY,SAAiB,IAAa,OAA2B,YAAqC;AACtG,SAAK,OAAO;AACZ,SAAK,UAAU;AACf,SAAK,KAAK;AACV,SAAK,QAAQ;AACb,SAAK,aAAa;AAAA,EACtB;AACJ;AAEO,MAAM,kBAA4C;AAAA,EAMrD,YAAY,OAAe,SAAiB,YAAkC;AAC1E,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,UAAU;AACf,SAAK,aAAa;AAAA,EACtB;AACJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Helpers.cjs.js","sources":["../../../src/exceptions/Helpers.ts"],"sourcesContent":["import { EditorResponse, Id } from '../types/CommonTypes';\nimport { connectorHttpErrorErrorCode, variableInvalidValueErrorCode } from './Codes';\nimport { ConnectorHttpError , VariableValueConstrainsViolationError } from './Exceptions';\n\nexport function throwEditorResponseError(response: EditorResponse<unknown>): never {\n const parsedError = response.error ?? 'Yikes, something went wrong';\n const parsedCause = {\n cause: {\n name: String(response.status),\n message: response.error ?? 'Yikes, something went wrong',\n },\n };\n\n if (response.status === connectorHttpErrorErrorCode) {\n const parsedErrorData = JSON.parse(response.data as string);\n const httpStatusCode = parsedErrorData['statusCode'] as number;\n\n throw new ConnectorHttpError(httpStatusCode, parsedError, parsedCause);\n } else {\n throw new Error(parsedError, parsedCause);\n }\n}\n\n\n\nfunction parseVariableConstraintError(errorMsg: string): { valid: boolean; variableId?: string } {\n // Only the listed formats are considered valid for constraint errors.\n // Extend with future use cases (i.e. character's limit error)\n const patterns = [\n /DateVariable '([^']+)' should not be part of excludedDays, \".*\" was given/,\n /DateVariable '([^']+)' expects \\$date to be > startDate:.*$/,\n /DateVariable '([^']+)' expects \\$date to be < endDate:.*$/,\n /NumberVariable '([^']+)' expects \\$extractedValue to be >= .+$/,\n /NumberVariable '([^']+)' expects \\$extractedValue to be <= .+$/,\n ];\n\n for (const pattern of patterns) {\n const match = errorMsg.match(pattern);\n if (match) {\n return { valid: true };\n }\n }\n return { valid: false };\n}\n\n/**\n * Variable-specific failure hook\n * Throws VariableValueConstrainsViolationError when the response matches a recognized constraint error;\n * otherwise returns so `getEditorResponseData` falls back to `throwEditorResponseError`.\n */\nexport function throwVariableException(response: EditorResponse<unknown>, context: { id: Id }): void {\n if (response.status === variableInvalidValueErrorCode && response.error) {\n const errorMsg = response.error;\n const parseResult = parseVariableConstraintError(errorMsg);\n\n if (parseResult.valid) {\n throw new VariableValueConstrainsViolationError(context, errorMsg, {\n cause: { name: String(response.status), message: errorMsg },\n });\n }\n }\n}\n"],"names":["connectorHttpErrorErrorCode","ConnectorHttpError","variableInvalidValueErrorCode","VariableValueConstrainsViolationError"],"mappings":";;;;AAIO,SAAS,yBAAyB,UAA0C;AAC/E,QAAM,cAAc,SAAS,SAAS;AACtC,QAAM,cAAc;AAAA,IAChB,OAAO;AAAA,MACH,MAAM,OAAO,SAAS,MAAM;AAAA,MAC5B,SAAS,SAAS,SAAS;AAAA,IAAA;AAAA,EAC/B;AAGJ,MAAI,SAAS,WAAWA,mCAA6B;AACjD,UAAM,kBAAkB,KAAK,MAAM,SAAS,IAAc;AAC1D,UAAM,iBAAiB,gBAAgB,YAAY;AAEnD,UAAM,IAAIC,WAAAA,mBAAmB,gBAAgB,aAAa,WAAW;AAAA,EACzE,OAAO;AACH,UAAM,IAAI,MAAM,aAAa,WAAW;AAAA,EAC5C;AACJ;AAIA,SAAS,6BAA6B,UAA2D;AAG7F,QAAM,WAAW;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAGJ,aAAW,WAAW,UAAU;AAC5B,UAAM,QAAQ,SAAS,MAAM,OAAO;AACpC,QAAI,OAAO;AACP,aAAO,EAAE,OAAO,KAAA;AAAA,IACpB;AAAA,EACJ;AACA,SAAO,EAAE,OAAO,MAAA;AACpB;AAOO,SAAS,uBAAuB,UAAmC,SAA2B;AACjG,MAAI,SAAS,WAAWC,uCAAiC,SAAS,OAAO;AACrE,UAAM,WAAW,SAAS;AAC1B,UAAM,cAAc,6BAA6B,QAAQ;AAEzD,QAAI,YAAY,OAAO;AACnB,YAAM,IAAIC,WAAAA,sCAAsC,SAAS,UAAU;AAAA,QAC/D,OAAO,EAAE,MAAM,OAAO,SAAS,MAAM,GAAG,SAAS,SAAA;AAAA,MAAS,CAC7D;AAAA,IACL;AAAA,EACJ;AACJ;;;"}
1
+ {"version":3,"file":"Helpers.cjs.js","sources":["../../../src/exceptions/Helpers.ts"],"sourcesContent":["import { EditorResponse, Id } from '../types/CommonTypes';\nimport { connectorHttpErrorErrorCode, variableInvalidValueErrorCode } from './Codes';\nimport { ConnectorHttpError, VariableValueConstrainsViolationError } from './Exceptions';\n\nexport function throwEditorResponseError(response: EditorResponse<unknown>): never {\n const parsedError = response.error ?? 'Yikes, something went wrong';\n const parsedCause = {\n cause: {\n name: String(response.status),\n message: response.error ?? 'Yikes, something went wrong',\n },\n };\n\n if (response.status === connectorHttpErrorErrorCode) {\n const parsedErrorData = JSON.parse(response.data as string);\n const httpStatusCode = parsedErrorData['statusCode'] as number;\n\n throw new ConnectorHttpError(httpStatusCode, parsedError, parsedCause);\n } else {\n throw new Error(parsedError, parsedCause);\n }\n}\n\nfunction parseVariableConstraintError(errorMsg: string): { valid: boolean; variableId?: string } {\n // Only the listed formats are considered valid for constraint errors.\n // Extend with future use cases (i.e. character's limit error)\n const patterns = [\n /DateVariable '([^']+)' should not be part of excludedDays, \".*\" was given/,\n /DateVariable '([^']+)' expects \\$date to be > startDate:.*$/,\n /DateVariable '([^']+)' expects \\$date to be < endDate:.*$/,\n /NumberVariable '([^']+)' expects \\$extractedValue to be >= .+$/,\n /NumberVariable '([^']+)' expects \\$extractedValue to be <= .+$/,\n ];\n\n for (const pattern of patterns) {\n const match = errorMsg.match(pattern);\n if (match) {\n return { valid: true };\n }\n }\n return { valid: false };\n}\n\n/**\n * Variable-specific failure hook\n * Throws VariableValueConstrainsViolationError when the response matches a recognized constraint error;\n * otherwise returns so `getEditorResponseData` falls back to `throwEditorResponseError`.\n */\nexport function throwVariableException(response: EditorResponse<unknown>, context: { id: Id }): void {\n if (response.status === variableInvalidValueErrorCode && response.error) {\n const errorMsg = response.error;\n const parseResult = parseVariableConstraintError(errorMsg);\n\n if (parseResult.valid) {\n throw new VariableValueConstrainsViolationError(context, errorMsg, {\n cause: { name: String(response.status), message: errorMsg },\n });\n }\n }\n}\n"],"names":["connectorHttpErrorErrorCode","ConnectorHttpError","variableInvalidValueErrorCode","VariableValueConstrainsViolationError"],"mappings":";;;;AAIO,SAAS,yBAAyB,UAA0C;AAC/E,QAAM,cAAc,SAAS,SAAS;AACtC,QAAM,cAAc;AAAA,IAChB,OAAO;AAAA,MACH,MAAM,OAAO,SAAS,MAAM;AAAA,MAC5B,SAAS,SAAS,SAAS;AAAA,IAAA;AAAA,EAC/B;AAGJ,MAAI,SAAS,WAAWA,mCAA6B;AACjD,UAAM,kBAAkB,KAAK,MAAM,SAAS,IAAc;AAC1D,UAAM,iBAAiB,gBAAgB,YAAY;AAEnD,UAAM,IAAIC,WAAAA,mBAAmB,gBAAgB,aAAa,WAAW;AAAA,EACzE,OAAO;AACH,UAAM,IAAI,MAAM,aAAa,WAAW;AAAA,EAC5C;AACJ;AAEA,SAAS,6BAA6B,UAA2D;AAG7F,QAAM,WAAW;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAGJ,aAAW,WAAW,UAAU;AAC5B,UAAM,QAAQ,SAAS,MAAM,OAAO;AACpC,QAAI,OAAO;AACP,aAAO,EAAE,OAAO,KAAA;AAAA,IACpB;AAAA,EACJ;AACA,SAAO,EAAE,OAAO,MAAA;AACpB;AAOO,SAAS,uBAAuB,UAAmC,SAA2B;AACjG,MAAI,SAAS,WAAWC,uCAAiC,SAAS,OAAO;AACrE,UAAM,WAAW,SAAS;AAC1B,UAAM,cAAc,6BAA6B,QAAQ;AAEzD,QAAI,YAAY,OAAO;AACnB,YAAM,IAAIC,WAAAA,sCAAsC,SAAS,UAAU;AAAA,QAC/D,OAAO,EAAE,MAAM,OAAO,SAAS,MAAM,GAAG,SAAS,SAAA;AAAA,MAAS,CAC7D;AAAA,IACL;AAAA,EACJ;AACJ;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Helpers.es.js","sources":["../../../src/exceptions/Helpers.ts"],"sourcesContent":["import { EditorResponse, Id } from '../types/CommonTypes';\nimport { connectorHttpErrorErrorCode, variableInvalidValueErrorCode } from './Codes';\nimport { ConnectorHttpError , VariableValueConstrainsViolationError } from './Exceptions';\n\nexport function throwEditorResponseError(response: EditorResponse<unknown>): never {\n const parsedError = response.error ?? 'Yikes, something went wrong';\n const parsedCause = {\n cause: {\n name: String(response.status),\n message: response.error ?? 'Yikes, something went wrong',\n },\n };\n\n if (response.status === connectorHttpErrorErrorCode) {\n const parsedErrorData = JSON.parse(response.data as string);\n const httpStatusCode = parsedErrorData['statusCode'] as number;\n\n throw new ConnectorHttpError(httpStatusCode, parsedError, parsedCause);\n } else {\n throw new Error(parsedError, parsedCause);\n }\n}\n\n\n\nfunction parseVariableConstraintError(errorMsg: string): { valid: boolean; variableId?: string } {\n // Only the listed formats are considered valid for constraint errors.\n // Extend with future use cases (i.e. character's limit error)\n const patterns = [\n /DateVariable '([^']+)' should not be part of excludedDays, \".*\" was given/,\n /DateVariable '([^']+)' expects \\$date to be > startDate:.*$/,\n /DateVariable '([^']+)' expects \\$date to be < endDate:.*$/,\n /NumberVariable '([^']+)' expects \\$extractedValue to be >= .+$/,\n /NumberVariable '([^']+)' expects \\$extractedValue to be <= .+$/,\n ];\n\n for (const pattern of patterns) {\n const match = errorMsg.match(pattern);\n if (match) {\n return { valid: true };\n }\n }\n return { valid: false };\n}\n\n/**\n * Variable-specific failure hook\n * Throws VariableValueConstrainsViolationError when the response matches a recognized constraint error;\n * otherwise returns so `getEditorResponseData` falls back to `throwEditorResponseError`.\n */\nexport function throwVariableException(response: EditorResponse<unknown>, context: { id: Id }): void {\n if (response.status === variableInvalidValueErrorCode && response.error) {\n const errorMsg = response.error;\n const parseResult = parseVariableConstraintError(errorMsg);\n\n if (parseResult.valid) {\n throw new VariableValueConstrainsViolationError(context, errorMsg, {\n cause: { name: String(response.status), message: errorMsg },\n });\n }\n }\n}\n"],"names":[],"mappings":";;AAIO,SAAS,yBAAyB,UAA0C;AAC/E,QAAM,cAAc,SAAS,SAAS;AACtC,QAAM,cAAc;AAAA,IAChB,OAAO;AAAA,MACH,MAAM,OAAO,SAAS,MAAM;AAAA,MAC5B,SAAS,SAAS,SAAS;AAAA,IAAA;AAAA,EAC/B;AAGJ,MAAI,SAAS,WAAW,6BAA6B;AACjD,UAAM,kBAAkB,KAAK,MAAM,SAAS,IAAc;AAC1D,UAAM,iBAAiB,gBAAgB,YAAY;AAEnD,UAAM,IAAI,mBAAmB,gBAAgB,aAAa,WAAW;AAAA,EACzE,OAAO;AACH,UAAM,IAAI,MAAM,aAAa,WAAW;AAAA,EAC5C;AACJ;AAIA,SAAS,6BAA6B,UAA2D;AAG7F,QAAM,WAAW;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAGJ,aAAW,WAAW,UAAU;AAC5B,UAAM,QAAQ,SAAS,MAAM,OAAO;AACpC,QAAI,OAAO;AACP,aAAO,EAAE,OAAO,KAAA;AAAA,IACpB;AAAA,EACJ;AACA,SAAO,EAAE,OAAO,MAAA;AACpB;AAOO,SAAS,uBAAuB,UAAmC,SAA2B;AACjG,MAAI,SAAS,WAAW,iCAAiC,SAAS,OAAO;AACrE,UAAM,WAAW,SAAS;AAC1B,UAAM,cAAc,6BAA6B,QAAQ;AAEzD,QAAI,YAAY,OAAO;AACnB,YAAM,IAAI,sCAAsC,SAAS,UAAU;AAAA,QAC/D,OAAO,EAAE,MAAM,OAAO,SAAS,MAAM,GAAG,SAAS,SAAA;AAAA,MAAS,CAC7D;AAAA,IACL;AAAA,EACJ;AACJ;"}
1
+ {"version":3,"file":"Helpers.es.js","sources":["../../../src/exceptions/Helpers.ts"],"sourcesContent":["import { EditorResponse, Id } from '../types/CommonTypes';\nimport { connectorHttpErrorErrorCode, variableInvalidValueErrorCode } from './Codes';\nimport { ConnectorHttpError, VariableValueConstrainsViolationError } from './Exceptions';\n\nexport function throwEditorResponseError(response: EditorResponse<unknown>): never {\n const parsedError = response.error ?? 'Yikes, something went wrong';\n const parsedCause = {\n cause: {\n name: String(response.status),\n message: response.error ?? 'Yikes, something went wrong',\n },\n };\n\n if (response.status === connectorHttpErrorErrorCode) {\n const parsedErrorData = JSON.parse(response.data as string);\n const httpStatusCode = parsedErrorData['statusCode'] as number;\n\n throw new ConnectorHttpError(httpStatusCode, parsedError, parsedCause);\n } else {\n throw new Error(parsedError, parsedCause);\n }\n}\n\nfunction parseVariableConstraintError(errorMsg: string): { valid: boolean; variableId?: string } {\n // Only the listed formats are considered valid for constraint errors.\n // Extend with future use cases (i.e. character's limit error)\n const patterns = [\n /DateVariable '([^']+)' should not be part of excludedDays, \".*\" was given/,\n /DateVariable '([^']+)' expects \\$date to be > startDate:.*$/,\n /DateVariable '([^']+)' expects \\$date to be < endDate:.*$/,\n /NumberVariable '([^']+)' expects \\$extractedValue to be >= .+$/,\n /NumberVariable '([^']+)' expects \\$extractedValue to be <= .+$/,\n ];\n\n for (const pattern of patterns) {\n const match = errorMsg.match(pattern);\n if (match) {\n return { valid: true };\n }\n }\n return { valid: false };\n}\n\n/**\n * Variable-specific failure hook\n * Throws VariableValueConstrainsViolationError when the response matches a recognized constraint error;\n * otherwise returns so `getEditorResponseData` falls back to `throwEditorResponseError`.\n */\nexport function throwVariableException(response: EditorResponse<unknown>, context: { id: Id }): void {\n if (response.status === variableInvalidValueErrorCode && response.error) {\n const errorMsg = response.error;\n const parseResult = parseVariableConstraintError(errorMsg);\n\n if (parseResult.valid) {\n throw new VariableValueConstrainsViolationError(context, errorMsg, {\n cause: { name: String(response.status), message: errorMsg },\n });\n }\n }\n}\n"],"names":[],"mappings":";;AAIO,SAAS,yBAAyB,UAA0C;AAC/E,QAAM,cAAc,SAAS,SAAS;AACtC,QAAM,cAAc;AAAA,IAChB,OAAO;AAAA,MACH,MAAM,OAAO,SAAS,MAAM;AAAA,MAC5B,SAAS,SAAS,SAAS;AAAA,IAAA;AAAA,EAC/B;AAGJ,MAAI,SAAS,WAAW,6BAA6B;AACjD,UAAM,kBAAkB,KAAK,MAAM,SAAS,IAAc;AAC1D,UAAM,iBAAiB,gBAAgB,YAAY;AAEnD,UAAM,IAAI,mBAAmB,gBAAgB,aAAa,WAAW;AAAA,EACzE,OAAO;AACH,UAAM,IAAI,MAAM,aAAa,WAAW;AAAA,EAC5C;AACJ;AAEA,SAAS,6BAA6B,UAA2D;AAG7F,QAAM,WAAW;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAGJ,aAAW,WAAW,UAAU;AAC5B,UAAM,QAAQ,SAAS,MAAM,OAAO;AACpC,QAAI,OAAO;AACP,aAAO,EAAE,OAAO,KAAA;AAAA,IACpB;AAAA,EACJ;AACA,SAAO,EAAE,OAAO,MAAA;AACpB;AAOO,SAAS,uBAAuB,UAAmC,SAA2B;AACjG,MAAI,SAAS,WAAW,iCAAiC,SAAS,OAAO;AACrE,UAAM,WAAW,SAAS;AAC1B,UAAM,cAAc,6BAA6B,QAAQ;AAEzD,QAAI,YAAY,OAAO;AACnB,YAAM,IAAI,sCAAsC,SAAS,UAAU;AAAA,QAC/D,OAAO,EAAE,MAAM,OAAO,SAAS,MAAM,GAAG,SAAS,SAAA;AAAA,MAAS,CAC7D;AAAA,IACL;AAAA,EACJ;AACJ;"}
@@ -8,8 +8,8 @@ const LayoutTypes = require("./types/LayoutTypes.cjs.js");
8
8
  const DocumentTypes = require("./types/DocumentTypes.cjs.js");
9
9
  const ViewModeTypes = require("./types/ViewModeTypes.cjs.js");
10
10
  const VariableTypes = require("./types/VariableTypes.cjs.js");
11
- const CommonTypes = require("./types/CommonTypes.cjs.js");
12
11
  const ColorStyleTypes = require("./types/ColorStyleTypes.cjs.js");
12
+ const CommonTypes = require("./types/CommonTypes.cjs.js");
13
13
  const GradientStyleTypes = require("./types/GradientStyleTypes.cjs.js");
14
14
  const ConnectorTypes = require("./types/ConnectorTypes.cjs.js");
15
15
  const FontConnectorTypes = require("./types/FontConnectorTypes.cjs.js");
@@ -75,9 +75,10 @@ exports.VariableType = VariableTypes.VariableType;
75
75
  exports.VariableVisibilityOperator = VariableTypes.VariableVisibilityOperator;
76
76
  exports.VariableVisibilityTargetType = VariableTypes.VariableVisibilityTargetType;
77
77
  exports.VariableVisibilityType = VariableTypes.VariableVisibilityType;
78
- exports.SDKUnauthorizedError = CommonTypes.SDKUnauthorizedError;
78
+ exports.APIColorType = ColorStyleTypes.APIColorType;
79
79
  exports.ColorType = ColorStyleTypes.ColorType;
80
80
  exports.ColorUsageType = ColorStyleTypes.ColorUsageType;
81
+ exports.SDKUnauthorizedError = CommonTypes.SDKUnauthorizedError;
81
82
  exports.GradientType = GradientStyleTypes.GradientType;
82
83
  exports.GradientUsageType = GradientStyleTypes.GradientUsageType;
83
84
  exports.AuthCredentialsTypeEnum = ConnectorTypes.AuthCredentialsTypeEnum;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -12,6 +12,7 @@ export type { FrameProperties, Layout, LayoutListItemType, LayoutPreset, LayoutP
12
12
  export { Day, Locale, VariableType, VariableVisibilityOperator, VariableVisibilityTargetType, VariableVisibilityType, DataSourceVariableDisplayOptionsType, DataSourceVariableSourceType, } from './types/VariableTypes';
13
13
  export type { AbsoluteDate, BooleanVariable, ConnectorImageVariableSource, DateRestriction, DateVariable, GroupVariable, ImageVariable, ListVariable, ListVariableItem, LongTextVariable, NumberVariable, RelativeDate, ShortTextVariable, ValueWithStyle, RichTextVariable, Variable, VariableVisibility, VariableVisibilityConditional, VariableVisibilityConditionValue, VariableVisibilityLayout, VariableWithValue, DataSourceVariable, DataSourceVariableDisplayOptions, DataSourceVariableDisplayOptionsList, DataSourceVariableDisplayOptionsTable, InjectedDataSourceVariableSource, ConnectorDataSourceVariableSource, DataSourceVariableSource, } from './types/VariableTypes';
14
14
  export type { Color, ColorUpdate, DocumentColor } from './types/ColorStyleTypes';
15
+ export { APIColorType } from './types/ColorStyleTypes';
15
16
  export type { AnimationPlaybackType, BasicAnimationsType, EaseTweenCombinationType, FrameAnimationPropertiesType, FrameAnimationType, } from './types/AnimationTypes';
16
17
  export type { ConfigType, EditorResponse, Id, InitialStateType, PageType, PrivateData, PropertyState, SelectedLayoutFrame, } from './types/CommonTypes';
17
18
  export { SDKUnauthorizedError } from './types/CommonTypes';
@@ -34,7 +35,7 @@ export * from './types/MediaConnectorTypes';
34
35
  export { Alignment, Case, FontWeights, Scripting, SelectedTextStyles, SelectedTextStyleSections, TextPosition, MarkedListType, } from './types/TextStyleTypes';
35
36
  export { NumberListFormat, NumberListSeparatorSymbol } from './types/ParagraphStyleTypes';
36
37
  export { WellKnownConfigurationKeys, FrameEditingMode } from './types/ConfigurationTypes';
37
- export type { APIBrandKit, APIBrandKitMedia, BrandKitCharacterStyle, BrandKitColor, BrandKitFont, APIBrandKitTheme, BrandKitMedia, BrandKitParagraphStyle, CMYK, CMYKColorValue, HEXColorValue, RGB, RGBColorValue, SpotCMYKColorValue, SpotHEXColorValue, SpotRGBColorValue, StudioBrandKit, BrandKitTheme, } from './types/BrandKitTypes';
38
+ export type { APIBrandKit, APIBrandKitMedia, APIBrandKitCharacterStyle, APIBrandKitColor, APIBrandKitFont, APIBrandKitTheme, BrandKitMedia, APIBrandKitParagraphStyle, CMYK, CMYKColorValue, HEXColorValue, RGB, RGBColorValue, SpotCMYKColorValue, SpotHEXColorValue, SpotRGBColorValue, BrandKit, } from './types/BrandKitTypes';
38
39
  export type { ComponentGridSettings, FixedComponentGridSettings } from './types/ComponentGridTypes';
39
40
  export { ComponentGridLayoutAlgorithm } from './types/ComponentGridTypes';
40
41
  export * from './types/ActionTypes';
@@ -6,8 +6,8 @@ import { ConstraintMode, LayoutIntent, LayoutType, PositionEnum } from "./types/
6
6
  import { DocumentIssueTypeEnum, DocumentType } from "./types/DocumentTypes.es.js";
7
7
  import { ViewMode } from "./types/ViewModeTypes.es.js";
8
8
  import { DataSourceVariableDisplayOptionsType, DataSourceVariableSourceType, Day, Locale, VariableType, VariableVisibilityOperator, VariableVisibilityTargetType, VariableVisibilityType } from "./types/VariableTypes.es.js";
9
+ import { APIColorType, ColorType, ColorUsageType } from "./types/ColorStyleTypes.es.js";
9
10
  import { SDKUnauthorizedError } from "./types/CommonTypes.es.js";
10
- import { ColorType, ColorUsageType } from "./types/ColorStyleTypes.es.js";
11
11
  import { GradientType, GradientUsageType } from "./types/GradientStyleTypes.es.js";
12
12
  import { AuthCredentialsTypeEnum, AuthRefreshTypeEnum, ConnectorConfigContextType, ConnectorConfigValueType, ConnectorEventType, ConnectorMapping, ConnectorMappingDirection, ConnectorMappingSource, ConnectorRegistrationSource, ConnectorStateType, ConnectorSupportedAuth, ConnectorType, DeprecatedMediaConnectorDownloadType, DeprecatedMediaType, GrafxTokenAuthCredentials, MediaType, RefreshedAuthCredendentials, SortBy, SortOrder, UploadAssetValidationError, UploadAssetValidationErrorType, grafxMediaConnectorRegistration } from "./types/ConnectorTypes.es.js";
13
13
  import { FontPreviewFormat } from "./types/FontConnectorTypes.es.js";
@@ -27,6 +27,7 @@ import { ActionAsyncError, DataRowAsyncError } from "./exceptions/AsyncException
27
27
  import * as index from "./next/index.es.js";
28
28
  import { MeasurementUnit } from "./connector-types/src/Common.es.js";
29
29
  export {
30
+ APIColorType,
30
31
  ActionAsyncError,
31
32
  ActionEditorEvent,
32
33
  Alignment,
@@ -188,7 +188,8 @@ const Connect = (editorLink, params, setConnection, editorId = "chili-editor", s
188
188
  documentIssueListChanged: params.onDocumentIssueListChanged,
189
189
  customUndoDataChanged: params.onCustomUndoDataChanged,
190
190
  engineEditingModeChanged: params.onEngineEditModeChanged,
191
- brandKitMediaChanged: params.onBrandKitMediaChanged
191
+ brandKitMediaChanged: params.onBrandKitMediaChanged,
192
+ frameManipulated: params.onCanvasFramesManipulated
192
193
  }
193
194
  })
194
195
  );