fix: migrate segment subscribers + typescript support (#5904)

Fixes #6068.

**What**

- Uses new Subscriber API.
- Adds support for typescript files in Segment plugin.
- Adds a peerDependency on @medusajs/medusa for the version that introduced new Subscriber API.
This commit is contained in:
Sebastian Rindom
2024-01-18 09:38:33 +00:00
committed by GitHub
parent 130c641e5c
commit 5cfb662ec0
19 changed files with 536 additions and 531 deletions
@@ -78,10 +78,10 @@ class SegmentService extends BaseService {
order_id: order.id,
email: order.email,
region_id: order.region_id,
payment_provider: order.payments.map((p) => p.provider_id).join(","),
payment_provider: order.payments?.map((p) => p.provider_id).join(","),
shipping_methods: order.shipping_methods,
shipping_country: order.shipping_address.country_code,
shipping_city: order.shipping_address.city,
shipping_country: order.shipping_address?.country_code,
shipping_city: order.shipping_address?.city,
reporting_total: await this.getReportingValue(order.currency_code, total),
reporting_subtotal: await this.getReportingValue(
order.currency_code,