@snap/camera-kit 0.22.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1122 -537
- package/README.md +1 -1
- package/dist/CameraKit.d.ts +3 -3
- package/dist/CameraKit.d.ts.map +1 -1
- package/dist/CameraKit.js +1 -2
- package/dist/CameraKit.js.map +1 -1
- package/dist/RootServices.d.ts +78 -0
- package/dist/RootServices.d.ts.map +1 -0
- package/dist/RootServices.js.map +1 -0
- package/dist/bootstrapCameraKit.d.ts +3 -4
- package/dist/bootstrapCameraKit.d.ts.map +1 -1
- package/dist/bootstrapCameraKit.js +8 -8
- package/dist/bootstrapCameraKit.js.map +1 -1
- package/dist/clients/createTsProtoClient.d.ts +2 -2
- package/dist/clients/createTsProtoClient.d.ts.map +1 -1
- package/dist/clients/createTsProtoClient.js.map +1 -1
- package/dist/clients/grpcHandler.d.ts.map +1 -1
- package/dist/clients/grpcHandler.js +1 -1
- package/dist/clients/grpcHandler.js.map +1 -1
- package/dist/clients/lensesClient.js +1 -1
- package/dist/clients/lensesClient.js.map +1 -1
- package/dist/clients/metricsClient.d.ts.map +1 -1
- package/dist/clients/metricsClient.js +1 -1
- package/dist/clients/metricsClient.js.map +1 -1
- package/dist/common/pageVisibility.js +1 -1
- package/dist/common/pageVisibility.js.map +1 -1
- package/dist/configuration.d.ts.map +1 -1
- package/dist/configuration.js +1 -1
- package/dist/configuration.js.map +1 -1
- package/dist/environment.d.ts.map +1 -1
- package/dist/environment.js +1 -1
- package/dist/environment.js.map +1 -1
- package/dist/extensions/RemoteApiServices.js +1 -1
- package/dist/extensions/RemoteApiServices.js.map +1 -1
- package/dist/extensions/UriHandlers.js +1 -1
- package/dist/extensions/UriHandlers.js.map +1 -1
- package/dist/extensions/uriHandlersRegister.d.ts.map +1 -1
- package/dist/extensions/uriHandlersRegister.js +1 -1
- package/dist/extensions/uriHandlersRegister.js.map +1 -1
- package/dist/generated-proto/blizzard/cameraKitEvents.d.ts +45 -9270
- package/dist/generated-proto/blizzard/cameraKitEvents.d.ts.map +1 -1
- package/dist/generated-proto/blizzard/cameraKitEvents.js +300 -123
- package/dist/generated-proto/blizzard/cameraKitEvents.js.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/business_events.d.ts +12 -32
- package/dist/generated-proto/pb_schema/camera_kit/v3/business_events.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/business_events.js +77 -37
- package/dist/generated-proto/pb_schema/camera_kit/v3/business_events.js.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/export.d.ts +19 -454
- package/dist/generated-proto/pb_schema/camera_kit/v3/export.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/export.js +219 -118
- package/dist/generated-proto/pb_schema/camera_kit/v3/export.js.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/features/ranking_info.d.ts +12 -12
- package/dist/generated-proto/pb_schema/camera_kit/v3/features/ranking_info.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/features/ranking_info.js +16 -13
- package/dist/generated-proto/pb_schema/camera_kit/v3/features/ranking_info.js.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/features/remote_api_info.d.ts +12 -12
- package/dist/generated-proto/pb_schema/camera_kit/v3/features/remote_api_info.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/features/remote_api_info.js +16 -13
- package/dist/generated-proto/pb_schema/camera_kit/v3/features/remote_api_info.js.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/legal_prompt.d.ts +13 -54
- package/dist/generated-proto/pb_schema/camera_kit/v3/legal_prompt.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/legal_prompt.js +61 -34
- package/dist/generated-proto/pb_schema/camera_kit/v3/legal_prompt.js.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/lens.d.ts +19 -299
- package/dist/generated-proto/pb_schema/camera_kit/v3/lens.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/lens.js +294 -133
- package/dist/generated-proto/pb_schema/camera_kit/v3/lens.js.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/operational_metrics.d.ts +14 -148
- package/dist/generated-proto/pb_schema/camera_kit/v3/operational_metrics.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/operational_metrics.js +74 -48
- package/dist/generated-proto/pb_schema/camera_kit/v3/operational_metrics.js.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/ranking.d.ts +12 -18
- package/dist/generated-proto/pb_schema/camera_kit/v3/ranking.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/ranking.js +34 -19
- package/dist/generated-proto/pb_schema/camera_kit/v3/ranking.js.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/remote_api_spec.d.ts +19 -516
- package/dist/generated-proto/pb_schema/camera_kit/v3/remote_api_spec.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/remote_api_spec.js +164 -80
- package/dist/generated-proto/pb_schema/camera_kit/v3/remote_api_spec.js.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/service.d.ts +80 -2371
- package/dist/generated-proto/pb_schema/camera_kit/v3/service.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/camera_kit/v3/service.js +847 -174
- package/dist/generated-proto/pb_schema/camera_kit/v3/service.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/app_launch_type.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/app_launch_type.js +0 -6
- package/dist/generated-proto/pb_schema/cdp/cof/app_launch_type.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/benchmark.d.ts +18 -59
- package/dist/generated-proto/pb_schema/cdp/cof/benchmark.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/benchmark.js +88 -52
- package/dist/generated-proto/pb_schema/cdp/cof/benchmark.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/benchmark_name.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/benchmark_name.js +0 -6
- package/dist/generated-proto/pb_schema/cdp/cof/benchmark_name.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/billboard_provided_signals.d.ts +12 -106
- package/dist/generated-proto/pb_schema/cdp/cof/billboard_provided_signals.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/billboard_provided_signals.js +328 -140
- package/dist/generated-proto/pb_schema/cdp/cof/billboard_provided_signals.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/bolt_provided_signals.d.ts +12 -18
- package/dist/generated-proto/pb_schema/cdp/cof/bolt_provided_signals.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/bolt_provided_signals.js +35 -20
- package/dist/generated-proto/pb_schema/cdp/cof/bolt_provided_signals.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/camera_provided_signals.d.ts +12 -34
- package/dist/generated-proto/pb_schema/cdp/cof/camera_provided_signals.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/camera_provided_signals.js +86 -39
- package/dist/generated-proto/pb_schema/cdp/cof/camera_provided_signals.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/circumstance_service.d.ts +47 -28591
- package/dist/generated-proto/pb_schema/cdp/cof/circumstance_service.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/circumstance_service.js +644 -348
- package/dist/generated-proto/pb_schema/cdp/cof/circumstance_service.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/cognac_provided_signals.d.ts +12 -12
- package/dist/generated-proto/pb_schema/cdp/cof/cognac_provided_signals.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/cognac_provided_signals.js +16 -13
- package/dist/generated-proto/pb_schema/cdp/cof/cognac_provided_signals.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/config_request.d.ts +18 -214
- package/dist/generated-proto/pb_schema/cdp/cof/config_request.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/config_request.js +362 -157
- package/dist/generated-proto/pb_schema/cdp/cof/config_request.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/config_response.d.ts +20 -3801
- package/dist/generated-proto/pb_schema/cdp/cof/config_response.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/config_response.js +144 -46
- package/dist/generated-proto/pb_schema/cdp/cof/config_response.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/config_result.d.ts +49 -10060
- package/dist/generated-proto/pb_schema/cdp/cof/config_result.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/config_result.js +443 -182
- package/dist/generated-proto/pb_schema/cdp/cof/config_result.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/contact_authorization_status.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/contact_authorization_status.js +0 -6
- package/dist/generated-proto/pb_schema/cdp/cof/contact_authorization_status.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/content_manager_provided_signals.d.ts +12 -12
- package/dist/generated-proto/pb_schema/cdp/cof/content_manager_provided_signals.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/content_manager_provided_signals.js +16 -13
- package/dist/generated-proto/pb_schema/cdp/cof/content_manager_provided_signals.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/creative_tools_provided_signals.d.ts +12 -14
- package/dist/generated-proto/pb_schema/cdp/cof/creative_tools_provided_signals.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/creative_tools_provided_signals.js +24 -17
- package/dist/generated-proto/pb_schema/cdp/cof/creative_tools_provided_signals.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/debug_info.d.ts +14 -56
- package/dist/generated-proto/pb_schema/cdp/cof/debug_info.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/debug_info.js +78 -45
- package/dist/generated-proto/pb_schema/cdp/cof/debug_info.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/discover_feed_provided_signals.d.ts +28 -0
- package/dist/generated-proto/pb_schema/cdp/cof/discover_feed_provided_signals.d.ts.map +1 -0
- package/dist/generated-proto/pb_schema/cdp/cof/discover_feed_provided_signals.js +89 -0
- package/dist/generated-proto/pb_schema/cdp/cof/discover_feed_provided_signals.js.map +1 -0
- package/dist/generated-proto/pb_schema/cdp/cof/feature_provided_signals.d.ts +28 -1103
- package/dist/generated-proto/pb_schema/cdp/cof/feature_provided_signals.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/feature_provided_signals.js +358 -210
- package/dist/generated-proto/pb_schema/cdp/cof/feature_provided_signals.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/lenses_provided_signals.d.ts +12 -16
- package/dist/generated-proto/pb_schema/cdp/cof/lenses_provided_signals.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/lenses_provided_signals.js +31 -23
- package/dist/generated-proto/pb_schema/cdp/cof/lenses_provided_signals.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/mdp_media_attribution.d.ts +13 -15
- package/dist/generated-proto/pb_schema/cdp/cof/mdp_media_attribution.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/mdp_media_attribution.js +22 -15
- package/dist/generated-proto/pb_schema/cdp/cof/mdp_media_attribution.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/media_provided_signals.d.ts +12 -14
- package/dist/generated-proto/pb_schema/cdp/cof/media_provided_signals.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/media_provided_signals.js +22 -15
- package/dist/generated-proto/pb_schema/cdp/cof/media_provided_signals.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/namespace.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/namespace.js +0 -6
- package/dist/generated-proto/pb_schema/cdp/cof/namespace.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/opera_provided_signals.d.ts +12 -16
- package/dist/generated-proto/pb_schema/cdp/cof/opera_provided_signals.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/opera_provided_signals.js +29 -18
- package/dist/generated-proto/pb_schema/cdp/cof/opera_provided_signals.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/perception_provided_signals.d.ts +12 -12
- package/dist/generated-proto/pb_schema/cdp/cof/perception_provided_signals.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/perception_provided_signals.js +16 -13
- package/dist/generated-proto/pb_schema/cdp/cof/perception_provided_signals.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/recipients_provided_signals.d.ts +12 -12
- package/dist/generated-proto/pb_schema/cdp/cof/recipients_provided_signals.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/recipients_provided_signals.js +16 -13
- package/dist/generated-proto/pb_schema/cdp/cof/recipients_provided_signals.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/routing_provided_signals.d.ts +12 -12
- package/dist/generated-proto/pb_schema/cdp/cof/routing_provided_signals.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/routing_provided_signals.js +16 -13
- package/dist/generated-proto/pb_schema/cdp/cof/routing_provided_signals.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/snap_kit_provided_signals.d.ts +12 -12
- package/dist/generated-proto/pb_schema/cdp/cof/snap_kit_provided_signals.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/snap_kit_provided_signals.js +16 -13
- package/dist/generated-proto/pb_schema/cdp/cof/snap_kit_provided_signals.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/upload_provided_signals.d.ts +12 -18
- package/dist/generated-proto/pb_schema/cdp/cof/upload_provided_signals.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/cof/upload_provided_signals.js +35 -20
- package/dist/generated-proto/pb_schema/cdp/cof/upload_provided_signals.js.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/media/snap_source.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/cdp/media/snap_source.js +0 -6
- package/dist/generated-proto/pb_schema/cdp/media/snap_source.js.map +1 -1
- package/dist/generated-proto/pb_schema/common/ruid.d.ts +12 -16
- package/dist/generated-proto/pb_schema/common/ruid.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/common/ruid.js +28 -17
- package/dist/generated-proto/pb_schema/common/ruid.js.map +1 -1
- package/dist/generated-proto/pb_schema/common/value.d.ts +25 -123
- package/dist/generated-proto/pb_schema/common/value.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/common/value.js +136 -71
- package/dist/generated-proto/pb_schema/common/value.js.map +1 -1
- package/dist/generated-proto/pb_schema/content/asset.d.ts +12 -14
- package/dist/generated-proto/pb_schema/content/asset.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/content/asset.js +22 -15
- package/dist/generated-proto/pb_schema/content/asset.js.map +1 -1
- package/dist/generated-proto/pb_schema/content/media_reference.d.ts +13 -46
- package/dist/generated-proto/pb_schema/content/media_reference.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/content/media_reference.js +86 -47
- package/dist/generated-proto/pb_schema/content/media_reference.js.map +1 -1
- package/dist/generated-proto/pb_schema/content/media_source.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/content/media_source.js +0 -6
- package/dist/generated-proto/pb_schema/content/media_source.js.map +1 -1
- package/dist/generated-proto/pb_schema/content/media_types.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/content/media_types.js +0 -6
- package/dist/generated-proto/pb_schema/content/media_types.js.map +1 -1
- package/dist/generated-proto/pb_schema/google/api/annotations.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/google/api/annotations.js +0 -6
- package/dist/generated-proto/pb_schema/google/api/annotations.js.map +1 -1
- package/dist/generated-proto/pb_schema/google/api/http.d.ts +15 -3336
- package/dist/generated-proto/pb_schema/google/api/http.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/google/api/http.js +129 -68
- package/dist/generated-proto/pb_schema/google/api/http.js.map +1 -1
- package/dist/generated-proto/pb_schema/google/protobuf/any.d.ts +12 -14
- package/dist/generated-proto/pb_schema/google/protobuf/any.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/google/protobuf/any.js +24 -17
- package/dist/generated-proto/pb_schema/google/protobuf/any.js.map +1 -1
- package/dist/generated-proto/pb_schema/google/protobuf/descriptor.d.ts +126 -50157
- package/dist/generated-proto/pb_schema/google/protobuf/descriptor.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/google/protobuf/descriptor.js +1162 -563
- package/dist/generated-proto/pb_schema/google/protobuf/descriptor.js.map +1 -1
- package/dist/generated-proto/pb_schema/google/protobuf/timestamp.d.ts +12 -14
- package/dist/generated-proto/pb_schema/google/protobuf/timestamp.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/google/protobuf/timestamp.js +23 -19
- package/dist/generated-proto/pb_schema/google/protobuf/timestamp.js.map +1 -1
- package/dist/generated-proto/pb_schema/google/protobuf/wrappers.d.ts +20 -84
- package/dist/generated-proto/pb_schema/google/protobuf/wrappers.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/google/protobuf/wrappers.js +141 -77
- package/dist/generated-proto/pb_schema/google/protobuf/wrappers.js.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/geocircle.d.ts +12 -23
- package/dist/generated-proto/pb_schema/lenses/geocircle.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/geocircle.js +26 -18
- package/dist/generated-proto/pb_schema/lenses/geocircle.js.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/geopoint.d.ts +12 -14
- package/dist/generated-proto/pb_schema/lenses/geopoint.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/geopoint.js +22 -15
- package/dist/generated-proto/pb_schema/lenses/geopoint.js.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/launch_params.d.ts +12 -12
- package/dist/generated-proto/pb_schema/lenses/launch_params.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/launch_params.js +18 -15
- package/dist/generated-proto/pb_schema/lenses/launch_params.js.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/launchdata.d.ts +15 -324
- package/dist/generated-proto/pb_schema/lenses/launchdata.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/launchdata.js +112 -66
- package/dist/generated-proto/pb_schema/lenses/launchdata.js.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/lures.d.ts +12 -91
- package/dist/generated-proto/pb_schema/lenses/lures.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/lures.js +37 -28
- package/dist/generated-proto/pb_schema/lenses/lures.js.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/persistent_store.d.ts +12 -12
- package/dist/generated-proto/pb_schema/lenses/persistent_store.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/persistent_store.js +18 -15
- package/dist/generated-proto/pb_schema/lenses/persistent_store.js.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/remote_api/remote_api_service.d.ts +30 -396
- package/dist/generated-proto/pb_schema/lenses/remote_api/remote_api_service.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/remote_api/remote_api_service.js +520 -240
- package/dist/generated-proto/pb_schema/lenses/remote_api/remote_api_service.js.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/remote_api/remote_api_spec.d.ts +30 -2429
- package/dist/generated-proto/pb_schema/lenses/remote_api/remote_api_spec.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/remote_api/remote_api_spec.js +991 -440
- package/dist/generated-proto/pb_schema/lenses/remote_api/remote_api_spec.js.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/snappable.d.ts +27 -783
- package/dist/generated-proto/pb_schema/lenses/snappable.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/snappable.js +502 -245
- package/dist/generated-proto/pb_schema/lenses/snappable.js.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/user_data.d.ts +15 -174
- package/dist/generated-proto/pb_schema/lenses/user_data.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/lenses/user_data.js +144 -77
- package/dist/generated-proto/pb_schema/lenses/user_data.js.map +1 -1
- package/dist/generated-proto/pb_schema/snapdoc/capture_characteristics.d.ts +12 -14
- package/dist/generated-proto/pb_schema/snapdoc/capture_characteristics.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/snapdoc/capture_characteristics.js +24 -17
- package/dist/generated-proto/pb_schema/snapdoc/capture_characteristics.js.map +1 -1
- package/dist/generated-proto/pb_schema/snapdoc/extensions.d.ts +14 -18
- package/dist/generated-proto/pb_schema/snapdoc/extensions.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/snapdoc/extensions.js +29 -18
- package/dist/generated-proto/pb_schema/snapdoc/extensions.js.map +1 -1
- package/dist/generated-proto/pb_schema/snapdoc/media.d.ts +52 -576
- package/dist/generated-proto/pb_schema/snapdoc/media.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/snapdoc/media.js +615 -318
- package/dist/generated-proto/pb_schema/snapdoc/media.js.map +1 -1
- package/dist/generated-proto/pb_schema/snapdoc/media_codec_formats.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/snapdoc/media_codec_formats.js +0 -6
- package/dist/generated-proto/pb_schema/snapdoc/media_codec_formats.js.map +1 -1
- package/dist/generated-proto/pb_schema/snapdoc/media_file_formats.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/snapdoc/media_file_formats.js +0 -6
- package/dist/generated-proto/pb_schema/snapdoc/media_file_formats.js.map +1 -1
- package/dist/generated-proto/pb_schema/snapdoc/media_id.d.ts +12 -12
- package/dist/generated-proto/pb_schema/snapdoc/media_id.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/snapdoc/media_id.js +17 -17
- package/dist/generated-proto/pb_schema/snapdoc/media_id.js.map +1 -1
- package/dist/generated-proto/pb_schema/snapdoc/snap_component_type.d.ts.map +1 -1
- package/dist/generated-proto/pb_schema/snapdoc/snap_component_type.js +0 -6
- package/dist/generated-proto/pb_schema/snapdoc/snap_component_type.js.map +1 -1
- package/dist/handlers/cameraKitServiceFetchHandlerFactory.d.ts.map +1 -1
- package/dist/handlers/cameraKitServiceFetchHandlerFactory.js +1 -1
- package/dist/handlers/cameraKitServiceFetchHandlerFactory.js.map +1 -1
- package/dist/handlers/defaultFetchHandler.js +1 -1
- package/dist/handlers/defaultFetchHandler.js.map +1 -1
- package/dist/handlers/requestStateEmittingHandler.js +1 -1
- package/dist/handlers/requestStateEmittingHandler.js.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/legal/legalPrompt.js +1 -1
- package/dist/legal/legalPrompt.js.map +1 -1
- package/dist/legal/legalState.js +1 -1
- package/dist/legal/legalState.js.map +1 -1
- package/dist/lens/LensPersistenceStore.js +1 -1
- package/dist/lens/LensPersistenceStore.js.map +1 -1
- package/dist/lens/LensRepository.js +1 -1
- package/dist/lens/LensRepository.js.map +1 -1
- package/dist/lens/LensSource.js +1 -1
- package/dist/lens/LensSource.js.map +1 -1
- package/dist/lens/assets/LensAssetRepository.js +1 -1
- package/dist/lens/assets/LensAssetRepository.js.map +1 -1
- package/dist/lens/assets/LensAssetsProvider.js +1 -1
- package/dist/lens/assets/LensAssetsProvider.js.map +1 -1
- package/dist/lens/assets/deviceDependentAssetLoader.js +1 -1
- package/dist/lens/assets/deviceDependentAssetLoader.js.map +1 -1
- package/dist/lens/assets/remoteMediaAssetLoaderFactory.js +1 -1
- package/dist/lens/assets/remoteMediaAssetLoaderFactory.js.map +1 -1
- package/dist/lens/assets/staticAssetLoader.js +1 -1
- package/dist/lens/assets/staticAssetLoader.js.map +1 -1
- package/dist/lens/cameraKitLensSource.d.ts.map +1 -1
- package/dist/lens/cameraKitLensSource.js +6 -6
- package/dist/lens/cameraKitLensSource.js.map +1 -1
- package/dist/lens/fetchWatermarkLens.d.ts.map +1 -1
- package/dist/lens/fetchWatermarkLens.js +1 -1
- package/dist/lens/fetchWatermarkLens.js.map +1 -1
- package/dist/lens/userDataAccessResolver.d.ts +52 -0
- package/dist/lens/userDataAccessResolver.d.ts.map +1 -0
- package/dist/lens/userDataAccessResolver.js +3 -0
- package/dist/lens/userDataAccessResolver.js.map +1 -0
- package/dist/lens-client-interface/filePicker.d.ts.map +1 -1
- package/dist/lens-client-interface/filePicker.js +1 -1
- package/dist/lens-client-interface/filePicker.js.map +1 -1
- package/dist/lens-client-interface/lensClientInterface.js +1 -1
- package/dist/lens-client-interface/lensClientInterface.js.map +1 -1
- package/dist/lens-core-module/loader/bootstrapURLs.d.ts +2 -0
- package/dist/lens-core-module/loader/bootstrapURLs.d.ts.map +1 -1
- package/dist/lens-core-module/loader/bootstrapURLs.js +22 -11
- package/dist/lens-core-module/loader/bootstrapURLs.js.map +1 -1
- package/dist/lens-core-module/loader/lensCoreFactory.d.ts.map +1 -1
- package/dist/lens-core-module/loader/lensCoreFactory.js +1 -1
- package/dist/lens-core-module/loader/lensCoreFactory.js.map +1 -1
- package/dist/lensCoreWasmVersions.js +3 -3
- package/dist/lensCoreWasmVersions.js.map +1 -1
- package/dist/logger/logEntries.js +1 -1
- package/dist/logger/logEntries.js.map +1 -1
- package/dist/logger/registerLogEntriesSubscriber.d.ts.map +1 -1
- package/dist/logger/registerLogEntriesSubscriber.js +1 -1
- package/dist/logger/registerLogEntriesSubscriber.js.map +1 -1
- package/dist/media-sources/CameraKitSource.d.ts +6 -0
- package/dist/media-sources/CameraKitSource.d.ts.map +1 -1
- package/dist/media-sources/CameraKitSource.js +2 -2
- package/dist/media-sources/CameraKitSource.js.map +1 -1
- package/dist/metrics/businessEventsReporter.js +1 -1
- package/dist/metrics/businessEventsReporter.js.map +1 -1
- package/dist/metrics/metricsEventTarget.js +1 -1
- package/dist/metrics/metricsEventTarget.js.map +1 -1
- package/dist/metrics/reporters/reportBenchmarks.d.ts.map +1 -1
- package/dist/metrics/reporters/reportBenchmarks.js +1 -1
- package/dist/metrics/reporters/reportBenchmarks.js.map +1 -1
- package/dist/metrics/reporters/reportGlobalException.js +1 -1
- package/dist/metrics/reporters/reportGlobalException.js.map +1 -1
- package/dist/metrics/reporters/reportHttpMetrics.js +1 -1
- package/dist/metrics/reporters/reportHttpMetrics.js.map +1 -1
- package/dist/metrics/reporters/reportLegalState.js +1 -1
- package/dist/metrics/reporters/reportLegalState.js.map +1 -1
- package/dist/metrics/reporters/reportLensAndAssetDownload.d.ts.map +1 -1
- package/dist/metrics/reporters/reportLensAndAssetDownload.js +1 -1
- package/dist/metrics/reporters/reportLensAndAssetDownload.js.map +1 -1
- package/dist/metrics/reporters/reportLensValidationFailed.js +1 -1
- package/dist/metrics/reporters/reportLensValidationFailed.js.map +1 -1
- package/dist/metrics/reporters/reportLensView.js +1 -1
- package/dist/metrics/reporters/reportLensView.js.map +1 -1
- package/dist/metrics/reporters/reportLensWait.js +1 -1
- package/dist/metrics/reporters/reportLensWait.js.map +1 -1
- package/dist/metrics/reporters/reportPlatformCapabilities.d.ts.map +1 -1
- package/dist/metrics/reporters/reportPlatformCapabilities.js +1 -1
- package/dist/metrics/reporters/reportPlatformCapabilities.js.map +1 -1
- package/dist/metrics/reporters/reportSessionException.js +1 -1
- package/dist/metrics/reporters/reportSessionException.js.map +1 -1
- package/dist/metrics/reporters/reportUserSession.js +1 -1
- package/dist/metrics/reporters/reportUserSession.js.map +1 -1
- package/dist/metrics/reporters/reporters.d.ts +1 -1
- package/dist/metrics/reporters/reporters.d.ts.map +1 -1
- package/dist/metrics/reporters/reporters.js +1 -1
- package/dist/metrics/reporters/reporters.js.map +1 -1
- package/dist/platform/platformCapabilities.d.ts +6 -16
- package/dist/platform/platformCapabilities.d.ts.map +1 -1
- package/dist/platform/platformCapabilities.js +15 -15
- package/dist/platform/platformCapabilities.js.map +1 -1
- package/dist/remote-configuration/cofHandler.d.ts.map +1 -1
- package/dist/remote-configuration/cofHandler.js +1 -1
- package/dist/remote-configuration/cofHandler.js.map +1 -1
- package/dist/remote-configuration/preloadConfiguration.js +1 -1
- package/dist/remote-configuration/preloadConfiguration.js.map +1 -1
- package/dist/remote-configuration/remoteConfiguration.d.ts.map +1 -1
- package/dist/remote-configuration/remoteConfiguration.js +1 -1
- package/dist/remote-configuration/remoteConfiguration.js.map +1 -1
- package/dist/session/CameraKitSession.d.ts +6 -1
- package/dist/session/CameraKitSession.d.ts.map +1 -1
- package/dist/session/CameraKitSession.js +1 -1
- package/dist/session/CameraKitSession.js.map +1 -1
- package/dist/session/LensKeyboard.js +1 -1
- package/dist/session/LensKeyboard.js.map +1 -1
- package/dist/session/lensState.d.ts +3 -2
- package/dist/session/lensState.d.ts.map +1 -1
- package/dist/session/lensState.js +21 -6
- package/dist/session/lensState.js.map +1 -1
- package/dist/session/sessionState.js +1 -1
- package/dist/session/sessionState.js.map +1 -1
- package/docs/html/assets/navigation.js +1 -1
- package/docs/html/assets/search.js +1 -1
- package/docs/html/classes/CameraKit.html +2 -2
- package/docs/html/classes/CameraKitSession.html +7 -3
- package/docs/html/classes/CameraKitSource.html +6 -2
- package/docs/html/classes/LensPerformanceMeasurement.html +2 -2
- package/docs/html/classes/LensPerformanceMetrics.html +2 -2
- package/docs/html/classes/LensRepository.html +2 -2
- package/docs/html/classes/Transform2D.html +2 -2
- package/docs/html/classes/TypedCustomEvent.html +2 -2
- package/docs/html/classes/TypedEventTarget.html +2 -2
- package/docs/html/enums/Lens_CameraFacing.html +2 -2
- package/docs/html/functions/bootstrapCameraKit.html +2 -2
- package/docs/html/functions/createExtension.html +2 -2
- package/docs/html/functions/createImageSource.html +2 -2
- package/docs/html/functions/createMediaStreamSource.html +2 -2
- package/docs/html/functions/createVideoSource.html +2 -2
- package/docs/html/functions/estimateLensPerformance.html +2 -2
- package/docs/html/functions/filePickerFactory.html +2 -4
- package/docs/html/functions/lensSourcesFactory.html +3 -5
- package/docs/html/functions/remoteApiServicesFactory.html +1 -3
- package/docs/html/hierarchy.html +1 -1
- package/docs/html/index.html +3 -3
- package/docs/html/interfaces/BitmojiUserInfo.html +2 -2
- package/docs/html/interfaces/CameraKitBootstrapConfiguration.html +2 -2
- package/docs/html/interfaces/CameraKitDeviceOptions.html +2 -2
- package/docs/html/interfaces/CameraKitSourceInfo.html +2 -2
- package/docs/html/interfaces/CameraKitSourceSubscriber.html +2 -2
- package/docs/html/interfaces/ComputedFrameMetrics.html +2 -2
- package/docs/html/interfaces/CreateSessionOptions.html +2 -2
- package/docs/html/interfaces/EstimatedLensPerformance.html +2 -2
- package/docs/html/interfaces/FriendUserInfo.html +2 -2
- package/docs/html/interfaces/FunctionSourceOptions.html +2 -2
- package/docs/html/interfaces/Lens.html +2 -2
- package/docs/html/interfaces/LensCreator.html +2 -2
- package/docs/html/interfaces/LensLaunchData.html +2 -2
- package/docs/html/interfaces/LensSource.html +2 -2
- package/docs/html/interfaces/LensUserData.html +2 -2
- package/docs/html/interfaces/LoadAssetRequest.html +2 -2
- package/docs/html/interfaces/MediaStreamSourceOptions.html +2 -2
- package/docs/html/interfaces/Preview.html +2 -2
- package/docs/html/interfaces/RemoteApiRequest.html +2 -2
- package/docs/html/interfaces/RemoteApiResponse.html +2 -2
- package/docs/html/interfaces/RemoteApiService.html +2 -2
- package/docs/html/interfaces/Snapcode.html +2 -2
- package/docs/html/interfaces/UriCancelRequest.html +2 -2
- package/docs/html/interfaces/UriRequest.html +2 -2
- package/docs/html/interfaces/UriResponse.html +2 -2
- package/docs/html/interfaces/VideoSourceOptions.html +2 -2
- package/docs/html/modules.html +2 -4
- package/docs/html/types/ArgumentValidationError.html +2 -2
- package/docs/html/types/AssetLoader.html +2 -2
- package/docs/html/types/AssetResponse.html +1 -1
- package/docs/html/types/AssetTiming.html +2 -2
- package/docs/html/types/BenchmarkError.html +1 -1
- package/docs/html/types/BootstrapError.html +2 -2
- package/docs/html/types/CacheKeyNotFoundError.html +1 -1
- package/docs/html/types/CameraKitSessionEventListener.html +2 -2
- package/docs/html/types/CameraKitSessionEvents.html +2 -2
- package/docs/html/types/CameraKitSourceError.html +1 -1
- package/docs/html/types/ConfigurationError.html +2 -2
- package/docs/html/types/FetchHandler.html +1 -1
- package/docs/html/types/FilePicker.html +2 -2
- package/docs/html/types/FilePickerOptions.html +2 -2
- package/docs/html/types/FilePickerResult.html +2 -2
- package/docs/html/types/Keyboard.html +2 -2
- package/docs/html/types/KeyboardEvents.html +2 -2
- package/docs/html/types/LegalError.html +1 -1
- package/docs/html/types/LensAbortError.html +2 -2
- package/docs/html/types/LensAssetError.html +2 -2
- package/docs/html/types/LensContentValidationError.html +1 -1
- package/docs/html/types/LensError.html +1 -1
- package/docs/html/types/LensExecutionError.html +2 -2
- package/docs/html/types/LensImagePickerError.html +2 -2
- package/docs/html/types/LensLaunchParams.html +2 -2
- package/docs/html/types/LensMetricsEvents.html +2 -2
- package/docs/html/types/LensPerformanceCluster.html +1 -1
- package/docs/html/types/LensView.html +2 -2
- package/docs/html/types/LensWait.html +2 -2
- package/docs/html/types/Matrix.html +2 -2
- package/docs/html/types/PersistentStoreError.html +2 -2
- package/docs/html/types/PlatformNotSupportedError.html +2 -2
- package/docs/html/types/PublicContainer.html +2 -2
- package/docs/html/types/PublicServices.html +2 -2
- package/docs/html/types/RemoteApiCancelRequestHandler.html +2 -2
- package/docs/html/types/RemoteApiRequestHandler.html +2 -2
- package/docs/html/types/RemoteApiServices.html +1 -1
- package/docs/html/types/RemoteApiStatus.html +2 -2
- package/docs/html/types/RenderTarget.html +2 -2
- package/docs/html/types/Uri.html +1 -1
- package/docs/html/types/WebGLError.html +1 -1
- package/docs/html/types/Zodiac.html +1 -1
- package/docs/html/variables/extensionRequestContext.html +2 -2
- package/docs/md/README.md +1 -1
- package/docs/md/classes/CameraKit.md +1 -1
- package/docs/md/classes/CameraKitSession.md +7 -2
- package/docs/md/classes/CameraKitSource.md +6 -1
- package/docs/md/classes/LensPerformanceMeasurement.md +1 -1
- package/docs/md/classes/LensPerformanceMetrics.md +1 -1
- package/docs/md/classes/LensRepository.md +1 -1
- package/docs/md/classes/Transform2D.md +1 -1
- package/docs/md/classes/TypedCustomEvent.md +1 -1
- package/docs/md/classes/TypedEventTarget.md +1 -1
- package/docs/md/enums/Lens_CameraFacing.md +1 -1
- package/docs/md/interfaces/BitmojiUserInfo.md +1 -1
- package/docs/md/interfaces/CameraKitBootstrapConfiguration.md +1 -1
- package/docs/md/interfaces/CameraKitDeviceOptions.md +1 -1
- package/docs/md/interfaces/CameraKitSourceInfo.md +1 -1
- package/docs/md/interfaces/CameraKitSourceSubscriber.md +1 -1
- package/docs/md/interfaces/ComputedFrameMetrics.md +1 -1
- package/docs/md/interfaces/CreateSessionOptions.md +1 -1
- package/docs/md/interfaces/EstimatedLensPerformance.md +1 -1
- package/docs/md/interfaces/FriendUserInfo.md +1 -1
- package/docs/md/interfaces/FunctionSourceOptions.md +1 -1
- package/docs/md/interfaces/Lens.md +1 -1
- package/docs/md/interfaces/LensCreator.md +1 -1
- package/docs/md/interfaces/LensLaunchData.md +1 -1
- package/docs/md/interfaces/LensSource.md +1 -1
- package/docs/md/interfaces/LensUserData.md +1 -1
- package/docs/md/interfaces/LoadAssetRequest.md +1 -1
- package/docs/md/interfaces/MediaStreamSourceOptions.md +1 -1
- package/docs/md/interfaces/Preview.md +1 -1
- package/docs/md/interfaces/RemoteApiRequest.md +1 -1
- package/docs/md/interfaces/RemoteApiResponse.md +1 -1
- package/docs/md/interfaces/RemoteApiService.md +1 -1
- package/docs/md/interfaces/Snapcode.md +1 -1
- package/docs/md/interfaces/UriCancelRequest.md +1 -1
- package/docs/md/interfaces/UriRequest.md +1 -1
- package/docs/md/interfaces/UriResponse.md +1 -1
- package/docs/md/interfaces/VideoSourceOptions.md +1 -1
- package/docs/md/modules.md +5 -166
- package/package.json +6 -6
- package/dist/dependency-injection/Container.d.ts +0 -177
- package/dist/dependency-injection/Container.d.ts.map +0 -1
- package/dist/dependency-injection/Container.js +0 -72
- package/dist/dependency-injection/Container.js.map +0 -1
- package/dist/dependency-injection/Injectable.d.ts +0 -96
- package/dist/dependency-injection/Injectable.d.ts.map +0 -1
- package/dist/dependency-injection/Injectable.js +0 -37
- package/dist/dependency-injection/Injectable.js.map +0 -1
- package/dist/dependency-injection/PartialContainer.d.ts +0 -86
- package/dist/dependency-injection/PartialContainer.d.ts.map +0 -1
- package/dist/dependency-injection/PartialContainer.js +0 -28
- package/dist/dependency-injection/PartialContainer.js.map +0 -1
- package/dist/dependency-injection/RootServices.d.ts +0 -76
- package/dist/dependency-injection/RootServices.d.ts.map +0 -1
- package/dist/dependency-injection/RootServices.js.map +0 -1
- package/dist/dependency-injection/types.d.ts +0 -57
- package/dist/dependency-injection/types.d.ts.map +0 -1
- package/dist/dependency-injection/types.js +0 -2
- package/dist/dependency-injection/types.js.map +0 -1
- package/docs/html/functions/ConcatInjectable.html +0 -19
- package/docs/html/functions/Injectable.html +0 -17
- /package/dist/{dependency-injection/RootServices.js → RootServices.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reportHttpMetrics.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reportHttpMetrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAMzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,oBAAoB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O;QAEvC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;QAEpD,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;QAC/E,OAAO,CAAC,qBAAqB,CAAC,SAAS,CAAC,KAAK,CAAC,kBAAkB,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC;QAC/F,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACP,CAAC,CACJ,CAAC","sourcesContent":["import { assertUnreachable } from \"../../common/assertions\";\nimport { Injectable } from \"../../dependency-injection/Injectable\";\nimport { scan } from \"../../events/scan\";\nimport type { CofDimensions } from \"../../remote-configuration/cofHandler\";\nimport { COF_REQUEST_TYPE } from \"../../remote-configuration/cofHandler\";\nimport type {\n Dimensions,\n RequestStateEventTarget,\n RequestStateEvents,\n} from \"../../handlers/requestStateEmittingHandler\";\nimport { requestStateEventTargetFactory } from \"../../handlers/requestStateEmittingHandler\";\nimport { getPlatformInfo } from \"../../platform/platformInfo\";\nimport type { MetricsClient } from \"../../clients/metricsClient\";\nimport { metricsClientFactory } from \"../../clients/metricsClient\";\nimport { Count } from \"../operational/Count\";\nimport { Histogram } from \"../operational/Histogram\";\nimport type { Timer } from \"../operational/Timer\";\nimport {\n LENS_CORE_JS_REQUEST_TYPE,\n LENS_CORE_WASM_REQUEST_TYPE,\n type LensCoreDownloadDimensions,\n} from \"../../lens-core-module/loader/lensCoreFactory\";\nimport { GRPC_CALL_REQUEST_TYPE, type GrpcRequestDimensions } from \"../../clients/grpcHandler\";\nimport type { AssetDownloadDimensions, LensDownloadDimensions } from \"./reportLensAndAssetDownload\";\n\ntype InProgressMap = Map<number, { timer: Timer<\"download_latency\"> }>;\ninterface InProgress {\n name: \"inProgress\";\n inProgress: InProgressMap;\n}\ninterface Completed {\n name: \"completed\";\n inProgress: InProgressMap;\n dimensions: Record<string, string>;\n timer: Timer<\"download_latency\">;\n downloadSizeKb: number;\n}\ntype RequestState = InProgress | Completed;\n\ntype ReportableMetricDimensions =\n | LensDownloadDimensions\n | AssetDownloadDimensions\n | CofDimensions\n | LensCoreDownloadDimensions\n | GrpcRequestDimensions;\n\nconst reportableMetricRequestTypes: ReportableMetricDimensions[\"requestType\"][] = [\n \"asset\",\n \"lens_content\",\n LENS_CORE_JS_REQUEST_TYPE,\n LENS_CORE_WASM_REQUEST_TYPE,\n COF_REQUEST_TYPE,\n GRPC_CALL_REQUEST_TYPE,\n];\n\nconst getAdditionalDimensions = (dimensions: ReportableMetricDimensions): [string, string][] => {\n switch (dimensions.requestType) {\n case COF_REQUEST_TYPE:\n return [[\"delta\", dimensions.delta]];\n case GRPC_CALL_REQUEST_TYPE:\n return [[\"method\", dimensions.methodName]];\n case LENS_CORE_JS_REQUEST_TYPE:\n case LENS_CORE_WASM_REQUEST_TYPE:\n return [[\"custom\", dimensions.customBuild]];\n default:\n return [];\n }\n};\n\nconst getContentType = (dimensions: ReportableMetricDimensions): string => {\n if (dimensions.requestType === \"asset\") {\n return dimensions.assetType;\n }\n return dimensions.requestType;\n};\n\nconst getSizeKb = (event: RequestStateEvents): number => {\n switch (event.type) {\n case \"started\":\n case \"errored\":\n return 0;\n case \"completed\":\n return event.detail.sizeByte / 1024;\n default:\n assertUnreachable(event);\n }\n};\n\nconst getStatus = (event: RequestStateEvents): string => {\n switch (event.type) {\n case \"started\":\n case \"errored\":\n // We'll use status 0 to indicate that an exception occurred during the request. This is somewhat in keeping\n // with browsers that set the response status to 0 if the request was not able to be made (e.g. CORs\n // preflight failed, or the user canceled the request).\n return \"0\";\n case \"completed\":\n return event.detail.status.toString();\n default:\n assertUnreachable(event);\n }\n};\n\nexport const isRelevantRequest = (value: Dimensions): value is ReportableMetricDimensions => {\n const reportableMetricDimensions = value as ReportableMetricDimensions;\n return reportableMetricRequestTypes.includes(reportableMetricDimensions.requestType);\n};\n\nexport const reportHttpMetrics = Injectable(\n \"reportHttpMetrics\",\n [metricsClientFactory.token, requestStateEventTargetFactory.token] as const,\n (metrics: MetricsClient, requestStateEventTarget: RequestStateEventTarget) => {\n scan<RequestState>({ name: \"inProgress\", inProgress: new Map() })(\n requestStateEventTarget,\n [\"started\", \"completed\", \"errored\"],\n (state, event) => {\n const { inProgress } = state;\n const { dimensions, requestId } = event.detail;\n\n if (!isRelevantRequest(dimensions)) return state;\n\n switch (event.type) {\n case \"started\":\n const timer = event.detail.timer;\n inProgress.set(requestId, { timer });\n return { name: \"inProgress\", inProgress };\n case \"completed\":\n case \"errored\":\n const completedRequest = inProgress.get(requestId);\n if (!completedRequest) return state;\n inProgress.delete(requestId);\n\n const downloadSizeKb = getSizeKb(event);\n const status = getStatus(event);\n const operationalDimensions: Record<string, string> = {\n content_type: getContentType(dimensions),\n network_type: getPlatformInfo().connectionType ?? \"unknown\",\n status,\n };\n\n for (const [key, value] of getAdditionalDimensions(dimensions)) {\n operationalDimensions[key] = value;\n }\n\n completedRequest.timer.measure(operationalDimensions);\n\n return {\n name: \"completed\",\n inProgress: state.inProgress,\n dimensions: operationalDimensions,\n downloadSizeKb,\n timer: completedRequest.timer,\n };\n default:\n assertUnreachable(event);\n }\n }\n ).addEventListener(\"state\", ({ detail: state }) => {\n if (state.name !== \"completed\") return;\n\n const { dimensions, timer, downloadSizeKb } = state;\n\n metrics.setOperationalMetrics(Count.count(\"download_finished\", 1, dimensions));\n metrics.setOperationalMetrics(Histogram.level(\"download_size_kb\", downloadSizeKb, dimensions));\n metrics.setOperationalMetrics(timer);\n });\n }\n);\n"]}
|
|
1
|
+
{"version":3,"file":"reportHttpMetrics.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reportHttpMetrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EA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AC,KAAK;iBAChC,CAAC;YACN;gBACI,iBAAiB,CAAC,KAAK,CAAC,CAAC;SAChC;IACL,CAAC,CACJ,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;QAC9C,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW;YAAE,OAAO;QAEvC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;QAEpD,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;QAC/E,OAAO,CAAC,qBAAqB,CAAC,SAAS,CAAC,KAAK,CAAC,kBAAkB,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC;QAC/F,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACP,CAAC,CACJ,CAAC","sourcesContent":["import { Injectable } from \"@snap/ts-inject\";\nimport { assertUnreachable } from \"../../common/assertions\";\nimport { scan } from \"../../events/scan\";\nimport type { CofDimensions } from \"../../remote-configuration/cofHandler\";\nimport { COF_REQUEST_TYPE } from \"../../remote-configuration/cofHandler\";\nimport type {\n Dimensions,\n RequestStateEventTarget,\n RequestStateEvents,\n} from \"../../handlers/requestStateEmittingHandler\";\nimport { requestStateEventTargetFactory } from \"../../handlers/requestStateEmittingHandler\";\nimport { getPlatformInfo } from \"../../platform/platformInfo\";\nimport type { MetricsClient } from \"../../clients/metricsClient\";\nimport { metricsClientFactory } from \"../../clients/metricsClient\";\nimport { Count } from \"../operational/Count\";\nimport { Histogram } from \"../operational/Histogram\";\nimport type { Timer } from \"../operational/Timer\";\nimport {\n LENS_CORE_JS_REQUEST_TYPE,\n LENS_CORE_WASM_REQUEST_TYPE,\n type LensCoreDownloadDimensions,\n} from \"../../lens-core-module/loader/lensCoreFactory\";\nimport { GRPC_CALL_REQUEST_TYPE, type GrpcRequestDimensions } from \"../../clients/grpcHandler\";\nimport type { AssetDownloadDimensions, LensDownloadDimensions } from \"./reportLensAndAssetDownload\";\n\ntype InProgressMap = Map<number, { timer: Timer<\"download_latency\"> }>;\ninterface InProgress {\n name: \"inProgress\";\n inProgress: InProgressMap;\n}\ninterface Completed {\n name: \"completed\";\n inProgress: InProgressMap;\n dimensions: Record<string, string>;\n timer: Timer<\"download_latency\">;\n downloadSizeKb: number;\n}\ntype RequestState = InProgress | Completed;\n\ntype ReportableMetricDimensions =\n | LensDownloadDimensions\n | AssetDownloadDimensions\n | CofDimensions\n | LensCoreDownloadDimensions\n | GrpcRequestDimensions;\n\nconst reportableMetricRequestTypes: ReportableMetricDimensions[\"requestType\"][] = [\n \"asset\",\n \"lens_content\",\n LENS_CORE_JS_REQUEST_TYPE,\n LENS_CORE_WASM_REQUEST_TYPE,\n COF_REQUEST_TYPE,\n GRPC_CALL_REQUEST_TYPE,\n];\n\nconst getAdditionalDimensions = (dimensions: ReportableMetricDimensions): [string, string][] => {\n switch (dimensions.requestType) {\n case COF_REQUEST_TYPE:\n return [[\"delta\", dimensions.delta]];\n case GRPC_CALL_REQUEST_TYPE:\n return [[\"method\", dimensions.methodName]];\n case LENS_CORE_JS_REQUEST_TYPE:\n case LENS_CORE_WASM_REQUEST_TYPE:\n return [[\"custom\", dimensions.customBuild]];\n default:\n return [];\n }\n};\n\nconst getContentType = (dimensions: ReportableMetricDimensions): string => {\n if (dimensions.requestType === \"asset\") {\n return dimensions.assetType;\n }\n return dimensions.requestType;\n};\n\nconst getSizeKb = (event: RequestStateEvents): number => {\n switch (event.type) {\n case \"started\":\n case \"errored\":\n return 0;\n case \"completed\":\n return event.detail.sizeByte / 1024;\n default:\n assertUnreachable(event);\n }\n};\n\nconst getStatus = (event: RequestStateEvents): string => {\n switch (event.type) {\n case \"started\":\n case \"errored\":\n // We'll use status 0 to indicate that an exception occurred during the request. This is somewhat in keeping\n // with browsers that set the response status to 0 if the request was not able to be made (e.g. CORs\n // preflight failed, or the user canceled the request).\n return \"0\";\n case \"completed\":\n return event.detail.status.toString();\n default:\n assertUnreachable(event);\n }\n};\n\nexport const isRelevantRequest = (value: Dimensions): value is ReportableMetricDimensions => {\n const reportableMetricDimensions = value as ReportableMetricDimensions;\n return reportableMetricRequestTypes.includes(reportableMetricDimensions.requestType);\n};\n\nexport const reportHttpMetrics = Injectable(\n \"reportHttpMetrics\",\n [metricsClientFactory.token, requestStateEventTargetFactory.token] as const,\n (metrics: MetricsClient, requestStateEventTarget: RequestStateEventTarget) => {\n scan<RequestState>({ name: \"inProgress\", inProgress: new Map() })(\n requestStateEventTarget,\n [\"started\", \"completed\", \"errored\"],\n (state, event) => {\n const { inProgress } = state;\n const { dimensions, requestId } = event.detail;\n\n if (!isRelevantRequest(dimensions)) return state;\n\n switch (event.type) {\n case \"started\":\n const timer = event.detail.timer;\n inProgress.set(requestId, { timer });\n return { name: \"inProgress\", inProgress };\n case \"completed\":\n case \"errored\":\n const completedRequest = inProgress.get(requestId);\n if (!completedRequest) return state;\n inProgress.delete(requestId);\n\n const downloadSizeKb = getSizeKb(event);\n const status = getStatus(event);\n const operationalDimensions: Record<string, string> = {\n content_type: getContentType(dimensions),\n network_type: getPlatformInfo().connectionType ?? \"unknown\",\n status,\n };\n\n for (const [key, value] of getAdditionalDimensions(dimensions)) {\n operationalDimensions[key] = value;\n }\n\n completedRequest.timer.measure(operationalDimensions);\n\n return {\n name: \"completed\",\n inProgress: state.inProgress,\n dimensions: operationalDimensions,\n downloadSizeKb,\n timer: completedRequest.timer,\n };\n default:\n assertUnreachable(event);\n }\n }\n ).addEventListener(\"state\", ({ detail: state }) => {\n if (state.name !== \"completed\") return;\n\n const { dimensions, timer, downloadSizeKb } = state;\n\n metrics.setOperationalMetrics(Count.count(\"download_finished\", 1, dimensions));\n metrics.setOperationalMetrics(Histogram.level(\"download_size_kb\", downloadSizeKb, dimensions));\n metrics.setOperationalMetrics(timer);\n });\n }\n);\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { forActions } from "@snap/state-management";
|
|
2
2
|
import { map } from "rxjs";
|
|
3
|
-
import { Injectable } from "
|
|
3
|
+
import { Injectable } from "@snap/ts-inject";
|
|
4
4
|
import { TypedCustomEvent } from "../../events/TypedCustomEvent";
|
|
5
5
|
import { CameraKitLegalPromptResult } from "../../generated-proto/blizzard/cameraKitEvents";
|
|
6
6
|
import { legalStateFactory } from "../../legal/legalState";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reportLegalState.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reportLegalState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"reportLegalState.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reportLegalState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AAE5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAU7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CACtC,kBAAkB,EAClB,CAAC,iBAAiB,CAAC,KAAK,EAAE,yBAAyB,CAAC,KAAK,EAAE,oBAAoB,CAAC,KAAK,CAAU,EAC/F,CAAC,UAAsB,EAAE,kBAAsC,EAAE,OAAsB,EAAE,EAAE;IACvF,UAAU,CAAC,MAAM;SACZ,IAAI,CACD,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAC9B,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACvB,IAAI,EAAE,aAAsB;QAC5B,aAAa,EAAE,IAAI;QACnB,iBAAiB,EACb,IAAI,KAAK,QAAQ;YACb,CAAC,CAAC,0BAA0B,CAAC,gCAAgC;YAC7D,CAAC,CAAC,0BAA0B,CAAC,iCAAiC;KACzE,CAAC,CAAC,CACN;SACA,SAAS,CAAC;QACP,IAAI,EAAE,CAAC,gBAAgB,EAAE,EAAE;YACvB,kBAAkB,CAAC,aAAa,CAAC,IAAI,gBAAgB,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC,CAAC;YACxF,OAAO,CAAC,qBAAqB,CACzB,KAAK,CAAC,KAAK,CAAC,0BAA0B,EAAE,CAAC,EAAE;gBACvC,QAAQ,EAAE,CACN,gBAAgB,CAAC,iBAAiB;oBAClC,0BAA0B,CAAC,gCAAgC,CAC9D,CAAC,QAAQ,EAAE;aACf,CAAC,CACL,CAAC;QACN,CAAC;KACJ,CAAC,CAAC;AACX,CAAC,CACJ,CAAC","sourcesContent":["import { forActions } from \"@snap/state-management\";\nimport { map } from \"rxjs\";\nimport { Injectable } from \"@snap/ts-inject\";\nimport { TypedCustomEvent } from \"../../events/TypedCustomEvent\";\nimport { CameraKitLegalPromptResult } from \"../../generated-proto/blizzard/cameraKitEvents\";\nimport type { LegalState } from \"../../legal/legalState\";\nimport { legalStateFactory } from \"../../legal/legalState\";\nimport type { MakeTaggedBusinessEvent } from \"../businessEventsReporter\";\nimport type { MetricsEventTarget } from \"../metricsEventTarget\";\nimport { metricsEventTargetFactory } from \"../metricsEventTarget\";\nimport type { MetricsClient } from \"../../clients/metricsClient\";\nimport { metricsClientFactory } from \"../../clients/metricsClient\";\nimport { Count } from \"../operational/Count\";\n\n/**\n * The LegalPrompt metric reports each time a BIPA legal prompt is shown.\n */\nexport type LegalPrompt = MakeTaggedBusinessEvent<\"legalPrompt\">;\n\n/**\n * @internal\n */\nexport const reportLegalState = Injectable(\n \"reportLegalState\",\n [legalStateFactory.token, metricsEventTargetFactory.token, metricsClientFactory.token] as const,\n (legalState: LegalState, metricsEventTarget: MetricsEventTarget, metrics: MetricsClient) => {\n legalState.events\n .pipe(\n forActions(\"accept\", \"reject\"),\n map(([{ data, name }]) => ({\n name: \"legalPrompt\" as const,\n legalPromptId: data,\n legalPromptResult:\n name === \"accept\"\n ? CameraKitLegalPromptResult.CAMERA_KIT_LEGAL_PROMPT_ACCEPTED\n : CameraKitLegalPromptResult.CAMERA_KIT_LEGAL_PROMPT_DISMISSED,\n }))\n )\n .subscribe({\n next: (legalPromptEvent) => {\n metricsEventTarget.dispatchEvent(new TypedCustomEvent(\"legalPrompt\", legalPromptEvent));\n metrics.setOperationalMetrics(\n Count.count(\"legal_prompt_interaction\", 1, {\n accepted: (\n legalPromptEvent.legalPromptResult ===\n CameraKitLegalPromptResult.CAMERA_KIT_LEGAL_PROMPT_ACCEPTED\n ).toString(),\n })\n );\n },\n });\n }\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reportLensAndAssetDownload.d.ts","sourceRoot":"","sources":["../../../src/metrics/reporters/reportLensAndAssetDownload.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reportLensAndAssetDownload.d.ts","sourceRoot":"","sources":["../../../src/metrics/reporters/reportLensAndAssetDownload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAMjE,OAAO,KAAK,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAEtG,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EAAyB,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAkBvF,eAAO,MAAM,oBAAoB,UAAW,UAAU,8DAIrD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GAAG,uBAAuB,CAAC,cAAc,CAAC,CAAC;AACnE,MAAM,MAAM,sBAAsB,GAAG;IAAE,WAAW,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAErF;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG,uBAAuB,CAAC,eAAe,CAAC,CAAC;AACrE,MAAM,MAAM,uBAAuB,GAAG;IAAE,WAAW,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnH,eAAO,MAAM,0BAA0B;;;;CAsFtC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Injectable } from "@snap/ts-inject";
|
|
1
2
|
import { metricsClientFactory } from "../../clients/metricsClient";
|
|
2
3
|
import { assertUnreachable } from "../../common/assertions";
|
|
3
4
|
import { stringifyError } from "../../common/errorHelpers";
|
|
4
|
-
import { Injectable } from "../../dependency-injection/Injectable";
|
|
5
5
|
import { scan } from "../../events/scan";
|
|
6
6
|
import { TypedCustomEvent } from "../../events/TypedCustomEvent";
|
|
7
7
|
import { requestStateEventTargetFactory } from "../../handlers/requestStateEmittingHandler";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reportLensAndAssetDownload.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reportLensAndAssetDownload.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,M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AAE,CAAC,CAAC,CAAC;SACzG;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CACJ,CAAC","sourcesContent":["import type { MetricsClient } from \"../../clients/metricsClient\";\nimport { metricsClientFactory } from \"../../clients/metricsClient\";\nimport { assertUnreachable } from \"../../common/assertions\";\nimport { stringifyError } from \"../../common/errorHelpers\";\nimport { Injectable } from \"../../dependency-injection/Injectable\";\nimport { scan } from \"../../events/scan\";\nimport { TypedCustomEvent } from \"../../events/TypedCustomEvent\";\nimport type { Dimensions, RequestStateEventTarget } from \"../../handlers/requestStateEmittingHandler\";\nimport { requestStateEventTargetFactory } from \"../../handlers/requestStateEmittingHandler\";\nimport type { MakeTaggedBusinessEvent } from \"../businessEventsReporter\";\nimport type { CameraKitMetricEvents, MetricsEventTarget } from \"../metricsEventTarget\";\nimport { metricsEventTargetFactory } from \"../metricsEventTarget\";\nimport { Count } from \"../operational/Count\";\nimport type { Timer } from \"../operational/Timer\";\n\ntype InProgressMap = Map<number, { timer: Timer<string> }>;\ninterface InProgress {\n name: \"inProgress\";\n inProgress: InProgressMap;\n}\ninterface Completed {\n name: \"completed\";\n inProgress: InProgressMap;\n event: CameraKitMetricEvents;\n}\ntype RequestState = InProgress | Completed;\n\nconst relevantRequestTypes = [\"lens_content\", \"asset\"] as const;\nexport const isLensOrAssetRequest = (value: Dimensions): value is LensDownloadDimensions | AssetDownloadDimensions => {\n const requestType = value[\"requestType\"];\n // Safety: the cast makes the type less specific so we can check if any string is present in the tuple.\n return typeof requestType === \"string\" && (relevantRequestTypes as readonly string[]).includes(requestType);\n};\n\n/**\n * The LensDownload metric is triggered by any download of lens content.\n *\n * It contains download stats, which lens was requested, and whether prefetch was used.\n *\n * It corresponds to the internal CameraKitLensDownload event, described here:\n * https://docs.google.com/document/d/1-kSzFWCWw9Qo3D08FR1_cqeHTsUtk9p3p3uOptzWDTY/edit#heading=h.stqom49qs91t\n */\nexport type LensDownload = MakeTaggedBusinessEvent<\"lensDownload\">;\nexport type LensDownloadDimensions = { requestType: \"lens_content\"; lensId: string };\n\n/**\n * The AssetDownload metric is triggered by any type of asset download.\n *\n * It contains download stats, which asset was requested, and whether prefetch was used.\n *\n * It corresponds to the internal CameraKitAssetDownload event, described here:\n * https://docs.google.com/document/d/1-kSzFWCWw9Qo3D08FR1_cqeHTsUtk9p3p3uOptzWDTY/edit#heading=h.vlormd1724fp\n */\nexport type AssetDownload = MakeTaggedBusinessEvent<\"assetDownload\">;\nexport type AssetDownloadDimensions = { requestType: \"asset\"; assetType: string; assetId: string; lensId: string };\n\nexport const reportLensAndAssetDownload = Injectable(\n \"reportLensAndAssetDownload\",\n [metricsEventTargetFactory.token, metricsClientFactory.token, requestStateEventTargetFactory.token] as const,\n (\n metricsEventTarget: MetricsEventTarget,\n metrics: MetricsClient,\n requestStateEventTarget: RequestStateEventTarget\n ) => {\n scan<RequestState>({ name: \"inProgress\", inProgress: new Map() })(\n requestStateEventTarget,\n [\"started\", \"completed\", \"errored\"],\n (state, event): RequestState => {\n const { inProgress } = state;\n const { dimensions, requestId } = event.detail;\n\n if (!isLensOrAssetRequest(dimensions)) return state;\n\n switch (event.type) {\n case \"started\":\n const timer = event.detail.timer;\n inProgress.set(requestId, { timer });\n return { name: \"inProgress\", inProgress };\n case \"completed\":\n const completedRequest = inProgress.get(requestId);\n if (!completedRequest) return state;\n inProgress.delete(requestId);\n\n const { duration } = completedRequest.timer.measure() ?? { duration: 0 };\n const downloadTimeSec = duration / 1000;\n const { sizeByte } = event.detail;\n\n switch (dimensions.requestType) {\n case \"lens_content\":\n return {\n name: \"completed\",\n inProgress,\n event: new TypedCustomEvent(\"lensDownload\", {\n name: \"lensDownload\",\n lensId: dimensions.lensId,\n automaticDownload: false,\n sizeByte: `${Math.ceil(sizeByte)}`,\n downloadTimeSec,\n }),\n };\n case \"asset\":\n return {\n name: \"completed\",\n inProgress,\n event: new TypedCustomEvent(\"assetDownload\", {\n name: \"assetDownload\",\n assetId: dimensions.assetId,\n automaticDownload: false,\n sizeByte: `${Math.ceil(sizeByte)}`,\n downloadTimeSec,\n }),\n };\n default:\n assertUnreachable(dimensions);\n }\n case \"errored\":\n const erroredRequest = inProgress.get(requestId);\n if (!erroredRequest) return state;\n inProgress.delete(requestId);\n const error = event.detail.error;\n return {\n name: \"completed\",\n inProgress,\n event: new TypedCustomEvent(\"exception\", {\n name: \"exception\",\n lensId: dimensions.lensId,\n type: dimensions.requestType === \"lens_content\" ? \"lens\" : \"asset\",\n reason: stringifyError(error),\n }),\n };\n default:\n assertUnreachable(event);\n }\n }\n ).addEventListener(\"state\", ({ detail: state }) => {\n if (state.name !== \"completed\") return;\n metricsEventTarget.dispatchEvent(state.event);\n if (state.event.detail.name === \"exception\") {\n metrics.setOperationalMetrics(Count.count(\"handled_exception\", 1, { type: state.event.detail.type }));\n }\n });\n }\n);\n"]}
|
|
1
|
+
{"version":3,"file":"reportLensAndAssetDownload.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reportLensAndAssetDownload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AAG5F,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAe7C,MAAM,oBAAoB,GAAG,CAAC,cAAc,EAAE,OAAO,CAAU,CAAC;AAChE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAiB,EAA6D,EAAE;IACjH,MAAM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ACV,KAAK,EAAE,IAAI,gBAAgB,CAAC,WAAW,EAAE;wBACrC,IAAI,EAAE,WAAW;wBACjB,MAAM,EAAE,UAAU,CAAC,MAAM;wBACzB,IAAI,EAAE,UAAU,CAAC,WAAW,KAAK,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;wBAClE,MAAM,EAAE,cAAc,CAAC,KAAK,CAAC;qBAChC,CAAC;iBACL,CAAC;YACN;gBACI,iBAAiB,CAAC,KAAK,CAAC,CAAC;SAChC;IACL,CAAC,CACJ,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;QAC9C,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW;YAAE,OAAO;QACvC,kBAAkB,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC9C,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,WAAW,EAAE;YACzC,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;SACzG;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CACJ,CAAC","sourcesContent":["import { Injectable } from \"@snap/ts-inject\";\nimport type { MetricsClient } from \"../../clients/metricsClient\";\nimport { metricsClientFactory } from \"../../clients/metricsClient\";\nimport { assertUnreachable } from \"../../common/assertions\";\nimport { stringifyError } from \"../../common/errorHelpers\";\nimport { scan } from \"../../events/scan\";\nimport { TypedCustomEvent } from \"../../events/TypedCustomEvent\";\nimport type { Dimensions, RequestStateEventTarget } from \"../../handlers/requestStateEmittingHandler\";\nimport { requestStateEventTargetFactory } from \"../../handlers/requestStateEmittingHandler\";\nimport type { MakeTaggedBusinessEvent } from \"../businessEventsReporter\";\nimport type { CameraKitMetricEvents, MetricsEventTarget } from \"../metricsEventTarget\";\nimport { metricsEventTargetFactory } from \"../metricsEventTarget\";\nimport { Count } from \"../operational/Count\";\nimport type { Timer } from \"../operational/Timer\";\n\ntype InProgressMap = Map<number, { timer: Timer<string> }>;\ninterface InProgress {\n name: \"inProgress\";\n inProgress: InProgressMap;\n}\ninterface Completed {\n name: \"completed\";\n inProgress: InProgressMap;\n event: CameraKitMetricEvents;\n}\ntype RequestState = InProgress | Completed;\n\nconst relevantRequestTypes = [\"lens_content\", \"asset\"] as const;\nexport const isLensOrAssetRequest = (value: Dimensions): value is LensDownloadDimensions | AssetDownloadDimensions => {\n const requestType = value[\"requestType\"];\n // Safety: the cast makes the type less specific so we can check if any string is present in the tuple.\n return typeof requestType === \"string\" && (relevantRequestTypes as readonly string[]).includes(requestType);\n};\n\n/**\n * The LensDownload metric is triggered by any download of lens content.\n *\n * It contains download stats, which lens was requested, and whether prefetch was used.\n *\n * It corresponds to the internal CameraKitLensDownload event, described here:\n * https://docs.google.com/document/d/1-kSzFWCWw9Qo3D08FR1_cqeHTsUtk9p3p3uOptzWDTY/edit#heading=h.stqom49qs91t\n */\nexport type LensDownload = MakeTaggedBusinessEvent<\"lensDownload\">;\nexport type LensDownloadDimensions = { requestType: \"lens_content\"; lensId: string };\n\n/**\n * The AssetDownload metric is triggered by any type of asset download.\n *\n * It contains download stats, which asset was requested, and whether prefetch was used.\n *\n * It corresponds to the internal CameraKitAssetDownload event, described here:\n * https://docs.google.com/document/d/1-kSzFWCWw9Qo3D08FR1_cqeHTsUtk9p3p3uOptzWDTY/edit#heading=h.vlormd1724fp\n */\nexport type AssetDownload = MakeTaggedBusinessEvent<\"assetDownload\">;\nexport type AssetDownloadDimensions = { requestType: \"asset\"; assetType: string; assetId: string; lensId: string };\n\nexport const reportLensAndAssetDownload = Injectable(\n \"reportLensAndAssetDownload\",\n [metricsEventTargetFactory.token, metricsClientFactory.token, requestStateEventTargetFactory.token] as const,\n (\n metricsEventTarget: MetricsEventTarget,\n metrics: MetricsClient,\n requestStateEventTarget: RequestStateEventTarget\n ) => {\n scan<RequestState>({ name: \"inProgress\", inProgress: new Map() })(\n requestStateEventTarget,\n [\"started\", \"completed\", \"errored\"],\n (state, event): RequestState => {\n const { inProgress } = state;\n const { dimensions, requestId } = event.detail;\n\n if (!isLensOrAssetRequest(dimensions)) return state;\n\n switch (event.type) {\n case \"started\":\n const timer = event.detail.timer;\n inProgress.set(requestId, { timer });\n return { name: \"inProgress\", inProgress };\n case \"completed\":\n const completedRequest = inProgress.get(requestId);\n if (!completedRequest) return state;\n inProgress.delete(requestId);\n\n const { duration } = completedRequest.timer.measure() ?? { duration: 0 };\n const downloadTimeSec = duration / 1000;\n const { sizeByte } = event.detail;\n\n switch (dimensions.requestType) {\n case \"lens_content\":\n return {\n name: \"completed\",\n inProgress,\n event: new TypedCustomEvent(\"lensDownload\", {\n name: \"lensDownload\",\n lensId: dimensions.lensId,\n automaticDownload: false,\n sizeByte: `${Math.ceil(sizeByte)}`,\n downloadTimeSec,\n }),\n };\n case \"asset\":\n return {\n name: \"completed\",\n inProgress,\n event: new TypedCustomEvent(\"assetDownload\", {\n name: \"assetDownload\",\n assetId: dimensions.assetId,\n automaticDownload: false,\n sizeByte: `${Math.ceil(sizeByte)}`,\n downloadTimeSec,\n }),\n };\n default:\n assertUnreachable(dimensions);\n }\n case \"errored\":\n const erroredRequest = inProgress.get(requestId);\n if (!erroredRequest) return state;\n inProgress.delete(requestId);\n const error = event.detail.error;\n return {\n name: \"completed\",\n inProgress,\n event: new TypedCustomEvent(\"exception\", {\n name: \"exception\",\n lensId: dimensions.lensId,\n type: dimensions.requestType === \"lens_content\" ? \"lens\" : \"asset\",\n reason: stringifyError(error),\n }),\n };\n default:\n assertUnreachable(event);\n }\n }\n ).addEventListener(\"state\", ({ detail: state }) => {\n if (state.name !== \"completed\") return;\n metricsEventTarget.dispatchEvent(state.event);\n if (state.event.detail.name === \"exception\") {\n metrics.setOperationalMetrics(Count.count(\"handled_exception\", 1, { type: state.event.detail.type }));\n }\n });\n }\n);\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { forActions } from "@snap/state-management";
|
|
2
2
|
import { filter } from "rxjs";
|
|
3
|
-
import { Injectable } from "
|
|
3
|
+
import { Injectable } from "@snap/ts-inject";
|
|
4
4
|
import { TypedCustomEvent } from "../../events/TypedCustomEvent";
|
|
5
5
|
import { lensStateFactory } from "../../session/lensState";
|
|
6
6
|
import { metricsEventTargetFactory } from "../metricsEventTarget";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reportLensValidationFailed.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reportLensValidationFailed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"reportLensValidationFailed.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reportLensValidationFailed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAUlE,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAChD,4BAA4B,EAC5B,CAAC,gBAAgB,CAAC,KAAK,EAAE,yBAAyB,CAAC,KAAK,CAAU,EAClE,CAAC,SAAoB,EAAE,kBAAsC,EAAE,EAAE;IAC7D,SAAS,CAAC,MAAM;SACX,IAAI,CACD,UAAU,CAAC,iBAAiB,CAAC,EAC7B,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,4BAA4B,CAAC,CACtE;SACA,SAAS,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE;YACjB,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;YACtB,MAAM,2BAA2B,GAAgC;gBAC7D,IAAI,EAAE,6BAA6B;gBACnC,MAAM,EAAE,IAAI,CAAC,EAAE;aAClB,CAAC;YACF,kBAAkB,CAAC,aAAa,CAC5B,IAAI,gBAAgB,CAAC,6BAA6B,EAAE,2BAA2B,CAAC,CACnF,CAAC;QACN,CAAC;KACJ,CAAC,CAAC;AACX,CAAC,CACJ,CAAC","sourcesContent":["import { forActions } from \"@snap/state-management\";\nimport { filter } from \"rxjs\";\nimport { Injectable } from \"@snap/ts-inject\";\nimport { TypedCustomEvent } from \"../../events/TypedCustomEvent\";\nimport type { LensState } from \"../../session/lensState\";\nimport { lensStateFactory } from \"../../session/lensState\";\nimport type { MakeTaggedBusinessEvent } from \"../businessEventsReporter\";\nimport type { MetricsEventTarget } from \"../metricsEventTarget\";\nimport { metricsEventTargetFactory } from \"../metricsEventTarget\";\n\n/**\n * The LensContentValidationFailed metric reports every time we handle an lens checksum validation failure.\n */\nexport type LensContentValidationFailed = MakeTaggedBusinessEvent<\"lensContentValidationFailed\">;\n\n/**\n * @internal\n */\nexport const reportLensValidationFailed = Injectable(\n \"reportLensValidationFailed\",\n [lensStateFactory.token, metricsEventTargetFactory.token] as const,\n (lensState: LensState, metricsEventTarget: MetricsEventTarget) => {\n lensState.events\n .pipe(\n forActions(\"applyLensFailed\"),\n filter(([a]) => a.data.error.name === \"LensContentValidationError\")\n )\n .subscribe({\n next: ([{ data }]) => {\n const { lens } = data;\n const lensContentValidationFailed: LensContentValidationFailed = {\n name: \"lensContentValidationFailed\",\n lensId: lens.id,\n };\n metricsEventTarget.dispatchEvent(\n new TypedCustomEvent(\"lensContentValidationFailed\", lensContentValidationFailed)\n );\n },\n });\n }\n);\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { combineLatestWith, filter, from, map, merge, mergeMap, of, raceWith, switchMap, take, takeUntil } from "rxjs";
|
|
3
3
|
import { forActions, inStates, isState } from "@snap/state-management";
|
|
4
|
-
import { Injectable } from "
|
|
4
|
+
import { Injectable } from "@snap/ts-inject";
|
|
5
5
|
import { TypedCustomEvent } from "../../events/TypedCustomEvent";
|
|
6
6
|
import { metricsEventTargetFactory } from "../metricsEventTarget";
|
|
7
7
|
import { cameraKitSessionFactory } from "../../session/CameraKitSession";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reportLensView.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reportLensView.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACvH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MAA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,EACpB,sBAAsB,GACzB,EAAE,EAAE;YACD,IAAI,WAAW,GAAG,oBAAoB;gBAAE,OAAO;YAE/C,MAAM,QAAQ,GAAa;gBACvB,IAAI,EAAE,UAAU;gBAChB,aAAa;gBACb,MAAM;gBACN,MAAM;gBACN,WAAW;gBACX,4BAA4B;gBAC5B,4BAA4B;gBAE5B,gBAAgB,EAAE,CAAC;gBACnB,WAAW;gBACX,oBAAoB;gBACpB,sBAAsB;gBACtB,kBAAkB,EAAE,GAAG,kBAAkB,EAAE;gBAC3C,iBAAiB;aACpB,CAAC;YAEF,kBAAkB,CAAC,aAAa,CAAC,IAAI,gBAAgB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC7E,OAAO,CAAC,qBAAqB,CAAC,SAAS,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC;YAKhF,IAAI,oBAAoB,IAAI,EAAE,EAAE;gBAC5B,OAAO,CAAC,qBAAqB,CACzB,SAAS,CAAC,KAAK,CAAC,iCAAiC,EAAE,+BAA+B,EAAE;oBAChF,mBAAmB,EAAE,kBAAkB,CAAC,QAAQ,EAAE;iBACrD,CAAC,CACL,CAAC;aACL;QACL,CAAC,CAAA;KACJ,CAAC,CAAC;AACX,CAAC,CAAA,CACJ,CAAC","sourcesContent":["import { combineLatestWith, filter, from, map, merge, mergeMap, of, raceWith, switchMap, take, takeUntil } from \"rxjs\";\nimport { forActions, inStates, isState } from \"@snap/state-management\";\nimport { Injectable } from \"../../dependency-injection/Injectable\";\nimport { TypedCustomEvent } from \"../../events/TypedCustomEvent\";\nimport type { MetricsEventTarget } from \"../metricsEventTarget\";\nimport { metricsEventTargetFactory } from \"../metricsEventTarget\";\nimport type { CameraKitSession } from \"../../session/CameraKitSession\";\nimport { cameraKitSessionFactory } from \"../../session/CameraKitSession\";\nimport type { MakeTaggedBusinessEvent } from \"../businessEventsReporter\";\nimport { getTimeMs } from \"../../common/time\";\nimport type { CameraKitConfiguration } from \"../../configuration\";\nimport { configurationToken } from \"../../configuration\";\nimport type { LensState } from \"../../session/lensState\";\nimport { lensStateFactory } from \"../../session/lensState\";\nimport type { SessionState } from \"../../session/sessionState\";\nimport { sessionStateFactory } from \"../../session/sessionState\";\nimport { Histogram } from \"../operational/Histogram\";\nimport { IndexedDBPersistence } from \"../../persistence/IndexedDBPersistence\";\nimport { ExpiringPersistence } from \"../../persistence/ExpiringPersistence\";\nimport { dayFormatter, monthFormatter } from \"../../common/date\";\nimport type { MetricsClient } from \"../../clients/metricsClient\";\nimport { metricsClientFactory } from \"../../clients/metricsClient\";\n\n// We ignore short-duration lens views.\n//\n// The value is documented here:\n// https://docs.google.com/document/d/1-kSzFWCWw9Qo3D08FR1_cqeHTsUtk9p3p3uOptzWDTY/edit#heading=h.q5liip76r9lt\nconst viewTimeThresholdSec = 0.1;\n\nasync function isFirstTimeWithinPeriods(lensId: string, persistence: ExpiringPersistence<Date>) {\n let isLensFirstWithinDay = false;\n let isLensFirstWithinMonth = false;\n\n try {\n const lensLastViewDate = await persistence.retrieve(lensId);\n const currentDate = new Date();\n\n if (!lensLastViewDate) {\n isLensFirstWithinDay = true;\n isLensFirstWithinMonth = true;\n } else {\n isLensFirstWithinDay = dayFormatter.format(lensLastViewDate) !== dayFormatter.format(currentDate);\n isLensFirstWithinMonth = monthFormatter.format(lensLastViewDate) !== monthFormatter.format(currentDate);\n }\n\n await persistence.store(lensId, currentDate);\n } catch (error) {\n console.error(`Error handling persistence for lensId ${lensId}: ${error}`);\n isLensFirstWithinDay = false;\n isLensFirstWithinMonth = false;\n }\n\n return { isLensFirstWithinDay, isLensFirstWithinMonth };\n}\n\n/**\n * The LensView metric is emitted after a lens has been viewed (for longer than 100ms), when the lens is turned off.\n *\n * It contains information about rendering performance.\n *\n * Notes:\n * - If the page is hidden (e.g. user switches to a different tab, or application, or closes the tab, or closes the\n * browser, navigates to a new page, refreshes, etc.) this metric will be emitted at that time. This is to ensure\n * we don't lose the metric if the page is closed.\n * - If the page is hidden and then made visible again later (e.g. user switches to a different tab, then back), we\n * will begin measuring a new LensView. That is, we will not capture the time when the page is hidden even if the\n * lens is still rendering in the background.\n *\n * @category Lenses\n * @category Metrics\n */\n// This type corresponds to the internal CameraKitLensSwipe event, described here:\n// https://docs.google.com/document/d/1-kSzFWCWw9Qo3D08FR1_cqeHTsUtk9p3p3uOptzWDTY#heading=h.q5liip76r9lt\nexport type LensView = MakeTaggedBusinessEvent<\"lensView\">;\n\n/**\n * @internal\n */\nexport const reportLensView = Injectable(\n \"reportLensView\",\n [\n cameraKitSessionFactory.token,\n lensStateFactory.token,\n sessionStateFactory.token,\n metricsEventTargetFactory.token,\n metricsClientFactory.token,\n configurationToken,\n ] as const,\n async (\n session: CameraKitSession,\n lensState: LensState,\n sessionState: SessionState,\n metricsEventTarget: MetricsEventTarget,\n metrics: MetricsClient,\n configuration: CameraKitConfiguration\n ): Promise<void> => {\n // We need to do this await up front so that it won't interrupt reporting the metric when the session is\n // suspended -- suspension could happen because the tab is closing, in which case we cannot perform await a\n // Promise, because in the case of a tab close the browser will not schedule any work for future turns of the\n // event loop.\n const { cluster: performanceCluster, webglRendererInfo } = (await configuration.lensPerformance) ?? {\n cluster: 0,\n webglRendererInfo: \"unknown\",\n };\n\n const lensViewPersistence = new ExpiringPersistence<Date>(\n // 60 days expiration\n () => 60 * 24 * 60 * 60,\n new IndexedDBPersistence({ databaseName: \"recentLensViews\" })\n );\n\n merge(\n // Begin measuring LensCore apply time once the lens has finished downloading and we actually add the lens\n // to LensCore (LensWait measures the full download + LensCore apply time i.e. perceived UX latency).\n lensState.events.pipe(\n forActions(\"downloadComplete\"),\n map(([a]) => a.data)\n ),\n\n // If the session is resumed (e.g. user returns to this tab while a lens is on), we count this as a new\n // LensView (and applyDelaySec will be 0).\n lensState.events.pipe(\n inStates(\"lensApplied\"),\n switchMap(([, s]) =>\n sessionState.events.pipe(\n forActions(\"resume\"),\n takeUntil(lensState.events.pipe(forActions(\"removeLens\"))),\n map(() => s.data)\n )\n )\n )\n )\n .pipe(\n map((lens): [number, string, string] => [getTimeMs(), lens.id, lens.groupId]),\n mergeMap(([applyLensStartTime, lensId, lensGroupId]) => {\n const alreadyOn = isState(lensState.getState(), \"lensApplied\");\n\n const applyDelay = alreadyOn\n ? of(0)\n : lensState.events.pipe(\n forActions(\"resourcesLoaded\"),\n filter(([a]) => a.data.id === lensId),\n // Applying a new lens may happen before removing the old one, so if we kept taking events\n // we would get the lensResourcesLoaded for the next lens, too.\n take(1),\n map(() => (getTimeMs() - applyLensStartTime) / 1000)\n );\n\n const viewMetrics = (\n alreadyOn\n ? of([getTimeMs(), session.metrics.beginMeasurement()] as const)\n : lensState.events.pipe(\n forActions(\"turnedOn\"),\n filter(([a]) => a.data.id === lensId),\n map(() => [getTimeMs(), session.metrics.beginMeasurement()] as const)\n )\n ).pipe(\n take(1),\n mergeMap(([lensTurnedOnTime, metricsMeasurement]) =>\n lensState.events.pipe(\n forActions(\"turnedOff\"),\n // Applying a new lens may happen before removing the old one, so we'll get a\n // lensTurnedOff for the prior lens (if one was applied), which we must filter out.\n filter(([a]) => a.data.id === lensId),\n // If the session is suspended, we'll count that as the lens turning off.\n raceWith(sessionState.events.pipe(forActions(\"suspend\"))),\n map(() => {\n metricsMeasurement.end();\n return {\n viewTimeSec: (getTimeMs() - lensTurnedOnTime) / 1000,\n ...metricsMeasurement.measure(),\n };\n })\n )\n )\n );\n\n return applyDelay.pipe(\n combineLatestWith(viewMetrics, from(isFirstTimeWithinPeriods(lensId, lensViewPersistence))),\n // This lens should always receive the lensTurnedOff action *before* the next lens is\n // turned on. But just in case that assumption is violated, we'll clean up\n // (and not report) if another lens turns on before our lens is turned off.\n takeUntil(\n lensState.events.pipe(\n forActions(\"turnedOn\"),\n filter(([a]) => a.data.id !== lensId)\n )\n ),\n take(1),\n map(([applyDelaySec, viewMetrics, isFirstTimeResults]) => ({\n applyDelaySec,\n lensId,\n lensGroupId,\n ...viewMetrics,\n ...isFirstTimeResults,\n }))\n );\n })\n )\n .subscribe({\n next: async ({\n applyDelaySec,\n lensId,\n lensGroupId,\n viewTimeSec,\n avgFps,\n lensFrameProcessingTimeMsAvg,\n lensFrameProcessingTimeMsStd,\n lensFrameProcessingTimeMsMedian,\n lensFrameProcessingN,\n isLensFirstWithinDay,\n isLensFirstWithinMonth,\n }) => {\n if (viewTimeSec < viewTimeThresholdSec) return;\n\n const lensView: LensView = {\n name: \"lensView\",\n applyDelaySec,\n avgFps,\n lensId,\n lensGroupId,\n lensFrameProcessingTimeMsAvg,\n lensFrameProcessingTimeMsStd,\n // We don't support recording video, but applications may do this without our knowledge.\n recordingTimeSec: 0,\n viewTimeSec,\n isLensFirstWithinDay,\n isLensFirstWithinMonth,\n performanceCluster: `${performanceCluster}`,\n webglRendererInfo,\n };\n\n metricsEventTarget.dispatchEvent(new TypedCustomEvent(\"lensView\", lensView));\n metrics.setOperationalMetrics(Histogram.level(\"lens_view\", viewTimeSec * 1000));\n\n // The first few frames will typically take much longer to process (as they might involve requesting\n // remote assets to be downloaded, or other high-latency initialization steps) -- so we'll skip\n // reporting views with a very small number of frames.\n if (lensFrameProcessingN >= 30) {\n metrics.setOperationalMetrics(\n Histogram.level(\"lens_view_frame-processing-time\", lensFrameProcessingTimeMsMedian, {\n performance_cluster: performanceCluster.toString(),\n })\n );\n }\n },\n });\n }\n);\n"]}
|
|
1
|
+
{"version":3,"file":"reportLensView.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reportLensView.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACvH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,C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switchMap, take, takeUntil } from \"rxjs\";\nimport { forActions, inStates, isState } from \"@snap/state-management\";\nimport { Injectable } from \"@snap/ts-inject\";\nimport { TypedCustomEvent } from \"../../events/TypedCustomEvent\";\nimport type { MetricsEventTarget } from \"../metricsEventTarget\";\nimport { metricsEventTargetFactory } from \"../metricsEventTarget\";\nimport type { CameraKitSession } from \"../../session/CameraKitSession\";\nimport { cameraKitSessionFactory } from \"../../session/CameraKitSession\";\nimport type { MakeTaggedBusinessEvent } from \"../businessEventsReporter\";\nimport { getTimeMs } from \"../../common/time\";\nimport type { CameraKitConfiguration } from \"../../configuration\";\nimport { configurationToken } from \"../../configuration\";\nimport type { LensState } from \"../../session/lensState\";\nimport { lensStateFactory } from \"../../session/lensState\";\nimport type { SessionState } from \"../../session/sessionState\";\nimport { sessionStateFactory } from \"../../session/sessionState\";\nimport { Histogram } from \"../operational/Histogram\";\nimport { IndexedDBPersistence } from \"../../persistence/IndexedDBPersistence\";\nimport { ExpiringPersistence } from \"../../persistence/ExpiringPersistence\";\nimport { dayFormatter, monthFormatter } from \"../../common/date\";\nimport type { MetricsClient } from \"../../clients/metricsClient\";\nimport { metricsClientFactory } from \"../../clients/metricsClient\";\n\n// We ignore short-duration lens views.\n//\n// The value is documented here:\n// https://docs.google.com/document/d/1-kSzFWCWw9Qo3D08FR1_cqeHTsUtk9p3p3uOptzWDTY/edit#heading=h.q5liip76r9lt\nconst viewTimeThresholdSec = 0.1;\n\nasync function isFirstTimeWithinPeriods(lensId: string, persistence: ExpiringPersistence<Date>) {\n let isLensFirstWithinDay = false;\n let isLensFirstWithinMonth = false;\n\n try {\n const lensLastViewDate = await persistence.retrieve(lensId);\n const currentDate = new Date();\n\n if (!lensLastViewDate) {\n isLensFirstWithinDay = true;\n isLensFirstWithinMonth = true;\n } else {\n isLensFirstWithinDay = dayFormatter.format(lensLastViewDate) !== dayFormatter.format(currentDate);\n isLensFirstWithinMonth = monthFormatter.format(lensLastViewDate) !== monthFormatter.format(currentDate);\n }\n\n await persistence.store(lensId, currentDate);\n } catch (error) {\n console.error(`Error handling persistence for lensId ${lensId}: ${error}`);\n isLensFirstWithinDay = false;\n isLensFirstWithinMonth = false;\n }\n\n return { isLensFirstWithinDay, isLensFirstWithinMonth };\n}\n\n/**\n * The LensView metric is emitted after a lens has been viewed (for longer than 100ms), when the lens is turned off.\n *\n * It contains information about rendering performance.\n *\n * Notes:\n * - If the page is hidden (e.g. user switches to a different tab, or application, or closes the tab, or closes the\n * browser, navigates to a new page, refreshes, etc.) this metric will be emitted at that time. This is to ensure\n * we don't lose the metric if the page is closed.\n * - If the page is hidden and then made visible again later (e.g. user switches to a different tab, then back), we\n * will begin measuring a new LensView. That is, we will not capture the time when the page is hidden even if the\n * lens is still rendering in the background.\n *\n * @category Lenses\n * @category Metrics\n */\n// This type corresponds to the internal CameraKitLensSwipe event, described here:\n// https://docs.google.com/document/d/1-kSzFWCWw9Qo3D08FR1_cqeHTsUtk9p3p3uOptzWDTY#heading=h.q5liip76r9lt\nexport type LensView = MakeTaggedBusinessEvent<\"lensView\">;\n\n/**\n * @internal\n */\nexport const reportLensView = Injectable(\n \"reportLensView\",\n [\n cameraKitSessionFactory.token,\n lensStateFactory.token,\n sessionStateFactory.token,\n metricsEventTargetFactory.token,\n metricsClientFactory.token,\n configurationToken,\n ] as const,\n async (\n session: CameraKitSession,\n lensState: LensState,\n sessionState: SessionState,\n metricsEventTarget: MetricsEventTarget,\n metrics: MetricsClient,\n configuration: CameraKitConfiguration\n ): Promise<void> => {\n // We need to do this await up front so that it won't interrupt reporting the metric when the session is\n // suspended -- suspension could happen because the tab is closing, in which case we cannot perform await a\n // Promise, because in the case of a tab close the browser will not schedule any work for future turns of the\n // event loop.\n const { cluster: performanceCluster, webglRendererInfo } = (await configuration.lensPerformance) ?? {\n cluster: 0,\n webglRendererInfo: \"unknown\",\n };\n\n const lensViewPersistence = new ExpiringPersistence<Date>(\n // 60 days expiration\n () => 60 * 24 * 60 * 60,\n new IndexedDBPersistence({ databaseName: \"recentLensViews\" })\n );\n\n merge(\n // Begin measuring LensCore apply time once the lens has finished downloading and we actually add the lens\n // to LensCore (LensWait measures the full download + LensCore apply time i.e. perceived UX latency).\n lensState.events.pipe(\n forActions(\"downloadComplete\"),\n map(([a]) => a.data)\n ),\n\n // If the session is resumed (e.g. user returns to this tab while a lens is on), we count this as a new\n // LensView (and applyDelaySec will be 0).\n lensState.events.pipe(\n inStates(\"lensApplied\"),\n switchMap(([, s]) =>\n sessionState.events.pipe(\n forActions(\"resume\"),\n takeUntil(lensState.events.pipe(forActions(\"removeLens\"))),\n map(() => s.data)\n )\n )\n )\n )\n .pipe(\n map((lens): [number, string, string] => [getTimeMs(), lens.id, lens.groupId]),\n mergeMap(([applyLensStartTime, lensId, lensGroupId]) => {\n const alreadyOn = isState(lensState.getState(), \"lensApplied\");\n\n const applyDelay = alreadyOn\n ? of(0)\n : lensState.events.pipe(\n forActions(\"resourcesLoaded\"),\n filter(([a]) => a.data.id === lensId),\n // Applying a new lens may happen before removing the old one, so if we kept taking events\n // we would get the lensResourcesLoaded for the next lens, too.\n take(1),\n map(() => (getTimeMs() - applyLensStartTime) / 1000)\n );\n\n const viewMetrics = (\n alreadyOn\n ? of([getTimeMs(), session.metrics.beginMeasurement()] as const)\n : lensState.events.pipe(\n forActions(\"turnedOn\"),\n filter(([a]) => a.data.id === lensId),\n map(() => [getTimeMs(), session.metrics.beginMeasurement()] as const)\n )\n ).pipe(\n take(1),\n mergeMap(([lensTurnedOnTime, metricsMeasurement]) =>\n lensState.events.pipe(\n forActions(\"turnedOff\"),\n // Applying a new lens may happen before removing the old one, so we'll get a\n // lensTurnedOff for the prior lens (if one was applied), which we must filter out.\n filter(([a]) => a.data.id === lensId),\n // If the session is suspended, we'll count that as the lens turning off.\n raceWith(sessionState.events.pipe(forActions(\"suspend\"))),\n map(() => {\n metricsMeasurement.end();\n return {\n viewTimeSec: (getTimeMs() - lensTurnedOnTime) / 1000,\n ...metricsMeasurement.measure(),\n };\n })\n )\n )\n );\n\n return applyDelay.pipe(\n combineLatestWith(viewMetrics, from(isFirstTimeWithinPeriods(lensId, lensViewPersistence))),\n // This lens should always receive the lensTurnedOff action *before* the next lens is\n // turned on. But just in case that assumption is violated, we'll clean up\n // (and not report) if another lens turns on before our lens is turned off.\n takeUntil(\n lensState.events.pipe(\n forActions(\"turnedOn\"),\n filter(([a]) => a.data.id !== lensId)\n )\n ),\n take(1),\n map(([applyDelaySec, viewMetrics, isFirstTimeResults]) => ({\n applyDelaySec,\n lensId,\n lensGroupId,\n ...viewMetrics,\n ...isFirstTimeResults,\n }))\n );\n })\n )\n .subscribe({\n next: async ({\n applyDelaySec,\n lensId,\n lensGroupId,\n viewTimeSec,\n avgFps,\n lensFrameProcessingTimeMsAvg,\n lensFrameProcessingTimeMsStd,\n lensFrameProcessingTimeMsMedian,\n lensFrameProcessingN,\n isLensFirstWithinDay,\n isLensFirstWithinMonth,\n }) => {\n if (viewTimeSec < viewTimeThresholdSec) return;\n\n const lensView: LensView = {\n name: \"lensView\",\n applyDelaySec,\n avgFps,\n lensId,\n lensGroupId,\n lensFrameProcessingTimeMsAvg,\n lensFrameProcessingTimeMsStd,\n // We don't support recording video, but applications may do this without our knowledge.\n recordingTimeSec: 0,\n viewTimeSec,\n isLensFirstWithinDay,\n isLensFirstWithinMonth,\n performanceCluster: `${performanceCluster}`,\n webglRendererInfo,\n };\n\n metricsEventTarget.dispatchEvent(new TypedCustomEvent(\"lensView\", lensView));\n metrics.setOperationalMetrics(Histogram.level(\"lens_view\", viewTimeSec * 1000));\n\n // The first few frames will typically take much longer to process (as they might involve requesting\n // remote assets to be downloaded, or other high-latency initialization steps) -- so we'll skip\n // reporting views with a very small number of frames.\n if (lensFrameProcessingN >= 30) {\n metrics.setOperationalMetrics(\n Histogram.level(\"lens_view_frame-processing-time\", lensFrameProcessingTimeMsMedian, {\n performance_cluster: performanceCluster.toString(),\n })\n );\n }\n },\n });\n }\n);\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { forActions } from "@snap/state-management";
|
|
2
2
|
import { map, mergeMap, take } from "rxjs";
|
|
3
|
+
import { Injectable } from "@snap/ts-inject";
|
|
3
4
|
import { getTimeMs } from "../../common/time";
|
|
4
|
-
import { Injectable } from "../../dependency-injection/Injectable";
|
|
5
5
|
import { TypedCustomEvent } from "../../events/TypedCustomEvent";
|
|
6
6
|
import { lensStateFactory } from "../../session/lensState";
|
|
7
7
|
import { metricsEventTargetFactory } from "../metricsEventTarget";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reportLensWait.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reportLensWait.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"reportLensWait.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reportLensWait.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAMlE,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAwBjC,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CACpC,gBAAgB,EAChB,CAAC,gBAAgB,CAAC,KAAK,EAAE,yBAAyB,CAAC,KAAK,CAAU,EAClE,CAAC,SAAoB,EAAE,kBAAsC,EAAE,EAAE;IAC7D,SAAS,CAAC,MAAM;SACX,IAAI,CACD,UAAU,CAAC,WAAW,CAAC,EACvB,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE;QACb,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;QACxC,MAAM,kBAAkB,GAAG,SAAS,EAAE,CAAC;QACvC,OAAO,SAAS,CAAC,MAAM,CAAC,IAAI,CAWxB,UAAU,CAAC,qBAAqB,EAAE,WAAW,CAAC,EAC9C,IAAI,CAAC,CAAC,CAAC,EACP,GAAG,CAAC,GAA6B,EAAE,CAAC;YAChC,CAAC,SAAS,EAAE,GAAG,kBAAkB,CAAC,GAAG,IAAI;YACzC,MAAM;YACN,WAAW;SACd,CAAC,CACL,CAAC;IACN,CAAC,CAAC,CACL;SACA,SAAS,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,EAAE;YACzC,IAAI,WAAW,GAAG,oBAAoB;gBAAE,OAAO;YAE/C,MAAM,QAAQ,GAAa;gBACvB,IAAI,EAAE,UAAU;gBAChB,MAAM;gBACN,WAAW;gBACX,WAAW;aACd,CAAC;YACF,kBAAkB,CAAC,aAAa,CAAC,IAAI,gBAAgB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;QACjF,CAAC;KACJ,CAAC,CAAC;AACX,CAAC,CACJ,CAAC","sourcesContent":["import { forActions } from \"@snap/state-management\";\nimport { map, mergeMap, take } from \"rxjs\";\nimport { Injectable } from \"@snap/ts-inject\";\nimport { getTimeMs } from \"../../common/time\";\nimport { TypedCustomEvent } from \"../../events/TypedCustomEvent\";\nimport type { LensState } from \"../../session/lensState\";\nimport { lensStateFactory } from \"../../session/lensState\";\nimport type { MakeTaggedBusinessEvent } from \"../businessEventsReporter\";\nimport type { MetricsEventTarget } from \"../metricsEventTarget\";\nimport { metricsEventTargetFactory } from \"../metricsEventTarget\";\n\n// We ignore short-duration lens waits.\n//\n// The value is documented here:\n// https://docs.google.com/document/d/1-kSzFWCWw9Qo3D08FR1_cqeHTsUtk9p3p3uOptzWDTY/edit#heading=h.q5liip76r9lt\nconst viewTimeThresholdSec = 0.1;\n\n/**\n * The LensWait metric measures the time spent downloading the lens content and required assets. It gives an indication\n * of the real UX impact of download latency. If lens content and assets are pre-loaded, the latency measured here\n * should decrease – we measure between the request to apply a lens and when the lens is ready to render.\n *\n * @category Lenses\n * @category Metrics\n */\n// This type corresponds to the internal CameraKitLensSpin event, described here:\n// https://docs.google.com/document/d/1-kSzFWCWw9Qo3D08FR1_cqeHTsUtk9p3p3uOptzWDTY#heading=h.q5liip76r9lt\nexport type LensWait = MakeTaggedBusinessEvent<\"lensWait\">;\n\n/**\n * Each time a lens is applied, we measure the duration until the lens is fully loaded by LensCore. This\n * includes any time spent downloading the lens content and required assets from the lens manifest.\n *\n * The intention of this event is to measure the experienced UX latency between a user requesting a lens and\n * the lens rendering. Of course, the application may call `applyLens` at any time, and may hide/show the\n * rendered result at any time – but this should give us a good baseline for how much UX latency could be seen.\n *\n * @internal\n */\nexport const reportLensWait = Injectable(\n \"reportLensWait\",\n [lensStateFactory.token, metricsEventTargetFactory.token] as const,\n (lensState: LensState, metricsEventTarget: MetricsEventTarget) => {\n lensState.events\n .pipe(\n forActions(\"applyLens\"),\n mergeMap(([a]) => {\n const lensId = a.data.lens.id;\n const lensGroupId = a.data.lens.groupId;\n const applyLensStartTime = getTimeMs();\n return lensState.events.pipe(\n // We'll measure the time until either the requested lens was rendered, or a new applyLens\n // request was made (in both cases, we're done waiting for this lens).\n //\n // This does have the side-effect that if a user rapidly switches between lenses, we'll record\n // many low-duration lensWait events that are measuring user behavior instead of system latency.\n // But this is a good trade-off so that we can capture those long-duration lensWaits that are\n // terminated by the user trying a different lens.\n //\n // (This effect can be mitigated by increasing the viewtimeThresholdSec to ignore low-duration\n // waits that are likely caused by user behavior).\n forActions(\"firstFrameProcessed\", \"applyLens\"),\n take(1),\n map((): [number, string, string] => [\n (getTimeMs() - applyLensStartTime) / 1000,\n lensId,\n lensGroupId,\n ])\n );\n })\n )\n .subscribe({\n next: ([viewTimeSec, lensId, lensGroupId]) => {\n if (viewTimeSec < viewTimeThresholdSec) return;\n\n const lensWait: LensWait = {\n name: \"lensWait\",\n lensId,\n viewTimeSec,\n lensGroupId,\n };\n metricsEventTarget.dispatchEvent(new TypedCustomEvent(\"lensWait\", lensWait));\n },\n });\n }\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reportPlatformCapabilities.d.ts","sourceRoot":"","sources":["../../../src/metrics/reporters/reportPlatformCapabilities.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reportPlatformCapabilities.d.ts","sourceRoot":"","sources":["../../../src/metrics/reporters/reportPlatformCapabilities.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAMjE;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B;;;;CAStC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
|
+
import { Injectable } from "@snap/ts-inject";
|
|
2
3
|
import { metricsClientFactory } from "../../clients/metricsClient";
|
|
3
|
-
import { Injectable } from "../../dependency-injection/Injectable";
|
|
4
4
|
import { getPlatformCapabilities } from "../../platform/platformCapabilities";
|
|
5
5
|
import { Count } from "../operational/Count";
|
|
6
6
|
import { joinMetricNames } from "../operational/Metric";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reportPlatformCapabilities.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reportPlatformCapabilities.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"reportPlatformCapabilities.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reportPlatformCapabilities.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAQxD,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAChD,4BAA4B,EAC5B,CAAC,oBAAoB,CAAC,KAAK,CAAU,EACrC,CAAO,OAAsB,EAAE,EAAE;IAC7B,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,uBAAuB,EAAE,CAAC;IAC/D,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5G,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1G,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChH,CAAC,CAAA,CACJ,CAAC","sourcesContent":["import { Injectable } from \"@snap/ts-inject\";\nimport type { MetricsClient } from \"../../clients/metricsClient\";\nimport { metricsClientFactory } from \"../../clients/metricsClient\";\nimport { getPlatformCapabilities } from \"../../platform/platformCapabilities\";\nimport { Count } from \"../operational/Count\";\nimport { joinMetricNames } from \"../operational/Metric\";\n\n/**\n * Report the number of total page loads that have support for various capabilities. By dividing by the total number of\n * data points recorded, we can calculate the percent of page loads with support.\n *\n * @internal\n */\nexport const reportPlatformCapabilities = Injectable(\n \"reportPlatformCapabilities\",\n [metricsClientFactory.token] as const,\n async (metrics: MetricsClient) => {\n const { webgl, wasm, webxr } = await getPlatformCapabilities();\n metrics.setOperationalMetrics(Count.count(joinMetricNames([\"platform\", \"webgl\"]), webgl.supported ? 1 : 0));\n metrics.setOperationalMetrics(Count.count(joinMetricNames([\"platform\", \"wasm\"]), wasm.supported ? 1 : 0));\n metrics.setOperationalMetrics(Count.count(joinMetricNames([\"platform\", \"webxr\"]), webxr.supported ? 1 : 0));\n }\n);\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Injectable } from "
|
|
1
|
+
import { Injectable } from "@snap/ts-inject";
|
|
2
2
|
import { lensStateFactory } from "../../session/lensState";
|
|
3
3
|
import { reportGlobalException } from "./reportGlobalException";
|
|
4
4
|
export const reportSessionException = Injectable("reportSessionException", [reportGlobalException.token, lensStateFactory.token], (globalExceptionReporter, lensState) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reportSessionException.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reportSessionException.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"reportSessionException.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reportSessionException.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAOhE,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAC5C,wBAAwB,EACxB,CAAC,qBAAqB,CAAC,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAU,EAC9D,CAAC,uBAAgD,EAAE,SAAoB,EAAE,EAAE;IACvE,uBAAuB,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;AACzD,CAAC,CACJ,CAAC","sourcesContent":["import { Injectable } from \"@snap/ts-inject\";\nimport type { LensState } from \"../../session/lensState\";\nimport { lensStateFactory } from \"../../session/lensState\";\nimport type { GlobalExceptionReporter } from \"./reportGlobalException\";\nimport { reportGlobalException } from \"./reportGlobalException\";\n\n/**\n * Reports log entries to Blizzard during a CameraKit session.\n *\n * @internal\n */\nexport const reportSessionException = Injectable(\n \"reportSessionException\",\n [reportGlobalException.token, lensStateFactory.token] as const,\n (globalExceptionReporter: GlobalExceptionReporter, lensState: LensState) => {\n globalExceptionReporter.attachLensContext(lensState);\n }\n);\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
|
+
import { Injectable } from "@snap/ts-inject";
|
|
2
3
|
import { dayFormatter, monthFormatter } from "../../common/date";
|
|
3
|
-
import { Injectable } from "../../dependency-injection/Injectable";
|
|
4
4
|
import { TypedCustomEvent } from "../../events/TypedCustomEvent";
|
|
5
5
|
import { DailySessionBucket } from "../../generated-proto/blizzard/cameraKitEvents";
|
|
6
6
|
import { IndexedDBPersistence } from "../../persistence/IndexedDBPersistence";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reportUserSession.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reportUserSession.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"reportUserSession.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reportUserSession.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mB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rB,IAAI,EAAE,SAAS;QACf,kBAAkB;QAClB,kBAAkB;QAClB,KAAK,EAAE,GAAG,KAAK,EAAE;QACjB,GAAG,EAAE,GAAG,GAAG,EAAE;QACb,IAAI,EAAE,GAAG,IAAI,EAAE;KAClB,CAAC;IACF,kBAAkB,CAAC,aAAa,CAAC,IAAI,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AAC/E,CAAC,CAAA,CACJ,CAAC","sourcesContent":["import { Injectable } from \"@snap/ts-inject\";\nimport { dayFormatter, monthFormatter } from \"../../common/date\";\nimport { TypedCustomEvent } from \"../../events/TypedCustomEvent\";\nimport { DailySessionBucket } from \"../../generated-proto/blizzard/cameraKitEvents\";\nimport { IndexedDBPersistence } from \"../../persistence/IndexedDBPersistence\";\nimport type { MakeTaggedBusinessEvent } from \"../businessEventsReporter\";\nimport type { MetricsEventTarget } from \"../metricsEventTarget\";\nimport { metricsEventTargetFactory } from \"../metricsEventTarget\";\n\ninterface UserSessionInfo {\n mostRecentSessionStartDate: Date;\n dailySessionBucket: DailySessionBucket;\n}\n\n/**\n * The Session metric reports each user session.\n */\nexport type Session = MakeTaggedBusinessEvent<\"session\">;\n\n/**\n * @internal\n */\nexport const reportUserSession = Injectable(\n \"reportUserSession\",\n [metricsEventTargetFactory.token] as const,\n async (metricsEventTarget: MetricsEventTarget): Promise<void> => {\n const userSessionKey = \"userSessionInfo\";\n const db = new IndexedDBPersistence<UserSessionInfo>({ databaseName: \"SessionHistory\" });\n // We standardize all user dates to PST as per our documentation:\n // https://docs.google.com/document/d/1-kSzFWCWw9Qo3D08FR1_cqeHTsUtk9p3p3uOptzWDTY/\n const date = new Date();\n const formattedDate = dayFormatter.format(date);\n const formattedDateParts = dayFormatter.formatToParts(date);\n const { day, month, year } = formattedDateParts.reduce(\n (acc: Record<string, number>, { type, value }) => ({\n ...acc,\n [type]: parseInt(value),\n }),\n {}\n );\n\n const userSessionInfo = await db.retrieve(userSessionKey);\n const mostRecentSessionStartDate = userSessionInfo?.mostRecentSessionStartDate;\n const formattedMostRecentSessionStartDate = mostRecentSessionStartDate\n ? dayFormatter.format(mostRecentSessionStartDate)\n : null;\n\n const dailySessionBucketMap = new Map<number, DailySessionBucket>([\n [1, DailySessionBucket.ONE_SESSION],\n [2, DailySessionBucket.TWO_SESSION],\n [3, DailySessionBucket.THREE_SESSION],\n [4, DailySessionBucket.FOUR_SESSION],\n [5, DailySessionBucket.FIVE_SESSION],\n [6, DailySessionBucket.SIX_SESSION],\n [7, DailySessionBucket.SEVEN_SESSION],\n [8, DailySessionBucket.EIGHT_SESSION],\n [9, DailySessionBucket.NINE_SESSION],\n ]);\n let dailySessionBucket = userSessionInfo?.dailySessionBucket ?? DailySessionBucket.NO_SESSION_BUCKET;\n let isFirstWithinMonth = false;\n if (formattedMostRecentSessionStartDate === formattedDate) {\n dailySessionBucket =\n dailySessionBucketMap.get(dailySessionBucket + 1) ?? DailySessionBucket.TEN_OR_MORE_SESSION;\n await db.store(userSessionKey, {\n mostRecentSessionStartDate: date,\n dailySessionBucket,\n });\n } else {\n isFirstWithinMonth =\n !mostRecentSessionStartDate ||\n monthFormatter.format(mostRecentSessionStartDate) !== monthFormatter.format(date);\n await db.store(userSessionKey, {\n mostRecentSessionStartDate: date,\n dailySessionBucket: (dailySessionBucket = DailySessionBucket.ONE_SESSION),\n });\n }\n const session: Session = {\n name: \"session\",\n dailySessionBucket,\n isFirstWithinMonth,\n month: `${month}`,\n day: `${day}`,\n year: `${year}`,\n };\n metricsEventTarget.dispatchEvent(new TypedCustomEvent(\"session\", session));\n }\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reporters.d.ts","sourceRoot":"","sources":["../../../src/metrics/reporters/reporters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"reporters.d.ts","sourceRoot":"","sources":["../../../src/metrics/reporters/reporters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAYnD;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;EAKC,CAAC;AAE1C;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;EAKE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PartialContainer } from "
|
|
1
|
+
import { PartialContainer } from "@snap/ts-inject";
|
|
2
2
|
import { reportSessionException } from "./reportSessionException";
|
|
3
3
|
import { reportBenchmarks } from "./reportBenchmarks";
|
|
4
4
|
import { reportHttpMetrics } from "./reportHttpMetrics";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reporters.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reporters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"reporters.js","sourceRoot":"","sources":["../../../src/metrics/reporters/reporters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAS1E,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,gBAAgB,CAAC,EAAE,CAAC;KAC9D,QAAQ,CAAC,iBAAiB,CAAC;KAC3B,QAAQ,CAAC,gBAAgB,CAAC;KAC1B,QAAQ,CAAC,0BAA0B,CAAC;KACpC,QAAQ,CAAC,gBAAgB,CAAC;KAC1B,QAAQ,CAAC,0BAA0B,CAAC,CAAC;AAM1C,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,gBAAgB,CAAC,EAAE,CAAC;KAC7D,QAAQ,CAAC,iBAAiB,CAAC;KAC3B,QAAQ,CAAC,cAAc,CAAC;KACxB,QAAQ,CAAC,cAAc,CAAC;KACxB,QAAQ,CAAC,sBAAsB,CAAC;KAChC,QAAQ,CAAC,0BAA0B,CAAC,CAAC","sourcesContent":["import { PartialContainer } from \"@snap/ts-inject\";\nimport { reportSessionException } from \"./reportSessionException\";\nimport { reportBenchmarks } from \"./reportBenchmarks\";\nimport { reportHttpMetrics } from \"./reportHttpMetrics\";\nimport { reportLegalState } from \"./reportLegalState\";\nimport { reportLensAndAssetDownload } from \"./reportLensAndAssetDownload\";\nimport { reportLensValidationFailed } from \"./reportLensValidationFailed\";\nimport { reportLensView } from \"./reportLensView\";\nimport { reportLensWait } from \"./reportLensWait\";\nimport { reportUserSession } from \"./reportUserSession\";\nimport { reportPlatformCapabilities } from \"./reportPlatformCapabilities\";\n\n/**\n * These metrics reporters must be run once in the top-level DI container. They only depend on globally-available\n * services.\n *\n * The businessEventsReporter is special, it doesn't create any of its own metrics, it simply listens to the global\n * metricsEventTarget and reports metrics emitted there to our backend.\n */\nexport const reportGloballyScopedMetrics = new PartialContainer({})\n .provides(reportHttpMetrics)\n .provides(reportBenchmarks)\n .provides(reportLensAndAssetDownload)\n .provides(reportLegalState)\n .provides(reportPlatformCapabilities);\n\n/**\n * These metrics reporters must be run once for each CameraKitSession DI container created. They may depend on services\n * which are only available at the session scope (e.g. the CameraKitSession itself).\n */\nexport const reportSessionScopedMetrics = new PartialContainer({})\n .provides(reportUserSession)\n .provides(reportLensView)\n .provides(reportLensWait)\n .provides(reportSessionException)\n .provides(reportLensValidationFailed);\n"]}
|
|
@@ -13,24 +13,14 @@ export type Capability<T = void> = SupportedCapability<T> | UnsupportedCapabilit
|
|
|
13
13
|
type WebGlCapability = Capability<{
|
|
14
14
|
maxTextureSize: number;
|
|
15
15
|
}>;
|
|
16
|
+
export interface WasmFeatures {
|
|
17
|
+
simd: boolean;
|
|
18
|
+
exceptionHandling: boolean;
|
|
19
|
+
relaxedSimd: boolean;
|
|
20
|
+
}
|
|
16
21
|
type WasmCapability = Capability<{
|
|
17
|
-
wasmFeatures:
|
|
22
|
+
wasmFeatures: WasmFeatures;
|
|
18
23
|
}>;
|
|
19
|
-
/**
|
|
20
|
-
* Because there may be a large number of WASM-related capabilities, and because these may correspond to various builds
|
|
21
|
-
* of LensCore, we encode the various WASM capabilities into a single number by bitwise OR-ing together the numbers
|
|
22
|
-
* corresponding to each capability.
|
|
23
|
-
*
|
|
24
|
-
* Since each combindation of capabilities is represented by a single number, we can easily map between that number and
|
|
25
|
-
* the corresponding LensCore build name that makes use of those capabilities.
|
|
26
|
-
*
|
|
27
|
-
* @internal
|
|
28
|
-
*/
|
|
29
|
-
export declare enum WasmFeatures {
|
|
30
|
-
Default = 0,
|
|
31
|
-
SIMD = 1,
|
|
32
|
-
ExceptionHandling = 2
|
|
33
|
-
}
|
|
34
24
|
type WebXrCapability = Capability<XrCapabilities>;
|
|
35
25
|
/**
|
|
36
26
|
* @returns A Promise containing an object with fields describing the support of various WebXR features. This object's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platformCapabilities.d.ts","sourceRoot":"","sources":["../../src/platform/platformCapabilities.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAI1E,gBAAgB;AAChB,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,SAAS,EA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AAsB,oBAAoB,IAAI,OAAO,CAAC,eAAe,CAAC,CAuBrE;AAED,gBAAgB;AAChB,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,eAAe,CAAC;IACvB,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,eAAe,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,6CAAqD,QAAQ,oBAAoB,CAAC,CAMpH,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
|
-
import { exceptions, simd } from "wasm-feature-detect";
|
|
2
|
+
import { exceptions as getExceptions, simd as getSimd, relaxedSimd as getRelaxedSimd } from "wasm-feature-detect";
|
|
3
3
|
import { memoize } from "../common/memoize";
|
|
4
4
|
import { platformNotSupportedError } from "../namedErrors";
|
|
5
5
|
import { getPlatformInfo } from "./platformInfo";
|
|
@@ -28,12 +28,6 @@ function getWebGlSupport() {
|
|
|
28
28
|
`${minRequiredMaxTextureSize}, but the browser's reported MAX_TEXTURE_SIZE is ${maxTextureSize}.`),
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
export var WasmFeatures;
|
|
32
|
-
(function (WasmFeatures) {
|
|
33
|
-
WasmFeatures[WasmFeatures["Default"] = 0] = "Default";
|
|
34
|
-
WasmFeatures[WasmFeatures["SIMD"] = 1] = "SIMD";
|
|
35
|
-
WasmFeatures[WasmFeatures["ExceptionHandling"] = 2] = "ExceptionHandling";
|
|
36
|
-
})(WasmFeatures || (WasmFeatures = {}));
|
|
37
31
|
function getWebAssemblyCapabilities() {
|
|
38
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
33
|
if (globalThis.WebAssembly === undefined)
|
|
@@ -41,16 +35,22 @@ function getWebAssemblyCapabilities() {
|
|
|
41
35
|
supported: false,
|
|
42
36
|
error: platformNotSupportedError("CameraKit requires WebAssembly, but this browser does not support WebAssembly."),
|
|
43
37
|
};
|
|
38
|
+
const [simd, exceptionHandling, relaxedSimd] = yield Promise.all([
|
|
39
|
+
getSimd().then((simd) => {
|
|
40
|
+
if (getPlatformInfo().browser.brand === "Safari")
|
|
41
|
+
return false;
|
|
42
|
+
return simd;
|
|
43
|
+
}),
|
|
44
|
+
getExceptions(),
|
|
45
|
+
getRelaxedSimd(),
|
|
46
|
+
]);
|
|
44
47
|
return {
|
|
45
48
|
supported: true,
|
|
46
|
-
wasmFeatures:
|
|
47
|
-
simd
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}),
|
|
52
|
-
exceptions().then((supported) => (supported ? WasmFeatures.ExceptionHandling : WasmFeatures.Default)),
|
|
53
|
-
])).reduce((features, feature) => features | feature, WasmFeatures.Default),
|
|
49
|
+
wasmFeatures: {
|
|
50
|
+
simd,
|
|
51
|
+
exceptionHandling,
|
|
52
|
+
relaxedSimd,
|
|
53
|
+
},
|
|
54
54
|
};
|
|
55
55
|
});
|
|
56
56
|
}
|