@ethioreview/review-widget-core 0.1.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,31 @@
1
+ import { type WidgetRatingResponse, type WidgetResolveResponse, type WidgetReviewsResponse, type WidgetReviewsWithRating, type WidgetTelemetryPayload } from "@ethioreview/review-widget-core-client";
2
+ export type { WidgetAuthor, WidgetLayoutType, WidgetRatingResponse, WidgetRegistryType, WidgetResolveResponse, WidgetReview, WidgetReviewsResponse, WidgetTelemetryEvent, WidgetTelemetryPayload, RatingDistribution, ReviewAggregateData, ReviewWidgetEmbedConfig, WidgetReviewsWithRating, } from "@ethioreview/review-widget-core-client";
3
+ export { CoreClient, type CoreClientOptions, buildReactEmbedSnippet, createReviewWidgetConfig, formatWidgetError, resolvePublicKey, } from "@ethioreview/review-widget-core-client";
4
+ export interface WidgetClientOptions {
5
+ baseUrl: string;
6
+ publicKey: string;
7
+ fetchImpl?: typeof fetch;
8
+ emitTelemetry?: (payload: WidgetTelemetryPayload) => void;
9
+ }
10
+ /** Thin wrapper around CoreClient with object-style fetchReviews params. */
11
+ export declare class WidgetApiClient {
12
+ private readonly client;
13
+ constructor(options: WidgetClientOptions);
14
+ fetchReviews(params: {
15
+ businessId: string;
16
+ page?: number;
17
+ limit?: number;
18
+ language?: string;
19
+ minStars?: number;
20
+ }): Promise<WidgetReviewsResponse>;
21
+ fetchRating(businessId: string): Promise<WidgetRatingResponse>;
22
+ fetchReviewsWithRating(params: {
23
+ businessId: string;
24
+ page?: number;
25
+ limit?: number;
26
+ language?: string;
27
+ minStars?: number;
28
+ }): Promise<WidgetReviewsWithRating>;
29
+ resolveWidget(widgetId: string): Promise<WidgetResolveResponse>;
30
+ }
31
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,oBAAoB,EACzB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AC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAS9B,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAGrE"}
package/dist/index.js ADDED
@@ -0,0 +1,36 @@
1
+ import { CoreClient, } from "@ethioreview/review-widget-core-client";
2
+ export { CoreClient, buildReactEmbedSnippet, createReviewWidgetConfig, formatWidgetError, resolvePublicKey, } from "@ethioreview/review-widget-core-client";
3
+ /** Thin wrapper around CoreClient with object-style fetchReviews params. */
4
+ export class WidgetApiClient {
5
+ constructor(options) {
6
+ this.client = new CoreClient({
7
+ baseUrl: options.baseUrl,
8
+ publicKey: options.publicKey,
9
+ fetchImpl: options.fetchImpl,
10
+ emitTelemetry: options.emitTelemetry,
11
+ });
12
+ }
13
+ async fetchReviews(params) {
14
+ return this.client.fetchReviews(params.businessId, {
15
+ page: params.page,
16
+ limit: params.limit,
17
+ language: params.language,
18
+ minStars: params.minStars,
19
+ });
20
+ }
21
+ async fetchRating(businessId) {
22
+ return this.client.fetchRating(businessId);
23
+ }
24
+ async fetchReviewsWithRating(params) {
25
+ return this.client.fetchReviewsWithRating(params.businessId, {
26
+ page: params.page,
27
+ limit: params.limit,
28
+ language: params.language,
29
+ minStars: params.minStars,
30
+ });
31
+ }
32
+ async resolveWidget(widgetId) {
33
+ return this.client.resolveWidget(widgetId);
34
+ }
35
+ }
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,UAAU,GAMV,MAAM,wCAAwC,CAAC;AAkBhD,OAAO,EACN,UAAU,EAEV,sBAAsB,EACtB,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,GAChB,MAAM,wCAAwC,CAAC;AAShD,4EAA4E;AAC5E,MAAM,OAAO,eAAe;IAG3B,YAAY,OAA4B;QACvC,IAAI,CAAC,MAAM,GAAG,IAAI,UAAU,CAAC;YAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,aAAa,EAAE,OAAO,CAAC,aAAa;SACpC,CAAC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,MAMlB;QACA,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,EAAE;YAClD,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;SACzB,CAAC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,UAAkB;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,sBAAsB,CAAC,MAM5B;QACA,OAAO,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,MAAM,CAAC,UAAU,EAAE;YAC5D,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;SACzB,CAAC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,QAAgB;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;CACD"}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@ethioreview/review-widget-core",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js",
9
+ "default": "./dist/index.js"
10
+ }
11
+ },
12
+ "main": "dist/index.js",
13
+ "types": "dist/index.d.ts",
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/ethioreview/review-widget.git",
20
+ "directory": "packages/core"
21
+ },
22
+ "publishConfig": {
23
+ "registry": "https://registry.npmjs.org",
24
+ "access": "public"
25
+ },
26
+ "dependencies": {
27
+ "@ethioreview/review-widget-core-client": "0.1.0"
28
+ },
29
+ "devDependencies": {
30
+ "typescript": "^5.9.0",
31
+ "vitest": "^3.2.4"
32
+ },
33
+ "scripts": {
34
+ "build": "tsc -p tsconfig.json",
35
+ "typecheck": "tsc -p tsconfig.json --noEmit",
36
+ "lint": "echo \"No lint configured\"",
37
+ "test": "vitest run"
38
+ }
39
+ }