@rokt/dcui-orchestrator 1.2.1-rc.6 → 1.2.1-rc.61

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 (123) hide show
  1. package/dist/index.cjs +47 -38
  2. package/dist/index.js +59 -50
  3. package/dist/libraries/dcui-components/src/components/index.d.ts +3 -0
  4. package/dist/libraries/dcui-components/src/components/paypal-button/index.d.ts +1 -0
  5. package/dist/libraries/dcui-components/src/components/paypal-button/paypal-button.d.ts +78 -0
  6. package/dist/libraries/dcui-components/src/components/paypal-button/paypal-wordmark.d.ts +10 -0
  7. package/dist/libraries/dcui-components/src/components/progress-control/index.d.ts +1 -0
  8. package/dist/libraries/dcui-components/src/components/progress-control/progress-control.d.ts +49 -0
  9. package/dist/libraries/dcui-components/src/components/progress-indicator/get-progress-indicator-state.d.ts +3 -0
  10. package/dist/libraries/dcui-components/src/components/progress-indicator/index.d.ts +3 -0
  11. package/dist/libraries/dcui-components/src/components/progress-indicator/progress-indicator.d.ts +8 -0
  12. package/dist/libraries/dcui-components/src/components/progress-indicator/types.d.ts +88 -0
  13. package/dist/libraries/dcui-components/src/components/style-mapper/combiners/escape-css-string.d.ts +19 -0
  14. package/dist/libraries/dcui-components/src/components/style-mapper/combiners/index.d.ts +1 -0
  15. package/dist/libraries/dcui-components/src/contexts/index.d.ts +1 -0
  16. package/dist/libraries/dcui-components/src/contexts/lead-capture-offer-context.d.ts +5 -0
  17. package/dist/libraries/dcui-components/src/contexts/validators/validator-provider.d.ts +5 -3
  18. package/dist/libraries/dcui-components/src/failure-codes.d.ts +2 -0
  19. package/dist/libraries/dcui-components/src/utils/index.d.ts +1 -0
  20. package/dist/libraries/dcui-components/src/utils/link-schemes.d.ts +35 -0
  21. package/dist/libraries/dcui-components/src/utils/responsive-css.d.ts +9 -0
  22. package/dist/libraries/domain/src/behaviors/continuous-child.d.ts +62 -0
  23. package/dist/libraries/domain/src/behaviors/custom-states.d.ts +8 -1
  24. package/dist/libraries/domain/src/behaviors/index.d.ts +1 -0
  25. package/dist/libraries/domain/src/behaviors/offer-engagement.d.ts +11 -0
  26. package/dist/libraries/domain/src/behaviors/send-partner.d.ts +14 -2
  27. package/dist/libraries/domain/src/behaviors/trigger-action.d.ts +3 -3
  28. package/dist/libraries/domain/src/models/child-layout-response.d.ts +6 -0
  29. package/dist/libraries/domain/src/models/form-state.d.ts +85 -0
  30. package/dist/libraries/domain/src/models/global-state.d.ts +15 -1
  31. package/dist/libraries/domain/src/models/index.d.ts +1 -0
  32. package/dist/libraries/domain/src/models/layout/layout-offer.d.ts +2 -0
  33. package/dist/libraries/domain/src/models/partner-event.d.ts +1 -1
  34. package/dist/libraries/domain/src/models/plugin/plugin-child-layout-model.d.ts +1 -0
  35. package/dist/libraries/domain/src/models/plugin/plugin-offer.d.ts +2 -0
  36. package/dist/libraries/domain/src/models/purchase.d.ts +3 -0
  37. package/dist/libraries/layout-renderer-utils/src/reducers/breakpoint/coerce-breakpoints.d.ts +19 -0
  38. package/dist/libraries/layout-renderer-utils/src/reducers/breakpoint/index.d.ts +1 -0
  39. package/dist/libraries/layout-renderer-utils/src/sagas/error/error-codes.d.ts +3 -0
  40. package/dist/libraries/layout-renderer-utils/src/sagas/plugin/display.d.ts +3 -0
  41. package/dist/libraries/layout-renderer-utils/src/sagas/plugin/sagas.d.ts +4 -1
  42. package/dist/libraries/layout-renderer-utils/src/sagas/utils/index.d.ts +8 -1
  43. package/dist/libraries/layout-renderer-utils/src/sagas/utils/links.d.ts +28 -1
  44. package/dist/libraries/module-connector/src/main.d.ts +1 -1
  45. package/dist/libraries/module-connector/src/models/gateway.d.ts +19 -3
  46. package/dist/libraries/module-connector/src/models/module-attributes.d.ts +3 -0
  47. package/dist/libraries/module-connector/src/models/module-connector-builder.d.ts +1 -0
  48. package/dist/libraries/module-utils/src/sagas/child-layouts/sagas.d.ts +14 -4
  49. package/dist/libraries/orchestrator/src/actions/global-offer-data-state.d.ts +11 -1
  50. package/dist/libraries/orchestrator/src/actions/index.d.ts +2 -0
  51. package/dist/libraries/orchestrator/src/actions/module.d.ts +9 -1
  52. package/dist/libraries/orchestrator/src/cart-listener-gateway.d.ts +7 -0
  53. package/dist/libraries/orchestrator/src/components/progress-control/progress-control.d.ts +2 -45
  54. package/dist/libraries/orchestrator/src/components/progress-indicator/progress-indicator.d.ts +1 -9
  55. package/dist/libraries/orchestrator/src/components/progress-indicator/types.d.ts +1 -87
  56. package/dist/libraries/orchestrator/src/measurement/creative-measurement.d.ts +54 -0
  57. package/dist/libraries/orchestrator/src/models/state/global-offer-data-state.d.ts +6 -0
  58. package/dist/libraries/orchestrator/src/models/state/module.d.ts +1 -0
  59. package/dist/libraries/orchestrator/src/reducers/progression/reducer.d.ts +8 -0
  60. package/dist/libraries/orchestrator/src/sagas/child-layouts/continuous-child-host.d.ts +15 -0
  61. package/dist/libraries/orchestrator/src/sagas/child-layouts/continuous-child.d.ts +52 -0
  62. package/dist/libraries/orchestrator/src/sagas/index.d.ts +1 -1
  63. package/dist/libraries/orchestrator/src/sagas/offer-engagement/sagas.d.ts +3 -3
  64. package/dist/libraries/orchestrator/src/sagas/partner-cart-sync/sagas.d.ts +2 -2
  65. package/dist/libraries/orchestrator/src/sagas/progression/sagas.d.ts +8 -2
  66. package/dist/libraries/orchestrator/src/sagas/utils/distribution.d.ts +21 -0
  67. package/dist/libraries/orchestrator/src/sagas/utils/index.d.ts +3 -0
  68. package/dist/libraries/orchestrator/src/selectors/global-offer-data-state/selectors.d.ts +8 -1
  69. package/dist/libraries/plugin-utils/src/plugin-service/display.d.ts +1 -0
  70. package/dist/libraries/saga-utils/src/utils/index.d.ts +1 -0
  71. package/dist/libraries/saga-utils/src/utils/quantity-rules.d.ts +184 -0
  72. package/dist/modules/add-to-cart/src/actions/cart.d.ts +7 -1
  73. package/dist/modules/add-to-cart/src/actions/catalog-item.d.ts +15 -1
  74. package/dist/modules/add-to-cart/src/components/when-catalog-quantity/when-catalog-quantity.d.ts +2 -1
  75. package/dist/modules/add-to-cart/src/reducers/cart/reducer.d.ts +2 -1
  76. package/dist/modules/add-to-cart/src/sagas/index.d.ts +2 -1
  77. package/dist/modules/add-to-cart/src/sagas/update-cart-item/sagas.d.ts +6 -3
  78. package/dist/modules/add-to-cart/src/selectors/cart/selectors.d.ts +31 -0
  79. package/dist/modules/add-to-cart/src/selectors/catalogItems/selectors.d.ts +8 -0
  80. package/dist/modules/instant-purchase/src/actions/instant-purchase.d.ts +4 -0
  81. package/dist/modules/instant-purchase/src/components/catalog-device-pay-button/catalog-device-pay-button.d.ts +8 -0
  82. package/dist/modules/instant-purchase/src/components/catalog-selectors-stacked/catalog-selectors-stacked.d.ts +30 -0
  83. package/dist/modules/instant-purchase/src/constants/device-pay-error.d.ts +1 -1
  84. package/dist/modules/instant-purchase/src/models/state/device-pay-availability.d.ts +2 -0
  85. package/dist/modules/instant-purchase/src/models/state/instant-purchase.d.ts +4 -0
  86. package/dist/modules/instant-purchase/src/sagas/device-pay/sagas.d.ts +2 -7
  87. package/dist/modules/instant-purchase/src/sagas/instant-purchase/sagas.d.ts +17 -3
  88. package/dist/modules/instant-purchase/src/sagas/paypal/sagas.d.ts +2 -0
  89. package/dist/modules/instant-purchase/src/sagas/tax-and-shipping/sagas.d.ts +10 -20
  90. package/dist/modules/instant-purchase/src/selectors/catalog-selection/index.d.ts +1 -0
  91. package/dist/modules/instant-purchase/src/selectors/catalog-selection/selectors.d.ts +7 -0
  92. package/dist/modules/instant-purchase/src/selectors/device-pay-availability/selectors.d.ts +2 -0
  93. package/dist/modules/instant-purchase/src/selectors/index.d.ts +1 -0
  94. package/dist/modules/instant-purchase/src/selectors/tax-and-shipping/selectors.d.ts +8 -0
  95. package/dist/modules/instant-purchase/src/utils/compute-selections-for-item.d.ts +7 -0
  96. package/dist/modules/instant-purchase/src/utils/create-tax-and-shipping-cache-key.d.ts +4 -0
  97. package/dist/modules/instant-purchase/src/utils/parse-non-negative-monetary-amount.d.ts +1 -0
  98. package/dist/modules/instant-purchase/src/utils/requires-tax-and-shipping-initialization.d.ts +2 -0
  99. package/dist/modules/standard-marketing/src/sagas/offer-engagement/sagas.d.ts +2 -1
  100. package/node_modules/@rokt/dcui-layout-schema/dist/schema.d.ts +583 -21
  101. package/node_modules/@rokt/dcui-layout-schema/dist/tsconfig.tsbuildinfo +1 -1
  102. package/node_modules/@rokt/dcui-layout-schema/package.json +1 -1
  103. package/node_modules/@rokt/dcui-layout-schema/v1.21/index.d.ts +7105 -0
  104. package/node_modules/@rokt/dcui-layout-schema/v1.21/index.js +4 -0
  105. package/node_modules/@rokt/dcui-layout-schema/v1.22/index.d.ts +7121 -0
  106. package/node_modules/@rokt/dcui-layout-schema/v1.22/index.js +4 -0
  107. package/node_modules/@rokt/dcui-layout-schema/v1.23/index.d.ts +7126 -0
  108. package/node_modules/@rokt/dcui-layout-schema/v1.23/index.js +4 -0
  109. package/node_modules/@rokt/dcui-layout-schema/v1.24/index.d.ts +7492 -0
  110. package/node_modules/@rokt/dcui-layout-schema/v1.24/index.js +4 -0
  111. package/node_modules/@rokt/dcui-layout-schema/v1.25/index.d.ts +7510 -0
  112. package/node_modules/@rokt/dcui-layout-schema/v1.25/index.js +4 -0
  113. package/node_modules/@rokt/dcui-layout-schema/v1.26/index.d.ts +7516 -0
  114. package/node_modules/@rokt/dcui-layout-schema/v1.26/index.js +4 -0
  115. package/node_modules/@rokt/dcui-layout-schema/v1.27/index.d.ts +7577 -0
  116. package/node_modules/@rokt/dcui-layout-schema/v1.27/index.js +4 -0
  117. package/node_modules/@rokt/dcui-layout-schema/v1.28/index.d.ts +7628 -0
  118. package/node_modules/@rokt/dcui-layout-schema/v1.28/index.js +4 -0
  119. package/node_modules/@rokt/dcui-layout-schema/v1.29/index.d.ts +7643 -0
  120. package/node_modules/@rokt/dcui-layout-schema/v1.29/index.js +4 -0
  121. package/node_modules/@rokt/dcui-layout-schema/v1.30/index.d.ts +7659 -0
  122. package/node_modules/@rokt/dcui-layout-schema/v1.30/index.js +4 -0
  123. package/package.json +2 -2
