@snap/push2web 0.11.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.
@@ -0,0 +1,4 @@
1
+ export { ErrorEvent, LensReceivedEvent, Push2WebEvents, State, SubscriptionChangedEvent, Push2Web, GenericErrorEvent, CommunicationErrorEvent, LensExcludedErrorEvent, SubscriptionInstance, } from "./Push2Web";
2
+ export { Lens } from "@snap/camera-kit";
3
+ export { Code } from "./generated-api-client/core/snap_status_code";
4
+ export { ListenLensPushResponse_ExcludedLens_Code } from "./generated-api-client/camera_kit/v3/push_to_device";
@@ -0,0 +1,3 @@
1
+ export { State, Push2Web, } from "./Push2Web";
2
+ export { Code } from "./generated-api-client/core/snap_status_code";
3
+ export { ListenLensPushResponse_ExcludedLens_Code } from "./generated-api-client/camera_kit/v3/push_to_device";
@@ -0,0 +1,3 @@
1
+ import type { OperationalMetricsReporter } from "@snap/camera-kit/lib/metrics/operational/operationalMetricsReporter";
2
+ import { Push2WebEvents } from "./Push2Web";
3
+ export declare function reportEvent(metricsReporter: OperationalMetricsReporter, event: Push2WebEvents): void;
@@ -0,0 +1,30 @@
1
+ function assertUnreachable(_) {
2
+ throw new Error("Reached unreachable code at runtime.");
3
+ }
4
+ // Document wich describes the operational metrics we send:
5
+ // https://docs.google.com/document/d/1wGadstNanzvB_7XYf7fMlQhsHi90p73CHtpD39r_d3g/edit?pli=1#
6
+ export function reportEvent(metricsReporter, event) {
7
+ const { type } = event;
8
+ switch (type) {
9
+ case "error": {
10
+ const dimensions = new Map();
11
+ if (event.detail.name === "CommunicationError") {
12
+ dimensions.set("type", "subscription").set("cause", event.detail.grpcStatus);
13
+ }
14
+ else if (event.detail.name === "LensExcludedError") {
15
+ dimensions.set("type", "lens_excluded").set("cause", event.detail.reason);
16
+ }
17
+ metricsReporter.count("push2web_error", 1, dimensions);
18
+ break;
19
+ }
20
+ case "lensReceived": {
21
+ metricsReporter.count("push2web_received", 1);
22
+ break;
23
+ }
24
+ case "subscriptionChanged": // do not report subscription changed events
25
+ break;
26
+ default: {
27
+ assertUnreachable(type);
28
+ }
29
+ }
30
+ }
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@snap/push2web",
3
+ "version": "0.11.0",
4
+ "license": "SEE LICENSE IN LICENSE FILE",
5
+ "description": "Extension for Camera Kit Web SDK. Create a lens in Lens Studio and send it to your web page.",
6
+ "homepage": "https://ar.snap.com/camera-kit",
7
+ "author": "Snap Inc.",
8
+ "main": "dist/public-api.js",
9
+ "types": "dist/public-api.d.ts",
10
+ "files": [
11
+ "dist",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "devDependencies": {
16
+ "@babel/preset-env": "7.22.5",
17
+ "@typescript-eslint/eslint-plugin": "5.59.2",
18
+ "@typescript-eslint/parser": "5.59.2",
19
+ "eslint": "8.40.0",
20
+ "jest": "29.5.0",
21
+ "ts-jest": "29.1.0",
22
+ "ts-proto": "1.110.0",
23
+ "typedoc": "0.24.8",
24
+ "typedoc-plugin-markdown": "3.15.3",
25
+ "typescript": "5.0.4"
26
+ },
27
+ "peerDependencies": {
28
+ "@snap/camera-kit": ">=0.11.0-alpha.1"
29
+ },
30
+ "dependencies": {
31
+ "@improbable-eng/grpc-web": "^0.15.0",
32
+ "browser-headers": "^0.4.1",
33
+ "long": "^4.0.0",
34
+ "protobufjs": "^6.11.3",
35
+ "rxjs": "^7.5.7"
36
+ }
37
+ }