@amplitude/element-selector 0.0.1 → 0.1.1-featelement-selector-v1.0
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/LICENSE +21 -0
- package/README.md +162 -0
- package/lib/cjs/config/resolve-config.d.ts +56 -0
- package/lib/cjs/config/resolve-config.d.ts.map +1 -0
- package/lib/cjs/config/resolve-config.js +114 -0
- package/lib/cjs/config/resolve-config.js.map +1 -0
- package/lib/cjs/engine.d.ts +54 -0
- package/lib/cjs/engine.d.ts.map +1 -0
- package/lib/cjs/engine.js +139 -0
- package/lib/cjs/engine.js.map +1 -0
- package/lib/cjs/fallback-css-path.d.ts +53 -0
- package/lib/cjs/fallback-css-path.d.ts.map +1 -0
- package/lib/cjs/fallback-css-path.js +124 -0
- package/lib/cjs/fallback-css-path.js.map +1 -0
- package/lib/cjs/generate-selector.d.ts +54 -0
- package/lib/cjs/generate-selector.d.ts.map +1 -0
- package/lib/cjs/generate-selector.js +76 -0
- package/lib/cjs/generate-selector.js.map +1 -0
- package/lib/cjs/helpers/describe-relative.d.ts +28 -0
- package/lib/cjs/helpers/describe-relative.d.ts.map +1 -0
- package/lib/cjs/helpers/describe-relative.js +60 -0
- package/lib/cjs/helpers/describe-relative.js.map +1 -0
- package/lib/cjs/helpers/escape-css-identifier.d.ts +8 -0
- package/lib/cjs/helpers/escape-css-identifier.d.ts.map +1 -0
- package/lib/cjs/helpers/escape-css-identifier.js +50 -0
- package/lib/cjs/helpers/escape-css-identifier.js.map +1 -0
- package/lib/cjs/helpers/escape-id.d.ts +3 -0
- package/lib/cjs/helpers/escape-id.d.ts.map +1 -0
- package/lib/cjs/helpers/escape-id.js +10 -0
- package/lib/cjs/helpers/escape-id.js.map +1 -0
- package/lib/cjs/helpers/get-stable-id.d.ts +23 -0
- package/lib/cjs/helpers/get-stable-id.d.ts.map +1 -0
- package/lib/cjs/helpers/get-stable-id.js +44 -0
- package/lib/cjs/helpers/get-stable-id.js.map +1 -0
- package/lib/cjs/index.d.ts +31 -0
- package/lib/cjs/index.d.ts.map +1 -0
- package/lib/cjs/index.js +71 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/legacy-css-path.d.ts +84 -0
- package/lib/cjs/legacy-css-path.d.ts.map +1 -0
- package/lib/cjs/legacy-css-path.js +230 -0
- package/lib/cjs/legacy-css-path.js.map +1 -0
- package/lib/cjs/orchestrator.d.ts +61 -0
- package/lib/cjs/orchestrator.d.ts.map +1 -0
- package/lib/cjs/orchestrator.js +140 -0
- package/lib/cjs/orchestrator.js.map +1 -0
- package/lib/cjs/patterns/autogenerated-ids.d.ts +37 -0
- package/lib/cjs/patterns/autogenerated-ids.d.ts.map +1 -0
- package/lib/cjs/patterns/autogenerated-ids.js +102 -0
- package/lib/cjs/patterns/autogenerated-ids.js.map +1 -0
- package/lib/cjs/patterns/unstable-classes.d.ts +48 -0
- package/lib/cjs/patterns/unstable-classes.d.ts.map +1 -0
- package/lib/cjs/patterns/unstable-classes.js +155 -0
- package/lib/cjs/patterns/unstable-classes.js.map +1 -0
- package/lib/cjs/strategies/explicit-tracking-attribute.d.ts +22 -0
- package/lib/cjs/strategies/explicit-tracking-attribute.d.ts.map +1 -0
- package/lib/cjs/strategies/explicit-tracking-attribute.js +36 -0
- package/lib/cjs/strategies/explicit-tracking-attribute.js.map +1 -0
- package/lib/cjs/strategies/stable-id.d.ts +14 -0
- package/lib/cjs/strategies/stable-id.d.ts.map +1 -0
- package/lib/cjs/strategies/stable-id.js +27 -0
- package/lib/cjs/strategies/stable-id.js.map +1 -0
- package/lib/cjs/types.d.ts +100 -0
- package/lib/cjs/types.d.ts.map +1 -0
- package/lib/cjs/types.js +13 -0
- package/lib/cjs/types.js.map +1 -0
- package/lib/esm/config/resolve-config.d.ts +56 -0
- package/lib/esm/config/resolve-config.d.ts.map +1 -0
- package/lib/esm/config/resolve-config.js +110 -0
- package/lib/esm/config/resolve-config.js.map +1 -0
- package/lib/esm/engine.d.ts +54 -0
- package/lib/esm/engine.d.ts.map +1 -0
- package/lib/esm/engine.js +135 -0
- package/lib/esm/engine.js.map +1 -0
- package/lib/esm/fallback-css-path.d.ts +53 -0
- package/lib/esm/fallback-css-path.d.ts.map +1 -0
- package/lib/esm/fallback-css-path.js +120 -0
- package/lib/esm/fallback-css-path.js.map +1 -0
- package/lib/esm/generate-selector.d.ts +54 -0
- package/lib/esm/generate-selector.d.ts.map +1 -0
- package/lib/esm/generate-selector.js +72 -0
- package/lib/esm/generate-selector.js.map +1 -0
- package/lib/esm/helpers/describe-relative.d.ts +28 -0
- package/lib/esm/helpers/describe-relative.d.ts.map +1 -0
- package/lib/esm/helpers/describe-relative.js +56 -0
- package/lib/esm/helpers/describe-relative.js.map +1 -0
- package/lib/esm/helpers/escape-css-identifier.d.ts +8 -0
- package/lib/esm/helpers/escape-css-identifier.d.ts.map +1 -0
- package/lib/esm/helpers/escape-css-identifier.js +46 -0
- package/lib/esm/helpers/escape-css-identifier.js.map +1 -0
- package/lib/esm/helpers/escape-id.d.ts +3 -0
- package/lib/esm/helpers/escape-id.d.ts.map +1 -0
- package/lib/esm/helpers/escape-id.js +6 -0
- package/lib/esm/helpers/escape-id.js.map +1 -0
- package/lib/esm/helpers/get-stable-id.d.ts +23 -0
- package/lib/esm/helpers/get-stable-id.d.ts.map +1 -0
- package/lib/esm/helpers/get-stable-id.js +40 -0
- package/lib/esm/helpers/get-stable-id.js.map +1 -0
- package/lib/esm/index.d.ts +31 -0
- package/lib/esm/index.d.ts.map +1 -0
- package/lib/esm/index.js +50 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/legacy-css-path.d.ts +84 -0
- package/lib/esm/legacy-css-path.d.ts.map +1 -0
- package/lib/esm/legacy-css-path.js +226 -0
- package/lib/esm/legacy-css-path.js.map +1 -0
- package/lib/esm/orchestrator.d.ts +61 -0
- package/lib/esm/orchestrator.d.ts.map +1 -0
- package/lib/esm/orchestrator.js +136 -0
- package/lib/esm/orchestrator.js.map +1 -0
- package/lib/esm/patterns/autogenerated-ids.d.ts +37 -0
- package/lib/esm/patterns/autogenerated-ids.d.ts.map +1 -0
- package/lib/esm/patterns/autogenerated-ids.js +97 -0
- package/lib/esm/patterns/autogenerated-ids.js.map +1 -0
- package/lib/esm/patterns/unstable-classes.d.ts +48 -0
- package/lib/esm/patterns/unstable-classes.d.ts.map +1 -0
- package/lib/esm/patterns/unstable-classes.js +150 -0
- package/lib/esm/patterns/unstable-classes.js.map +1 -0
- package/lib/esm/strategies/explicit-tracking-attribute.d.ts +22 -0
- package/lib/esm/strategies/explicit-tracking-attribute.d.ts.map +1 -0
- package/lib/esm/strategies/explicit-tracking-attribute.js +33 -0
- package/lib/esm/strategies/explicit-tracking-attribute.js.map +1 -0
- package/lib/esm/strategies/stable-id.d.ts +14 -0
- package/lib/esm/strategies/stable-id.d.ts.map +1 -0
- package/lib/esm/strategies/stable-id.js +24 -0
- package/lib/esm/strategies/stable-id.js.map +1 -0
- package/lib/esm/types.d.ts +100 -0
- package/lib/esm/types.d.ts.map +1 -0
- package/lib/esm/types.js +12 -0
- package/lib/esm/types.js.map +1 -0
- package/package.json +40 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Amplitude Analytics
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# @amplitude/element-selector
|
|
2
|
+
|
|
3
|
+
Shared element-selector algorithm consumed by the autocapture SDK plugin, the app.amplitude.com tagging UI, and the Chrome extension visual tagger. One implementation, three surfaces, identical output.
|
|
4
|
+
|
|
5
|
+
## Why it exists
|
|
6
|
+
|
|
7
|
+
The legacy autocapture `cssPath` algorithm anchored on any element id it found, which broke selector stability whenever a framework generated an id like `:r5:` (React's `useId`) or `radix-A1B2C3` (Radix UI). It also leaned heavily on classes for sibling disambiguation, which broke selector stability whenever a library applied transient state classes like `swiper-slide-active` or `Mui-selected`.
|
|
8
|
+
|
|
9
|
+
This package replaces that algorithm with a strategy-chain orchestrator that filters autogenerated ids and library state classes out of the anchor selection, then disambiguates siblings positionally via `:nth-of-type`. The result: selectors that survive component re-mounts, carousel interactions, hover/focus state churn, and minor design tweaks.
|
|
10
|
+
|
|
11
|
+
See the design doc at `packages/plugin-autocapture-browser/element-selector-strategy-v1-no-classes.md` for the full background and rationale.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
This package lives in the `Amplitude-TypeScript` monorepo and is published to npm as `@amplitude/element-selector`. Consumers in this repo declare it as a workspace dependency:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@amplitude/element-selector": "workspace:*"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The only runtime dependency is `tslib`; diagnostics accept any logger with `warn` and `debug` methods.
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
### Standalone consumer
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { createSelectorEngine, resolveSelectorConfig } from '@amplitude/element-selector';
|
|
33
|
+
|
|
34
|
+
// Start with the documented defaults. Remote-config values can be applied as
|
|
35
|
+
// they arrive — `resolveSelectorConfig` is safe to call repeatedly.
|
|
36
|
+
const config = resolveSelectorConfig({ enabled: true });
|
|
37
|
+
const engine = createSelectorEngine(config);
|
|
38
|
+
|
|
39
|
+
// Generate a selector for any element. The engine returns the best selector
|
|
40
|
+
// it can produce, falling back to a positional walk when no strategy applies.
|
|
41
|
+
document.addEventListener('click', (event) => {
|
|
42
|
+
const target = event.target as Element;
|
|
43
|
+
const selector = engine.generate(target);
|
|
44
|
+
console.log(`Clicked: ${selector}`);
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Autocapture SDK plugin
|
|
49
|
+
|
|
50
|
+
The autocapture plugin instantiates one engine per `init()` call, threads its `loggerProvider` through for diagnostic logs, and forwards remote-config updates via `updateConfig`:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { createSelectorEngine, resolveSelectorConfig } from '@amplitude/element-selector';
|
|
54
|
+
|
|
55
|
+
const engine = createSelectorEngine(resolveSelectorConfig(remote, config.loggerProvider), {
|
|
56
|
+
logger: config.loggerProvider,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
config.remoteConfigClient.subscribe('elementSelector', 'all', (next) => {
|
|
60
|
+
engine.updateConfig(resolveSelectorConfig(next, config.loggerProvider));
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Chrome extension visual tagger
|
|
65
|
+
|
|
66
|
+
The extension reads the page's already-live engine from `window.amplitude.elementSelector` (when present) and subscribes to `onConfigChange` so its preview stays in sync with the customer's runtime config:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
const pageEngine = (window as any).amplitude?.elementSelector;
|
|
70
|
+
if (pageEngine) {
|
|
71
|
+
const unsubscribe = pageEngine.onConfigChange((nextConfig) => {
|
|
72
|
+
rerenderTaggingUI(nextConfig);
|
|
73
|
+
});
|
|
74
|
+
// Call unsubscribe() on extension teardown.
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## How the algorithm works
|
|
79
|
+
|
|
80
|
+
The orchestrator walks from the clicked element up through its ancestors, trying each strategy at each level in priority order. The first strategy that produces a unique-resolving selector wins; the trail of elements between the anchor and the original target is expressed as a positional descent.
|
|
81
|
+
|
|
82
|
+
### Strategy chain
|
|
83
|
+
|
|
84
|
+
| Order | Strategy | Anchor format | When it applies |
|
|
85
|
+
|-------|----------|--------------|-----------------|
|
|
86
|
+
| 1 | `explicitTrackingAttribute` | `[data-amp-track-id="value"]` | Customer set the tracking attribute with a non-empty value |
|
|
87
|
+
| 2 | `stableId` | `tag#id` | Element has an id, the id isn't suppressed, and it doesn't match any autogenerated-id pattern |
|
|
88
|
+
|
|
89
|
+
### Fallback
|
|
90
|
+
|
|
91
|
+
When neither strategy produces a unique selector anywhere on the walk, the engine invokes `fallbackCssPath`. The fallback walks from the target back up to `<html>`, expressing each step as `tag:nth-of-type(n)` and terminating early at the first unique id that survives the autogenerated-id filter.
|
|
92
|
+
|
|
93
|
+
### Sibling disambiguation: `:nth-of-type`, never classes
|
|
94
|
+
|
|
95
|
+
The fallback does not use classes for sibling disambiguation. Classes are runtime-volatile in modern frameworks — Tailwind utilities change with design tweaks, CSS-in-JS hashes change every build, and library state classes (`swiper-slide-active`, `is-open`, `Mui-selected`) move between elements as the user interacts. Positional descent via `:nth-of-type(n)` is stable across all of these.
|
|
96
|
+
|
|
97
|
+
## Defaults
|
|
98
|
+
|
|
99
|
+
### `enabled: false`
|
|
100
|
+
|
|
101
|
+
v1 ships dormant. Autocapture continues to use the legacy `cssPath` until the remote-config payload flips `enabled` to `true` for an org.
|
|
102
|
+
|
|
103
|
+
### `explicitTrackingAttribute: "data-amp-track-id"`
|
|
104
|
+
|
|
105
|
+
Customers can set this attribute on an element to anchor the selector on it explicitly. Setting it to an empty string is a suppression signal — the engine treats the element's id as if it didn't exist.
|
|
106
|
+
|
|
107
|
+
### `autogeneratedIdPatterns`
|
|
108
|
+
|
|
109
|
+
The default list filters out ids that look generated rather than authored:
|
|
110
|
+
|
|
111
|
+
| Pattern | Catches | Example |
|
|
112
|
+
|---------|---------|---------|
|
|
113
|
+
| `^:r[0-9a-z]+:$` | React `useId` | `:r5:`, `:rk:` |
|
|
114
|
+
| `^radix-` | Radix UI primitives | `radix-A1B2C3` |
|
|
115
|
+
| `^headlessui-` | Headless UI components | `headlessui-menu-button-:r5:` |
|
|
116
|
+
| `^mui-` | MUI internal id prefix | `mui-12345` |
|
|
117
|
+
| `^[a-f0-9]{16,}$` (`i`) | UUIDs without hyphens, build hashes | `a9b8c7d6e5f4321b` |
|
|
118
|
+
| `-\d{8,}$` | Trailing long digit runs | `session-1700000000` |
|
|
119
|
+
| `\d{4,}` | Any 4+ consecutive digits | `product-2134`, `row-1234` |
|
|
120
|
+
|
|
121
|
+
### `unstableClassPatterns`
|
|
122
|
+
|
|
123
|
+
The default list (used by the fallback) catches classes that look stable in name but aren't stable in practice — Tailwind utilities, CSS-in-JS hashes (Emotion, styled-components, CSS modules, styled-jsx), and library runtime state classes (Swiper, MUI, Radix, BEM-style `is-active`).
|
|
124
|
+
|
|
125
|
+
### `maxAncestorWalkDepth: undefined`
|
|
126
|
+
|
|
127
|
+
By default the walk runs all the way to `<html>`. Set this to a positive integer to cap the depth — useful for catastrophically deep DOMs where uniqueness checks could become expensive.
|
|
128
|
+
|
|
129
|
+
## Remote config
|
|
130
|
+
|
|
131
|
+
The remote-config payload shape is defined in `src/types.ts` as `ElementSelectorRemoteConfig` and mirrored as a JSON Schema at `schema/element-selector-remote-config.schema.json` for the dashboard's remote-config editor and backend validation.
|
|
132
|
+
|
|
133
|
+
Customer-provided pattern lists fully **replace** the defaults — they're not merged. An empty array (`autogeneratedIdPatterns: []`) is an explicit "disable filtering" signal, not a "use defaults" signal. Invalid regex strings are dropped (with a warn log) rather than crashing the engine.
|
|
134
|
+
|
|
135
|
+
## Diagnostics
|
|
136
|
+
|
|
137
|
+
Every path that catches an error accepts an optional `ElementSelectorLogger`, which is structurally compatible with the SDK's `@amplitude/analytics-core` logger provider. When wired up, the engine surfaces:
|
|
138
|
+
|
|
139
|
+
- `warn` — invalid regex strings in remote config, subscriber exceptions during `updateConfig` fan-out
|
|
140
|
+
- `debug` — malformed selectors produced by a strategy
|
|
141
|
+
|
|
142
|
+
When no logger is provided, the engine stays silent — preserving fire-and-forget semantics for consumers that don't want diagnostic noise.
|
|
143
|
+
|
|
144
|
+
## Testing
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
pnpm --filter @amplitude/element-selector test
|
|
148
|
+
pnpm --filter @amplitude/element-selector lint
|
|
149
|
+
pnpm --filter @amplitude/element-selector build
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
The test suite includes:
|
|
153
|
+
|
|
154
|
+
- **Primitive unit tests** for the pattern packs, helpers, strategies, config resolver, orchestrator, fallback, and engine factory
|
|
155
|
+
- **Schema drift guard** — asserts the JSON Schema and the `ElementSelectorRemoteConfig` TypeScript type stay in sync
|
|
156
|
+
- **Scenarios corpus** — a parameterized differential test that runs the engine over hand-picked fixtures (Swiper, MUI, Tailwind, semantic HTML, CSS-in-JS soup, etc.) and asserts both the expected selector and a `querySelector` round-trip
|
|
157
|
+
- **Property tests** — generate random DOM trees with mixed stable / autogen ids and class soup, assert the engine always emits a selector that uniquely resolves back to the target
|
|
158
|
+
|
|
159
|
+
## Design references
|
|
160
|
+
|
|
161
|
+
- Design doc: `packages/plugin-autocapture-browser/element-selector-strategy-v1-no-classes.md`
|
|
162
|
+
- Implementation plan: phased PR breakdown in the design doc's "Rollout" section
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config resolver — collapses the optional, string-based remote-config payload
|
|
3
|
+
* into the fully-typed `ResolvedSelectorConfig` that strategies, orchestrator,
|
|
4
|
+
* and fallback consume at runtime.
|
|
5
|
+
*
|
|
6
|
+
* Responsibilities:
|
|
7
|
+
*
|
|
8
|
+
* 1. Apply defaults for every field. The defaults (enabled = false,
|
|
9
|
+
* attribute = `data-amp-track-id`, built-in pattern packs) match the
|
|
10
|
+
* design doc's "v1 defaults" table.
|
|
11
|
+
*
|
|
12
|
+
* 2. Compile regex strings into `RegExp[]`. Bad regexes are skipped by the
|
|
13
|
+
* underlying `compile` helpers; when a logger is provided it surfaces a
|
|
14
|
+
* warning for each invalid pattern so customers can diagnose why their
|
|
15
|
+
* override isn't taking effect.
|
|
16
|
+
*
|
|
17
|
+
* 3. Treat customer-provided pattern lists as a **full replacement** of the
|
|
18
|
+
* defaults — not a merge. This matches the design doc: "The customer
|
|
19
|
+
* sees the defaults in the remote-config UI and may add or remove
|
|
20
|
+
* patterns as needed." If a customer provides `autogeneratedIdPatterns:
|
|
21
|
+
* []`, that's their explicit request to disable autogen filtering.
|
|
22
|
+
*
|
|
23
|
+
* 4. Clamp `maxAncestorWalkDepth` into a sane range. Negative / zero values
|
|
24
|
+
* are coerced to `undefined` (treat as "no limit") rather than throwing —
|
|
25
|
+
* remote config should never crash the engine.
|
|
26
|
+
*
|
|
27
|
+
* See the design doc:
|
|
28
|
+
* packages/plugin-autocapture-browser/element-selector-strategy-v1-no-classes.md
|
|
29
|
+
*/
|
|
30
|
+
import { ElementSelectorLogger, ElementSelectorRemoteConfig, ResolvedSelectorConfig } from '../types';
|
|
31
|
+
/**
|
|
32
|
+
* Built-in defaults applied when a field is absent from the remote payload.
|
|
33
|
+
* Exported so consumers (and tests) can introspect the baseline without
|
|
34
|
+
* round-tripping through `resolveSelectorConfig({})`.
|
|
35
|
+
*/
|
|
36
|
+
export declare const DEFAULT_RESOLVED_CONFIG: Readonly<ResolvedSelectorConfig>;
|
|
37
|
+
/**
|
|
38
|
+
* Resolve a (possibly partial, possibly absent) remote-config payload into a
|
|
39
|
+
* fully-typed runtime config. Always returns a fresh object; never mutates the
|
|
40
|
+
* input.
|
|
41
|
+
*
|
|
42
|
+
* Field-by-field semantics:
|
|
43
|
+
*
|
|
44
|
+
* - `enabled`: defaults to false (the engine ships dormant). Any boolean in
|
|
45
|
+
* the payload — including `false` — wins.
|
|
46
|
+
* - `explicitTrackingAttribute`: defaults to `data-amp-track-id`. Empty
|
|
47
|
+
* strings are rejected (they'd make the strategy match every element);
|
|
48
|
+
* fall back to the default in that case.
|
|
49
|
+
* - `autogeneratedIdPatterns` / `unstableClassPatterns`: present → compile
|
|
50
|
+
* the strings (skipping invalid regexes), use the compiled list as-is.
|
|
51
|
+
* Absent → use the defaults.
|
|
52
|
+
* - `maxAncestorWalkDepth`: positive finite integer → use as-is. Anything
|
|
53
|
+
* else (zero, negative, NaN, Infinity) → `undefined` (no limit).
|
|
54
|
+
*/
|
|
55
|
+
export declare function resolveSelectorConfig(remote?: ElementSelectorRemoteConfig, logger?: ElementSelectorLogger): ResolvedSelectorConfig;
|
|
56
|
+
//# sourceMappingURL=resolve-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-config.d.ts","sourceRoot":"","sources":["../../../src/config/resolve-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAOtG;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,sBAAsB,CAQnE,CAAC;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,CAAC,EAAE,2BAA2B,EACpC,MAAM,CAAC,EAAE,qBAAqB,GAC7B,sBAAsB,CA4BxB"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Config resolver — collapses the optional, string-based remote-config payload
|
|
4
|
+
* into the fully-typed `ResolvedSelectorConfig` that strategies, orchestrator,
|
|
5
|
+
* and fallback consume at runtime.
|
|
6
|
+
*
|
|
7
|
+
* Responsibilities:
|
|
8
|
+
*
|
|
9
|
+
* 1. Apply defaults for every field. The defaults (enabled = false,
|
|
10
|
+
* attribute = `data-amp-track-id`, built-in pattern packs) match the
|
|
11
|
+
* design doc's "v1 defaults" table.
|
|
12
|
+
*
|
|
13
|
+
* 2. Compile regex strings into `RegExp[]`. Bad regexes are skipped by the
|
|
14
|
+
* underlying `compile` helpers; when a logger is provided it surfaces a
|
|
15
|
+
* warning for each invalid pattern so customers can diagnose why their
|
|
16
|
+
* override isn't taking effect.
|
|
17
|
+
*
|
|
18
|
+
* 3. Treat customer-provided pattern lists as a **full replacement** of the
|
|
19
|
+
* defaults — not a merge. This matches the design doc: "The customer
|
|
20
|
+
* sees the defaults in the remote-config UI and may add or remove
|
|
21
|
+
* patterns as needed." If a customer provides `autogeneratedIdPatterns:
|
|
22
|
+
* []`, that's their explicit request to disable autogen filtering.
|
|
23
|
+
*
|
|
24
|
+
* 4. Clamp `maxAncestorWalkDepth` into a sane range. Negative / zero values
|
|
25
|
+
* are coerced to `undefined` (treat as "no limit") rather than throwing —
|
|
26
|
+
* remote config should never crash the engine.
|
|
27
|
+
*
|
|
28
|
+
* See the design doc:
|
|
29
|
+
* packages/plugin-autocapture-browser/element-selector-strategy-v1-no-classes.md
|
|
30
|
+
*/
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.resolveSelectorConfig = exports.DEFAULT_RESOLVED_CONFIG = void 0;
|
|
33
|
+
var tslib_1 = require("tslib");
|
|
34
|
+
var autogenerated_ids_1 = require("../patterns/autogenerated-ids");
|
|
35
|
+
var unstable_classes_1 = require("../patterns/unstable-classes");
|
|
36
|
+
/**
|
|
37
|
+
* Built-in defaults applied when a field is absent from the remote payload.
|
|
38
|
+
* Exported so consumers (and tests) can introspect the baseline without
|
|
39
|
+
* round-tripping through `resolveSelectorConfig({})`.
|
|
40
|
+
*/
|
|
41
|
+
exports.DEFAULT_RESOLVED_CONFIG = Object.freeze({
|
|
42
|
+
// v1 ships disabled — autocapture only flips to the new engine when the
|
|
43
|
+
// remote config explicitly enables it for an org.
|
|
44
|
+
enabled: false,
|
|
45
|
+
explicitTrackingAttribute: 'data-amp-track-id',
|
|
46
|
+
autogeneratedIdPatterns: tslib_1.__spreadArray([], tslib_1.__read(autogenerated_ids_1.DEFAULT_AUTOGENERATED_ID_PATTERNS), false),
|
|
47
|
+
unstableClassPatterns: tslib_1.__spreadArray([], tslib_1.__read(unstable_classes_1.DEFAULT_UNSTABLE_CLASS_PATTERNS), false),
|
|
48
|
+
maxAncestorWalkDepth: undefined,
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* Resolve a (possibly partial, possibly absent) remote-config payload into a
|
|
52
|
+
* fully-typed runtime config. Always returns a fresh object; never mutates the
|
|
53
|
+
* input.
|
|
54
|
+
*
|
|
55
|
+
* Field-by-field semantics:
|
|
56
|
+
*
|
|
57
|
+
* - `enabled`: defaults to false (the engine ships dormant). Any boolean in
|
|
58
|
+
* the payload — including `false` — wins.
|
|
59
|
+
* - `explicitTrackingAttribute`: defaults to `data-amp-track-id`. Empty
|
|
60
|
+
* strings are rejected (they'd make the strategy match every element);
|
|
61
|
+
* fall back to the default in that case.
|
|
62
|
+
* - `autogeneratedIdPatterns` / `unstableClassPatterns`: present → compile
|
|
63
|
+
* the strings (skipping invalid regexes), use the compiled list as-is.
|
|
64
|
+
* Absent → use the defaults.
|
|
65
|
+
* - `maxAncestorWalkDepth`: positive finite integer → use as-is. Anything
|
|
66
|
+
* else (zero, negative, NaN, Infinity) → `undefined` (no limit).
|
|
67
|
+
*/
|
|
68
|
+
function resolveSelectorConfig(remote, logger) {
|
|
69
|
+
if (!remote) {
|
|
70
|
+
// Return a fresh copy so callers can safely mutate the result without
|
|
71
|
+
// poisoning the frozen defaults singleton.
|
|
72
|
+
return cloneDefaults();
|
|
73
|
+
}
|
|
74
|
+
var resolved = cloneDefaults();
|
|
75
|
+
if (typeof remote.enabled === 'boolean') {
|
|
76
|
+
resolved.enabled = remote.enabled;
|
|
77
|
+
}
|
|
78
|
+
if (typeof remote.explicitTrackingAttribute === 'string' && remote.explicitTrackingAttribute !== '') {
|
|
79
|
+
resolved.explicitTrackingAttribute = remote.explicitTrackingAttribute;
|
|
80
|
+
}
|
|
81
|
+
if (Array.isArray(remote.autogeneratedIdPatterns)) {
|
|
82
|
+
resolved.autogeneratedIdPatterns = (0, autogenerated_ids_1.compile)(remote.autogeneratedIdPatterns, logger);
|
|
83
|
+
}
|
|
84
|
+
if (Array.isArray(remote.unstableClassPatterns)) {
|
|
85
|
+
resolved.unstableClassPatterns = (0, unstable_classes_1.compile)(remote.unstableClassPatterns, logger);
|
|
86
|
+
}
|
|
87
|
+
resolved.maxAncestorWalkDepth = clampDepth(remote.maxAncestorWalkDepth);
|
|
88
|
+
return resolved;
|
|
89
|
+
}
|
|
90
|
+
exports.resolveSelectorConfig = resolveSelectorConfig;
|
|
91
|
+
/**
|
|
92
|
+
* Coerce a remote-supplied depth value into the runtime contract:
|
|
93
|
+
* - undefined / non-number / NaN / Infinity / <= 0 → undefined (no limit)
|
|
94
|
+
* - positive finite number → floor()'d integer
|
|
95
|
+
*/
|
|
96
|
+
function clampDepth(depth) {
|
|
97
|
+
if (typeof depth !== 'number')
|
|
98
|
+
return undefined;
|
|
99
|
+
if (!Number.isFinite(depth))
|
|
100
|
+
return undefined;
|
|
101
|
+
if (depth <= 0)
|
|
102
|
+
return undefined;
|
|
103
|
+
return Math.floor(depth);
|
|
104
|
+
}
|
|
105
|
+
function cloneDefaults() {
|
|
106
|
+
return {
|
|
107
|
+
enabled: exports.DEFAULT_RESOLVED_CONFIG.enabled,
|
|
108
|
+
explicitTrackingAttribute: exports.DEFAULT_RESOLVED_CONFIG.explicitTrackingAttribute,
|
|
109
|
+
autogeneratedIdPatterns: tslib_1.__spreadArray([], tslib_1.__read(exports.DEFAULT_RESOLVED_CONFIG.autogeneratedIdPatterns), false),
|
|
110
|
+
unstableClassPatterns: tslib_1.__spreadArray([], tslib_1.__read(exports.DEFAULT_RESOLVED_CONFIG.unstableClassPatterns), false),
|
|
111
|
+
maxAncestorWalkDepth: exports.DEFAULT_RESOLVED_CONFIG.maxAncestorWalkDepth,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=resolve-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-config.js","sourceRoot":"","sources":["../../../src/config/resolve-config.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;;AAGH,mEAGuC;AACvC,iEAAwH;AAExH;;;;GAIG;AACU,QAAA,uBAAuB,GAAqC,MAAM,CAAC,MAAM,CAAC;IACrF,wEAAwE;IACxE,kDAAkD;IAClD,OAAO,EAAE,KAAK;IACd,yBAAyB,EAAE,mBAAmB;IAC9C,uBAAuB,2CAAM,qDAAiC,SAAC;IAC/D,qBAAqB,2CAAM,kDAA+B,SAAC;IAC3D,oBAAoB,EAAE,SAAS;CAChC,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,qBAAqB,CACnC,MAAoC,EACpC,MAA8B;IAE9B,IAAI,CAAC,MAAM,EAAE;QACX,sEAAsE;QACtE,2CAA2C;QAC3C,OAAO,aAAa,EAAE,CAAC;KACxB;IAED,IAAM,QAAQ,GAA2B,aAAa,EAAE,CAAC;IAEzD,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE;QACvC,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;KACnC;IAED,IAAI,OAAO,MAAM,CAAC,yBAAyB,KAAK,QAAQ,IAAI,MAAM,CAAC,yBAAyB,KAAK,EAAE,EAAE;QACnG,QAAQ,CAAC,yBAAyB,GAAG,MAAM,CAAC,yBAAyB,CAAC;KACvE;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAAC,EAAE;QACjD,QAAQ,CAAC,uBAAuB,GAAG,IAAA,2BAA8B,EAAC,MAAM,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;KAC3G;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE;QAC/C,QAAQ,CAAC,qBAAqB,GAAG,IAAA,0BAA4B,EAAC,MAAM,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;KACrG;IAED,QAAQ,CAAC,oBAAoB,GAAG,UAAU,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAExE,OAAO,QAAQ,CAAC;AAClB,CAAC;AA/BD,sDA+BC;AAED;;;;GAIG;AACH,SAAS,UAAU,CAAC,KAAyB;IAC3C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC9C,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IACjC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC;AAED,SAAS,aAAa;IACpB,OAAO;QACL,OAAO,EAAE,+BAAuB,CAAC,OAAO;QACxC,yBAAyB,EAAE,+BAAuB,CAAC,yBAAyB;QAC5E,uBAAuB,2CAAM,+BAAuB,CAAC,uBAAuB,SAAC;QAC7E,qBAAqB,2CAAM,+BAAuB,CAAC,qBAAqB,SAAC;QACzE,oBAAoB,EAAE,+BAAuB,CAAC,oBAAoB;KACnE,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Config resolver — collapses the optional, string-based remote-config payload\n * into the fully-typed `ResolvedSelectorConfig` that strategies, orchestrator,\n * and fallback consume at runtime.\n *\n * Responsibilities:\n *\n * 1. Apply defaults for every field. The defaults (enabled = false,\n * attribute = `data-amp-track-id`, built-in pattern packs) match the\n * design doc's \"v1 defaults\" table.\n *\n * 2. Compile regex strings into `RegExp[]`. Bad regexes are skipped by the\n * underlying `compile` helpers; when a logger is provided it surfaces a\n * warning for each invalid pattern so customers can diagnose why their\n * override isn't taking effect.\n *\n * 3. Treat customer-provided pattern lists as a **full replacement** of the\n * defaults — not a merge. This matches the design doc: \"The customer\n * sees the defaults in the remote-config UI and may add or remove\n * patterns as needed.\" If a customer provides `autogeneratedIdPatterns:\n * []`, that's their explicit request to disable autogen filtering.\n *\n * 4. Clamp `maxAncestorWalkDepth` into a sane range. Negative / zero values\n * are coerced to `undefined` (treat as \"no limit\") rather than throwing —\n * remote config should never crash the engine.\n *\n * See the design doc:\n * packages/plugin-autocapture-browser/element-selector-strategy-v1-no-classes.md\n */\n\nimport { ElementSelectorLogger, ElementSelectorRemoteConfig, ResolvedSelectorConfig } from '../types';\nimport {\n DEFAULT_AUTOGENERATED_ID_PATTERNS,\n compile as compileAutogeneratedIdPatterns,\n} from '../patterns/autogenerated-ids';\nimport { DEFAULT_UNSTABLE_CLASS_PATTERNS, compile as compileUnstableClassPatterns } from '../patterns/unstable-classes';\n\n/**\n * Built-in defaults applied when a field is absent from the remote payload.\n * Exported so consumers (and tests) can introspect the baseline without\n * round-tripping through `resolveSelectorConfig({})`.\n */\nexport const DEFAULT_RESOLVED_CONFIG: Readonly<ResolvedSelectorConfig> = Object.freeze({\n // v1 ships disabled — autocapture only flips to the new engine when the\n // remote config explicitly enables it for an org.\n enabled: false,\n explicitTrackingAttribute: 'data-amp-track-id',\n autogeneratedIdPatterns: [...DEFAULT_AUTOGENERATED_ID_PATTERNS],\n unstableClassPatterns: [...DEFAULT_UNSTABLE_CLASS_PATTERNS],\n maxAncestorWalkDepth: undefined,\n});\n\n/**\n * Resolve a (possibly partial, possibly absent) remote-config payload into a\n * fully-typed runtime config. Always returns a fresh object; never mutates the\n * input.\n *\n * Field-by-field semantics:\n *\n * - `enabled`: defaults to false (the engine ships dormant). Any boolean in\n * the payload — including `false` — wins.\n * - `explicitTrackingAttribute`: defaults to `data-amp-track-id`. Empty\n * strings are rejected (they'd make the strategy match every element);\n * fall back to the default in that case.\n * - `autogeneratedIdPatterns` / `unstableClassPatterns`: present → compile\n * the strings (skipping invalid regexes), use the compiled list as-is.\n * Absent → use the defaults.\n * - `maxAncestorWalkDepth`: positive finite integer → use as-is. Anything\n * else (zero, negative, NaN, Infinity) → `undefined` (no limit).\n */\nexport function resolveSelectorConfig(\n remote?: ElementSelectorRemoteConfig,\n logger?: ElementSelectorLogger,\n): ResolvedSelectorConfig {\n if (!remote) {\n // Return a fresh copy so callers can safely mutate the result without\n // poisoning the frozen defaults singleton.\n return cloneDefaults();\n }\n\n const resolved: ResolvedSelectorConfig = cloneDefaults();\n\n if (typeof remote.enabled === 'boolean') {\n resolved.enabled = remote.enabled;\n }\n\n if (typeof remote.explicitTrackingAttribute === 'string' && remote.explicitTrackingAttribute !== '') {\n resolved.explicitTrackingAttribute = remote.explicitTrackingAttribute;\n }\n\n if (Array.isArray(remote.autogeneratedIdPatterns)) {\n resolved.autogeneratedIdPatterns = compileAutogeneratedIdPatterns(remote.autogeneratedIdPatterns, logger);\n }\n\n if (Array.isArray(remote.unstableClassPatterns)) {\n resolved.unstableClassPatterns = compileUnstableClassPatterns(remote.unstableClassPatterns, logger);\n }\n\n resolved.maxAncestorWalkDepth = clampDepth(remote.maxAncestorWalkDepth);\n\n return resolved;\n}\n\n/**\n * Coerce a remote-supplied depth value into the runtime contract:\n * - undefined / non-number / NaN / Infinity / <= 0 → undefined (no limit)\n * - positive finite number → floor()'d integer\n */\nfunction clampDepth(depth: number | undefined): number | undefined {\n if (typeof depth !== 'number') return undefined;\n if (!Number.isFinite(depth)) return undefined;\n if (depth <= 0) return undefined;\n return Math.floor(depth);\n}\n\nfunction cloneDefaults(): ResolvedSelectorConfig {\n return {\n enabled: DEFAULT_RESOLVED_CONFIG.enabled,\n explicitTrackingAttribute: DEFAULT_RESOLVED_CONFIG.explicitTrackingAttribute,\n autogeneratedIdPatterns: [...DEFAULT_RESOLVED_CONFIG.autogeneratedIdPatterns],\n unstableClassPatterns: [...DEFAULT_RESOLVED_CONFIG.unstableClassPatterns],\n maxAncestorWalkDepth: DEFAULT_RESOLVED_CONFIG.maxAncestorWalkDepth,\n };\n}\n"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Engine factory — composes the strategy chain (via `runOrchestrator`) with
|
|
3
|
+
* the safety-net fallback (`fallbackCssPath`) behind a single `SelectorEngine`
|
|
4
|
+
* interface.
|
|
5
|
+
*
|
|
6
|
+
* This is the surface every consumer talks to:
|
|
7
|
+
*
|
|
8
|
+
* - autocapture SDK plugin → instantiates one engine per init() call,
|
|
9
|
+
* wires it into the click handler, and forwards remote-config updates
|
|
10
|
+
* via `updateConfig`.
|
|
11
|
+
* - app.amplitude.com tagging UI → fetches the customer's remote config
|
|
12
|
+
* out-of-band and stands up a transient engine to compute selectors for
|
|
13
|
+
* elements the user clicks in the iframe.
|
|
14
|
+
* - Chrome extension visual tagger → reads the customer's already-live
|
|
15
|
+
* engine off `window.amplitude.elementSelector` (when present) and
|
|
16
|
+
* subscribes to `onConfigChange` so the extension's preview stays in
|
|
17
|
+
* sync with the customer's runtime config.
|
|
18
|
+
*
|
|
19
|
+
* The factory deliberately takes a pre-resolved `ResolvedSelectorConfig` rather
|
|
20
|
+
* than the raw remote payload — config resolution is a separate concern handled
|
|
21
|
+
* by `resolveSelectorConfig`, and keeping it out of the engine constructor lets
|
|
22
|
+
* dashboard / extension consumers stand up an engine from a static snapshot
|
|
23
|
+
* without re-running the full resolver.
|
|
24
|
+
*
|
|
25
|
+
* See the design doc:
|
|
26
|
+
* packages/plugin-autocapture-browser/element-selector-strategy-v1-no-classes.md
|
|
27
|
+
*/
|
|
28
|
+
import { ElementSelectorLogger, ResolvedSelectorConfig, SelectorEngine } from './types';
|
|
29
|
+
import { OrchestratorOptions } from './orchestrator';
|
|
30
|
+
export interface CreateSelectorEngineOptions {
|
|
31
|
+
/** Optional document or shadow root for uniqueness checks. Defaults per-call to the target's owner document. */
|
|
32
|
+
scope?: ParentNode;
|
|
33
|
+
/** Optional override of the strategy chain. Primarily for testing / dashboard ad-hoc runs. */
|
|
34
|
+
strategies?: OrchestratorOptions['strategies'];
|
|
35
|
+
/**
|
|
36
|
+
* Optional logger threaded through the orchestrator and the subscriber-fan-out
|
|
37
|
+
* inside `updateConfig`. When provided, the engine surfaces malformed
|
|
38
|
+
* selectors (`debug`) and listener exceptions (`warn`); when absent it stays
|
|
39
|
+
* silent — preserving the legacy "fire-and-forget" semantics existing
|
|
40
|
+
* consumers may rely on.
|
|
41
|
+
*/
|
|
42
|
+
logger?: ElementSelectorLogger;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Build a `SelectorEngine` bound to the supplied config.
|
|
46
|
+
*
|
|
47
|
+
* The returned engine is independent — calling the factory twice yields two
|
|
48
|
+
* engines with separate config state and separate subscriber lists. This is the
|
|
49
|
+
* shape the autocapture plugin wants (one engine per SDK instance) and the
|
|
50
|
+
* shape the Chrome extension consumes off the page (the extension reads, never
|
|
51
|
+
* writes).
|
|
52
|
+
*/
|
|
53
|
+
export declare function createSelectorEngine(initialConfig: ResolvedSelectorConfig, options?: CreateSelectorEngineOptions): SelectorEngine;
|
|
54
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACxF,OAAO,EAAmB,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAItE,MAAM,WAAW,2BAA2B;IAC1C,gHAAgH;IAChH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,8FAA8F;IAC9F,UAAU,CAAC,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAC/C;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,qBAAqB,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,sBAAsB,EACrC,OAAO,GAAE,2BAAgC,GACxC,cAAc,CAoFhB"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Engine factory — composes the strategy chain (via `runOrchestrator`) with
|
|
4
|
+
* the safety-net fallback (`fallbackCssPath`) behind a single `SelectorEngine`
|
|
5
|
+
* interface.
|
|
6
|
+
*
|
|
7
|
+
* This is the surface every consumer talks to:
|
|
8
|
+
*
|
|
9
|
+
* - autocapture SDK plugin → instantiates one engine per init() call,
|
|
10
|
+
* wires it into the click handler, and forwards remote-config updates
|
|
11
|
+
* via `updateConfig`.
|
|
12
|
+
* - app.amplitude.com tagging UI → fetches the customer's remote config
|
|
13
|
+
* out-of-band and stands up a transient engine to compute selectors for
|
|
14
|
+
* elements the user clicks in the iframe.
|
|
15
|
+
* - Chrome extension visual tagger → reads the customer's already-live
|
|
16
|
+
* engine off `window.amplitude.elementSelector` (when present) and
|
|
17
|
+
* subscribes to `onConfigChange` so the extension's preview stays in
|
|
18
|
+
* sync with the customer's runtime config.
|
|
19
|
+
*
|
|
20
|
+
* The factory deliberately takes a pre-resolved `ResolvedSelectorConfig` rather
|
|
21
|
+
* than the raw remote payload — config resolution is a separate concern handled
|
|
22
|
+
* by `resolveSelectorConfig`, and keeping it out of the engine constructor lets
|
|
23
|
+
* dashboard / extension consumers stand up an engine from a static snapshot
|
|
24
|
+
* without re-running the full resolver.
|
|
25
|
+
*
|
|
26
|
+
* See the design doc:
|
|
27
|
+
* packages/plugin-autocapture-browser/element-selector-strategy-v1-no-classes.md
|
|
28
|
+
*/
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.createSelectorEngine = void 0;
|
|
31
|
+
var tslib_1 = require("tslib");
|
|
32
|
+
var orchestrator_1 = require("./orchestrator");
|
|
33
|
+
var fallback_css_path_1 = require("./fallback-css-path");
|
|
34
|
+
var legacy_css_path_1 = require("./legacy-css-path");
|
|
35
|
+
/**
|
|
36
|
+
* Build a `SelectorEngine` bound to the supplied config.
|
|
37
|
+
*
|
|
38
|
+
* The returned engine is independent — calling the factory twice yields two
|
|
39
|
+
* engines with separate config state and separate subscriber lists. This is the
|
|
40
|
+
* shape the autocapture plugin wants (one engine per SDK instance) and the
|
|
41
|
+
* shape the Chrome extension consumes off the page (the extension reads, never
|
|
42
|
+
* writes).
|
|
43
|
+
*/
|
|
44
|
+
function createSelectorEngine(initialConfig, options) {
|
|
45
|
+
if (options === void 0) { options = {}; }
|
|
46
|
+
var config = initialConfig;
|
|
47
|
+
var subscribers = new Set();
|
|
48
|
+
var logger = options.logger;
|
|
49
|
+
var orchestratorOptions = {
|
|
50
|
+
strategies: options.strategies,
|
|
51
|
+
scope: options.scope,
|
|
52
|
+
logger: logger,
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
generate: function (el) {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
// Kill switch: when the customer's remote config has the engine
|
|
58
|
+
// disabled (the default for orgs that haven't opted in), emit the same
|
|
59
|
+
// Chromium-derived selector autocapture has shipped since before the
|
|
60
|
+
// strategy chain existed. This is what makes "flip enabled back to
|
|
61
|
+
// false" a one-config-fetch revert for both the SDK and the dashboard —
|
|
62
|
+
// they both go through this entry point now.
|
|
63
|
+
if (!config.enabled) {
|
|
64
|
+
return safeLegacyCssPath(el);
|
|
65
|
+
}
|
|
66
|
+
// Engine path: try the strategy chain, then the hardened fallback. Both
|
|
67
|
+
// are wrapped so a runtime exception (malformed config slipped past the
|
|
68
|
+
// resolver, browser API quirks, a bad scope) still produces a usable
|
|
69
|
+
// selector. Without this, an autocapture click handler could throw
|
|
70
|
+
// mid-flow and the customer would silently lose the event — a worse
|
|
71
|
+
// outcome than emitting a less-stable selector.
|
|
72
|
+
try {
|
|
73
|
+
var composed = (0, orchestrator_1.runOrchestrator)(el, config, orchestratorOptions);
|
|
74
|
+
if (composed !== null) {
|
|
75
|
+
return composed;
|
|
76
|
+
}
|
|
77
|
+
return (0, fallback_css_path_1.fallbackCssPath)(el, config, { scope: (_b = (_a = options.scope) !== null && _a !== void 0 ? _a : el.ownerDocument) !== null && _b !== void 0 ? _b : document });
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
var message = e instanceof Error ? e.message : String(e);
|
|
81
|
+
logger === null || logger === void 0 ? void 0 : logger.warn("@amplitude/element-selector: strategy chain threw \u2014 falling back to legacy cssPath: ".concat(message));
|
|
82
|
+
return safeLegacyCssPath(el);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
getConfig: function () {
|
|
86
|
+
return config;
|
|
87
|
+
},
|
|
88
|
+
updateConfig: function (next) {
|
|
89
|
+
var e_1, _a;
|
|
90
|
+
config = next;
|
|
91
|
+
try {
|
|
92
|
+
// Notify subscribers in insertion order. Errors thrown by individual
|
|
93
|
+
// subscribers are isolated so one bad listener can't break the others —
|
|
94
|
+
// the extension's listener is the canonical consumer here and we don't
|
|
95
|
+
// want SDK-side changes to cascade-fail because of an extension bug.
|
|
96
|
+
for (var subscribers_1 = tslib_1.__values(subscribers), subscribers_1_1 = subscribers_1.next(); !subscribers_1_1.done; subscribers_1_1 = subscribers_1.next()) {
|
|
97
|
+
var cb = subscribers_1_1.value;
|
|
98
|
+
try {
|
|
99
|
+
cb(next);
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
var message = e instanceof Error ? e.message : String(e);
|
|
103
|
+
logger === null || logger === void 0 ? void 0 : logger.warn("@amplitude/element-selector: onConfigChange subscriber threw \u2014 ".concat(message));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
108
|
+
finally {
|
|
109
|
+
try {
|
|
110
|
+
if (subscribers_1_1 && !subscribers_1_1.done && (_a = subscribers_1.return)) _a.call(subscribers_1);
|
|
111
|
+
}
|
|
112
|
+
finally { if (e_1) throw e_1.error; }
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
onConfigChange: function (cb) {
|
|
116
|
+
subscribers.add(cb);
|
|
117
|
+
return function () {
|
|
118
|
+
subscribers.delete(cb);
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
// Local wrapper so a thrown error in the legacy walker (extremely unlikely
|
|
123
|
+
// — Element inputs only — but defensible if a host environment is missing
|
|
124
|
+
// `CSS.escape` or `Node` constants) doesn't escape `generate` and crash the
|
|
125
|
+
// caller. Returns the empty string in that pathological case; consumers
|
|
126
|
+
// already coalesce empty results to a sentinel.
|
|
127
|
+
function safeLegacyCssPath(el) {
|
|
128
|
+
try {
|
|
129
|
+
return (0, legacy_css_path_1.legacyCssPath)(el);
|
|
130
|
+
}
|
|
131
|
+
catch (e) {
|
|
132
|
+
var message = e instanceof Error ? e.message : String(e);
|
|
133
|
+
logger === null || logger === void 0 ? void 0 : logger.warn("@amplitude/element-selector: legacyCssPath threw \u2014 emitting empty selector: ".concat(message));
|
|
134
|
+
return '';
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.createSelectorEngine = createSelectorEngine;
|
|
139
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/engine.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;;;AAGH,+CAAsE;AACtE,yDAAsD;AACtD,qDAAkD;AAiBlD;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAClC,aAAqC,EACrC,OAAyC;IAAzC,wBAAA,EAAA,YAAyC;IAEzC,IAAI,MAAM,GAA2B,aAAa,CAAC;IACnD,IAAM,WAAW,GAAG,IAAI,GAAG,EAA4C,CAAC;IACxE,IAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAE9B,IAAM,mBAAmB,GAAwB;QAC/C,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,QAAA;KACP,CAAC;IAEF,OAAO;QACL,QAAQ,YAAC,EAAW;;YAClB,gEAAgE;YAChE,uEAAuE;YACvE,qEAAqE;YACrE,mEAAmE;YACnE,wEAAwE;YACxE,6CAA6C;YAC7C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;gBACnB,OAAO,iBAAiB,CAAC,EAAE,CAAC,CAAC;aAC9B;YAED,wEAAwE;YACxE,wEAAwE;YACxE,qEAAqE;YACrE,mEAAmE;YACnE,oEAAoE;YACpE,gDAAgD;YAChD,IAAI;gBACF,IAAM,QAAQ,GAAG,IAAA,8BAAe,EAAC,EAAE,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC;gBAClE,IAAI,QAAQ,KAAK,IAAI,EAAE;oBACrB,OAAO,QAAQ,CAAC;iBACjB;gBACD,OAAO,IAAA,mCAAe,EAAC,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAA,MAAA,OAAO,CAAC,KAAK,mCAAI,EAAE,CAAC,aAAa,mCAAI,QAAQ,EAAE,CAAC,CAAC;aAC9F;YAAC,OAAO,CAAC,EAAE;gBACV,IAAM,OAAO,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBAC3D,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,mGAAuF,OAAO,CAAE,CAAC,CAAC;gBAC/G,OAAO,iBAAiB,CAAC,EAAE,CAAC,CAAC;aAC9B;QACH,CAAC;QAED,SAAS;YACP,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,YAAY,YAAC,IAA4B;;YACvC,MAAM,GAAG,IAAI,CAAC;;gBACd,qEAAqE;gBACrE,wEAAwE;gBACxE,uEAAuE;gBACvE,qEAAqE;gBACrE,KAAiB,IAAA,gBAAA,iBAAA,WAAW,CAAA,wCAAA,iEAAE;oBAAzB,IAAM,EAAE,wBAAA;oBACX,IAAI;wBACF,EAAE,CAAC,IAAI,CAAC,CAAC;qBACV;oBAAC,OAAO,CAAC,EAAE;wBACV,IAAM,OAAO,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;wBAC3D,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,8EAAkE,OAAO,CAAE,CAAC,CAAC;qBAC3F;iBACF;;;;;;;;;QACH,CAAC;QAED,cAAc,YAAC,EAA4C;YACzD,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACpB,OAAO;gBACL,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACzB,CAAC,CAAC;QACJ,CAAC;KACF,CAAC;IAEF,2EAA2E;IAC3E,0EAA0E;IAC1E,4EAA4E;IAC5E,wEAAwE;IACxE,gDAAgD;IAChD,SAAS,iBAAiB,CAAC,EAAW;QACpC,IAAI;YACF,OAAO,IAAA,+BAAa,EAAC,EAAE,CAAC,CAAC;SAC1B;QAAC,OAAO,CAAC,EAAE;YACV,IAAM,OAAO,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC3D,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,2FAA+E,OAAO,CAAE,CAAC,CAAC;YACvG,OAAO,EAAE,CAAC;SACX;IACH,CAAC;AACH,CAAC;AAvFD,oDAuFC","sourcesContent":["/**\n * Engine factory — composes the strategy chain (via `runOrchestrator`) with\n * the safety-net fallback (`fallbackCssPath`) behind a single `SelectorEngine`\n * interface.\n *\n * This is the surface every consumer talks to:\n *\n * - autocapture SDK plugin → instantiates one engine per init() call,\n * wires it into the click handler, and forwards remote-config updates\n * via `updateConfig`.\n * - app.amplitude.com tagging UI → fetches the customer's remote config\n * out-of-band and stands up a transient engine to compute selectors for\n * elements the user clicks in the iframe.\n * - Chrome extension visual tagger → reads the customer's already-live\n * engine off `window.amplitude.elementSelector` (when present) and\n * subscribes to `onConfigChange` so the extension's preview stays in\n * sync with the customer's runtime config.\n *\n * The factory deliberately takes a pre-resolved `ResolvedSelectorConfig` rather\n * than the raw remote payload — config resolution is a separate concern handled\n * by `resolveSelectorConfig`, and keeping it out of the engine constructor lets\n * dashboard / extension consumers stand up an engine from a static snapshot\n * without re-running the full resolver.\n *\n * See the design doc:\n * packages/plugin-autocapture-browser/element-selector-strategy-v1-no-classes.md\n */\n\nimport { ElementSelectorLogger, ResolvedSelectorConfig, SelectorEngine } from './types';\nimport { runOrchestrator, OrchestratorOptions } from './orchestrator';\nimport { fallbackCssPath } from './fallback-css-path';\nimport { legacyCssPath } from './legacy-css-path';\n\nexport interface CreateSelectorEngineOptions {\n /** Optional document or shadow root for uniqueness checks. Defaults per-call to the target's owner document. */\n scope?: ParentNode;\n /** Optional override of the strategy chain. Primarily for testing / dashboard ad-hoc runs. */\n strategies?: OrchestratorOptions['strategies'];\n /**\n * Optional logger threaded through the orchestrator and the subscriber-fan-out\n * inside `updateConfig`. When provided, the engine surfaces malformed\n * selectors (`debug`) and listener exceptions (`warn`); when absent it stays\n * silent — preserving the legacy \"fire-and-forget\" semantics existing\n * consumers may rely on.\n */\n logger?: ElementSelectorLogger;\n}\n\n/**\n * Build a `SelectorEngine` bound to the supplied config.\n *\n * The returned engine is independent — calling the factory twice yields two\n * engines with separate config state and separate subscriber lists. This is the\n * shape the autocapture plugin wants (one engine per SDK instance) and the\n * shape the Chrome extension consumes off the page (the extension reads, never\n * writes).\n */\nexport function createSelectorEngine(\n initialConfig: ResolvedSelectorConfig,\n options: CreateSelectorEngineOptions = {},\n): SelectorEngine {\n let config: ResolvedSelectorConfig = initialConfig;\n const subscribers = new Set<(config: ResolvedSelectorConfig) => void>();\n const logger = options.logger;\n\n const orchestratorOptions: OrchestratorOptions = {\n strategies: options.strategies,\n scope: options.scope,\n logger,\n };\n\n return {\n generate(el: Element): string {\n // Kill switch: when the customer's remote config has the engine\n // disabled (the default for orgs that haven't opted in), emit the same\n // Chromium-derived selector autocapture has shipped since before the\n // strategy chain existed. This is what makes \"flip enabled back to\n // false\" a one-config-fetch revert for both the SDK and the dashboard —\n // they both go through this entry point now.\n if (!config.enabled) {\n return safeLegacyCssPath(el);\n }\n\n // Engine path: try the strategy chain, then the hardened fallback. Both\n // are wrapped so a runtime exception (malformed config slipped past the\n // resolver, browser API quirks, a bad scope) still produces a usable\n // selector. Without this, an autocapture click handler could throw\n // mid-flow and the customer would silently lose the event — a worse\n // outcome than emitting a less-stable selector.\n try {\n const composed = runOrchestrator(el, config, orchestratorOptions);\n if (composed !== null) {\n return composed;\n }\n return fallbackCssPath(el, config, { scope: options.scope ?? el.ownerDocument ?? document });\n } catch (e) {\n const message = e instanceof Error ? e.message : String(e);\n logger?.warn(`@amplitude/element-selector: strategy chain threw — falling back to legacy cssPath: ${message}`);\n return safeLegacyCssPath(el);\n }\n },\n\n getConfig(): Readonly<ResolvedSelectorConfig> {\n return config;\n },\n\n updateConfig(next: ResolvedSelectorConfig): void {\n config = next;\n // Notify subscribers in insertion order. Errors thrown by individual\n // subscribers are isolated so one bad listener can't break the others —\n // the extension's listener is the canonical consumer here and we don't\n // want SDK-side changes to cascade-fail because of an extension bug.\n for (const cb of subscribers) {\n try {\n cb(next);\n } catch (e) {\n const message = e instanceof Error ? e.message : String(e);\n logger?.warn(`@amplitude/element-selector: onConfigChange subscriber threw — ${message}`);\n }\n }\n },\n\n onConfigChange(cb: (config: ResolvedSelectorConfig) => void): () => void {\n subscribers.add(cb);\n return () => {\n subscribers.delete(cb);\n };\n },\n };\n\n // Local wrapper so a thrown error in the legacy walker (extremely unlikely\n // — Element inputs only — but defensible if a host environment is missing\n // `CSS.escape` or `Node` constants) doesn't escape `generate` and crash the\n // caller. Returns the empty string in that pathological case; consumers\n // already coalesce empty results to a sentinel.\n function safeLegacyCssPath(el: Element): string {\n try {\n return legacyCssPath(el);\n } catch (e) {\n const message = e instanceof Error ? e.message : String(e);\n logger?.warn(`@amplitude/element-selector: legacyCssPath threw — emitting empty selector: ${message}`);\n return '';\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fallback CSS-path walker — the safety net for the v1 element-selector
|
|
3
|
+
* algorithm.
|
|
4
|
+
*
|
|
5
|
+
* When the orchestrator's strategy chain finds nothing usable across the full
|
|
6
|
+
* ancestor walk, the engine invokes this fallback. It produces a positional
|
|
7
|
+
* selector by walking up from the target to <html>, expressing each step as
|
|
8
|
+
* either an id anchor (when one survives the autogen filter) or a
|
|
9
|
+
* `tag:nth-of-type(n)` step.
|
|
10
|
+
*
|
|
11
|
+
* Key differences from the legacy autocapture `cssPath`:
|
|
12
|
+
*
|
|
13
|
+
* 1. Ids are filtered through `getStableId`, which honors the
|
|
14
|
+
* explicit-tracking-attribute suppression signal AND the autogenerated-id
|
|
15
|
+
* pattern pack. The legacy `cssPath` would happily anchor on `id=":r5:"`
|
|
16
|
+
* and produce selectors that never match across page loads.
|
|
17
|
+
*
|
|
18
|
+
* 2. Classes — when they're used at all for sibling disambiguation — are
|
|
19
|
+
* filtered through `filterClasses` against the unstable-class pattern
|
|
20
|
+
* pack. The current v1 implementation here doesn't emit classes (we lean
|
|
21
|
+
* entirely on `:nth-of-type` for sibling disambiguation), but the
|
|
22
|
+
* filtering helper is wired through so future iterations can opt back in
|
|
23
|
+
* surgically without re-deriving the policy.
|
|
24
|
+
*
|
|
25
|
+
* 3. A unique anchor id terminates the walk early — once we hit `body#main`,
|
|
26
|
+
* we don't need to keep walking up to `<html>`.
|
|
27
|
+
*
|
|
28
|
+
* 4. Ambiguous id anchors are skipped. Duplicate ids are invalid HTML but
|
|
29
|
+
* common enough in the wild that fallback must not emit selectors that
|
|
30
|
+
* resolve to the wrong target.
|
|
31
|
+
*
|
|
32
|
+
* Output format mirrors the orchestrator's output: `<anchor> > <descent>`.
|
|
33
|
+
* When no usable id is found anywhere on the walk, the fallback emits a
|
|
34
|
+
* pure-positional selector rooted at `html`.
|
|
35
|
+
*
|
|
36
|
+
* See the design doc:
|
|
37
|
+
* packages/plugin-autocapture-browser/element-selector-strategy-v1-no-classes.md
|
|
38
|
+
*/
|
|
39
|
+
import { ResolvedSelectorConfig } from './types';
|
|
40
|
+
export interface FallbackCssPathOptions {
|
|
41
|
+
/** Document or shadow root used for uniqueness checks. Defaults to the target's owner document. */
|
|
42
|
+
scope?: ParentNode;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Build a positional CSS selector for `el`, using stable ids as anchors when
|
|
46
|
+
* available and falling back to `tag:nth-of-type(n)` for disambiguation.
|
|
47
|
+
*
|
|
48
|
+
* Honors `config.maxAncestorWalkDepth` defensively — once the depth limit is
|
|
49
|
+
* reached, the walker stops and returns whatever it has built so far rooted at
|
|
50
|
+
* the deepest reached ancestor.
|
|
51
|
+
*/
|
|
52
|
+
export declare function fallbackCssPath(el: Element, config: ResolvedSelectorConfig, options?: FallbackCssPathOptions): string;
|
|
53
|
+
//# sourceMappingURL=fallback-css-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fallback-css-path.d.ts","sourceRoot":"","sources":["../../src/fallback-css-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAIjD,MAAM,WAAW,sBAAsB;IACrC,mGAAmG;IACnG,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,EAAE,EAAE,OAAO,EACX,MAAM,EAAE,sBAAsB,EAC9B,OAAO,GAAE,sBAA2B,GACnC,MAAM,CAgCR"}
|