@@ -1,87 +1 @@
1
- import { ProgressIndicatorModel, WhenPredicate } from '@rokt/dcui-layout-schema';
2
- export interface StateProps {
3
- /** The number of indicators */
4
- numOfIndicators: number;
5
- /** The currently active index. */
6
- activeIndex: number;
7
- /** The index of the indicator to start displaying from **/
8
- startIndex: number;
9
- }
10
- export interface OwnProps {
11
- /**
12
- * - `indicator`: The string content of the indicator.
13
- * - `styles`:
14
- * * `elements`:
15
- * * `own`:
16
- * - `container`
17
- * - `background`
18
- * - `border`
19
- * - `dimension`
20
- * - `flexChild`
21
- * - `spacing`
22
- * * `indicator`:
23
- * - `container`
24
- * - `background`
25
- * - `border`
26
- * - `dimension`
27
- * - `flexChild`
28
- * - `spacing`
29
- * - `text`
30
- * * `activeIndicator`:
31
- * - `container`
32
- * - `background`
33
- * - `border`
34
- * - `dimension`
35
- * - `flexChild`
36
- * - `spacing`
37
- * - `text`
38
- * * `seenIndicator`:
39
- * - `container`
40
- * - `background`
41
- * - `border`
42
- * - `dimension`
43
- * - `flexChild`
44
- * - `spacing`
45
- * - `text`
46
- * * `transitions`:
47
- * - `type`: 'Conditional'
48
- * - `transition`:
49
- * * `predicates`: WhenPredicate[]
50
- * * `duration`: number
51
- * * `value`:
52
- * * `own`:
53
- * - `container`
54
- * - `background`
55
- * - `border`
56
- * - `dimension`
57
- * - `flexChild`
58
- * - `spacing`
59
- * * `indicator`:
60
- * - `container`
61
- * - `background`
62
- * - `border`
63
- * - `dimension`
64
- * - `flexChild`
65
- * - `spacing`
66
- * - `text`
67
- * * `activeIndicator`:
68
- * - `container`
69
- * - `background`
70
- * - `border`
71
- * - `dimension`
72
- * - `flexChild`
73
- * - `spacing`
74
- * - `text`
75
- * * `seenIndicator`:
76
- * - `container`
77
- * - `background`
78
- * - `border`
79
- * - `dimension`
80
- * - `flexChild`
81
- * - `spacing`
82
- * - `text`
83
- */
84
- schema: ProgressIndicatorModel<WhenPredicate>;
85
- }
86
- export interface ProgressIndicatorProps extends OwnProps, StateProps {
87
- }
1
+ export type { ProgressIndicatorProps, ProgressIndicatorStateProps as StateProps, ProgressIndicatorSchemaProps as OwnProps, } from '../../../../dcui-components/src/index';
@@ -0,0 +1,54 @@
1
+ import { RaiseSignal } from '../../../domain/src/behaviors';
2
+ import { Impression, Viewed } from '../../../domain/src/models';
3
+ export interface CreativeIdentity {
4
+ creativeInstanceGuid: string;
5
+ offerPositionIndex: number;
6
+ }
7
+ export interface PresentationIdentity extends CreativeIdentity {
8
+ sessionId: string;
9
+ revision: number;
10
+ }
11
+ export type Qualification = Pick<Viewed, 'supportedByBrowser' | 'inferred'>;
12
+ type MeasurementStore = {
13
+ dispatch(action: RaiseSignal): void;
14
+ };
15
+ /** One registry per parent store/selection, never one per child session. */
16
+ export declare function getContinuousMeasurement(store: MeasurementStore): CreativeMeasurement;
17
+ /**
18
+ * Parent-owned creative signals. Layout/slot signals deliberately bypass this
19
+ * ledger. Registration is explicit: the disabled capability and ordinary layouts
20
+ * must never change their existing measurement just because a child exists.
21
+ */
22
+ export declare class CreativeMeasurement {
23
+ private readonly emit;
24
+ private readonly creatives;
25
+ private readonly presentations;
26
+ private sessionId;
27
+ private highestRevision;
28
+ private occluded;
29
+ private readonly listeners;
30
+ constructor(emit: (action: RaiseSignal) => void);
31
+ /** A new served selection is a new lifetime; reopening the child is not. */
32
+ resetSelection(): void;
33
+ registerCreative(identity: CreativeIdentity, ownsViewability: boolean): void;
34
+ getEmbeddedPolicy(identity: CreativeIdentity): {
35
+ registered: boolean;
36
+ ownsViewability: boolean;
37
+ occluded: boolean;
38
+ };
39
+ subscribe(listener: () => void): () => void;
40
+ setOccluded(occluded: boolean): void;
41
+ /** Consumes only opted-in CREATIVE signals; false means use the legacy path. */
42
+ reportEmbedded(identity: CreativeIdentity, signal: Impression | Viewed): boolean;
43
+ /** Called after the child applied the snapshot, not when it was configured. */
44
+ acknowledge(identity: PresentationIdentity): boolean;
45
+ beginSession(sessionId: string): void;
46
+ endSession(): void;
47
+ reportExpanded(identity: PresentationIdentity, qualification?: Qualification): boolean;
48
+ private getCreative;
49
+ private matchesAcknowledged;
50
+ private render;
51
+ private qualify;
52
+ private notify;
53
+ }
54
+ export {};
@@ -1,3 +1,9 @@
1
1
  export type GlobalOfferDataState = {
2
2
  [key: string]: unknown;
3
3
  };
