Skip to content

Commit

Permalink
function string
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderkirtzel committed Dec 12, 2024
1 parent e6920ac commit 82517ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions website/docs/destinations/google-ga4.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ live&nbsp;<Link to="#configuration">configuration</Link>.

<DestinationPush
event={getEvent('order complete', { custom: {} })}
mapping={{
mapping={`{
name: 'purchase',
data: {
map: {
Expand All @@ -209,6 +209,7 @@ live&nbsp;<Link to="#configuration">configuration</Link>.
loop: [
'nested',
{
condition: (entity) => entity.type === 'product',
map: {
item_id: 'data.id',
item_name: 'data.name',
Expand All @@ -219,7 +220,7 @@ live&nbsp;<Link to="#configuration">configuration</Link>.
},
},
},
}}
}`}
/>

:::info
Expand Down
6 changes: 3 additions & 3 deletions website/src/components/preview/eventMapping.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const EventMapping: React.FC<EventMappingProps> = ({
[fnName],
);

const parseJavaScriptObject = useCallback((code: string): unknown => {
const parseInput = useCallback((code: string): unknown => {
return Function('"use strict"; return (' + code + ')')();
}, []);

Expand All @@ -66,8 +66,8 @@ const EventMapping: React.FC<EventMappingProps> = ({
setRight([]);

try {
const parsedLeft = parseJavaScriptObject(leftStr);
const parsedMiddle = parseJavaScriptObject(middleStr) as never;
const parsedLeft = parseInput(leftStr);
const parsedMiddle = parseInput(middleStr) as never;

fn(parsedLeft, parsedMiddle, log, options);
} catch (e) {
Expand Down

0 comments on commit 82517ee

Please sign in to comment.