Skip to content

Commit 922fe37

Browse files
DataLoop
1 parent b5270fe commit 922fe37

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

website/docs/destinations/event_mapping.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
DataMap,
1313
DataSet,
1414
DataComplete,
15+
DataLoop,
1516
} from '@site/src/components/templates/mappings/eventConfig';
1617
import Link from '@docusaurus/Link';
1718

@@ -124,6 +125,8 @@ to a `WalkerOS.Property`.
124125
Loops over the first parameter and maps the second to the current value. It is
125126
used for creating an array of dynamic length.
126127

128+
<DataLoop />
129+
127130
### condition
128131

129132
Is a function to check if the mapping should be used. It returns a boolean, if

website/src/components/templates/mappings/eventConfig.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Mapping } from '@elbwalker/types';
12
import { getEvent } from '@elbwalker/utils';
23
import { DestinationPush } from '../destination';
34

@@ -9,23 +10,25 @@ export const destination = {
910
},
1011
};
1112

12-
const string = 'data.total';
13+
const string: Mapping.Data = 'data.total';
1314

14-
const key = {
15+
const key: Mapping.Data = {
1516
key: 'data.id',
1617
};
1718

18-
const map = {
19+
const map: Mapping.Data = {
1920
map: {
2021
pageGroup: 'globals.pagegroup',
2122
shoppingStage: 'context.shopping.0',
2223
},
2324
};
2425

25-
const set = {
26+
const set: Mapping.Data = {
2627
set: ['trigger', 'entity', 'action'],
2728
};
2829

30+
const loop: Mapping.Data = { loop: ['nested', 'data.name'] };
31+
2932
export const DataString: React.FC = () => {
3033
return (
3134
<DestinationPush event={{ data: event.data }} mapping={{ data: string }} />
@@ -60,6 +63,15 @@ export const DataSet: React.FC = () => {
6063
);
6164
};
6265

66+
export const DataLoop: React.FC = () => {
67+
return (
68+
<DestinationPush
69+
event={{ nested: event.nested }}
70+
mapping={{ data: loop }}
71+
/>
72+
);
73+
};
74+
6375
export const DataComplete: React.FC = () => {
6476
return (
6577
<DestinationPush

0 commit comments

Comments
 (0)