Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TypeError in payload.products mapping #7

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
const { payload: initialPayload, name } = event
const { ecommerce: payload } = initialPayload

const data: any = {

Check warning on line 12 in src/index.ts

View workflow job for this annotation

GitHub Actions / build-test (18.x)

Unexpected any. Specify a different type
ec: 'ecommerce',
gc: payload.currency,
gv: payload.revenue || payload.total || payload.value,
Expand All @@ -28,7 +28,7 @@
payload.product_id ||
payload.sku ||
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
Expand All @@ -50,9 +50,9 @@
payload.checkout_id ||
payload.product_id ||
payload.name ||
Array.isArray(payload.products)
(Array.isArray(payload.products)
? payload.products.map((p: any) => p.name).join()

Check warning on line 54 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.revenue || payload.total || payload.value || payload.price
}
Expand Down
Loading