ns8-switchboard-interfaces
Advanced tools
Comparing version 1.0.57 to 1.0.58
@@ -0,2 +1,4 @@ | ||
/// <reference types="node" /> | ||
import { Merchant } from 'ns8-protect-models'; | ||
import { URL } from 'url'; | ||
export declare class SwitchContext { | ||
@@ -6,3 +8,6 @@ readonly apiBaseUrl: URL; | ||
data: any; | ||
constructor(apiBaseUrl: URL, merchant: Merchant, data: any); | ||
constructor(context: any); | ||
createWebhookUrl(action: string): URL; | ||
createTrackingUrl(): URL; | ||
getIntegrationAccessToken(type: string): string; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const url_1 = require("url"); | ||
class SwitchContext { | ||
constructor(apiBaseUrl, merchant, data) { | ||
this.apiBaseUrl = apiBaseUrl; | ||
this.merchant = merchant; | ||
this.data = data; | ||
constructor(context) { | ||
this.apiBaseUrl = context.apiBaseUrl; | ||
this.merchant = context.merchant; | ||
this.data = context.data; | ||
} | ||
createWebhookUrl(action) { | ||
const webhook = new url_1.URL(this.data.executorEndpoint, this.apiBaseUrl); | ||
const queryParams = new url_1.URLSearchParams({ | ||
action, | ||
authorization: this.merchant.accessTokens[0].id, | ||
}); | ||
webhook.search = queryParams.toString(); | ||
return webhook; | ||
} | ||
createTrackingUrl() { | ||
const url = new url_1.URL(this.data.trackingEndpoint, this.apiBaseUrl); | ||
const queryParams = new url_1.URLSearchParams({ | ||
authorization: this.merchant.accessTokens[0].id, | ||
}); | ||
url.search = queryParams.toString(); | ||
return url; | ||
} | ||
getIntegrationAccessToken(type) { | ||
return this.merchant.serviceIntegrations | ||
.find((integration) => integration.type === type) | ||
.token; | ||
} | ||
} | ||
exports.SwitchContext = SwitchContext; | ||
//# sourceMappingURL=SwitchContext.js.map |
{ | ||
"name": "ns8-switchboard-interfaces", | ||
"version": "1.0.57", | ||
"version": "1.0.58", | ||
"description": "Contains switchboard interfaces", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8618
123