diff --git a/src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml b/src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml index 5d97da5a9e..241373575a 100644 --- a/src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml +++ b/src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml @@ -67,9 +67,9 @@ steps: "event_id": $.getOneByPaths(., ^.destination.Config.deduplicationKey) ?? .messageId, "app_id": ^.destination.Config.appId, "advertiser_id": ^.destination.Config.advertiserId, - "partner_name": .properties.partnerName, - "device_carrier": .context.network.carrier, - "wifi": .context.network.wifi + "partner_name": .properties.partnerName ? String(.properties.partnerName), + "device_carrier": .properties.partnerName ? String(.context.network.carrier), + "wifi": .context.network.wifi ? Boolean(.context.network.wifi) }); $.outputs.apiVersion === {{$.API_VERSION.v5}} ? commonFields = commonFields{~["advertiser_id"]}; $.removeUndefinedValues(commonFields) @@ -107,7 +107,7 @@ steps: "client_user_agent": .context.userAgent, "external_id": {{{{$.getGenericPaths("userId")}}}}, "click_id": .properties.clickId, - "partner_id": .traits.partnerId ?? .context.traits.partnerId + "partner_id": .traits.partnerId ?? .context.traits.partnerId ? String(.traits.partnerId ?? .context.traits.partnerId) }); !.destination.Config.sendExternalId ? userFields = userFields{~["external_id"]} : null; userFields = $.removeUndefinedAndNullAndEmptyValues(userFields); @@ -127,17 +127,15 @@ steps: template: | const customFields = .message.().({ "currency": .properties.currency, - "value": .properties.value !== undefined ? String(.properties.value) : - .properties.total !== undefined ? String(.properties.total) : - .properties.revenue !== undefined ? String(.properties.revenue) : undefined, + "value": (.properties.value ?? .properties.total ?? .properties.revenue) ? String(.properties.value ?? .properties.total ?? .properties.revenue), "num_items": .properties.numOfItems && Number(.properties.numOfItems), "order_id": .properties.order_id, "search_string": .properties.query, "opt_out_type": .properties.optOutType, - "content_name": .properties.contentName, - "content_category": .properties.contentCategory, - "content_brand": .properties.contentBrand, - "np": .properties.np + "content_name": .properties.contentName ? String(.properties.contentName), + "content_category": .properties.contentCategory ? String(.properties.contentCategory), + "content_brand": .properties.contentBrand ? String(.properties.contentBrand), + "np": .properties.np ? String(.properties.np) }); $.removeUndefinedValues(customFields) @@ -148,14 +146,14 @@ steps: let products = .message.properties.products; { "num_items": $.sum(products.quantity.(Number(.))[]) || 0, - "content_ids": products.(.product_id ?? .sku ?? .id)[], + "content_ids": products.(String(.product_id ?? .sku ?? .id))[], "contents": .message.properties@prop.products.({ "quantity": Number(.quantity ?? prop.quantity ?? 1), "item_price": String(.price ?? prop.price), "item_name": String(.name), - "id": .product_id ?? .sku, - "item_category": .category, - "item_brand": .brand + "id": .product_id ?? .sku ? String(.product_id ?? .sku), + "item_category": .category ? String(.category), + "item_brand": .brand ? String(.brand) })[] } else: @@ -164,14 +162,14 @@ steps: const props = .message.properties; const output = { "num_items": Number(props.quantity) || 0, - "content_ids": (props.product_id ?? props.sku ?? props.id)[], + "content_ids": (props.product_id ?? props.sku ?? props.id) ? String(props.product_id ?? props.sku ?? props.id)[], "contents": { "quantity": Number(props.quantity) || 1, "item_price": String(props.price), "item_name": String(props.name), - "id": props.product_id ?? props.sku, - "item_category": props.category, - "item_brand": props.brand + "id": props.product_id ?? props.sku ? String(props.product_id ?? props.sku), + "item_category": props.category ? String(props.category), + "item_brand": props.brand ? String(props.brand) }[] }; - name: combineAllEcomFields diff --git a/test/integrations/destinations/pinterest_tag/processor/data.ts b/test/integrations/destinations/pinterest_tag/processor/data.ts index 1788d13d56..a772f295f6 100644 --- a/test/integrations/destinations/pinterest_tag/processor/data.ts +++ b/test/integrations/destinations/pinterest_tag/processor/data.ts @@ -32,7 +32,7 @@ export const data = [ library: { name: 'rudder-sdk-ruby-sync', version: '1.0.6' }, network: { carrier: 'VI', - wifi: true, + wifi: 'true', }, }, messageId: '7208bbb6-2c4e-45bb-bf5b-ad426f3593e9', @@ -62,7 +62,7 @@ export const data = [ category: 'Games', quantity: 1, image_url: 'https:///www.example.com/product/path.jpg', - product_id: '507f1f77bcf86cd799439011', + product_id: 1234, }, { sku: '46493-32', @@ -122,11 +122,11 @@ export const data = [ app_id: '429047995', custom_data: { content_brand: 'LV', - content_ids: ['507f1f77bcf86cd799439011', '505bd76785ebb509fc183733'], + content_ids: ['1234', '505bd76785ebb509fc183733'], content_name: 'testContent', contents: [ { - id: '507f1f77bcf86cd799439011', + id: '1234', item_category: 'Games', item_name: 'Monopoly: 3rd Edition', item_price: '19',