@picked/client 0.0.62-next.11 → 0.0.62-next.2
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/api-C-Q9t21v.cjs +1 -0
- package/dist/{api-C6HQ65g9.js → api-Cfb-8mqu.js} +1 -1
- package/dist/cjs/form/index.js +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/single-page-app/index.js +1 -1
- package/dist/cjs/plugins/web-components/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/docs/image-optimisation-service.md +6 -6
- package/dist/docs/sdk/content-security-policy.md +7 -8
- package/dist/docs/sdk/fields.md +2 -2
- package/dist/docs/workspaces.mdx +1 -1
- package/dist/esm/form/index.js +1 -1
- package/dist/esm/index.js +472 -1015
- package/dist/esm/plugins/create-experience/index.js +1 -1
- package/dist/esm/plugins/dynamic-experiences/index.js +60 -133
- package/dist/esm/plugins/experience-browser-storage/index.js +6 -9
- package/dist/esm/plugins/history-browser-storage/index.js +1 -1
- package/dist/esm/plugins/responses-browser-storage/index.js +1 -1
- package/dist/esm/plugins/single-page-app/index.js +1 -1
- package/dist/esm/plugins/web-components/index.js +1 -1
- package/dist/esm/server/index.js +13 -23
- package/dist/experience-instance-DC2gKwA6.cjs +1 -0
- package/dist/experience-instance-DJaNc5Ob.js +486 -0
- package/dist/rules-logic-BTIxfrJJ.js +240 -0
- package/dist/rules-logic-DNLOv90w.cjs +1 -0
- package/dist/types/entities/action/action.d.ts +3 -6
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/component/component.d.ts +2 -39
- package/dist/types/entities/component/component.d.ts.map +1 -1
- package/dist/types/entities/experience/experience.d.ts +113 -69
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +2 -17
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/feature/feature.d.ts +2 -26
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/framework/framework.d.ts +3 -24
- package/dist/types/entities/framework/framework.d.ts.map +1 -1
- package/dist/types/entities/plugin/plugin.d.ts +1 -32
- package/dist/types/entities/plugin/plugin.d.ts.map +1 -1
- package/dist/types/entities/predicate/predicate.d.ts +3 -24
- package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
- package/dist/types/entities/step/step.d.ts +2 -17
- package/dist/types/entities/step/step.d.ts.map +1 -1
- package/dist/types/exports.d.ts +4 -8
- package/dist/types/exports.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/logic-engine.d.ts +1 -1
- package/dist/types/logic-engine.d.ts.map +1 -1
- package/dist/types/picked.d.ts +186 -141
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/index.d.ts +1 -2
- package/dist/types/plugins/dynamic-experiences/index.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +1 -18
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts +1 -63
- package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/web-components/plugin.d.ts.map +1 -1
- package/dist/types/server/index.d.ts +0 -7
- package/dist/types/server/index.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +1 -1
- package/dist/types/utils/events.d.ts.map +1 -1
- package/dist/types/utils/rules-logic.d.ts +9 -4
- package/dist/types/utils/rules-logic.d.ts.map +1 -1
- package/dist/types/utils/state-snaphot.d.ts +26 -0
- package/dist/types/utils/state-snaphot.d.ts.map +1 -0
- package/dist/types/utils/user-session.d.ts +12 -0
- package/dist/types/utils/user-session.d.ts.map +1 -0
- package/package.json +2 -12
- package/dist/api-v323-Asd.cjs +0 -1
- package/dist/cjs/plugins/dom-observer/index.js +0 -1
- package/dist/dom-C3C6Fmwz.cjs +0 -1
- package/dist/dom-DGePXPpM.js +0 -84
- package/dist/esm/plugins/dom-observer/index.js +0 -87
- package/dist/experience-instance-DImym3m_.js +0 -419
- package/dist/experience-instance-DygAdzbn.cjs +0 -1
- package/dist/rules-logic-D_CVBuv7.js +0 -13
- package/dist/rules-logic-H6P8xwHF.cjs +0 -1
- package/dist/types/entities/content/content.d.ts +0 -37
- package/dist/types/entities/content/content.d.ts.map +0 -1
- package/dist/types/entities/session/session.d.ts +0 -45
- package/dist/types/entities/session/session.d.ts.map +0 -1
- package/dist/types/lifecycle/lifecycle.d.ts +0 -47
- package/dist/types/lifecycle/lifecycle.d.ts.map +0 -1
- package/dist/types/lifecycle/rules-logic.d.ts +0 -24
- package/dist/types/lifecycle/rules-logic.d.ts.map +0 -1
- package/dist/types/lifecycle/state-snapshot.d.ts +0 -37
- package/dist/types/lifecycle/state-snapshot.d.ts.map +0 -1
- package/dist/types/plugins/dom-observer/index.d.ts +0 -3
- package/dist/types/plugins/dom-observer/index.d.ts.map +0 -1
- package/dist/types/plugins/dom-observer/plugin.d.ts +0 -50
- package/dist/types/plugins/dom-observer/plugin.d.ts.map +0 -1
- /package/dist/{id-Cg7fVl1O.cjs → id-Bv44ilEo.cjs} +0 -0
- /package/dist/{id-n2yrHvNo.js → id-CRqy981z.js} +0 -0
- /package/dist/{object-DvUDOytC.js → object-C82v79xc.js} +0 -0
- /package/dist/{object-ThO1DEyl.cjs → object-CUJOjanb.cjs} +0 -0
- /package/dist/{storage-hOHCCXvP.js → storage-6Xk0uAxB.js} +0 -0
- /package/dist/{storage-BXSlLTRa.cjs → storage-B6lQtc4-.cjs} +0 -0
|
@@ -8,12 +8,5 @@ export interface Renderer<T = AdaptedComponent<string, unknown>> {
|
|
|
8
8
|
body: string;
|
|
9
9
|
}>;
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Renders all experiences in sequence using the provided renderers.
|
|
13
|
-
*
|
|
14
|
-
* @param {Picked} client - The Picked client instance.
|
|
15
|
-
* @param {Renderer[]} renderers - Array of available renderers to use.
|
|
16
|
-
* @returns {Promise<string[]>} A promise resolving to rendered experience HTML strings.
|
|
17
|
-
*/
|
|
18
11
|
export declare function render(client: Picked, renderers: Renderer[]): Promise<string[]>;
|
|
19
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAE7F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAkBvE,MAAM,WAAW,QAAQ,CAAC,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC;IAC7D,gBAAgB,EAAE,CAAC,SAAS,EAAE,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAA;IAC3E,MAAM,EAAE,CACN,SAAS,EAAE,CAAC,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,kBAAkB,KAC3B,OAAO,CAAC;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;KACb,CAAC,CAAA;CACH;AAmBD,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA6H/E"}
|
|
@@ -3,7 +3,7 @@ import { ValidationError } from '../entities/response/response';
|
|
|
3
3
|
import { ExperienceStep } from '../entities/step/step';
|
|
4
4
|
import { ExperienceInstance } from '../entities/experience-instance/experience-instance';
|
|
5
5
|
import { ResolvedFeature } from '../entities/feature/feature';
|
|
6
|
-
import { Session } from '
|
|
6
|
+
import { Session } from './user-session';
|
|
7
7
|
export interface FormPayload {
|
|
8
8
|
id: string;
|
|
9
9
|
title: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/utils/events.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/utils/events.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE7C,MAAM,WAAW,WAA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ked } from '../picked';
|
|
|
14
14
|
*/
|
|
15
15
|
export declare function isRulesLogic(rules: unknown): rules is LogicRule;
|
|
16
16
|
/**
|
|
17
|
-
* Evaluates a json-logic condition against the current client state
|
|
17
|
+
* Evaluates a json-logic condition against the current client state.
|
|
18
18
|
*
|
|
19
|
-
* @
|
|
19
|
+
* Builds a {@link LogicContext} from committed responses, location, predicates,
|
|
20
|
+
* and features, then applies the caller-supplied `context` on top so that
|
|
21
|
+
* callers such as the field evaluator can override defaults like `responses`
|
|
22
|
+
* with staged/in-session values.
|
|
23
|
+
*
|
|
24
|
+
* @param {Picked} client - The Picked client instance providing state snapshots.
|
|
20
25
|
* @param {LogicRule} condition - The json-logic rule to evaluate.
|
|
21
|
-
* @param {LogicObject} [context] - Optional overrides merged on top of the default context
|
|
26
|
+
* @param {LogicObject} [context] - Optional overrides merged on top of the default context.
|
|
22
27
|
* @returns {Promise<unknown>} The result of applying the logic rule.
|
|
23
28
|
* @example
|
|
24
29
|
* ```ts
|
|
@@ -27,5 +32,5 @@ export declare function isRulesLogic(rules: unknown): rules is LogicRule;
|
|
|
27
32
|
* })
|
|
28
33
|
* ```
|
|
29
34
|
*/
|
|
30
|
-
export declare function evaluateRuleLogic(client: Picked, condition: LogicRule, context?: LogicObject): Promise<
|
|
35
|
+
export declare function evaluateRuleLogic(client: Picked, condition: LogicRule, context?: LogicObject): Promise<import('../logic-engine').SyncLogicValue | (() => import('../logic-engine').LogicValue) | (() => Promise<import('../logic-engine').SyncLogicValue>)>;
|
|
31
36
|
//# sourceMappingURL=rules-logic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules-logic.d.ts","sourceRoot":"","sources":["../../../src/utils/rules-logic.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"rules-logic.d.ts","sourceRoot":"","sources":["../../../src/utils/rules-logic.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAgB,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGvC;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAE/D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,WAAW,gKAmDtB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Picked } from '../picked';
|
|
2
|
+
import { Field, FieldValue } from '../entities/field/field';
|
|
3
|
+
export interface StateSnapshot {
|
|
4
|
+
client: Picked;
|
|
5
|
+
location?: Window['location'];
|
|
6
|
+
document?: Window['document'];
|
|
7
|
+
sessionStorage?: Window['sessionStorage'];
|
|
8
|
+
localStorage?: Window['localStorage'];
|
|
9
|
+
responses: {
|
|
10
|
+
fieldKey: string;
|
|
11
|
+
value: FieldValue | undefined;
|
|
12
|
+
}[];
|
|
13
|
+
fields: Field[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates an immutable snapshot of the current client state for condition evaluation.
|
|
17
|
+
*
|
|
18
|
+
* @param {Picked} client - The Picked client instance to snapshot.
|
|
19
|
+
* @returns {StateSnapshot} A frozen snapshot of the current client state.
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const snapshot = createStateSnapshot(client)
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function createStateSnapshot(client: Picked): StateSnapshot;
|
|
26
|
+
//# sourceMappingURL=state-snaphot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-snaphot.d.ts","sourceRoot":"","sources":["../../../src/utils/state-snaphot.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEhE,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAA;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAA;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAA;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC,CAAA;IACrC,SAAS,EAAE;QACT,QAAQ,EAAE,MAAM,CAAA;QAChB,KAAK,EAAE,UAAU,GAAG,SAAS,CAAA;KAC9B,EAAE,CAAA;IACH,MAAM,EAAE,KAAK,EAAE,CAAA;CAChB;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAYjE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface Session {
|
|
2
|
+
id: string;
|
|
3
|
+
isUser?: boolean;
|
|
4
|
+
identifiers?: Record<string, string>;
|
|
5
|
+
}
|
|
6
|
+
export interface SessionStore extends Session {
|
|
7
|
+
setIsUser: (value: boolean) => void;
|
|
8
|
+
setIdentifier: (key: string, value: string) => void;
|
|
9
|
+
removeIdentifier: (key: string) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const initialiseSession: () => SessionStore | null;
|
|
12
|
+
//# sourceMappingURL=user-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-session.d.ts","sourceRoot":"","sources":["../../../src/utils/user-session.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACrC;AAED,MAAM,WAAW,YAAa,SAAQ,OAAO;IAC3C,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IACnC,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACnD,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CACxC;AAmED,eAAO,MAAM,iBAAiB,2BAI7B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/client",
|
|
3
|
-
"version": "0.0.62-next.
|
|
3
|
+
"version": "0.0.62-next.2",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@withease/factories": "^1.0.5"
|
|
6
6
|
},
|
|
@@ -89,12 +89,6 @@
|
|
|
89
89
|
"require": "./dist/cjs/plugins/dynamic-experiences/index.js",
|
|
90
90
|
"default": "./dist/esm/plugins/dynamic-experiences/index.js"
|
|
91
91
|
},
|
|
92
|
-
"./plugins/dom-observer": {
|
|
93
|
-
"types": "./dist/types/plugins/dom-observer/index.d.ts",
|
|
94
|
-
"import": "./dist/esm/plugins/dom-observer/index.js",
|
|
95
|
-
"require": "./dist/cjs/plugins/dom-observer/index.js",
|
|
96
|
-
"default": "./dist/esm/plugins/dom-observer/index.js"
|
|
97
|
-
},
|
|
98
92
|
"./form": {
|
|
99
93
|
"types": "./dist/types/form/index.d.ts",
|
|
100
94
|
"import": "./dist/esm/form/index.js",
|
|
@@ -166,7 +160,7 @@
|
|
|
166
160
|
"size-limit": [
|
|
167
161
|
{
|
|
168
162
|
"path": "dist/esm/index.js",
|
|
169
|
-
"limit": "
|
|
163
|
+
"limit": "12.5 kB"
|
|
170
164
|
},
|
|
171
165
|
{
|
|
172
166
|
"path": "dist/esm/server/index.js",
|
|
@@ -204,10 +198,6 @@
|
|
|
204
198
|
"path": "dist/esm/plugins/web-components/index.js",
|
|
205
199
|
"limit": "10 kB"
|
|
206
200
|
},
|
|
207
|
-
{
|
|
208
|
-
"path": "dist/esm/plugins/dom-observer/index.js",
|
|
209
|
-
"limit": "5 kB"
|
|
210
|
-
},
|
|
211
201
|
{
|
|
212
202
|
"path": "dist/esm/form/index.js",
|
|
213
203
|
"limit": "5 kB"
|
package/dist/api-v323-Asd.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=`Picked-Client`,t=`Picked-Version`;function n(n,r){return{[e]:n,[t]:r}}var r=()=>`0.0.62-next.11`,i=`v1`;function a(e,t){return new URL(`/api/${i}/${t}`,e).toString()}function o(e){return{...n(`sdk`,r()),...e}}async function s(e,t,n){let r=a(e,t);return fetch(r,{headers:o(n)})}async function c(e,t,n,r){let i=a(e,t);return fetch(i,{method:`POST`,headers:{"Content-Type":`application/json`,...o(r)},body:JSON.stringify(n)})}Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return s}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../../logger-fbvQC40v.cjs`);const e=require(`../../../supports-Dsjg-82e.cjs`),t=require(`../../../dom-C3C6Fmwz.cjs`);let n=require(`effector`);var r=new WeakSet,i=()=>({name:`dom-observer`,setup:e=>{a()&&(r.has(e)||(r.add(e),o(e)))}});function a(){return!(!e.d()||!e.r()||typeof MutationObserver!=`function`||typeof requestAnimationFrame!=`function`)}function o(e){t.r().then(()=>{document.body&&s(e)})}function s(e){let t=(0,n.createEvent)(),r=(0,n.createStore)(new Map).on(t,(e,{id:t,selectors:n})=>{let r=new Map(e);return n.length>0?r.set(t,n):r.delete(t),r}),i=new Map;e.experiences.listStore.watch(e=>{for(let n of e){if(i.has(n.id))continue;let e=n.configStore.watch(e=>{t({id:n.id,selectors:c(e.targetSelectors)})});i.set(n.id,e)}});let a=(0,n.createEffect)(async e=>{await Promise.all(e.map(async e=>{await e.shouldInitialiseFx()&&await e.initialiseFx(void 0)}))});a.fail.watch(({error:e})=>{});let o=(0,n.createEvent)();(0,n.sample)({clock:o,source:{selectorsById:r,experiences:e.experiences.listStore},fn:({selectorsById:e,experiences:t},n)=>t.filter(t=>{let r=e.get(t.id);return r?r.some(e=>l(n,e)):!1}),target:a});let s=[],u,d=()=>{u=void 0;let e=s;s=[],o(e)};new MutationObserver(e=>{let t=!1;for(let n of e)if(n.type===`childList`)for(let e of n.addedNodes)e instanceof Element&&(s.push(e),t=!0);t&&(u??=requestAnimationFrame(d))}).observe(document.body,{childList:!0,subtree:!0})}function c(e){let t=[];for(let n of e){let e=n.selector.trim();e.length>0&&t.push(e)}return t}function l(e,t){for(let n of e)try{if(n.matches(t)||n.querySelector(t)!==null)return!0}catch{return!1}return!1}exports.domObserverPlugin=i;
|
package/dist/dom-C3C6Fmwz.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./supports-Dsjg-82e.cjs`);function t(t){return!e.d()||!e.r()?[]:Array.from(window.document.querySelectorAll(t)).filter(e=>e instanceof HTMLElement)}var n=`open`;function r(t){if(!e.l())throw Error(`Shadow DOM is not supported in this environment`);return t.attachShadow({mode:n})}function i(){return new Promise((t,n)=>{if(!e.r()){n();return}document.readyState===`loading`?document.addEventListener(`readystatechange`,()=>t(),{once:!0}):t()})}function a(e,t){let n=new MutationObserver(r=>{document.contains(e)||(n.disconnect(),t())});n.observe(document.body,{childList:!0,subtree:!0})}var o=`picked-root`,s=`picked-target`,c=`picked-root`;function l(e,n){return[...e,{selector:`${c}[experience-id="${n}"]`,placement:`replace`}].flatMap(e=>{let r=t(e.selector).filter(e=>!f(e,n)&&!p(e,n));return{...e,elements:r}})}function u(e,t,n){return e.flatMap(e=>e.elements.map(r=>h(r,e.placement,t,n)))}function d(e,t){e.classList.add(s),e.classList.add(`${s}-${t}`)}function f(e,t){return t?e.classList.contains(`${s}-${t}`):e.classList.contains(`${s}`)}function p(e,t){return t?e.classList.contains(`${o}-${t}`):e.classList.contains(o)}function m(e,t){let n=document.createElement(`div`);return n.style.display=`block`,n.classList.add(o),n.classList.add(`${o}-${e}`),n.classList.add(`${o}-${t}`),n}function h(e,t,n,r){let i,a=m(n,r);if(e instanceof Document)i=e.body.appendChild(a);else{switch(t){case`replace`:e.replaceWith(a);break;case`before`:e.before(a);break;case`after`:e.after(a);break;case`prepend`:e.prepend(a);break;case`append`:e.append(a);break}i=a}return i}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return u}});
|
package/dist/dom-DGePXPpM.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { d as e, l as t, r as n } from "./supports-0XIfd4-R.js";
|
|
2
|
-
//#region src/utils/dom.ts
|
|
3
|
-
function r(t) {
|
|
4
|
-
return !e() || !n() ? [] : Array.from(window.document.querySelectorAll(t)).filter((e) => e instanceof HTMLElement);
|
|
5
|
-
}
|
|
6
|
-
var i = "open";
|
|
7
|
-
function a(e) {
|
|
8
|
-
if (!t()) throw Error("Shadow DOM is not supported in this environment");
|
|
9
|
-
return e.attachShadow({ mode: i });
|
|
10
|
-
}
|
|
11
|
-
function o() {
|
|
12
|
-
return new Promise((e, t) => {
|
|
13
|
-
if (!n()) {
|
|
14
|
-
t();
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
document.readyState === "loading" ? document.addEventListener("readystatechange", () => e(), { once: !0 }) : e();
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
function s(e, t) {
|
|
21
|
-
let n = new MutationObserver((r) => {
|
|
22
|
-
document.contains(e) || (n.disconnect(), t());
|
|
23
|
-
});
|
|
24
|
-
n.observe(document.body, {
|
|
25
|
-
childList: !0,
|
|
26
|
-
subtree: !0
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
var c = "picked-root", l = "picked-target", u = "picked-root";
|
|
30
|
-
function d(e, t) {
|
|
31
|
-
return [...e, {
|
|
32
|
-
selector: `${u}[experience-id="${t}"]`,
|
|
33
|
-
placement: "replace"
|
|
34
|
-
}].flatMap((e) => {
|
|
35
|
-
let n = r(e.selector).filter((e) => !m(e, t) && !h(e, t));
|
|
36
|
-
return {
|
|
37
|
-
...e,
|
|
38
|
-
elements: n
|
|
39
|
-
};
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
function f(e, t, n) {
|
|
43
|
-
return e.flatMap((e) => e.elements.map((r) => _(r, e.placement, t, n)));
|
|
44
|
-
}
|
|
45
|
-
function p(e, t) {
|
|
46
|
-
e.classList.add(l), e.classList.add(`${l}-${t}`);
|
|
47
|
-
}
|
|
48
|
-
function m(e, t) {
|
|
49
|
-
return t ? e.classList.contains(`${l}-${t}`) : e.classList.contains(`${l}`);
|
|
50
|
-
}
|
|
51
|
-
function h(e, t) {
|
|
52
|
-
return t ? e.classList.contains(`${c}-${t}`) : e.classList.contains(c);
|
|
53
|
-
}
|
|
54
|
-
function g(e, t) {
|
|
55
|
-
let n = document.createElement("div");
|
|
56
|
-
return n.style.display = "block", n.classList.add(c), n.classList.add(`${c}-${e}`), n.classList.add(`${c}-${t}`), n;
|
|
57
|
-
}
|
|
58
|
-
function _(e, t, n, r) {
|
|
59
|
-
let i, a = g(n, r);
|
|
60
|
-
if (e instanceof Document) i = e.body.appendChild(a);
|
|
61
|
-
else {
|
|
62
|
-
switch (t) {
|
|
63
|
-
case "replace":
|
|
64
|
-
e.replaceWith(a);
|
|
65
|
-
break;
|
|
66
|
-
case "before":
|
|
67
|
-
e.before(a);
|
|
68
|
-
break;
|
|
69
|
-
case "after":
|
|
70
|
-
e.after(a);
|
|
71
|
-
break;
|
|
72
|
-
case "prepend":
|
|
73
|
-
e.prepend(a);
|
|
74
|
-
break;
|
|
75
|
-
case "append":
|
|
76
|
-
e.append(a);
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
i = a;
|
|
80
|
-
}
|
|
81
|
-
return i;
|
|
82
|
-
}
|
|
83
|
-
//#endregion
|
|
84
|
-
export { h as a, d as i, a as n, s as o, o as r, p as s, f as t };
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import "../../../logger-6z_gb4rA.js";
|
|
2
|
-
import { d as e, r as t } from "../../../supports-0XIfd4-R.js";
|
|
3
|
-
import { r as n } from "../../../dom-DGePXPpM.js";
|
|
4
|
-
import { createEffect as r, createEvent as i, createStore as a, sample as o } from "effector";
|
|
5
|
-
//#region src/plugins/dom-observer/plugin.ts
|
|
6
|
-
var s = /* @__PURE__ */ new WeakSet(), c = () => ({
|
|
7
|
-
name: "dom-observer",
|
|
8
|
-
setup: (e) => {
|
|
9
|
-
l() && (s.has(e) || (s.add(e), u(e)));
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
function l() {
|
|
13
|
-
return !(!e() || !t() || typeof MutationObserver != "function" || typeof requestAnimationFrame != "function");
|
|
14
|
-
}
|
|
15
|
-
function u(e) {
|
|
16
|
-
n().then(() => {
|
|
17
|
-
document.body && d(e);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
function d(e) {
|
|
21
|
-
let t = i(), n = a(/* @__PURE__ */ new Map()).on(t, (e, { id: t, selectors: n }) => {
|
|
22
|
-
let r = new Map(e);
|
|
23
|
-
return n.length > 0 ? r.set(t, n) : r.delete(t), r;
|
|
24
|
-
}), s = /* @__PURE__ */ new Map();
|
|
25
|
-
e.experiences.listStore.watch((e) => {
|
|
26
|
-
for (let n of e) {
|
|
27
|
-
if (s.has(n.id)) continue;
|
|
28
|
-
let e = n.configStore.watch((e) => {
|
|
29
|
-
t({
|
|
30
|
-
id: n.id,
|
|
31
|
-
selectors: f(e.targetSelectors)
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
s.set(n.id, e);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
let c = r(async (e) => {
|
|
38
|
-
await Promise.all(e.map(async (e) => {
|
|
39
|
-
await e.shouldInitialiseFx() && await e.initialiseFx(void 0);
|
|
40
|
-
}));
|
|
41
|
-
});
|
|
42
|
-
c.fail.watch(({ error: e }) => {});
|
|
43
|
-
let l = i();
|
|
44
|
-
o({
|
|
45
|
-
clock: l,
|
|
46
|
-
source: {
|
|
47
|
-
selectorsById: n,
|
|
48
|
-
experiences: e.experiences.listStore
|
|
49
|
-
},
|
|
50
|
-
fn: ({ selectorsById: e, experiences: t }, n) => t.filter((t) => {
|
|
51
|
-
let r = e.get(t.id);
|
|
52
|
-
return r ? r.some((e) => p(n, e)) : !1;
|
|
53
|
-
}),
|
|
54
|
-
target: c
|
|
55
|
-
});
|
|
56
|
-
let u = [], d, m = () => {
|
|
57
|
-
d = void 0;
|
|
58
|
-
let e = u;
|
|
59
|
-
u = [], l(e);
|
|
60
|
-
};
|
|
61
|
-
new MutationObserver((e) => {
|
|
62
|
-
let t = !1;
|
|
63
|
-
for (let n of e) if (n.type === "childList") for (let e of n.addedNodes) e instanceof Element && (u.push(e), t = !0);
|
|
64
|
-
t && (d ??= requestAnimationFrame(m));
|
|
65
|
-
}).observe(document.body, {
|
|
66
|
-
childList: !0,
|
|
67
|
-
subtree: !0
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
function f(e) {
|
|
71
|
-
let t = [];
|
|
72
|
-
for (let n of e) {
|
|
73
|
-
let e = n.selector.trim();
|
|
74
|
-
e.length > 0 && t.push(e);
|
|
75
|
-
}
|
|
76
|
-
return t;
|
|
77
|
-
}
|
|
78
|
-
function p(e, t) {
|
|
79
|
-
for (let n of e) try {
|
|
80
|
-
if (n.matches(t) || n.querySelector(t) !== null) return !0;
|
|
81
|
-
} catch {
|
|
82
|
-
return !1;
|
|
83
|
-
}
|
|
84
|
-
return !1;
|
|
85
|
-
}
|
|
86
|
-
//#endregion
|
|
87
|
-
export { c as domObserverPlugin };
|