@pexip-engage-public/plugin-instance
Advanced tools
Comparing version 1.1.4-canary-20231025140910 to 1.1.4
# @pexip-engage-public/plugin-instance | ||
## 1.1.4-canary-20231025140910 | ||
## 1.1.4 | ||
### Patch Changes | ||
- c49c5a4aa: SKED-11604: plugin-instance-hooks | ||
- Updated dependencies [c49c5a4aa] | ||
- Updated dependencies [d5413de87] | ||
- @pexip-engage-public/plugin-state@1.2.2-canary-20231025140910 | ||
- @pexip-engage-public/plugin-events@1.0.30 | ||
- @pexip-engage-public/plugin-state@1.2.2 | ||
- @pexip-engage-public/plugin-configuration-parser@1.2.1 | ||
- @pexip-engage-public/plugin-events@1.0.30-canary-20231025140910 | ||
- @pexip-engage-public/plugin-utils@1.0.10 | ||
@@ -12,0 +14,0 @@ |
{ | ||
"name": "@pexip-engage-public/plugin-instance", | ||
"version": "1.1.4-canary-20231025140910", | ||
"version": "1.1.4", | ||
"homepage": "https://github.com/skedify/frontend-mono/tree/develop/apps/plugin-remix/packages/plugin-instance#readme", | ||
@@ -37,4 +37,4 @@ "bugs": { | ||
"@pexip-engage-public/plugin-configuration-parser": "1.2.1", | ||
"@pexip-engage-public/plugin-events": "1.0.30-canary-20231025140910", | ||
"@pexip-engage-public/plugin-state": "1.2.2-canary-20231025140910", | ||
"@pexip-engage-public/plugin-events": "1.0.30", | ||
"@pexip-engage-public/plugin-state": "1.2.2", | ||
"@pexip-engage-public/plugin-utils": "1.0.10" | ||
@@ -45,3 +45,3 @@ }, | ||
"@pexip-engage/tsconfig": "0.0.9", | ||
"eslint-config-pexip-engage": "0.0.41-canary-20231025140910" | ||
"eslint-config-pexip-engage": "0.0.41" | ||
}, | ||
@@ -48,0 +48,0 @@ "volta": { |
@@ -15,2 +15,3 @@ import { | ||
RequestEvent, | ||
RequestEventMessage, | ||
StateUpdateMessage, | ||
@@ -26,2 +27,3 @@ } from "@pexip-engage-public/plugin-events"; | ||
import { dispatchEvent, PEXIP_ENGAGE_PLUGIN_EVENT, PluginCustomEvent } from "./dispatchEvent"; | ||
import type { PluginHooks } from "./hooks"; | ||
import { getPexipEngagePluginFrame } from "./PexipEngagePluginFrame"; | ||
@@ -37,3 +39,3 @@ | ||
#state: StateUpdateMessage["payload"] | null = null; | ||
#meta: Record<string, unknown> | null = null; | ||
#meta: Record<string, unknown> = {}; | ||
#status: "pending" | "success" | "error" | "disposed" = "pending"; | ||
@@ -167,6 +169,14 @@ #fallbackTimeoutId: number | null = null; | ||
if (message.type === RequestEvent.REQUEST_METADATA) { | ||
if (message.type === RequestEvent.PRE_APPOINTMENT_REQUEST) { | ||
//@ts-expect-error we can reassign this because we check above. | ||
let _message: RequestEventMessage<"PRE_APPOINTMENT_REQUEST"> = message; | ||
this.#hooks.beforeAppointmentCreate?.({ | ||
data: _message.payload, | ||
appointment: { meta: this.appointment.meta }, | ||
}); | ||
this.#instance.iFrameResizer.sendMessage({ | ||
type: RequestEvent.REQUEST_METADATA, | ||
payload: this.#meta, | ||
type: RequestEvent.PRE_APPOINTMENT_REQUEST, | ||
payload: { meta: this.#meta }, | ||
}); | ||
@@ -241,2 +251,7 @@ | ||
#hooks: Partial<PluginHooks> = {}; | ||
setHook<T extends keyof PluginHooks>(type: T, callback: PluginHooks[T]) { | ||
this.#hooks[type] = callback; | ||
} | ||
openDebugger = () => { | ||
@@ -334,7 +349,5 @@ const searchParams = new URLSearchParams(); | ||
get: (key: string, defaultValue: unknown) => { | ||
return this.#meta?.[key] ?? defaultValue; | ||
return this.#meta[key] ?? defaultValue; | ||
}, | ||
set: (key: string, value: unknown) => { | ||
if (!this.#meta) this.#meta = {}; | ||
this.#meta[key] = value; | ||
@@ -345,3 +358,3 @@ | ||
remove: (key: string) => { | ||
delete this.#meta?.[key]; | ||
delete this.#meta[key]; | ||
}, | ||
@@ -348,0 +361,0 @@ }, |
@@ -5,2 +5,3 @@ import { parsePluginConfiguration } from "@pexip-engage-public/plugin-configuration-parser"; | ||
import { PluginCustomEvent } from "./dispatchEvent"; | ||
import type { PluginHooks } from "./hooks"; | ||
type PluginEventListener = (event: PluginCustomEvent) => unknown; | ||
@@ -16,2 +17,3 @@ export declare class PluginInstance { | ||
get hashConfig(): string; | ||
setHook<T extends keyof PluginHooks>(type: T, callback: PluginHooks[T]): void; | ||
openDebugger: () => string; | ||
@@ -38,3 +40,3 @@ /** Destroy the instance */ | ||
meta: { | ||
getAll: () => Record<string, unknown> | null; | ||
getAll: () => Record<string, unknown>; | ||
get: (key: string, defaultValue: unknown) => unknown; | ||
@@ -112,3 +114,3 @@ set: (key: string, value: unknown) => Record<string, unknown>; | ||
meta: { | ||
getAll: () => Record<string, unknown> | null; | ||
getAll: () => Record<string, unknown>; | ||
get: (key: string, defaultValue: unknown) => unknown; | ||
@@ -115,0 +117,0 @@ set: (key: string, value: unknown) => Record<string, unknown>; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
114465
20
1594
1
+ Added@pexip-engage-public/plugin-events@1.0.30(transitive)
+ Added@pexip-engage-public/plugin-state@1.2.2(transitive)
- Removed@pexip-engage-public/plugin-events@1.0.30-canary-20231025140910(transitive)
- Removed@pexip-engage-public/plugin-state@1.2.2-canary-20231025140910(transitive)