Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(commonConfiguration: AnalyticsProviderConfiguration,
configuration: AdobeMarketingCloudWebProviderConfiguration) {
super(commonConfiguration);
this.client = new FSNetwork({ baseURL: this.kBaseEndpoint });
this.configuration = configuration;
// TODO: Trigger basic analytics.
}
constructor(configuration: ContentManagementSystemProviderConfiguration) {
super(configuration);
let baseURL;
// tslint:disable-next-line
if (configuration.environment === ContentManagementSystemEnvironment.PROD) {
baseURL = this.productionBaseEndpoint;
} else {
baseURL = this.developmentBaseEndpoint;
}
this.network = new FSNetwork({ baseURL });
this.cache = {};
}
import {
ContentManagementSystem,
CoreContentManagementSystemProvider
} from '@brandingbrand/fsengage';
import {
BrandCMSProductCatalog
} from '@brandingbrand/fsbrandcmsproductcatalog';
import FSNetwork from '@brandingbrand/fsnetwork';
import { PowerReviewsDataSource } from '@brandingbrand/fspowerreviews';
const origin = 'https://demo-ocapi.demandware.net';
const endpoint = 'https://demo-ocapi.demandware.net/s/SiteGenesis/dw/shop/v18_6';
const clientId = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
const networkClient = new FSNetwork({
baseURL: endpoint,
headers: {
origin,
'x-dw-client-id': clientId
}
});
export const demandware = new CommerceCloudDataSource({
endpoint,
clientId,
networkClient,
middleware: {
fetchCategory: [
(data: any, normalized: any) => {
normalized.middle = 'middle';
normalized.ware = 'middle';
const payload = {
payment: {
amount: checkout.paymentDue,
unique_token: paymentIdempotency,
credit_card: {
number: payment.paymentCard.number,
month: payment.paymentCard.expirationMonth,
year: payment.paymentCard.expirationYear,
verification_value: payment.paymentCard.securityCode,
first_name: fname,
last_name: lname
}
}
};
const newNetworkClient = new FSNetwork();
const paymentToken = await newNetworkClient
.post('https://elb.deposit.shopifycs.com/sessions', payload, {
headers: {
'Content-Type': 'application/json'
}
});
if (paymentToken && paymentToken.data && paymentToken.data.id) {
this.payment.idempotencyKey = paymentIdempotency;
this.payment.vaultId = paymentToken.data.id;
this.payment.amount = checkout.paymentDue;
} else {
throw new ShopifyAPIError('Unable to exchange payment details for token', paymentToken);
}
return checkout;
constructor(apiHost: string) {
this.client = new FSNetwork({
baseURL: apiHost + '/api/'
});
}
constructor(config: TurnToConfig) {
super();
this.client = new FSNetwork({
baseURL: config.endpoint + (config.version || 'v1.1/'),
headers: {
Authorization: 'Bearer ' + config.key
}
});
}
constructor(config: PowerReviewsConfig) {
super();
this.client = new FSNetwork({
baseURL: config.endpoint +
'm/' + config.merchantId +
'/l/' + (config.locale || 'en_US') + '/',
params: {
apikey: config.apikey
}
});
}
constructor(config: DemandwareConfig) {
this.client = config.networkClient || new FSNetwork({
baseURL: config.endpoint,
headers: {
'x-dw-client-id': config.clientId
}
});
this.masterToVariantProductId =
config.masterToVariantProductId || (p => p.product_id);
this.middleware = config.middleware || {};
this.sessionManager = new CommerceCookieSessionManager({
refreshToken: this.refreshToken,
createGuestToken: this.createGuestToken,
createLoginToken: this.createLoginToken,
destroyToken: this.destroyToken,
sessionCookiesToToken: this.sessionCookiesToToken,
restoreCookies: config.restoreCookies
constructor(config: BazaarvoiceConfig) {
super();
this.client = new FSNetwork({
baseURL: config.endpoint,
params: {
apiversion: config.apiversion || '5.4',
passkey: config.passkey
}
});
}
constructor(props: ProductCarouselBlockProps) {
super(props);
this.state = {
sliderActiveSlide: SLIDER_1_FIRST_ITEM,
products: [],
loading: true
};
this.network = new FSNetwork({
baseURL: props.baseUrl
});
}