4
+ export type OfferStateCartItem = {
5
+ cartItemId: string;
6
+ quantity: number;
7
+ };
8
+ export declare function offerStateKey(position: number): string;
9
+ export declare function readOfferStateCart(state: GlobalOfferDataState, position: number): Array<OfferStateCartItem>;
@@ -1,3 +1,4 @@
1
1
  export type ModuleState = {
2
2
  loadedModules: Array<string>;
3
+ cartListenerCounts: Record<number, number>;
3
4
  };
@@ -1,5 +1,13 @@
1
1
  import { AnyAction } from '@reduxjs/toolkit';
2
2
  import { ProgressionState } from '../../models';
3
3
  export declare function makeInitialProgressionState(): null;
4
+ /**
5
+ * A group size is usable only as a whole number from 1 up to the total count.
6
+ * The value comes from the layout's viewableItems, which the plugin does not
7
+ * re-check at runtime: a fraction below 1 makes totalCount / groupSize as
8
+ * large as the layout likes, and a fraction above 1 produces fractional offer
9
+ * indexes.
10
+ */
11
+ export declare function isValidGroupSize(groupSize: number, totalCount: number): boolean;
4
12
  export declare function getNumberOfGroups(totalCount: number, groupSize: number): number;
5
13
  export declare function progressionReducer(state: ProgressionState | undefined, action: AnyAction): ProgressionState;
