@picked/client 0.0.1-dev.1774231221701 → 0.0.1-dev.1774244905386

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 (119) hide show
  1. package/dist/{api-oudcFuUX.js → api-ENA5t36y.js} +1 -1
  2. package/dist/{api-BEXzPJHZ.cjs → api-dkMxUUe0.cjs} +1 -1
  3. package/dist/cjs/index.js +2 -2
  4. package/dist/cjs/plugins/create-experience/index.js +1 -1
  5. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  6. package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
  7. package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
  8. package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
  9. package/dist/cjs/plugins/responses-indexeddb/index.js +1 -1
  10. package/dist/cjs/plugins/single-page-app/index.js +1 -1
  11. package/dist/cjs/plugins/web-components/index.js +1 -1
  12. package/dist/cjs/server/index.js +1 -1
  13. package/dist/esm/index.js +503 -426
  14. package/dist/esm/plugins/create-experience/index.js +329 -294
  15. package/dist/esm/plugins/dynamic-experiences/index.js +53 -30
  16. package/dist/esm/plugins/experience-browser-storage/index.js +1 -1
  17. package/dist/esm/plugins/history-browser-storage/index.js +1 -1
  18. package/dist/esm/plugins/responses-browser-storage/index.js +1 -1
  19. package/dist/esm/plugins/responses-indexeddb/index.js +9 -5
  20. package/dist/esm/plugins/single-page-app/index.js +4 -4
  21. package/dist/esm/plugins/web-components/index.js +1 -1
  22. package/dist/esm/server/index.js +1 -1
  23. package/dist/experience-instance-BODAwa-_.js +713 -0
  24. package/dist/experience-instance-DImQh64e.cjs +1 -0
  25. package/dist/object-BReQiaSS.cjs +1 -0
  26. package/dist/{object-C82v79xc.js → object-Clj5zVr1.js} +1 -2
  27. package/dist/storage-BFjb8azI.cjs +1 -0
  28. package/dist/{storage-6Xk0uAxB.js → storage-DyxpJ0pg.js} +1 -3
  29. package/dist/types/entities/action/action.d.ts.map +1 -1
  30. package/dist/types/entities/condition/condition.d.ts +17 -0
  31. package/dist/types/entities/condition/condition.d.ts.map +1 -0
  32. package/dist/types/entities/experience/experience.d.ts +36 -59
  33. package/dist/types/entities/experience/experience.d.ts.map +1 -1
  34. package/dist/types/entities/experience-instance/experience-instance.d.ts +2 -2
  35. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  36. package/dist/types/entities/feature/feature.d.ts.map +1 -1
  37. package/dist/types/entities/field/field.d.ts +17 -12
  38. package/dist/types/entities/field/field.d.ts.map +1 -1
  39. package/dist/types/entities/history/history.d.ts.map +1 -1
  40. package/dist/types/entities/project/project.d.ts +9 -0
  41. package/dist/types/entities/project/project.d.ts.map +1 -0
  42. package/dist/types/entities/response/response.d.ts +10 -7
  43. package/dist/types/entities/response/response.d.ts.map +1 -1
  44. package/dist/types/entities/step/step.d.ts +38 -0
  45. package/dist/types/entities/step/step.d.ts.map +1 -0
  46. package/dist/types/index.d.ts +3 -1
  47. package/dist/types/index.d.ts.map +1 -1
  48. package/dist/types/logic-engine.d.ts +8 -2
  49. package/dist/types/logic-engine.d.ts.map +1 -1
  50. package/dist/types/picked.d.ts +61 -52
  51. package/dist/types/picked.d.ts.map +1 -1
  52. package/dist/types/plugins/create-experience/create-experience.d.ts +61 -29
  53. package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
  54. package/dist/types/plugins/create-experience/index.d.ts +2 -2
  55. package/dist/types/plugins/create-experience/index.d.ts.map +1 -1
  56. package/dist/types/plugins/create-experience/plugin.d.ts.map +1 -1
  57. package/dist/types/plugins/dynamic-experiences/plugin.d.ts +21 -4
  58. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
  59. package/dist/types/plugins/dynamic-experiences/types.d.ts +47 -0
  60. package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
  61. package/dist/types/plugins/experience-browser-storage/plugin.d.ts +1 -2
  62. package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
  63. package/dist/types/plugins/history-browser-storage/plugin.d.ts +0 -1
  64. package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -1
  65. package/dist/types/plugins/responses-browser-storage/plugin.d.ts +1 -2
  66. package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
  67. package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +1 -1
  68. package/dist/types/plugins/single-page-app/plugin.d.ts +1 -1
  69. package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
  70. package/dist/types/utils/dom.d.ts +3 -0
  71. package/dist/types/utils/dom.d.ts.map +1 -1
  72. package/dist/types/utils/events.d.ts +2 -2
  73. package/dist/types/utils/events.d.ts.map +1 -1
  74. package/dist/types/utils/global-obj.d.ts +1 -0
  75. package/dist/types/utils/global-obj.d.ts.map +1 -1
  76. package/dist/types/utils/indexed-db.d.ts +1 -2
  77. package/dist/types/utils/indexed-db.d.ts.map +1 -1
  78. package/dist/types/utils/key.d.ts +12 -0
  79. package/dist/types/utils/key.d.ts.map +1 -0
  80. package/dist/types/utils/logger.d.ts.map +1 -1
  81. package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts.map +1 -1
  82. package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts.map +1 -1
  83. package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts +3 -3
  84. package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -1
  85. package/dist/types/utils/nodes.d.ts +25 -2
  86. package/dist/types/utils/nodes.d.ts.map +1 -1
  87. package/dist/types/utils/object.d.ts +8 -0
  88. package/dist/types/utils/object.d.ts.map +1 -1
  89. package/dist/types/utils/picked-config.d.ts +1 -1
  90. package/dist/types/utils/picked-config.d.ts.map +1 -1
  91. package/dist/types/utils/search-params.d.ts.map +1 -1
  92. package/dist/types/utils/storage.d.ts.map +1 -1
  93. package/package.json +1 -11
  94. package/dist/cjs/form/index.js +0 -1
  95. package/dist/esm/form/index.js +0 -428
  96. package/dist/experience-instance-DZiAwXph.js +0 -481
  97. package/dist/experience-instance-Ddk4Jktn.cjs +0 -1
  98. package/dist/object-CUJOjanb.cjs +0 -1
  99. package/dist/rules-logic-B7vJrWyO.js +0 -231
  100. package/dist/rules-logic-CXr4wXcG.cjs +0 -1
  101. package/dist/storage-B6lQtc4-.cjs +0 -1
  102. package/dist/types/form/build-responses.d.ts +0 -14
  103. package/dist/types/form/build-responses.d.ts.map +0 -1
  104. package/dist/types/form/create-field-evaluator.d.ts +0 -19
  105. package/dist/types/form/create-field-evaluator.d.ts.map +0 -1
  106. package/dist/types/form/create-field-validation.d.ts +0 -44
  107. package/dist/types/form/create-field-validation.d.ts.map +0 -1
  108. package/dist/types/form/create-form.d.ts +0 -66
  109. package/dist/types/form/create-form.d.ts.map +0 -1
  110. package/dist/types/form/create-submit-pipeline.d.ts +0 -58
  111. package/dist/types/form/create-submit-pipeline.d.ts.map +0 -1
  112. package/dist/types/form/get-step-fields.d.ts +0 -5
  113. package/dist/types/form/get-step-fields.d.ts.map +0 -1
  114. package/dist/types/form/index.d.ts +0 -10
  115. package/dist/types/form/index.d.ts.map +0 -1
  116. package/dist/types/plugins/create-experience/serialization.d.ts +0 -6
  117. package/dist/types/plugins/create-experience/serialization.d.ts.map +0 -1
  118. /package/dist/{id-CRqy981z.js → id-BniPxOdF.js} +0 -0
  119. /package/dist/{id-Bv44ilEo.cjs → id-CIbS4P60.cjs} +0 -0
