How to use the mwp-core/lib/util/cookieUtils.parseMemberCookie function in mwp-core

To help you get started, we’ve selected a few mwp-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github meetup / meetup-web-platform / packages / mwp-core / src / renderers / server-render.jsx View on Github external
const requestLanguage = request.getLanguage();

	return {
		apiUrl: API_ROUTE_PATH,
		baseUrl: host,
		basename: requestLanguage === 'en-US' ? '' : `/${requestLanguage}`, // basename is the 'base path' for the application - usually a localeCode
		enableServiceWorker,
		requestLanguage,
		supportedLangs: server.settings.app.supportedLangs,
		initialNow: new Date().getTime(),
		isProdApi: server.settings.app.api.isProd,
		isQL: parseMemberCookie(state).ql === 'true',
		memberId: parseMemberCookie(state).id, // deprecated, use member.id
		// the member cookie is not structured the same way as the member object returned from /member/self
		// be careful relying on it to have the same properties downstream
		member: parseMemberCookie(state),
		variants: getVariants(state),
		entryPath: url.pathname, // the path that the user entered the app on
		media: getMedia(userAgent, userAgentDevice),
		browserId: parseBrowserIdCookie(state),
		clientIp,
		siftSessionId: parseSiftSessionCookie(state),
		isBot: isBot(request.headers['user-agent']),
	};
};
github meetup / meetup-web-platform / packages / mwp-core / src / renderers / server-render.jsx View on Github external
initializeStore(resolvedRoutes).then(store => {
				// the initial addFlags call will only be key'd by member ID
				return addFlags(store, { id: parseMemberCookie(request.state).id })
					.then(() => populateStore(store))
					.then(
						store =>
							// create tracer and immediately invoke the resulting function.
							// trace should start before rendering, finish after rendering
							newrelic.createTracer('serverRender', getRouterRenderer)({
								request,
								h,
								appContext,
								routes: resolvedRoutes,
								store,
								scripts,
								cssLinks,
							}) // immediately invoke callback
					);
			})
github meetup / meetup-web-platform / packages / mwp-core / src / renderers / server-render.jsx View on Github external
const host = `${requestProtocol}://${domain}`;
	const userAgent = headers['user-agent'];
	const userAgentDevice = headers['x-ua-device'] || ''; // set by fastly
	const requestLanguage = request.getLanguage();

	return {
		apiUrl: API_ROUTE_PATH,
		baseUrl: host,
		basename: requestLanguage === 'en-US' ? '' : `/${requestLanguage}`, // basename is the 'base path' for the application - usually a localeCode
		enableServiceWorker,
		requestLanguage,
		supportedLangs: server.settings.app.supportedLangs,
		initialNow: new Date().getTime(),
		isProdApi: server.settings.app.api.isProd,
		isQL: parseMemberCookie(state).ql === 'true',
		memberId: parseMemberCookie(state).id, // deprecated, use member.id
		// the member cookie is not structured the same way as the member object returned from /member/self
		// be careful relying on it to have the same properties downstream
		member: parseMemberCookie(state),
		variants: getVariants(state),
		entryPath: url.pathname, // the path that the user entered the app on
		media: getMedia(userAgent, userAgentDevice),
		browserId: parseBrowserIdCookie(state),
		clientIp,
		siftSessionId: parseSiftSessionCookie(state),
		isBot: isBot(request.headers['user-agent']),
	};
};
github meetup / meetup-web-platform / packages / mwp-core / src / renderers / server-render.jsx View on Github external
info.remoteAddress;
	const host = `${requestProtocol}://${domain}`;
	const userAgent = headers['user-agent'];
	const userAgentDevice = headers['x-ua-device'] || ''; // set by fastly
	const requestLanguage = request.getLanguage();

	return {
		apiUrl: API_ROUTE_PATH,
		baseUrl: host,
		basename: requestLanguage === 'en-US' ? '' : `/${requestLanguage}`, // basename is the 'base path' for the application - usually a localeCode
		enableServiceWorker,
		requestLanguage,
		supportedLangs: server.settings.app.supportedLangs,
		initialNow: new Date().getTime(),
		isProdApi: server.settings.app.api.isProd,
		isQL: parseMemberCookie(state).ql === 'true',
		memberId: parseMemberCookie(state).id, // deprecated, use member.id
		// the member cookie is not structured the same way as the member object returned from /member/self
		// be careful relying on it to have the same properties downstream
		member: parseMemberCookie(state),
		variants: getVariants(state),
		entryPath: url.pathname, // the path that the user entered the app on
		media: getMedia(userAgent, userAgentDevice),
		browserId: parseBrowserIdCookie(state),
		clientIp,
		siftSessionId: parseSiftSessionCookie(state),
		isBot: isBot(request.headers['user-agent']),
	};
};

mwp-core

Core utilities for MWP apps

MIT
Latest version published 7 months ago

Package Health Score

39 / 100
Full package analysis

Similar packages