This repository was archived by the owner on Feb 19, 2025. It is now read-only.

File tree

317 files changed

+47066
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searcx below for content that may be hidden.

317 files changed

+47066
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ All of codebases in this repo should be reviewed by our team, to ensure they are
2828
---
2929
### E
3030
* Elastic (https://cloud.elastic.co) - Searching / Cong Nguyen, 2021/09/20
31+
* Ello (https://ello.co) - Social / Cong Nguyen, 2021/09/23
3132

3233
---
3334
### F
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var g;
2+
3+
// This works in non-strict mode
4+
g = (function() {
5+
return this;
6+
})();
7+
8+
try {
9+
// This works if eval is allowed (see CSP)
10+
g = g || new Function("return this")();
11+
} catch (e) {
12+
// This works if the window reference is available
13+
if (typeof window === "object") g = window;
14+
}
15+
16+
// g can still be undefined, but nothing to do about it...
17+
// We return undefined, instead of nothing here, so it's
18+
// easier to handle this case. if(!global) { ...}
19+
20+
module.exports = g;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module.exports = function(originalModule) {
2+
if (!originalModule.webpackPolyfill) {
3+
var module = Object.create(originalModule);
4+
// module.parent = undefined by default
5+
if (!module.children) module.children = [];
6+
Object.defineProperty(module, "loaded", {
7+
enumerable: true,
8+
get: function() {
9+
return module.l;
10+
}
11+
});
12+
Object.defineProperty(module, "id", {
13+
enumerable: true,
14+
get: function() {
15+
return module.i;
16+
}
17+
});
18+
Object.defineProperty(module, "exports", {
19+
enumerable: true
20+
});
21+
module.webpackPolyfill = 1;
22+
}
23+
return module;
24+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module.exports = function(module) {
2+
if (!module.webpackPolyfill) {
3+
module.deprecate = function() {};
4+
module.paths = [];
5+
// module.parent = undefined by default
6+
if (!module.children) module.children = [];
7+
Object.defineProperty(module, "loaded", {
8+
enumerable: true,
9+
get: function() {
10+
return module.l;
11+
}
12+
});
13+
Object.defineProperty(module, "id", {
14+
enumerable: true,
15+
get: function() {
16+
return module.i;
17+
}
18+
});
19+
module.webpackPolyfill = 1;
20+
}
21+
return module;
22+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
const envEl = document.querySelector('meta[name="webappEnv"]')
2+
if (envEl) {
3+
const webappEnv = JSON.parse(decodeURI(envEl.getAttribute('content')))
4+
module.exports = {
5+
API_DOMAIN: webappEnv.API_DOMAIN || webappEnv.AUTH_DOMAIN,
6+
APP_DEBUG: webappEnv.APP_DEBUG,
7+
AUTH_CLIENT_ID: webappEnv.AUTH_CLIENT_ID,
8+
AUTH_DOMAIN: webappEnv.AUTH_DOMAIN,
9+
LOGO_MARK: webappEnv.LOGO_MARK,
10+
NODE_ENV: process.env.NODE_ENV,
11+
PROMO_HOST: webappEnv.PROMO_HOST,
12+
SEGMENT_WRITE_KEY: webappEnv.SEGMENT_WRITE_KEY,
13+
USE_LOCAL_EMOJI: (process.env.USE_LOCAL_EMOJI === 'true'),
14+
}
15+
} else if (typeof window !== 'undefined' && typeof window.webappEnv !== 'undefined') {
16+
module.exports = {
17+
API_DOMAIN: window.webappEnv.API_DOMAIN || window.webappEnv.AUTH_DOMAIN,
18+
APP_DEBUG: window.webappEnv.APP_DEBUG,
19+
AUTH_CLIENT_ID: window.webappEnv.AUTH_CLIENT_ID,
20+
AUTH_DOMAIN: window.webappEnv.AUTH_DOMAIN,
21+
LOGO_MARK: window.webappEnv.LOGO_MARK,
22+
NODE_ENV: process.env.NODE_ENV,
23+
PROMO_HOST: window.webappEnv.PROMO_HOST,
24+
SEGMENT_WRITE_KEY: window.webappEnv.SEGMENT_WRITE_KEY,
25+
USE_LOCAL_EMOJI: (process.env.USE_LOCAL_EMOJI === 'true'),
26+
}
27+
} else {
28+
module.exports = {
29+
API_DOMAIN: process.env.API_DOMAIN || process.env.AUTH_DOMAIN,
30+
APP_DEBUG: (process.env.APP_DEBUG === 'true'),
31+
AUTH_CLIENT_ID: process.env.AUTH_CLIENT_ID,
32+
AUTH_CLIENT_SECRET: process.env.AUTH_CLIENT_SECRET,
33+
AUTH_DOMAIN: process.env.AUTH_DOMAIN,
34+
LOGO_MARK: process.env.LOGO_MARK,
35+
NODE_ENV: process.env.NODE_ENV,
36+
PROMO_HOST: process.env.PROMO_HOST,
37+
SEGMENT_WRITE_KEY: process.env.SEGMENT_WRITE_KEY,
38+
USE_LOCAL_EMOJI: (process.env.USE_LOCAL_EMOJI === 'true'),
39+
}
40+
}
41+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { TRACK } from '../constants/action_types'
2+
3+
export function trackEvent(label, options = {}) {
4+
return {
5+
type: TRACK.EVENT,
6+
meta: {},
7+
payload: {
8+
label,
9+
options,
10+
},
11+
}
12+
}
13+
14+
export function trackInitialPage() {
15+
return {
16+
type: TRACK.INITIAL_PAGE,
17+
meta: {},
18+
payload: {},
19+
}
20+
}
21+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import { LOAD_STREAM } from '../constants/action_types'
2+
import { ARTIST_INVITES, ARTIST_INVITE_SUBMISSIONS } from '../constants/mapping_types'
3+
import { artistInvites as artistInvitesApi, artistInviteDetail } from '../networking/api'
4+
import { artistInvites as artistInvitesRenderable, artistInviteSubmissionsAsGrid, artistInviteSubmissionsAsList } from '../components/streams/StreamRenderables'
5+
6+
export const loadArtistInvites = isPreview => (
7+
{
8+
type: LOAD_STREAM,
9+
payload: { endpoint: artistInvitesApi(isPreview) },
10+
meta: {
11+
mappingType: ARTIST_INVITES,
12+
renderStream: {
13+
asList: artistInvitesRenderable,
14+
asGrid: artistInvitesRenderable,
15+
},
16+
},
17+
}
18+
)
19+
20+
export const loadArtistInviteDetail = slug => (
21+
{
22+
type: LOAD_STREAM,
23+
payload: { endpoint: artistInviteDetail(slug) },
24+
meta: {
25+
mappingType: ARTIST_INVITES,
26+
},
27+
}
28+
)
29+
30+
export const loadArtistInviteSubmissions = (path, key, slug, headerText) => (
31+
{
32+
type: LOAD_STREAM,
33+
payload: { endpoint: { path: `${path}&per_page=25` } },
34+
meta: {
35+
mappingType: ARTIST_INVITE_SUBMISSIONS,
36+
renderStream: {
37+
asList: ids => artistInviteSubmissionsAsList(ids, headerText),
38+
asGrid: (ids, colCount) => artistInviteSubmissionsAsGrid(ids, colCount, headerText),
39+
},
40+
resultKey: `/creative-briefs/${slug}/${key}`,
41+
},
42+
}
43+
)
44+
45+
export const sendAdminAction = action => (
46+
{
47+
type: LOAD_STREAM,
48+
meta: {
49+
mappingType: ARTIST_INVITE_SUBMISSIONS,
50+
updateResult: false,
51+
},
52+
payload: {
53+
body: action.get('body').toJS(),
54+
endpoint: { path: action.get('href') },
55+
method: action.get('method'),
56+
},
57+
}
58+
)
59+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
import { AUTHENTICATION } from '../constants/action_types'
2+
import {
3+
loginToken,
4+
logout as logoutEndpoint,
5+
emailConfirmation as emailConfirmationEndpoint,
6+
checkConfirmationCode as checkConfirmationCodeEndpoint,
7+
forgotPassword,
8+
resetPassword,
9+
refreshAuthToken,
10+
webappToken,
11+
} from '../networking/api'
12+
import * as ENV from '../../env'
13+
14+
export function clearAuthToken() {
15+
return {
16+
type: AUTHENTICATION.CLEAR_AUTH_TOKEN,
17+
}
18+
}
19+
20+
export function getUserCredentials(email, password, meta) {
21+
return {
22+
type: AUTHENTICATION.USER,
23+
payload: {
24+
endpoint: loginToken(),
25+
method: 'POST',
26+
body: {
27+
email,
28+
password,
29+
grant_type: 'password',
30+
client_id: ENV.AUTH_CLIENT_ID,
31+
},
32+
},
33+
meta,
34+
}
35+
}
36+
37+
export function logout() {
38+
return {
39+
type: AUTHENTICATION.LOGOUT,
40+
payload: {
41+
endpoint: logoutEndpoint(),
42+
method: 'DELETE',
43+
},
44+
}
45+
}
46+
47+
export function refreshAuthenticationToken(refreshToken) {
48+
return {
49+
type: AUTHENTICATION.REFRESH,
50+
payload: {
51+
endpoint: refreshAuthToken(refreshToken),
52+
method: 'POST',
53+
body: {
54+
refresh_token: refreshToken,
55+
grant_type: 'refresh_token',
56+
client_id: ENV.AUTH_CLIENT_ID,
57+
},
58+
},
59+
}
60+
}
61+
62+
export function sendForgotPasswordRequest(email) {
63+
return {
64+
type: AUTHENTICATION.FORGOT_PASSWORD,
65+
payload: {
66+
endpoint: forgotPassword(),
67+
method: 'POST',
68+
body: {
69+
email,
70+
},
71+
},
72+
}
73+
}
74+
75+
export function sendResetPasswordRequest(password, resetPasswordToken) {
76+
return {
77+
type: AUTHENTICATION.RESET_PASSWORD,
78+
payload: {
79+
endpoint: resetPassword(),
80+
method: 'PUT',
81+
body: {
82+
password,
83+
reset_password_token: resetPasswordToken,
84+
},
85+
},
86+
}
87+
}
88+
89+
export function sendEmailForConfirmation(email) {
90+
return {
91+
type: AUTHENTICATION.SEND_EMAIL_FOR_CONFIRMATION,
92+
payload: {
93+
body: { email },
94+
endpoint: emailConfirmationEndpoint(),
95+
method: 'POST',
96+
},
97+
}
98+
}
99+
100+
export function checkConfirmationCode({ email, code }) {
101+
return {
102+
type: AUTHENTICATION.CHECK_CONFIRMATION_CODE,
103+
payload: {
104+
body: { email, code },
105+
endpoint: checkConfirmationCodeEndpoint(),
106+
method: 'POST',
107+
},
108+
}
109+
}
110+
111+
export function signIn(email, password) {
112+
return {
113+
type: AUTHENTICATION.SIGN_IN,
114+
payload: {
115+
method: 'POST',
116+
email,
117+
password,
118+
},
119+
}
120+
}
121+
122+
export function fetchPublicToken() {
123+
return {
124+
type: AUTHENTICATION.PUBLIC,
125+
payload: {
126+
endpoint: webappToken(),
127+
method: 'GET',
128+
},
129+
}
130+
}
131+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* eslint-disable import/prefer-default-export */
2+
import { LOAD_STREAM } from '../constants/action_types'
3+
import { BADGES } from '../constants/mapping_types'
4+
import { badges } from '../networking/api'
5+
6+
export function loadBadges() {
7+
return {
8+
type: LOAD_STREAM,
9+
payload: { endpoint: badges() },
10+
meta: {
11+
mappingType: BADGES,
12+
resultKey: '/badges',
13+
},
14+
}
15+
}
16+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { LOAD_STREAM } from '../constants/action_types'
2+
import { CATEGORY_POSTS } from '../constants/mapping_types'
3+
4+
export function sendCategoryPostAction(action) {
5+
return {
6+
type: LOAD_STREAM,
7+
meta: {
8+
mappingType: CATEGORY_POSTS,
9+
updateResult: false,
10+
},
11+
payload: {
12+
endpoint: { path: action.get('href') },
13+
method: action.get('method'),
14+
},
15+
}
16+
}
17+
18+
export default sendCategoryPostAction

0 commit comments

Comments
 (0)