@syntrologie/adapt-content 2.4.0-canary.13 → 2.4.0-canary.14
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/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useTriggerWhenStatus.test.d.ts +2 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useTriggerWhenStatus.test.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/{useShowWhenStatus.test.js → useTriggerWhenStatus.test.js} +75 -75
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts +4 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts.map +1 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.js +2 -2
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts +3 -3
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts.map +1 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.js +1 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts +1 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.js +1 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts +24 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts.map +1 -0
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/{useShowWhenStatus.js → useTriggerWhenStatus.js} +14 -14
- package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts +3 -3
- package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts.map +1 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/index.js +1 -1
- package/package.json +1 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useShowWhenStatus.test.d.ts +0 -2
- package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useShowWhenStatus.test.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useShowWhenStatus.d.ts +0 -24
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useShowWhenStatus.d.ts.map +0 -1
package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useTriggerWhenStatus.test.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTriggerWhenStatus.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/useTriggerWhenStatus.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { act, renderHook } from '@testing-library/react';
|
|
2
2
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
3
|
-
import {
|
|
3
|
+
import { useTriggerWhenStatus } from '../hooks/useTriggerWhenStatus';
|
|
4
4
|
function createMockRuntime(overrides = {}) {
|
|
5
5
|
return {
|
|
6
6
|
context: {
|
|
@@ -37,7 +37,7 @@ function setRuntime(runtime) {
|
|
|
37
37
|
// =============================================================================
|
|
38
38
|
// TESTS
|
|
39
39
|
// =============================================================================
|
|
40
|
-
describe('
|
|
40
|
+
describe('useTriggerWhenStatus', () => {
|
|
41
41
|
beforeEach(() => {
|
|
42
42
|
vi.useFakeTimers();
|
|
43
43
|
setRuntime(null);
|
|
@@ -51,24 +51,24 @@ describe('useShowWhenStatus', () => {
|
|
|
51
51
|
// ===========================================================================
|
|
52
52
|
it('returns empty map when no runtime is available', () => {
|
|
53
53
|
setRuntime(null);
|
|
54
|
-
const { result } = renderHook(() =>
|
|
54
|
+
const { result } = renderHook(() => useTriggerWhenStatus([]));
|
|
55
55
|
expect(result.current.size).toBe(0);
|
|
56
56
|
});
|
|
57
|
-
it('returns null status for items without
|
|
57
|
+
it('returns null status for items without triggerWhen', () => {
|
|
58
58
|
setRuntime(createMockRuntime());
|
|
59
59
|
const items = [{ id: 'item-1' }];
|
|
60
|
-
const { result } = renderHook(() =>
|
|
60
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
61
61
|
expect(result.current.get('item-1')).toBeNull();
|
|
62
62
|
});
|
|
63
|
-
it('returns fallback status for non-rules type
|
|
63
|
+
it('returns fallback status for non-rules type triggerWhen', () => {
|
|
64
64
|
setRuntime(createMockRuntime());
|
|
65
65
|
const items = [
|
|
66
66
|
{
|
|
67
67
|
id: 'item-1',
|
|
68
|
-
|
|
68
|
+
triggerWhen: { type: 'always', default: true },
|
|
69
69
|
},
|
|
70
70
|
];
|
|
71
|
-
const { result } = renderHook(() =>
|
|
71
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
72
72
|
const status = result.current.get('item-1');
|
|
73
73
|
expect(status?.visible).toBe(true);
|
|
74
74
|
expect(status?.isFallback).toBe(true);
|
|
@@ -79,10 +79,10 @@ describe('useShowWhenStatus', () => {
|
|
|
79
79
|
const items = [
|
|
80
80
|
{
|
|
81
81
|
id: 'item-1',
|
|
82
|
-
|
|
82
|
+
triggerWhen: { type: 'rules', rules: [], default: false },
|
|
83
83
|
},
|
|
84
84
|
];
|
|
85
|
-
const { result } = renderHook(() =>
|
|
85
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
86
86
|
const status = result.current.get('item-1');
|
|
87
87
|
expect(status?.visible).toBe(false);
|
|
88
88
|
expect(status?.isFallback).toBe(true);
|
|
@@ -101,7 +101,7 @@ describe('useShowWhenStatus', () => {
|
|
|
101
101
|
const items = [
|
|
102
102
|
{
|
|
103
103
|
id: 'item-1',
|
|
104
|
-
|
|
104
|
+
triggerWhen: {
|
|
105
105
|
type: 'rules',
|
|
106
106
|
rules: [
|
|
107
107
|
{
|
|
@@ -113,7 +113,7 @@ describe('useShowWhenStatus', () => {
|
|
|
113
113
|
},
|
|
114
114
|
},
|
|
115
115
|
];
|
|
116
|
-
const { result } = renderHook(() =>
|
|
116
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
117
117
|
const status = result.current.get('item-1');
|
|
118
118
|
expect(status?.visible).toBe(true);
|
|
119
119
|
expect(status?.isFallback).toBe(false);
|
|
@@ -129,7 +129,7 @@ describe('useShowWhenStatus', () => {
|
|
|
129
129
|
const items = [
|
|
130
130
|
{
|
|
131
131
|
id: 'item-1',
|
|
132
|
-
|
|
132
|
+
triggerWhen: {
|
|
133
133
|
type: 'rules',
|
|
134
134
|
rules: [
|
|
135
135
|
{
|
|
@@ -141,7 +141,7 @@ describe('useShowWhenStatus', () => {
|
|
|
141
141
|
},
|
|
142
142
|
},
|
|
143
143
|
];
|
|
144
|
-
const { result } = renderHook(() =>
|
|
144
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
145
145
|
const status = result.current.get('item-1');
|
|
146
146
|
expect(status?.visible).toBe(false);
|
|
147
147
|
expect(status?.isFallback).toBe(true);
|
|
@@ -165,7 +165,7 @@ describe('useShowWhenStatus', () => {
|
|
|
165
165
|
const items = [
|
|
166
166
|
{
|
|
167
167
|
id: 'item-1',
|
|
168
|
-
|
|
168
|
+
triggerWhen: {
|
|
169
169
|
type: 'rules',
|
|
170
170
|
rules: [
|
|
171
171
|
{
|
|
@@ -177,7 +177,7 @@ describe('useShowWhenStatus', () => {
|
|
|
177
177
|
},
|
|
178
178
|
},
|
|
179
179
|
];
|
|
180
|
-
const { result } = renderHook(() =>
|
|
180
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
181
181
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(expected);
|
|
182
182
|
});
|
|
183
183
|
it('skips event_count when accumulator is missing', () => {
|
|
@@ -187,7 +187,7 @@ describe('useShowWhenStatus', () => {
|
|
|
187
187
|
const items = [
|
|
188
188
|
{
|
|
189
189
|
id: 'item-1',
|
|
190
|
-
|
|
190
|
+
triggerWhen: {
|
|
191
191
|
type: 'rules',
|
|
192
192
|
rules: [
|
|
193
193
|
{
|
|
@@ -199,7 +199,7 @@ describe('useShowWhenStatus', () => {
|
|
|
199
199
|
},
|
|
200
200
|
},
|
|
201
201
|
];
|
|
202
|
-
const { result } = renderHook(() =>
|
|
202
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
203
203
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(false);
|
|
204
204
|
});
|
|
205
205
|
});
|
|
@@ -219,14 +219,14 @@ describe('useShowWhenStatus', () => {
|
|
|
219
219
|
const items = [
|
|
220
220
|
{
|
|
221
221
|
id: 'item-1',
|
|
222
|
-
|
|
222
|
+
triggerWhen: {
|
|
223
223
|
type: 'rules',
|
|
224
224
|
rules: [{ conditions: [{ type: 'page_url', url: '/products' }], value: true }],
|
|
225
225
|
default: false,
|
|
226
226
|
},
|
|
227
227
|
},
|
|
228
228
|
];
|
|
229
|
-
const { result } = renderHook(() =>
|
|
229
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
230
230
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(true);
|
|
231
231
|
});
|
|
232
232
|
it('passes for single-star wildcard URL match (single segment)', () => {
|
|
@@ -241,14 +241,14 @@ describe('useShowWhenStatus', () => {
|
|
|
241
241
|
const items = [
|
|
242
242
|
{
|
|
243
243
|
id: 'item-1',
|
|
244
|
-
|
|
244
|
+
triggerWhen: {
|
|
245
245
|
type: 'rules',
|
|
246
246
|
rules: [{ conditions: [{ type: 'page_url', url: '/products/*' }], value: true }],
|
|
247
247
|
default: false,
|
|
248
248
|
},
|
|
249
249
|
},
|
|
250
250
|
];
|
|
251
|
-
const { result } = renderHook(() =>
|
|
251
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
252
252
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(true);
|
|
253
253
|
});
|
|
254
254
|
it('single-star wildcard does not match multi-segment paths', () => {
|
|
@@ -263,14 +263,14 @@ describe('useShowWhenStatus', () => {
|
|
|
263
263
|
const items = [
|
|
264
264
|
{
|
|
265
265
|
id: 'item-1',
|
|
266
|
-
|
|
266
|
+
triggerWhen: {
|
|
267
267
|
type: 'rules',
|
|
268
268
|
rules: [{ conditions: [{ type: 'page_url', url: '/products/*' }], value: true }],
|
|
269
269
|
default: false,
|
|
270
270
|
},
|
|
271
271
|
},
|
|
272
272
|
];
|
|
273
|
-
const { result } = renderHook(() =>
|
|
273
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
274
274
|
// Single * only matches one path segment
|
|
275
275
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(false);
|
|
276
276
|
});
|
|
@@ -286,14 +286,14 @@ describe('useShowWhenStatus', () => {
|
|
|
286
286
|
const items = [
|
|
287
287
|
{
|
|
288
288
|
id: 'item-1',
|
|
289
|
-
|
|
289
|
+
triggerWhen: {
|
|
290
290
|
type: 'rules',
|
|
291
291
|
rules: [{ conditions: [{ type: 'page_url', url: '/products' }], value: true }],
|
|
292
292
|
default: false,
|
|
293
293
|
},
|
|
294
294
|
},
|
|
295
295
|
];
|
|
296
|
-
const { result } = renderHook(() =>
|
|
296
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
297
297
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(false);
|
|
298
298
|
});
|
|
299
299
|
});
|
|
@@ -313,14 +313,14 @@ describe('useShowWhenStatus', () => {
|
|
|
313
313
|
const items = [
|
|
314
314
|
{
|
|
315
315
|
id: 'item-1',
|
|
316
|
-
|
|
316
|
+
triggerWhen: {
|
|
317
317
|
type: 'rules',
|
|
318
318
|
rules: [{ conditions: [{ type: 'route', routeId: 'products' }], value: true }],
|
|
319
319
|
default: false,
|
|
320
320
|
},
|
|
321
321
|
},
|
|
322
322
|
];
|
|
323
|
-
const { result } = renderHook(() =>
|
|
323
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
324
324
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(true);
|
|
325
325
|
});
|
|
326
326
|
it('fails when routeId does not match', () => {
|
|
@@ -335,14 +335,14 @@ describe('useShowWhenStatus', () => {
|
|
|
335
335
|
const items = [
|
|
336
336
|
{
|
|
337
337
|
id: 'item-1',
|
|
338
|
-
|
|
338
|
+
triggerWhen: {
|
|
339
339
|
type: 'rules',
|
|
340
340
|
rules: [{ conditions: [{ type: 'route', routeId: 'home' }], value: true }],
|
|
341
341
|
default: false,
|
|
342
342
|
},
|
|
343
343
|
},
|
|
344
344
|
];
|
|
345
|
-
const { result } = renderHook(() =>
|
|
345
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
346
346
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(false);
|
|
347
347
|
});
|
|
348
348
|
});
|
|
@@ -363,7 +363,7 @@ describe('useShowWhenStatus', () => {
|
|
|
363
363
|
const items = [
|
|
364
364
|
{
|
|
365
365
|
id: 'item-1',
|
|
366
|
-
|
|
366
|
+
triggerWhen: {
|
|
367
367
|
type: 'rules',
|
|
368
368
|
rules: [
|
|
369
369
|
{
|
|
@@ -375,7 +375,7 @@ describe('useShowWhenStatus', () => {
|
|
|
375
375
|
},
|
|
376
376
|
},
|
|
377
377
|
];
|
|
378
|
-
const { result } = renderHook(() =>
|
|
378
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
379
379
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(true);
|
|
380
380
|
});
|
|
381
381
|
it('passes for present anchor', () => {
|
|
@@ -391,7 +391,7 @@ describe('useShowWhenStatus', () => {
|
|
|
391
391
|
const items = [
|
|
392
392
|
{
|
|
393
393
|
id: 'item-1',
|
|
394
|
-
|
|
394
|
+
triggerWhen: {
|
|
395
395
|
type: 'rules',
|
|
396
396
|
rules: [
|
|
397
397
|
{
|
|
@@ -403,7 +403,7 @@ describe('useShowWhenStatus', () => {
|
|
|
403
403
|
},
|
|
404
404
|
},
|
|
405
405
|
];
|
|
406
|
-
const { result } = renderHook(() =>
|
|
406
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
407
407
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(true);
|
|
408
408
|
});
|
|
409
409
|
it('passes for absent anchor', () => {
|
|
@@ -419,7 +419,7 @@ describe('useShowWhenStatus', () => {
|
|
|
419
419
|
const items = [
|
|
420
420
|
{
|
|
421
421
|
id: 'item-1',
|
|
422
|
-
|
|
422
|
+
triggerWhen: {
|
|
423
423
|
type: 'rules',
|
|
424
424
|
rules: [
|
|
425
425
|
{
|
|
@@ -433,7 +433,7 @@ describe('useShowWhenStatus', () => {
|
|
|
433
433
|
},
|
|
434
434
|
},
|
|
435
435
|
];
|
|
436
|
-
const { result } = renderHook(() =>
|
|
436
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
437
437
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(true);
|
|
438
438
|
});
|
|
439
439
|
});
|
|
@@ -448,7 +448,7 @@ describe('useShowWhenStatus', () => {
|
|
|
448
448
|
const items = [
|
|
449
449
|
{
|
|
450
450
|
id: 'item-1',
|
|
451
|
-
|
|
451
|
+
triggerWhen: {
|
|
452
452
|
type: 'rules',
|
|
453
453
|
rules: [
|
|
454
454
|
{
|
|
@@ -460,7 +460,7 @@ describe('useShowWhenStatus', () => {
|
|
|
460
460
|
},
|
|
461
461
|
},
|
|
462
462
|
];
|
|
463
|
-
const { result } = renderHook(() =>
|
|
463
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
464
464
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(true);
|
|
465
465
|
});
|
|
466
466
|
it('falls back to false when events service is missing', () => {
|
|
@@ -470,7 +470,7 @@ describe('useShowWhenStatus', () => {
|
|
|
470
470
|
const items = [
|
|
471
471
|
{
|
|
472
472
|
id: 'item-1',
|
|
473
|
-
|
|
473
|
+
triggerWhen: {
|
|
474
474
|
type: 'rules',
|
|
475
475
|
rules: [
|
|
476
476
|
{
|
|
@@ -482,7 +482,7 @@ describe('useShowWhenStatus', () => {
|
|
|
482
482
|
},
|
|
483
483
|
},
|
|
484
484
|
];
|
|
485
|
-
const { result } = renderHook(() =>
|
|
485
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
486
486
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(false);
|
|
487
487
|
});
|
|
488
488
|
});
|
|
@@ -502,7 +502,7 @@ describe('useShowWhenStatus', () => {
|
|
|
502
502
|
const items = [
|
|
503
503
|
{
|
|
504
504
|
id: 'item-1',
|
|
505
|
-
|
|
505
|
+
triggerWhen: {
|
|
506
506
|
type: 'rules',
|
|
507
507
|
rules: [
|
|
508
508
|
{
|
|
@@ -522,7 +522,7 @@ describe('useShowWhenStatus', () => {
|
|
|
522
522
|
},
|
|
523
523
|
},
|
|
524
524
|
];
|
|
525
|
-
const { result } = renderHook(() =>
|
|
525
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
526
526
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(true);
|
|
527
527
|
});
|
|
528
528
|
it('fails when width is below minWidth', () => {
|
|
@@ -537,14 +537,14 @@ describe('useShowWhenStatus', () => {
|
|
|
537
537
|
const items = [
|
|
538
538
|
{
|
|
539
539
|
id: 'item-1',
|
|
540
|
-
|
|
540
|
+
triggerWhen: {
|
|
541
541
|
type: 'rules',
|
|
542
542
|
rules: [{ conditions: [{ type: 'viewport', minWidth: 800 }], value: true }],
|
|
543
543
|
default: false,
|
|
544
544
|
},
|
|
545
545
|
},
|
|
546
546
|
];
|
|
547
|
-
const { result } = renderHook(() =>
|
|
547
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
548
548
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(false);
|
|
549
549
|
});
|
|
550
550
|
it('fails when width exceeds maxWidth', () => {
|
|
@@ -559,14 +559,14 @@ describe('useShowWhenStatus', () => {
|
|
|
559
559
|
const items = [
|
|
560
560
|
{
|
|
561
561
|
id: 'item-1',
|
|
562
|
-
|
|
562
|
+
triggerWhen: {
|
|
563
563
|
type: 'rules',
|
|
564
564
|
rules: [{ conditions: [{ type: 'viewport', maxWidth: 1200 }], value: true }],
|
|
565
565
|
default: false,
|
|
566
566
|
},
|
|
567
567
|
},
|
|
568
568
|
];
|
|
569
|
-
const { result } = renderHook(() =>
|
|
569
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
570
570
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(false);
|
|
571
571
|
});
|
|
572
572
|
it('fails when height is below minHeight', () => {
|
|
@@ -581,14 +581,14 @@ describe('useShowWhenStatus', () => {
|
|
|
581
581
|
const items = [
|
|
582
582
|
{
|
|
583
583
|
id: 'item-1',
|
|
584
|
-
|
|
584
|
+
triggerWhen: {
|
|
585
585
|
type: 'rules',
|
|
586
586
|
rules: [{ conditions: [{ type: 'viewport', minHeight: 600 }], value: true }],
|
|
587
587
|
default: false,
|
|
588
588
|
},
|
|
589
589
|
},
|
|
590
590
|
];
|
|
591
|
-
const { result } = renderHook(() =>
|
|
591
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
592
592
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(false);
|
|
593
593
|
});
|
|
594
594
|
it('fails when height exceeds maxHeight', () => {
|
|
@@ -603,14 +603,14 @@ describe('useShowWhenStatus', () => {
|
|
|
603
603
|
const items = [
|
|
604
604
|
{
|
|
605
605
|
id: 'item-1',
|
|
606
|
-
|
|
606
|
+
triggerWhen: {
|
|
607
607
|
type: 'rules',
|
|
608
608
|
rules: [{ conditions: [{ type: 'viewport', maxHeight: 900 }], value: true }],
|
|
609
609
|
default: false,
|
|
610
610
|
},
|
|
611
611
|
},
|
|
612
612
|
];
|
|
613
|
-
const { result } = renderHook(() =>
|
|
613
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
614
614
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(false);
|
|
615
615
|
});
|
|
616
616
|
});
|
|
@@ -637,7 +637,7 @@ describe('useShowWhenStatus', () => {
|
|
|
637
637
|
const items = [
|
|
638
638
|
{
|
|
639
639
|
id: 'item-1',
|
|
640
|
-
|
|
640
|
+
triggerWhen: {
|
|
641
641
|
type: 'rules',
|
|
642
642
|
rules: [
|
|
643
643
|
{
|
|
@@ -649,7 +649,7 @@ describe('useShowWhenStatus', () => {
|
|
|
649
649
|
},
|
|
650
650
|
},
|
|
651
651
|
];
|
|
652
|
-
const { result } = renderHook(() =>
|
|
652
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
653
653
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(expected);
|
|
654
654
|
});
|
|
655
655
|
});
|
|
@@ -669,7 +669,7 @@ describe('useShowWhenStatus', () => {
|
|
|
669
669
|
const items = [
|
|
670
670
|
{
|
|
671
671
|
id: 'item-1',
|
|
672
|
-
|
|
672
|
+
triggerWhen: {
|
|
673
673
|
type: 'rules',
|
|
674
674
|
rules: [
|
|
675
675
|
{
|
|
@@ -681,7 +681,7 @@ describe('useShowWhenStatus', () => {
|
|
|
681
681
|
},
|
|
682
682
|
},
|
|
683
683
|
];
|
|
684
|
-
const { result } = renderHook(() =>
|
|
684
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
685
685
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(true);
|
|
686
686
|
});
|
|
687
687
|
it('passes inverted dismissed (not dismissed)', () => {
|
|
@@ -696,7 +696,7 @@ describe('useShowWhenStatus', () => {
|
|
|
696
696
|
const items = [
|
|
697
697
|
{
|
|
698
698
|
id: 'item-1',
|
|
699
|
-
|
|
699
|
+
triggerWhen: {
|
|
700
700
|
type: 'rules',
|
|
701
701
|
rules: [
|
|
702
702
|
{
|
|
@@ -708,7 +708,7 @@ describe('useShowWhenStatus', () => {
|
|
|
708
708
|
},
|
|
709
709
|
},
|
|
710
710
|
];
|
|
711
|
-
const { result } = renderHook(() =>
|
|
711
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
712
712
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(true);
|
|
713
713
|
});
|
|
714
714
|
});
|
|
@@ -728,7 +728,7 @@ describe('useShowWhenStatus', () => {
|
|
|
728
728
|
const items = [
|
|
729
729
|
{
|
|
730
730
|
id: 'item-1',
|
|
731
|
-
|
|
731
|
+
triggerWhen: {
|
|
732
732
|
type: 'rules',
|
|
733
733
|
rules: [
|
|
734
734
|
{
|
|
@@ -740,7 +740,7 @@ describe('useShowWhenStatus', () => {
|
|
|
740
740
|
},
|
|
741
741
|
},
|
|
742
742
|
];
|
|
743
|
-
const { result } = renderHook(() =>
|
|
743
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
744
744
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(true);
|
|
745
745
|
});
|
|
746
746
|
it('passes inverted cooldown (cooldown not active)', () => {
|
|
@@ -755,7 +755,7 @@ describe('useShowWhenStatus', () => {
|
|
|
755
755
|
const items = [
|
|
756
756
|
{
|
|
757
757
|
id: 'item-1',
|
|
758
|
-
|
|
758
|
+
triggerWhen: {
|
|
759
759
|
type: 'rules',
|
|
760
760
|
rules: [
|
|
761
761
|
{
|
|
@@ -767,7 +767,7 @@ describe('useShowWhenStatus', () => {
|
|
|
767
767
|
},
|
|
768
768
|
},
|
|
769
769
|
];
|
|
770
|
-
const { result } = renderHook(() =>
|
|
770
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
771
771
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(true);
|
|
772
772
|
});
|
|
773
773
|
});
|
|
@@ -787,7 +787,7 @@ describe('useShowWhenStatus', () => {
|
|
|
787
787
|
const items = [
|
|
788
788
|
{
|
|
789
789
|
id: 'item-1',
|
|
790
|
-
|
|
790
|
+
triggerWhen: {
|
|
791
791
|
type: 'rules',
|
|
792
792
|
rules: [
|
|
793
793
|
{
|
|
@@ -799,7 +799,7 @@ describe('useShowWhenStatus', () => {
|
|
|
799
799
|
},
|
|
800
800
|
},
|
|
801
801
|
];
|
|
802
|
-
const { result } = renderHook(() =>
|
|
802
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
803
803
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(true);
|
|
804
804
|
});
|
|
805
805
|
it('passes inverted frequency limit (below limit)', () => {
|
|
@@ -814,7 +814,7 @@ describe('useShowWhenStatus', () => {
|
|
|
814
814
|
const items = [
|
|
815
815
|
{
|
|
816
816
|
id: 'item-1',
|
|
817
|
-
|
|
817
|
+
triggerWhen: {
|
|
818
818
|
type: 'rules',
|
|
819
819
|
rules: [
|
|
820
820
|
{
|
|
@@ -826,7 +826,7 @@ describe('useShowWhenStatus', () => {
|
|
|
826
826
|
},
|
|
827
827
|
},
|
|
828
828
|
];
|
|
829
|
-
const { result } = renderHook(() =>
|
|
829
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
830
830
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(true);
|
|
831
831
|
});
|
|
832
832
|
});
|
|
@@ -850,7 +850,7 @@ describe('useShowWhenStatus', () => {
|
|
|
850
850
|
const items = [
|
|
851
851
|
{
|
|
852
852
|
id: 'item-1',
|
|
853
|
-
|
|
853
|
+
triggerWhen: {
|
|
854
854
|
type: 'rules',
|
|
855
855
|
rules: [
|
|
856
856
|
{
|
|
@@ -865,7 +865,7 @@ describe('useShowWhenStatus', () => {
|
|
|
865
865
|
},
|
|
866
866
|
},
|
|
867
867
|
];
|
|
868
|
-
const { result } = renderHook(() =>
|
|
868
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
869
869
|
expect(result.current.get('item-1')?.visible).toBe(true);
|
|
870
870
|
});
|
|
871
871
|
it('falls through to next rule when first rule fails', () => {
|
|
@@ -880,7 +880,7 @@ describe('useShowWhenStatus', () => {
|
|
|
880
880
|
const items = [
|
|
881
881
|
{
|
|
882
882
|
id: 'item-1',
|
|
883
|
-
|
|
883
|
+
triggerWhen: {
|
|
884
884
|
type: 'rules',
|
|
885
885
|
rules: [
|
|
886
886
|
{
|
|
@@ -896,7 +896,7 @@ describe('useShowWhenStatus', () => {
|
|
|
896
896
|
},
|
|
897
897
|
},
|
|
898
898
|
];
|
|
899
|
-
const { result } = renderHook(() =>
|
|
899
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
900
900
|
expect(result.current.get('item-1')?.visible).toBe(true);
|
|
901
901
|
});
|
|
902
902
|
it('falls to default when no rules match', () => {
|
|
@@ -911,14 +911,14 @@ describe('useShowWhenStatus', () => {
|
|
|
911
911
|
const items = [
|
|
912
912
|
{
|
|
913
913
|
id: 'item-1',
|
|
914
|
-
|
|
914
|
+
triggerWhen: {
|
|
915
915
|
type: 'rules',
|
|
916
916
|
rules: [{ conditions: [{ type: 'page_url', url: '/products' }], value: true }],
|
|
917
917
|
default: true,
|
|
918
918
|
},
|
|
919
919
|
},
|
|
920
920
|
];
|
|
921
|
-
const { result } = renderHook(() =>
|
|
921
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
922
922
|
const status = result.current.get('item-1');
|
|
923
923
|
expect(status?.visible).toBe(true);
|
|
924
924
|
expect(status?.isFallback).toBe(true);
|
|
@@ -945,7 +945,7 @@ describe('useShowWhenStatus', () => {
|
|
|
945
945
|
const items = [
|
|
946
946
|
{
|
|
947
947
|
id: 'item-1',
|
|
948
|
-
|
|
948
|
+
triggerWhen: {
|
|
949
949
|
type: 'rules',
|
|
950
950
|
rules: [
|
|
951
951
|
{
|
|
@@ -957,7 +957,7 @@ describe('useShowWhenStatus', () => {
|
|
|
957
957
|
},
|
|
958
958
|
},
|
|
959
959
|
];
|
|
960
|
-
const { result } = renderHook(() =>
|
|
960
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
961
961
|
// Initially: count=0, should fail
|
|
962
962
|
expect(result.current.get('item-1')?.conditions[0].passed).toBe(false);
|
|
963
963
|
// Update count and trigger subscription
|
|
@@ -980,14 +980,14 @@ describe('useShowWhenStatus', () => {
|
|
|
980
980
|
const items = [
|
|
981
981
|
{
|
|
982
982
|
id: 'item-1',
|
|
983
|
-
|
|
983
|
+
triggerWhen: {
|
|
984
984
|
type: 'rules',
|
|
985
985
|
rules: [{ conditions: [{ type: 'page_url', url: '/products' }], value: true }],
|
|
986
986
|
default: false,
|
|
987
987
|
},
|
|
988
988
|
},
|
|
989
989
|
];
|
|
990
|
-
const { result } = renderHook(() =>
|
|
990
|
+
const { result } = renderHook(() => useTriggerWhenStatus(items));
|
|
991
991
|
// Initially: URL is /home, should fail
|
|
992
992
|
expect(result.current.get('item-1')?.visible).toBe(false);
|
|
993
993
|
// Change URL and advance timer
|
|
@@ -1007,7 +1007,7 @@ describe('useShowWhenStatus', () => {
|
|
|
1007
1007
|
},
|
|
1008
1008
|
},
|
|
1009
1009
|
}));
|
|
1010
|
-
const { unmount } = renderHook(() =>
|
|
1010
|
+
const { unmount } = renderHook(() => useTriggerWhenStatus([]));
|
|
1011
1011
|
unmount();
|
|
1012
1012
|
expect(unsubCalled).toBe(true);
|
|
1013
1013
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ConditionStatusLine — inline
|
|
2
|
+
* ConditionStatusLine — inline triggerWhen diagnostic on EditorCard.
|
|
3
3
|
*
|
|
4
|
-
* Shows a compact one-line status for items with
|
|
4
|
+
* Shows a compact one-line status for items with triggerWhen conditions.
|
|
5
5
|
* Click to expand per-condition detail.
|
|
6
6
|
*/
|
|
7
7
|
import type { FormattedCondition } from '../formatConditionLabel';
|
|
@@ -10,13 +10,13 @@ export interface ConditionStatus {
|
|
|
10
10
|
passed: boolean;
|
|
11
11
|
formatted: FormattedCondition;
|
|
12
12
|
}
|
|
13
|
-
export interface
|
|
13
|
+
export interface TriggerWhenStatus {
|
|
14
14
|
visible: boolean;
|
|
15
15
|
isFallback: boolean;
|
|
16
16
|
conditions: ConditionStatus[];
|
|
17
17
|
}
|
|
18
18
|
interface ConditionStatusLineProps {
|
|
19
|
-
status:
|
|
19
|
+
status: TriggerWhenStatus | null;
|
|
20
20
|
}
|
|
21
21
|
export declare function ConditionStatusLine({ status }: ConditionStatusLineProps): import("react/jsx-runtime").JSX.Element | null;
|
|
22
22
|
export {};
|
package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConditionStatusLine.d.ts","sourceRoot":"","sources":["../../src/components/ConditionStatusLine.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,kBAAkB,CAAC;CAC/B;AAED,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"ConditionStatusLine.d.ts","sourceRoot":"","sources":["../../src/components/ConditionStatusLine.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,kBAAkB,CAAC;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,eAAe,EAAE,CAAC;CAC/B;AAED,UAAU,wBAAwB;IAChC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAClC;AA6CD,wBAAgB,mBAAmB,CAAC,EAAE,MAAM,EAAE,EAAE,wBAAwB,kDAiEvE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
|
-
* ConditionStatusLine — inline
|
|
3
|
+
* ConditionStatusLine — inline triggerWhen diagnostic on EditorCard.
|
|
4
4
|
*
|
|
5
|
-
* Shows a compact one-line status for items with
|
|
5
|
+
* Shows a compact one-line status for items with triggerWhen conditions.
|
|
6
6
|
* Click to expand per-condition detail.
|
|
7
7
|
*/
|
|
8
8
|
import { Check, Clock, X } from 'lucide-react';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TriggerJourney — compact horizontal node graph for
|
|
2
|
+
* TriggerJourney — compact horizontal node graph for triggerWhen conditions.
|
|
3
3
|
*
|
|
4
4
|
* Displays each condition as a small circle node connected by lines.
|
|
5
5
|
* Nodes light up green as conditions are met.
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
7
|
+
import type { TriggerWhenStatus } from './ConditionStatusLine';
|
|
8
8
|
export interface TriggerJourneyProps {
|
|
9
|
-
status:
|
|
9
|
+
status: TriggerWhenStatus | null;
|
|
10
10
|
}
|
|
11
11
|
export declare function TriggerJourney({ status }: TriggerJourneyProps): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
//# sourceMappingURL=TriggerJourney.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TriggerJourney.d.ts","sourceRoot":"","sources":["../../src/components/TriggerJourney.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAmB,
|
|
1
|
+
{"version":3,"file":"TriggerJourney.d.ts","sourceRoot":"","sources":["../../src/components/TriggerJourney.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAmB,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAEhF,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAClC;AA4FD,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,EAAE,mBAAmB,2CA+B7D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
|
-
* TriggerJourney — compact horizontal node graph for
|
|
3
|
+
* TriggerJourney — compact horizontal node graph for triggerWhen conditions.
|
|
4
4
|
*
|
|
5
5
|
* Displays each condition as a small circle node connected by lines.
|
|
6
6
|
* Nodes light up green as conditions are met.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TriggerWhenStatus } from '../components/ConditionStatusLine';
|
|
2
|
+
/**
|
|
3
|
+
* Minimal type for a triggerWhen action item.
|
|
4
|
+
* Works with both FAQQuestionAction and NavTipAction.
|
|
5
|
+
*/
|
|
6
|
+
export interface TriggerWhenItem {
|
|
7
|
+
id: string;
|
|
8
|
+
triggerWhen?: {
|
|
9
|
+
type: string;
|
|
10
|
+
rules?: Array<{
|
|
11
|
+
conditions: Array<Record<string, unknown>>;
|
|
12
|
+
value: unknown;
|
|
13
|
+
}>;
|
|
14
|
+
default?: unknown;
|
|
15
|
+
} | null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Hook: live triggerWhen evaluation for a list of action items.
|
|
19
|
+
*
|
|
20
|
+
* @param items Array of items with id + optional triggerWhen
|
|
21
|
+
* @returns Map from item id → TriggerWhenStatus (null for items without triggerWhen)
|
|
22
|
+
*/
|
|
23
|
+
export declare function useTriggerWhenStatus(items: TriggerWhenItem[]): Map<string, TriggerWhenStatus | null>;
|
|
24
|
+
//# sourceMappingURL=useTriggerWhenStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTriggerWhenStatus.d.ts","sourceRoot":"","sources":["../../src/hooks/useTriggerWhenStatus.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAmB,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAG5F;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,KAAK,CAAC;YACZ,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;YAC3C,KAAK,EAAE,OAAO,CAAC;SAChB,CAAC,CAAC;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,GAAG,IAAI,CAAC;CACV;AAuND;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,eAAe,EAAE,GACvB,GAAG,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC,CA0CvC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* useTriggerWhenStatus — live triggerWhen evaluation for editor diagnostics.
|
|
3
3
|
*
|
|
4
4
|
* Subscribes to the runtime's EventAccumulator for reactive updates.
|
|
5
|
-
* Evaluates each item's
|
|
5
|
+
* Evaluates each item's triggerWhen strategy locally to get
|
|
6
6
|
* per-condition breakdowns.
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This hook accesses `window.SynOS.handle.runtime` directly
|
|
@@ -143,15 +143,15 @@ function evaluateConditionLocally(condition, runtime) {
|
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
146
|
-
* Evaluate all conditions in a
|
|
146
|
+
* Evaluate all conditions in a triggerWhen RuleStrategy.
|
|
147
147
|
*/
|
|
148
|
-
function
|
|
149
|
-
if (
|
|
150
|
-
return { visible: !!
|
|
148
|
+
function evaluateTriggerWhen(triggerWhen, runtime) {
|
|
149
|
+
if (triggerWhen.type !== 'rules' || !triggerWhen.rules?.length) {
|
|
150
|
+
return { visible: !!triggerWhen.default, isFallback: true, conditions: [] };
|
|
151
151
|
}
|
|
152
152
|
// Evaluate ALL rules' conditions for diagnostic display
|
|
153
153
|
const allConditions = [];
|
|
154
|
-
for (const rule of
|
|
154
|
+
for (const rule of triggerWhen.rules) {
|
|
155
155
|
let ruleMatched = true;
|
|
156
156
|
for (const condition of rule.conditions) {
|
|
157
157
|
const { passed, cs } = evaluateConditionLocally(condition, runtime);
|
|
@@ -165,18 +165,18 @@ function evaluateShowWhen(showWhen, runtime) {
|
|
|
165
165
|
}
|
|
166
166
|
// No rules matched — use default
|
|
167
167
|
return {
|
|
168
|
-
visible:
|
|
168
|
+
visible: triggerWhen.default ?? false,
|
|
169
169
|
isFallback: true,
|
|
170
170
|
conditions: allConditions,
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
173
|
/**
|
|
174
|
-
* Hook: live
|
|
174
|
+
* Hook: live triggerWhen evaluation for a list of action items.
|
|
175
175
|
*
|
|
176
|
-
* @param items Array of items with id + optional
|
|
177
|
-
* @returns Map from item id →
|
|
176
|
+
* @param items Array of items with id + optional triggerWhen
|
|
177
|
+
* @returns Map from item id → TriggerWhenStatus (null for items without triggerWhen)
|
|
178
178
|
*/
|
|
179
|
-
export function
|
|
179
|
+
export function useTriggerWhenStatus(items) {
|
|
180
180
|
const [statuses, setStatuses] = useState(new Map());
|
|
181
181
|
const itemsRef = useRef(items);
|
|
182
182
|
itemsRef.current = items;
|
|
@@ -186,11 +186,11 @@ export function useShowWhenStatus(items) {
|
|
|
186
186
|
return;
|
|
187
187
|
const map = new Map();
|
|
188
188
|
for (const item of itemsRef.current) {
|
|
189
|
-
if (!item.
|
|
189
|
+
if (!item.triggerWhen) {
|
|
190
190
|
map.set(item.id, null);
|
|
191
191
|
}
|
|
192
192
|
else {
|
|
193
|
-
map.set(item.id,
|
|
193
|
+
map.set(item.id, evaluateTriggerWhen(item.triggerWhen, runtime));
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
setStatuses(map);
|
|
@@ -2,7 +2,7 @@ export { cn } from './cn';
|
|
|
2
2
|
export type { AnchorPickerProps, PickedElement } from './components/AnchorPicker';
|
|
3
3
|
export { AnchorPicker } from './components/AnchorPicker';
|
|
4
4
|
export { BeforeAfterToggle } from './components/BeforeAfterToggle';
|
|
5
|
-
export type { ConditionStatus,
|
|
5
|
+
export type { ConditionStatus, TriggerWhenStatus } from './components/ConditionStatusLine';
|
|
6
6
|
export { ConditionStatusLine } from './components/ConditionStatusLine';
|
|
7
7
|
export { DetectionBadge } from './components/DetectionBadge';
|
|
8
8
|
export { DismissedSection } from './components/DismissedSection';
|
|
@@ -26,8 +26,8 @@ export { TriggerJourney } from './components/TriggerJourney';
|
|
|
26
26
|
export type { ConditionProgress, FormattedCondition } from './formatConditionLabel';
|
|
27
27
|
export { formatConditionLabel } from './formatConditionLabel';
|
|
28
28
|
export { useElementRect } from './hooks/useElementRect';
|
|
29
|
-
export type {
|
|
30
|
-
export {
|
|
29
|
+
export type { TriggerWhenItem } from './hooks/useTriggerWhenStatus';
|
|
30
|
+
export { useTriggerWhenStatus } from './hooks/useTriggerWhenStatus';
|
|
31
31
|
export type { SelectorOptions } from './utils/selectorGenerator';
|
|
32
32
|
export { generateSelector, getElementDescription, validateSelector, } from './utils/selectorGenerator';
|
|
33
33
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,YAAY,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC"}
|
|
@@ -20,5 +20,5 @@ export { GroupHeader } from './components/GroupHeader';
|
|
|
20
20
|
export { TriggerJourney } from './components/TriggerJourney';
|
|
21
21
|
export { formatConditionLabel } from './formatConditionLabel';
|
|
22
22
|
export { useElementRect } from './hooks/useElementRect';
|
|
23
|
-
export {
|
|
23
|
+
export { useTriggerWhenStatus } from './hooks/useTriggerWhenStatus';
|
|
24
24
|
export { generateSelector, getElementDescription, validateSelector, } from './utils/selectorGenerator';
|
package/package.json
CHANGED
package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useShowWhenStatus.test.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useShowWhenStatus.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/useShowWhenStatus.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { ShowWhenStatus } from '../components/ConditionStatusLine';
|
|
2
|
-
/**
|
|
3
|
-
* Minimal type for a showWhen action item.
|
|
4
|
-
* Works with both FAQQuestionAction and NavTipAction.
|
|
5
|
-
*/
|
|
6
|
-
export interface ShowWhenItem {
|
|
7
|
-
id: string;
|
|
8
|
-
showWhen?: {
|
|
9
|
-
type: string;
|
|
10
|
-
rules?: Array<{
|
|
11
|
-
conditions: Array<Record<string, unknown>>;
|
|
12
|
-
value: unknown;
|
|
13
|
-
}>;
|
|
14
|
-
default?: unknown;
|
|
15
|
-
} | null;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Hook: live showWhen evaluation for a list of action items.
|
|
19
|
-
*
|
|
20
|
-
* @param items Array of items with id + optional showWhen
|
|
21
|
-
* @returns Map from item id → ShowWhenStatus (null for items without showWhen)
|
|
22
|
-
*/
|
|
23
|
-
export declare function useShowWhenStatus(items: ShowWhenItem[]): Map<string, ShowWhenStatus | null>;
|
|
24
|
-
//# sourceMappingURL=useShowWhenStatus.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useShowWhenStatus.d.ts","sourceRoot":"","sources":["../../src/hooks/useShowWhenStatus.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAGzF;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,KAAK,CAAC;YACZ,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;YAC3C,KAAK,EAAE,OAAO,CAAC;SAChB,CAAC,CAAC;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,GAAG,IAAI,CAAC;CACV;AAuND;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC,CA0C3F"}
|