@snipet/angular-widget 0.0.0-stage → 0.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.
@@ -0,0 +1,11 @@
1
+ import { InjectionToken } from "@angular/core";
2
+ import type { EnvironmentProviders } from "@angular/core";
3
+ import type { Snipet, WidgetInit } from "@snipet/widget";
4
+ export type * from "@snipet/widget";
5
+ /** The widget's API: `inject(SNIPET).open()`. Safe to call before the widget loads, and on the server (no-op). */
6
+ export declare const SNIPET: InjectionToken<Snipet>;
7
+ /**
8
+ * Mounts the chat widget when the app starts (in the browser only) and unmounts it with the app.
9
+ * `src` overrides where the widget script loads from; defaults to the CDN build of the installed version.
10
+ */
11
+ export declare function provideSnipet(config: WidgetInit, src?: string): EnvironmentProviders;
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ import { isPlatformBrowser } from "@angular/common";
2
+ import { DestroyRef, InjectionToken, PLATFORM_ID, inject, makeEnvironmentProviders, provideEnvironmentInitializer, } from "@angular/core";
3
+ import { snipet } from "@snipet/widget";
4
+ /** The widget's API: `inject(SNIPET).open()`. Safe to call before the widget loads, and on the server (no-op). */
5
+ export const SNIPET = new InjectionToken("SNIPET", { providedIn: "root", factory: () => snipet });
6
+ /**
7
+ * Mounts the chat widget when the app starts (in the browser only) and unmounts it with the app.
8
+ * `src` overrides where the widget script loads from; defaults to the CDN build of the installed version.
9
+ */
10
+ export function provideSnipet(config, src) {
11
+ return makeEnvironmentProviders([
12
+ provideEnvironmentInitializer(() => {
13
+ if (!isPlatformBrowser(inject(PLATFORM_ID)))
14
+ return;
15
+ snipet.init(config, src);
16
+ inject(DestroyRef).onDestroy(() => snipet.destroy());
17
+ }),
18
+ ]);
19
+ }
package/package.json CHANGED
@@ -1,6 +1,40 @@
1
1
  {
2
2
  "name": "@snipet/angular-widget",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.0.0",
4
+ "description": "Angular bindings for the Snipet chat widget.",
5
+ "type": "module",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/usesnipet/snipet.git",
9
+ "directory": "packages/angular-widget"
10
+ },
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ }
19
+ },
20
+ "sideEffects": false,
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "dependencies": {
25
+ "@snipet/widget": "0.0.0"
26
+ },
27
+ "peerDependencies": {
28
+ "@angular/common": ">=19",
29
+ "@angular/core": ">=19"
30
+ },
31
+ "devDependencies": {
32
+ "@angular/common": "^22.2.3",
33
+ "@angular/core": "^22.2.3",
34
+ "rxjs": "^7.8.2",
35
+ "typescript": "~6.0.3"
36
+ },
37
+ "scripts": {
38
+ "build": "tsc"
39
+ }
6
40
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.