@@ -8,14 +8,20 @@ export type LogicValue = SyncLogicValue | (() => LogicValue) | (() => Promise<Sy
8
8
  export interface LogicObject {
9
9
  [key: string]: LogicValue;
10
10
  }
11
- type LogicArray = Array<LogicValue>;
11
+ export type LogicArray = Array<LogicValue>;
12
12
  export type LogicRuleValue = string | number | boolean | null | undefined | LogicRule | LogicRule[] | LogicRuleValue[];
13
13
  export interface LogicRule {
14
14
  [key: string]: LogicRuleValue | LogicRuleValue[];
15
15
  }
16
+ export type ComparisonOperation = (a: LogicValue, b: LogicValue) => boolean;
17
+ export type NumericOperation = (a: number, b: number, c?: number) => boolean | number;
18
+ export type UnaryOperation = (a: LogicValue) => LogicValue;
19
+ export type StringOperation = (source: LogicValue, start: number, end?: number) => string;
20
+ export type ArrayOperation = (...args: LogicValue[]) => LogicValue[];
21
+ export type MathOperation = (...args: number[]) => number;
16
22
  export type LogicContext = {
17
23
  [key: string]: LogicValue;
18
24
  } | LogicValue;
25
+ export type Operation = (this: LogicContext, ...args: LogicValue[]) => LogicValue | Promise<SyncLogicValue>;
19
26
  export declare function apply(logic: LogicObject | LogicValue | undefined, data?: LogicContext): Promise<LogicValue>;
20
- export {};
21
27
  //# sourceMappingURL=logic-engine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logic-engine.d.ts","sourceRoot":"","sources":["../../src/logic-engine.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,CAAA;AAEpG,MAAM,MAAM,UAAU,GAClB,cAAc,GACd,CAAC,MAAM,UAAU,CAAC,GAClB,CAAC,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC,GAC/B,OAAO,CAAC,cAAc,CAAC,CAAA;AAE3B,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;CAC1B;AAED,KAAK,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,CAAA;AAEnC,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,SAAS,GACT,SAAS,EAAE,GACX,cAAc,EAAE,CAAA;AAEpB,MAAM,WAAW,SAAS;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,cAAc,EAAE,CAAA;CACjD;AAED,MAAM,MAAM,YAAY,GACpB;IACE,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;CAC1B,GACD,UAAU,CAA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,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;AACzF,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,IAAI,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,CAAA;AACpE,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,KAAK,MAAM,CAAA;AAEzD,MAAM,MAAM,YAAY,GACpB;IACE,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;CAC1B,GACD,UAAU,CAAA;AAqCd,MAAM,MAAM,SAAS,GAAG,CACtB,IAAI,EAAE,YAAY,EAClB,GAAG,IAAI,EAAE,UAAU,EAAE,KAClB,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;AAuMzC,wBAAsB,KAAK,CACzB,KAAK,EAAE,WAAW,GAAG,UAAU,GAAG,SAAS,EAC3C,IAAI,CAAC,EAAE,YAAY,GAClB,OAAO,CAAC,UAAU,CAAC,CAoJrB"}
@@ -8,13 +8,16 @@ import { Predicate } from './entities/predicate/predicate';
8
8
  import { Feature } from './entities/feature/feature';
9
9
  import { EventBusPayload, EventHistoryStore } from './utils/events';
10
10
  import { Field } from './entities/field/field';
11
+ import { ExperienceStep } from './entities/step/step';
11
12
  import { Action } from './entities/action/action';
13
+ import { Condition } from './entities/condition/condition';
12
14
  import { SessionStore } from './utils/user-session';
13
15
  import { LogicRule } from './logic-engine';
14
16
  export declare class Picked {
15
17
  static readonly logger: (level: "log" | "warn" | "info" | "error", ...args: Parameters<Console["log"]>) => void;
16
18
  private readonly options;
17
19
  isReady: boolean;
20
+ private project?;
18
21
  private readonly plugins;
19
22
  private readonly pluginStartHooks;
20
23
  readonly eventBus: import('effector').EventCallable<EventBusPayload>;
@@ -28,7 +31,7 @@ export declare class Picked {
28
31
  readonly precondition?: LogicRule | boolean;
29
32
  readonly condition?: LogicRule | boolean;
30
33
  preconditionPassed?: boolean;
31
- readonly searchParams: import('.').PickedSearchParams;
34
+ readonly searchParams: import('./utils/search-params').PickedSearchParams;
32
35
  readonly history: {
33
36
  push: import('effector').EventCallable<{
34
37
  experienceId: string;
@@ -65,34 +68,10 @@ export declare class Picked {
65
68
  };
66
69
  readonly experiences: {
67
70
  register: (experience: Experience) => void;
68
- get: (id: Experience["id"]) => import('effector').Store<{
69
- id: string;
70
- configStore: import('effector').Store<{
71
- name: string;
72
- decisionLogic: import('./logic-engine').LogicValue | LogicRule;
73
- targetSelectors: import('.').ExperienceTarget[];
74
- initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
75
- }>;
76
- treeStore: import('effector').Store<{
77
- steps: import('.').ExperienceStep[];
78
- nodes: import('.').ExperienceNode[];
79
- edges: import('.').ExperienceEdge[];
80
- conditionals: import('.').ExperienceConditional[];
81
- }>;
82
- fieldsStore: import('effector').Store<Field[]>;
83
- componentStore: import('effector').Store<{
84
- name: string;
85
- component: AdaptedComponent<string, unknown>;
86
- frameworkStore: import('effector').Store<Framework | undefined>;
87
- } | undefined>;
88
- actions: import('.').ExperienceAction[];
89
- merge: import('effector').EventCallable<{
90
- experience: Partial<Experience>;
91
- strategy: "override";
92
- }>;
93
- } | undefined>;
94
- getById: (id: Experience["id"]) => import('effector').Store<{
71
+ get: (key: string) => import('effector').Store<{
95
72
  id: string;
73
+ key: string;
74
+ name: string;
96
75
  configStore: import('effector').Store<{
97
76
  name: string;
98
77
  decisionLogic: import('./logic-engine').LogicValue | LogicRule;
@@ -100,12 +79,11 @@ export declare class Picked {
100
79
  initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
101
80
  }>;
102
81
  treeStore: import('effector').Store<{
103
- steps: import('.').ExperienceStep[];
82
+ steps: ExperienceStep[];
104
83
  nodes: import('.').ExperienceNode[];
105
84
  edges: import('.').ExperienceEdge[];
106
- conditionals: import('.').ExperienceConditional[];
85
+ conditions: Condition[];
107
86
  }>;
108
- fieldsStore: import('effector').Store<Field[]>;
109
87
  componentStore: import('effector').Store<{
110
88
  name: string;
111
89
  component: AdaptedComponent<string, unknown>;
@@ -118,15 +96,17 @@ export declare class Picked {
118
96
  }>;
119
97
  } | undefined>;
120
98
  launch: import('effector').Effect<{
121
- id: string;
99
+ key: string;
122
100
  options?: LaunchExperienceOptions;
123
101
  }, void, Error>;
124
102
  open: import('effector').Effect<{
125
- id: string;
103
+ key: string;
126
104
  options?: import('./exports').OpenExperienceOptions;
127
105
  }, void, Error>;
128
106
  listStore: import('effector').Store<{
129
107
  id: string;
108
+ key: string;
109
+ name: string;
130
110
  configStore: import('effector').Store<{
131
111
  name: string;
132
112
  decisionLogic: import('./logic-engine').LogicValue | LogicRule;
@@ -134,12 +114,11 @@ export declare class Picked {
134
114
  initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
135
115
  }>;
136
116
  treeStore: import('effector').Store<{
137
- steps: import('.').ExperienceStep[];
117
+ steps: ExperienceStep[];
138
118
  nodes: import('.').ExperienceNode[];
139
119
  edges: import('.').ExperienceEdge[];
140
- conditionals: import('.').ExperienceConditional[];
120
+ conditions: Condition[];
141
121
  }>;
142
- fieldsStore: import('effector').Store<Field[]>;
143
122
  componentStore: import('effector').Store<{
144
123
  name: string;
145
124
  component: AdaptedComponent<string, unknown>;
@@ -173,6 +152,20 @@ export declare class Picked {
173
152
  listStore: import('effector').Store<import('.').FeatureBucket[]>;
174
153
  getEvokableFeature: (featureName: string) => import('effector').Store<() => Promise<boolean | string | undefined>>;
175
154
  };
155
+ readonly conditions: {
156
+ register: (condition: Condition) => void;
157
+ getById: (id: Condition["id"]) => import('effector').Store<Condition | null>;
158
+ getByKey: (key: Condition["key"]) => import('effector').Store<Condition | null>;
159
+ listStore: import('effector').Store<Condition[]>;
160
+ };
161
+ readonly fields: {
162
+ register: (field: Field) => void;
163
+ update: (fieldKeyOrId: import('.').FieldBase["key"], updates: Partial<Field>) => void;
164
+ getById: (id: import('.').FieldBase["id"]) => import('effector').Store<Field | null>;
165
+ getByKey: (key: import('.').FieldBase["key"]) => import('effector').Store<Field | null>;
166
+ listStore: import('effector').Store<Field[]>;
167
+ getByName: (name: import('.').FieldBase["name"]) => import('effector').Store<Field | null>;
168
+ };
176
169
  readonly responses: {
177
170
  register: {
178
171
  (fieldId: Field["id"], response: import('.').Response): void;
@@ -189,23 +182,21 @@ export declare class Picked {
189
182
  }>;
190
183
  listStore: import('effector').Store<{
191
184
  fieldId: string;
192
- value: import('.').FieldValue | undefined;
185
+ fieldKey: string;
186
+ value: import('.').FieldValue;
193
187
  }[]>;
194
188
  getAllStore: import('effector').Store<{
195
189
  [fieldId: string]: import('.').FieldValue;
196
190
  }>;
197
- getByFieldId: {
198
- (fieldId: Field["id"]): import('effector').Store<import('.').FieldValue>;
199
- <T extends import('.').JsonValue>(fieldId: Field["id"]): import('effector').Store<T | null>;
200
- };
191
+ getAllByKeyStore: import('effector').Store<Record<string, import('.').FieldValue>>;
192
+ getByFieldId: (fieldId: Field["id"]) => import('effector').Store<import('.').FieldValue>;
193
+ getByFieldKey: (key: Field["key"]) => import('effector').Store<import('.').FieldValue>;
201
194
  getByFieldName: (fieldName: Field["name"]) => import('effector').Store<import('.').FieldValue>;
202
195
  };
203
- readonly fields: {
204
- register: (field: Field) => void;
205
- update: (fieldId: import('.').FieldBase["id"], updates: Partial<Field>) => void;
206
- getById: (id: import('.').FieldBase["id"]) => import('effector').Store<Field | null>;
207
- listStore: import('effector').Store<Field[]>;
208
- getByName: (name: import('.').FieldBase["name"]) => import('effector').Store<Field | null>;
196
+ readonly steps: {
197
+ register: (step: ExperienceStep) => void;
198
+ getById: (id: ExperienceStep["id"]) => import('effector').Store<ExperienceStep | null>;
199
+ listStore: import('effector').Store<ExperienceStep[]>;
209
200
  };
210
201
  readonly actions: {
211
202
  register: (name: string, action: Action) => void;
@@ -220,13 +211,34 @@ export declare class Picked {
220
211
  registerPlugin: (plugin: Plugin) => void;
221
212
  registerFeature: (name: string, feature: Feature) => void;
222
213
  registerPredicate: (name: string, predicate: Predicate) => void;
214
+ registerCondition: (condition: Condition) => void;
223
215
  registerField: (field: Field) => void;
216
+ registerStep: (step: ExperienceStep) => void;
224
217
  registerAction: (name: string, action: Action) => void;
225
218
  registerExperience: (experience: Experience) => void;
226
219
  getStateSnapshot: () => StateSnapshot;
227
- /** @deprecated Use `client.experiences.launch({ id: experienceId })` instead. */
220
+ /**
221
+ * Launches an experience by ID.
222
+ *
223
+ * @deprecated Use `client.experiences.launch({ key: experienceKey })` instead.
224
+ * @param experienceId - The experience ID to launch.
225
+ * @param options - Optional launch options.
226
+ * @example
227
+ * ```typescript
228
+ * await client.launchExperienceById('exp-1')
229
+ * ```
230
+ */
228
231
  launchExperienceById: (experienceId: string, options?: LaunchExperienceOptions) => Promise<void>;
229
- /** @deprecated Use `client.experiences.open({ id: experienceId })` instead. */
232
+ /**
233
+ * Opens an experience by ID.
234
+ *
235
+ * @deprecated Use `client.experiences.open({ key: experienceKey })` instead.
236
+ * @param experienceId - The experience ID to open.
237
+ * @example
238
+ * ```typescript
239
+ * await client.openExperienceById('exp-1')
240
+ * ```
241
+ */
230
242
  openExperienceById: (experienceId: string) => Promise<void>;
231
243
  private runPluginStartHooks;
232
244
  private evaluateGate;
@@ -265,15 +277,12 @@ export declare class Picked {
265
277
  * @param template Template containing placeholders.
266
278
  * @param context Optional data for interpolation. Non-responses.* keys belong here; function values are executed.
267
279
  * @returns Interpolated string.
268
- *
269
280
  * @example
270
281
  * renderString("Hello {{ name | default: 'Guest' | capitalize }}! Email: {{ responses.email | lower }}.", { name: "ALICE" })
271
282
  * // => "Hello Alice! Email: alice@example.com."
272
- *
273
283
  * @example
274
284
  * renderString("User: {{ getName | capitalize }}", { getName: () => "alice" })
275
285
  * // => "User: Alice"
276
- *
277
286
  * @example
278
287
  * renderString("Fruits: {{ fruits | list }}", { fruits: ["apple", "banana", "cherry"] })
279
288
  * // => "Fruits: apple, banana, and cherry"
@@ -1 +1 @@
1
- {"version":3,"file":"picked.d.ts","sourceRoot":"","sources":["../../src/picked.ts"],"names":[],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GAAI,OAAO,KAAK,KAAG,IAAI,CAEnC;IAED,YAAY,GAAI,MAAM,cAAc,KAAG,IAAI,CAE1C;IAED,cAAc,GAAI,MAAM,MAAM,EAAE,QAAQ,MAAM,KAAG,IAAI,CAEpD;IAED,kBAAkB,GAAI,YAAY,UAAU,KAAG,IAAI,CAMlD;IAED,gBAAgB,QAAO,aAAa,CAEnC;IAED;;;;;;;;;;OAUG;IACH,oBAAoB,GAClB,cAAc,MAAM,EACpB,UAAU,uBAAuB,KAChC,OAAO,CAAC,IAAI,CAAC,CAEf;IAED;;;;;;;;;OASG;IACH,kBAAkB,GAAU,cAAc,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC,CAE/D;YAEa,mBAAmB;YAMnB,YAAY;IAc1B,OAAO,CAAC,YAAY;IA6BpB,OAAO,CAAC,aAAa;IA8CrB,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,eAAe;IAWvB,eAAe,GAAI,YAAY,MAAM,KAAG,iBAAiB,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE1F;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,YAAY,GAAI,UAAU,MAAM,EAAE,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,MAAM,CAY3E;CACF"}
@@ -1,35 +1,42 @@
1
- import { ActionNode, Experience, ExperienceConditional, ExperienceEdge, ExperienceNode, ExperienceStep, ExperienceTarget } from '../../entities/experience/experience';
1
+ import { ExperienceTarget } from '../../entities/experience/experience';
2
2
  import { AdaptedComponent } from '../../entities/component/component';
3
3
  import { LogicRule, LogicValue } from '../../logic-engine';
4
4
  import { Field, FieldBooleanMultiple, FieldBooleanSingular, FieldNumberMultiple, FieldNumberSingular, FieldObjectMultiple, FieldObjectSingular, FieldTextMultiple, FieldTextSingular, JsonValue } from '../../entities/field/field';
5
- import { Serialized } from './serialization';
6
5
  export interface Nodeable {
7
6
  node: SerializableNode | null;
8
7
  }
9
8
  export interface SerializableStep extends Nodeable {
10
9
  id: string;
10
+ name: string;
11
+ key: string;
12
+ /** @deprecated Use `name` instead. */
11
13
  label: string;
12
14
  fields: SerializableField[];
13
15
  experience: SerializableExperience;
14
16
  nextStep: (stepOptions: CreateStepOptions | SerializableStep) => SerializableStep;
15
- nextConditional: (conditionalOptions: CreateConditionalOptions | SerializableConditional) => SerializableConditional;
17
+ nextCondition: (conditionOptions: CreateConditionOptions | SerializableCondition) => SerializableCondition;
18
+ /** @deprecated Use `nextCondition` instead. */
19
+ nextConditional: (conditionOptions: CreateConditionOptions | SerializableCondition) => SerializableCondition;
16
20
  addNextExperience: (experience: SerializableExperience) => SerializableExperience;
17
21
  addField: (fieldOptions: CreateFieldOptions | SerializableField) => SerializableField;
18
- serialize: () => Serialized<ExperienceStep>;
22
+ serialize: () => string;
19
23
  }
20
24
  export interface CreateStepOptions {
21
25
  id?: string;
22
- label: string;
26
+ name?: string;
27
+ key?: string;
28
+ /** @deprecated Use `name` instead. */
29
+ label?: string;
23
30
  fields?: SerializableField[];
24
31
  }
25
- export type SerializableNode = SerializableStepNode | SerializableConditionalNode | SerializableLaunchExperienceNode | SerializableOriginNode | SerializableActionNode;
32
+ export type SerializableNode = SerializableStepNode | SerializableConditionNode | SerializableLaunchExperienceNode | SerializableOriginNode | SerializableActionNode;
26
33
  export interface SerializableActionNode extends SerializableBaseNode {
27
34
  type: 'action';
28
35
  action: string;
29
36
  addNext: (nodeable: Nodeable) => undefined;
30
37
  onSuccess: (nodeable: Nodeable) => undefined;
31
38
  onFail: (nodeable: Nodeable) => undefined;
32
- serialize: () => Serialized<ActionNode>;
39
+ serialize: () => string;
33
40
  }
34
41
  export interface CreateActionOptions {
35
42
  action: string;
@@ -38,15 +45,15 @@ export declare const createAction: (actionOptions: CreateActionOptions, experien
38
45
  export interface SerializableBaseNode {
39
46
  id: string;
40
47
  experience: SerializableExperience;
41
- serialize: () => Serialized<ExperienceNode>;
48
+ serialize: () => string;
42
49
  }
43
50
  export interface SerializableStepNode extends SerializableBaseNode {
44
51
  type: 'step';
45
52
  connectedStep: SerializableStep;
46
53
  }
47
- export interface SerializableConditionalNode extends SerializableBaseNode {
48
- type: 'conditional';
49
- connectedConditional: SerializableConditional;
54
+ export interface SerializableConditionNode extends SerializableBaseNode {
55
+ type: 'condition';
56
+ connectedCondition: SerializableCondition;
50
57
  }
51
58
  export interface SerializableLaunchExperienceNode extends SerializableBaseNode {
52
59
  type: 'experience';
@@ -59,8 +66,8 @@ export type CreateNodeOptions = {
59
66
  step: SerializableStep;
60
67
  type: 'step';
61
68
  } | {
62
- conditional: SerializableConditional;
63
- type: 'conditional';
69
+ condition: SerializableCondition;
70
+ type: 'condition';
64
71
  } | {
65
72
  type: 'origin';
66
73
  } | {
@@ -76,27 +83,41 @@ export interface SerializableEdge {
76
83
  sourceNodeHandle: 'true' | 'false' | null;
77
84
  destinationNode: SerializableNode;
78
85
  experience: SerializableExperience;
79
- serialize: () => Serialized<ExperienceEdge>;
86
+ serialize: () => string;
80
87
  }
81
88
  export interface CreateEdgeOptions {
82
89
  sourceNode: SerializableNode;
83
90
  sourceNodeHandle: 'true' | 'false' | null;
84
91
  destinationNode: SerializableNode;
85
92
  }
86
- export interface SerializableConditional extends Nodeable {
93
+ export interface SerializableCondition extends Nodeable {
87
94
  id: string;
95
+ key: string;
96
+ name: string;
97
+ /** @deprecated Use `name` instead. */
88
98
  label?: string;
89
- condition: LogicRule;
99
+ logic: LogicRule;
90
100
  experience: SerializableExperience;
91
101
  addTrue: (nodeable: Nodeable) => undefined;
92
102
  addFalse: (nodeable: Nodeable) => undefined;
93
- serialize: () => Serialized<ExperienceConditional>;
103
+ serialize: () => string;
94
104
  }
95
- export interface CreateConditionalOptions {
105
+ export interface CreateConditionOptions {
106
+ /** @deprecated The `id` is auto-generated. This property is accepted but ignored. */
107
+ id?: string;
96
108
  condition: LogicRule;
109
+ name?: string;
110
+ key?: string;
111
+ /** @deprecated Use `name` instead. */
97
112
  label?: string;
98
113
  }
99
- export type CreateFieldOptions = Omit<Field, 'options' | 'placeholder' | 'description' | 'helpText' | 'validation' | 'policies' | 'defaultValue'> & {
114
+ export type CreateFieldOptions = Omit<Field, 'id' | 'key' | 'options' | 'placeholder' | 'description' | 'helpText' | 'validation' | 'policies' | 'defaultValue'> & {
115
+ /**
116
+ * @deprecated Provide `key` instead. If omitted, a stable key is auto-generated from `name`.
117
+ * The internal `id` is derived from `key` when not explicitly set.
118
+ */
119
+ id?: string;
120
+ key?: string;
100
121
  defaultValue?: string | number | boolean | object | null | string[] | number[] | boolean[] | object[];
101
122
  placeholder?: string;
102
123
  description?: string;
@@ -110,6 +131,7 @@ export type CreateFieldOptions = Omit<Field, 'options' | 'placeholder' | 'descri
110
131
  };
111
132
  export type SerializableField<T extends JsonValue = JsonValue> = {
112
133
  id: string;
134
+ key: string;
113
135
  name: string;
114
136
  label: string;
115
137
  type: 'text' | 'number' | 'object' | 'boolean';
@@ -135,16 +157,19 @@ export type SerializableField<T extends JsonValue = JsonValue> = {
135
157
  /**
136
158
  * Phantom type property for TypeScript type inference.
137
159
  * This property never exists at runtime but enables type-safe field value access.
160
+ *
138
161
  * @internal
139
162
  */
140
163
  __fieldType?: T;
141
164
  } & {
142
- serialize: () => Serialized<Field>;
165
+ serialize: () => string;
143
166
  };
144
167
  export interface SerializableExperience {
145
168
  id: string;
169
+ key: string;
146
170
  component?: AdaptedComponent;
147
171
  name: string;
172
+ /** Decision logic that controls whether this experience is initialised. */
148
173
  condition?: LogicRule | LogicValue;
149
174
  initializeOpen?: LogicRule | LogicValue;
150
175
  targets: ExperienceTarget[];
@@ -152,13 +177,17 @@ export interface SerializableExperience {
152
177
  nodes: SerializableNode[];
153
178
  edges: SerializableEdge[];
154
179
  fields: SerializableField[];
155
- conditionals: SerializableConditional[];
180
+ conditions: SerializableCondition[];
156
181
  addStep: (stepOptions: CreateStepOptions | SerializableStep | OrphanStep, after?: {
157
182
  node: SerializableNode | null;
158
183
  }) => SerializableStep;
159
- addConditional: (conditionalOptions: CreateConditionalOptions | SerializableConditional, after?: {
184
+ addCondition: (conditionOptions: CreateConditionOptions | SerializableCondition, after?: {
160
185
  node: SerializableNode | null;
161
- }) => SerializableConditional;
186
+ }) => SerializableCondition;
187
+ /** @deprecated Use `addCondition` instead. */
188
+ addConditional: (conditionOptions: CreateConditionOptions | SerializableCondition, after?: {
189
+ node: SerializableNode | null;
190
+ }) => SerializableCondition;
162
191
  addExperience: (experience: SerializableExperience, after?: {
163
192
  node: SerializableNode | null;
164
193
  }) => SerializableExperience;
@@ -166,29 +195,32 @@ export interface SerializableExperience {
166
195
  addAction: (actionOptions: CreateActionOptions | SerializableActionNode, after?: {
167
196
  node: SerializableNode | null;
168
197
  }) => SerializableActionNode;
169
- serialize: () => Serialized<Experience>;
198
+ serialize: () => string;
170
199
  }
171
200
  export interface CreateExperienceOptions {
172
201
  id: string;
202
+ key?: string;
173
203
  name: string;
204
+ /** Decision logic that controls whether this experience is initialised. */
174
205
  condition?: LogicRule | LogicValue;
175
206
  initializeOpen?: LogicRule | LogicValue;
176
207
  targets: ExperienceTarget[];
177
208
  component?: AdaptedComponent;
178
209
  }
179
- export type OrphanStep = Omit<SerializableStep, 'nextStep' | 'nextConditional' | 'addNextExperience' | 'node' | 'serialize' | 'addField' | 'experience'> & {
210
+ export type OrphanStep = Omit<SerializableStep, 'nextStep' | 'nextCondition' | 'nextConditional' | 'addNextExperience' | 'node' | 'serialize' | 'addField' | 'experience'> & {
180
211
  addField: (fieldOrFieldOptions: CreateFieldOptions | SerializableField) => void;
181
212
  };
182
213
  export declare const createStep: (stepOptions: CreateStepOptions) => OrphanStep;
183
214
  export declare const bindExperienceStep: (stepOptions: CreateStepOptions | OrphanStep, experience: SerializableExperience) => SerializableStep;
184
215
  export declare const createNode: (nodeOptions: CreateNodeOptions, experience: SerializableExperience) => SerializableNode;
185
216
  export declare const createEdge: (edgeOptions: CreateEdgeOptions, experience: SerializableExperience) => SerializableEdge;
186
- export declare const createConditional: (conditionalOptions: CreateConditionalOptions, experience: SerializableExperience) => SerializableConditional;
217
+ export declare const createCondition: (conditionOptions: CreateConditionOptions, experience: SerializableExperience) => SerializableCondition;
187
218
  /**
188
219
  * Creates a field with optional generic type parameter for object field type safety.
189
- * @template T - The type of the object field value (only applicable for type: 'object')
190
- * @param fieldOptions - The field configuration options
191
- * @returns A serializable field with type information
220
+ *
221
+ * @template T - The type of the object field value (only applicable for type: 'object').
222
+ * @param fieldOptions - The field configuration options.
223
+ * @returns A serializable field with type information.
192
224
  * @example
193
225
  * ```typescript
194
226
  * // Without type parameter (default JsonValue)
@@ -1 +1 @@
1
- {"version":3,"file":"create-experience.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/create-experience.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAEV,UAAU,EACV,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,cAAc,EACd,gBAAgB,EAGjB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,KAAK,EACV,KAAK,EACL,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACV,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEhE,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAA;CAC9B;AAED,MAAM,WAAW,gBAAiB,SAAQ,QAAQ;IAChD,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,iBAAiB,EAAE,CAAA;IAC3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jC,uBA4CF,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,SAAS,GAAG,SAAS,EACzD,cAAc,kBAAkB,KAC/B,iBAAiB,CAAC,CAAC,CAkOrB,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,YAAY,uBAAuB,KAAG,sBAsLtE,CAAA"}
1
+ {"version":3,"file":"create-experience.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/create-experience.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AAC5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAG1E,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,KAAK,EACV,KAAK,EACL,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACV,MAAM,4BAA4B,CAAA;AAGnC,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAA;CAC9B;AAED,MAAM,WAAW,gBAAiB,SAAQ,QAAQ;IAChD,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,iBAAiB,EAAE,CAAA;IAC3B,UAAU,EAAE,sBAAsB,CAAA;IAClC,QAAQ,EAAE,CAAC,WAAW,EAAE,iBAAiB,GAAG,gBAAgB,KAAK,gBAAgB,CAAA;IACjF,aAAa,EAAE,CACb,gBAAgB,EAAE,sBAAsB,GAAG,qBAAqB,KAC7D,qBAAqB,CAAA;IAC1B,+CAA+C;IAC/C,eAAe,EAAE,CACf,g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G,iBAAiB,KAAK,IAAI,CAAA;CAChF,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,aAAa,iBAAiB,KAAG,UAsB3D,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC7B,aAAa,iBAAiB,GAAG,UAAU,EAC3C,YAAY,sBAAsB,KACjC,gBA4CF,CAAA;AAED,eAAO,MAAM,UAAU,GACrB,aAAa,iBAAiB,EAC9B,YAAY,sBAAsB,KACjC,gBA4EF,CAAA;AAED,eAAO,MAAM,UAAU,GACrB,aAAa,iBAAiB,EAC9B,YAAY,sBAAsB,KACjC,gBAkBF,CAAA;AAED,eAAO,MAAM,eAAe,GAC1B,kBAAkB,sBAAsB,EACxC,YAAY,sBAAsB,KACjC,qBAqDF,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,SAAS,GAAG,SAAS,EACzD,cAAc,kBAAkB,KAC/B,iBAAiB,CAAC,CAAC,CAmPrB,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,YAAY,uBAAuB,KAAG,sBAwLtE,CAAA"}
@@ -1,6 +1,6 @@
1
+ /** @file Public API for the create-experience plugin. */
1
2
  export { createExperiencePlugin } from './plugin';
2
3
  export type * from './plugin';
3
4
  export type * from './create-experience';
4
- export { createConditional, createEdge, createExperience, createNode, createField, createStep, } from './create-experience';
5
- export { serialization } from './serialization';
5
+ export { createCondition, createEdge, createExperience, createNode, createField, createStep, } from './create-experience';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AACjD,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,qBAAqB,CAAA;AACxC,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,UAAU,GACX,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/index.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AACjD,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,qBAAqB,CAAA;AACxC,OAAO,EACL,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,UAAU,GACX,MAAM,qBAAqB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAG1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAGjE,UAAU,6BAA6B;IACrC,WAAW,EAAE,sBAAsB,EAAE,CAAA;CACtC;AAED,eAAO,MAAM,sBAAsB,GAAI,SAAS,6BAA6B,KAAG,MAmB/E,CAAA"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/plugin.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAG1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAEjE,UAAU,6BAA6B;IACrC,WAAW,EAAE,sBAAsB,EAAE,CAAA;CACtC;AAED,eAAO,MAAM,sBAAsB,GAAI,SAAS,6BAA6B,KAAG,MA2B/E,CAAA"}
@@ -1,13 +1,30 @@
1
1
  import { Plugin } from '../../entities/plugin/plugin';
2
2
  import { DynamicExperiencesPluginOptions, FetchProjectOptions, ProjectConfig } from './types';
3
+ /**
4
+ * Fetches the project configuration from the Picked REST API.
5
+ *
6
+ * Returns `null` on network failure, non-OK responses, or invalid JSON shape.
7
+ * Connection-refused errors from local URLs are suppressed silently.
8
+ *
9
+ * @param apiUrl - Base URL for the Picked API.
10
+ * @param projectId - Project ID to fetch config for.
11
+ * @param options - Optional headers and preview token.
12
+ * @returns Validated project config, or `null` on any failure.
13
+ * @example
14
+ * ```typescript
15
+ * const config = await fetchProject('https://api.picked.app', 'proj_123')
16
+ * ```
17
+ */
3
18
  export declare function fetchProject(apiUrl: string, projectId: string, options?: FetchProjectOptions): Promise<ProjectConfig | null>;
4
19
  /**
5
- * Plugin that fetches feature configuration from the Picked REST API
6
- * and registers features with deterministic bucket allocation.
20
+ * Plugin that fetches project configuration from the Picked REST API and registers
21
+ * features, steps, fields, and experiences with the client.
7
22
  *
8
- * Features are fetched during the `onStart` hook, before experience
9
- * initialization. Search param feature overrides take precedence.
23
+ * Features are fetched during the `onStart` hook, before experience initialisation.
24
+ * Search param feature overrides take precedence over API-provided values.
10
25
  *
26
+ * @param options - Optional plugin configuration.
27
+ * @returns A configured Picked plugin.
11
28
  * @example
12
29
  * ```typescript
13
30
  * import { dynamicExperiencesPlugin } from '@picked/client/plugins/dynamic-experiences'
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAK1D,OAAO,KAAK,EACV,+BAA+B,EAC/B,mBAAmB,EACnB,aAAa,EAEd,MAAM,SAAS,CAAA;AA8JhB,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAmC/B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE,+BAA+B,GAAG,MAAM,CAoC1F"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/plugin.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAK1D,OAAO,KAAK,EACV,+BAA+B,EAC/B,mBAAmB,EACnB,aAAa,EAGd,MAAM,SAAS,CAAA;AAoUhB;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAmC/B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE,+BAA+B,GAAG,MAAM,CAgD1F"}