Skip to content

Commit

Permalink
Merge pull request #8 from managed-components/pr-added
Browse files Browse the repository at this point in the history
make sure products is an array before .map()
  • Loading branch information
jonnyparris authored Jun 18, 2024
2 parents 36905c0 + 9427245 commit 6e0f512
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ const getECParams = (event: MCEvent) => {
payload.name ||
payload.product_id ||
payload.sku ||
Array.isArray(payload.products)
(Array.isArray(payload.products)
? payload.products.map((p: any) => p.name).join()

Check warning on line 31 in src/index.ts

View workflow job for this annotation

GitHub Actions / build-test (18.x)

Unexpected any. Specify a different type
: ''
: '')

data.ev = payload.price || payload.total || payload.value
data.gv = payload.price || data.gv
break
Expand Down

0 comments on commit 6e0f512

Please sign in to comment.