@rokt/dcui-orchestrator 0.3.1-rc.7 → 0.3.1-rc.8
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/index.cjs +27 -27
- package/dist/index.js +27 -27
- package/dist/libraries/domain/src/behaviors/child-layout-bridge.d.ts +36 -0
- package/dist/libraries/domain/src/behaviors/custom-states.d.ts +1 -0
- package/dist/libraries/domain/src/behaviors/form-state.d.ts +5 -0
- package/dist/libraries/domain/src/behaviors/index.d.ts +1 -0
- package/dist/libraries/domain/src/behaviors/safe-state-key.d.ts +3 -0
- package/dist/libraries/domain/src/behaviors/trigger-action.d.ts +1 -0
- package/dist/libraries/domain/src/models/global-state.d.ts +6 -0
- package/dist/libraries/domain/src/models/plugin/plugin-child-layout-model.d.ts +8 -0
- package/dist/libraries/layout-renderer-utils/src/sagas/index.d.ts +0 -1
- package/dist/libraries/module-utils/src/sagas/child-layouts/sagas.d.ts +15 -3
- package/dist/libraries/module-utils/src/sagas/error-codes.d.ts +1 -0
- package/dist/libraries/module-utils/src/selectors/static-data/selectors.d.ts +3 -0
- package/dist/libraries/plugin-utils/src/plugin-service/index.d.ts +3 -1
- package/dist/libraries/plugin-utils/src/plugin-service/parent-interaction.d.ts +3 -0
- package/package.json +1 -1
- package/dist/libraries/layout-renderer-utils/src/sagas/trigger-action/index.d.ts +0 -1
- package/dist/libraries/layout-renderer-utils/src/sagas/trigger-action/sagas.d.ts +0 -12
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SyncedGlobalState } from '../models';
|
|
2
|
+
import { GlobalActions } from './global-actions';
|
|
3
|
+
export * from './safe-state-key';
|
|
4
|
+
/**
|
|
5
|
+
* Wire protocol between a child layout plugin and its launching host module,
|
|
6
|
+
* carried over the WSDK parent-interaction channel. Receivers ignore unknown
|
|
7
|
+
* event names and envelope versions so a version-skewed bundle pair degrades
|
|
8
|
+
* to pre-bridge behavior.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CHILD_LAYOUT_BRIDGE_EVENTS: {
|
|
11
|
+
/** child → host: a GlobalAction to re-dispatch in the launching module */
|
|
12
|
+
readonly DISPATCH_BEHAVIOR: "CHILD_LAYOUT/DISPATCH_BEHAVIOR";
|
|
13
|
+
/** host → child: the offer-scoped synced GlobalState slices */
|
|
14
|
+
readonly STATE_SYNC: "CHILD_LAYOUT/STATE_SYNC";
|
|
15
|
+
/** child → host: bridge sagas are subscribed; reply with a fresh snapshot */
|
|
16
|
+
readonly READY: "CHILD_LAYOUT/READY";
|
|
17
|
+
};
|
|
18
|
+
export declare const CHILD_LAYOUT_BRIDGE_VERSION = 1;
|
|
19
|
+
export interface ChildBridgeEnvelope<Payload> {
|
|
20
|
+
version: typeof CHILD_LAYOUT_BRIDGE_VERSION;
|
|
21
|
+
payload: Payload;
|
|
22
|
+
}
|
|
23
|
+
export type DispatchBehaviorEnvelope = ChildBridgeEnvelope<GlobalActions>;
|
|
24
|
+
export type StateSyncEnvelope = ChildBridgeEnvelope<SyncedGlobalState>;
|
|
25
|
+
export type ReadyEnvelope = ChildBridgeEnvelope<null>;
|
|
26
|
+
export declare function makeBridgeEnvelope<Payload>(payload: Payload): ChildBridgeEnvelope<Payload>;
|
|
27
|
+
/**
|
|
28
|
+
* The behaviors a child layout may dispatch into its host (keys) and their
|
|
29
|
+
* structural gates (values, co-located with each behavior's definition). The
|
|
30
|
+
* host warns-and-drops anything unknown or malformed — skew degradation and
|
|
31
|
+
* bug detection, not a security boundary. To add a forwardable behavior:
|
|
32
|
+
* write its gate next to its type, add one entry here.
|
|
33
|
+
*/
|
|
34
|
+
export declare const FORWARDABLE_BEHAVIOR_GUARDS: Readonly<Record<string, (payload: unknown) => boolean>>;
|
|
35
|
+
/** Version gate for anything read off the wire. */
|
|
36
|
+
export declare function isBridgeEnvelope(value: unknown): value is ChildBridgeEnvelope<unknown>;
|
|
@@ -64,3 +64,8 @@ export interface ValidateFormFields {
|
|
|
64
64
|
payload: ValidateFormFieldsPayload;
|
|
65
65
|
}
|
|
66
66
|
export type FormStateBehaviors = RegisterFormField | UnregisterFormField | SetFormFieldValue | SetFormFieldTouched | ValidateFormFields;
|
|
67
|
+
export declare function isValidRegisterFormFieldPayload(payload: unknown): payload is RegisterFormFieldPayload;
|
|
68
|
+
export declare function isValidSetFormFieldValuePayload(payload: unknown): payload is SetFormFieldValuePayload;
|
|
69
|
+
/** Shared by UNREGISTER_FORM_FIELD and SET_FORM_FIELD_TOUCHED. */
|
|
70
|
+
export declare function isValidFormFieldRefPayload(payload: unknown): payload is UnregisterFormFieldPayload;
|
|
71
|
+
export declare function isValidValidateFormFieldsPayload(payload: unknown): payload is ValidateFormFieldsPayload;
|
|
@@ -12,6 +12,7 @@ export * from './open-link';
|
|
|
12
12
|
export * from './partner-validation';
|
|
13
13
|
export * from './global-offer-data-state';
|
|
14
14
|
export * from './child-layout';
|
|
15
|
+
export * from './child-layout-bridge';
|
|
15
16
|
export * from './cart-item-event';
|
|
16
17
|
export * from './dismiss-overlay';
|
|
17
18
|
export * from './trigger-action';
|
|
@@ -16,4 +16,10 @@ export interface GlobalState {
|
|
|
16
16
|
firedEvents: Partial<Record<LayoutEvent, boolean>>;
|
|
17
17
|
formStates: FormStatesState;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* The GlobalState slices a host syncs down to a child layout; `breakpoint`
|
|
21
|
+
* is absent because the child computes its own from its iframe width.
|
|
22
|
+
*/
|
|
23
|
+
export type SyncedGlobalState = Pick<GlobalState, 'progression' | 'customStates' | 'domainStates' | 'firedEvents' | 'formStates'>;
|
|
24
|
+
export declare function makeSyncedGlobalState(state?: Partial<SyncedGlobalState>): SyncedGlobalState;
|
|
19
25
|
export declare function makeGlobalState(state?: Partial<GlobalState>): GlobalState;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LayoutSchemaModel, LayoutDisplayPreset, LayoutSettings, ChildRootSchemaModel, WhenPredicate } from '@rokt/dcui-layout-schema';
|
|
2
2
|
import { Fonts } from '@rokt/plugin';
|
|
3
|
+
import { SyncedGlobalState } from '../global-state';
|
|
3
4
|
import { PluginOffer } from './plugin-offer';
|
|
4
5
|
export interface PluginChildLayoutModel<ChildRootLayoutSchema = ChildRootSchemaModel<LayoutSchemaModel, LayoutDisplayPreset, LayoutSettings, WhenPredicate>> {
|
|
5
6
|
instanceGuid: string;
|
|
@@ -11,6 +12,13 @@ export interface PluginChildLayoutModel<ChildRootLayoutSchema = ChildRootSchemaM
|
|
|
11
12
|
text?: Record<string, string>;
|
|
12
13
|
};
|
|
13
14
|
fonts?: Fonts;
|
|
15
|
+
/**
|
|
16
|
+
* Offer-scoped state snapshot at launch time, hydrating the child's synced
|
|
17
|
+
* slices so its first render is correct before the first STATE_SYNC push.
|
|
18
|
+
* Absent when the host predates the child-layout bridge — the child then
|
|
19
|
+
* renders from its own local state (pre-bridge behavior).
|
|
20
|
+
*/
|
|
21
|
+
globalState?: SyncedGlobalState;
|
|
14
22
|
}
|
|
15
23
|
export declare function makeChildLayoutRootSchemaModel(data?: Partial<ChildRootSchemaModel<LayoutSchemaModel, LayoutDisplayPreset, LayoutSettings, WhenPredicate>>): ChildRootSchemaModel<LayoutSchemaModel, LayoutDisplayPreset, LayoutSettings, WhenPredicate>;
|
|
16
24
|
export declare function makePluginChildLayoutModel(data?: Partial<PluginChildLayoutModel>): PluginChildLayoutModel;
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { LaunchChildLayout } from '../../../../domain/src/behaviors';
|
|
2
|
-
import { CallEffect, PutEffect, SelectEffect } from 'redux-saga/effects';
|
|
2
|
+
import { CallEffect, CancelledEffect, ChannelTakeEffect, ForkEffect, PutEffect, RaceEffect, SelectEffect } from 'redux-saga/effects';
|
|
3
3
|
import { GlobalGateway } from '../../../../module-connector/src/main';
|
|
4
|
-
import { Log } from '../../../../domain/src/models';
|
|
5
|
-
|
|
4
|
+
import { Log, PluginOffer } from '../../../../domain/src/models';
|
|
5
|
+
import { BasicObject, ChildPluginInterface } from '@rokt/plugin';
|
|
6
|
+
export declare function launchChildLayout(gateway: GlobalGateway, logger: (log: Log) => void, action: LaunchChildLayout): Generator<PutEffect | CallEffect | SelectEffect | ForkEffect, void, never>;
|
|
7
|
+
type BridgeChannelMessage = {
|
|
8
|
+
kind: 'ready';
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'behavior';
|
|
11
|
+
envelope: unknown;
|
|
12
|
+
};
|
|
13
|
+
export declare function childLayoutBridge(gateway: GlobalGateway, logger: (log: Log) => void, childPlugin: ChildPluginInterface<BasicObject>, offerContext: {
|
|
14
|
+
offer: PluginOffer;
|
|
15
|
+
offerPositionIndex: number | undefined;
|
|
16
|
+
}): Generator<PutEffect | CallEffect | CancelledEffect | RaceEffect<ChannelTakeEffect<BridgeChannelMessage> | CallEffect>, void, never>;
|
|
17
|
+
export {};
|
|
@@ -3,13 +3,15 @@ import { ContextService } from './context';
|
|
|
3
3
|
import { MetricsService } from './metrics';
|
|
4
4
|
import { DisplayService } from './display';
|
|
5
5
|
import { PartnerInteractionService } from './partner-interaction';
|
|
6
|
+
import { ParentInteractionService } from './parent-interaction';
|
|
6
7
|
import { ConfigService } from './config';
|
|
7
8
|
import { ChildPluginService } from './child-plugin';
|
|
8
|
-
export { ContextService, MetricsService, DisplayService, PartnerInteractionService, ConfigService, ChildPluginService, };
|
|
9
|
+
export { ContextService, MetricsService, DisplayService, PartnerInteractionService, ParentInteractionService, ConfigService, ChildPluginService, };
|
|
9
10
|
export interface PluginService<T> {
|
|
10
11
|
contextService: ContextService;
|
|
11
12
|
configService: ConfigService<T>;
|
|
12
13
|
partnerInteractionService: PartnerInteractionService;
|
|
14
|
+
parentInteractionService: ParentInteractionService;
|
|
13
15
|
rdnService: RDNInterface;
|
|
14
16
|
metricsService: MetricsService;
|
|
15
17
|
errorService: ErrorInterface;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ParentInteractionInterface, PluginInterface } from '@rokt/plugin';
|
|
2
|
+
export type ParentInteractionService = ParentInteractionInterface;
|
|
3
|
+
export declare const makeParentInteractionService: (pluginInterface: Pick<PluginInterface, 'parentInteraction'>) => ParentInteractionService;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './sagas';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PutEffect } from 'redux-saga/effects';
|
|
2
|
-
import { TriggerAction } from '../../../../domain/src/behaviors';
|
|
3
|
-
/**
|
|
4
|
-
* Handles TRIGGER_ACTION in a root-scoped store (the child layout renderer)
|
|
5
|
-
* where no offer/module gateway exists. The general actions (Close,
|
|
6
|
-
* SetCustomState) resolve to their root behaviors; offer-specific actions
|
|
7
|
-
* (CreativeResponse, CatalogResponse, AddToCart, InitiateTax) have no meaning
|
|
8
|
-
* without a module gateway, so they surface a warning instead of silently
|
|
9
|
-
* dropping — a layout author wiring one of those into a child layout gets a
|
|
10
|
-
* diagnosable signal rather than a dead button.
|
|
11
|
-
*/
|
|
12
|
-
export declare function handleRootLayoutAction(action: TriggerAction): Generator<PutEffect, void, never>;
|