@@ -0,0 +1,15 @@
1
+ import { ContinuousPresentationInput } from '../../../../domain/src/behaviors';
2
+ import { ContinuousGatewayService } from '../../../../module-connector/src/main';
3
+ import type { AppStore } from '../../store';
4
+ import { PluginService } from '../../plugin-service';
5
+ import { ContinuousChildCoordinator } from './continuous-child';
6
+ export declare function isContinuousEngagement(action: unknown): boolean;
7
+ /** Connect the coordinator to trusted selected slots and the existing module response path. */
8
+ export declare function makeContinuousChildHost(store: Pick<AppStore, 'getState' | 'dispatch' | 'subscribe'>, service: PluginService, enabled?: boolean): {
9
+ gateway: ContinuousGatewayService | undefined;
10
+ coordinator: ContinuousChildCoordinator;
11
+ getSequence: (key: string, onRejected?: (reason: string) => void) => ContinuousPresentationInput[] | undefined;
12
+ transformAction(action: unknown): unknown;
13
+ observeAction(action: unknown): void;
14
+ close(): Promise<void>;
15
+ };
@@ -0,0 +1,52 @@
1
+ import { LinkOpenTarget } from '@rokt/dcui-layout-schema';
2
+ import { ContinuousExposure, ContinuousPresentation, ContinuousPresentationInput } from '../../../../domain/src/behaviors';
3
+ export interface ContinuousChildTransport {
4
+ send(name: string, payload: object): Promise<void>;
5
+ onEvent(name: string): {
6
+ subscribe(callback: (value: unknown) => void): {
7
+ unsubscribe(): void;
8
+ };
9
+ };
10
+ close(): Promise<void>;
11
+ onClose(): Promise<void>;
12
+ }
13
+ export interface ContinuousChildDependencies {
14
+ createChild(presentation: ContinuousPresentation): Promise<ContinuousChildTransport>;
15
+ getSequence(key: string): ContinuousPresentationInput[] | undefined;
16
+ getActivePosition(): number;
17
+ navigate(position: number): void;
18
+ respond(position: number, key: 'positive' | 'negative', openLinks?: LinkOpenTarget): Promise<void>;
19
+ dismiss(position: number, dismissalMethod?: string): Promise<void>;
20
+ onApplied?(presentation: ContinuousPresentation): void;
21
+ onExposure?(presentation: ContinuousPresentation, report: ContinuousExposure): void;
22
+ onOcclusion?(occluded: boolean): void;
23
+ onError?(error: Error): void;
24
+ }
25
+ export declare function compatibleContinuousSequence(sequence: ContinuousPresentationInput[]): boolean;
26
+ /** One parent-owned session. Never rebinds the launching module's gateway. */
27
+ export declare class ContinuousChildCoordinator {
28
+ private readonly dependencies;
29
+ private child?;
30
+ private sequence;
31
+ private current?;
32
+ private applied?;
33
+ private acknowledged;
34
+ private subscriptions;
35
+ private actionIds;
36
+ private busy;
37
+ private opening;
38
+ private ready;
39
+ private epoch;
40
+ private acknowledgementTimer?;
41
+ private key;
42
+ constructor(dependencies: ContinuousChildDependencies);
43
+ open(position: number, key: string): Promise<boolean>;
44
+ /** Called on authoritative parent progression changes. */
45
+ sync(): void;
46
+ private makePresentation;
47
+ private push;
48
+ private request;
49
+ private awaitAcknowledgement;
50
+ private reset;
51
+ close(): Promise<void>;
52
+ }
@@ -1,4 +1,4 @@
1
1
  import { GlobalGatewayFactory } from '../../../module-connector/src/main';
2
2
  import { PluginService } from '../plugin-service';
3
3
  export * from './plugin';
4
- export declare function appSagas(pluginService: PluginService, gatewayFactory: GlobalGatewayFactory): Generator<import("redux-saga/effects").AllEffect<import("redux-saga/effects").ForkEffect<void> | Generator<import("redux-saga/effects").CallEffect | import("redux-saga/effects").TakeEffect, void, import("redux-saga").TakeableChannel<unknown> | undefined> | Generator<import("redux-saga/effects").CallEffect | import("redux-saga/effects").ActionChannelEffect | import("redux-saga/effects").ChannelTakeEffect<unknown>, void, import("redux-saga").TakeableChannel<unknown> | undefined>>, void, unknown>;
4
+ export declare function appSagas(pluginService: PluginService, gatewayFactory: GlobalGatewayFactory, closeContinuous?: () => Promise<void>): Generator<import("redux-saga/effects").AllEffect<import("redux-saga/effects").ForkEffect<void> | Generator<import("redux-saga/effects").CallEffect | import("redux-saga/effects").TakeEffect, void, import("redux-saga").TakeableChannel<unknown> | undefined> | Generator<import("redux-saga/effects").CallEffect | import("redux-saga/effects").ActionChannelEffect | import("redux-saga/effects").ChannelTakeEffect<unknown>, void, import("redux-saga").TakeableChannel<unknown> | undefined>>, void, unknown>;
@@ -3,9 +3,9 @@ import { PluginCreativeResponseOption } from '../../../../domain/src/models';
3
3
  import { CallEffect, PutEffect, SelectEffect, TakeEffect } from 'redux-saga/effects';
4
4
  import { ReportError, ClosePlugin, OfferEngagement } from '../../actions';
5
5
  import { ContextService, PartnerInteractionService } from '../../../../plugin-utils/src/index';
