From 6a83acc7d7fa80a2dd01cbcc3102e93645690b7d Mon Sep 17 00:00:00 2001 From: Kevin Date: Fri, 22 May 2026 18:03:31 +0200 Subject: [PATCH] feat(types): complete PurchaselyEventProperties with missing public event fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The native iOS (PLYEventProperty.swift) and Android (PLYEventProperties.kt) SDKs emit several event-context properties that were missing from the TypeScript type, forcing consumers to cast `event.properties` to access them. Adds all non-internal fields currently serialized by the native SDKs: presentation context (is_fallback_presentation, presentation_type, audience_id, ab_test_id / ab_test_variant_id, content_id), campaign / flow context (campaign_id, flow_id, step_id, flow_version, flow_session_id, from_action_id, from_step_id, display_mode), display / rendering metrics (display_method, method_to_display, orientation, paywall_request_duration_in_ms, paywall_display_time_in_ms, paywall_rendering_time_in_ms), offers (promo_offer, eligible_to_intro_offer[_sk2], eligible_to_promo_offer[_sk2]), plan details (billing_plan_type, commitment, commitment_progress, storekit_version), select-options (selected_option_id, selected_options, displayed_options), session / installation (session_id, session_duration, session_count, app_installed_at[_ms], screen_duration, screen_displayed_at[_ms]), SDK lifecycle (is_sdk_started, sdk_start_error, sdk_start_duration_in_ms), web checkout (web_checkout_provider, web_checkout_url, client_reference_id, stripe_checkout_session_id, stripe_purchase_id), error_code, and the original event timestamps (event_created_at_ms_original, event_created_at_original). All added fields are optional (?:) since each property only appears on the event types that emit it, matching the convention of placement_id (#240) and the other existing fields. Internal fields (`internal_*`) are intentionally excluded — they are marked `internal` in the Kotlin model and are not part of the public event payload. No runtime behavior change. Co-Authored-By: Claude Opus 4.7 (1M context) --- packages/purchasely/src/types.ts | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/packages/purchasely/src/types.ts b/packages/purchasely/src/types.ts index 2736532..9aa1e5d 100644 --- a/packages/purchasely/src/types.ts +++ b/packages/purchasely/src/types.ts @@ -223,6 +223,57 @@ export type PurchaselyEventProperties = { selected_product?: string; plan_change_type?: string; running_subscriptions?: PurchaselyEventPropertySubscription[]; + event_created_at_ms_original?: number; + event_created_at_original?: string; + is_fallback_presentation?: boolean; + presentation_type?: string; + audience_id?: string; + ab_test_id?: string; + ab_test_variant_id?: string; + content_id?: string; + campaign_id?: string; + flow_id?: string; + step_id?: string; + flow_version?: string; + flow_session_id?: string; + from_action_id?: string; + from_step_id?: string; + display_mode?: string; + display_method?: string; + method_to_display?: string; + orientation?: string; + paywall_request_duration_in_ms?: number; + paywall_display_time_in_ms?: number; + paywall_rendering_time_in_ms?: number; + promo_offer?: string; + eligible_to_intro_offer?: boolean; + eligible_to_intro_offer_sk2?: boolean; + eligible_to_promo_offer?: boolean; + eligible_to_promo_offer_sk2?: boolean; + billing_plan_type?: string; + commitment?: string; + commitment_progress?: string; + storekit_version?: string; + selected_option_id?: string; + selected_options?: string[]; + displayed_options?: string[]; + session_id?: string; + session_duration?: number; + session_count?: number; + app_installed_at?: string; + app_installed_at_ms?: number; + screen_duration?: number; + screen_displayed_at?: string; + screen_displayed_at_ms?: number; + is_sdk_started?: boolean; + sdk_start_error?: string; + sdk_start_duration_in_ms?: number; + error_code?: string; + web_checkout_provider?: string; + web_checkout_url?: string; + client_reference_id?: string; + stripe_checkout_session_id?: string; + stripe_purchase_id?: string; }; export type PLYPresentationPlan = {