@kizenapps/engine 1.9.3 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ThirdPartyScript-BkCjYWLd.d.ts → ThirdPartyScript-DxPk6YJY.d.ts} +16 -4
- package/dist/{automation-BuZbZjRB.d.ts → automation-WGLB_R74.d.ts} +1 -1
- package/dist/{blocks-1HdzUin7.d.ts → blocks-BOnF4OcC.d.ts} +2 -2
- package/dist/{chunk-ZJEUSM6D.js → chunk-634UTGPV.js} +3 -3
- package/dist/{chunk-ZJEUSM6D.js.map → chunk-634UTGPV.js.map} +1 -1
- package/dist/{chunk-I6M7IOUN.js → chunk-A35SDJRQ.js} +31 -9
- package/dist/chunk-A35SDJRQ.js.map +1 -0
- package/dist/{chunk-Z5EJLAOV.js → chunk-IAFKDUUO.js} +3 -3
- package/dist/{chunk-Z5EJLAOV.js.map → chunk-IAFKDUUO.js.map} +1 -1
- package/dist/{chunk-KOHHWIU2.js → chunk-JWNY3CVG.js} +3 -3
- package/dist/{chunk-KOHHWIU2.js.map → chunk-JWNY3CVG.js.map} +1 -1
- package/dist/{chunk-QL5TKJNY.js → chunk-NY7WM2BO.js} +5 -5
- package/dist/{chunk-QL5TKJNY.js.map → chunk-NY7WM2BO.js.map} +1 -1
- package/dist/{chunk-3DIQOQD4.js → chunk-RK33JALB.js} +3 -3
- package/dist/{chunk-3DIQOQD4.js.map → chunk-RK33JALB.js.map} +1 -1
- package/dist/{chunk-LBQKIZYB.js → chunk-TXMNM4A6.js} +3 -3
- package/dist/{chunk-LBQKIZYB.js.map → chunk-TXMNM4A6.js.map} +1 -1
- package/dist/{chunk-DEQQUMNQ.js → chunk-XNFBWPQ7.js} +12 -3
- package/dist/chunk-XNFBWPQ7.js.map +1 -0
- package/dist/{chunk-CDGV5N5I.js → chunk-ZZ75DJI4.js} +4 -4
- package/dist/{chunk-CDGV5N5I.js.map → chunk-ZZ75DJI4.js.map} +1 -1
- package/dist/communication.d.ts +2 -2
- package/dist/communication.js +2 -2
- package/dist/contexts/base.d.ts +1 -1
- package/dist/contexts/base.js +4 -4
- package/dist/contexts/floatingFrame.d.ts +1 -1
- package/dist/contexts/floatingFrame.js +5 -5
- package/dist/contexts/recordDetail.d.ts +1 -1
- package/dist/contexts/recordDetail.js +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +4 -4
- package/dist/react.d.ts +18 -16
- package/dist/react.js +28 -12
- package/dist/react.js.map +1 -1
- package/dist/types.d.ts +5 -5
- package/dist/util.d.ts +28 -6
- package/dist/util.js +62 -10
- package/dist/util.js.map +1 -1
- package/dist/{values-08CsQDfa.d.ts → values-ClHf3SXM.d.ts} +4 -3
- package/dist/workers/calendarSource.worker.js +6 -6
- package/dist/workers/floatingFrame.worker.js +7 -7
- package/dist/workers/generic.worker.js +6 -6
- package/dist/workers/recordDetail.worker.js +7 -7
- package/package.json +1 -1
- package/dist/chunk-DEQQUMNQ.js.map +0 -1
- package/dist/chunk-I6M7IOUN.js.map +0 -1
|
@@ -44,6 +44,7 @@ interface PartialClientObject {
|
|
|
44
44
|
interface SelectOption {
|
|
45
45
|
label: string;
|
|
46
46
|
value: string;
|
|
47
|
+
disabled?: string;
|
|
47
48
|
}
|
|
48
49
|
interface PartialLocation {
|
|
49
50
|
host: string;
|
|
@@ -225,7 +226,7 @@ interface AssistantLink {
|
|
|
225
226
|
type IncludeOption = 'email' | 'name' | 'business_id' | 'user_id' | 'base_url';
|
|
226
227
|
interface AssistantField {
|
|
227
228
|
key: string;
|
|
228
|
-
type: 'custom_object' | 'description' | 'container' | 'field' | 'text' | 'number' | 'select' | 'boolean' | 'qr' | 'image' | 'link';
|
|
229
|
+
type: 'custom_object' | 'description' | 'container' | 'field' | 'text' | 'number' | 'select' | 'radio' | 'api_key' | 'boolean' | 'qr' | 'image' | 'link';
|
|
229
230
|
columns?: number;
|
|
230
231
|
fields?: AssistantField[];
|
|
231
232
|
content?: string;
|
|
@@ -234,6 +235,7 @@ interface AssistantField {
|
|
|
234
235
|
default?: string;
|
|
235
236
|
options?: SelectOption[];
|
|
236
237
|
allow_multiple?: boolean;
|
|
238
|
+
secret?: string;
|
|
237
239
|
placeholder?: string;
|
|
238
240
|
when?: string;
|
|
239
241
|
getFetchUrl?: string;
|
|
@@ -296,12 +298,22 @@ type SelectCleanValue = SelectOption | SelectOption[];
|
|
|
296
298
|
interface SelectValueStore {
|
|
297
299
|
value: SelectOption | SelectOption[];
|
|
298
300
|
}
|
|
301
|
+
type RadioCleanValue = SelectOption;
|
|
302
|
+
interface RadioValueStore {
|
|
303
|
+
value: SelectOption;
|
|
304
|
+
}
|
|
305
|
+
interface ApiKeyValueStore {
|
|
306
|
+
type?: 'api_key';
|
|
307
|
+
value?: string;
|
|
308
|
+
hasValue?: boolean;
|
|
309
|
+
maskedValue?: string;
|
|
310
|
+
}
|
|
299
311
|
type TextCleanValue = string;
|
|
300
312
|
interface TextValueStore {
|
|
301
313
|
value: string;
|
|
302
314
|
}
|
|
303
|
-
type ValueStore = BooleanValueStore | CustomObjectValueStore | FieldValueStore | NumberValueStore | SelectValueStore | TextValueStore;
|
|
304
|
-
type CleanValueStoreType = BooleanCleanValue | CustomObjectCleanValue | FieldCleanValue | NumberCleanValue | SelectCleanValue | TextCleanValue;
|
|
315
|
+
type ValueStore = BooleanValueStore | CustomObjectValueStore | FieldValueStore | NumberValueStore | SelectValueStore | RadioValueStore | ApiKeyValueStore | TextValueStore;
|
|
316
|
+
type CleanValueStoreType = BooleanCleanValue | CustomObjectCleanValue | FieldCleanValue | NumberCleanValue | SelectCleanValue | RadioCleanValue | TextCleanValue;
|
|
305
317
|
type CleanValueStore = Record<string, CleanValueStoreType>;
|
|
306
318
|
type OnShowModalFn = (config: ModalConfig, cb: (result?: UnknownJSON) => void) => void;
|
|
307
319
|
type OnCloseModalFn = (values?: UnknownJSON, canceled?: boolean) => void;
|
|
@@ -533,4 +545,4 @@ declare class ThirdPartyScript {
|
|
|
533
545
|
call(...params: unknown[]): void;
|
|
534
546
|
}
|
|
535
547
|
|
|
536
|
-
export { type
|
|
548
|
+
export { type CurriedInstallThirdPartyScriptFn as $, type Args as A, type BaseAPI as B, type CurrentUser as C, type DataCache as D, type ButtonConfig as E, type CleanValueStore as F, type GetOptions as G, type CleanValueStoreType as H, type Instance as I, type JSONValue as J, type CloseModalFn as K, type CompleteSetupFn as L, type ModalConfig as M, type CompleteSetupLevel as N, type ConfigService as O, type PartialEntity as P, type ConsoleLogLevel as Q, type RequestWithErrorsResponse as R, type StateChangePayload as S, ThirdPartyScript as T, type UnknownJSON as U, type CreateRecordModalQueue as V, type WorkerContextArgs as W, type CreateRelatedRecordModalQueue as X, type CurriedCloseModalFn as Y, type CurriedCompleteSetupFn as Z, type CurriedDynamicPromptFn as _, type PartialCustomObject as a, type SetupAssistantConfig as a$, type CurriedKizenRequestFn as a0, type CurriedOpenCreateRecordFn as a1, type CurriedOpenCreateRelatedRecordFn as a2, type CurriedPostFormDataFn as a3, type CurriedPromptFn as a4, type CurriedRefreshEntityFn as a5, type CurriedShowViewInModalFn as a6, type CurriedUploadFileFn as a7, type CustomObjectCleanValue as a8, type CustomObjectValueStore as a9, type NumberCleanValue as aA, type NumberValueStore as aB, type OnCloseModalFn as aC, type OnNetworkErrorFn as aD, type OnShowCreateRecordModalFn as aE, type OnShowCreateRelatedRecordModalFn as aF, type OnShowModalFn as aG, type OpenCreateRecordFn as aH, type OpenCreateRelatedRecordFn as aI, type PartialRelatedObject as aJ, type PatchReturnValue as aK, type PostFormDataPayload as aL, type PostReturnValue as aM, type Profile as aN, type PromiseMap as aO, type PromiseReject as aP, type PromiseResolve as aQ, type PromiseState as aR, type PromptFn as aS, type PutReturnValue as aT, type RadioCleanValue as aU, type RadioValueStore as aV, type RefreshEntityFn as aW, type ReleaseBlockingScriptHandler as aX, type SelectCleanValue as aY, type SelectValueStore as aZ, type SetInternalSessionDataFn as a_, type DataCacheEntry as aa, type DeleteReturnValue as ab, type DynamicPromptFn as ac, type EmployeeConfig as ad, type ErrorHandler as ae, type ErrorResponse as af, type FieldCleanValue as ag, type FieldValueStore as ah, type GetReturnValue as ai, type InstallThirdPartyScriptFn as aj, type JSONArray as ak, type JSONObject as al, type JSONPrimitive as am, type KizenConfig as an, type KizenNetworkResponse as ao, type KizenProxySuccessResponse as ap, type KizenRequestFn as aq, type KizenRequestFnHandler as ar, type KnownArgs as as, type MatchSetupAssistantField as at, type MaybeMessageError as au, type ModalBlock as av, type ModalCancelEventSource as aw, type ModalContainer as ax, type ModalQueue as ay, type ModalSize as az, type PartialUser as b, type ShowViewInModalFn as b0, type TextValueStore as b1, type UnknownFunction as b2, type UploadFileData as b3, type UploadFileFn as b4, type UserConfig as b5, type ValueStore as b6, modalSize as b7, KizenRequestError as b8, ACTIONS as b9, ALLOWED_INTEGRATIONS as ba, INDICATOR_TYPE as bb, IFRAME_PREFIX as bc, type PartialTeamMember as c, type PartialBusiness as d, type PartialClientObject as e, type PostFormDataFn as f, type PromptState as g, type InternalSessionData as h, type PartialLocation as i, type CompleteSetupOptions as j, type RequestOptions as k, type ShowToastOptions as l, type ShowViewInModalOptions as m, type DynamicPromptConfig as n, type ConsoleBridge as o, type IncludeOption as p, type SetupAssistantField as q, type AppPlugin as r, type SelectOption as s, type ApiKeyValueStore as t, type AppPlugins as u, type AssistantConfigAction as v, type AssistantField as w, type AssistantLink as x, type BooleanCleanValue as y, type BooleanValueStore as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b9 as ACTIONS, U as UnknownJSON, ba as ALLOWED_INTEGRATIONS, j as CompleteSetupOptions, Q as ConsoleLogLevel, M as ModalConfig, S as StateChangePayload, l as ShowToastOptions, h as InternalSessionData, m as ShowViewInModalOptions, a_ as SetInternalSessionDataFn, aG as OnShowModalFn, aE as OnShowCreateRecordModalFn, aF as OnShowCreateRelatedRecordModalFn, aC as OnCloseModalFn, aD as OnNetworkErrorFn, W as WorkerContextArgs, ad as EmployeeConfig } from './ThirdPartyScript-DxPk6YJY.js';
|
|
2
2
|
import { H as HideConfig, S as ShowConfig } from './floatingFrames-BzaoL7cq.js';
|
|
3
3
|
import { B as BuildIframeURLWithProxyOptions } from './frames-AOHUyPDP.js';
|
|
4
4
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as CommonExecutionPlugin, c as CommonPluginDefinition } from './automation-
|
|
2
|
-
import { U as UnknownJSON } from './ThirdPartyScript-
|
|
1
|
+
import { b as CommonExecutionPlugin, c as CommonPluginDefinition } from './automation-WGLB_R74.js';
|
|
2
|
+
import { U as UnknownJSON } from './ThirdPartyScript-DxPk6YJY.js';
|
|
3
3
|
|
|
4
4
|
interface GenericPluginConfig extends CommonPluginDefinition {
|
|
5
5
|
api_name: string;
|
|
@@ -66,7 +66,7 @@ var INDICATOR_TYPE = /* @__PURE__ */ ((INDICATOR_TYPE2) => {
|
|
|
66
66
|
var ROUTE_CHANGE_INTERNAL_EVENT = "integration:route-change";
|
|
67
67
|
var ROUTE_CHANGE_IFRAME_EVENT = "kizen-route-change";
|
|
68
68
|
var IFRAME_PREFIX = "kzn-integration-frame";
|
|
69
|
-
var PKG_VERSION = "1.
|
|
69
|
+
var PKG_VERSION = "1.10.0";
|
|
70
70
|
var BASE_QUERY_KEY = ["__plugin_engine", PKG_VERSION];
|
|
71
71
|
var QUERY_KEYS = {
|
|
72
72
|
CALENDAR_SOURCE_CALENDAR_LIST: (pluginApiName, sourceApiName) => [...BASE_QUERY_KEY, "calendar-source", "calendar-list", pluginApiName, sourceApiName],
|
|
@@ -175,5 +175,5 @@ var ThirdPartyScript = class {
|
|
|
175
175
|
};
|
|
176
176
|
|
|
177
177
|
export { ACTIONS, COMMUNICATIONS, IFRAME_PREFIX, INDICATOR_TYPE, QUERY_KEYS, RESPONSES, ROUTE_CHANGE_IFRAME_EVENT, ROUTE_CHANGE_INTERNAL_EVENT, ThirdPartyScript, getScriptIntegrationType, thirdPartyGlobalNames, thirdPartyReadyPredicates, thirdPartySetupScripts };
|
|
178
|
-
//# sourceMappingURL=chunk-
|
|
179
|
-
//# sourceMappingURL=chunk-
|
|
178
|
+
//# sourceMappingURL=chunk-634UTGPV.js.map
|
|
179
|
+
//# sourceMappingURL=chunk-634UTGPV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/communication/constants.ts","../src/communication/ThirdPartyScript.ts"],"names":["INDICATOR_TYPE"],"mappings":";AAAO,IAAM,OAAA,GAAU;AAAA,EACrB,aAAA,EAAe,eAAA;AAAA,EACf,SAAA,EAAW,UAAA;AAAA,EACX,aAAA,EAAe,cAAA;AAAA,EACf,oBAAA,EAAsB,sBAAA;AAAA,EACtB,QAAA,EAAU,UAAA;AAAA,EACV,IAAA,EAAM,MAAA;AAAA,EACN,GAAA,EAAK,KAAA;AAAA,EACL,WAAA,EAAa,YAAA;AAAA,EACb,WAAA,EAAa,aAAA;AAAA,EACb,IAAA,EAAM,MAAA;AAAA,EACN,IAAA,EAAM,MAAA;AAAA,EACN,MAAA,EAAQ,QAAA;AAAA,EACR,QAAA,EAAU,UAAA;AAAA,EACV,WAAA,EAAa,YAAA;AAAA,EACb,WAAA,EAAa,YAAA;AAAA,EACb,gCAAA,EAAkC,+BAAA;AAAA,EAClC,wCAAA,EAA0C,sCAAA;AAAA,EAC1C,UAAA,EAAY,WAAA;AAAA,EACZ,YAAA,EAAc,aAAA;AAAA,EACd,gBAAA,EAAkB,iBAAA;AAAA,EAClB,cAAA,EAAgB,eAAA;AAAA,EAChB,kBAAA,EAAoB,oBAAA;AAAA,EACpB,mBAAA,EAAqB,mBAAA;AAAA,EACrB,kCAAA,EAAoC,iCAAA;AAAA,EACpC,cAAA,EAAgB,gBAAA;AAAA;AAAA;AAAA,EAGhB,sBAAA,EAAwB,uBAAA;AAAA,EACxB,uBAAA,EAAyB,uBAAA;AAAA,EACzB,SAAA,EAAW,WAAA;AAAA,EACX,iBAAA,EAAmB,iBAAA;AAAA,EACnB,0BAAA,EAA4B,yB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,SAAA;AAAA,EACA,WAAA;AAAA,EAER,WAAA,CAAY,UAAoB,SAAA,EAAmB;AACjD,IAAA,IAAA,CAAK,QAAA,GAAW,QAAA;AAChB,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AACjB,IAAA,MAAM,IAAA,GAAO,yBAAyB,SAAS,CAAA;AAE/C,IAAA,IAAI,IAAA,EAAM;AACR,MAAA,IAAA,CAAK,WAAA,GAAc,IAAA;AAAA,IACrB,CAAA,MAAO;AACL,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,8BAAA,EAAiC,SAAS,CAAA,CAAE,CAAA;AAAA,IAC9D;AAAA,EACF;AAAA,EAEA,IAAI,IAAA,GAAyE;AAC3E,IAAA,OAAO,IAAA,CAAK,WAAA;AAAA,EACd;AAAA,EAEO,QAAQ,MAAA,EAAyB;AACtC,IAAA,IAAA,CAAK,QAAA,CAAS,WAAA;AAAA,MACZ,KAAK,SAAA,CAAU;AAAA,QACb,QAAQ,OAAA,CAAQ,WAAA;AAAA,QAChB,MAAM,cAAA,CAAe,uBAAA;AAAA,QACrB,SAAA,EAAW,CAAA,WAAA,EAAc,cAAA,CAAe,uBAAuB,CAAA,CAAA;AAAA,QAC/D,SAAA,EAAW;AAAA,UACT,QAAQ,IAAA,CAAK,SAAA;AAAA,UACb,MAAM,IAAA,CAAK;AAAA,SACb;AAAA,QACA;AAAA,OACD;AAAA,KACH;AAAA,EACF;AACF","file":"chunk-ZJEUSM6D.js","sourcesContent":["export const ACTIONS = {\n QUERY_REQUEST: 'query:request',\n UI_OUTPUT: 'outputui',\n IFRAME_OUTPUT: 'iframeoutput',\n POSTFORMDATA_REQUEST: 'postformdata:request',\n SETSTATE: 'setstate',\n DONE: 'done',\n RUN: 'run',\n OPEN_WINDOW: 'openwindow',\n COMMUNICATE: 'communicate',\n HIDE: 'hide',\n SHOW: 'show',\n EXPAND: 'expand',\n COLLAPSE: 'collapse',\n HIDE_HEADER: 'hideheader',\n SHOW_HEADER: 'showheader',\n OPEN_CREATE_RECORD_MODAL_REQUEST: 'opencreaterecordmodal:request',\n OPEN_CREATE_RELATED_RECORD_MODAL_REQUEST: 'opencreaterelatedrecordmodal:request',\n SHOW_TOAST: 'showtoast',\n CLEAR_TOASTS: 'cleartoasts',\n REFRESH_TIMELINE: 'refreshtimeline',\n REFRESH_ENTITY: 'refreshentity',\n UPLOADFILE_REQUEST: 'uploadfile:request',\n UPDATE_SESSION_DATA: 'updatesessiondata',\n INSTALL_THIRD_PARTY_SCRIPT_REQUEST: 'installthirdpartyscript:request',\n PROMPT_REQUEST: 'prompt:request',\n // Note: We have a special request for dynamic prompts, but the regular response is sufficient\n // and no special dynamic one is needed\n DYNAMIC_PROMPT_REQUEST: 'dynamicprompt:request',\n RELEASE_BLOCKING_SCRIPT: 'releaseblockingscript',\n AUTHORIZE: 'authorize',\n COPY_TO_CLIPBOARD: 'copytoclipboard',\n SHOW_VIEW_IN_MODAL_REQUEST: 'showviewinmodal:request',\n CLOSE_MODAL_REQUEST: 'closemodal:request',\n CONSOLE_LOG: 'consolelog',\n RUN_EVENT_SCRIPT: 'runeventscript',\n COMPLETE_SETUP_REQUEST: 'completesetup:request',\n};\n\nexport const RESPONSES = {\n QUERY_RESPONSE: 'query:response',\n POSTFORMDATA_RESPONSE: 'postformdata:response',\n ERROR: 'error',\n UPLOADFILE_RESPONSE: 'uploadfile:response',\n UPLOADFILE_PROGRESS: 'uploadfile:progress',\n INSTALL_THIRD_PARTY_SCRIPT_RESPONSE: 'installthirdpartyscript:response',\n PROMPT_RESPONSE: 'prompt:response',\n REFRESH_ENTITY_RESPONSE: 'refreshentity:response',\n CREATE_RECORD_RESPONSE: 'createrecord:response',\n CREATE_RELATED_RECORD_RESPONSE: 'createrelatedrecord:response',\n COMPLETE_SETUP_RESPONSE: 'completesetup:response',\n};\n\nexport const COMMUNICATIONS = {\n RUN_FRAME_SCRIPT: 'runframescript',\n RUN_BLOCK_SCRIPT: 'runblockscript',\n SEND_MESSAGE_TO_FRAME: 'sendmessagetoframe',\n CALL_THIRD_PARTY_SCRIPT: 'callthirdpartyscript',\n};\n\nexport enum INDICATOR_TYPE {\n NONE = 'none',\n BLOCK = 'block',\n BUTTON = 'button',\n SPINNER = 'spinner',\n}\n\nexport const ROUTE_CHANGE_INTERNAL_EVENT = 'integration:route-change';\nexport const ROUTE_CHANGE_IFRAME_EVENT = 'kizen-route-change';\nexport const IFRAME_PREFIX = 'kzn-integration-frame';\n\nconst PKG_VERSION = __PKG_VERSION__;\n\nconst BASE_QUERY_KEY = ['__plugin_engine', PKG_VERSION] as const;\n\nexport const QUERY_KEYS = {\n CALENDAR_SOURCE_CALENDAR_LIST: (pluginApiName: string, sourceApiName: string) =>\n [...BASE_QUERY_KEY, 'calendar-source', 'calendar-list', pluginApiName, sourceApiName] as const,\n CALENDAR_SOURCE_EVENTS: (\n pluginApiName: string,\n sourceApiName: string,\n calendarId: string,\n params: unknown,\n ) =>\n [\n ...BASE_QUERY_KEY,\n 'calendar-source',\n 'events',\n pluginApiName,\n sourceApiName,\n calendarId,\n params,\n ] as const,\n};\n","import type { Instance } from '../types/contexts.js';\nimport { ACTIONS, COMMUNICATIONS } from './constants.js';\n\nconst freshWorksPattern = /https:\\/\\/.*widget\\.freshworks\\.com\\/.*\\.js/;\nconst intercomPattern = /https:\\/\\/widget\\.intercom\\.io\\/widget\\/[a-z0-9]+/;\n\nexport const ALLOWED_INTEGRATIONS = {\n FRESHWORKS: 'freshworks',\n INTERCOM: 'intercom',\n} as const;\n\n/*\n Third party scripts must match an approved regex, and arbitrary scripts cannot be\n loaded by a plugin if they do not.\n*/\nexport const getScriptIntegrationType = (\n scriptUrl: string,\n): (typeof ALLOWED_INTEGRATIONS)[keyof typeof ALLOWED_INTEGRATIONS] | undefined => {\n if (freshWorksPattern.test(scriptUrl)) {\n return ALLOWED_INTEGRATIONS.FRESHWORKS;\n }\n\n if (intercomPattern.test(scriptUrl)) {\n return ALLOWED_INTEGRATIONS.INTERCOM;\n }\n};\n\n/* \n The global name of the third-party integration. This is the variable where the\n integration code can be called from. For example, if the third-party integration\n is 'Freshworks', function calls will be made like window.FreshworksWidget(...args).\n*/\nexport const thirdPartyGlobalNames = {\n [ALLOWED_INTEGRATIONS.FRESHWORKS]: 'FreshworksWidget',\n [ALLOWED_INTEGRATIONS.INTERCOM]: 'Intercom',\n};\n\n/*\n For a predefined third-party integration, the setup script will be run\n BEFORE the third party javascript has been loaded.\n*/\nexport const thirdPartySetupScripts = {\n [ALLOWED_INTEGRATIONS.FRESHWORKS]: (args: Record<string, unknown>) => {\n (window as unknown as Record<string, unknown>).fwSettings = {\n widget_id: args.widgetId,\n };\n\n // Function adapted from https://developers.freshdesk.com/widget-api/#introduction\n (function (...rest) {\n if (\n 'function' !=\n typeof (window as unknown as Record<string, unknown>)[\n thirdPartyGlobalNames[ALLOWED_INTEGRATIONS.FRESHWORKS]\n ]\n ) {\n const n: { q: unknown[]; __kizen_pending?: boolean } = function () {\n n.q.push(...rest);\n };\n\n n.__kizen_pending = true;\n\n // eslint-disable-next-line\n ((n.q = []), ((window as any)[thirdPartyGlobalNames[ALLOWED_INTEGRATIONS.FRESHWORKS]] = n));\n }\n })();\n },\n // Function adapted from https://developers.intercom.com/installing-intercom/web/installation\n [ALLOWED_INTEGRATIONS.INTERCOM]: () => {\n (function () {\n if (\n 'function' !=\n typeof (window as unknown as Record<string, unknown>)[\n thirdPartyGlobalNames[ALLOWED_INTEGRATIONS.INTERCOM]\n ]\n ) {\n const w = window as unknown as Record<string, unknown>;\n const i: { c: (args: unknown) => void; q: unknown[]; __kizen_pending?: boolean } =\n function () {\n // eslint-disable-next-line prefer-rest-params\n i.c(arguments);\n };\n\n i.q = [];\n i.c = function (args: unknown) {\n i.q.push(args);\n };\n\n i.__kizen_pending = true;\n\n w[thirdPartyGlobalNames[ALLOWED_INTEGRATIONS.INTERCOM]] = i;\n }\n })();\n },\n};\n\n/*\n For a predefined third-party integration, the ready predicate will be run\n AFTER the third party javascript has been loaded, but before the worker has been\n notified that it is ready. This is optional, but gives a chance to wait for an arbitrary\n condition to be met before considering the third-party code initialized successfully.\n*/\nexport const thirdPartyReadyPredicates = {\n [ALLOWED_INTEGRATIONS.FRESHWORKS]: () => {\n return (\n (\n (window as unknown as Record<string, unknown>)[\n thirdPartyGlobalNames[ALLOWED_INTEGRATIONS.FRESHWORKS]\n ] as { __kizen_pending?: boolean } | undefined\n )?.__kizen_pending !== true\n );\n },\n [ALLOWED_INTEGRATIONS.INTERCOM]: () => {\n return (\n (\n (window as unknown as Record<string, unknown>)[\n thirdPartyGlobalNames[ALLOWED_INTEGRATIONS.INTERCOM]\n ] as { __kizen_pending?: boolean } | undefined\n )?.__kizen_pending !== true\n );\n },\n};\n\nexport class ThirdPartyScript {\n private instance: Instance;\n private scriptUrl: string;\n private integration: (typeof ALLOWED_INTEGRATIONS)[keyof typeof ALLOWED_INTEGRATIONS];\n\n constructor(instance: Instance, scriptUrl: string) {\n this.instance = instance;\n this.scriptUrl = scriptUrl;\n const type = getScriptIntegrationType(scriptUrl);\n\n if (type) {\n this.integration = type;\n } else {\n throw new Error(`Error: Disallowed script url: ${scriptUrl}`);\n }\n }\n\n get type(): (typeof ALLOWED_INTEGRATIONS)[keyof typeof ALLOWED_INTEGRATIONS] {\n return this.integration;\n }\n\n public call(...params: unknown[]): void {\n this.instance.postMessage(\n JSON.stringify({\n action: ACTIONS.COMMUNICATE,\n type: COMMUNICATIONS.CALL_THIRD_PARTY_SCRIPT,\n eventName: `thirdParty:${COMMUNICATIONS.CALL_THIRD_PARTY_SCRIPT}`,\n recipient: {\n script: this.scriptUrl,\n type: this.type,\n },\n params,\n }),\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/communication/constants.ts","../src/communication/ThirdPartyScript.ts"],"names":["INDICATOR_TYPE"],"mappings":";AAAO,IAAM,OAAA,GAAU;AAAA,EACrB,aAAA,EAAe,eAAA;AAAA,EACf,SAAA,EAAW,UAAA;AAAA,EACX,aAAA,EAAe,cAAA;AAAA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9D;AAAA,EACF;AAAA,EAEA,IAAI,IAAA,GAAyE;AAC3E,IAAA,OAAO,IAAA,CAAK,WAAA;AAAA,EACd;AAAA,EAEO,QAAQ,MAAA,EAAyB;AACtC,IAAA,IAAA,CAAK,QAAA,CAAS,WAAA;AAAA,MACZ,KAAK,SAAA,CAAU;AAAA,QACb,QAAQ,OAAA,CAAQ,WAAA;AAAA,QAChB,MAAM,cAAA,CAAe,uBAAA;AAAA,QACrB,SAAA,EAAW,CAAA,WAAA,EAAc,cAAA,CAAe,uBAAuB,CAAA,CAAA;AAAA,QAC/D,SAAA,EAAW;AAAA,UACT,QAAQ,IAAA,CAAK,SAAA;AAAA,UACb,MAAM,IAAA,CAAK;AAAA,SACb;AAAA,QACA;AAAA,OACD;AAAA,KACH;AAAA,EACF;AACF","file":"chunk-634UTGPV.js","sourcesContent":["export const ACTIONS = {\n QUERY_REQUEST: 'query:request',\n UI_OUTPUT: 'outputui',\n IFRAME_OUTPUT: 'iframeoutput',\n POSTFORMDATA_REQUEST: 'postformdata:request',\n SETSTATE: 'setstate',\n DONE: 'done',\n RUN: 'run',\n OPEN_WINDOW: 'openwindow',\n COMMUNICATE: 'communicate',\n HIDE: 'hide',\n SHOW: 'show',\n EXPAND: 'expand',\n COLLAPSE: 'collapse',\n HIDE_HEADER: 'hideheader',\n SHOW_HEADER: 'showheader',\n OPEN_CREATE_RECORD_MODAL_REQUEST: 'opencreaterecordmodal:request',\n OPEN_CREATE_RELATED_RECORD_MODAL_REQUEST: 'opencreaterelatedrecordmodal:request',\n SHOW_TOAST: 'showtoast',\n CLEAR_TOASTS: 'cleartoasts',\n REFRESH_TIMELINE: 'refreshtimeline',\n REFRESH_ENTITY: 'refreshentity',\n UPLOADFILE_REQUEST: 'uploadfile:request',\n UPDATE_SESSION_DATA: 'updatesessiondata',\n INSTALL_THIRD_PARTY_SCRIPT_REQUEST: 'installthirdpartyscript:request',\n PROMPT_REQUEST: 'prompt:request',\n // Note: We have a special request for dynamic prompts, but the regular response is sufficient\n // and no special dynamic one is needed\n DYNAMIC_PROMPT_REQUEST: 'dynamicprompt:request',\n RELEASE_BLOCKING_SCRIPT: 'releaseblockingscript',\n AUTHORIZE: 'authorize',\n COPY_TO_CLIPBOARD: 'copytoclipboard',\n SHOW_VIEW_IN_MODAL_REQUEST: 'showviewinmodal:request',\n CLOSE_MODAL_REQUEST: 'closemodal:request',\n CONSOLE_LOG: 'consolelog',\n RUN_EVENT_SCRIPT: 'runeventscript',\n COMPLETE_SETUP_REQUEST: 'completesetup:request',\n};\n\nexport const RESPONSES = {\n QUERY_RESPONSE: 'query:response',\n POSTFORMDATA_RESPONSE: 'postformdata:response',\n ERROR: 'error',\n UPLOADFILE_RESPONSE: 'uploadfile:response',\n UPLOADFILE_PROGRESS: 'uploadfile:progress',\n INSTALL_THIRD_PARTY_SCRIPT_RESPONSE: 'installthirdpartyscript:response',\n PROMPT_RESPONSE: 'prompt:response',\n REFRESH_ENTITY_RESPONSE: 'refreshentity:response',\n CREATE_RECORD_RESPONSE: 'createrecord:response',\n CREATE_RELATED_RECORD_RESPONSE: 'createrelatedrecord:response',\n COMPLETE_SETUP_RESPONSE: 'completesetup:response',\n};\n\nexport const COMMUNICATIONS = {\n RUN_FRAME_SCRIPT: 'runframescript',\n RUN_BLOCK_SCRIPT: 'runblockscript',\n SEND_MESSAGE_TO_FRAME: 'sendmessagetoframe',\n CALL_THIRD_PARTY_SCRIPT: 'callthirdpartyscript',\n};\n\nexport enum INDICATOR_TYPE {\n NONE = 'none',\n BLOCK = 'block',\n BUTTON = 'button',\n SPINNER = 'spinner',\n}\n\nexport const ROUTE_CHANGE_INTERNAL_EVENT = 'integration:route-change';\nexport const ROUTE_CHANGE_IFRAME_EVENT = 'kizen-route-change';\nexport const IFRAME_PREFIX = 'kzn-integration-frame';\n\nconst PKG_VERSION = __PKG_VERSION__;\n\nconst BASE_QUERY_KEY = ['__plugin_engine', PKG_VERSION] as const;\n\nexport const QUERY_KEYS = {\n CALENDAR_SOURCE_CALENDAR_LIST: (pluginApiName: string, sourceApiName: string) =>\n [...BASE_QUERY_KEY, 'calendar-source', 'calendar-list', pluginApiName, sourceApiName] as const,\n CALENDAR_SOURCE_EVENTS: (\n pluginApiName: string,\n sourceApiName: string,\n calendarId: string,\n params: unknown,\n ) =>\n [\n ...BASE_QUERY_KEY,\n 'calendar-source',\n 'events',\n pluginApiName,\n sourceApiName,\n calendarId,\n params,\n ] as const,\n};\n","import type { Instance } from '../types/contexts.js';\nimport { ACTIONS, COMMUNICATIONS } from './constants.js';\n\nconst freshWorksPattern = /https:\\/\\/.*widget\\.freshworks\\.com\\/.*\\.js/;\nconst intercomPattern = /https:\\/\\/widget\\.intercom\\.io\\/widget\\/[a-z0-9]+/;\n\nexport const ALLOWED_INTEGRATIONS = {\n FRESHWORKS: 'freshworks',\n INTERCOM: 'intercom',\n} as const;\n\n/*\n Third party scripts must match an approved regex, and arbitrary scripts cannot be\n loaded by a plugin if they do not.\n*/\nexport const getScriptIntegrationType = (\n scriptUrl: string,\n): (typeof ALLOWED_INTEGRATIONS)[keyof typeof ALLOWED_INTEGRATIONS] | undefined => {\n if (freshWorksPattern.test(scriptUrl)) {\n return ALLOWED_INTEGRATIONS.FRESHWORKS;\n }\n\n if (intercomPattern.test(scriptUrl)) {\n return ALLOWED_INTEGRATIONS.INTERCOM;\n }\n};\n\n/* \n The global name of the third-party integration. This is the variable where the\n integration code can be called from. For example, if the third-party integration\n is 'Freshworks', function calls will be made like window.FreshworksWidget(...args).\n*/\nexport const thirdPartyGlobalNames = {\n [ALLOWED_INTEGRATIONS.FRESHWORKS]: 'FreshworksWidget',\n [ALLOWED_INTEGRATIONS.INTERCOM]: 'Intercom',\n};\n\n/*\n For a predefined third-party integration, the setup script will be run\n BEFORE the third party javascript has been loaded.\n*/\nexport const thirdPartySetupScripts = {\n [ALLOWED_INTEGRATIONS.FRESHWORKS]: (args: Record<string, unknown>) => {\n (window as unknown as Record<string, unknown>).fwSettings = {\n widget_id: args.widgetId,\n };\n\n // Function adapted from https://developers.freshdesk.com/widget-api/#introduction\n (function (...rest) {\n if (\n 'function' !=\n typeof (window as unknown as Record<string, unknown>)[\n thirdPartyGlobalNames[ALLOWED_INTEGRATIONS.FRESHWORKS]\n ]\n ) {\n const n: { q: unknown[]; __kizen_pending?: boolean } = function () {\n n.q.push(...rest);\n };\n\n n.__kizen_pending = true;\n\n // eslint-disable-next-line\n ((n.q = []), ((window as any)[thirdPartyGlobalNames[ALLOWED_INTEGRATIONS.FRESHWORKS]] = n));\n }\n })();\n },\n // Function adapted from https://developers.intercom.com/installing-intercom/web/installation\n [ALLOWED_INTEGRATIONS.INTERCOM]: () => {\n (function () {\n if (\n 'function' !=\n typeof (window as unknown as Record<string, unknown>)[\n thirdPartyGlobalNames[ALLOWED_INTEGRATIONS.INTERCOM]\n ]\n ) {\n const w = window as unknown as Record<string, unknown>;\n const i: { c: (args: unknown) => void; q: unknown[]; __kizen_pending?: boolean } =\n function () {\n // eslint-disable-next-line prefer-rest-params\n i.c(arguments);\n };\n\n i.q = [];\n i.c = function (args: unknown) {\n i.q.push(args);\n };\n\n i.__kizen_pending = true;\n\n w[thirdPartyGlobalNames[ALLOWED_INTEGRATIONS.INTERCOM]] = i;\n }\n })();\n },\n};\n\n/*\n For a predefined third-party integration, the ready predicate will be run\n AFTER the third party javascript has been loaded, but before the worker has been\n notified that it is ready. This is optional, but gives a chance to wait for an arbitrary\n condition to be met before considering the third-party code initialized successfully.\n*/\nexport const thirdPartyReadyPredicates = {\n [ALLOWED_INTEGRATIONS.FRESHWORKS]: () => {\n return (\n (\n (window as unknown as Record<string, unknown>)[\n thirdPartyGlobalNames[ALLOWED_INTEGRATIONS.FRESHWORKS]\n ] as { __kizen_pending?: boolean } | undefined\n )?.__kizen_pending !== true\n );\n },\n [ALLOWED_INTEGRATIONS.INTERCOM]: () => {\n return (\n (\n (window as unknown as Record<string, unknown>)[\n thirdPartyGlobalNames[ALLOWED_INTEGRATIONS.INTERCOM]\n ] as { __kizen_pending?: boolean } | undefined\n )?.__kizen_pending !== true\n );\n },\n};\n\nexport class ThirdPartyScript {\n private instance: Instance;\n private scriptUrl: string;\n private integration: (typeof ALLOWED_INTEGRATIONS)[keyof typeof ALLOWED_INTEGRATIONS];\n\n constructor(instance: Instance, scriptUrl: string) {\n this.instance = instance;\n this.scriptUrl = scriptUrl;\n const type = getScriptIntegrationType(scriptUrl);\n\n if (type) {\n this.integration = type;\n } else {\n throw new Error(`Error: Disallowed script url: ${scriptUrl}`);\n }\n }\n\n get type(): (typeof ALLOWED_INTEGRATIONS)[keyof typeof ALLOWED_INTEGRATIONS] {\n return this.integration;\n }\n\n public call(...params: unknown[]): void {\n this.instance.postMessage(\n JSON.stringify({\n action: ACTIONS.COMMUNICATE,\n type: COMMUNICATIONS.CALL_THIRD_PARTY_SCRIPT,\n eventName: `thirdParty:${COMMUNICATIONS.CALL_THIRD_PARTY_SCRIPT}`,\n recipient: {\n script: this.scriptUrl,\n type: this.type,\n },\n params,\n }),\n );\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getPartialLocation, generateUUIDV4 } from './chunk-
|
|
2
|
-
import { getAllNestedInputsFromConfig, buildIframeURLWithProxy, getParentFrameAllowParam, deserializeConsoleArg, KizenRequestError, filterSandboxList, filterAllowList } from './chunk-
|
|
3
|
-
import { IFRAME_PREFIX, ACTIONS, RESPONSES, COMMUNICATIONS, thirdPartyGlobalNames, getScriptIntegrationType, thirdPartySetupScripts, thirdPartyReadyPredicates } from './chunk-
|
|
1
|
+
import { getPartialLocation, generateUUIDV4 } from './chunk-IAFKDUUO.js';
|
|
2
|
+
import { getAllNestedInputsFromConfig, buildIframeURLWithProxy, getParentFrameAllowParam, deserializeConsoleArg, KizenRequestError, filterSandboxList, filterAllowList } from './chunk-XNFBWPQ7.js';
|
|
3
|
+
import { IFRAME_PREFIX, ACTIONS, RESPONSES, COMMUNICATIONS, thirdPartyGlobalNames, getScriptIntegrationType, thirdPartySetupScripts, thirdPartyReadyPredicates } from './chunk-634UTGPV.js';
|
|
4
4
|
import { __commonJS, __toESM } from './chunk-5WRI5ZAA.js';
|
|
5
5
|
import DOMPurify from 'dompurify';
|
|
6
6
|
|
|
@@ -1675,6 +1675,13 @@ var mergeConfig = (cleanConfig, disabledFieldKeys, rawConfig, setupAssistantFiel
|
|
|
1675
1675
|
value: getDisabledValue(field.type),
|
|
1676
1676
|
type: field.type
|
|
1677
1677
|
};
|
|
1678
|
+
} else if (field.type === "api_key") {
|
|
1679
|
+
const raw = rawConfig[field.key];
|
|
1680
|
+
mergedConfig[field.key] = {
|
|
1681
|
+
type: field.type,
|
|
1682
|
+
hasValue: Boolean(raw?.hasValue),
|
|
1683
|
+
maskedValue: raw?.maskedValue
|
|
1684
|
+
};
|
|
1678
1685
|
} else {
|
|
1679
1686
|
mergedConfig[field.key] = {
|
|
1680
1687
|
value: field.default,
|
|
@@ -1685,12 +1692,27 @@ var mergeConfig = (cleanConfig, disabledFieldKeys, rawConfig, setupAssistantFiel
|
|
|
1685
1692
|
});
|
|
1686
1693
|
return mergedConfig;
|
|
1687
1694
|
};
|
|
1695
|
+
var RESERVED_NAMESPACES = ["config", "userConfig", "plan", "entitlement"];
|
|
1696
|
+
var NAMESPACE_PATTERN = new RegExp(`{{(${RESERVED_NAMESPACES.join("|")})\\.([^}]+)}}`, "g");
|
|
1697
|
+
var flattenReservedState = (plan, entitlements) => {
|
|
1698
|
+
const flattened = {};
|
|
1699
|
+
Object.entries(plan ?? {}).forEach(([planType, planValues]) => {
|
|
1700
|
+
Object.entries(planValues).forEach(([planKey, planValue]) => {
|
|
1701
|
+
flattened[`plan__${planType}__${planKey}`] = { value: planValue };
|
|
1702
|
+
});
|
|
1703
|
+
});
|
|
1704
|
+
Object.entries(entitlements ?? {}).forEach(([entitlementKey, entitlementValue]) => {
|
|
1705
|
+
flattened[`entitlement__${entitlementKey}`] = { value: entitlementValue };
|
|
1706
|
+
});
|
|
1707
|
+
return flattened;
|
|
1708
|
+
};
|
|
1688
1709
|
var replaceConfigValues = (when) => {
|
|
1689
1710
|
if (!when) {
|
|
1690
1711
|
return "";
|
|
1691
1712
|
}
|
|
1692
|
-
|
|
1693
|
-
|
|
1713
|
+
return when.replace(NAMESPACE_PATTERN, (_match, namespace, path) => {
|
|
1714
|
+
return `{{${namespace}__${path.replaceAll(".", "__")}}}`;
|
|
1715
|
+
});
|
|
1694
1716
|
};
|
|
1695
1717
|
var getEnabledState = async (when, state) => {
|
|
1696
1718
|
const replaced = replaceConfigValues(when);
|
|
@@ -2816,8 +2838,8 @@ var modalSize = {
|
|
|
2816
2838
|
};
|
|
2817
2839
|
|
|
2818
2840
|
// src/index.ts
|
|
2819
|
-
var version = "1.
|
|
2841
|
+
var version = "1.10.0";
|
|
2820
2842
|
|
|
2821
|
-
export { clearNavigationContext, consumeNavigationContext, forceQualifiedUrl, getDisabledValue, getEnabledState, getHash, getLinkValue, getPluginSafeHTML, getQrCodeValue, getStableHash, isFlagEnabled, mergeConfig, modalSize, pluginMapper, readNavigationContext, reduceEnabledResults, replaceConfigValues, runExpression, runObjectExpression, runOptionExpression, runScript, runStringExpression, version };
|
|
2822
|
-
//# sourceMappingURL=chunk-
|
|
2823
|
-
//# sourceMappingURL=chunk-
|
|
2843
|
+
export { clearNavigationContext, consumeNavigationContext, flattenReservedState, forceQualifiedUrl, getDisabledValue, getEnabledState, getHash, getLinkValue, getPluginSafeHTML, getQrCodeValue, getStableHash, isFlagEnabled, mergeConfig, modalSize, pluginMapper, readNavigationContext, reduceEnabledResults, replaceConfigValues, runExpression, runObjectExpression, runOptionExpression, runScript, runStringExpression, version };
|
|
2844
|
+
//# sourceMappingURL=chunk-A35SDJRQ.js.map
|
|
2845
|
+
//# sourceMappingURL=chunk-A35SDJRQ.js.map
|