6
- import { WindowRef } from '../../../../layout-renderer-utils/src/index';
7
- type NextValues = WindowRef | CallEffect | null | undefined;
8
- type OfferCompletionResult = 'SUCCESS' | 'UNSPECIFIED' | 'ERROR' | 'EXPLICIT_DISMISSAL' | 'IMPLICIT_DISMISSAL' | 'END';
6
+ import { HandleUnavailable, WindowRef } from '../../../../layout-renderer-utils/src/index';
7
+ type NextValues = WindowRef | HandleUnavailable | CallEffect | null | undefined;
8
+ type OfferCompletionResult = 'SUCCESS' | 'ERROR' | 'EXPLICIT_DISMISSAL' | 'IMPLICIT_DISMISSAL' | 'END';
9
9
  declare const handleUrlResponse: (args_0: PluginCreativeResponseOption, args_1: ContextService, args_2: import("@rokt/plugin").SenderReceiver, args_3: OfferEngagement) => Generator<TakeEffect | NextValues | PutEffect<RaiseSignal | ClosePlugin | ReportError>, OfferCompletionResult, NextValues>;
10
10
  export declare function processOfferResponse(dependencies: {
11
11
  context: ContextService;
@@ -1,6 +1,6 @@
1
1
  import { CallEffect, ChannelTakeEffect, PutEffect, SelectEffect } from 'redux-saga/effects';
2
2
  import { Cart } from '@rokt/partner-integration';
3
3
  import { PartnerInteractionService } from '../../../../plugin-utils/src/index';
4
- import { SlotState } from '../../models';
5
- export declare function reconcilePartnerCartItem(message: Cart.V2.UpdateCartItemPartnerMessageBody): Generator<SelectEffect | PutEffect, void, SlotState>;
4
+ import { AppState } from '../../models';
5
+ export declare function reconcilePartnerCartItem(message: Cart.V2.UpdateCartItemPartnerMessageBody): Generator<SelectEffect | PutEffect, void, AppState>;
6
6
  export declare function listenForPartnerCartItemSync(partner: PartnerInteractionService): Generator<ChannelTakeEffect<Cart.V2.UpdateCartItemPartnerMessageBody> | CallEffect | PutEffect, void, Cart.V2.UpdateCartItemPartnerMessageBody>;
@@ -1,11 +1,17 @@
1
1
  import { CallEffect, PutEffect, SelectEffect, TakeEffect } from 'redux-saga/effects';
2
- import { ProcessProgression, StateActions, UpdateActiveBreakpointAction } from '../../actions';
2
+ import { InitialiseBreakpointAction, ProcessProgression, StateActions, UpdateActiveBreakpointAction } from '../../actions';
3
3
  import { CloseOnNegativeResponsePolicy } from '@rokt/dcui-layout-schema';
4
4
  type ProgressResult = {
5
5
  exists: boolean;
6
6
  isLastOffer: boolean;
7
7
  };
8
8
  type NextValues = ProgressResult | boolean | number | CloseOnNegativeResponsePolicy | undefined;
9
- export declare function updateGroupSize(action: UpdateActiveBreakpointAction): Generator<SelectEffect | PutEffect<StateActions>, void, Array<number> | undefined>;
9
+ /**
10
+ * Sends the group size for the breakpoint the action names, on the first
11
+ * breakpoint read (INITIALISE_BREAKPOINT) and on every later change
12
+ * (UPDATE_ACTIVE_BREAKPOINT). The first read names no breakpoint when the
13
+ * channel reports none, and the reducer reads that as the default one.
14
+ */
15
+ export declare function updateGroupSize(action: UpdateActiveBreakpointAction | InitialiseBreakpointAction): Generator<SelectEffect | PutEffect<StateActions>, void, Array<number> | undefined>;
10
16
  export declare function processProgress(action: ProcessProgression): Generator<SelectEffect | CallEffect | PutEffect | TakeEffect, void, NextValues>;
11
17
  export {};
@@ -14,3 +14,24 @@ export type Distribution = {
14
14
  };
15
15
  export declare function getDistribution(layout: LayoutSchemaModel): Distribution | undefined;
16
16
  export declare function getDistributionViewableItems(distribution: Distribution | undefined): Array<number> | undefined;
17
+ /**
18
+ * The layout's viewableItems entry for a breakpoint, made safe for the
19
+ * progression reducer: a value of at least 1 is rounded down to a whole
20
+ * number, so 2.5 keeps a group of 2, and anything else (a value below 1,
21
+ * a missing entry, a value that is not a finite number) becomes 1, the
22
+ * value the reducer already uses when a layout names no group size.
23
+ */
24
+ export declare function normaliseGroupSize(value: number | undefined): number;
25
+ /**
26
+ * True when normaliseGroupSize uses a value other than the one the layout
27
+ * configured, the case the plugin saga reports as INVALID_GROUP_SIZE. A
28
+ * missing entry is a layout that names no group size, not a changed one.
29
+ */
30
+ export declare function isGroupSizeChanged(value: number | undefined): boolean;
31
+ /**
32
+ * A normalised group size capped at the number of offers the placement
33
+ * holds: the reducer refuses a group larger than the placement, so one offer
34
+ * with viewableItems [2] at a breakpoint keeps a group of 1 instead of a
35
+ * null progression.
36
+ */
37
+ export declare function capGroupSize(groupSize: number, slotSize: number): number;
@@ -3,5 +3,8 @@ export { Distribution } from './distribution';
3
3
  declare const _default: {
4
4
  getDistribution(layout: import("@rokt/dcui-layout-schema").LayoutSchemaModel): distributionUtils.Distribution | undefined;
5
5
  getDistributionViewableItems(distribution: distributionUtils.Distribution | undefined): Array<number> | undefined;
6
+ normaliseGroupSize(value: number | undefined): number;
7
+ isGroupSizeChanged(value: number | undefined): boolean;
8
+ capGroupSize(groupSize: number, slotSize: number): number;
6
9
  };
7
10
  export default _default;
@@ -1,7 +1,14 @@
1
- import { GlobalOfferDataState } from '../../models';
1
+ import { GlobalOfferDataState, OfferStateCartItem } from '../../models';
2
2
  export declare function getTotalCartQty(state: {
3
3
  globalOfferDataState: GlobalOfferDataState;
4
4
  }): number;
5
5
  export declare function getOfferState(state: {
6
6
  globalOfferDataState: GlobalOfferDataState;
7
7
  }, position: number): unknown;
8
+ /**
9
+ * The cart held for one position: what its module last published, with
10
+ * the partner updates retained while it was unmounted.
11
+ */
12
+ export declare function getOfferStateCart(state: {
13
+ globalOfferDataState: GlobalOfferDataState;
14
+ }, position: number): Array<OfferStateCartItem>;
@@ -1,6 +1,7 @@
1
1
  import { DisplayInterface, PluginInterface } from '@rokt/plugin';
2
2
  import { EventChannel } from 'redux-saga';
3
3
  export type DisplayService = Pick<DisplayInterface, 'setDisplaySettings'> & {
4
+ scrollHostToViewportOffset?(viewportOffsetY: number): Promise<void>;
4
5
  activeBreakpointEventChannel?(breakpoints: Record<string, number>): EventChannel<string>;
5
6
  };
6
7
  export declare const makeDisplayService: (pluginInterface: Pick<PluginInterface, 'display'>) => DisplayService;
@@ -1,4 +1,5 @@
1
1
  export * from './catalog-translator';
2
+ export * from './quantity-rules';
2
3
  export * from './stringify';
3
4
  export * from './take-in-sequence';
4
5
  export * from './take-one';
@@ -0,0 +1,184 @@
1
+ import { PluginCatalogItem } from '../../../domain/src/models';
2
+ /**
3
+ * The keys under which the transport emits the quantity rules on a catalog
4
+ * item's `copy` map, each mapped to the name the plugin uses for it. The
5
+ * keys carry the `provider.` prefix every partner-supplied field on the map
6
+ * carries, and each names the quantity it bounds, beside the item's
7
+ * `maxItemCount` and the offer's `maxTotalItemsQtyInOffer`, so a layout
8
+ * reads a rule as `%^DATA.catalogItem.copy.provider.quantityLimit^%`. Each
9
+ * value is a whole number as a string, and a rule that does not apply to the
10
+ * item is absent or 0. The first four are the item's own rules
11
+ * (readQuantityRules). The offer limit is the offer's: the transport writes
12
+ * the offer-wide max on every item of the offer, and it caps the total
13
+ * quantity across all the offer's items (readOfferQuantityLimit). The
14
+ * boundary is this map alone: the rest of the plugin reads the rules by the
15
+ * names on the left.
16
+ */
17
+ export declare const QUANTITY_RULE_KEYS: {
18
+ readonly max: "provider.quantityLimit";
19
+ readonly min: "provider.minimumQuantity";
20
+ readonly multiple: "provider.quantityMultiple";
21
+ readonly exact: "provider.exactQuantity";
22
+ readonly offerLimit: "provider.offerQuantityLimit";
23
+ };
24
+ export type QuantityRules = {
25
+ /**
26
+ * The per-item maximum: the max the item sets, or Infinity when it sets
27
+ * none, or 0, whatever other rules it carries. The transport supplies the
28
+ * max where one applies, so the plugin never defaults it, and an item
29
+ * without one is bounded by its existing per-item cap and the offer caps
30
+ * alone. Never null.
31
+ */
32
+ max: number;
33
+ /** The least quantity the item can hold besides 0; 0 when absent. */
34
+ min: number;
35
+ /** The step every quantity besides 0 is a multiple of; 1 when absent. */
36
+ multiple: number;
37
+ /**
38
+ * The only quantity the item can hold besides 0, or the offer capacity left
39
+ * by the other items when that is lower; absent when unset.
40
+ */
41
+ exact?: number;
42
+ };
43
+ export type ExactRules = QuantityRules & {
44
+ exact: number;
45
+ };
46
+ export type QuantityBounds = {
47
+ /**
48
+ * The item's existing per-item minimum, a floor under the rules; 0 when
49
+ * absent.
50
+ */
51
+ minItemCount: number;
52
+ /** The cap the item's own rules set, from getItemCap. */
53
+ itemCap: number;
54
+ /**
55
+ * The cap the quantity can reach under the offer capacity as well, from
56
+ * getApplicableCap, or a bound the caller sets in its place, at or below
57
+ * the item cap. Only the item cap overrides the minimum, so this cap admits
58
+ * nothing when it is below the first admitted multiple.
59
+ */
60
+ cap: number;
61
+ };
62
+ export type CapInputs = {
63
+ /** The item's existing per-item cap. */
64
+ maxItemCount?: number;
65
+ /**
66
+ * The offer's existing cap on the total quantity across its items,
67
+ * maxTotalItemsQtyInOffer; absent, or null as the offer may carry it, when
68
+ * the offer sets none.
69
+ */
70
+ offerCap?: number | null;
71
+ /**
72
+ * The offer limit the items carry (readOfferQuantityLimit), a second cap
73
+ * on the same total; absent when no item carries one. Both caps apply and
74
+ * the smaller wins (getOfferCap).
75
+ */
76
+ offerLimit?: number;
77
+ /** The offer's total quantity minus this item's own quantity. */
78
+ offerQuantityOfOthers: number;
79
+ };
80
+ /**
81
+ * Reads the item's four quantity rules from a catalog item's attributes,
82
+ * applying the effective defaults (no max, minimum 0, multiple 1, no exact
83
+ * quantity) so that an item with no rules behaves as the counter does today.
84
+ * A max that is absent or 0 reads as no max of its own, Infinity, whatever
85
+ * other rules the item carries: the transport supplies the max where one
86
+ * applies, so the plugin never defaults it, and the item's existing per-item
87
+ * cap and the offer caps alone bound it. The offer limit is the offer's and
88
+ * is not an item rule (readOfferQuantityLimit).
89
+ */
90
+ export declare function readQuantityRules(catalogItem: Pick<PluginCatalogItem, 'copy'>): QuantityRules;
91
+ /**
92
+ * The offer limit the items of an offer carry: the cap on the total quantity
93
+ * across all the offer's cart items, which the transport writes under the
94
+ * same key, with the same value, on every item of the offer. Read as the
95
+ * first positive whole number across the offer's catalog items, the item's
96
+ * own attributes first, so an item that lacks the key is still bounded by
97
+ * the limit its siblings carry. Undefined when no item carries one: the
98
+ * transport writes 0 for no additional offer limit, and 0, like an absent or
99
+ * malformed value, is no rule. It applies beside the offer's existing
100
+ * maxTotalItemsQtyInOffer, and the smaller wins (getOfferCap).
101
+ */
102
+ export declare function readOfferQuantityLimit(catalogItems: ReadonlyArray<Pick<PluginCatalogItem, 'copy'>>, ownItem?: Pick<PluginCatalogItem, 'copy'>): number | undefined;
103
+ /**
104
+ * Whether the item carries a rule beyond the effective defaults: a max of
105
+ * its own, a minimum, a multiple or an exact quantity. An item with no rule
106
+ * keeps today's behaviour under its existing cap and the offer caps alone.
107
+ * The offer limit is the offer's and makes no item a rule-carrying one.
108
+ */
109
+ export declare function hasQuantityRules(rules: QuantityRules): boolean;
110
+ export declare function isExactRules(rules: QuantityRules): rules is ExactRules;
111
+ /**
112
+ * The cap the item's own rules set: the smaller of its max and its existing
113
+ * per-item cap. An item that sets no max, with or without other rules, has
114
+ * no max of its own, so its existing cap alone bounds it, as before the
115
+ * rules. An exact item has no own cap, because its exact quantity overrides
116
+ * its own limits; the offer capacity alone bounds it, in getApplicableCap.
117
+ * This cap alone overrides the minimum, and a quantity the cart already holds
118
+ * is corrected against it alone, because the offer capacity bounds additions
119
+ * and never cuts an existing quantity.
120
+ */
121
+ export declare function getItemCap(rules: QuantityRules, maxItemCount: number | undefined): number;
122
+ /**
123
+ * The cap on the total quantity across the offer's items: the smaller of the
124
+ * offer's existing maxTotalItemsQtyInOffer and the offer limit the items
125
+ * carry, each applying where it is set, or Infinity when neither is.
126
+ */
127
+ export declare function getOfferCap(caps: Pick<CapInputs, 'offerCap' | 'offerLimit'>): number;
128
+ /**
129
+ * The cap an item's quantity can reach: the smaller of its own cap and the
130
+ * offer capacity left by the other items under the offer cap (getOfferCap),
131
+ * or Infinity when none applies. An exact item has no own cap, so for it
132
+ * this is the offer capacity alone: an exact quantity above it is capped
133
+ * there.
134
+ */
135
+ export declare function getApplicableCap(rules: QuantityRules, caps: CapInputs): number;
136
+ /**
137
+ * The cap the ordinary update keeps for an item's quantity: the smaller of
138
+ * the applicable cap (getApplicableCap) and the item's existing per-item cap,
139
+ * which the ordinary update keeps for an exact item too (the exact path
140
+ * alone bypasses it). A quantity at or below it can be held, and an increase
141
+ * above it is refused, wherever a partner update is applied to a cart: the
142
+ * module's own update and the hold the orchestrator keeps for a module that
143
+ * is not mounted read this one cap, so the two never disagree on a quantity.
144
+ */
145
+ export declare function getUpdateCap(rules: QuantityRules, caps: CapInputs): number;
146
+ /**
147
+ * The correction applied to a typed quantity when it is committed and to an
148
+ * existing quantity on the first render. Zero and anything that is not a
149
+ * positive number mean removal. Any positive quantity on an exact item becomes
150
+ * the exact quantity, or the cap when the exact quantity is above it, or
151
+ * removal when the cap admits nothing. Otherwise a positive quantity becomes
152
+ * the multiple at or below it, raised to the first admitted multiple when it
153
+ * is below that and cut to the last when it is above it, the item's own cap
154
+ * winning over the minimum when the two disagree. So with the default step a
155
+ * quantity below the minimum becomes the minimum and a quantity above the cap
156
+ * becomes the cap. The first multiple lies at or above the item's existing
157
+ * minimum too, so a correction never goes below that floor. A cap that admits
158
+ * nothing means removal.
159
+ */
160
+ export declare function normalizeQuantity(rules: QuantityRules, bounds: QuantityBounds, quantity: number): number;
161
+ /**
162
+ * The quantity the increment button selects from a normalized quantity: the
163
+ * next admitted multiple above it. From zero with a minimum of 3 and a
164
+ * multiple of 2 that is 4, and from 4 it is 6. At the last multiple under the
165
+ * cap it changes nothing, and the increment is disabled there, as it is from
166
+ * zero when the cap admits nothing. On an exact item it selects the exact
167
+ * quantity, or the cap below it, and changes nothing once the quantity is at
168
+ * or above that.
169
+ */
170
+ export declare function plusStep(rules: QuantityRules, bounds: QuantityBounds, quantity: number): number;
171
+ /**
172
+ * The quantity the decrement button selects from a normalized quantity: the
173
+ * previous multiple below it, or 0 when that multiple is below the first
174
+ * admitted one. From 4 with a minimum of 3 and a multiple of 2 it removes the
175
+ * item, because 2 is below the minimum. On an exact item any positive
176
+ * quantity goes to zero.
177
+ */
178
+ export declare function minusStep(rules: QuantityRules, bounds: QuantityBounds, quantity: number): number;
179
+ /**
180
+ * Whether the increment button is disabled: when no admitted multiple lies
181
+ * above the quantity under the cap, when no more of the item can be added to
182
+ * the offer, or once an exact item holds its quantity, or the cap below it.
183
+ */
184
+ export declare function isIncrementDisabled(rules: QuantityRules, bounds: QuantityBounds, quantity: number, maxAddableQuantity: number): boolean;
@@ -1,4 +1,5 @@
1
1
  import { PluginCatalogItem } from '../../../../libraries/domain/src/models';
2
+ import { CartState } from '../models';
2
3
  export type UpdateCartPayload = {
3
4
  catalogItem: PluginCatalogItem;
4
5
  quantity: number;
@@ -8,4 +9,9 @@ export type UpdateCart = {
8
9
  type: typeof UPDATE_CART;
9
10
  payload: UpdateCartPayload;
10
11
  };
11
- export type CartActions = UpdateCart;
12
+ export declare const HYDRATE_RETAINED_CART = "CART/HYDRATE_RETAINED";
13
+ export type HydrateRetainedCart = {
14
+ type: typeof HYDRATE_RETAINED_CART;
15
+ payload: CartState;
16
+ };
17
+ export type CartActions = UpdateCart | HydrateRetainedCart;
@@ -8,4 +8,18 @@ export type CatalogItemResponse = {
8
8
  type: typeof CATALOG_ITEM_RESPONSE;
9
9
  payload: CatalogItemResponsePayload;
10
10
  };
11
- export type CatalogItemActions = CatalogItemResponse;
11
+ export type CatalogItemExactResponsePayload = {
12
+ catalogItem: PluginCatalogItem;
13
+ };
14
+ /**
15
+ * Sets an exact-quantity item to its exact quantity, or to the offer capacity
16
+ * the other items leave when the exact quantity is above it. The quantity is
17
+ * read from the item's own rules and the cart in the saga, so a stale closure
18
+ * never sets another number, and the item cap does not apply to it.
19
+ */
20
+ export declare const CATALOG_ITEM_EXACT_RESPONSE = "CATALOG_ITEM/EXACT_RESPONSE";
21
+ export type CatalogItemExactResponse = {
22
+ type: typeof CATALOG_ITEM_EXACT_RESPONSE;
23
+ payload: CatalogItemExactResponsePayload;
24
+ };
25
+ export type CatalogItemActions = CatalogItemResponse | CatalogItemExactResponse;
@@ -3,7 +3,8 @@ import { LayoutSchemaModel, EqualityWhenCondition, OrderableWhenCondition } from
3
3
  export type QuantityCondition = EqualityWhenCondition | OrderableWhenCondition;
4
4
  export interface QuantityPredicate {
5
5
  condition: QuantityCondition;
6
- value: number;
6
+ /** Fixed number or a numeric string resolved through the current data mapper. */
7
+ value: number | string;
7
8
  }
8
9
  export interface WhenCatalogQuantityModel {
9
10
  cartItemId: string;
@@ -1,4 +1,5 @@
1
1
  import { AnyAction } from '@reduxjs/toolkit';
2
2
  import { CartState, AppSettingsCartItemState } from '../../models';
3
- export declare function makeInitialCartState(cart: Array<AppSettingsCartItemState>): CartState;
3
+ import { PluginCatalogItem } from '../../../../../libraries/domain/src/models';
4
+ export declare function makeInitialCartState(cart: Array<AppSettingsCartItemState>, catalogItems?: Array<PluginCatalogItem>): CartState;
4
5
  export declare function cartReducer(state: CartState | undefined, action: AnyAction): CartState;
@@ -2,6 +2,7 @@ import { GlobalGateway } from '../../../../libraries/module-connector/src/main';
2
2
  import { Log } from '../../../../libraries/domain/src/models';
3
3
  export declare const sagaActionTypes: {
4
4
  readonly CATALOG_ITEM_RESPONSE: "CATALOG_ITEM/RESPONSE";
5
+ readonly CATALOG_ITEM_EXACT_RESPONSE: "CATALOG_ITEM/EXACT_RESPONSE";
5
6
  readonly RAISE_METRIC: "GLOBAL/RAISE_METRIC";
6
7
  readonly PREPARE_SIGNAL: "GLOBAL/PREPARE_SIGNAL";
7
8
  readonly OFFER_ENGAGEMENT: "GLOBAL/OFFER_ENGAGEMENT";
@@ -26,4 +27,4 @@ export declare const sagaActionTypes: {
26
27
  readonly VALIDATE_FORM_FIELDS: "GLOBAL/VALIDATE_FORM_FIELDS";
27
28
  readonly REPORT_ERROR: "ERROR/REPORT";
28
29
  };
29
- export declare function appSagas(gateway: GlobalGateway, logger: (log: Log) => void): Generator<import("redux-saga/effects").AllEffect<import("redux-saga/effects").ForkEffect<void>>, void, unknown>;
30
+ export declare function appSagas(gateway: GlobalGateway, logger: (log: Log) => void): Generator<import("redux-saga/effects").CallEffect<void> | import("redux-saga/effects").ForkEffect<never> | import("redux-saga/effects").AllEffect<import("redux-saga/effects").ForkEffect<void>>, void, unknown>;
@@ -1,10 +1,13 @@
1
- import { CallEffect, CancelledEffect, ChannelTakeEffect, PutEffect, SelectEffect, TakeEffect } from 'redux-saga/effects';
1
+ import { EventChannel } from 'redux-saga';
2
+ import { CallEffect, ChannelTakeEffect, PutEffect, SelectEffect, TakeEffect, FlushEffect, ForkEffect } from 'redux-saga/effects';
2
3
  import { GlobalActions } from '../../../../../libraries/domain/src/behaviors';
3
4
  import { Log, PluginCartItem, PluginCatalogItem } from '../../../../../libraries/domain/src/models';
4
5
  import { GlobalGateway } from '../../../../../libraries/module-connector/src/main';
5
6
  import { Cart } from '@rokt/partner-integration';
6
- import { CatalogItemResponse } from '../../actions';
7
+ import { CatalogItemExactResponse, CatalogItemResponse } from '../../actions';
7
8
  export declare function processPreselectedCatalogItems(logger: (log: Log) => void): Generator<SelectEffect | CallEffect | PutEffect, void, PluginCartItem | null | undefined>;
8
9
  export declare function processUpdateCartItem(gateway: GlobalGateway, logger: (log: Log) => void, action: CatalogItemResponse): Generator<SelectEffect | CallEffect | PutEffect, void, undefined | GlobalActions | string>;
9
- export declare function listenForUpdateCartItemPartnerMessage(gateway: GlobalGateway, logger: (log: Log) => void): Generator<TakeEffect | CallEffect | CancelledEffect | ChannelTakeEffect<Cart.V2.UpdateCartItemPartnerMessageBody>, void, Cart.V2.UpdateCartItemPartnerMessageBody>;
10
+ export declare function processSetExactCartItem(gateway: GlobalGateway, logger: (log: Log) => void, action: CatalogItemExactResponse): Generator<SelectEffect | CallEffect | PutEffect, void, unknown>;
11
+ export declare function listenForUpdateCartItemPartnerMessage(gateway: GlobalGateway, logger: (log: Log) => void, preparedChannel?: EventChannel<Cart.V2.UpdateCartItemPartnerMessageBody>): Generator<TakeEffect | CallEffect | PutEffect | SelectEffect | ChannelTakeEffect<Cart.V2.UpdateCartItemPartnerMessageBody>, void, Cart.V2.UpdateCartItemPartnerMessageBody>;
12
+ export declare function initializePartnerCartSync(gateway: GlobalGateway, logger: (log: Log) => void): Generator<CallEffect | FlushEffect<Cart.V2.UpdateCartItemPartnerMessageBody> | ForkEffect, void, Array<Cart.V2.UpdateCartItemPartnerMessageBody>>;
10
13
  export declare function processPartnerUpdateCartItem(message: Cart.V2.UpdateCartItemPartnerMessageBody): Generator<SelectEffect | PutEffect, void, PluginCatalogItem | string | number | null | undefined>;