Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use happychat-client npm package #23630

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions client/me/happychat/index.jsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
/** @format */

/**
* /*
* External Deps
*
* @format
* External dependencies
*/

import React from 'react';
import page from 'page';
import { translate } from 'i18n-calypso';

/*
Internal deps
*/
/**
* Internal dependencies
*/
import config from 'config';
import controller from 'me/controller';
import Happychat from './main';
import { setDocumentHeadTitle } from 'state/document-head/actions';
import { makeLayout, render as clientRender } from 'controller';
import HappychatClient from 'happychat-client';
import wpcom from 'lib/wp';

const renderChat = ( context, next ) => {
context.store.dispatch( setDocumentHeadTitle( translate( 'Chat', { textOnly: true } ) ) );
context.primary = <Happychat />;
HappychatClient.open( {
nodeId: 'primary',
authentication: {
type: 'wpcom-proxy-iframe',
options: {
proxy: wpcom,
},
},
entry: 'chat',
} );
next();
};

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
"eslint-plugin-react": "7.1.0",
"eslint-plugin-wpcalypso": "3.4.1",
"glob": "7.0.3",
"happychat-client": "0.0.1",
"husky": "0.13.3",
"ignore": "3.3.5",
"jest": "22.0.3",
Expand Down
4 changes: 4 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ const webpackConfig = {
},
getAliasesForExtensions()
),
// This is needed because babel doesn't play well with symlinks, this allows node_modules to
// work as symlinks (`npm link`) needed when developing one of the dependencies.
// Reference https://github.com/babel/babel-loader/issues/149
symlinks: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should measure how this change impacts the Webpack compile times.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will look into that when there will be a proper HC-Calypso integration in place. This is more of an experiment to test the authentication. However I don't think it would impact compile times as it will affect only npm linked packages' path.

},
node: false,
plugins: _.compact( [
Expand Down