@pvh-afl/core 1.0.16 → 1.0.18
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/dist/integrations/index.d.ts +2 -0
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +4 -0
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/integrations.module.d.ts.map +1 -1
- package/dist/integrations/integrations.module.js +10 -0
- package/dist/integrations/integrations.module.js.map +1 -1
- package/dist/integrations/reviews/index.d.ts +3 -0
- package/dist/integrations/reviews/index.d.ts.map +1 -0
- package/dist/integrations/reviews/index.js +6 -0
- package/dist/integrations/reviews/index.js.map +1 -0
- package/dist/integrations/reviews/judgeme.service.d.ts +86 -0
- package/dist/integrations/reviews/judgeme.service.d.ts.map +1 -0
- package/dist/integrations/reviews/judgeme.service.js +448 -0
- package/dist/integrations/reviews/judgeme.service.js.map +1 -0
- package/dist/integrations/reviews/judgeme.types.d.ts +127 -0
- package/dist/integrations/reviews/judgeme.types.d.ts.map +1 -0
- package/dist/integrations/reviews/judgeme.types.js +9 -0
- package/dist/integrations/reviews/judgeme.types.js.map +1 -0
- package/dist/integrations/swish/index.d.ts +3 -0
- package/dist/integrations/swish/index.d.ts.map +1 -0
- package/dist/integrations/swish/index.js +6 -0
- package/dist/integrations/swish/index.js.map +1 -0
- package/dist/integrations/swish/swish.service.d.ts +93 -0
- package/dist/integrations/swish/swish.service.d.ts.map +1 -0
- package/dist/integrations/swish/swish.service.js +478 -0
- package/dist/integrations/swish/swish.service.js.map +1 -0
- package/dist/integrations/swish/swish.types.d.ts +115 -0
- package/dist/integrations/swish/swish.types.d.ts.map +1 -0
- package/dist/integrations/swish/swish.types.js +9 -0
- package/dist/integrations/swish/swish.types.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Judge.me Reviews API Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for Judge.me Reviews integration.
|
|
5
|
+
* @see https://judge.me/api/docs
|
|
6
|
+
*/
|
|
7
|
+
import { IntegrationResponse } from '../integration.types';
|
|
8
|
+
/**
|
|
9
|
+
* JudgeMe service configuration
|
|
10
|
+
*/
|
|
11
|
+
export interface JudgeMeConfig {
|
|
12
|
+
/** Base URL for Judge.me API (e.g., https://judge.me/api/v1) */
|
|
13
|
+
baseUrl: string;
|
|
14
|
+
/** Shop domain for Shopify integration */
|
|
15
|
+
shopDomain: string;
|
|
16
|
+
/** Private API token for authenticated requests */
|
|
17
|
+
privateToken: string;
|
|
18
|
+
/** Public API token (optional, for client-side operations) */
|
|
19
|
+
publicToken?: string;
|
|
20
|
+
/** Request timeout in milliseconds (default: 10000) */
|
|
21
|
+
timeout?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Judge.me reviewer information
|
|
25
|
+
*/
|
|
26
|
+
export interface JudgeMeReviewer {
|
|
27
|
+
id: number;
|
|
28
|
+
email: string;
|
|
29
|
+
name: string;
|
|
30
|
+
phone: string | null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Judge.me review picture
|
|
34
|
+
*/
|
|
35
|
+
export interface JudgeMePicture {
|
|
36
|
+
urls: {
|
|
37
|
+
original: string;
|
|
38
|
+
small: string;
|
|
39
|
+
compact: string;
|
|
40
|
+
huge: string;
|
|
41
|
+
};
|
|
42
|
+
hidden: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Judge.me single review
|
|
46
|
+
*/
|
|
47
|
+
export interface JudgeMeReview {
|
|
48
|
+
id: number;
|
|
49
|
+
rating: number;
|
|
50
|
+
title: string;
|
|
51
|
+
body: string;
|
|
52
|
+
reviewer: JudgeMeReviewer;
|
|
53
|
+
pictures: JudgeMePicture[];
|
|
54
|
+
curated: string;
|
|
55
|
+
published: boolean;
|
|
56
|
+
hidden: boolean;
|
|
57
|
+
verified: string;
|
|
58
|
+
featured: boolean;
|
|
59
|
+
created_at: string;
|
|
60
|
+
updated_at: string;
|
|
61
|
+
has_published_pictures: boolean;
|
|
62
|
+
ip_address: string | null;
|
|
63
|
+
reviewer_name_format: string;
|
|
64
|
+
source: string;
|
|
65
|
+
reply: string | null;
|
|
66
|
+
replied_at: string | null;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Judge.me reviews list response
|
|
70
|
+
*/
|
|
71
|
+
export interface JudgeMeReviewsResponse {
|
|
72
|
+
reviews: JudgeMeReview[];
|
|
73
|
+
current_page: number;
|
|
74
|
+
per_page: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Judge.me product info
|
|
78
|
+
*/
|
|
79
|
+
export interface JudgeMeProduct {
|
|
80
|
+
id: number;
|
|
81
|
+
external_id: string;
|
|
82
|
+
name: string;
|
|
83
|
+
handle: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Judge.me product response
|
|
87
|
+
*/
|
|
88
|
+
export interface JudgeMeProductResponse {
|
|
89
|
+
product: JudgeMeProduct;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Judge.me review count response
|
|
93
|
+
*/
|
|
94
|
+
export interface JudgeMeCountResponse {
|
|
95
|
+
count: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Review submission request
|
|
99
|
+
*/
|
|
100
|
+
export interface JudgeMeSubmitRequest {
|
|
101
|
+
shopifyProductId: string;
|
|
102
|
+
rating: number;
|
|
103
|
+
title: string;
|
|
104
|
+
body: string;
|
|
105
|
+
reviewerName: string;
|
|
106
|
+
reviewerEmail: string;
|
|
107
|
+
pictureUrls?: string[];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get reviews request
|
|
111
|
+
*/
|
|
112
|
+
export interface JudgeMeGetReviewsRequest {
|
|
113
|
+
shopifyProductId: string;
|
|
114
|
+
page?: number;
|
|
115
|
+
perPage?: number;
|
|
116
|
+
sortBy?: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Reviews service interface
|
|
120
|
+
*/
|
|
121
|
+
export interface IReviewsService {
|
|
122
|
+
resolveProductId(shopifyProductId: string): Promise<IntegrationResponse<string>>;
|
|
123
|
+
getReviews(params: JudgeMeGetReviewsRequest): Promise<IntegrationResponse<JudgeMeReviewsResponse>>;
|
|
124
|
+
getReviewCount(shopifyProductId: string): Promise<IntegrationResponse<number>>;
|
|
125
|
+
submitReview(params: JudgeMeSubmitRequest): Promise<IntegrationResponse<JudgeMeReview>>;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=judgeme.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"judgeme.types.d.ts","sourceRoot":"","sources":["../../../src/integrations/reviews/judgeme.types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,mDAAmD;IACnD,YAAY,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAMD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE;QACJ,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,MAAM,EAAE,OAAO,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K,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAMD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,gBAAgB,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;IACjF,UAAU,CACR,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,mBAAmB,CAAC,sBAAsB,CAAC,CAAC,CAAC;IACxD,cAAc,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/E,YAAY,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAC;CACzF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"judgeme.types.js","sourceRoot":"","sources":["../../../src/integrations/reviews/judgeme.types.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/swish/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./swish.types"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./swish.service"), exports);
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/swish/index.ts"],"names":[],"mappings":";;;AAAA,wDAA8B;AAC9B,0DAAgC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { IntegrationResponse } from '../integration.types';
|
|
2
|
+
import { SwishConfig, SwishCreateSessionResponse, SwishCustomerProfileResponse, SwishMergeResponse, SwishItemsResponse, SwishAddItemResponse, SwishListsResponse, SwishListResponse, IWishlistService } from './swish.types';
|
|
3
|
+
/**
|
|
4
|
+
* Swish Wishlist Service
|
|
5
|
+
*
|
|
6
|
+
* Provides integration with Swish's Wishlist API.
|
|
7
|
+
* Handles:
|
|
8
|
+
* - Token/session management (POST /profiles/token)
|
|
9
|
+
* - Wishlist items (GET/POST/DELETE /items)
|
|
10
|
+
* - Wishlist lists (GET/POST/PATCH/DELETE /lists)
|
|
11
|
+
*
|
|
12
|
+
* @see https://developers.swish.app/swish-api/authentication
|
|
13
|
+
*/
|
|
14
|
+
export declare class SwishService implements IWishlistService {
|
|
15
|
+
private config;
|
|
16
|
+
private brand;
|
|
17
|
+
private readonly defaultTimeout;
|
|
18
|
+
/**
|
|
19
|
+
* Configure the service for a specific brand
|
|
20
|
+
*/
|
|
21
|
+
configure(brand: string, config: SwishConfig): void;
|
|
22
|
+
/**
|
|
23
|
+
* Check if the service is configured
|
|
24
|
+
*/
|
|
25
|
+
isConfigured(): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Create an anonymous session for guest users.
|
|
28
|
+
*/
|
|
29
|
+
createSession(): Promise<IntegrationResponse<SwishCreateSessionResponse>>;
|
|
30
|
+
/**
|
|
31
|
+
* Create or get a customer profile token for logged-in users.
|
|
32
|
+
*/
|
|
33
|
+
createCustomerProfile(customerId: string): Promise<IntegrationResponse<SwishCustomerProfileResponse>>;
|
|
34
|
+
/**
|
|
35
|
+
* Merge guest session into customer account.
|
|
36
|
+
*
|
|
37
|
+
* Per Swish API docs: "When a customer logs in, replace their session token
|
|
38
|
+
* with a customer token. To link the previous session to the new customer
|
|
39
|
+
* session, provide the customer and session IDs when creating the customer token."
|
|
40
|
+
*
|
|
41
|
+
* This calls POST /profiles/token with both customer and session to merge them.
|
|
42
|
+
*/
|
|
43
|
+
mergeSession(sessionGid: string, customerId: string): Promise<IntegrationResponse<SwishMergeResponse>>;
|
|
44
|
+
/**
|
|
45
|
+
* Get wishlist items with pagination.
|
|
46
|
+
*/
|
|
47
|
+
getItems(token: string, page?: number, limit?: number): Promise<IntegrationResponse<SwishItemsResponse>>;
|
|
48
|
+
/**
|
|
49
|
+
* Add item to wishlist.
|
|
50
|
+
*/
|
|
51
|
+
addItem(token: string, productId: string, variantId?: string, listId?: string): Promise<IntegrationResponse<SwishAddItemResponse>>;
|
|
52
|
+
/**
|
|
53
|
+
* Remove item from wishlist.
|
|
54
|
+
*/
|
|
55
|
+
removeItem(token: string, itemId: string): Promise<IntegrationResponse<void>>;
|
|
56
|
+
/**
|
|
57
|
+
* Get all lists for a profile.
|
|
58
|
+
*/
|
|
59
|
+
getLists(token: string): Promise<IntegrationResponse<SwishListsResponse>>;
|
|
60
|
+
/**
|
|
61
|
+
* Create a new list.
|
|
62
|
+
*/
|
|
63
|
+
createList(token: string, name: string): Promise<IntegrationResponse<SwishListResponse>>;
|
|
64
|
+
/**
|
|
65
|
+
* Update a list.
|
|
66
|
+
*/
|
|
67
|
+
updateList(token: string, listId: string, name: string): Promise<IntegrationResponse<SwishListResponse>>;
|
|
68
|
+
/**
|
|
69
|
+
* Delete a list.
|
|
70
|
+
*/
|
|
71
|
+
deleteList(token: string, listId: string): Promise<IntegrationResponse<void>>;
|
|
72
|
+
/**
|
|
73
|
+
* Make a request using admin token (for session/profile management)
|
|
74
|
+
*/
|
|
75
|
+
private request;
|
|
76
|
+
/**
|
|
77
|
+
* Make a request using session/customer token (for items/lists operations)
|
|
78
|
+
*/
|
|
79
|
+
private requestWithToken;
|
|
80
|
+
/**
|
|
81
|
+
* Return not configured error
|
|
82
|
+
*/
|
|
83
|
+
private notConfiguredError;
|
|
84
|
+
/**
|
|
85
|
+
* Extract numeric ID from Shopify GID or return as-is if already numeric.
|
|
86
|
+
*/
|
|
87
|
+
private extractNumericId;
|
|
88
|
+
/**
|
|
89
|
+
* Normalize error responses
|
|
90
|
+
*/
|
|
91
|
+
private normalizeError;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=swish.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swish.service.d.ts","sourceRoot":"","sources":["../../../src/integrations/swish/swish.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAoB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EACL,WAAW,EACX,0BAA0B,EAC1B,4BAA4B,EAC5B,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;GAUG;AACH,qBACa,YAAa,YAAW,gBAAgB;IACnD,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IAExC;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI;IASnD;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,CAAC;IA8B/E;;OAEG;IACG,qBAAqB,CACzB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,mBAAmB,CAAC,4BAA4B,CAAC,CAAC;IAmC7D;;;;;;;;OAQG;IACG,YAAY,CAChB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM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